Normand Briere
2019-05-05 44b1501b5c4cd60ea67cc3d0971ed53f53b594e6
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,12 +1617,12 @@
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
....@@ -2170,6 +2175,11 @@
21702175 BOXMODE ^= true;
21712176 }
21722177
2178
+ public void ToggleZoomBoxMode()
2179
+ {
2180
+ ZOOMBOXMODE ^= true;
2181
+ }
2182
+
21732183 public void ToggleSmoothFocus()
21742184 {
21752185 SMOOTHFOCUS ^= true;
....@@ -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,7 +9538,7 @@
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 {
....@@ -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
....@@ -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;
....@@ -13670,7 +13694,7 @@
1367013694
1367113695 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1367213696
13673
- void clickStart(int x, int y, int modifiers)
13697
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1367413698 {
1367513699 if (!wasliveok)
1367613700 return;
....@@ -13687,7 +13711,7 @@
1368713711 // touched = true; // main DL
1368813712 if (isRenderer)
1368913713 {
13690
- SetMouseMode(modifiers);
13714
+ SetMouseMode(modifiers, modifiersex);
1369113715 }
1369213716
1369313717 selectX = anchorX = x;
....@@ -13700,7 +13724,7 @@
1370013724 clicked = true;
1370113725 hold = false;
1370213726
13703
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13727
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1370413728 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1370513729 {
1370613730 // System.out.println("RESTART II " + modifiers);
....@@ -13731,7 +13755,7 @@
1373113755 info.camera = renderCamera;
1373213756 info.x = x;
1373313757 info.y = y;
13734
- info.modifiers = modifiers;
13758
+ info.modifiers = modifiersex;
1373513759 editObj = object.doEditClick(info, 0);
1373613760 if (!editObj)
1373713761 {
....@@ -13748,11 +13772,11 @@
1374813772
1374913773 public void mouseDragged(MouseEvent e)
1375013774 {
13775
+ //System.out.println("mouseDragged: " + e);
1375113776 if (isRenderer)
1375213777 movingcamera = true;
1375313778 //if (drawing)
1375413779 //return;
13755
- //System.out.println("mouseDragged: " + e);
1375613780 if ((e.getModifiersEx() & CTRL) != 0
1375713781 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1375813782 {
....@@ -13760,7 +13784,7 @@
1376013784 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1376113785 }
1376213786 else
13763
- drag(e.getX(), e.getY(), e.getModifiersEx());
13787
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1376413788
1376513789 //try { Thread.sleep(1); } catch (Exception ex) {}
1376613790 }
....@@ -13933,6 +13957,7 @@
1393313957
1393413958 public void run()
1393513959 {
13960
+ new Exception().printStackTrace();
1393613961 System.exit(0);
1393713962 for (;;)
1393813963 {
....@@ -13996,7 +14021,7 @@
1399614021 {
1399714022 Globals.lighttouched = true;
1399814023 }
13999
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14024
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1400014025 }
1400114026 //else
1400214027 }
....@@ -14096,7 +14121,7 @@
1409614121 int X, Y;
1409714122 boolean SX, SY;
1409814123
14099
- void drag(int x, int y, int modifiers)
14124
+ void drag(int x, int y, int modifiers, int modifiersex)
1410014125 {
1410114126 if (IsFrozen())
1410214127 {
....@@ -14105,17 +14130,17 @@
1410514130
1410614131 drag = true; // NEW
1410714132
14108
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14133
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1410914134
1411014135 X = x;
1411114136 Y = y;
1411214137 // floating state for animation
14113
- MODIFIERS = modifiers;
14114
- modifiers &= ~1024;
14138
+ MODIFIERS = modifiersex;
14139
+ modifiersex &= ~1024;
1411514140 if (false) // modifiers != 0)
1411614141 {
1411714142 //new Exception().printStackTrace();
14118
- System.out.println("mouseDragged: " + modifiers);
14143
+ System.out.println("mouseDragged: " + modifiersex);
1411914144 System.out.println("SHIFT = " + SHIFT);
1412014145 System.out.println("CONTROL = " + COMMAND);
1412114146 System.out.println("META = " + META);
....@@ -14135,7 +14160,7 @@
1413514160 info.camera = renderCamera;
1413614161 info.x = x;
1413714162 info.y = y;
14138
- object.editWindow.copy.doEditDrag(info);
14163
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1413914164 } else
1414014165 {
1414114166 if (x < startX)
....@@ -14287,7 +14312,6 @@
1428714312 public void mouseMoved(MouseEvent e)
1428814313 {
1428914314 //System.out.println("mouseMoved: " + e);
14290
-
1429114315 if (isRenderer)
1429214316 return;
1429314317
....@@ -14337,7 +14361,7 @@
1433714361
1433814362 if (control || command || IsFrozen())
1433914363 timeout = true;
14340
- else
14364
+// ?? May 2019 else
1434114365 // timer.setDelay((modifiers & 128) != 0?0:350);
1434214366 mouseDown = false;
1434314367 if (!control && !command) // june 2013
....@@ -14447,7 +14471,7 @@
1444714471 System.out.println("keyReleased: " + e);
1444814472 }
1444914473
14450
- void SetMouseMode(int modifiers)
14474
+ void SetMouseMode(int modifiers, int modifiersex)
1445114475 {
1445214476 //System.out.println("SetMouseMode = " + modifiers);
1445314477 //modifiers &= ~1024;
....@@ -14459,25 +14483,25 @@
1445914483 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1446014484 // return;
1446114485 //System.out.println("SetMode = " + modifiers);
14462
- if ((modifiers & WHEEL) == WHEEL)
14486
+ if ((modifiersex & WHEEL) == WHEEL)
1446314487 {
1446414488 mouseMode |= ZOOM;
1446514489 }
1446614490
1446714491 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14468
- if (capsLocked || (modifiers & META) == META)
14492
+ if (capsLocked) // || (modifiers & META) == META)
1446914493 {
1447014494 mouseMode |= VR; // BACKFORTH;
1447114495 }
14472
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14496
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1447314497 {
1447414498 mouseMode |= SELECT;
1447514499 }
14476
- if ((modifiers & COMMAND) == COMMAND)
14500
+ if ((modifiersex & COMMAND) == COMMAND)
1447714501 {
1447814502 mouseMode |= SELECT;
1447914503 }
14480
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14504
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1448114505 {
1448214506 mouseMode &= ~VR;
1448314507 mouseMode |= TRANSLATE;
....@@ -14506,7 +14530,7 @@
1450614530
1450714531 if (isRenderer) //
1450814532 {
14509
- SetMouseMode(modifiers);
14533
+ SetMouseMode(0, modifiers);
1451014534 }
1451114535
1451214536 Globals.theRenderer.keyPressed(key);
....@@ -14966,7 +14990,7 @@
1496614990 //mode = ROTATE;
1496714991 if ((MODIFIERS & COMMAND) == 0) // VR??
1496814992 {
14969
- SetMouseMode(modifiers);
14993
+ SetMouseMode(0, modifiers);
1497014994 }
1497114995 }
1497214996
....@@ -15100,8 +15124,9 @@
1510015124
1510115125 protected void processMouseMotionEvent(MouseEvent e)
1510215126 {
15103
- //System.out.println("processMouseMotionEvent: " + mouseMode);
15104
- if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15127
+ //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
15128
+ //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15129
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1510515130 {
1510615131 mouseMoved(e);
1510715132 } else
....@@ -15131,6 +15156,7 @@
1513115156
1513215157 void SelectParent()
1513315158 {
15159
+ new Exception().printStackTrace();
1513415160 System.exit(0);
1513515161 Composite group = (Composite) object;
1513615162 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15154,6 +15180,7 @@
1515415180
1515515181 void SelectChildren()
1515615182 {
15183
+ new Exception().printStackTrace();
1515715184 System.exit(0);
1515815185 /*
1515915186 Composite group = (Composite) object;
....@@ -15536,6 +15563,7 @@
1553615563 public boolean mouseDown(Event evt, int x, int y)
1553715564 {
1553815565 System.out.println("mouseDown: " + evt);
15566
+ System.exit(0);
1553915567 /*
1554015568 locked = true;
1554115569 drag = false;
....@@ -15579,7 +15607,7 @@
1557915607 {
1558015608 keyPressed(0, modifiers);
1558115609 }
15582
- clickStart(x, y, modifiers);
15610
+ // clickStart(x, y, modifiers);
1558315611 return true;
1558415612 }
1558515613
....@@ -15697,7 +15725,7 @@
1569715725 {
1569815726 keyReleased(0, 0);
1569915727 }
15700
- drag(x, y, modifiers);
15728
+ drag(x, y, 0, modifiers);
1570115729 return true;
1570215730 }
1570315731
....@@ -16267,6 +16295,7 @@
1626716295 {
1626816296 if (!selection)
1626916297 {
16298
+ new Exception().printStackTrace();
1627016299 System.exit(0);
1627116300 return;
1627216301 }