Normand Briere
2019-05-05 623dc0fa8cbd9473830a1786f6d49fa808a09439
CameraPane.java
....@@ -56,8 +56,6 @@
5656 static int CURRENTANTIALIAS = 0; // 1;
5757 /*static*/ boolean RENDERSHADOW = true;
5858 /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal
59
- static boolean ANIMATION = false;
60
- static String filename;
6159
6260 boolean DISPLAYTEXT = false;
6361 //boolean REDUCETEXTURE = true;
....@@ -92,6 +90,8 @@
9290
9391 static int tickcount = 0; // slow pose issue
9492
93
+static boolean BUTTONLESSWHEEL = false;
94
+static boolean ZOOMBOXMODE = false;
9595 static boolean BOXMODE = false;
9696 static boolean IMAGEFLIP = false;
9797 static boolean SMOOTHFOCUS = false;
....@@ -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
....@@ -223,6 +223,11 @@
223223 public boolean IsBoxMode()
224224 {
225225 return BOXMODE;
226
+ }
227
+
228
+ public boolean IsZoomBoxMode()
229
+ {
230
+ return ZOOMBOXMODE;
226231 }
227232
228233 public void ClearDepth()
....@@ -1612,18 +1617,18 @@
16121617 //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);
16131618 if (!material.multiply)
16141619 {
1615
- display.color = color;
1620
+ display.color = material.color;
16161621 display.saturation = material.modulation;
16171622 }
16181623 else
16191624 {
1620
- display.color *= color*2;
1625
+ display.color *= material.color*2;
16211626 display.saturation *= material.modulation*2;
16221627 }
16231628
16241629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16251630
1626
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
16271632
16281633 /**/
16291634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -2135,7 +2140,7 @@
21352140 System.err.println("LIVE = " + Globals.isLIVE());
21362141
21372142 if (!Globals.isLIVE()) // save sound
2138
- GrafreeD.savesound = true; // wav.save();
2143
+ Grafreed.savesound = true; // wav.save();
21392144 // else
21402145 repaint(); // start loop // may 2013
21412146 }
....@@ -2168,6 +2173,11 @@
21682173 public void ToggleBoxMode()
21692174 {
21702175 BOXMODE ^= true;
2176
+ }
2177
+
2178
+ public void ToggleZoomBoxMode()
2179
+ {
2180
+ ZOOMBOXMODE ^= true;
21712181 }
21722182
21732183 public void ToggleSmoothFocus()
....@@ -2257,7 +2267,7 @@
22572267
22582268 void ToggleRandom()
22592269 {
2260
- RANDOM ^= true;
2270
+ SWITCH ^= true;
22612271 }
22622272
22632273 void ToggleHandles()
....@@ -4196,6 +4206,7 @@
41964206
41974207 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
41984208 {
4209
+ new Exception().printStackTrace();
41994210 System.exit(0);
42004211 com.sun.opengl.util.texture.Texture texture = null;
42014212
....@@ -8064,12 +8075,16 @@
80648075 {
80658076 String texname = tex;
80668077
8067
- String[] split = tex.split("Textures");
8068
- if (split.length > 1)
8069
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8070
- else
8071
- if (!texname.startsWith("/"))
8072
- 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
+ }
80738088
80748089 if (CACHETEXTURE)
80758090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9382,7 +9397,7 @@
93829397 //gl.glFlush();
93839398 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93849399
9385
- if (ANIMATION && ABORTED)
9400
+ if (Globals.ANIMATION && ABORTED)
93869401 {
93879402 System.err.println(" ABORTED FRAME");
93889403 break;
....@@ -9412,7 +9427,7 @@
94129427 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94139428
94149429 // save image
9415
- if (ANIMATION && !ABORTED)
9430
+ if (Globals.ANIMATION && !ABORTED)
94169431 {
94179432 VPwidth = viewport[2];
94189433 VPheight = viewport[3];
....@@ -9523,11 +9538,11 @@
95239538
95249539 // imagecount++;
95259540
9526
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9541
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
95279542
95289543 if (!BOXMODE)
95299544 {
9530
- 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) + ")");
95319546 }
95329547
95339548 if (!BOXMODE)
....@@ -9565,7 +9580,7 @@
95659580 ABORTED = false;
95669581 }
95679582 else
9568
- GrafreeD.wav.cursor += 735 * ACSIZE;
9583
+ Grafreed.wav.cursor += 735 * ACSIZE;
95699584
95709585 if (false)
95719586 {
....@@ -10228,11 +10243,11 @@
1022810243
1022910244 public void display(GLAutoDrawable drawable)
1023010245 {
10231
- if (GrafreeD.savesound && GrafreeD.hassound)
10246
+ if (Grafreed.savesound && Grafreed.hassound)
1023210247 {
10233
- GrafreeD.wav.save();
10234
- GrafreeD.savesound = false;
10235
- GrafreeD.hassound = false;
10248
+ Grafreed.wav.save();
10249
+ Grafreed.savesound = false;
10250
+ Grafreed.hassound = false;
1023610251 }
1023710252 // if (DEBUG_SELECTION)
1023810253 // {
....@@ -10362,7 +10377,7 @@
1036210377 Object3D theobject = object;
1036310378 Object3D theparent = object.parent;
1036410379 object.parent = null;
10365
- object = (Object3D)GrafreeD.clone(object);
10380
+ object = (Object3D)Grafreed.clone(object);
1036610381 object.Stripify();
1036710382 if (theobject.selection == null || theobject.selection.Size() == 0)
1036810383 theobject.PreprocessOcclusion(this);
....@@ -11247,8 +11262,14 @@
1124711262 {
1124811263 renderpass++;
1124911264 // System.out.println("Draw object... ");
11265
+ STEP = 1;
1125011266 if (FAST) // in case there is no script
11251
- STEP = 16;
11267
+ STEP = 8;
11268
+
11269
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11270
+ {
11271
+ STEP *= 4;
11272
+ }
1125211273
1125311274 //object.FullInvariants();
1125411275
....@@ -11262,8 +11283,8 @@
1126211283 e.printStackTrace();
1126311284 }
1126411285
11265
- if (GrafreeD.RENDERME > 0)
11266
- GrafreeD.RENDERME--; // mechante magouille
11286
+ if (Grafreed.RENDERME > 0)
11287
+ Grafreed.RENDERME--; // mechante magouille
1126711288
1126811289 Globals.ONESTEP = false;
1126911290 }
....@@ -12586,8 +12607,10 @@
1258612607 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1258712608
1258812609 "SUB temp.x, one.x, ndotl.x;" +
12589
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12590
- "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
1259112614 "MUL temp.x, temp.x, temp.y;" +
1259212615
1259312616 "MUL saturation, saturation, temp.xxxx;" +
....@@ -13496,7 +13519,7 @@
1349613519 public void mousePressed(MouseEvent e)
1349713520 {
1349813521 //System.out.println("mousePressed: " + e);
13499
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1350013523 }
1350113524
1350213525 static long prevtime = 0;
....@@ -13523,6 +13546,7 @@
1352313546
1352413547 //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio);
1352513548
13549
+ if (BUTTONLESSWHEEL)
1352613550 if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30)
1352713551 {
1352813552 return;
....@@ -13531,7 +13555,7 @@
1353113555 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
1353213556
1353313557 // TIMER
13534
- if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
13558
+ if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
1353513559 {
1353613560 keepboxmode = BOXMODE;
1353713561 keepsupport = SUPPORT;
....@@ -13571,8 +13595,8 @@
1357113595 // mode |= META;
1357213596 //}
1357313597
13574
- SetMouseMode(WHEEL | e.getModifiersEx());
13575
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1357613600 anchorX = ax;
1357713601 anchorY = ay;
1357813602 prevX = px;
....@@ -13632,6 +13656,10 @@
1363213656 // wasliveok = true;
1363313657 // waslive = false;
1363413658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1363513663 // source == timer
1363613664 if (mouseDown)
1363713665 {
....@@ -13670,7 +13698,7 @@
1367013698
1367113699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1367213700
13673
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1367413702 {
1367513703 if (!wasliveok)
1367613704 return;
....@@ -13687,7 +13715,7 @@
1368713715 // touched = true; // main DL
1368813716 if (isRenderer)
1368913717 {
13690
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1369113719 }
1369213720
1369313721 selectX = anchorX = x;
....@@ -13700,7 +13728,7 @@
1370013728 clicked = true;
1370113729 hold = false;
1370213730
13703
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1370413732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1370513733 {
1370613734 // System.out.println("RESTART II " + modifiers);
....@@ -13731,7 +13759,7 @@
1373113759 info.camera = renderCamera;
1373213760 info.x = x;
1373313761 info.y = y;
13734
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1373513763 editObj = object.doEditClick(info, 0);
1373613764 if (!editObj)
1373713765 {
....@@ -13748,11 +13776,11 @@
1374813776
1374913777 public void mouseDragged(MouseEvent e)
1375013778 {
13779
+ //System.out.println("mouseDragged: " + e);
1375113780 if (isRenderer)
1375213781 movingcamera = true;
1375313782 //if (drawing)
1375413783 //return;
13755
- //System.out.println("mouseDragged: " + e);
1375613784 if ((e.getModifiersEx() & CTRL) != 0
1375713785 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1375813786 {
....@@ -13760,7 +13788,7 @@
1376013788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1376113789 }
1376213790 else
13763
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1376413792
1376513793 //try { Thread.sleep(1); } catch (Exception ex) {}
1376613794 }
....@@ -13933,6 +13961,7 @@
1393313961
1393413962 public void run()
1393513963 {
13964
+ new Exception().printStackTrace();
1393613965 System.exit(0);
1393713966 for (;;)
1393813967 {
....@@ -13996,7 +14025,7 @@
1399614025 {
1399714026 Globals.lighttouched = true;
1399814027 }
13999
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1400014029 }
1400114030 //else
1400214031 }
....@@ -14096,7 +14125,7 @@
1409614125 int X, Y;
1409714126 boolean SX, SY;
1409814127
14099
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1410014129 {
1410114130 if (IsFrozen())
1410214131 {
....@@ -14105,17 +14134,17 @@
1410514134
1410614135 drag = true; // NEW
1410714136
14108
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1410914138
1411014139 X = x;
1411114140 Y = y;
1411214141 // floating state for animation
14113
- MODIFIERS = modifiers;
14114
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1411514144 if (false) // modifiers != 0)
1411614145 {
1411714146 //new Exception().printStackTrace();
14118
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1411914148 System.out.println("SHIFT = " + SHIFT);
1412014149 System.out.println("CONTROL = " + COMMAND);
1412114150 System.out.println("META = " + META);
....@@ -14135,7 +14164,7 @@
1413514164 info.camera = renderCamera;
1413614165 info.x = x;
1413714166 info.y = y;
14138
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1413914168 } else
1414014169 {
1414114170 if (x < startX)
....@@ -14287,7 +14316,6 @@
1428714316 public void mouseMoved(MouseEvent e)
1428814317 {
1428914318 //System.out.println("mouseMoved: " + e);
14290
-
1429114319 if (isRenderer)
1429214320 return;
1429314321
....@@ -14335,9 +14363,9 @@
1433514363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1433614364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1433714365
14338
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1433914367 timeout = true;
14340
- else
14368
+// ?? May 2019 else
1434114369 // timer.setDelay((modifiers & 128) != 0?0:350);
1434214370 mouseDown = false;
1434314371 if (!control && !command) // june 2013
....@@ -14447,7 +14475,7 @@
1444714475 System.out.println("keyReleased: " + e);
1444814476 }
1444914477
14450
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1445114479 {
1445214480 //System.out.println("SetMouseMode = " + modifiers);
1445314481 //modifiers &= ~1024;
....@@ -14459,25 +14487,25 @@
1445914487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1446014488 // return;
1446114489 //System.out.println("SetMode = " + modifiers);
14462
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1446314491 {
1446414492 mouseMode |= ZOOM;
1446514493 }
1446614494
1446714495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14468
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1446914497 {
1447014498 mouseMode |= VR; // BACKFORTH;
1447114499 }
14472
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1447314501 {
1447414502 mouseMode |= SELECT;
1447514503 }
14476
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1447714505 {
1447814506 mouseMode |= SELECT;
1447914507 }
14480
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1448114509 {
1448214510 mouseMode &= ~VR;
1448314511 mouseMode |= TRANSLATE;
....@@ -14506,7 +14534,7 @@
1450614534
1450714535 if (isRenderer) //
1450814536 {
14509
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1451014538 }
1451114539
1451214540 Globals.theRenderer.keyPressed(key);
....@@ -14966,7 +14994,7 @@
1496614994 //mode = ROTATE;
1496714995 if ((MODIFIERS & COMMAND) == 0) // VR??
1496814996 {
14969
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1497014998 }
1497114999 }
1497215000
....@@ -15100,8 +15128,9 @@
1510015128
1510115129 protected void processMouseMotionEvent(MouseEvent e)
1510215130 {
15103
- //System.out.println("processMouseMotionEvent: " + mouseMode);
15104
- if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15131
+ //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
15132
+ //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15133
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1510515134 {
1510615135 mouseMoved(e);
1510715136 } else
....@@ -15131,6 +15160,7 @@
1513115160
1513215161 void SelectParent()
1513315162 {
15163
+ new Exception().printStackTrace();
1513415164 System.exit(0);
1513515165 Composite group = (Composite) object;
1513615166 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15154,6 +15184,7 @@
1515415184
1515515185 void SelectChildren()
1515615186 {
15187
+ new Exception().printStackTrace();
1515715188 System.exit(0);
1515815189 /*
1515915190 Composite group = (Composite) object;
....@@ -15536,6 +15567,7 @@
1553615567 public boolean mouseDown(Event evt, int x, int y)
1553715568 {
1553815569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1553915571 /*
1554015572 locked = true;
1554115573 drag = false;
....@@ -15579,7 +15611,7 @@
1557915611 {
1558015612 keyPressed(0, modifiers);
1558115613 }
15582
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1558315615 return true;
1558415616 }
1558515617
....@@ -15697,7 +15729,7 @@
1569715729 {
1569815730 keyReleased(0, 0);
1569915731 }
15700
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1570115733 return true;
1570215734 }
1570315735
....@@ -16267,6 +16299,7 @@
1626716299 {
1626816300 if (!selection)
1626916301 {
16302
+ new Exception().printStackTrace();
1627016303 System.exit(0);
1627116304 return;
1627216305 }
....@@ -16394,16 +16427,16 @@
1639416427 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]));
1639516428 }
1639616429
16397
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16430
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1639816431 }
1639916432 }
1640016433
1640116434 if (!movingcamera && !PAINTMODE)
1640216435 object.editWindow.ScreenFitPoint(); // fev 2014
1640316436
16404
- 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)
1640516438 {
16406
- 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);
1640716440
1640816441 Object3D group = new Object3D("inst" + paintcount++);
1640916442