Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
CameraPane.java
....@@ -106,7 +106,7 @@
106106 static boolean OEIL = true;
107107 static boolean OEILONCE = false; // do oeilon then oeiloff
108108 static boolean LOOKAT = true;
109
-static boolean RANDOM = true; // false;
109
+static boolean SWITCH = true; // false;
110110 static boolean HANDLES = false; // selection doesn't work!!
111111 static boolean PAINTMODE = false;
112112
....@@ -1628,7 +1628,7 @@
16281628
16291629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16301630
1631
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
16321632
16331633 /**/
16341634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -2140,7 +2140,7 @@
21402140 System.err.println("LIVE = " + Globals.isLIVE());
21412141
21422142 if (!Globals.isLIVE()) // save sound
2143
- GrafreeD.savesound = true; // wav.save();
2143
+ Grafreed.savesound = true; // wav.save();
21442144 // else
21452145 repaint(); // start loop // may 2013
21462146 }
....@@ -2267,7 +2267,7 @@
22672267
22682268 void ToggleRandom()
22692269 {
2270
- RANDOM ^= true;
2270
+ SWITCH ^= true;
22712271 }
22722272
22732273 void ToggleHandles()
....@@ -8075,12 +8075,16 @@
80758075 {
80768076 String texname = tex;
80778077
8078
- String[] split = tex.split("Textures");
8079
- if (split.length > 1)
8080
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8081
- else
8082
- if (!texname.startsWith("/"))
8083
- texname = "/Users/nbriere/Textures/" + texname;
8078
+// String[] split = tex.split("Textures");
8079
+// if (split.length > 1)
8080
+// texname = "/Users/nbriere/Textures" + split[split.length-1];
8081
+// else
8082
+// if (!texname.startsWith("/"))
8083
+// texname = "/Users/nbriere/Textures/" + texname;
8084
+ if (!new File(tex).exists())
8085
+ {
8086
+ texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8087
+ }
80848088
80858089 if (CACHETEXTURE)
80868090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9538,7 +9542,7 @@
95389542
95399543 if (!BOXMODE)
95409544 {
9541
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9545
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95429546 }
95439547
95449548 if (!BOXMODE)
....@@ -9576,7 +9580,7 @@
95769580 ABORTED = false;
95779581 }
95789582 else
9579
- GrafreeD.wav.cursor += 735 * ACSIZE;
9583
+ Grafreed.wav.cursor += 735 * ACSIZE;
95809584
95819585 if (false)
95829586 {
....@@ -10239,11 +10243,11 @@
1023910243
1024010244 public void display(GLAutoDrawable drawable)
1024110245 {
10242
- if (GrafreeD.savesound && GrafreeD.hassound)
10246
+ if (Grafreed.savesound && Grafreed.hassound)
1024310247 {
10244
- GrafreeD.wav.save();
10245
- GrafreeD.savesound = false;
10246
- GrafreeD.hassound = false;
10248
+ Grafreed.wav.save();
10249
+ Grafreed.savesound = false;
10250
+ Grafreed.hassound = false;
1024710251 }
1024810252 // if (DEBUG_SELECTION)
1024910253 // {
....@@ -10373,7 +10377,7 @@
1037310377 Object3D theobject = object;
1037410378 Object3D theparent = object.parent;
1037510379 object.parent = null;
10376
- object = (Object3D)GrafreeD.clone(object);
10380
+ object = (Object3D)Grafreed.clone(object);
1037710381 object.Stripify();
1037810382 if (theobject.selection == null || theobject.selection.Size() == 0)
1037910383 theobject.PreprocessOcclusion(this);
....@@ -11279,8 +11283,8 @@
1127911283 e.printStackTrace();
1128011284 }
1128111285
11282
- if (GrafreeD.RENDERME > 0)
11283
- GrafreeD.RENDERME--; // mechante magouille
11286
+ if (Grafreed.RENDERME > 0)
11287
+ Grafreed.RENDERME--; // mechante magouille
1128411288
1128511289 Globals.ONESTEP = false;
1128611290 }
....@@ -12603,8 +12607,10 @@
1260312607 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1260412608
1260512609 "SUB temp.x, one.x, ndotl.x;" +
12606
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12607
- "ADD temp.y, one.y, options2.y;" + // sursurface
12610
+ // Tuning for default skin
12611
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12612
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12613
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1260812614 "MUL temp.x, temp.x, temp.y;" +
1260912615
1261012616 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12752,7 +12758,7 @@
1275212758 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275312759 "FLR final.x, final.y;" +
1275412760 "SUB final.y, final.y, final.x;" +
12755
- //"MUL final.x, final.x, c256i;" +
12761
+ "MUL final.x, final.x, c256i;" +
1275612762 "MOV final.z, zero.x;" +
1275712763 "MOV final.a, one.w;":""
1275812764 ) +
....@@ -12760,7 +12766,7 @@
1276012766 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276112767 "FLR final.x, final.y;" +
1276212768 "SUB final.y, final.y, final.x;" +
12763
- //"MUL final.x, final.x, c256i;" +
12769
+ "MUL final.x, final.x, c256i;" +
1276412770 "MOV final.z, zero.x;" +
1276512771 "MOV final.a, one.w;":""
1276612772 ) +
....@@ -13513,7 +13519,7 @@
1351313519 public void mousePressed(MouseEvent e)
1351413520 {
1351513521 //System.out.println("mousePressed: " + e);
13516
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351713523 }
1351813524
1351913525 static long prevtime = 0;
....@@ -13589,8 +13595,8 @@
1358913595 // mode |= META;
1359013596 //}
1359113597
13592
- SetMouseMode(WHEEL | e.getModifiersEx());
13593
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359413600 anchorX = ax;
1359513601 anchorY = ay;
1359613602 prevX = px;
....@@ -13650,6 +13656,10 @@
1365013656 // wasliveok = true;
1365113657 // waslive = false;
1365213658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1365313663 // source == timer
1365413664 if (mouseDown)
1365513665 {
....@@ -13688,7 +13698,7 @@
1368813698
1368913699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369013700
13691
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369213702 {
1369313703 if (!wasliveok)
1369413704 return;
....@@ -13705,7 +13715,7 @@
1370513715 // touched = true; // main DL
1370613716 if (isRenderer)
1370713717 {
13708
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1370913719 }
1371013720
1371113721 selectX = anchorX = x;
....@@ -13718,7 +13728,7 @@
1371813728 clicked = true;
1371913729 hold = false;
1372013730
13721
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372213732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372313733 {
1372413734 // System.out.println("RESTART II " + modifiers);
....@@ -13749,7 +13759,7 @@
1374913759 info.camera = renderCamera;
1375013760 info.x = x;
1375113761 info.y = y;
13752
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1375313763 editObj = object.doEditClick(info, 0);
1375413764 if (!editObj)
1375513765 {
....@@ -13778,7 +13788,7 @@
1377813788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377913789 }
1378013790 else
13781
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378213792
1378313793 //try { Thread.sleep(1); } catch (Exception ex) {}
1378413794 }
....@@ -14015,7 +14025,7 @@
1401514025 {
1401614026 Globals.lighttouched = true;
1401714027 }
14018
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401914029 }
1402014030 //else
1402114031 }
....@@ -14115,7 +14125,7 @@
1411514125 int X, Y;
1411614126 boolean SX, SY;
1411714127
14118
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1411914129 {
1412014130 if (IsFrozen())
1412114131 {
....@@ -14124,17 +14134,17 @@
1412414134
1412514135 drag = true; // NEW
1412614136
14127
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412814138
1412914139 X = x;
1413014140 Y = y;
1413114141 // floating state for animation
14132
- MODIFIERS = modifiers;
14133
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1413414144 if (false) // modifiers != 0)
1413514145 {
1413614146 //new Exception().printStackTrace();
14137
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1413814148 System.out.println("SHIFT = " + SHIFT);
1413914149 System.out.println("CONTROL = " + COMMAND);
1414014150 System.out.println("META = " + META);
....@@ -14154,7 +14164,7 @@
1415414164 info.camera = renderCamera;
1415514165 info.x = x;
1415614166 info.y = y;
14157
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415814168 } else
1415914169 {
1416014170 if (x < startX)
....@@ -14353,9 +14363,9 @@
1435314363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435414364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435514365
14356
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1435714367 timeout = true;
14358
- else
14368
+// ?? May 2019 else
1435914369 // timer.setDelay((modifiers & 128) != 0?0:350);
1436014370 mouseDown = false;
1436114371 if (!control && !command) // june 2013
....@@ -14465,7 +14475,7 @@
1446514475 System.out.println("keyReleased: " + e);
1446614476 }
1446714477
14468
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1446914479 {
1447014480 //System.out.println("SetMouseMode = " + modifiers);
1447114481 //modifiers &= ~1024;
....@@ -14477,25 +14487,25 @@
1447714487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447814488 // return;
1447914489 //System.out.println("SetMode = " + modifiers);
14480
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1448114491 {
1448214492 mouseMode |= ZOOM;
1448314493 }
1448414494
1448514495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14486
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1448714497 {
1448814498 mouseMode |= VR; // BACKFORTH;
1448914499 }
14490
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449114501 {
1449214502 mouseMode |= SELECT;
1449314503 }
14494
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1449514505 {
1449614506 mouseMode |= SELECT;
1449714507 }
14498
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449914509 {
1450014510 mouseMode &= ~VR;
1450114511 mouseMode |= TRANSLATE;
....@@ -14524,7 +14534,7 @@
1452414534
1452514535 if (isRenderer) //
1452614536 {
14527
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1452814538 }
1452914539
1453014540 Globals.theRenderer.keyPressed(key);
....@@ -14860,7 +14870,7 @@
1486014870 //RESIZETEXTURE ^= true;
1486114871 //break;
1486214872 case 'z':
14863
- RENDERSHADOW ^= true;
14873
+ Globals.RENDERSHADOW ^= true;
1486414874 Globals.lighttouched = true;
1486514875 repaint();
1486614876 break;
....@@ -14984,7 +14994,7 @@
1498414994 //mode = ROTATE;
1498514995 if ((MODIFIERS & COMMAND) == 0) // VR??
1498614996 {
14987
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1498814998 }
1498914999 }
1499015000
....@@ -15120,7 +15130,7 @@
1512015130 {
1512115131 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512215132 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15123
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15133
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1512415134 {
1512515135 mouseMoved(e);
1512615136 } else
....@@ -15557,6 +15567,7 @@
1555715567 public boolean mouseDown(Event evt, int x, int y)
1555815568 {
1555915569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1556015571 /*
1556115572 locked = true;
1556215573 drag = false;
....@@ -15600,7 +15611,7 @@
1560015611 {
1560115612 keyPressed(0, modifiers);
1560215613 }
15603
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1560415615 return true;
1560515616 }
1560615617
....@@ -15718,7 +15729,7 @@
1571815729 {
1571915730 keyReleased(0, 0);
1572015731 }
15721
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1572215733 return true;
1572315734 }
1572415735
....@@ -16416,16 +16427,16 @@
1641616427 System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2]));
1641716428 }
1641816429
16419
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16430
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642016431 }
1642116432 }
1642216433
1642316434 if (!movingcamera && !PAINTMODE)
1642416435 object.editWindow.ScreenFitPoint(); // fev 2014
1642516436
16426
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16437
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1642716438 {
16428
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16439
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1642916440
1643016441 Object3D group = new Object3D("inst" + paintcount++);
1643116442
....@@ -16581,7 +16592,7 @@
1658116592 gl.glDisable(gl.GL_CULL_FACE);
1658216593 }
1658316594
16584
- if (!RENDERSHADOW)
16595
+ if (!Globals.RENDERSHADOW)
1658516596 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658616597
1658716598 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16591,7 +16602,7 @@
1659116602 //gl.glColorMask(false, false, false, false);
1659216603
1659316604 //render_scene_from_light_view(gl, drawable, 0, 0);
16594
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16605
+ if (Globals.RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
1659516606 {
1659616607 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659716608