Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
CameraPane.java
....@@ -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
....@@ -1628,7 +1628,7 @@
16281628
16291629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16301630
1631
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
16321632
16331633 /**/
16341634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -2140,7 +2140,7 @@
21402140 System.err.println("LIVE = " + Globals.isLIVE());
21412141
21422142 if (!Globals.isLIVE()) // save sound
2143
- GrafreeD.savesound = true; // wav.save();
2143
+ Grafreed.savesound = true; // wav.save();
21442144 // else
21452145 repaint(); // start loop // may 2013
21462146 }
....@@ -2267,7 +2267,7 @@
22672267
22682268 void ToggleRandom()
22692269 {
2270
- RANDOM ^= true;
2270
+ SWITCH ^= true;
22712271 }
22722272
22732273 void ToggleHandles()
....@@ -8075,12 +8075,16 @@
80758075 {
80768076 String texname = tex;
80778077
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;
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
+ }
80848088
80858089 if (CACHETEXTURE)
80868090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -9538,7 +9542,7 @@
95389542
95399543 if (!BOXMODE)
95409544 {
9541
- 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) + ")");
95429546 }
95439547
95449548 if (!BOXMODE)
....@@ -9576,7 +9580,7 @@
95769580 ABORTED = false;
95779581 }
95789582 else
9579
- GrafreeD.wav.cursor += 735 * ACSIZE;
9583
+ Grafreed.wav.cursor += 735 * ACSIZE;
95809584
95819585 if (false)
95829586 {
....@@ -10239,11 +10243,11 @@
1023910243
1024010244 public void display(GLAutoDrawable drawable)
1024110245 {
10242
- if (GrafreeD.savesound && GrafreeD.hassound)
10246
+ if (Grafreed.savesound && Grafreed.hassound)
1024310247 {
10244
- GrafreeD.wav.save();
10245
- GrafreeD.savesound = false;
10246
- GrafreeD.hassound = false;
10248
+ Grafreed.wav.save();
10249
+ Grafreed.savesound = false;
10250
+ Grafreed.hassound = false;
1024710251 }
1024810252 // if (DEBUG_SELECTION)
1024910253 // {
....@@ -10373,7 +10377,7 @@
1037310377 Object3D theobject = object;
1037410378 Object3D theparent = object.parent;
1037510379 object.parent = null;
10376
- object = (Object3D)GrafreeD.clone(object);
10380
+ object = (Object3D)Grafreed.clone(object);
1037710381 object.Stripify();
1037810382 if (theobject.selection == null || theobject.selection.Size() == 0)
1037910383 theobject.PreprocessOcclusion(this);
....@@ -11279,8 +11283,8 @@
1127911283 e.printStackTrace();
1128011284 }
1128111285
11282
- if (GrafreeD.RENDERME > 0)
11283
- GrafreeD.RENDERME--; // mechante magouille
11286
+ if (Grafreed.RENDERME > 0)
11287
+ Grafreed.RENDERME--; // mechante magouille
1128411288
1128511289 Globals.ONESTEP = false;
1128611290 }
....@@ -12754,7 +12758,7 @@
1275412758 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275512759 "FLR final.x, final.y;" +
1275612760 "SUB final.y, final.y, final.x;" +
12757
- //"MUL final.x, final.x, c256i;" +
12761
+ "MUL final.x, final.x, c256i;" +
1275812762 "MOV final.z, zero.x;" +
1275912763 "MOV final.a, one.w;":""
1276012764 ) +
....@@ -12762,7 +12766,7 @@
1276212766 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276312767 "FLR final.x, final.y;" +
1276412768 "SUB final.y, final.y, final.x;" +
12765
- //"MUL final.x, final.x, c256i;" +
12769
+ "MUL final.x, final.x, c256i;" +
1276612770 "MOV final.z, zero.x;" +
1276712771 "MOV final.a, one.w;":""
1276812772 ) +
....@@ -13515,7 +13519,7 @@
1351513519 public void mousePressed(MouseEvent e)
1351613520 {
1351713521 //System.out.println("mousePressed: " + e);
13518
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13522
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351913523 }
1352013524
1352113525 static long prevtime = 0;
....@@ -13591,8 +13595,8 @@
1359113595 // mode |= META;
1359213596 //}
1359313597
13594
- SetMouseMode(WHEEL | e.getModifiersEx());
13595
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13598
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13599
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359613600 anchorX = ax;
1359713601 anchorY = ay;
1359813602 prevX = px;
....@@ -13652,6 +13656,10 @@
1365213656 // wasliveok = true;
1365313657 // waslive = false;
1365413658
13659
+ // May 2019 Forget it:
13660
+ if (true)
13661
+ return;
13662
+
1365513663 // source == timer
1365613664 if (mouseDown)
1365713665 {
....@@ -13690,7 +13698,7 @@
1369013698
1369113699 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369213700
13693
- void clickStart(int x, int y, int modifiers)
13701
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369413702 {
1369513703 if (!wasliveok)
1369613704 return;
....@@ -13707,7 +13715,7 @@
1370713715 // touched = true; // main DL
1370813716 if (isRenderer)
1370913717 {
13710
- SetMouseMode(modifiers);
13718
+ SetMouseMode(modifiers, modifiersex);
1371113719 }
1371213720
1371313721 selectX = anchorX = x;
....@@ -13720,7 +13728,7 @@
1372013728 clicked = true;
1372113729 hold = false;
1372213730
13723
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13731
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372413732 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372513733 {
1372613734 // System.out.println("RESTART II " + modifiers);
....@@ -13751,7 +13759,7 @@
1375113759 info.camera = renderCamera;
1375213760 info.x = x;
1375313761 info.y = y;
13754
- info.modifiers = modifiers;
13762
+ info.modifiers = modifiersex;
1375513763 editObj = object.doEditClick(info, 0);
1375613764 if (!editObj)
1375713765 {
....@@ -13780,7 +13788,7 @@
1378013788 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378113789 }
1378213790 else
13783
- drag(e.getX(), e.getY(), e.getModifiersEx());
13791
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378413792
1378513793 //try { Thread.sleep(1); } catch (Exception ex) {}
1378613794 }
....@@ -14017,7 +14025,7 @@
1401714025 {
1401814026 Globals.lighttouched = true;
1401914027 }
14020
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14028
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402114029 }
1402214030 //else
1402314031 }
....@@ -14117,7 +14125,7 @@
1411714125 int X, Y;
1411814126 boolean SX, SY;
1411914127
14120
- void drag(int x, int y, int modifiers)
14128
+ void drag(int x, int y, int modifiers, int modifiersex)
1412114129 {
1412214130 if (IsFrozen())
1412314131 {
....@@ -14126,17 +14134,17 @@
1412614134
1412714135 drag = true; // NEW
1412814136
14129
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14137
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413014138
1413114139 X = x;
1413214140 Y = y;
1413314141 // floating state for animation
14134
- MODIFIERS = modifiers;
14135
- modifiers &= ~1024;
14142
+ MODIFIERS = modifiersex;
14143
+ modifiersex &= ~1024;
1413614144 if (false) // modifiers != 0)
1413714145 {
1413814146 //new Exception().printStackTrace();
14139
- System.out.println("mouseDragged: " + modifiers);
14147
+ System.out.println("mouseDragged: " + modifiersex);
1414014148 System.out.println("SHIFT = " + SHIFT);
1414114149 System.out.println("CONTROL = " + COMMAND);
1414214150 System.out.println("META = " + META);
....@@ -14156,7 +14164,7 @@
1415614164 info.camera = renderCamera;
1415714165 info.x = x;
1415814166 info.y = y;
14159
- object.editWindow.copy.doEditDrag(info);
14167
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416014168 } else
1416114169 {
1416214170 if (x < startX)
....@@ -14355,9 +14363,9 @@
1435514363 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435614364 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435714365
14358
- if (control || command || IsFrozen())
14366
+// No delay if (control || command || IsFrozen())
1435914367 timeout = true;
14360
- else
14368
+// ?? May 2019 else
1436114369 // timer.setDelay((modifiers & 128) != 0?0:350);
1436214370 mouseDown = false;
1436314371 if (!control && !command) // june 2013
....@@ -14467,7 +14475,7 @@
1446714475 System.out.println("keyReleased: " + e);
1446814476 }
1446914477
14470
- void SetMouseMode(int modifiers)
14478
+ void SetMouseMode(int modifiers, int modifiersex)
1447114479 {
1447214480 //System.out.println("SetMouseMode = " + modifiers);
1447314481 //modifiers &= ~1024;
....@@ -14479,25 +14487,25 @@
1447914487 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448014488 // return;
1448114489 //System.out.println("SetMode = " + modifiers);
14482
- if ((modifiers & WHEEL) == WHEEL)
14490
+ if ((modifiersex & WHEEL) == WHEEL)
1448314491 {
1448414492 mouseMode |= ZOOM;
1448514493 }
1448614494
1448714495 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14488
- if (capsLocked || (modifiers & META) == META)
14496
+ if (capsLocked) // || (modifiers & META) == META)
1448914497 {
1449014498 mouseMode |= VR; // BACKFORTH;
1449114499 }
14492
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14500
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449314501 {
1449414502 mouseMode |= SELECT;
1449514503 }
14496
- if ((modifiers & COMMAND) == COMMAND)
14504
+ if ((modifiersex & COMMAND) == COMMAND)
1449714505 {
1449814506 mouseMode |= SELECT;
1449914507 }
14500
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14508
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450114509 {
1450214510 mouseMode &= ~VR;
1450314511 mouseMode |= TRANSLATE;
....@@ -14526,7 +14534,7 @@
1452614534
1452714535 if (isRenderer) //
1452814536 {
14529
- SetMouseMode(modifiers);
14537
+ SetMouseMode(0, modifiers);
1453014538 }
1453114539
1453214540 Globals.theRenderer.keyPressed(key);
....@@ -14862,7 +14870,7 @@
1486214870 //RESIZETEXTURE ^= true;
1486314871 //break;
1486414872 case 'z':
14865
- RENDERSHADOW ^= true;
14873
+ Globals.RENDERSHADOW ^= true;
1486614874 Globals.lighttouched = true;
1486714875 repaint();
1486814876 break;
....@@ -14986,7 +14994,7 @@
1498614994 //mode = ROTATE;
1498714995 if ((MODIFIERS & COMMAND) == 0) // VR??
1498814996 {
14989
- SetMouseMode(modifiers);
14997
+ SetMouseMode(0, modifiers);
1499014998 }
1499114999 }
1499215000
....@@ -15122,7 +15130,7 @@
1512215130 {
1512315131 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512415132 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15125
- 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)
1512615134 {
1512715135 mouseMoved(e);
1512815136 } else
....@@ -15559,6 +15567,7 @@
1555915567 public boolean mouseDown(Event evt, int x, int y)
1556015568 {
1556115569 System.out.println("mouseDown: " + evt);
15570
+ System.exit(0);
1556215571 /*
1556315572 locked = true;
1556415573 drag = false;
....@@ -15602,7 +15611,7 @@
1560215611 {
1560315612 keyPressed(0, modifiers);
1560415613 }
15605
- clickStart(x, y, modifiers);
15614
+ // clickStart(x, y, modifiers);
1560615615 return true;
1560715616 }
1560815617
....@@ -15720,7 +15729,7 @@
1572015729 {
1572115730 keyReleased(0, 0);
1572215731 }
15723
- drag(x, y, modifiers);
15732
+ drag(x, y, 0, modifiers);
1572415733 return true;
1572515734 }
1572615735
....@@ -16418,16 +16427,16 @@
1641816427 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]));
1641916428 }
1642016429
16421
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16430
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642216431 }
1642316432 }
1642416433
1642516434 if (!movingcamera && !PAINTMODE)
1642616435 object.editWindow.ScreenFitPoint(); // fev 2014
1642716436
16428
- 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)
1642916438 {
16430
- 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);
1643116440
1643216441 Object3D group = new Object3D("inst" + paintcount++);
1643316442
....@@ -16583,7 +16592,7 @@
1658316592 gl.glDisable(gl.GL_CULL_FACE);
1658416593 }
1658516594
16586
- if (!RENDERSHADOW)
16595
+ if (!Globals.RENDERSHADOW)
1658716596 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816597
1658916598 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16593,7 +16602,7 @@
1659316602 //gl.glColorMask(false, false, false, false);
1659416603
1659516604 //render_scene_from_light_view(gl, drawable, 0, 0);
16596
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16605
+ if (Globals.RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
1659716606 {
1659816607 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659916608