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;
....@@ -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()
....@@ -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,11 +9538,11 @@
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 {
9542
- 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) + ")");
95439546 }
95449547
95459548 if (!BOXMODE)
....@@ -9577,7 +9580,7 @@
95779580 ABORTED = false;
95789581 }
95799582 else
9580
- GrafreeD.wav.cursor += 735 * ACSIZE;
9583
+ Grafreed.wav.cursor += 735 * ACSIZE;
95819584
95829585 if (false)
95839586 {
....@@ -10240,11 +10243,11 @@
1024010243
1024110244 public void display(GLAutoDrawable drawable)
1024210245 {
10243
- if (GrafreeD.savesound && GrafreeD.hassound)
10246
+ if (Grafreed.savesound && Grafreed.hassound)
1024410247 {
10245
- GrafreeD.wav.save();
10246
- GrafreeD.savesound = false;
10247
- GrafreeD.hassound = false;
10248
+ Grafreed.wav.save();
10249
+ Grafreed.savesound = false;
10250
+ Grafreed.hassound = false;
1024810251 }
1024910252 // if (DEBUG_SELECTION)
1025010253 // {
....@@ -10374,7 +10377,7 @@
1037410377 Object3D theobject = object;
1037510378 Object3D theparent = object.parent;
1037610379 object.parent = null;
10377
- object = (Object3D)GrafreeD.clone(object);
10380
+ object = (Object3D)Grafreed.clone(object);
1037810381 object.Stripify();
1037910382 if (theobject.selection == null || theobject.selection.Size() == 0)
1038010383 theobject.PreprocessOcclusion(this);
....@@ -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
....@@ -11274,8 +11283,8 @@
1127411283 e.printStackTrace();
1127511284 }
1127611285
11277
- if (GrafreeD.RENDERME > 0)
11278
- GrafreeD.RENDERME--; // mechante magouille
11286
+ if (Grafreed.RENDERME > 0)
11287
+ Grafreed.RENDERME--; // mechante magouille
1127911288
1128011289 Globals.ONESTEP = false;
1128111290 }
....@@ -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;" +
....@@ -12747,7 +12758,7 @@
1274712758 "MUL final.y, fragment.texcoord[0].x, c256;" +
1274812759 "FLR final.x, final.y;" +
1274912760 "SUB final.y, final.y, final.x;" +
12750
- //"MUL final.x, final.x, c256i;" +
12761
+ "MUL final.x, final.x, c256i;" +
1275112762 "MOV final.z, zero.x;" +
1275212763 "MOV final.a, one.w;":""
1275312764 ) +
....@@ -12755,7 +12766,7 @@
1275512766 "MUL final.y, fragment.texcoord[0].y, c256;" +
1275612767 "FLR final.x, final.y;" +
1275712768 "SUB final.y, final.y, final.x;" +
12758
- //"MUL final.x, final.x, c256i;" +
12769
+ "MUL final.x, final.x, c256i;" +
1275912770 "MOV final.z, zero.x;" +
1276012771 "MOV final.a, one.w;":""
1276112772 ) +
....@@ -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;
....@@ -13645,6 +13656,10 @@
1364513656 // wasliveok = true;
1364613657 // waslive = false;
1364713658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1364813663 // source == timer
1364913664 if (mouseDown)
1365013665 {
....@@ -13683,7 +13698,7 @@
1368313698
1368413699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368513700
13686
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368713702 {
1368813703 if (!wasliveok)
1368913704 return;
....@@ -13700,7 +13715,7 @@
1370013715 // touched = true; // main DL
1370113716 if (isRenderer)
1370213717 {
13703
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1370413719 }
1370513720
1370613721 selectX = anchorX = x;
....@@ -13713,7 +13728,7 @@
1371313728 clicked = true;
1371413729 hold = false;
1371513730
13716
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371713732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371813733 {
1371913734 // System.out.println("RESTART II " + modifiers);
....@@ -13744,7 +13759,7 @@
1374413759 info.camera = renderCamera;
1374513760 info.x = x;
1374613761 info.y = y;
13747
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1374813763 editObj = object.doEditClick(info, 0);
1374913764 if (!editObj)
1375013765 {
....@@ -13773,7 +13788,7 @@
1377313788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377413789 }
1377513790 else
13776
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377713792
1377813793 //try { Thread.sleep(1); } catch (Exception ex) {}
1377913794 }
....@@ -13946,6 +13961,7 @@
1394613961
1394713962 public void run()
1394813963 {
13964
+ new Exception().printStackTrace();
1394913965 System.exit(0);
1395013966 for (;;)
1395113967 {
....@@ -14009,7 +14025,7 @@
1400914025 {
1401014026 Globals.lighttouched = true;
1401114027 }
14012
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401314029 }
1401414030 //else
1401514031 }
....@@ -14109,7 +14125,7 @@
1410914125 int X, Y;
1411014126 boolean SX, SY;
1411114127
14112
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1411314129 {
1411414130 if (IsFrozen())
1411514131 {
....@@ -14118,17 +14134,17 @@
1411814134
1411914135 drag = true; // NEW
1412014136
14121
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412214138
1412314139 X = x;
1412414140 Y = y;
1412514141 // floating state for animation
14126
- MODIFIERS = modifiers;
14127
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1412814144 if (false) // modifiers != 0)
1412914145 {
1413014146 //new Exception().printStackTrace();
14131
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1413214148 System.out.println("SHIFT = " + SHIFT);
1413314149 System.out.println("CONTROL = " + COMMAND);
1413414150 System.out.println("META = " + META);
....@@ -14148,7 +14164,7 @@
1414814164 info.camera = renderCamera;
1414914165 info.x = x;
1415014166 info.y = y;
14151
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415214168 } else
1415314169 {
1415414170 if (x < startX)
....@@ -14347,9 +14363,9 @@
1434714363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1434814364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1434914365
14350
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1435114367 timeout = true;
14352
- else
14368
+// ?? May 2019 else
1435314369 // timer.setDelay((modifiers & 128) != 0?0:350);
1435414370 mouseDown = false;
1435514371 if (!control && !command) // june 2013
....@@ -14459,7 +14475,7 @@
1445914475 System.out.println("keyReleased: " + e);
1446014476 }
1446114477
14462
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1446314479 {
1446414480 //System.out.println("SetMouseMode = " + modifiers);
1446514481 //modifiers &= ~1024;
....@@ -14471,25 +14487,25 @@
1447114487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447214488 // return;
1447314489 //System.out.println("SetMode = " + modifiers);
14474
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1447514491 {
1447614492 mouseMode |= ZOOM;
1447714493 }
1447814494
1447914495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14480
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1448114497 {
1448214498 mouseMode |= VR; // BACKFORTH;
1448314499 }
14484
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448514501 {
1448614502 mouseMode |= SELECT;
1448714503 }
14488
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1448914505 {
1449014506 mouseMode |= SELECT;
1449114507 }
14492
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449314509 {
1449414510 mouseMode &= ~VR;
1449514511 mouseMode |= TRANSLATE;
....@@ -14518,7 +14534,7 @@
1451814534
1451914535 if (isRenderer) //
1452014536 {
14521
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1452214538 }
1452314539
1452414540 Globals.theRenderer.keyPressed(key);
....@@ -14978,7 +14994,7 @@
1497814994 //mode = ROTATE;
1497914995 if ((MODIFIERS & COMMAND) == 0) // VR??
1498014996 {
14981
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1498214998 }
1498314999 }
1498415000
....@@ -15114,7 +15130,7 @@
1511415130 {
1511515131 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511615132 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15117
- 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)
1511815134 {
1511915135 mouseMoved(e);
1512015136 } else
....@@ -15144,6 +15160,7 @@
1514415160
1514515161 void SelectParent()
1514615162 {
15163
+ new Exception().printStackTrace();
1514715164 System.exit(0);
1514815165 Composite group = (Composite) object;
1514915166 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15167,6 +15184,7 @@
1516715184
1516815185 void SelectChildren()
1516915186 {
15187
+ new Exception().printStackTrace();
1517015188 System.exit(0);
1517115189 /*
1517215190 Composite group = (Composite) object;
....@@ -15549,6 +15567,7 @@
1554915567 public boolean mouseDown(Event evt, int x, int y)
1555015568 {
1555115569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1555215571 /*
1555315572 locked = true;
1555415573 drag = false;
....@@ -15592,7 +15611,7 @@
1559215611 {
1559315612 keyPressed(0, modifiers);
1559415613 }
15595
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1559615615 return true;
1559715616 }
1559815617
....@@ -15710,7 +15729,7 @@
1571015729 {
1571115730 keyReleased(0, 0);
1571215731 }
15713
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1571415733 return true;
1571515734 }
1571615735
....@@ -16280,6 +16299,7 @@
1628016299 {
1628116300 if (!selection)
1628216301 {
16302
+ new Exception().printStackTrace();
1628316303 System.exit(0);
1628416304 return;
1628516305 }
....@@ -16407,16 +16427,16 @@
1640716427 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]));
1640816428 }
1640916429
16410
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16430
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1641116431 }
1641216432 }
1641316433
1641416434 if (!movingcamera && !PAINTMODE)
1641516435 object.editWindow.ScreenFitPoint(); // fev 2014
1641616436
16417
- 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)
1641816438 {
16419
- 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);
1642016440
1642116441 Object3D group = new Object3D("inst" + paintcount++);
1642216442