Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
CameraPane.java
....@@ -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
....@@ -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;
....@@ -14946,7 +14953,9 @@
1494614953 case 'E' : COMPACT ^= true;
1494714954 repaint();
1494814955 break;
14949
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1495014959 repaint();
1495114960 break;
1495214961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14972,13 +14981,7 @@
1497214981 repaint();
1497314982 break;
1497414983 case 'l':
14975
- lightMode ^= true;
14976
- Globals.lighttouched = true;
14977
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14978
- targetLookAt.set(manipCamera.lookAt);
14979
- repaint();
14980
- break;
14981
- case 'L':
14984
+ //case 'L':
1498214985 if (lightMode)
1498314986 {
1498414987 lightMode = false;
....@@ -15125,7 +15128,10 @@
1512515128 // kompactbit = 6;
1512615129 // break;
1512715130 case ' ':
15128
- ObjEditor.theFrame.ToggleFullScreen();
15131
+ lightMode ^= true;
15132
+ Globals.lighttouched = true;
15133
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15134
+ targetLookAt.set(manipCamera.lookAt);
1512915135 repaint();
1513015136 break;
1513115137 //case '`' :
....@@ -15709,6 +15715,7 @@
1570915715 info.bounds.y += (height - desired) / 2;
1571015716 }
1571115717 }
15718
+
1571215719 info.g = gr;
1571315720 info.camera = renderCamera;
1571415721 /*
....@@ -15718,6 +15725,8 @@
1571815725 */
1571915726 if (!isRenderer)
1572015727 {
15728
+ Grafreed.Assert(object != null);
15729
+ Grafreed.Assert(object.selection != null);
1572115730 if (object.selection.Size() > 0)
1572215731 {
1572315732 int hitSomething = object.selection.get(0).hitSomething;
....@@ -16551,6 +16560,14 @@
1655116560 }
1655216561 }
1655316562
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
+
1655416571 class SelectBuffer implements GLEventListener
1655516572 {
1655616573
....@@ -16630,6 +16647,17 @@
1663016647
1663116648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1663216649
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
+
1663316661 //int tmp = selection_view;
1663416662 //selection_view = -1;
1663516663 int temp = DrawMode();
....@@ -16641,6 +16669,17 @@
1664116669 // temp = DEFAULT; // patch for selection debug
1664216670 Globals.drawMode = temp; // WARNING
1664316671
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
+
1664416683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1664516684
1664616685 // trying different ways of getting the depth info over
....@@ -16746,27 +16785,29 @@
1674616785 if (!movingcamera && !PAINTMODE)
1674716786 object.GetWindow().ScreenFitPoint(); // fev 2014
1674816787
16749
- 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)
1675016789 {
16751
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16752
-
16753
- Object3D group = new Object3D("inst" + paintcount++);
16754
-
16755
- group.CreateMaterial(); // use a void leaf to select instances
16756
-
16757
- group.add(paintobj); // link
16758
-
16759
- object.GetWindow().SnapObject(group);
16760
-
16761
- Object3D folder = object.GetWindow().copy;
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1676216791
1676316792 if (object.GetWindow().copy.selection.Size() > 0)
16764
- folder = object.GetWindow().copy.selection.elementAt(0);
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1676516795
16766
- folder.add(group);
16767
-
16768
- object.GetWindow().ResetModel();
16769
- object.GetWindow().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
+ }
1677016811 }
1677116812 else
1677216813 paintcount = 0;