Normand Briere
2019-07-20 0a52bd4800459cd9935f360d7ca9555b6bea2146
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)
....@@ -8503,7 +8510,7 @@
85038510 return texture!=null?texture.texturedata:null;
85048511 }
85058512
8506
- boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
8513
+ com.sun.opengl.util.texture.Texture BindTexture(String tex, boolean bump, int resolution) throws Exception
85078514 {
85088515 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
85098516 {
....@@ -8515,7 +8522,7 @@
85158522 com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution);
85168523
85178524 if (texture == null)
8518
- return false;
8525
+ return texture;
85198526 /**/
85208527
85218528 if (textureon || tex.equals("DEFAULT_TEXTURE") || tex.equals("DEFAULT_TEXTURE_BUMP") || tex.equals("WHITE_NOISE")) // || tex.equals("IMMORTAL"))
....@@ -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;
....@@ -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 '`' :
....@@ -15708,6 +15715,7 @@
1570815715 info.bounds.y += (height - desired) / 2;
1570915716 }
1571015717 }
15718
+
1571115719 info.g = gr;
1571215720 info.camera = renderCamera;
1571315721 /*
....@@ -15717,23 +15725,44 @@
1571715725 */
1571815726 if (!isRenderer)
1571915727 {
15720
- object.drawEditHandles(info, 0);
15721
-
15722
- 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)
1572315731 {
15724
- 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)
1572515738 {
15726
- case Object3D.hitCenter: gr.setColor(Color.pink);
15727
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15728
- break;
15729
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15730
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15731
- break;
15732
- case Object3D.hitScale: gr.setColor(Color.cyan);
15733
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15734
- 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;
1573515746 }
15736
-
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
+ }
1573715766 }
1573815767 }
1573915768 }
....@@ -16531,6 +16560,14 @@
1653116560 }
1653216561 }
1653316562
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
+
1653416571 class SelectBuffer implements GLEventListener
1653516572 {
1653616573
....@@ -16610,6 +16647,17 @@
1661016647
1661116648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1661216649
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
+
1661316661 //int tmp = selection_view;
1661416662 //selection_view = -1;
1661516663 int temp = DrawMode();
....@@ -16621,6 +16669,17 @@
1662116669 // temp = DEFAULT; // patch for selection debug
1662216670 Globals.drawMode = temp; // WARNING
1662316671
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
+
1662416683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1662516684
1662616685 // trying different ways of getting the depth info over
....@@ -16726,27 +16785,29 @@
1672616785 if (!movingcamera && !PAINTMODE)
1672716786 object.GetWindow().ScreenFitPoint(); // fev 2014
1672816787
16729
- 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)
1673016789 {
16731
- Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16732
-
16733
- Object3D group = new Object3D("inst" + paintcount++);
16734
-
16735
- group.CreateMaterial(); // use a void leaf to select instances
16736
-
16737
- group.add(paintobj); // link
16738
-
16739
- object.GetWindow().SnapObject(group);
16740
-
16741
- Object3D folder = object.GetWindow().copy;
16790
+ //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1674216791
1674316792 if (object.GetWindow().copy.selection.Size() > 0)
16744
- folder = object.GetWindow().copy.selection.elementAt(0);
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1674516795
16746
- folder.add(group);
16747
-
16748
- object.GetWindow().ResetModel();
16749
- 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
+ }
1675016811 }
1675116812 else
1675216813 paintcount = 0;