Normand Briere
2019-06-17 26b49d8e26625491f4a407a05e9bc9d72037f938
CameraPane.java
....@@ -150,6 +150,8 @@
150150 defaultcaps.setAccumAlphaBits(16);
151151 }
152152
153
+ private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
154
+
153155 void SetAsGLRenderer(boolean b)
154156 {
155157 isRenderer = b;
....@@ -462,7 +464,7 @@
462464 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
463465 {
464466 //gl.glBegin(gl.GL_TRIANGLES);
465
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
467
+ boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
466468 if (!hasnorm)
467469 {
468470 // System.out.println("FUCK!!");
....@@ -1628,7 +1630,7 @@
16281630
16291631 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
16301632
1631
- float[] colorV = GrafreeD.colorV;
1633
+ float[] colorV = Grafreed.colorV;
16321634
16331635 /**/
16341636 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1888,7 +1890,7 @@
18881890 void PushMatrix(double[][] matrix)
18891891 {
18901892 // GrafreeD.tracein(matrix);
1891
- PushMatrix(matrix,1);
1893
+ PushMatrix(matrix, 1);
18921894 }
18931895
18941896 void PushMatrix()
....@@ -2140,7 +2142,7 @@
21402142 System.err.println("LIVE = " + Globals.isLIVE());
21412143
21422144 if (!Globals.isLIVE()) // save sound
2143
- GrafreeD.savesound = true; // wav.save();
2145
+ Grafreed.savesound = true; // wav.save();
21442146 // else
21452147 repaint(); // start loop // may 2013
21462148 }
....@@ -2265,7 +2267,7 @@
22652267 LOOKAT ^= true;
22662268 }
22672269
2268
- void ToggleRandom()
2270
+ void ToggleSwitch()
22692271 {
22702272 SWITCH ^= true;
22712273 }
....@@ -2374,7 +2376,7 @@
23742376 {
23752377 return currentGL;
23762378 }
2377
-
2379
+
23782380 /**/
23792381 class CacheTexture
23802382 {
....@@ -8022,7 +8024,7 @@
80228024 }
80238025 }
80248026
8025
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8027
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80268028 {
80278029 if (// DrawMode() != 0 || /*tex == null ||*/
80288030 ambientOcclusion ) // || !textureon)
....@@ -8067,7 +8069,27 @@
80678069 return; // true;
80688070 }
80698071
8070
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8072
+ java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();
8073
+
8074
+ private boolean FileExists(String tex)
8075
+ {
8076
+ if (missingTextures.contains(tex))
8077
+ {
8078
+ return false;
8079
+ }
8080
+
8081
+ boolean fileExists = new File(tex).exists();
8082
+
8083
+ if (!fileExists)
8084
+ {
8085
+ // If file exists, the "new File()" is not executed sgain
8086
+ missingTextures.add(tex);
8087
+ }
8088
+
8089
+ return fileExists;
8090
+ }
8091
+
8092
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80718093 {
80728094 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80738095
....@@ -8075,15 +8097,17 @@
80758097 {
80768098 String texname = tex;
80778099
8100
+ String fallbackTextureName = defaultDirectory + "/Textures/" + texname;
8101
+
80788102 // String[] split = tex.split("Textures");
80798103 // if (split.length > 1)
80808104 // texname = "/Users/nbriere/Textures" + split[split.length-1];
80818105 // else
80828106 // if (!texname.startsWith("/"))
80838107 // texname = "/Users/nbriere/Textures/" + texname;
8084
- if (!new File(tex).exists())
8108
+ if (!FileExists(tex))
80858109 {
8086
- texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8110
+ texname = fallbackTextureName;
80878111 }
80888112
80898113 if (CACHETEXTURE)
....@@ -8153,7 +8177,7 @@
81538177 }
81548178
81558179 cachename = texname.substring(0, texname.length()-4)+ext+".jpg";
8156
- if (!new File(cachename).exists())
8180
+ if (!FileExists(cachename))
81578181 cachename = texname;
81588182 else
81598183 processbump = false; // don't process bump map again
....@@ -8175,7 +8199,7 @@
81758199 }
81768200
81778201 cachename = texname.substring(0, texname.length()-4)+ext+".png";
8178
- if (!new File(cachename).exists())
8202
+ if (!FileExists(cachename))
81798203 cachename = texname;
81808204 else
81818205 processbump = false; // don't process bump map again
....@@ -8184,7 +8208,9 @@
81848208 texturedata = GetFileTexture(cachename, processbump, resolution);
81858209
81868210
8187
- if (texturedata != null)
8211
+ if (texturedata == null)
8212
+ throw new Exception();
8213
+
81888214 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81898215 //texture = GetTexture(tex, bump);
81908216 }
....@@ -8306,7 +8332,7 @@
83068332 return texture;
83078333 }
83088334
8309
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8335
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
83108336 {
83118337 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83128338
....@@ -8324,14 +8350,14 @@
83248350 return texture!=null?texture.texture:null;
83258351 }
83268352
8327
- public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8353
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
83288354 {
83298355 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83308356
83318357 return texture!=null?texture.texturedata:null;
83328358 }
83338359
8334
- boolean BindTexture(String tex, boolean bump, int resolution)
8360
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83358361 {
83368362 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83378363 {
....@@ -9308,8 +9334,8 @@
93089334 assert (parentcam != renderCamera);
93099335
93109336 if (renderCamera != lightCamera)
9311
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9312
- LA.matConcat(matrix, parentcam.toParent, matrix);
9337
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9338
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
93139339
93149340 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
93159341
....@@ -9324,8 +9350,8 @@
93249350 LA.matCopy(renderCamera.fromScreen, matrix);
93259351
93269352 if (renderCamera != lightCamera)
9327
- for (int count = parentcam.GetTransformCount(); --count>=0;)
9328
- LA.matConcat(parentcam.fromParent, matrix, matrix);
9353
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
9354
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
93299355
93309356 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
93319357
....@@ -9542,7 +9568,7 @@
95429568
95439569 if (!BOXMODE)
95449570 {
9545
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9571
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
95469572 }
95479573
95489574 if (!BOXMODE)
....@@ -9580,7 +9606,7 @@
95809606 ABORTED = false;
95819607 }
95829608 else
9583
- GrafreeD.wav.cursor += 735 * ACSIZE;
9609
+ Grafreed.wav.cursor += 735 * ACSIZE;
95849610
95859611 if (false)
95869612 {
....@@ -10243,11 +10269,11 @@
1024310269
1024410270 public void display(GLAutoDrawable drawable)
1024510271 {
10246
- if (GrafreeD.savesound && GrafreeD.hassound)
10272
+ if (Grafreed.savesound && Grafreed.hassound)
1024710273 {
10248
- GrafreeD.wav.save();
10249
- GrafreeD.savesound = false;
10250
- GrafreeD.hassound = false;
10274
+ Grafreed.wav.save();
10275
+ Grafreed.savesound = false;
10276
+ Grafreed.hassound = false;
1025110277 }
1025210278 // if (DEBUG_SELECTION)
1025310279 // {
....@@ -10377,7 +10403,7 @@
1037710403 Object3D theobject = object;
1037810404 Object3D theparent = object.parent;
1037910405 object.parent = null;
10380
- object = (Object3D)GrafreeD.clone(object);
10406
+ object = (Object3D)Grafreed.clone(object);
1038110407 object.Stripify();
1038210408 if (theobject.selection == null || theobject.selection.Size() == 0)
1038310409 theobject.PreprocessOcclusion(this);
....@@ -10390,13 +10416,13 @@
1039010416 ambientOcclusion = false;
1039110417 }
1039210418
10393
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10419
+ if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039410420 {
1039510421 //if (RENDERSHADOW) // ?
1039610422 if (!IsFrozen())
1039710423 {
1039810424 // dec 2012
10399
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10425
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1040010426 {
1040110427 Globals.framecount++;
1040210428 shadowbuffer.display();
....@@ -10523,8 +10549,8 @@
1052310549
1052410550 // if (parentcam != renderCamera) // not a light
1052510551 if (cam != lightCamera)
10526
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10527
- LA.matConcat(matrix, parentcam.toParent, matrix);
10552
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10553
+ LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
1052810554
1052910555 for (int j = 0; j < 4; j++)
1053010556 {
....@@ -10538,8 +10564,8 @@
1053810564
1053910565 // if (parentcam != renderCamera) // not a light
1054010566 if (cam != lightCamera)
10541
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10542
- LA.matConcat(parentcam.fromParent, matrix, matrix);
10567
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10568
+ LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
1054310569
1054410570 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1054510571
....@@ -10798,7 +10824,16 @@
1079810824 // Bump noise
1079910825 gl.glActiveTexture(GL.GL_TEXTURE6);
1080010826 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10801
- BindTexture(NOISE_TEXTURE, false, 2);
10827
+
10828
+ try
10829
+ {
10830
+ BindTexture(NOISE_TEXTURE, false, 2);
10831
+ }
10832
+ catch (Exception e)
10833
+ {
10834
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10835
+ }
10836
+
1080210837
1080310838 gl.glActiveTexture(GL.GL_TEXTURE0);
1080410839 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10923,8 +10958,8 @@
1092310958 System.err.println("parentcam != renderCamera");
1092410959
1092510960 // if (cam != lightCamera)
10926
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10927
- LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013
10961
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10962
+ LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
1092810963 }
1092910964
1093010965 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -10945,8 +10980,8 @@
1094510980 if (true) // TODO
1094610981 {
1094710982 if (cam != lightCamera)
10948
- for (int count = parentcam.GetTransformCount(); --count>=0;)
10949
- LA.xformDir(light0, parentcam.toParent, light0); // may 2013
10983
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
10984
+ LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013
1095010985 }
1095110986
1095210987 LA.xformPos(light0, cam.toScreen, light0);
....@@ -11283,8 +11318,8 @@
1128311318 e.printStackTrace();
1128411319 }
1128511320
11286
- if (GrafreeD.RENDERME > 0)
11287
- GrafreeD.RENDERME--; // mechante magouille
11321
+ if (Grafreed.RENDERME > 0)
11322
+ Grafreed.RENDERME--; // mechante magouille
1128811323
1128911324 Globals.ONESTEP = false;
1129011325 }
....@@ -11354,7 +11389,14 @@
1135411389
1135511390 usedtextures.clear();
1135611391
11357
- BindTextures(DEFAULT_TEXTURES, 2);
11392
+ try
11393
+ {
11394
+ BindTextures(DEFAULT_TEXTURES, 2);
11395
+ }
11396
+ catch (Exception e)
11397
+ {
11398
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11399
+ }
1135811400 }
1135911401 //System.out.println("--> " + stackdepth);
1136011402 // GrafreeD.traceon();
....@@ -11445,7 +11487,14 @@
1144511487 if (checker != null && DrawMode() == DEFAULT)
1144611488 {
1144711489 //BindTexture(IMMORTAL_TEXTURE);
11448
- BindTextures(checker.GetTextures(), checker.texres);
11490
+ try
11491
+ {
11492
+ BindTextures(checker.GetTextures(), checker.texres);
11493
+ }
11494
+ catch (Exception e)
11495
+ {
11496
+ System.err.println("FAILED: " + checker.GetTextures());
11497
+ }
1144911498 // NEAREST
1145011499 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1145111500 DrawChecker(gl);
....@@ -11527,7 +11576,7 @@
1152711576 return;
1152811577 }
1152911578
11530
- String string = obj.GetToolTip();
11579
+ String string = obj.toString(); //.GetToolTip();
1153111580
1153211581 GL gl = GetGL();
1153311582
....@@ -11844,8 +11893,8 @@
1184411893 //obj.TransformToWorld(light, light);
1184511894 for (int i = tp.size(); --i >= 0;)
1184611895 {
11847
- for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11848
- LA.xformPos(light, tp.get(i).toParent, light);
11896
+ //for (int count = tp.get(i).GetTransformCount(); --count>=0;)
11897
+ LA.xformPos(light, tp.get(i).GlobalTransform(), light);
1184911898 }
1185011899
1185111900
....@@ -11862,8 +11911,8 @@
1186211911 parentcam = cameras[0];
1186311912 }
1186411913
11865
- for (int count = parentcam.GetTransformCount(); --count>=0;)
11866
- LA.xformPos(light, parentcam.toParent, light); // may 2013
11914
+ //for (int count = parentcam.GetTransformCount(); --count>=0;)
11915
+ LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013
1186711916
1186811917 LA.xformPos(light, renderCamera.toScreen, light);
1186911918
....@@ -12477,8 +12526,8 @@
1247712526
1247812527 // display shadow only (bump == 0)
1247912528 "SUB temp.x, half.x, shadow.x;" +
12480
- "MOV temp.y, -params6.x;" +
12481
- "SLT temp.z, temp.y, zero.x;" +
12529
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12530
+ "SLT temp.z, temp.y, -one2048th.x;" +
1248212531 "SUB temp.y, one.x, temp.z;" +
1248312532 "MUL temp.x, temp.x, temp.y;" +
1248412533 "KIL temp.x;" +
....@@ -12809,7 +12858,7 @@
1280912858 //once = true;
1281012859 }
1281112860
12812
- System.out.print("Program #" + mode + "; length = " + program.length());
12861
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1281312862 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1281412863 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1281512864
....@@ -12942,12 +12991,16 @@
1294212991
1294312992 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1294412993 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12994
+
12995
+ // Compare fragment depth in light space with shadowmap.
1294512996 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1294612997 "SGE temp.y, temp.x, zero.x;" +
12947
- "SUB " + shadow + ".y, one.x, temp.y;" +
12998
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12999
+
13000
+ // Reverse comparison
1294813001 "SUB temp.x, one.x, temp.x;" +
1294913002 "MUL " + shadow + ".x, temp.x, temp.y;" +
12950
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
13003
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1295113004 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1295213005
1295313006 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12961,6 +13014,10 @@
1296113014 // No shadow for backface
1296213015 "DP3 temp.x, normal, lightd;" +
1296313016 "SLT temp.x, temp.x, zero.x;" + // shadoweps
13017
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
13018
+
13019
+ // No shadow when out of frustrum
13020
+ "SGE temp.x, " + depth + ".z, one.z;" +
1296413021 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1296513022 "";
1296613023 }
....@@ -13519,7 +13576,7 @@
1351913576 public void mousePressed(MouseEvent e)
1352013577 {
1352113578 //System.out.println("mousePressed: " + e);
13522
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13579
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1352313580 }
1352413581
1352513582 static long prevtime = 0;
....@@ -13595,8 +13652,8 @@
1359513652 // mode |= META;
1359613653 //}
1359713654
13598
- SetMouseMode(WHEEL | e.getModifiersEx());
13599
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13655
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13656
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1360013657 anchorX = ax;
1360113658 anchorY = ay;
1360213659 prevX = px;
....@@ -13656,6 +13713,10 @@
1365613713 // wasliveok = true;
1365713714 // waslive = false;
1365813715
13716
+ // May 2019 Forget it:
13717
+ if (true)
13718
+ return;
13719
+
1365913720 // source == timer
1366013721 if (mouseDown)
1366113722 {
....@@ -13694,7 +13755,7 @@
1369413755
1369513756 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1369613757
13697
- void clickStart(int x, int y, int modifiers)
13758
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1369813759 {
1369913760 if (!wasliveok)
1370013761 return;
....@@ -13711,7 +13772,7 @@
1371113772 // touched = true; // main DL
1371213773 if (isRenderer)
1371313774 {
13714
- SetMouseMode(modifiers);
13775
+ SetMouseMode(modifiers, modifiersex);
1371513776 }
1371613777
1371713778 selectX = anchorX = x;
....@@ -13724,7 +13785,7 @@
1372413785 clicked = true;
1372513786 hold = false;
1372613787
13727
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13788
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1372813789 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1372913790 {
1373013791 // System.out.println("RESTART II " + modifiers);
....@@ -13755,7 +13816,7 @@
1375513816 info.camera = renderCamera;
1375613817 info.x = x;
1375713818 info.y = y;
13758
- info.modifiers = modifiers;
13819
+ info.modifiers = modifiersex;
1375913820 editObj = object.doEditClick(info, 0);
1376013821 if (!editObj)
1376113822 {
....@@ -13772,9 +13833,12 @@
1377213833
1377313834 public void mouseDragged(MouseEvent e)
1377413835 {
13836
+ Globals.MOUSEDRAGGED = true;
13837
+
1377513838 //System.out.println("mouseDragged: " + e);
1377613839 if (isRenderer)
1377713840 movingcamera = true;
13841
+
1377813842 //if (drawing)
1377913843 //return;
1378013844 if ((e.getModifiersEx() & CTRL) != 0
....@@ -13784,7 +13848,7 @@
1378413848 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1378513849 }
1378613850 else
13787
- drag(e.getX(), e.getY(), e.getModifiersEx());
13851
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1378813852
1378913853 //try { Thread.sleep(1); } catch (Exception ex) {}
1379013854 }
....@@ -14021,7 +14085,7 @@
1402114085 {
1402214086 Globals.lighttouched = true;
1402314087 }
14024
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14088
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1402514089 }
1402614090 //else
1402714091 }
....@@ -14121,7 +14185,7 @@
1412114185 int X, Y;
1412214186 boolean SX, SY;
1412314187
14124
- void drag(int x, int y, int modifiers)
14188
+ void drag(int x, int y, int modifiers, int modifiersex)
1412514189 {
1412614190 if (IsFrozen())
1412714191 {
....@@ -14130,17 +14194,17 @@
1413014194
1413114195 drag = true; // NEW
1413214196
14133
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14197
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1413414198
1413514199 X = x;
1413614200 Y = y;
1413714201 // floating state for animation
14138
- MODIFIERS = modifiers;
14139
- modifiers &= ~1024;
14202
+ MODIFIERS = modifiersex;
14203
+ modifiersex &= ~1024;
1414014204 if (false) // modifiers != 0)
1414114205 {
1414214206 //new Exception().printStackTrace();
14143
- System.out.println("mouseDragged: " + modifiers);
14207
+ System.out.println("mouseDragged: " + modifiersex);
1414414208 System.out.println("SHIFT = " + SHIFT);
1414514209 System.out.println("CONTROL = " + COMMAND);
1414614210 System.out.println("META = " + META);
....@@ -14160,7 +14224,7 @@
1416014224 info.camera = renderCamera;
1416114225 info.x = x;
1416214226 info.y = y;
14163
- object.editWindow.copy.doEditDrag(info);
14227
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1416414228 } else
1416514229 {
1416614230 if (x < startX)
....@@ -14336,7 +14400,10 @@
1433614400
1433714401 public void mouseReleased(MouseEvent e)
1433814402 {
14403
+ Globals.MOUSEDRAGGED = false;
14404
+
1433914405 movingcamera = false;
14406
+ X = Y = 0;
1434014407 //System.out.println("mouseReleased: " + e);
1434114408 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1434214409 }
....@@ -14359,9 +14426,9 @@
1435914426 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1436014427 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1436114428
14362
- if (control || command || IsFrozen())
14429
+// No delay if (control || command || IsFrozen())
1436314430 timeout = true;
14364
- else
14431
+// ?? May 2019 else
1436514432 // timer.setDelay((modifiers & 128) != 0?0:350);
1436614433 mouseDown = false;
1436714434 if (!control && !command) // june 2013
....@@ -14471,7 +14538,7 @@
1447114538 System.out.println("keyReleased: " + e);
1447214539 }
1447314540
14474
- void SetMouseMode(int modifiers)
14541
+ void SetMouseMode(int modifiers, int modifiersex)
1447514542 {
1447614543 //System.out.println("SetMouseMode = " + modifiers);
1447714544 //modifiers &= ~1024;
....@@ -14483,7 +14550,7 @@
1448314550 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1448414551 // return;
1448514552 //System.out.println("SetMode = " + modifiers);
14486
- if ((modifiers & WHEEL) == WHEEL)
14553
+ if ((modifiersex & WHEEL) == WHEEL)
1448714554 {
1448814555 mouseMode |= ZOOM;
1448914556 }
....@@ -14493,15 +14560,15 @@
1449314560 {
1449414561 mouseMode |= VR; // BACKFORTH;
1449514562 }
14496
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14563
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1449714564 {
1449814565 mouseMode |= SELECT;
1449914566 }
14500
- if ((modifiers & COMMAND) == COMMAND)
14567
+ if ((modifiersex & COMMAND) == COMMAND)
1450114568 {
1450214569 mouseMode |= SELECT;
1450314570 }
14504
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14571
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1450514572 {
1450614573 mouseMode &= ~VR;
1450714574 mouseMode |= TRANSLATE;
....@@ -14530,7 +14597,7 @@
1453014597
1453114598 if (isRenderer) //
1453214599 {
14533
- SetMouseMode(modifiers);
14600
+ SetMouseMode(0, modifiers);
1453414601 }
1453514602
1453614603 Globals.theRenderer.keyPressed(key);
....@@ -14866,7 +14933,7 @@
1486614933 //RESIZETEXTURE ^= true;
1486714934 //break;
1486814935 case 'z':
14869
- RENDERSHADOW ^= true;
14936
+ Globals.RENDERSHADOW ^= true;
1487014937 Globals.lighttouched = true;
1487114938 repaint();
1487214939 break;
....@@ -14990,7 +15057,7 @@
1499015057 //mode = ROTATE;
1499115058 if ((MODIFIERS & COMMAND) == 0) // VR??
1499215059 {
14993
- SetMouseMode(modifiers);
15060
+ SetMouseMode(0, modifiers);
1499415061 }
1499515062 }
1499615063
....@@ -15345,7 +15412,9 @@
1534515412 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1534615413 //Image img = CreateImage(width, height);
1534715414 //System.out.println("width = " + width + "; height = " + height + "\n");
15415
+
1534815416 Graphics gr = g; // img.getGraphics();
15417
+
1534915418 if (!hasMarquee)
1535015419 {
1535115420 if (Xmin < Xmax) // !locked)
....@@ -15443,14 +15512,33 @@
1544315512 if (!isRenderer)
1544415513 {
1544515514 object.drawEditHandles(info, 0);
15515
+
15516
+ if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15517
+ {
15518
+ switch (object.selection.get(0).hitSomething)
15519
+ {
15520
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15521
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15522
+ break;
15523
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15524
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15525
+ break;
15526
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15527
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15528
+ break;
15529
+ }
15530
+
15531
+ }
1544615532 }
1544715533 }
15534
+
1544815535 if (isRenderer)
1544915536 {
1545015537 //gr.setColor(Color.black);
1545115538 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1545215539 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1545315540 }
15541
+
1545415542 if (hasMarquee)
1545515543 {
1545615544 gr.setXORMode(Color.white);
....@@ -15563,6 +15651,7 @@
1556315651 public boolean mouseDown(Event evt, int x, int y)
1556415652 {
1556515653 System.out.println("mouseDown: " + evt);
15654
+ System.exit(0);
1556615655 /*
1556715656 locked = true;
1556815657 drag = false;
....@@ -15606,7 +15695,7 @@
1560615695 {
1560715696 keyPressed(0, modifiers);
1560815697 }
15609
- clickStart(x, y, modifiers);
15698
+ // clickStart(x, y, modifiers);
1561015699 return true;
1561115700 }
1561215701
....@@ -15724,7 +15813,7 @@
1572415813 {
1572515814 keyReleased(0, 0);
1572615815 }
15727
- drag(x, y, modifiers);
15816
+ drag(x, y, 0, modifiers);
1572815817 return true;
1572915818 }
1573015819
....@@ -15856,7 +15945,7 @@
1585615945 Object3D object;
1585715946 static Object3D trackedobject;
1585815947 Camera renderCamera; // Light or Eye (or Occlusion)
15859
- /*static*/ Camera manipCamera; // Light or Eye
15948
+ /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light
1586015949 /*static*/ Camera eyeCamera;
1586115950 /*static*/ Camera lightCamera;
1586215951 int cameracount;
....@@ -16422,16 +16511,16 @@
1642216511 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]));
1642316512 }
1642416513
16425
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16514
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1642616515 }
1642716516 }
1642816517
1642916518 if (!movingcamera && !PAINTMODE)
1643016519 object.editWindow.ScreenFitPoint(); // fev 2014
1643116520
16432
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16521
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1643316522 {
16434
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16523
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1643516524
1643616525 Object3D group = new Object3D("inst" + paintcount++);
1643716526
....@@ -16587,7 +16676,7 @@
1658716676 gl.glDisable(gl.GL_CULL_FACE);
1658816677 }
1658916678
16590
- if (!RENDERSHADOW)
16679
+ if (!Globals.RENDERSHADOW)
1659116680 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659216681
1659316682 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16597,7 +16686,7 @@
1659716686 //gl.glColorMask(false, false, false, false);
1659816687
1659916688 //render_scene_from_light_view(gl, drawable, 0, 0);
16600
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16689
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1660116690 {
1660216691 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1660316692