Normand Briere
2019-06-11 4113164b3be1e50251ac40d6fd65660f0a6c2e63
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 }
....@@ -2267,9 +2265,9 @@
22672265 LOOKAT ^= true;
22682266 }
22692267
2270
- void ToggleRandom()
2268
+ void ToggleSwitch()
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
....@@ -8023,7 +8022,7 @@
80238022 }
80248023 }
80258024
8026
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8025
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80278026 {
80288027 if (// DrawMode() != 0 || /*tex == null ||*/
80298028 ambientOcclusion ) // || !textureon)
....@@ -8068,7 +8067,7 @@
80688067 return; // true;
80698068 }
80708069
8071
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8070
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80728071 {
80738072 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80748073
....@@ -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
....@@ -8181,7 +8184,9 @@
81818184 texturedata = GetFileTexture(cachename, processbump, resolution);
81828185
81838186
8184
- if (texturedata != null)
8187
+ if (texturedata == null)
8188
+ throw new Exception();
8189
+
81858190 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81868191 //texture = GetTexture(tex, bump);
81878192 }
....@@ -8303,7 +8308,7 @@
83038308 return texture;
83048309 }
83058310
8306
- 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
83078312 {
83088313 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83098314
....@@ -8321,14 +8326,14 @@
83218326 return texture!=null?texture.texture:null;
83228327 }
83238328
8324
- 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
83258330 {
83268331 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83278332
83288333 return texture!=null?texture.texturedata:null;
83298334 }
83308335
8331
- boolean BindTexture(String tex, boolean bump, int resolution)
8336
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83328337 {
83338338 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83348339 {
....@@ -9394,7 +9399,7 @@
93949399 //gl.glFlush();
93959400 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93969401
9397
- if (ANIMATION && ABORTED)
9402
+ if (Globals.ANIMATION && ABORTED)
93989403 {
93999404 System.err.println(" ABORTED FRAME");
94009405 break;
....@@ -9424,7 +9429,7 @@
94249429 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94259430
94269431 // save image
9427
- if (ANIMATION && !ABORTED)
9432
+ if (Globals.ANIMATION && !ABORTED)
94289433 {
94299434 VPwidth = viewport[2];
94309435 VPheight = viewport[3];
....@@ -9535,11 +9540,11 @@
95359540
95369541 // imagecount++;
95379542
9538
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9543
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
95399544
95409545 if (!BOXMODE)
95419546 {
9542
- 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) + ")");
95439548 }
95449549
95459550 if (!BOXMODE)
....@@ -9577,7 +9582,7 @@
95779582 ABORTED = false;
95789583 }
95799584 else
9580
- GrafreeD.wav.cursor += 735 * ACSIZE;
9585
+ Grafreed.wav.cursor += 735 * ACSIZE;
95819586
95829587 if (false)
95839588 {
....@@ -10240,11 +10245,11 @@
1024010245
1024110246 public void display(GLAutoDrawable drawable)
1024210247 {
10243
- if (GrafreeD.savesound && GrafreeD.hassound)
10248
+ if (Grafreed.savesound && Grafreed.hassound)
1024410249 {
10245
- GrafreeD.wav.save();
10246
- GrafreeD.savesound = false;
10247
- GrafreeD.hassound = false;
10250
+ Grafreed.wav.save();
10251
+ Grafreed.savesound = false;
10252
+ Grafreed.hassound = false;
1024810253 }
1024910254 // if (DEBUG_SELECTION)
1025010255 // {
....@@ -10374,7 +10379,7 @@
1037410379 Object3D theobject = object;
1037510380 Object3D theparent = object.parent;
1037610381 object.parent = null;
10377
- object = (Object3D)GrafreeD.clone(object);
10382
+ object = (Object3D)Grafreed.clone(object);
1037810383 object.Stripify();
1037910384 if (theobject.selection == null || theobject.selection.Size() == 0)
1038010385 theobject.PreprocessOcclusion(this);
....@@ -10387,13 +10392,13 @@
1038710392 ambientOcclusion = false;
1038810393 }
1038910394
10390
- if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN)
10395
+ if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN)
1039110396 {
1039210397 //if (RENDERSHADOW) // ?
1039310398 if (!IsFrozen())
1039410399 {
1039510400 // dec 2012
10396
- if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0))
10401
+ if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0))
1039710402 {
1039810403 Globals.framecount++;
1039910404 shadowbuffer.display();
....@@ -10795,7 +10800,16 @@
1079510800 // Bump noise
1079610801 gl.glActiveTexture(GL.GL_TEXTURE6);
1079710802 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10798
- 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
+
1079910813
1080010814 gl.glActiveTexture(GL.GL_TEXTURE0);
1080110815 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -11259,8 +11273,14 @@
1125911273 {
1126011274 renderpass++;
1126111275 // System.out.println("Draw object... ");
11276
+ STEP = 1;
1126211277 if (FAST) // in case there is no script
11263
- STEP = 16;
11278
+ STEP = 8;
11279
+
11280
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11281
+ {
11282
+ STEP *= 4;
11283
+ }
1126411284
1126511285 //object.FullInvariants();
1126611286
....@@ -11274,8 +11294,8 @@
1127411294 e.printStackTrace();
1127511295 }
1127611296
11277
- if (GrafreeD.RENDERME > 0)
11278
- GrafreeD.RENDERME--; // mechante magouille
11297
+ if (Grafreed.RENDERME > 0)
11298
+ Grafreed.RENDERME--; // mechante magouille
1127911299
1128011300 Globals.ONESTEP = false;
1128111301 }
....@@ -11345,7 +11365,14 @@
1134511365
1134611366 usedtextures.clear();
1134711367
11348
- 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
+ }
1134911376 }
1135011377 //System.out.println("--> " + stackdepth);
1135111378 // GrafreeD.traceon();
....@@ -11436,7 +11463,14 @@
1143611463 if (checker != null && DrawMode() == DEFAULT)
1143711464 {
1143811465 //BindTexture(IMMORTAL_TEXTURE);
11439
- 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
+ }
1144011474 // NEAREST
1144111475 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144211476 DrawChecker(gl);
....@@ -11518,7 +11552,7 @@
1151811552 return;
1151911553 }
1152011554
11521
- String string = obj.GetToolTip();
11555
+ String string = obj.toString(); //.GetToolTip();
1152211556
1152311557 GL gl = GetGL();
1152411558
....@@ -12468,8 +12502,8 @@
1246812502
1246912503 // display shadow only (bump == 0)
1247012504 "SUB temp.x, half.x, shadow.x;" +
12471
- "MOV temp.y, -params6.x;" +
12472
- "SLT temp.z, temp.y, zero.x;" +
12505
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12506
+ "SLT temp.z, temp.y, -one2048th.x;" +
1247312507 "SUB temp.y, one.x, temp.z;" +
1247412508 "MUL temp.x, temp.x, temp.y;" +
1247512509 "KIL temp.x;" +
....@@ -12598,8 +12632,10 @@
1259812632 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1259912633
1260012634 "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
12635
+ // Tuning for default skin
12636
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12637
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12638
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1260312639 "MUL temp.x, temp.x, temp.y;" +
1260412640
1260512641 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12747,7 +12783,7 @@
1274712783 "MUL final.y, fragment.texcoord[0].x, c256;" +
1274812784 "FLR final.x, final.y;" +
1274912785 "SUB final.y, final.y, final.x;" +
12750
- //"MUL final.x, final.x, c256i;" +
12786
+ "MUL final.x, final.x, c256i;" +
1275112787 "MOV final.z, zero.x;" +
1275212788 "MOV final.a, one.w;":""
1275312789 ) +
....@@ -12755,7 +12791,7 @@
1275512791 "MUL final.y, fragment.texcoord[0].y, c256;" +
1275612792 "FLR final.x, final.y;" +
1275712793 "SUB final.y, final.y, final.x;" +
12758
- //"MUL final.x, final.x, c256i;" +
12794
+ "MUL final.x, final.x, c256i;" +
1275912795 "MOV final.z, zero.x;" +
1276012796 "MOV final.a, one.w;":""
1276112797 ) +
....@@ -12798,7 +12834,7 @@
1279812834 //once = true;
1279912835 }
1280012836
12801
- System.out.print("Program #" + mode + "; length = " + program.length());
12837
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280212838 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1280312839 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1280412840
....@@ -12931,12 +12967,16 @@
1293112967
1293212968 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1293312969 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12970
+
12971
+ // Compare fragment depth in light space with shadowmap.
1293412972 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1293512973 "SGE temp.y, temp.x, zero.x;" +
12936
- "SUB " + shadow + ".y, one.x, temp.y;" +
12974
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12975
+
12976
+ // Reverse comparison
1293712977 "SUB temp.x, one.x, temp.x;" +
1293812978 "MUL " + shadow + ".x, temp.x, temp.y;" +
12939
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
12979
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294012980 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294112981
1294212982 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12950,6 +12990,10 @@
1295012990 // No shadow for backface
1295112991 "DP3 temp.x, normal, lightd;" +
1295212992 "SLT temp.x, temp.x, zero.x;" + // shadoweps
12993
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
12994
+
12995
+ // No shadow when out of frustrum
12996
+ "SGE temp.x, " + depth + ".z, one.z;" +
1295312997 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1295412998 "";
1295512999 }
....@@ -13508,7 +13552,7 @@
1350813552 public void mousePressed(MouseEvent e)
1350913553 {
1351013554 //System.out.println("mousePressed: " + e);
13511
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13555
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351213556 }
1351313557
1351413558 static long prevtime = 0;
....@@ -13584,8 +13628,8 @@
1358413628 // mode |= META;
1358513629 //}
1358613630
13587
- SetMouseMode(WHEEL | e.getModifiersEx());
13588
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13631
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13632
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1358913633 anchorX = ax;
1359013634 anchorY = ay;
1359113635 prevX = px;
....@@ -13645,6 +13689,10 @@
1364513689 // wasliveok = true;
1364613690 // waslive = false;
1364713691
13692
+ // May 2019 Forget it:
13693
+ if (true)
13694
+ return;
13695
+
1364813696 // source == timer
1364913697 if (mouseDown)
1365013698 {
....@@ -13683,7 +13731,7 @@
1368313731
1368413732 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368513733
13686
- void clickStart(int x, int y, int modifiers)
13734
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368713735 {
1368813736 if (!wasliveok)
1368913737 return;
....@@ -13700,7 +13748,7 @@
1370013748 // touched = true; // main DL
1370113749 if (isRenderer)
1370213750 {
13703
- SetMouseMode(modifiers);
13751
+ SetMouseMode(modifiers, modifiersex);
1370413752 }
1370513753
1370613754 selectX = anchorX = x;
....@@ -13713,7 +13761,7 @@
1371313761 clicked = true;
1371413762 hold = false;
1371513763
13716
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13764
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371713765 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371813766 {
1371913767 // System.out.println("RESTART II " + modifiers);
....@@ -13744,7 +13792,7 @@
1374413792 info.camera = renderCamera;
1374513793 info.x = x;
1374613794 info.y = y;
13747
- info.modifiers = modifiers;
13795
+ info.modifiers = modifiersex;
1374813796 editObj = object.doEditClick(info, 0);
1374913797 if (!editObj)
1375013798 {
....@@ -13773,7 +13821,7 @@
1377313821 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377413822 }
1377513823 else
13776
- drag(e.getX(), e.getY(), e.getModifiersEx());
13824
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377713825
1377813826 //try { Thread.sleep(1); } catch (Exception ex) {}
1377913827 }
....@@ -13946,6 +13994,7 @@
1394613994
1394713995 public void run()
1394813996 {
13997
+ new Exception().printStackTrace();
1394913998 System.exit(0);
1395013999 for (;;)
1395114000 {
....@@ -14009,7 +14058,7 @@
1400914058 {
1401014059 Globals.lighttouched = true;
1401114060 }
14012
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14061
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401314062 }
1401414063 //else
1401514064 }
....@@ -14109,7 +14158,7 @@
1410914158 int X, Y;
1411014159 boolean SX, SY;
1411114160
14112
- void drag(int x, int y, int modifiers)
14161
+ void drag(int x, int y, int modifiers, int modifiersex)
1411314162 {
1411414163 if (IsFrozen())
1411514164 {
....@@ -14118,17 +14167,17 @@
1411814167
1411914168 drag = true; // NEW
1412014169
14121
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14170
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412214171
1412314172 X = x;
1412414173 Y = y;
1412514174 // floating state for animation
14126
- MODIFIERS = modifiers;
14127
- modifiers &= ~1024;
14175
+ MODIFIERS = modifiersex;
14176
+ modifiersex &= ~1024;
1412814177 if (false) // modifiers != 0)
1412914178 {
1413014179 //new Exception().printStackTrace();
14131
- System.out.println("mouseDragged: " + modifiers);
14180
+ System.out.println("mouseDragged: " + modifiersex);
1413214181 System.out.println("SHIFT = " + SHIFT);
1413314182 System.out.println("CONTROL = " + COMMAND);
1413414183 System.out.println("META = " + META);
....@@ -14148,7 +14197,7 @@
1414814197 info.camera = renderCamera;
1414914198 info.x = x;
1415014199 info.y = y;
14151
- object.editWindow.copy.doEditDrag(info);
14200
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415214201 } else
1415314202 {
1415414203 if (x < startX)
....@@ -14325,6 +14374,7 @@
1432514374 public void mouseReleased(MouseEvent e)
1432614375 {
1432714376 movingcamera = false;
14377
+ X = Y = 0;
1432814378 //System.out.println("mouseReleased: " + e);
1432914379 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433014380 }
....@@ -14347,9 +14397,9 @@
1434714397 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1434814398 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1434914399
14350
- if (control || command || IsFrozen())
14400
+// No delay if (control || command || IsFrozen())
1435114401 timeout = true;
14352
- else
14402
+// ?? May 2019 else
1435314403 // timer.setDelay((modifiers & 128) != 0?0:350);
1435414404 mouseDown = false;
1435514405 if (!control && !command) // june 2013
....@@ -14459,7 +14509,7 @@
1445914509 System.out.println("keyReleased: " + e);
1446014510 }
1446114511
14462
- void SetMouseMode(int modifiers)
14512
+ void SetMouseMode(int modifiers, int modifiersex)
1446314513 {
1446414514 //System.out.println("SetMouseMode = " + modifiers);
1446514515 //modifiers &= ~1024;
....@@ -14471,25 +14521,25 @@
1447114521 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447214522 // return;
1447314523 //System.out.println("SetMode = " + modifiers);
14474
- if ((modifiers & WHEEL) == WHEEL)
14524
+ if ((modifiersex & WHEEL) == WHEEL)
1447514525 {
1447614526 mouseMode |= ZOOM;
1447714527 }
1447814528
1447914529 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14480
- if (capsLocked || (modifiers & META) == META)
14530
+ if (capsLocked) // || (modifiers & META) == META)
1448114531 {
1448214532 mouseMode |= VR; // BACKFORTH;
1448314533 }
14484
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14534
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448514535 {
1448614536 mouseMode |= SELECT;
1448714537 }
14488
- if ((modifiers & COMMAND) == COMMAND)
14538
+ if ((modifiersex & COMMAND) == COMMAND)
1448914539 {
1449014540 mouseMode |= SELECT;
1449114541 }
14492
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14542
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449314543 {
1449414544 mouseMode &= ~VR;
1449514545 mouseMode |= TRANSLATE;
....@@ -14518,7 +14568,7 @@
1451814568
1451914569 if (isRenderer) //
1452014570 {
14521
- SetMouseMode(modifiers);
14571
+ SetMouseMode(0, modifiers);
1452214572 }
1452314573
1452414574 Globals.theRenderer.keyPressed(key);
....@@ -14854,7 +14904,7 @@
1485414904 //RESIZETEXTURE ^= true;
1485514905 //break;
1485614906 case 'z':
14857
- RENDERSHADOW ^= true;
14907
+ Globals.RENDERSHADOW ^= true;
1485814908 Globals.lighttouched = true;
1485914909 repaint();
1486014910 break;
....@@ -14978,7 +15028,7 @@
1497815028 //mode = ROTATE;
1497915029 if ((MODIFIERS & COMMAND) == 0) // VR??
1498015030 {
14981
- SetMouseMode(modifiers);
15031
+ SetMouseMode(0, modifiers);
1498215032 }
1498315033 }
1498415034
....@@ -15114,7 +15164,7 @@
1511415164 {
1511515165 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511615166 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15117
- if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0)
15167
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1511815168 {
1511915169 mouseMoved(e);
1512015170 } else
....@@ -15144,6 +15194,7 @@
1514415194
1514515195 void SelectParent()
1514615196 {
15197
+ new Exception().printStackTrace();
1514715198 System.exit(0);
1514815199 Composite group = (Composite) object;
1514915200 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -15167,6 +15218,7 @@
1516715218
1516815219 void SelectChildren()
1516915220 {
15221
+ new Exception().printStackTrace();
1517015222 System.exit(0);
1517115223 /*
1517215224 Composite group = (Composite) object;
....@@ -15331,7 +15383,9 @@
1533115383 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1533215384 //Image img = CreateImage(width, height);
1533315385 //System.out.println("width = " + width + "; height = " + height + "\n");
15386
+
1533415387 Graphics gr = g; // img.getGraphics();
15388
+
1533515389 if (!hasMarquee)
1533615390 {
1533715391 if (Xmin < Xmax) // !locked)
....@@ -15429,14 +15483,28 @@
1542915483 if (!isRenderer)
1543015484 {
1543115485 object.drawEditHandles(info, 0);
15486
+
15487
+ if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15488
+ {
15489
+ switch (object.selection.get(0).hitSomething)
15490
+ {
15491
+ case Object3D.hitCenter: gr.setColor(Color.pink); break;
15492
+ case Object3D.hitRotate: gr.setColor(Color.green); break;
15493
+ case Object3D.hitScale: gr.setColor(Color.cyan); break;
15494
+ }
15495
+
15496
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15497
+ }
1543215498 }
1543315499 }
15500
+
1543415501 if (isRenderer)
1543515502 {
1543615503 //gr.setColor(Color.black);
1543715504 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1543815505 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1543915506 }
15507
+
1544015508 if (hasMarquee)
1544115509 {
1544215510 gr.setXORMode(Color.white);
....@@ -15549,6 +15617,7 @@
1554915617 public boolean mouseDown(Event evt, int x, int y)
1555015618 {
1555115619 System.out.println("mouseDown: " + evt);
15620
+ System.exit(0);
1555215621 /*
1555315622 locked = true;
1555415623 drag = false;
....@@ -15592,7 +15661,7 @@
1559215661 {
1559315662 keyPressed(0, modifiers);
1559415663 }
15595
- clickStart(x, y, modifiers);
15664
+ // clickStart(x, y, modifiers);
1559615665 return true;
1559715666 }
1559815667
....@@ -15710,7 +15779,7 @@
1571015779 {
1571115780 keyReleased(0, 0);
1571215781 }
15713
- drag(x, y, modifiers);
15782
+ drag(x, y, 0, modifiers);
1571415783 return true;
1571515784 }
1571615785
....@@ -16280,6 +16349,7 @@
1628016349 {
1628116350 if (!selection)
1628216351 {
16352
+ new Exception().printStackTrace();
1628316353 System.exit(0);
1628416354 return;
1628516355 }
....@@ -16407,16 +16477,16 @@
1640716477 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]));
1640816478 }
1640916479
16410
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16480
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1641116481 }
1641216482 }
1641316483
1641416484 if (!movingcamera && !PAINTMODE)
1641516485 object.editWindow.ScreenFitPoint(); // fev 2014
1641616486
16417
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16487
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1641816488 {
16419
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16489
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1642016490
1642116491 Object3D group = new Object3D("inst" + paintcount++);
1642216492
....@@ -16572,7 +16642,7 @@
1657216642 gl.glDisable(gl.GL_CULL_FACE);
1657316643 }
1657416644
16575
- if (!RENDERSHADOW)
16645
+ if (!Globals.RENDERSHADOW)
1657616646 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1657716647
1657816648 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16582,7 +16652,7 @@
1658216652 //gl.glColorMask(false, false, false, false);
1658316653
1658416654 //render_scene_from_light_view(gl, drawable, 0, 0);
16585
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16655
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1658616656 {
1658716657 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658816658