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;
....@@ -86,7 +84,7 @@
8684 static boolean FULLSCREEN = false;
8785 static boolean SUPPORT = true;
8886 static boolean INERTIA = true;
89
-static boolean FAST = true; // false;
87
+static boolean FAST = false;
9088 static boolean SLOWPOSE = false;
9189 static boolean FOOTCONTACT = true;
9290
....@@ -108,7 +106,7 @@
108106 static boolean OEIL = true;
109107 static boolean OEILONCE = false; // do oeilon then oeiloff
110108 static boolean LOOKAT = true;
111
-static boolean RANDOM = true; // false;
109
+static boolean SWITCH = true; // false;
112110 static boolean HANDLES = false; // selection doesn't work!!
113111 static boolean PAINTMODE = false;
114112
....@@ -2269,7 +2267,7 @@
22692267
22702268 void ToggleRandom()
22712269 {
2272
- RANDOM ^= true;
2270
+ SWITCH ^= true;
22732271 }
22742272
22752273 void ToggleHandles()
....@@ -4208,6 +4206,7 @@
42084206
42094207 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
42104208 {
4209
+ new Exception().printStackTrace();
42114210 System.exit(0);
42124211 com.sun.opengl.util.texture.Texture texture = null;
42134212
....@@ -8076,12 +8075,16 @@
80768075 {
80778076 String texname = tex;
80788077
8079
- String[] split = tex.split("Textures");
8080
- if (split.length > 1)
8081
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8082
- else
8083
- if (!texname.startsWith("/"))
8084
- 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
+ }
80858088
80868089 if (CACHETEXTURE)
80878090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9394,7 +9397,7 @@
93949397 //gl.glFlush();
93959398 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93969399
9397
- if (ANIMATION && ABORTED)
9400
+ if (Globals.ANIMATION && ABORTED)
93989401 {
93999402 System.err.println(" ABORTED FRAME");
94009403 break;
....@@ -9424,7 +9427,7 @@
94249427 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94259428
94269429 // save image
9427
- if (ANIMATION && !ABORTED)
9430
+ if (Globals.ANIMATION && !ABORTED)
94289431 {
94299432 VPwidth = viewport[2];
94309433 VPheight = viewport[3];
....@@ -9535,7 +9538,7 @@
95359538
95369539 // imagecount++;
95379540
9538
- 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;
95399542
95409543 if (!BOXMODE)
95419544 {
....@@ -11259,8 +11262,14 @@
1125911262 {
1126011263 renderpass++;
1126111264 // System.out.println("Draw object... ");
11265
+ STEP = 1;
1126211266 if (FAST) // in case there is no script
11263
- STEP = 16;
11267
+ STEP = 8;
11268
+
11269
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11270
+ {
11271
+ STEP *= 4;
11272
+ }
1126411273
1126511274 //object.FullInvariants();
1126611275
....@@ -12598,8 +12607,10 @@
1259812607 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1259912608
1260012609 "SUB temp.x, one.x, ndotl.x;" +
12601
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12602
- "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
1260312614 "MUL temp.x, temp.x, temp.y;" +
1260412615
1260512616 "MUL saturation, saturation, temp.xxxx;" +
....@@ -13508,7 +13519,7 @@
1350813519 public void mousePressed(MouseEvent e)
1350913520 {
1351013521 //System.out.println("mousePressed: " + e);
13511
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351213523 }
1351313524
1351413525 static long prevtime = 0;
....@@ -13584,8 +13595,8 @@
1358413595 // mode |= META;
1358513596 //}
1358613597
13587
- SetMouseMode(WHEEL | e.getModifiersEx());
13588
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1358913600 anchorX = ax;
1359013601 anchorY = ay;
1359113602 prevX = px;
....@@ -13683,7 +13694,7 @@
1368313694
1368413695 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368513696
13686
- void clickStart(int x, int y, int modifiers)
13697
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368713698 {
1368813699 if (!wasliveok)
1368913700 return;
....@@ -13700,7 +13711,7 @@
1370013711 // touched = true; // main DL
1370113712 if (isRenderer)
1370213713 {
13703
- SetMouseMode(modifiers);
13714
+ SetMouseMode(modifiers, modifiersex);
1370413715 }
1370513716
1370613717 selectX = anchorX = x;
....@@ -13713,7 +13724,7 @@
1371313724 clicked = true;
1371413725 hold = false;
1371513726
13716
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13727
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371713728 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371813729 {
1371913730 // System.out.println("RESTART II " + modifiers);
....@@ -13744,7 +13755,7 @@
1374413755 info.camera = renderCamera;
1374513756 info.x = x;
1374613757 info.y = y;
13747
- info.modifiers = modifiers;
13758
+ info.modifiers = modifiersex;
1374813759 editObj = object.doEditClick(info, 0);
1374913760 if (!editObj)
1375013761 {
....@@ -13773,7 +13784,7 @@
1377313784 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377413785 }
1377513786 else
13776
- drag(e.getX(), e.getY(), e.getModifiersEx());
13787
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377713788
1377813789 //try { Thread.sleep(1); } catch (Exception ex) {}
1377913790 }
....@@ -13946,6 +13957,7 @@
1394613957
1394713958 public void run()
1394813959 {
13960
+ new Exception().printStackTrace();
1394913961 System.exit(0);
1395013962 for (;;)
1395113963 {
....@@ -14009,7 +14021,7 @@
1400914021 {
1401014022 Globals.lighttouched = true;
1401114023 }
14012
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14024
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401314025 }
1401414026 //else
1401514027 }
....@@ -14109,7 +14121,7 @@
1410914121 int X, Y;
1411014122 boolean SX, SY;
1411114123
14112
- void drag(int x, int y, int modifiers)
14124
+ void drag(int x, int y, int modifiers, int modifiersex)
1411314125 {
1411414126 if (IsFrozen())
1411514127 {
....@@ -14118,17 +14130,17 @@
1411814130
1411914131 drag = true; // NEW
1412014132
14121
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14133
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412214134
1412314135 X = x;
1412414136 Y = y;
1412514137 // floating state for animation
14126
- MODIFIERS = modifiers;
14127
- modifiers &= ~1024;
14138
+ MODIFIERS = modifiersex;
14139
+ modifiersex &= ~1024;
1412814140 if (false) // modifiers != 0)
1412914141 {
1413014142 //new Exception().printStackTrace();
14131
- System.out.println("mouseDragged: " + modifiers);
14143
+ System.out.println("mouseDragged: " + modifiersex);
1413214144 System.out.println("SHIFT = " + SHIFT);
1413314145 System.out.println("CONTROL = " + COMMAND);
1413414146 System.out.println("META = " + META);
....@@ -14148,7 +14160,7 @@
1414814160 info.camera = renderCamera;
1414914161 info.x = x;
1415014162 info.y = y;
14151
- object.editWindow.copy.doEditDrag(info);
14163
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415214164 } else
1415314165 {
1415414166 if (x < startX)
....@@ -14349,7 +14361,7 @@
1434914361
1435014362 if (control || command || IsFrozen())
1435114363 timeout = true;
14352
- else
14364
+// ?? May 2019 else
1435314365 // timer.setDelay((modifiers & 128) != 0?0:350);
1435414366 mouseDown = false;
1435514367 if (!control && !command) // june 2013
....@@ -14459,7 +14471,7 @@
1445914471 System.out.println("keyReleased: " + e);
1446014472 }
1446114473
14462
- void SetMouseMode(int modifiers)
14474
+ void SetMouseMode(int modifiers, int modifiersex)
1446314475 {
1446414476 //System.out.println("SetMouseMode = " + modifiers);
1446514477 //modifiers &= ~1024;
....@@ -14471,25 +14483,25 @@
1447114483 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447214484 // return;
1447314485 //System.out.println("SetMode = " + modifiers);
14474
- if ((modifiers & WHEEL) == WHEEL)
14486
+ if ((modifiersex & WHEEL) == WHEEL)
1447514487 {
1447614488 mouseMode |= ZOOM;
1447714489 }
1447814490
1447914491 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14480
- if (capsLocked || (modifiers & META) == META)
14492
+ if (capsLocked) // || (modifiers & META) == META)
1448114493 {
1448214494 mouseMode |= VR; // BACKFORTH;
1448314495 }
14484
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14496
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448514497 {
1448614498 mouseMode |= SELECT;
1448714499 }
14488
- if ((modifiers & COMMAND) == COMMAND)
14500
+ if ((modifiersex & COMMAND) == COMMAND)
1448914501 {
1449014502 mouseMode |= SELECT;
1449114503 }
14492
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14504
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449314505 {
1449414506 mouseMode &= ~VR;
1449514507 mouseMode |= TRANSLATE;
....@@ -14518,7 +14530,7 @@
1451814530
1451914531 if (isRenderer) //
1452014532 {
14521
- SetMouseMode(modifiers);
14533
+ SetMouseMode(0, modifiers);
1452214534 }
1452314535
1452414536 Globals.theRenderer.keyPressed(key);
....@@ -14978,7 +14990,7 @@
1497814990 //mode = ROTATE;
1497914991 if ((MODIFIERS & COMMAND) == 0) // VR??
1498014992 {
14981
- SetMouseMode(modifiers);
14993
+ SetMouseMode(0, modifiers);
1498214994 }
1498314995 }
1498414996
....@@ -15114,7 +15126,7 @@
1511415126 {
1511515127 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511615128 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15117
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15129
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1511815130 {
1511915131 mouseMoved(e);
1512015132 } else
....@@ -15144,6 +15156,7 @@
1514415156
1514515157 void SelectParent()
1514615158 {
15159
+ new Exception().printStackTrace();
1514715160 System.exit(0);
1514815161 Composite group = (Composite) object;
1514915162 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15167,6 +15180,7 @@
1516715180
1516815181 void SelectChildren()
1516915182 {
15183
+ new Exception().printStackTrace();
1517015184 System.exit(0);
1517115185 /*
1517215186 Composite group = (Composite) object;
....@@ -15549,6 +15563,7 @@
1554915563 public boolean mouseDown(Event evt, int x, int y)
1555015564 {
1555115565 System.out.println("mouseDown: " + evt);
15566
+ System.exit(0);
1555215567 /*
1555315568 locked = true;
1555415569 drag = false;
....@@ -15592,7 +15607,7 @@
1559215607 {
1559315608 keyPressed(0, modifiers);
1559415609 }
15595
- clickStart(x, y, modifiers);
15610
+ // clickStart(x, y, modifiers);
1559615611 return true;
1559715612 }
1559815613
....@@ -15710,7 +15725,7 @@
1571015725 {
1571115726 keyReleased(0, 0);
1571215727 }
15713
- drag(x, y, modifiers);
15728
+ drag(x, y, 0, modifiers);
1571415729 return true;
1571515730 }
1571615731
....@@ -16280,6 +16295,7 @@
1628016295 {
1628116296 if (!selection)
1628216297 {
16298
+ new Exception().printStackTrace();
1628316299 System.exit(0);
1628416300 return;
1628516301 }