Normand Briere
2019-06-03 e24558ddeacfc945b9e9ba0a32b552d04e2ed4dd
CameraPane.java
....@@ -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 }
....@@ -8022,7 +8022,7 @@
80228022 }
80238023 }
80248024
8025
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8025
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80268026 {
80278027 if (// DrawMode() != 0 || /*tex == null ||*/
80288028 ambientOcclusion ) // || !textureon)
....@@ -8067,7 +8067,7 @@
80678067 return; // true;
80688068 }
80698069
8070
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8070
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80718071 {
80728072 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80738073
....@@ -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
....@@ -8180,7 +8184,9 @@
81808184 texturedata = GetFileTexture(cachename, processbump, resolution);
81818185
81828186
8183
- if (texturedata != null)
8187
+ if (texturedata == null)
8188
+ throw new Exception();
8189
+
81848190 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81858191 //texture = GetTexture(tex, bump);
81868192 }
....@@ -8302,7 +8308,7 @@
83028308 return texture;
83038309 }
83048310
8305
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8311
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
83068312 {
83078313 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83088314
....@@ -8320,14 +8326,14 @@
83208326 return texture!=null?texture.texture:null;
83218327 }
83228328
8323
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8329
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
83248330 {
83258331 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83268332
83278333 return texture!=null?texture.texturedata:null;
83288334 }
83298335
8330
- boolean BindTexture(String tex, boolean bump, int resolution)
8336
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83318337 {
83328338 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83338339 {
....@@ -9538,7 +9544,7 @@
95389544
95399545 if (!BOXMODE)
95409546 {
9541
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9547
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95429548 }
95439549
95449550 if (!BOXMODE)
....@@ -9576,7 +9582,7 @@
95769582 ABORTED = false;
95779583 }
95789584 else
9579
- GrafreeD.wav.cursor += 735 * ACSIZE;
9585
+ Grafreed.wav.cursor += 735 * ACSIZE;
95809586
95819587 if (false)
95829588 {
....@@ -10239,11 +10245,11 @@
1023910245
1024010246 public void display(GLAutoDrawable drawable)
1024110247 {
10242
- if (GrafreeD.savesound && GrafreeD.hassound)
10248
+ if (Grafreed.savesound && Grafreed.hassound)
1024310249 {
10244
- GrafreeD.wav.save();
10245
- GrafreeD.savesound = false;
10246
- GrafreeD.hassound = false;
10250
+ Grafreed.wav.save();
10251
+ Grafreed.savesound = false;
10252
+ Grafreed.hassound = false;
1024710253 }
1024810254 // if (DEBUG_SELECTION)
1024910255 // {
....@@ -10373,7 +10379,7 @@
1037310379 Object3D theobject = object;
1037410380 Object3D theparent = object.parent;
1037510381 object.parent = null;
10376
- object = (Object3D)GrafreeD.clone(object);
10382
+ object = (Object3D)Grafreed.clone(object);
1037710383 object.Stripify();
1037810384 if (theobject.selection == null || theobject.selection.Size() == 0)
1037910385 theobject.PreprocessOcclusion(this);
....@@ -10794,7 +10800,16 @@
1079410800 // Bump noise
1079510801 gl.glActiveTexture(GL.GL_TEXTURE6);
1079610802 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10797
- BindTexture(NOISE_TEXTURE, false, 2);
10803
+
10804
+ try
10805
+ {
10806
+ BindTexture(NOISE_TEXTURE, false, 2);
10807
+ }
10808
+ catch (Exception e)
10809
+ {
10810
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10811
+ }
10812
+
1079810813
1079910814 gl.glActiveTexture(GL.GL_TEXTURE0);
1080010815 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -11279,8 +11294,8 @@
1127911294 e.printStackTrace();
1128011295 }
1128111296
11282
- if (GrafreeD.RENDERME > 0)
11283
- GrafreeD.RENDERME--; // mechante magouille
11297
+ if (Grafreed.RENDERME > 0)
11298
+ Grafreed.RENDERME--; // mechante magouille
1128411299
1128511300 Globals.ONESTEP = false;
1128611301 }
....@@ -11350,7 +11365,14 @@
1135011365
1135111366 usedtextures.clear();
1135211367
11353
- BindTextures(DEFAULT_TEXTURES, 2);
11368
+ try
11369
+ {
11370
+ BindTextures(DEFAULT_TEXTURES, 2);
11371
+ }
11372
+ catch (Exception e)
11373
+ {
11374
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11375
+ }
1135411376 }
1135511377 //System.out.println("--> " + stackdepth);
1135611378 // GrafreeD.traceon();
....@@ -11441,7 +11463,14 @@
1144111463 if (checker != null && DrawMode() == DEFAULT)
1144211464 {
1144311465 //BindTexture(IMMORTAL_TEXTURE);
11444
- BindTextures(checker.GetTextures(), checker.texres);
11466
+ try
11467
+ {
11468
+ BindTextures(checker.GetTextures(), checker.texres);
11469
+ }
11470
+ catch (Exception e)
11471
+ {
11472
+ System.err.println("FAILED: " + checker.GetTextures());
11473
+ }
1144511474 // NEAREST
1144611475 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144711476 DrawChecker(gl);
....@@ -12754,7 +12783,7 @@
1275412783 "MUL final.y, fragment.texcoord[0].x, c256;" +
1275512784 "FLR final.x, final.y;" +
1275612785 "SUB final.y, final.y, final.x;" +
12757
- //"MUL final.x, final.x, c256i;" +
12786
+ "MUL final.x, final.x, c256i;" +
1275812787 "MOV final.z, zero.x;" +
1275912788 "MOV final.a, one.w;":""
1276012789 ) +
....@@ -12762,7 +12791,7 @@
1276212791 "MUL final.y, fragment.texcoord[0].y, c256;" +
1276312792 "FLR final.x, final.y;" +
1276412793 "SUB final.y, final.y, final.x;" +
12765
- //"MUL final.x, final.x, c256i;" +
12794
+ "MUL final.x, final.x, c256i;" +
1276612795 "MOV final.z, zero.x;" +
1276712796 "MOV final.a, one.w;":""
1276812797 ) +
....@@ -13515,7 +13544,7 @@
1351513544 public void mousePressed(MouseEvent e)
1351613545 {
1351713546 //System.out.println("mousePressed: " + e);
13518
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13547
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351913548 }
1352013549
1352113550 static long prevtime = 0;
....@@ -13591,8 +13620,8 @@
1359113620 // mode |= META;
1359213621 //}
1359313622
13594
- SetMouseMode(WHEEL | e.getModifiersEx());
13595
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13623
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13624
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359613625 anchorX = ax;
1359713626 anchorY = ay;
1359813627 prevX = px;
....@@ -13652,6 +13681,10 @@
1365213681 // wasliveok = true;
1365313682 // waslive = false;
1365413683
13684
+ // May 2019 Forget it:
13685
+ if (true)
13686
+ return;
13687
+
1365513688 // source == timer
1365613689 if (mouseDown)
1365713690 {
....@@ -13690,7 +13723,7 @@
1369013723
1369113724 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369213725
13693
- void clickStart(int x, int y, int modifiers)
13726
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369413727 {
1369513728 if (!wasliveok)
1369613729 return;
....@@ -13707,7 +13740,7 @@
1370713740 // touched = true; // main DL
1370813741 if (isRenderer)
1370913742 {
13710
- SetMouseMode(modifiers);
13743
+ SetMouseMode(modifiers, modifiersex);
1371113744 }
1371213745
1371313746 selectX = anchorX = x;
....@@ -13720,7 +13753,7 @@
1372013753 clicked = true;
1372113754 hold = false;
1372213755
13723
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13756
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372413757 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372513758 {
1372613759 // System.out.println("RESTART II " + modifiers);
....@@ -13751,7 +13784,7 @@
1375113784 info.camera = renderCamera;
1375213785 info.x = x;
1375313786 info.y = y;
13754
- info.modifiers = modifiers;
13787
+ info.modifiers = modifiersex;
1375513788 editObj = object.doEditClick(info, 0);
1375613789 if (!editObj)
1375713790 {
....@@ -13780,7 +13813,7 @@
1378013813 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378113814 }
1378213815 else
13783
- drag(e.getX(), e.getY(), e.getModifiersEx());
13816
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378413817
1378513818 //try { Thread.sleep(1); } catch (Exception ex) {}
1378613819 }
....@@ -14017,7 +14050,7 @@
1401714050 {
1401814051 Globals.lighttouched = true;
1401914052 }
14020
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14053
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402114054 }
1402214055 //else
1402314056 }
....@@ -14117,7 +14150,7 @@
1411714150 int X, Y;
1411814151 boolean SX, SY;
1411914152
14120
- void drag(int x, int y, int modifiers)
14153
+ void drag(int x, int y, int modifiers, int modifiersex)
1412114154 {
1412214155 if (IsFrozen())
1412314156 {
....@@ -14126,17 +14159,17 @@
1412614159
1412714160 drag = true; // NEW
1412814161
14129
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14162
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413014163
1413114164 X = x;
1413214165 Y = y;
1413314166 // floating state for animation
14134
- MODIFIERS = modifiers;
14135
- modifiers &= ~1024;
14167
+ MODIFIERS = modifiersex;
14168
+ modifiersex &= ~1024;
1413614169 if (false) // modifiers != 0)
1413714170 {
1413814171 //new Exception().printStackTrace();
14139
- System.out.println("mouseDragged: " + modifiers);
14172
+ System.out.println("mouseDragged: " + modifiersex);
1414014173 System.out.println("SHIFT = " + SHIFT);
1414114174 System.out.println("CONTROL = " + COMMAND);
1414214175 System.out.println("META = " + META);
....@@ -14156,7 +14189,7 @@
1415614189 info.camera = renderCamera;
1415714190 info.x = x;
1415814191 info.y = y;
14159
- object.editWindow.copy.doEditDrag(info);
14192
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416014193 } else
1416114194 {
1416214195 if (x < startX)
....@@ -14355,9 +14388,9 @@
1435514388 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435614389 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435714390
14358
- if (control || command || IsFrozen())
14391
+// No delay if (control || command || IsFrozen())
1435914392 timeout = true;
14360
- else
14393
+// ?? May 2019 else
1436114394 // timer.setDelay((modifiers & 128) != 0?0:350);
1436214395 mouseDown = false;
1436314396 if (!control && !command) // june 2013
....@@ -14467,7 +14500,7 @@
1446714500 System.out.println("keyReleased: " + e);
1446814501 }
1446914502
14470
- void SetMouseMode(int modifiers)
14503
+ void SetMouseMode(int modifiers, int modifiersex)
1447114504 {
1447214505 //System.out.println("SetMouseMode = " + modifiers);
1447314506 //modifiers &= ~1024;
....@@ -14479,25 +14512,25 @@
1447914512 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448014513 // return;
1448114514 //System.out.println("SetMode = " + modifiers);
14482
- if ((modifiers & WHEEL) == WHEEL)
14515
+ if ((modifiersex & WHEEL) == WHEEL)
1448314516 {
1448414517 mouseMode |= ZOOM;
1448514518 }
1448614519
1448714520 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14488
- if (capsLocked || (modifiers & META) == META)
14521
+ if (capsLocked) // || (modifiers & META) == META)
1448914522 {
1449014523 mouseMode |= VR; // BACKFORTH;
1449114524 }
14492
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14525
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449314526 {
1449414527 mouseMode |= SELECT;
1449514528 }
14496
- if ((modifiers & COMMAND) == COMMAND)
14529
+ if ((modifiersex & COMMAND) == COMMAND)
1449714530 {
1449814531 mouseMode |= SELECT;
1449914532 }
14500
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14533
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450114534 {
1450214535 mouseMode &= ~VR;
1450314536 mouseMode |= TRANSLATE;
....@@ -14526,7 +14559,7 @@
1452614559
1452714560 if (isRenderer) //
1452814561 {
14529
- SetMouseMode(modifiers);
14562
+ SetMouseMode(0, modifiers);
1453014563 }
1453114564
1453214565 Globals.theRenderer.keyPressed(key);
....@@ -14862,7 +14895,7 @@
1486214895 //RESIZETEXTURE ^= true;
1486314896 //break;
1486414897 case 'z':
14865
- RENDERSHADOW ^= true;
14898
+ Globals.RENDERSHADOW ^= true;
1486614899 Globals.lighttouched = true;
1486714900 repaint();
1486814901 break;
....@@ -14986,7 +15019,7 @@
1498615019 //mode = ROTATE;
1498715020 if ((MODIFIERS & COMMAND) == 0) // VR??
1498815021 {
14989
- SetMouseMode(modifiers);
15022
+ SetMouseMode(0, modifiers);
1499015023 }
1499115024 }
1499215025
....@@ -15122,7 +15155,7 @@
1512215155 {
1512315156 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1512415157 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15125
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15158
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1512615159 {
1512715160 mouseMoved(e);
1512815161 } else
....@@ -15559,6 +15592,7 @@
1555915592 public boolean mouseDown(Event evt, int x, int y)
1556015593 {
1556115594 System.out.println("mouseDown: " + evt);
15595
+ System.exit(0);
1556215596 /*
1556315597 locked = true;
1556415598 drag = false;
....@@ -15602,7 +15636,7 @@
1560215636 {
1560315637 keyPressed(0, modifiers);
1560415638 }
15605
- clickStart(x, y, modifiers);
15639
+ // clickStart(x, y, modifiers);
1560615640 return true;
1560715641 }
1560815642
....@@ -15720,7 +15754,7 @@
1572015754 {
1572115755 keyReleased(0, 0);
1572215756 }
15723
- drag(x, y, modifiers);
15757
+ drag(x, y, 0, modifiers);
1572415758 return true;
1572515759 }
1572615760
....@@ -16418,16 +16452,16 @@
1641816452 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]));
1641916453 }
1642016454
16421
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16455
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642216456 }
1642316457 }
1642416458
1642516459 if (!movingcamera && !PAINTMODE)
1642616460 object.editWindow.ScreenFitPoint(); // fev 2014
1642716461
16428
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16462
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1642916463 {
16430
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16464
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1643116465
1643216466 Object3D group = new Object3D("inst" + paintcount++);
1643316467
....@@ -16583,7 +16617,7 @@
1658316617 gl.glDisable(gl.GL_CULL_FACE);
1658416618 }
1658516619
16586
- if (!RENDERSHADOW)
16620
+ if (!Globals.RENDERSHADOW)
1658716621 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816622
1658916623 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16593,7 +16627,7 @@
1659316627 //gl.glColorMask(false, false, false, false);
1659416628
1659516629 //render_scene_from_light_view(gl, drawable, 0, 0);
16596
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16630
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1659716631 {
1659816632 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659916633