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()
....@@ -8077,12 +8075,16 @@
80778075 {
80788076 String texname = tex;
80798077
8080
- String[] split = tex.split("Textures");
8081
- if (split.length > 1)
8082
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8083
- else
8084
- if (!texname.startsWith("/"))
8085
- 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
+ }
80868088
80878089 if (CACHETEXTURE)
80888090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9395,7 +9397,7 @@
93959397 //gl.glFlush();
93969398 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93979399
9398
- if (ANIMATION && ABORTED)
9400
+ if (Globals.ANIMATION && ABORTED)
93999401 {
94009402 System.err.println(" ABORTED FRAME");
94019403 break;
....@@ -9425,7 +9427,7 @@
94259427 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94269428
94279429 // save image
9428
- if (ANIMATION && !ABORTED)
9430
+ if (Globals.ANIMATION && !ABORTED)
94299431 {
94309432 VPwidth = viewport[2];
94319433 VPheight = viewport[3];
....@@ -9536,7 +9538,7 @@
95369538
95379539 // imagecount++;
95389540
9539
- 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;
95409542
95419543 if (!BOXMODE)
95429544 {
....@@ -11260,8 +11262,14 @@
1126011262 {
1126111263 renderpass++;
1126211264 // System.out.println("Draw object... ");
11265
+ STEP = 1;
1126311266 if (FAST) // in case there is no script
11264
- STEP = 16;
11267
+ STEP = 8;
11268
+
11269
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11270
+ {
11271
+ STEP *= 4;
11272
+ }
1126511273
1126611274 //object.FullInvariants();
1126711275
....@@ -12599,8 +12607,10 @@
1259912607 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1260012608
1260112609 "SUB temp.x, one.x, ndotl.x;" +
12602
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12603
- "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
1260412614 "MUL temp.x, temp.x, temp.y;" +
1260512615
1260612616 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12748,7 +12758,7 @@
1274812758 "MUL final.y, fragment.texcoord[0].x, c256;" +
1274912759 "FLR final.x, final.y;" +
1275012760 "SUB final.y, final.y, final.x;" +
12751
- //"MUL final.x, final.x, c256i;" +
12761
+ "MUL final.x, final.x, c256i;" +
1275212762 "MOV final.z, zero.x;" +
1275312763 "MOV final.a, one.w;":""
1275412764 ) +
....@@ -12756,7 +12766,7 @@
1275612766 "MUL final.y, fragment.texcoord[0].y, c256;" +
1275712767 "FLR final.x, final.y;" +
1275812768 "SUB final.y, final.y, final.x;" +
12759
- //"MUL final.x, final.x, c256i;" +
12769
+ "MUL final.x, final.x, c256i;" +
1276012770 "MOV final.z, zero.x;" +
1276112771 "MOV final.a, one.w;":""
1276212772 ) +
....@@ -13509,7 +13519,7 @@
1350913519 public void mousePressed(MouseEvent e)
1351013520 {
1351113521 //System.out.println("mousePressed: " + e);
13512
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351313523 }
1351413524
1351513525 static long prevtime = 0;
....@@ -13585,8 +13595,8 @@
1358513595 // mode |= META;
1358613596 //}
1358713597
13588
- SetMouseMode(WHEEL | e.getModifiersEx());
13589
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359013600 anchorX = ax;
1359113601 anchorY = ay;
1359213602 prevX = px;
....@@ -13684,7 +13694,7 @@
1368413694
1368513695 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368613696
13687
- void clickStart(int x, int y, int modifiers)
13697
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368813698 {
1368913699 if (!wasliveok)
1369013700 return;
....@@ -13701,7 +13711,7 @@
1370113711 // touched = true; // main DL
1370213712 if (isRenderer)
1370313713 {
13704
- SetMouseMode(modifiers);
13714
+ SetMouseMode(modifiers, modifiersex);
1370513715 }
1370613716
1370713717 selectX = anchorX = x;
....@@ -13714,7 +13724,7 @@
1371413724 clicked = true;
1371513725 hold = false;
1371613726
13717
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13727
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371813728 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371913729 {
1372013730 // System.out.println("RESTART II " + modifiers);
....@@ -13745,7 +13755,7 @@
1374513755 info.camera = renderCamera;
1374613756 info.x = x;
1374713757 info.y = y;
13748
- info.modifiers = modifiers;
13758
+ info.modifiers = modifiersex;
1374913759 editObj = object.doEditClick(info, 0);
1375013760 if (!editObj)
1375113761 {
....@@ -13774,7 +13784,7 @@
1377413784 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377513785 }
1377613786 else
13777
- drag(e.getX(), e.getY(), e.getModifiersEx());
13787
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377813788
1377913789 //try { Thread.sleep(1); } catch (Exception ex) {}
1378013790 }
....@@ -14011,7 +14021,7 @@
1401114021 {
1401214022 Globals.lighttouched = true;
1401314023 }
14014
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14024
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401514025 }
1401614026 //else
1401714027 }
....@@ -14111,7 +14121,7 @@
1411114121 int X, Y;
1411214122 boolean SX, SY;
1411314123
14114
- void drag(int x, int y, int modifiers)
14124
+ void drag(int x, int y, int modifiers, int modifiersex)
1411514125 {
1411614126 if (IsFrozen())
1411714127 {
....@@ -14120,17 +14130,17 @@
1412014130
1412114131 drag = true; // NEW
1412214132
14123
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14133
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412414134
1412514135 X = x;
1412614136 Y = y;
1412714137 // floating state for animation
14128
- MODIFIERS = modifiers;
14129
- modifiers &= ~1024;
14138
+ MODIFIERS = modifiersex;
14139
+ modifiersex &= ~1024;
1413014140 if (false) // modifiers != 0)
1413114141 {
1413214142 //new Exception().printStackTrace();
14133
- System.out.println("mouseDragged: " + modifiers);
14143
+ System.out.println("mouseDragged: " + modifiersex);
1413414144 System.out.println("SHIFT = " + SHIFT);
1413514145 System.out.println("CONTROL = " + COMMAND);
1413614146 System.out.println("META = " + META);
....@@ -14150,7 +14160,7 @@
1415014160 info.camera = renderCamera;
1415114161 info.x = x;
1415214162 info.y = y;
14153
- object.editWindow.copy.doEditDrag(info);
14163
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415414164 } else
1415514165 {
1415614166 if (x < startX)
....@@ -14351,7 +14361,7 @@
1435114361
1435214362 if (control || command || IsFrozen())
1435314363 timeout = true;
14354
- else
14364
+// ?? May 2019 else
1435514365 // timer.setDelay((modifiers & 128) != 0?0:350);
1435614366 mouseDown = false;
1435714367 if (!control && !command) // june 2013
....@@ -14461,7 +14471,7 @@
1446114471 System.out.println("keyReleased: " + e);
1446214472 }
1446314473
14464
- void SetMouseMode(int modifiers)
14474
+ void SetMouseMode(int modifiers, int modifiersex)
1446514475 {
1446614476 //System.out.println("SetMouseMode = " + modifiers);
1446714477 //modifiers &= ~1024;
....@@ -14473,25 +14483,25 @@
1447314483 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447414484 // return;
1447514485 //System.out.println("SetMode = " + modifiers);
14476
- if ((modifiers & WHEEL) == WHEEL)
14486
+ if ((modifiersex & WHEEL) == WHEEL)
1447714487 {
1447814488 mouseMode |= ZOOM;
1447914489 }
1448014490
1448114491 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14482
- if (capsLocked || (modifiers & META) == META)
14492
+ if (capsLocked) // || (modifiers & META) == META)
1448314493 {
1448414494 mouseMode |= VR; // BACKFORTH;
1448514495 }
14486
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14496
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448714497 {
1448814498 mouseMode |= SELECT;
1448914499 }
14490
- if ((modifiers & COMMAND) == COMMAND)
14500
+ if ((modifiersex & COMMAND) == COMMAND)
1449114501 {
1449214502 mouseMode |= SELECT;
1449314503 }
14494
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14504
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449514505 {
1449614506 mouseMode &= ~VR;
1449714507 mouseMode |= TRANSLATE;
....@@ -14520,7 +14530,7 @@
1452014530
1452114531 if (isRenderer) //
1452214532 {
14523
- SetMouseMode(modifiers);
14533
+ SetMouseMode(0, modifiers);
1452414534 }
1452514535
1452614536 Globals.theRenderer.keyPressed(key);
....@@ -14980,7 +14990,7 @@
1498014990 //mode = ROTATE;
1498114991 if ((MODIFIERS & COMMAND) == 0) // VR??
1498214992 {
14983
- SetMouseMode(modifiers);
14993
+ SetMouseMode(0, modifiers);
1498414994 }
1498514995 }
1498614996
....@@ -15116,7 +15126,7 @@
1511615126 {
1511715127 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511815128 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15119
- 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)
1512015130 {
1512115131 mouseMoved(e);
1512215132 } else
....@@ -15553,6 +15563,7 @@
1555315563 public boolean mouseDown(Event evt, int x, int y)
1555415564 {
1555515565 System.out.println("mouseDown: " + evt);
15566
+ System.exit(0);
1555615567 /*
1555715568 locked = true;
1555815569 drag = false;
....@@ -15596,7 +15607,7 @@
1559615607 {
1559715608 keyPressed(0, modifiers);
1559815609 }
15599
- clickStart(x, y, modifiers);
15610
+ // clickStart(x, y, modifiers);
1560015611 return true;
1560115612 }
1560215613
....@@ -15714,7 +15725,7 @@
1571415725 {
1571515726 keyReleased(0, 0);
1571615727 }
15717
- drag(x, y, modifiers);
15728
+ drag(x, y, 0, modifiers);
1571815729 return true;
1571915730 }
1572015731