Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
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
....@@ -1630,7 +1628,7 @@
16301628
16311629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16321630
1633
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
16341632
16351633 /**/
16361634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -2142,7 +2140,7 @@
21422140 System.err.println("LIVE = " + Globals.isLIVE());
21432141
21442142 if (!Globals.isLIVE()) // save sound
2145
- GrafreeD.savesound = true; // wav.save();
2143
+ Grafreed.savesound = true; // wav.save();
21462144 // else
21472145 repaint(); // start loop // may 2013
21482146 }
....@@ -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,11 +9538,11 @@
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 {
9543
- 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) + ")");
95449546 }
95459547
95469548 if (!BOXMODE)
....@@ -9578,7 +9580,7 @@
95789580 ABORTED = false;
95799581 }
95809582 else
9581
- GrafreeD.wav.cursor += 735 * ACSIZE;
9583
+ Grafreed.wav.cursor += 735 * ACSIZE;
95829584
95839585 if (false)
95849586 {
....@@ -10241,11 +10243,11 @@
1024110243
1024210244 public void display(GLAutoDrawable drawable)
1024310245 {
10244
- if (GrafreeD.savesound && GrafreeD.hassound)
10246
+ if (Grafreed.savesound && Grafreed.hassound)
1024510247 {
10246
- GrafreeD.wav.save();
10247
- GrafreeD.savesound = false;
10248
- GrafreeD.hassound = false;
10248
+ Grafreed.wav.save();
10249
+ Grafreed.savesound = false;
10250
+ Grafreed.hassound = false;
1024910251 }
1025010252 // if (DEBUG_SELECTION)
1025110253 // {
....@@ -10375,7 +10377,7 @@
1037510377 Object3D theobject = object;
1037610378 Object3D theparent = object.parent;
1037710379 object.parent = null;
10378
- object = (Object3D)GrafreeD.clone(object);
10380
+ object = (Object3D)Grafreed.clone(object);
1037910381 object.Stripify();
1038010382 if (theobject.selection == null || theobject.selection.Size() == 0)
1038110383 theobject.PreprocessOcclusion(this);
....@@ -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
....@@ -11275,8 +11283,8 @@
1127511283 e.printStackTrace();
1127611284 }
1127711285
11278
- if (GrafreeD.RENDERME > 0)
11279
- GrafreeD.RENDERME--; // mechante magouille
11286
+ if (Grafreed.RENDERME > 0)
11287
+ Grafreed.RENDERME--; // mechante magouille
1128011288
1128111289 Globals.ONESTEP = false;
1128211290 }
....@@ -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;
....@@ -13646,6 +13656,10 @@
1364613656 // wasliveok = true;
1364713657 // waslive = false;
1364813658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1364913663 // source == timer
1365013664 if (mouseDown)
1365113665 {
....@@ -13684,7 +13698,7 @@
1368413698
1368513699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368613700
13687
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368813702 {
1368913703 if (!wasliveok)
1369013704 return;
....@@ -13701,7 +13715,7 @@
1370113715 // touched = true; // main DL
1370213716 if (isRenderer)
1370313717 {
13704
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1370513719 }
1370613720
1370713721 selectX = anchorX = x;
....@@ -13714,7 +13728,7 @@
1371413728 clicked = true;
1371513729 hold = false;
1371613730
13717
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371813732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371913733 {
1372013734 // System.out.println("RESTART II " + modifiers);
....@@ -13745,7 +13759,7 @@
1374513759 info.camera = renderCamera;
1374613760 info.x = x;
1374713761 info.y = y;
13748
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1374913763 editObj = object.doEditClick(info, 0);
1375013764 if (!editObj)
1375113765 {
....@@ -13774,7 +13788,7 @@
1377413788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377513789 }
1377613790 else
13777
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377813792
1377913793 //try { Thread.sleep(1); } catch (Exception ex) {}
1378013794 }
....@@ -14011,7 +14025,7 @@
1401114025 {
1401214026 Globals.lighttouched = true;
1401314027 }
14014
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401514029 }
1401614030 //else
1401714031 }
....@@ -14111,7 +14125,7 @@
1411114125 int X, Y;
1411214126 boolean SX, SY;
1411314127
14114
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1411514129 {
1411614130 if (IsFrozen())
1411714131 {
....@@ -14120,17 +14134,17 @@
1412014134
1412114135 drag = true; // NEW
1412214136
14123
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412414138
1412514139 X = x;
1412614140 Y = y;
1412714141 // floating state for animation
14128
- MODIFIERS = modifiers;
14129
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1413014144 if (false) // modifiers != 0)
1413114145 {
1413214146 //new Exception().printStackTrace();
14133
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1413414148 System.out.println("SHIFT = " + SHIFT);
1413514149 System.out.println("CONTROL = " + COMMAND);
1413614150 System.out.println("META = " + META);
....@@ -14150,7 +14164,7 @@
1415014164 info.camera = renderCamera;
1415114165 info.x = x;
1415214166 info.y = y;
14153
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415414168 } else
1415514169 {
1415614170 if (x < startX)
....@@ -14349,9 +14363,9 @@
1434914363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435014364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435114365
14352
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1435314367 timeout = true;
14354
- else
14368
+// ?? May 2019 else
1435514369 // timer.setDelay((modifiers & 128) != 0?0:350);
1435614370 mouseDown = false;
1435714371 if (!control && !command) // june 2013
....@@ -14461,7 +14475,7 @@
1446114475 System.out.println("keyReleased: " + e);
1446214476 }
1446314477
14464
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1446514479 {
1446614480 //System.out.println("SetMouseMode = " + modifiers);
1446714481 //modifiers &= ~1024;
....@@ -14473,25 +14487,25 @@
1447314487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447414488 // return;
1447514489 //System.out.println("SetMode = " + modifiers);
14476
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1447714491 {
1447814492 mouseMode |= ZOOM;
1447914493 }
1448014494
1448114495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14482
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1448314497 {
1448414498 mouseMode |= VR; // BACKFORTH;
1448514499 }
14486
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448714501 {
1448814502 mouseMode |= SELECT;
1448914503 }
14490
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1449114505 {
1449214506 mouseMode |= SELECT;
1449314507 }
14494
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449514509 {
1449614510 mouseMode &= ~VR;
1449714511 mouseMode |= TRANSLATE;
....@@ -14520,7 +14534,7 @@
1452014534
1452114535 if (isRenderer) //
1452214536 {
14523
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1452414538 }
1452514539
1452614540 Globals.theRenderer.keyPressed(key);
....@@ -14856,7 +14870,7 @@
1485614870 //RESIZETEXTURE ^= true;
1485714871 //break;
1485814872 case 'z':
14859
- RENDERSHADOW ^= true;
14873
+ Globals.RENDERSHADOW ^= true;
1486014874 Globals.lighttouched = true;
1486114875 repaint();
1486214876 break;
....@@ -14980,7 +14994,7 @@
1498014994 //mode = ROTATE;
1498114995 if ((MODIFIERS & COMMAND) == 0) // VR??
1498214996 {
14983
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1498414998 }
1498514999 }
1498615000
....@@ -15116,7 +15130,7 @@
1511615130 {
1511715131 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511815132 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15119
- 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)
1512015134 {
1512115135 mouseMoved(e);
1512215136 } else
....@@ -15553,6 +15567,7 @@
1555315567 public boolean mouseDown(Event evt, int x, int y)
1555415568 {
1555515569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1555615571 /*
1555715572 locked = true;
1555815573 drag = false;
....@@ -15596,7 +15611,7 @@
1559615611 {
1559715612 keyPressed(0, modifiers);
1559815613 }
15599
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1560015615 return true;
1560115616 }
1560215617
....@@ -15714,7 +15729,7 @@
1571415729 {
1571515730 keyReleased(0, 0);
1571615731 }
15717
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1571815733 return true;
1571915734 }
1572015735
....@@ -16412,16 +16427,16 @@
1641216427 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]));
1641316428 }
1641416429
16415
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16430
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1641616431 }
1641716432 }
1641816433
1641916434 if (!movingcamera && !PAINTMODE)
1642016435 object.editWindow.ScreenFitPoint(); // fev 2014
1642116436
16422
- 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)
1642316438 {
16424
- 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);
1642516440
1642616441 Object3D group = new Object3D("inst" + paintcount++);
1642716442
....@@ -16577,7 +16592,7 @@
1657716592 gl.glDisable(gl.GL_CULL_FACE);
1657816593 }
1657916594
16580
- if (!RENDERSHADOW)
16595
+ if (!Globals.RENDERSHADOW)
1658116596 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658216597
1658316598 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16587,7 +16602,7 @@
1658716602 //gl.glColorMask(false, false, false, false);
1658816603
1658916604 //render_scene_from_light_view(gl, drawable, 0, 0);
16590
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16605
+ if (Globals.RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
1659116606 {
1659216607 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659316608