Normand Briere
2019-06-09 8558ae86e65457c512a26339d3660d79eee16ae6
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()
....@@ -8024,7 +8022,7 @@
80248022 }
80258023 }
80268024
8027
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8025
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
80288026 {
80298027 if (// DrawMode() != 0 || /*tex == null ||*/
80308028 ambientOcclusion ) // || !textureon)
....@@ -8069,7 +8067,7 @@
80698067 return; // true;
80708068 }
80718069
8072
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8070
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
80738071 {
80748072 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
80758073
....@@ -8077,12 +8075,16 @@
80778075 {
80788076 String texname = tex;
80798077
8080
- String[] split = tex.split("Textures");
8081
- if (split.length > 1)
8082
- texname = "/Users/nbriere/Textures" + split[split.length-1];
8083
- else
8084
- if (!texname.startsWith("/"))
8085
- 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
+ }
80868088
80878089 if (CACHETEXTURE)
80888090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -8182,7 +8184,9 @@
81828184 texturedata = GetFileTexture(cachename, processbump, resolution);
81838185
81848186
8185
- if (texturedata != null)
8187
+ if (texturedata == null)
8188
+ throw new Exception();
8189
+
81868190 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
81878191 //texture = GetTexture(tex, bump);
81888192 }
....@@ -8304,7 +8308,7 @@
83048308 return texture;
83058309 }
83068310
8307
- 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
83088312 {
83098313 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83108314
....@@ -8322,14 +8326,14 @@
83228326 return texture!=null?texture.texture:null;
83238327 }
83248328
8325
- 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
83268330 {
83278331 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
83288332
83298333 return texture!=null?texture.texturedata:null;
83308334 }
83318335
8332
- boolean BindTexture(String tex, boolean bump, int resolution)
8336
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
83338337 {
83348338 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
83358339 {
....@@ -9395,7 +9399,7 @@
93959399 //gl.glFlush();
93969400 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
93979401
9398
- if (ANIMATION && ABORTED)
9402
+ if (Globals.ANIMATION && ABORTED)
93999403 {
94009404 System.err.println(" ABORTED FRAME");
94019405 break;
....@@ -9425,7 +9429,7 @@
94259429 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
94269430
94279431 // save image
9428
- if (ANIMATION && !ABORTED)
9432
+ if (Globals.ANIMATION && !ABORTED)
94299433 {
94309434 VPwidth = viewport[2];
94319435 VPheight = viewport[3];
....@@ -9536,11 +9540,11 @@
95369540
95379541 // imagecount++;
95389542
9539
- 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;
95409544
95419545 if (!BOXMODE)
95429546 {
9543
- 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) + ")");
95449548 }
95459549
95469550 if (!BOXMODE)
....@@ -9578,7 +9582,7 @@
95789582 ABORTED = false;
95799583 }
95809584 else
9581
- GrafreeD.wav.cursor += 735 * ACSIZE;
9585
+ Grafreed.wav.cursor += 735 * ACSIZE;
95829586
95839587 if (false)
95849588 {
....@@ -10241,11 +10245,11 @@
1024110245
1024210246 public void display(GLAutoDrawable drawable)
1024310247 {
10244
- if (GrafreeD.savesound && GrafreeD.hassound)
10248
+ if (Grafreed.savesound && Grafreed.hassound)
1024510249 {
10246
- GrafreeD.wav.save();
10247
- GrafreeD.savesound = false;
10248
- GrafreeD.hassound = false;
10250
+ Grafreed.wav.save();
10251
+ Grafreed.savesound = false;
10252
+ Grafreed.hassound = false;
1024910253 }
1025010254 // if (DEBUG_SELECTION)
1025110255 // {
....@@ -10375,7 +10379,7 @@
1037510379 Object3D theobject = object;
1037610380 Object3D theparent = object.parent;
1037710381 object.parent = null;
10378
- object = (Object3D)GrafreeD.clone(object);
10382
+ object = (Object3D)Grafreed.clone(object);
1037910383 object.Stripify();
1038010384 if (theobject.selection == null || theobject.selection.Size() == 0)
1038110385 theobject.PreprocessOcclusion(this);
....@@ -10796,7 +10800,16 @@
1079610800 // Bump noise
1079710801 gl.glActiveTexture(GL.GL_TEXTURE6);
1079810802 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
10799
- 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
+
1080010813
1080110814 gl.glActiveTexture(GL.GL_TEXTURE0);
1080210815 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -11260,8 +11273,14 @@
1126011273 {
1126111274 renderpass++;
1126211275 // System.out.println("Draw object... ");
11276
+ STEP = 1;
1126311277 if (FAST) // in case there is no script
11264
- STEP = 16;
11278
+ STEP = 8;
11279
+
11280
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11281
+ {
11282
+ STEP *= 4;
11283
+ }
1126511284
1126611285 //object.FullInvariants();
1126711286
....@@ -11275,8 +11294,8 @@
1127511294 e.printStackTrace();
1127611295 }
1127711296
11278
- if (GrafreeD.RENDERME > 0)
11279
- GrafreeD.RENDERME--; // mechante magouille
11297
+ if (Grafreed.RENDERME > 0)
11298
+ Grafreed.RENDERME--; // mechante magouille
1128011299
1128111300 Globals.ONESTEP = false;
1128211301 }
....@@ -11346,7 +11365,14 @@
1134611365
1134711366 usedtextures.clear();
1134811367
11349
- 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
+ }
1135011376 }
1135111377 //System.out.println("--> " + stackdepth);
1135211378 // GrafreeD.traceon();
....@@ -11437,7 +11463,14 @@
1143711463 if (checker != null && DrawMode() == DEFAULT)
1143811464 {
1143911465 //BindTexture(IMMORTAL_TEXTURE);
11440
- 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
+ }
1144111474 // NEAREST
1144211475 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1144311476 DrawChecker(gl);
....@@ -11519,7 +11552,7 @@
1151911552 return;
1152011553 }
1152111554
11522
- String string = obj.GetToolTip();
11555
+ String string = obj.toString(); //.GetToolTip();
1152311556
1152411557 GL gl = GetGL();
1152511558
....@@ -12469,8 +12502,8 @@
1246912502
1247012503 // display shadow only (bump == 0)
1247112504 "SUB temp.x, half.x, shadow.x;" +
12472
- "MOV temp.y, -params6.x;" +
12473
- "SLT temp.z, temp.y, zero.x;" +
12505
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12506
+ "SLT temp.z, temp.y, -one2048th.x;" +
1247412507 "SUB temp.y, one.x, temp.z;" +
1247512508 "MUL temp.x, temp.x, temp.y;" +
1247612509 "KIL temp.x;" +
....@@ -12599,8 +12632,10 @@
1259912632 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1260012633
1260112634 "SUB temp.x, one.x, ndotl.x;" +
12602
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
12603
- "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
1260412639 "MUL temp.x, temp.x, temp.y;" +
1260512640
1260612641 "MUL saturation, saturation, temp.xxxx;" +
....@@ -12748,7 +12783,7 @@
1274812783 "MUL final.y, fragment.texcoord[0].x, c256;" +
1274912784 "FLR final.x, final.y;" +
1275012785 "SUB final.y, final.y, final.x;" +
12751
- //"MUL final.x, final.x, c256i;" +
12786
+ "MUL final.x, final.x, c256i;" +
1275212787 "MOV final.z, zero.x;" +
1275312788 "MOV final.a, one.w;":""
1275412789 ) +
....@@ -12756,7 +12791,7 @@
1275612791 "MUL final.y, fragment.texcoord[0].y, c256;" +
1275712792 "FLR final.x, final.y;" +
1275812793 "SUB final.y, final.y, final.x;" +
12759
- //"MUL final.x, final.x, c256i;" +
12794
+ "MUL final.x, final.x, c256i;" +
1276012795 "MOV final.z, zero.x;" +
1276112796 "MOV final.a, one.w;":""
1276212797 ) +
....@@ -12799,7 +12834,7 @@
1279912834 //once = true;
1280012835 }
1280112836
12802
- System.out.print("Program #" + mode + "; length = " + program.length());
12837
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1280312838 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1280412839 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1280512840
....@@ -12932,12 +12967,16 @@
1293212967
1293312968 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1293412969 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12970
+
12971
+ // Compare fragment depth in light space with shadowmap.
1293512972 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1293612973 "SGE temp.y, temp.x, zero.x;" +
12937
- "SUB " + shadow + ".y, one.x, temp.y;" +
12974
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12975
+
12976
+ // Reverse comparison
1293812977 "SUB temp.x, one.x, temp.x;" +
1293912978 "MUL " + shadow + ".x, temp.x, temp.y;" +
12940
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
12979
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1294112980 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1294212981
1294312982 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12951,6 +12990,10 @@
1295112990 // No shadow for backface
1295212991 "DP3 temp.x, normal, lightd;" +
1295312992 "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;" +
1295412997 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1295512998 "";
1295612999 }
....@@ -13509,7 +13552,7 @@
1350913552 public void mousePressed(MouseEvent e)
1351013553 {
1351113554 //System.out.println("mousePressed: " + e);
13512
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13555
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1351313556 }
1351413557
1351513558 static long prevtime = 0;
....@@ -13585,8 +13628,8 @@
1358513628 // mode |= META;
1358613629 //}
1358713630
13588
- SetMouseMode(WHEEL | e.getModifiersEx());
13589
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13631
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13632
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1359013633 anchorX = ax;
1359113634 anchorY = ay;
1359213635 prevX = px;
....@@ -13646,6 +13689,10 @@
1364613689 // wasliveok = true;
1364713690 // waslive = false;
1364813691
13692
+ // May 2019 Forget it:
13693
+ if (true)
13694
+ return;
13695
+
1364913696 // source == timer
1365013697 if (mouseDown)
1365113698 {
....@@ -13684,7 +13731,7 @@
1368413731
1368513732 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1368613733
13687
- void clickStart(int x, int y, int modifiers)
13734
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1368813735 {
1368913736 if (!wasliveok)
1369013737 return;
....@@ -13701,7 +13748,7 @@
1370113748 // touched = true; // main DL
1370213749 if (isRenderer)
1370313750 {
13704
- SetMouseMode(modifiers);
13751
+ SetMouseMode(modifiers, modifiersex);
1370513752 }
1370613753
1370713754 selectX = anchorX = x;
....@@ -13714,7 +13761,7 @@
1371413761 clicked = true;
1371513762 hold = false;
1371613763
13717
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13764
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1371813765 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1371913766 {
1372013767 // System.out.println("RESTART II " + modifiers);
....@@ -13745,7 +13792,7 @@
1374513792 info.camera = renderCamera;
1374613793 info.x = x;
1374713794 info.y = y;
13748
- info.modifiers = modifiers;
13795
+ info.modifiers = modifiersex;
1374913796 editObj = object.doEditClick(info, 0);
1375013797 if (!editObj)
1375113798 {
....@@ -13774,7 +13821,7 @@
1377413821 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1377513822 }
1377613823 else
13777
- drag(e.getX(), e.getY(), e.getModifiersEx());
13824
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1377813825
1377913826 //try { Thread.sleep(1); } catch (Exception ex) {}
1378013827 }
....@@ -14011,7 +14058,7 @@
1401114058 {
1401214059 Globals.lighttouched = true;
1401314060 }
14014
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14061
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1401514062 }
1401614063 //else
1401714064 }
....@@ -14111,7 +14158,7 @@
1411114158 int X, Y;
1411214159 boolean SX, SY;
1411314160
14114
- void drag(int x, int y, int modifiers)
14161
+ void drag(int x, int y, int modifiers, int modifiersex)
1411514162 {
1411614163 if (IsFrozen())
1411714164 {
....@@ -14120,17 +14167,17 @@
1412014167
1412114168 drag = true; // NEW
1412214169
14123
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14170
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1412414171
1412514172 X = x;
1412614173 Y = y;
1412714174 // floating state for animation
14128
- MODIFIERS = modifiers;
14129
- modifiers &= ~1024;
14175
+ MODIFIERS = modifiersex;
14176
+ modifiersex &= ~1024;
1413014177 if (false) // modifiers != 0)
1413114178 {
1413214179 //new Exception().printStackTrace();
14133
- System.out.println("mouseDragged: " + modifiers);
14180
+ System.out.println("mouseDragged: " + modifiersex);
1413414181 System.out.println("SHIFT = " + SHIFT);
1413514182 System.out.println("CONTROL = " + COMMAND);
1413614183 System.out.println("META = " + META);
....@@ -14150,7 +14197,7 @@
1415014197 info.camera = renderCamera;
1415114198 info.x = x;
1415214199 info.y = y;
14153
- object.editWindow.copy.doEditDrag(info);
14200
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1415414201 } else
1415514202 {
1415614203 if (x < startX)
....@@ -14327,6 +14374,7 @@
1432714374 public void mouseReleased(MouseEvent e)
1432814375 {
1432914376 movingcamera = false;
14377
+ X = Y = 0;
1433014378 //System.out.println("mouseReleased: " + e);
1433114379 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1433214380 }
....@@ -14349,9 +14397,9 @@
1434914397 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1435014398 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1435114399
14352
- if (control || command || IsFrozen())
14400
+// No delay if (control || command || IsFrozen())
1435314401 timeout = true;
14354
- else
14402
+// ?? May 2019 else
1435514403 // timer.setDelay((modifiers & 128) != 0?0:350);
1435614404 mouseDown = false;
1435714405 if (!control && !command) // june 2013
....@@ -14461,7 +14509,7 @@
1446114509 System.out.println("keyReleased: " + e);
1446214510 }
1446314511
14464
- void SetMouseMode(int modifiers)
14512
+ void SetMouseMode(int modifiers, int modifiersex)
1446514513 {
1446614514 //System.out.println("SetMouseMode = " + modifiers);
1446714515 //modifiers &= ~1024;
....@@ -14473,25 +14521,25 @@
1447314521 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1447414522 // return;
1447514523 //System.out.println("SetMode = " + modifiers);
14476
- if ((modifiers & WHEEL) == WHEEL)
14524
+ if ((modifiersex & WHEEL) == WHEEL)
1447714525 {
1447814526 mouseMode |= ZOOM;
1447914527 }
1448014528
1448114529 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
14482
- if (capsLocked || (modifiers & META) == META)
14530
+ if (capsLocked) // || (modifiers & META) == META)
1448314531 {
1448414532 mouseMode |= VR; // BACKFORTH;
1448514533 }
14486
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14534
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1448714535 {
1448814536 mouseMode |= SELECT;
1448914537 }
14490
- if ((modifiers & COMMAND) == COMMAND)
14538
+ if ((modifiersex & COMMAND) == COMMAND)
1449114539 {
1449214540 mouseMode |= SELECT;
1449314541 }
14494
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14542
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1449514543 {
1449614544 mouseMode &= ~VR;
1449714545 mouseMode |= TRANSLATE;
....@@ -14520,7 +14568,7 @@
1452014568
1452114569 if (isRenderer) //
1452214570 {
14523
- SetMouseMode(modifiers);
14571
+ SetMouseMode(0, modifiers);
1452414572 }
1452514573
1452614574 Globals.theRenderer.keyPressed(key);
....@@ -14856,7 +14904,7 @@
1485614904 //RESIZETEXTURE ^= true;
1485714905 //break;
1485814906 case 'z':
14859
- RENDERSHADOW ^= true;
14907
+ Globals.RENDERSHADOW ^= true;
1486014908 Globals.lighttouched = true;
1486114909 repaint();
1486214910 break;
....@@ -14980,7 +15028,7 @@
1498015028 //mode = ROTATE;
1498115029 if ((MODIFIERS & COMMAND) == 0) // VR??
1498215030 {
14983
- SetMouseMode(modifiers);
15031
+ SetMouseMode(0, modifiers);
1498415032 }
1498515033 }
1498615034
....@@ -15116,7 +15164,7 @@
1511615164 {
1511715165 //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
1511815166 //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15119
- 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)
1512015168 {
1512115169 mouseMoved(e);
1512215170 } else
....@@ -15335,7 +15383,9 @@
1533515383 info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1533615384 //Image img = CreateImage(width, height);
1533715385 //System.out.println("width = " + width + "; height = " + height + "\n");
15386
+
1533815387 Graphics gr = g; // img.getGraphics();
15388
+
1533915389 if (!hasMarquee)
1534015390 {
1534115391 if (Xmin < Xmax) // !locked)
....@@ -15433,14 +15483,28 @@
1543315483 if (!isRenderer)
1543415484 {
1543515485 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
+ }
1543615498 }
1543715499 }
15500
+
1543815501 if (isRenderer)
1543915502 {
1544015503 //gr.setColor(Color.black);
1544115504 //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1);
1544215505 //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3);
1544315506 }
15507
+
1544415508 if (hasMarquee)
1544515509 {
1544615510 gr.setXORMode(Color.white);
....@@ -15553,6 +15617,7 @@
1555315617 public boolean mouseDown(Event evt, int x, int y)
1555415618 {
1555515619 System.out.println("mouseDown: " + evt);
15620
+ System.exit(0);
1555615621 /*
1555715622 locked = true;
1555815623 drag = false;
....@@ -15596,7 +15661,7 @@
1559615661 {
1559715662 keyPressed(0, modifiers);
1559815663 }
15599
- clickStart(x, y, modifiers);
15664
+ // clickStart(x, y, modifiers);
1560015665 return true;
1560115666 }
1560215667
....@@ -15714,7 +15779,7 @@
1571415779 {
1571515780 keyReleased(0, 0);
1571615781 }
15717
- drag(x, y, modifiers);
15782
+ drag(x, y, 0, modifiers);
1571815783 return true;
1571915784 }
1572015785
....@@ -16412,16 +16477,16 @@
1641216477 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]));
1641316478 }
1641416479
16415
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16480
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1641616481 }
1641716482 }
1641816483
1641916484 if (!movingcamera && !PAINTMODE)
1642016485 object.editWindow.ScreenFitPoint(); // fev 2014
1642116486
16422
- 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)
1642316488 {
16424
- 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);
1642516490
1642616491 Object3D group = new Object3D("inst" + paintcount++);
1642716492
....@@ -16577,7 +16642,7 @@
1657716642 gl.glDisable(gl.GL_CULL_FACE);
1657816643 }
1657916644
16580
- if (!RENDERSHADOW)
16645
+ if (!Globals.RENDERSHADOW)
1658116646 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1658216647
1658316648 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -16587,7 +16652,7 @@
1658716652 //gl.glColorMask(false, false, false, false);
1658816653
1658916654 //render_scene_from_light_view(gl, drawable, 0, 0);
16590
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16655
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1659116656 {
1659216657 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1659316658