Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -327,7 +326,7 @@
327326 cStatic.objectstack[materialdepth++] = obj;
328327 //System.out.println("material " + material);
329328 //Applet3D.tracein(this, selected);
330
- display.vector2buffer = obj.projectedVertices;
329
+ //display.vector2buffer = obj.projectedVertices;
331330 if (obj instanceof Camera)
332331 {
333332 display.options1[0] = material.shift;
....@@ -336,14 +335,28 @@
336335 display.options1[2] = material.shadowbias;
337336 display.options1[3] = material.aniso;
338337 display.options1[4] = material.anisoV;
338
+// System.out.println("display.options1[0] " + display.options1[0]);
339
+// System.out.println("display.options1[1] " + display.options1[1]);
340
+// System.out.println("display.options1[2] " + display.options1[2]);
341
+// System.out.println("display.options1[3] " + display.options1[3]);
342
+// System.out.println("display.options1[4] " + display.options1[4]);
339343 display.options2[0] = material.opacity;
340344 display.options2[1] = material.diffuse;
341345 display.options2[2] = material.factor;
346
+// System.out.println("display.options2[0] " + display.options2[0]);
347
+// System.out.println("display.options2[1] " + display.options2[1]);
348
+// System.out.println("display.options2[2] " + display.options2[2]);
342349
343350 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
351
+// System.out.println("display.options3[0] " + display.options3[0]);
352
+// System.out.println("display.options3[1] " + display.options3[1]);
353
+// System.out.println("display.options3[2] " + display.options3[2]);
344354 display.options4[0] = material.cameralight/0.2f;
345355 display.options4[1] = material.subsurface;
346356 display.options4[2] = material.sheen;
357
+// System.out.println("display.options4[0] " + display.options4[0]);
358
+// System.out.println("display.options4[1] " + display.options4[1]);
359
+// System.out.println("display.options4[2] " + display.options4[2]);
347360
348361 // if (display.CURRENTANTIALIAS > 0)
349362 // display.options3[3] /= 4;
....@@ -359,7 +372,7 @@
359372 /**/
360373 } else
361374 {
362
- DrawMaterial(material, selected);
375
+ DrawMaterial(material, selected, obj.projectedVertices);
363376 }
364377 } else
365378 {
....@@ -383,8 +396,8 @@
383396 cStatic.objectstack[materialdepth++] = obj;
384397 //System.out.println("material " + material);
385398 //Applet3D.tracein("selected ", selected);
386
- display.vector2buffer = obj.projectedVertices;
387
- display.DrawMaterial(material, selected);
399
+ //display.vector2buffer = obj.projectedVertices;
400
+ display.DrawMaterial(material, selected, obj.projectedVertices);
388401 }
389402 }
390403
....@@ -401,8 +414,8 @@
401414 materialdepth -= 1;
402415 if (materialdepth > 0)
403416 {
404
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
405
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
417
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
418
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
406419 }
407420 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
408421 } else if (selected && CameraPane.flash && obj.GetMaterial() != null)
....@@ -422,8 +435,8 @@
422435 materialdepth -= 1;
423436 if (materialdepth > 0)
424437 {
425
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
426
- display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
438
+ //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
439
+ display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
427440 }
428441 //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
429442 //else
....@@ -1611,7 +1624,7 @@
16111624 // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
16121625 }
16131626
1614
- void DrawMaterial(cMaterial material, boolean selected)
1627
+ void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others)
16151628 {
16161629 CameraPane display = this;
16171630 //new Exception().printStackTrace();
....@@ -1646,7 +1659,7 @@
16461659 colorV[0] = display.modelParams0[0] * material.diffuse;
16471660 colorV[1] = display.modelParams0[1] * material.diffuse;
16481661 colorV[2] = display.modelParams0[2] * material.diffuse;
1649
- colorV[3] = material.opacity;
1662
+ colorV[3] = 1; // material.opacity;
16501663
16511664 gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity);
16521665 //System.out.println("Opacity = " + opacity);
....@@ -1754,9 +1767,9 @@
17541767 display.modelParams7[2] = 0;
17551768 display.modelParams7[3] = 0;
17561769
1757
- display.modelParams6[0] = 100; // criss de bug de bump
1770
+ //display.modelParams6[0] = 100; // criss de bug de bump
17581771
1759
- Object3D.cVector2[] extparams = display.vector2buffer;
1772
+ Object3D.cVector2[] extparams = others; // display.vector2buffer;
17601773 if (extparams != null && extparams.length > 0 && extparams[0] != null)
17611774 {
17621775 display.modelParams6[0] = extparams[0].x / 1000.0f; // bump
....@@ -2052,7 +2065,7 @@
20522065 //System.err.println("Oeil on");
20532066 OEIL = true;
20542067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2055
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20562069 //pingthread.StepToTarget(true);
20572070 }
20582071
....@@ -2267,7 +2280,7 @@
22672280
22682281 void ToggleDebug()
22692282 {
2270
- DEBUG ^= true;
2283
+ Globals.DEBUG ^= true;
22712284 }
22722285
22732286 void ToggleLookAt()
....@@ -2285,10 +2298,17 @@
22852298 HANDLES ^= true;
22862299 }
22872300
2301
+ Object3D paintFolder;
2302
+
22882303 void TogglePaint()
22892304 {
22902305 PAINTMODE ^= true;
22912306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
22922312 }
22932313
22942314 void SwapCamera(int a, int b)
....@@ -7910,7 +7930,7 @@
79107930 String pigment = Object3D.GetPigment(tex);
79117931 String bump = Object3D.GetBump(tex);
79127932
7913
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79147934 {
79157935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79167936 // System.out.println("; bump = " + bump);
....@@ -7944,7 +7964,7 @@
79447964
79457965 String pigment = Object3D.GetPigment(tex);
79467966
7947
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7967
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79487968 {
79497969 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79507970 // System.out.println("; bump = " + bump);
....@@ -7973,7 +7993,7 @@
79737993
79747994 String bump = Object3D.GetBump(tex);
79757995
7976
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7996
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79777997 {
79787998 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79797999 // System.out.println("; bump = " + bump);
....@@ -8111,7 +8131,7 @@
81118131 usedtextures.put(pigment, pigment);
81128132 usedtextures.put(bump, bump);
81138133
8114
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81158135 {
81168136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81178137 // System.out.println("; bump = " + bump);
....@@ -8153,7 +8173,7 @@
81538173
81548174 usedtextures.put(pigment, pigment);
81558175
8156
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8176
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81578177 {
81588178 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81598179 // System.out.println("; bump = " + bump);
....@@ -8186,7 +8206,7 @@
81868206
81878207 usedtextures.put(bump, bump);
81888208
8189
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81908210 {
81918211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81928212 // System.out.println("; bump = " + bump);
....@@ -8497,7 +8517,7 @@
84978517 return false;
84988518 }
84998519
8500
- boolean newtex = false;
8520
+ //boolean newtex = false;
85018521
85028522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
85038523
....@@ -8529,7 +8549,7 @@
85298549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85308550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85318551
8532
- return newtex;
8552
+ return true; // Warning: not used.
85338553 }
85348554
85358555 ShadowBuffer shadowPBuf;
....@@ -9367,11 +9387,35 @@
93679387 jy8[3] = 0.5f;
93689388 }
93699389
9370
- float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
9390
+ float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
93719391 float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
93729392 float[] options3 = new float[]{1, 1, 1, 0}; // fog color
93739393 float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
93749394
9395
+ void ResetOptions()
9396
+ {
9397
+ options1[0] = 100;
9398
+ options1[1] = 0.025f;
9399
+ options1[2] = 0.01f;
9400
+ options1[3] = 0;
9401
+ options1[4] = 0;
9402
+
9403
+ options2[0] = 0;
9404
+ options2[1] = 0.75f;
9405
+ options2[2] = 0;
9406
+ options2[3] = 0;
9407
+
9408
+ options3[0] = 1;
9409
+ options3[1] = 1;
9410
+ options3[2] = 1;
9411
+ options3[3] = 0;
9412
+
9413
+ options4[0] = 1;
9414
+ options4[1] = 0;
9415
+ options4[2] = 1;
9416
+ options4[3] = 0;
9417
+ }
9418
+
93759419 static int imagecount = 0; // movie generation
93769420
93779421 static int jitter = 0;
....@@ -10482,6 +10526,7 @@
1048210526 ANTIALIAS = 0;
1048310527 //System.out.println("RESTART");
1048410528 AAtimer.restart();
10529
+ Globals.TIMERRUNNING = true;
1048510530 }
1048610531 }
1048710532 }
....@@ -10549,7 +10594,8 @@
1054910594 ambientOcclusion = false;
1055010595 }
1055110596
10552
- if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
10597
+ if (//Globals.lighttouched &&
10598
+ DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1055310599 {
1055410600 //if (RENDERSHADOW) // ?
1055510601 if (!IsFrozen())
....@@ -10989,9 +11035,9 @@
1098911035
1099011036 gl.glMatrixMode(GL.GL_MODELVIEW);
1099111037
10992
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
10993
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
10994
-//gl.glEnable(gl.GL_MULTISAMPLE);
11038
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11039
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11040
+gl.glEnable(gl.GL_MULTISAMPLE);
1099511041 } else
1099611042 {
1099711043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11002,7 +11048,7 @@
1100211048 //System.out.println("BLENDING ON");
1100311049 gl.glEnable(GL.GL_BLEND);
1100411050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11005
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1100611052 gl.glMatrixMode(gl.GL_PROJECTION);
1100711053 gl.glLoadIdentity();
1100811054
....@@ -11459,15 +11505,36 @@
1145911505
1146011506 static boolean zoomonce = false;
1146111507
11508
+ static void CreateSelectedPoint()
11509
+ {
11510
+ if (selectedpoint == null)
11511
+ {
11512
+ debugpointG = new Sphere();
11513
+ debugpointP = new Sphere();
11514
+ debugpointC = new Sphere();
11515
+ debugpointR = new Sphere();
11516
+
11517
+ selectedpoint = new Superellipsoid();
11518
+
11519
+ for (int i=0; i<8; i++)
11520
+ {
11521
+ debugpoints[i] = new Sphere();
11522
+ }
11523
+ }
11524
+ }
11525
+
1146211526 void DrawObject(GL gl, boolean draw)
1146311527 {
11528
+ // To clear camera values
11529
+ ResetOptions();
11530
+
1146411531 //System.out.println("DRAW OBJECT " + mouseDown);
1146511532 // DrawMode() = SELECTION;
1146611533 //GL gl = getGL();
1146711534 if ((TRACK || SHADOWTRACK) || zoomonce)
1146811535 {
1146911536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11470
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1147111538 pingthread.StepToTarget(true); // true);
1147211539 // zoomonce = false;
1147311540 }
....@@ -11539,8 +11606,9 @@
1153911606
1154011607 if (DrawMode() == DEFAULT)
1154111608 {
11542
- if (DEBUG)
11609
+ if (Globals.DEBUG)
1154311610 {
11611
+ CreateSelectedPoint();
1154411612 float radius = 0.05f;
1154511613 if (selectedpoint.radius != radius)
1154611614 {
....@@ -12027,7 +12095,7 @@
1202712095 for (int i = tp.size(); --i >= 0;)
1202812096 {
1202912097 //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
12030
- LA.xformPos(light, tp.get(i).GlobalTransform(), light);
12098
+ LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);
1203112099 }
1203212100
1203312101
....@@ -13297,7 +13365,8 @@
1329713365 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1329813366 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
1329913367 /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13300
- Object3D.cVector2[] vector2buffer;
13368
+
13369
+ //Object3D.cVector2[] vector2buffer;
1330113370
1330213371 // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea
1330313372 // OUT : diff, spec
....@@ -13313,9 +13382,10 @@
1331313382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1331413383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1331513384 //"MOV " + dest + ".w," + "normal.z;" +
13316
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13317
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13318
- //"MOV " + dest + ".z," + "params2.w;" +
13385
+// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET
13386
+// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13387
+
13388
+ "MOV " + dest + ".z," + "params2.w;" + // EXACT
1331913389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1332013390 "RCP " + dest + ".w," + dest + ".w;" +
1332113391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13820,6 +13890,7 @@
1382013890 else
1382113891 if (evt.getSource() == AAtimer)
1382213892 {
13893
+ Globals.TIMERRUNNING = false;
1382313894 if (mouseDown)
1382413895 {
1382513896 //new Exception().printStackTrace();
....@@ -13879,7 +13950,7 @@
1387913950
1388013951 // fev 2014???
1388113952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13882
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1388313954 pingthread.StepToTarget(true); // true);
1388413955 }
1388513956 // if (!LIVE)
....@@ -13894,6 +13965,7 @@
1389413965 return;
1389513966
1389613967 AAtimer.restart(); //
13968
+ Globals.TIMERRUNNING = true;
1389713969
1389813970 // waslive = LIVE;
1389913971 // LIVE = false;
....@@ -14232,12 +14304,12 @@
1423214304 void GoDown(int mod)
1423314305 {
1423414306 MODIFIERS |= COMMAND;
14235
- /*
14307
+ /**/
1423614308 if((mod&SHIFT) == SHIFT)
1423714309 manipCamera.RotatePosition(0, -speed);
1423814310 else
14239
- manipCamera.BackForth(0, -speed*delta, getWidth());
14240
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1424114313 if ((mod & SHIFT) == SHIFT)
1424214314 {
1424314315 mouseMode = mouseMode; // VR??
....@@ -14253,12 +14325,12 @@
1425314325 void GoUp(int mod)
1425414326 {
1425514327 MODIFIERS |= COMMAND;
14256
- /*
14328
+ /**/
1425714329 if((mod&SHIFT) == SHIFT)
1425814330 manipCamera.RotatePosition(0, speed);
1425914331 else
14260
- manipCamera.BackForth(0, speed*delta, getWidth());
14261
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1426214334 if ((mod & SHIFT) == SHIFT)
1426314335 {
1426414336 mouseMode = mouseMode;
....@@ -14274,12 +14346,12 @@
1427414346 void GoLeft(int mod)
1427514347 {
1427614348 MODIFIERS |= COMMAND;
14277
- /*
14349
+ /**/
1427814350 if((mod&SHIFT) == SHIFT)
14279
- manipCamera.RotatePosition(speed, 0);
14280
- else
1428114351 manipCamera.Translate(speed*delta, 0, getWidth());
14282
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1428314355 if ((mod & SHIFT) == SHIFT)
1428414356 {
1428514357 mouseMode = mouseMode;
....@@ -14295,12 +14367,12 @@
1429514367 void GoRight(int mod)
1429614368 {
1429714369 MODIFIERS |= COMMAND;
14298
- /*
14370
+ /**/
1429914371 if((mod&SHIFT) == SHIFT)
14300
- manipCamera.RotatePosition(-speed, 0);
14301
- else
1430214372 manipCamera.Translate(-speed*delta, 0, getWidth());
14303
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1430414376 if ((mod & SHIFT) == SHIFT)
1430514377 {
1430614378 mouseMode = mouseMode;
....@@ -14357,7 +14429,8 @@
1435714429 info.camera = renderCamera;
1435814430 info.x = x;
1435914431 info.y = y;
14360
- object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14432
+ object.GetWindow().copy
14433
+ .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1436114434 } else
1436214435 {
1436314436 if (x < startX)
....@@ -14521,7 +14594,9 @@
1452114594 ci.camera = renderCamera;
1452214595 if (!isRenderer)
1452314596 {
14524
- if (object.editWindow.copy.doEditClick(ci, 0))
14597
+ //ObjEditor editWindow = object.editWindow;
14598
+ //Object3D copy = editWindow.copy;
14599
+ if (object.doEditClick(ci, 0))
1452514600 {
1452614601 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1452714602 } else
....@@ -14536,7 +14611,8 @@
1453614611 Globals.MOUSEDRAGGED = false;
1453714612
1453814613 movingcamera = false;
14539
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1454014616 //System.out.println("mouseReleased: " + e);
1454114617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1454214618 }
....@@ -14877,7 +14953,9 @@
1487714953 case 'E' : COMPACT ^= true;
1487814954 repaint();
1487914955 break;
14880
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1488114959 repaint();
1488214960 break;
1488314961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14902,8 +14980,8 @@
1490214980 RevertCamera();
1490314981 repaint();
1490414982 break;
14905
- case 'L':
1490614983 case 'l':
14984
+ //case 'L':
1490714985 if (lightMode)
1490814986 {
1490914987 lightMode = false;
....@@ -15046,9 +15124,9 @@
1504615124 case '_':
1504715125 kompactbit = 5;
1504815126 break;
15049
- case '+':
15050
- kompactbit = 6;
15051
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1505215130 case ' ':
1505315131 lightMode ^= true;
1505415132 Globals.lighttouched = true;
....@@ -15060,6 +15138,7 @@
1506015138 case ESC:
1506115139 RENDERPROGRAM += 1;
1506215140 RENDERPROGRAM %= 3;
15141
+
1506315142 repaint();
1506415143 break;
1506515144 case 'Z':
....@@ -15099,8 +15178,9 @@
1509915178 case DELETE:
1510015179 ClearSelection();
1510115180 break;
15102
- /*
1510315181 case '+':
15182
+
15183
+ /*
1510415184 //fontsize += 1;
1510515185 bbzoom *= 2;
1510615186 repaint();
....@@ -15117,17 +15197,17 @@
1511715197 case '=':
1511815198 IncDepth();
1511915199 //fontsize += 1;
15120
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1512115201 maskbit = 6;
1512215202 break;
1512315203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1512415204 DecDepth();
1512515205 maskbit = 5;
1512615206 //if(fontsize > 1) fontsize -= 1;
15127
- if (object.editWindow == null)
15128
- new Exception().printStackTrace();
15129
- else
15130
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1513115211 break;
1513215212 case '{':
1513315213 manipCamera.shaper_fovy /= 1.1;
....@@ -15351,7 +15431,7 @@
1535115431 }
1535215432 */
1535315433
15354
- object.editWindow.EditSelection();
15434
+ object.GetWindow().EditSelection(false);
1535515435 }
1535615436
1535715437 void SelectParent()
....@@ -15368,10 +15448,10 @@
1536815448 {
1536915449 //selectees.remove(i);
1537015450 System.out.println("select parent of " + elem);
15371
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1537215452 } else
1537315453 {
15374
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1537515455 }
1537615456
1537715457 first = false;
....@@ -15413,12 +15493,12 @@
1541315493 for (int j = 0; j < group.children.size(); j++)
1541415494 {
1541515495 elem = (Object3D) group.children.elementAt(j);
15416
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1541715497 first = false;
1541815498 }
1541915499 } else
1542015500 {
15421
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1542215502 }
1542315503
1542415504 first = false;
....@@ -15429,21 +15509,21 @@
1542915509 {
1543015510 //Composite group = (Composite) object;
1543115511 Object3D group = object;
15432
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1543315513 }
1543415514
1543515515 void ResetTransform(int mask)
1543615516 {
1543715517 //Composite group = (Composite) object;
1543815518 Object3D group = object;
15439
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1544015520 }
1544115521
1544215522 void FlipTransform()
1544315523 {
1544415524 //Composite group = (Composite) object;
1544515525 Object3D group = object;
15446
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1544715527 // group.editWindow.ReduceMesh(true);
1544815528 }
1544915529
....@@ -15451,7 +15531,7 @@
1545115531 {
1545215532 //Composite group = (Composite) object;
1545315533 Object3D group = object;
15454
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1545515535 // group.editWindow.ReduceMesh(true);
1545615536 }
1545715537
....@@ -15459,7 +15539,7 @@
1545915539 {
1546015540 //Composite group = (Composite) object;
1546115541 Object3D group = object;
15462
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1546315543 }
1546415544
1546515545 void IncDepth()
....@@ -15635,6 +15715,7 @@
1563515715 info.bounds.y += (height - desired) / 2;
1563615716 }
1563715717 }
15718
+
1563815719 info.g = gr;
1563915720 info.camera = renderCamera;
1564015721 /*
....@@ -15644,23 +15725,44 @@
1564415725 */
1564515726 if (!isRenderer)
1564615727 {
15647
- object.drawEditHandles(info, 0);
15648
-
15649
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
15730
+ if (object.selection.Size() > 0)
1565015731 {
15651
- switch (object.selection.get(0).hitSomething)
15732
+ int hitSomething = object.selection.get(0).hitSomething;
15733
+
15734
+ info.DX = 0;
15735
+ info.DY = 0;
15736
+ info.W = 1;
15737
+ if (hitSomething == Object3D.hitCenter)
1565215738 {
15653
- case Object3D.hitCenter: gr.setColor(Color.pink);
15654
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15655
- break;
15656
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15657
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15658
- break;
15659
- case Object3D.hitScale: gr.setColor(Color.cyan);
15660
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15661
- break;
15739
+ info.DX = X;
15740
+ if (X != 0)
15741
+ info.DX -= info.bounds.width/2;
15742
+
15743
+ info.DY = Y;
15744
+ if (Y != 0)
15745
+ info.DY -= info.bounds.height/2;
1566215746 }
15663
-
15747
+
15748
+ object.drawEditHandles(info, 0);
15749
+
15750
+ if (drag && (X != 0 || Y != 0))
15751
+ {
15752
+ switch (hitSomething)
15753
+ {
15754
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15755
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15756
+ break;
15757
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15758
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15759
+ break;
15760
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15761
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15762
+ break;
15763
+ }
15764
+
15765
+ }
1566415766 }
1566515767 }
1566615768 }
....@@ -16363,16 +16465,16 @@
1636316465 cStatic.objectstack[materialdepth++] = checker;
1636416466 //System.out.println("material " + material);
1636516467 //Applet3D.tracein(this, selected);
16366
- vector2buffer = checker.projectedVertices;
16468
+ //vector2buffer = checker.projectedVertices;
1636716469
1636816470 //checker.GetMaterial().Draw(this, false); // true);
16369
- DrawMaterial(checker.GetMaterial(), false); // true);
16471
+ DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true);
1637016472
1637116473 materialdepth -= 1;
1637216474 if (materialdepth > 0)
1637316475 {
16374
- vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16375
- DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]);
16476
+ //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
16477
+ DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices);
1637616478 }
1637716479 //checker.GetMaterial().opacity = 1f;
1637816480 ////checker.GetMaterial().ambient = 1f;
....@@ -16458,6 +16560,14 @@
1645816560 }
1645916561 }
1646016562
16563
+ private Object3D GetFolder()
16564
+ {
16565
+ Object3D folder = object.GetWindow().copy;
16566
+ if (object.GetWindow().copy.selection.Size() > 0)
16567
+ folder = object.GetWindow().copy.selection.elementAt(0);
16568
+ return folder;
16569
+ }
16570
+
1646116571 class SelectBuffer implements GLEventListener
1646216572 {
1646316573
....@@ -16537,6 +16647,17 @@
1653716647
1653816648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1653916649
16650
+ if (PAINTMODE)
16651
+ {
16652
+ if (object.GetWindow().copy.selection.Size() > 0)
16653
+ {
16654
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16655
+
16656
+ // Make what you paint not selectable.
16657
+ paintobj.ResetSelectable();
16658
+ }
16659
+ }
16660
+
1654016661 //int tmp = selection_view;
1654116662 //selection_view = -1;
1654216663 int temp = DrawMode();
....@@ -16548,6 +16669,17 @@
1654816669 // temp = DEFAULT; // patch for selection debug
1654916670 Globals.drawMode = temp; // WARNING
1655016671
16672
+ if (PAINTMODE)
16673
+ {
16674
+ if (object.GetWindow().copy.selection.Size() > 0)
16675
+ {
16676
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
16677
+
16678
+ // Revert.
16679
+ paintobj.RestoreSelectable();
16680
+ }
16681
+ }
16682
+
1655116683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1655216684
1655316685 // trying different ways of getting the depth info over
....@@ -16595,6 +16727,8 @@
1659516727 // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]);
1659616728 // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
1659716729 // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
16730
+
16731
+ CreateSelectedPoint();
1659816732
1659916733 // Will fit the mesh !!!
1660016734 selectedpoint.toParent[0][0] = 0.0001;
....@@ -16649,29 +16783,31 @@
1664916783 }
1665016784
1665116785 if (!movingcamera && !PAINTMODE)
16652
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1665316787
16654
- if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16788
+ if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1665516789 {
16656
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1665716791
16658
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1665916795
16660
- group.CreateMaterial(); // use a void leaf to select instances
16661
-
16662
- group.add(paintobj); // link
16663
-
16664
- object.editWindow.SnapObject(group);
16665
-
16666
- Object3D folder = object.editWindow.copy;
16667
-
16668
- if (object.editWindow.copy.selection.Size() > 0)
16669
- folder = object.editWindow.copy.selection.elementAt(0);
16670
-
16671
- folder.add(group);
16672
-
16673
- object.editWindow.ResetModel();
16674
- object.editWindow.refreshContents();
16796
+ Object3D inst = new Object3D("inst" + paintcount++);
16797
+
16798
+ inst.CreateMaterial(); // use a void leaf to select instances
16799
+
16800
+ inst.add(paintobj); // link
16801
+
16802
+ object.GetWindow().SnapObject(inst);
16803
+
16804
+ Object3D folder = paintFolder; // GetFolder();
16805
+
16806
+ folder.add(inst);
16807
+
16808
+ object.GetWindow().ResetModel();
16809
+ object.GetWindow().refreshContents();
16810
+ }
1667516811 }
1667616812 else
1667716813 paintcount = 0;
....@@ -16710,6 +16846,11 @@
1671016846 //System.out.println("objects[color] = " + objects[color]);
1671116847 //objects[color].Select();
1671216848 indexcount = 0;
16849
+ ObjEditor window = object.GetWindow();
16850
+ if (window != null && deselect)
16851
+ {
16852
+ window.Select(null, deselect, true);
16853
+ }
1671316854 object.Select(color, deselect);
1671416855 }
1671516856
....@@ -17235,23 +17376,15 @@
1723517376 int AAbuffersize = 0;
1723617377
1723717378 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17379
+ static Superellipsoid selectedpoint;
1723917380 static Sphere previousselectedpoint = null;
17240
- static Sphere debugpointG = new Sphere();
17241
- static Sphere debugpointP = new Sphere();
17242
- static Sphere debugpointC = new Sphere();
17243
- static Sphere debugpointR = new Sphere();
17381
+ static Sphere debugpointG;
17382
+ static Sphere debugpointP;
17383
+ static Sphere debugpointC;
17384
+ static Sphere debugpointR;
1724417385
1724517386 static Sphere debugpoints[] = new Sphere[8];
1724617387
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517388 static void InitPoints(float radius)
1725617389 {
1725717390 for (int i=0; i<8; i++)