Normand Briere
2019-07-20 0a52bd4800459cd9935f360d7ca9555b6bea2146
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)
....@@ -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
....@@ -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 }
....@@ -13375,9 +13382,10 @@
1337513382 "DP3 " + dest + ".z," + "normals," + "eye;" +
1337613383 "MAX " + dest + ".w," + dest + ".z," + "eps.x;" +
1337713384 //"MOV " + dest + ".w," + "normal.z;" +
13378
- "MUL " + dest + ".z," + "params2.w," + dest + ".x;" +
13379
- "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" +
13380
- //"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
1338113389 "POW " + dest + ".w," + dest + ".w," + dest + ".z;" +
1338213390 "RCP " + dest + ".w," + dest + ".w;" +
1338313391 //"RSQ " + dest + ".w," + dest + ".w;" +
....@@ -13942,7 +13950,7 @@
1394213950
1394313951 // fev 2014???
1394413952 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
13945
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13953
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1394613954 pingthread.StepToTarget(true); // true);
1394713955 }
1394813956 // if (!LIVE)
....@@ -14296,12 +14304,12 @@
1429614304 void GoDown(int mod)
1429714305 {
1429814306 MODIFIERS |= COMMAND;
14299
- /*
14307
+ /**/
1430014308 if((mod&SHIFT) == SHIFT)
1430114309 manipCamera.RotatePosition(0, -speed);
1430214310 else
14303
- manipCamera.BackForth(0, -speed*delta, getWidth());
14304
- */
14311
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14312
+ /**/
1430514313 if ((mod & SHIFT) == SHIFT)
1430614314 {
1430714315 mouseMode = mouseMode; // VR??
....@@ -14317,12 +14325,12 @@
1431714325 void GoUp(int mod)
1431814326 {
1431914327 MODIFIERS |= COMMAND;
14320
- /*
14328
+ /**/
1432114329 if((mod&SHIFT) == SHIFT)
1432214330 manipCamera.RotatePosition(0, speed);
1432314331 else
14324
- manipCamera.BackForth(0, speed*delta, getWidth());
14325
- */
14332
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14333
+ /**/
1432614334 if ((mod & SHIFT) == SHIFT)
1432714335 {
1432814336 mouseMode = mouseMode;
....@@ -14338,12 +14346,12 @@
1433814346 void GoLeft(int mod)
1433914347 {
1434014348 MODIFIERS |= COMMAND;
14341
- /*
14349
+ /**/
1434214350 if((mod&SHIFT) == SHIFT)
14343
- manipCamera.RotatePosition(speed, 0);
14344
- else
1434514351 manipCamera.Translate(speed*delta, 0, getWidth());
14346
- */
14352
+ else
14353
+ manipCamera.RotatePosition(speed, 0);
14354
+ /**/
1434714355 if ((mod & SHIFT) == SHIFT)
1434814356 {
1434914357 mouseMode = mouseMode;
....@@ -14359,12 +14367,12 @@
1435914367 void GoRight(int mod)
1436014368 {
1436114369 MODIFIERS |= COMMAND;
14362
- /*
14370
+ /**/
1436314371 if((mod&SHIFT) == SHIFT)
14364
- manipCamera.RotatePosition(-speed, 0);
14365
- else
1436614372 manipCamera.Translate(-speed*delta, 0, getWidth());
14367
- */
14373
+ else
14374
+ manipCamera.RotatePosition(-speed, 0);
14375
+ /**/
1436814376 if ((mod & SHIFT) == SHIFT)
1436914377 {
1437014378 mouseMode = mouseMode;
....@@ -14603,7 +14611,8 @@
1460314611 Globals.MOUSEDRAGGED = false;
1460414612
1460514613 movingcamera = false;
14606
- X = Y = 0;
14614
+ X = 0; // getBounds().width/2;
14615
+ Y = 0; // getBounds().height/2;
1460714616 //System.out.println("mouseReleased: " + e);
1460814617 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1460914618 }
....@@ -14944,7 +14953,9 @@
1494414953 case 'E' : COMPACT ^= true;
1494514954 repaint();
1494614955 break;
14947
- case 'W' : DEBUGHSB ^= true;
14956
+ case 'W' : // Wide Window (fullscreen)
14957
+ //DEBUGHSB ^= true;
14958
+ ObjEditor.theFrame.ToggleFullScreen();
1494814959 repaint();
1494914960 break;
1495014961 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14970,13 +14981,7 @@
1497014981 repaint();
1497114982 break;
1497214983 case 'l':
14973
- lightMode ^= true;
14974
- Globals.lighttouched = true;
14975
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14976
- targetLookAt.set(manipCamera.lookAt);
14977
- repaint();
14978
- break;
14979
- case 'L':
14984
+ //case 'L':
1498014985 if (lightMode)
1498114986 {
1498214987 lightMode = false;
....@@ -15119,11 +15124,14 @@
1511915124 case '_':
1512015125 kompactbit = 5;
1512115126 break;
15122
- case '+':
15123
- kompactbit = 6;
15124
- break;
15127
+// case '+':
15128
+// kompactbit = 6;
15129
+// break;
1512515130 case ' ':
15126
- ObjEditor.theFrame.ToggleFullScreen();
15131
+ lightMode ^= true;
15132
+ Globals.lighttouched = true;
15133
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15134
+ targetLookAt.set(manipCamera.lookAt);
1512715135 repaint();
1512815136 break;
1512915137 //case '`' :
....@@ -15170,8 +15178,9 @@
1517015178 case DELETE:
1517115179 ClearSelection();
1517215180 break;
15173
- /*
1517415181 case '+':
15182
+
15183
+ /*
1517515184 //fontsize += 1;
1517615185 bbzoom *= 2;
1517715186 repaint();
....@@ -15188,17 +15197,17 @@
1518815197 case '=':
1518915198 IncDepth();
1519015199 //fontsize += 1;
15191
- object.editWindow.refreshContents(true);
15200
+ object.GetWindow().refreshContents(true);
1519215201 maskbit = 6;
1519315202 break;
1519415203 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1519515204 DecDepth();
1519615205 maskbit = 5;
1519715206 //if(fontsize > 1) fontsize -= 1;
15198
- if (object.editWindow == null)
15199
- new Exception().printStackTrace();
15200
- else
15201
- object.editWindow.refreshContents(true);
15207
+// if (object.editWindow == null)
15208
+// new Exception().printStackTrace();
15209
+// else
15210
+ object.GetWindow().refreshContents(true);
1520215211 break;
1520315212 case '{':
1520415213 manipCamera.shaper_fovy /= 1.1;
....@@ -15422,7 +15431,7 @@
1542215431 }
1542315432 */
1542415433
15425
- object.editWindow.EditSelection(false);
15434
+ object.GetWindow().EditSelection(false);
1542615435 }
1542715436
1542815437 void SelectParent()
....@@ -15439,10 +15448,10 @@
1543915448 {
1544015449 //selectees.remove(i);
1544115450 System.out.println("select parent of " + elem);
15442
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15451
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1544315452 } else
1544415453 {
15445
- group.editWindow.Select(elem.GetTreePath(), first, true);
15454
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1544615455 }
1544715456
1544815457 first = false;
....@@ -15484,12 +15493,12 @@
1548415493 for (int j = 0; j < group.children.size(); j++)
1548515494 {
1548615495 elem = (Object3D) group.children.elementAt(j);
15487
- object.editWindow.Select(elem.GetTreePath(), first, true);
15496
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1548815497 first = false;
1548915498 }
1549015499 } else
1549115500 {
15492
- object.editWindow.Select(elem.GetTreePath(), first, true);
15501
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1549315502 }
1549415503
1549515504 first = false;
....@@ -15500,21 +15509,21 @@
1550015509 {
1550115510 //Composite group = (Composite) object;
1550215511 Object3D group = object;
15503
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15512
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1550415513 }
1550515514
1550615515 void ResetTransform(int mask)
1550715516 {
1550815517 //Composite group = (Composite) object;
1550915518 Object3D group = object;
15510
- group.editWindow.ResetTransform(mask);
15519
+ group.GetWindow().ResetTransform(mask);
1551115520 }
1551215521
1551315522 void FlipTransform()
1551415523 {
1551515524 //Composite group = (Composite) object;
1551615525 Object3D group = object;
15517
- group.editWindow.FlipTransform();
15526
+ group.GetWindow().FlipTransform();
1551815527 // group.editWindow.ReduceMesh(true);
1551915528 }
1552015529
....@@ -15522,7 +15531,7 @@
1552215531 {
1552315532 //Composite group = (Composite) object;
1552415533 Object3D group = object;
15525
- group.editWindow.PrintMemory();
15534
+ group.GetWindow().PrintMemory();
1552615535 // group.editWindow.ReduceMesh(true);
1552715536 }
1552815537
....@@ -15530,7 +15539,7 @@
1553015539 {
1553115540 //Composite group = (Composite) object;
1553215541 Object3D group = object;
15533
- group.editWindow.ResetCentroid();
15542
+ group.GetWindow().ResetCentroid();
1553415543 }
1553515544
1553615545 void IncDepth()
....@@ -15706,6 +15715,7 @@
1570615715 info.bounds.y += (height - desired) / 2;
1570715716 }
1570815717 }
15718
+
1570915719 info.g = gr;
1571015720 info.camera = renderCamera;
1571115721 /*
....@@ -15715,23 +15725,44 @@
1571515725 */
1571615726 if (!isRenderer)
1571715727 {
15718
- object.drawEditHandles(info, 0);
15719
-
15720
- 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)
1572115731 {
15722
- 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)
1572315738 {
15724
- case Object3D.hitCenter: gr.setColor(Color.pink);
15725
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15726
- break;
15727
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15728
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15729
- break;
15730
- case Object3D.hitScale: gr.setColor(Color.cyan);
15731
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15732
- 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;
1573315746 }
15734
-
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
+ }
1573515766 }
1573615767 }
1573715768 }
....@@ -16529,6 +16560,14 @@
1652916560 }
1653016561 }
1653116562
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
+
1653216571 class SelectBuffer implements GLEventListener
1653316572 {
1653416573
....@@ -16608,6 +16647,17 @@
1660816647
1660916648 //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
1661016649
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
+
1661116661 //int tmp = selection_view;
1661216662 //selection_view = -1;
1661316663 int temp = DrawMode();
....@@ -16619,6 +16669,17 @@
1661916669 // temp = DEFAULT; // patch for selection debug
1662016670 Globals.drawMode = temp; // WARNING
1662116671
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
+
1662216683 //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view);
1662316684
1662416685 // trying different ways of getting the depth info over
....@@ -16722,29 +16783,31 @@
1672216783 }
1672316784
1672416785 if (!movingcamera && !PAINTMODE)
16725
- object.editWindow.ScreenFitPoint(); // fev 2014
16786
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1672616787
16727
- 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)
1672816789 {
16729
- 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);
1673016791
16731
- Object3D group = new Object3D("inst" + paintcount++);
16792
+ if (object.GetWindow().copy.selection.Size() > 0)
16793
+ {
16794
+ Object3D paintobj = object.GetWindow().copy.selection.elementAt(0);
1673216795
16733
- group.CreateMaterial(); // use a void leaf to select instances
16734
-
16735
- group.add(paintobj); // link
16736
-
16737
- object.editWindow.SnapObject(group);
16738
-
16739
- Object3D folder = object.editWindow.copy;
16740
-
16741
- if (object.editWindow.copy.selection.Size() > 0)
16742
- folder = object.editWindow.copy.selection.elementAt(0);
16743
-
16744
- folder.add(group);
16745
-
16746
- object.editWindow.ResetModel();
16747
- 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
+ }
1674816811 }
1674916812 else
1675016813 paintcount = 0;