Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
CameraPane.java
....@@ -2065,7 +2065,7 @@
20652065 //System.err.println("Oeil on");
20662066 OEIL = true;
20672067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20692069 //pingthread.StepToTarget(true);
20702070 }
20712071
....@@ -2298,10 +2298,17 @@
22982298 HANDLES ^= true;
22992299 }
23002300
2301
+ Object3D paintFolder;
2302
+
23012303 void TogglePaint()
23022304 {
23032305 PAINTMODE ^= true;
23042306 paintcount = 0;
2307
+
2308
+ if (PAINTMODE)
2309
+ {
2310
+ paintFolder = GetFolder();
2311
+ }
23052312 }
23062313
23072314 void SwapCamera(int a, int b)
....@@ -7923,7 +7930,7 @@
79237930 String pigment = Object3D.GetPigment(tex);
79247931 String bump = Object3D.GetBump(tex);
79257932
7926
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7933
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79277934 {
79287935 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79297936 // System.out.println("; bump = " + bump);
....@@ -7957,7 +7964,7 @@
79577964
79587965 String pigment = Object3D.GetPigment(tex);
79597966
7960
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7967
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79617968 {
79627969 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79637970 // System.out.println("; bump = " + bump);
....@@ -7986,7 +7993,7 @@
79867993
79877994 String bump = Object3D.GetBump(tex);
79887995
7989
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
7996
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
79907997 {
79917998 // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment);
79927999 // System.out.println("; bump = " + bump);
....@@ -8124,7 +8131,7 @@
81248131 usedtextures.put(pigment, pigment);
81258132 usedtextures.put(bump, bump);
81268133
8127
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8134
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81288135 {
81298136 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81308137 // System.out.println("; bump = " + bump);
....@@ -8166,7 +8173,7 @@
81668173
81678174 usedtextures.put(pigment, pigment);
81688175
8169
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8176
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
81708177 {
81718178 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
81728179 // System.out.println("; bump = " + bump);
....@@ -8199,7 +8206,7 @@
81998206
82008207 usedtextures.put(bump, bump);
82018208
8202
- if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
8209
+ //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES))
82038210 {
82048211 // System.out.print("BIND +++++++++++++++ pigment = " + pigment);
82058212 // System.out.println("; bump = " + bump);
....@@ -8510,7 +8517,7 @@
85108517 return false;
85118518 }
85128519
8513
- boolean newtex = false;
8520
+ //boolean newtex = false;
85148521
85158522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
85168523
....@@ -8542,7 +8549,7 @@
85428549 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT);
85438550 texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT);
85448551
8545
- return newtex;
8552
+ return true; // Warning: not used.
85468553 }
85478554
85488555 ShadowBuffer shadowPBuf;
....@@ -11028,9 +11035,9 @@
1102811035
1102911036 gl.glMatrixMode(GL.GL_MODELVIEW);
1103011037
11031
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11032
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11033
-//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);
1103411041 } else
1103511042 {
1103611043 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11041,7 +11048,7 @@
1104111048 //System.out.println("BLENDING ON");
1104211049 gl.glEnable(GL.GL_BLEND);
1104311050 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11044
-
11051
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1104511052 gl.glMatrixMode(gl.GL_PROJECTION);
1104611053 gl.glLoadIdentity();
1104711054
....@@ -11527,7 +11534,7 @@
1152711534 if ((TRACK || SHADOWTRACK) || zoomonce)
1152811535 {
1152911536 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11530
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11537
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1153111538 pingthread.StepToTarget(true); // true);
1153211539 // zoomonce = false;
1153311540 }
....@@ -13943,7 +13950,7 @@
1394313950
1394413951 // fev 2014???
1394513952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13946
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1394713954 pingthread.StepToTarget(true); // true);
1394813955 }
1394913956 // if (!LIVE)
....@@ -14297,12 +14304,12 @@
1429714304 void GoDown(int mod)
1429814305 {
1429914306 MODIFIERS |= COMMAND;
14300
- /*
14307
+ /**/
1430114308 if((mod&SHIFT) == SHIFT)
1430214309 manipCamera.RotatePosition(0, -speed);
1430314310 else
14304
- manipCamera.BackForth(0, -speed*delta, getWidth());
14305
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1430614313 if ((mod & SHIFT) == SHIFT)
1430714314 {
1430814315 mouseMode = mouseMode; // VR??
....@@ -14318,12 +14325,12 @@
1431814325 void GoUp(int mod)
1431914326 {
1432014327 MODIFIERS |= COMMAND;
14321
- /*
14328
+ /**/
1432214329 if((mod&SHIFT) == SHIFT)
1432314330 manipCamera.RotatePosition(0, speed);
1432414331 else
14325
- manipCamera.BackForth(0, speed*delta, getWidth());
14326
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1432714334 if ((mod & SHIFT) == SHIFT)
1432814335 {
1432914336 mouseMode = mouseMode;
....@@ -14339,12 +14346,12 @@
1433914346 void GoLeft(int mod)
1434014347 {
1434114348 MODIFIERS |= COMMAND;
14342
- /*
14349
+ /**/
1434314350 if((mod&SHIFT) == SHIFT)
14344
- manipCamera.RotatePosition(speed, 0);
14345
- else
1434614351 manipCamera.Translate(speed*delta, 0, getWidth());
14347
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1434814355 if ((mod & SHIFT) == SHIFT)
1434914356 {
1435014357 mouseMode = mouseMode;
....@@ -14360,12 +14367,12 @@
1436014367 void GoRight(int mod)
1436114368 {
1436214369 MODIFIERS |= COMMAND;
14363
- /*
14370
+ /**/
1436414371 if((mod&SHIFT) == SHIFT)
14365
- manipCamera.RotatePosition(-speed, 0);
14366
- else
1436714372 manipCamera.Translate(-speed*delta, 0, getWidth());
14368
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1436914376 if ((mod & SHIFT) == SHIFT)
1437014377 {
1437114378 mouseMode = mouseMode;
....@@ -14604,7 +14611,8 @@
1460414611 Globals.MOUSEDRAGGED = false;
1460514612
1460614613 movingcamera = false;
14607
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1460814616 //System.out.println("mouseReleased: " + e);
1460914617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1461014618 }
....@@ -14945,7 +14953,9 @@
1494514953 case 'E' : COMPACT ^= true;
1494614954 repaint();
1494714955 break;
14948
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1494914959 repaint();
1495014960 break;
1495114961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14971,13 +14981,7 @@
1497114981 repaint();
1497214982 break;
1497314983 case 'l':
14974
- lightMode ^= true;
14975
- Globals.lighttouched = true;
14976
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14977
- targetLookAt.set(manipCamera.lookAt);
14978
- repaint();
14979
- break;
14980
- case 'L':
14984
+ //case 'L':
1498114985 if (lightMode)
1498214986 {
1498314987 lightMode = false;
....@@ -15124,7 +15128,10 @@
1512415128 // kompactbit = 6;
1512515129 // break;
1512615130 case ' ':
15127
- ObjEditor.theFrame.ToggleFullScreen();
15131
+ lightMode ^= true;
15132
+ Globals.lighttouched = true;
15133
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15134
+ targetLookAt.set(manipCamera.lookAt);
1512815135 repaint();
1512915136 break;
1513015137 //case '`' :
....@@ -15172,6 +15179,7 @@
1517215179 ClearSelection();
1517315180 break;
1517415181 case '+':
15182
+
1517515183 /*
1517615184 //fontsize += 1;
1517715185 bbzoom *= 2;
....@@ -15189,17 +15197,17 @@
1518915197 case '=':
1519015198 IncDepth();
1519115199 //fontsize += 1;
15192
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1519315201 maskbit = 6;
1519415202 break;
1519515203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1519615204 DecDepth();
1519715205 maskbit = 5;
1519815206 //if(fontsize > 1) fontsize -= 1;
15199
- if (object.editWindow == null)
15200
- new Exception().printStackTrace();
15201
- else
15202
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1520315211 break;
1520415212 case '{':
1520515213 manipCamera.shaper_fovy /= 1.1;
....@@ -15423,7 +15431,7 @@
1542315431 }
1542415432 */
1542515433
15426
- object.editWindow.EditSelection(false);
15434
+ object.GetWindow().EditSelection(false);
1542715435 }
1542815436
1542915437 void SelectParent()
....@@ -15440,10 +15448,10 @@
1544015448 {
1544115449 //selectees.remove(i);
1544215450 System.out.println("select parent of " + elem);
15443
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1544415452 } else
1544515453 {
15446
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1544715455 }
1544815456
1544915457 first = false;
....@@ -15485,12 +15493,12 @@
1548515493 for (int j = 0; j < group.children.size(); j++)
1548615494 {
1548715495 elem = (Object3D) group.children.elementAt(j);
15488
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1548915497 first = false;
1549015498 }
1549115499 } else
1549215500 {
15493
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1549415502 }
1549515503
1549615504 first = false;
....@@ -15501,21 +15509,21 @@
1550115509 {
1550215510 //Composite group = (Composite) object;
1550315511 Object3D group = object;
15504
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1550515513 }
1550615514
1550715515 void ResetTransform(int mask)
1550815516 {
1550915517 //Composite group = (Composite) object;
1551015518 Object3D group = object;
15511
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1551215520 }
1551315521
1551415522 void FlipTransform()
1551515523 {
1551615524 //Composite group = (Composite) object;
1551715525 Object3D group = object;
15518
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1551915527 // group.editWindow.ReduceMesh(true);
1552015528 }
1552115529
....@@ -15523,7 +15531,7 @@
1552315531 {
1552415532 //Composite group = (Composite) object;
1552515533 Object3D group = object;
15526
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1552715535 // group.editWindow.ReduceMesh(true);
1552815536 }
1552915537
....@@ -15531,7 +15539,7 @@
1553115539 {
1553215540 //Composite group = (Composite) object;
1553315541 Object3D group = object;
15534
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1553515543 }
1553615544
1553715545 void IncDepth()
....@@ -15707,6 +15715,7 @@
1570715715 info.bounds.y += (height - desired) / 2;
1570815716 }
1570915717 }
15718
+
1571015719 info.g = gr;
1571115720 info.camera = renderCamera;
1571215721 /*
....@@ -15716,23 +15725,44 @@
1571615725 */
1571715726 if (!isRenderer)
1571815727 {
15719
- object.drawEditHandles(info, 0);
15720
-
15721
- 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)
1572215731 {
15723
- 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)
1572415738 {
15725
- case Object3D.hitCenter: gr.setColor(Color.pink);
15726
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15727
- break;
15728
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15729
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15730
- break;
15731
- case Object3D.hitScale: gr.setColor(Color.cyan);
15732
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15733
- 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;
1573415746 }
15735
-
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
+ }
1573615766 }
1573715767 }
1573815768 }
....@@ -16530,6 +16560,14 @@
1653016560 }
1653116561 }
1653216562
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
+
1653316571 class SelectBuffer implements GLEventListener
1653416572 {
1653516573
....@@ -16609,6 +16647,17 @@
1660916647
1661016648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1661116649
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
+
1661216661 //int tmp = selection_view;
1661316662 //selection_view = -1;
1661416663 int temp = DrawMode();
....@@ -16620,6 +16669,17 @@
1662016669 // temp = DEFAULT; // patch for selection debug
1662116670 Globals.drawMode = temp; // WARNING
1662216671
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
+
1662316683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1662416684
1662516685 // trying different ways of getting the depth info over
....@@ -16723,29 +16783,31 @@
1672316783 }
1672416784
1672516785 if (!movingcamera && !PAINTMODE)
16726
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1672716787
16728
- 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)
1672916789 {
16730
- 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);
1673116791
16732
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1673316795
16734
- group.CreateMaterial(); // use a void leaf to select instances
16735
-
16736
- group.add(paintobj); // link
16737
-
16738
- object.editWindow.SnapObject(group);
16739
-
16740
- Object3D folder = object.editWindow.copy;
16741
-
16742
- if (object.editWindow.copy.selection.Size() > 0)
16743
- folder = object.editWindow.copy.selection.elementAt(0);
16744
-
16745
- folder.add(group);
16746
-
16747
- object.editWindow.ResetModel();
16748
- 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
+ }
1674916811 }
1675016812 else
1675116813 paintcount = 0;