.. | .. |
---|
56 | 56 | static int CURRENTANTIALIAS = 0; // 1; |
---|
57 | 57 | /*static*/ boolean RENDERSHADOW = true; |
---|
58 | 58 | /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal |
---|
59 | | - static boolean ANIMATION = false; |
---|
60 | | - static String filename; |
---|
61 | 59 | |
---|
62 | 60 | boolean DISPLAYTEXT = false; |
---|
63 | 61 | //boolean REDUCETEXTURE = true; |
---|
.. | .. |
---|
92 | 90 | |
---|
93 | 91 | static int tickcount = 0; // slow pose issue |
---|
94 | 92 | |
---|
| 93 | +static boolean BUTTONLESSWHEEL = false; |
---|
| 94 | +static boolean ZOOMBOXMODE = false; |
---|
95 | 95 | static boolean BOXMODE = false; |
---|
96 | 96 | static boolean IMAGEFLIP = false; |
---|
97 | 97 | static boolean SMOOTHFOCUS = false; |
---|
.. | .. |
---|
106 | 106 | static boolean OEIL = true; |
---|
107 | 107 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
108 | 108 | static boolean LOOKAT = true; |
---|
109 | | -static boolean RANDOM = true; // false; |
---|
| 109 | +static boolean SWITCH = true; // false; |
---|
110 | 110 | static boolean HANDLES = false; // selection doesn't work!! |
---|
111 | 111 | static boolean PAINTMODE = false; |
---|
112 | 112 | |
---|
.. | .. |
---|
223 | 223 | public boolean IsBoxMode() |
---|
224 | 224 | { |
---|
225 | 225 | return BOXMODE; |
---|
| 226 | + } |
---|
| 227 | + |
---|
| 228 | + public boolean IsZoomBoxMode() |
---|
| 229 | + { |
---|
| 230 | + return ZOOMBOXMODE; |
---|
226 | 231 | } |
---|
227 | 232 | |
---|
228 | 233 | public void ClearDepth() |
---|
.. | .. |
---|
1612 | 1617 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
1613 | 1618 | if (!material.multiply) |
---|
1614 | 1619 | { |
---|
1615 | | - display.color = color; |
---|
| 1620 | + display.color = material.color; |
---|
1616 | 1621 | display.saturation = material.modulation; |
---|
1617 | 1622 | } |
---|
1618 | 1623 | else |
---|
1619 | 1624 | { |
---|
1620 | | - display.color *= color*2; |
---|
| 1625 | + display.color *= material.color*2; |
---|
1621 | 1626 | display.saturation *= material.modulation*2; |
---|
1622 | 1627 | } |
---|
1623 | 1628 | |
---|
1624 | 1629 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1625 | 1630 | |
---|
1626 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1631 | + float[] colorV = Grafreed.colorV; |
---|
1627 | 1632 | |
---|
1628 | 1633 | /**/ |
---|
1629 | 1634 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
2135 | 2140 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2136 | 2141 | |
---|
2137 | 2142 | if (!Globals.isLIVE()) // save sound |
---|
2138 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2143 | + Grafreed.savesound = true; // wav.save(); |
---|
2139 | 2144 | // else |
---|
2140 | 2145 | repaint(); // start loop // may 2013 |
---|
2141 | 2146 | } |
---|
.. | .. |
---|
2168 | 2173 | public void ToggleBoxMode() |
---|
2169 | 2174 | { |
---|
2170 | 2175 | BOXMODE ^= true; |
---|
| 2176 | + } |
---|
| 2177 | + |
---|
| 2178 | + public void ToggleZoomBoxMode() |
---|
| 2179 | + { |
---|
| 2180 | + ZOOMBOXMODE ^= true; |
---|
2171 | 2181 | } |
---|
2172 | 2182 | |
---|
2173 | 2183 | public void ToggleSmoothFocus() |
---|
.. | .. |
---|
2257 | 2267 | |
---|
2258 | 2268 | void ToggleRandom() |
---|
2259 | 2269 | { |
---|
2260 | | - RANDOM ^= true; |
---|
| 2270 | + SWITCH ^= true; |
---|
2261 | 2271 | } |
---|
2262 | 2272 | |
---|
2263 | 2273 | void ToggleHandles() |
---|
.. | .. |
---|
4196 | 4206 | |
---|
4197 | 4207 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4198 | 4208 | { |
---|
| 4209 | + new Exception().printStackTrace(); |
---|
4199 | 4210 | System.exit(0); |
---|
4200 | 4211 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4201 | 4212 | |
---|
.. | .. |
---|
8011 | 8022 | } |
---|
8012 | 8023 | } |
---|
8013 | 8024 | |
---|
8014 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8025 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8015 | 8026 | { |
---|
8016 | 8027 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8017 | 8028 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8056 | 8067 | return; // true; |
---|
8057 | 8068 | } |
---|
8058 | 8069 | |
---|
8059 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8070 | + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8060 | 8071 | { |
---|
8061 | 8072 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8062 | 8073 | |
---|
.. | .. |
---|
8064 | 8075 | { |
---|
8065 | 8076 | String texname = tex; |
---|
8066 | 8077 | |
---|
8067 | | - String[] split = tex.split("Textures"); |
---|
8068 | | - if (split.length > 1) |
---|
8069 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8070 | | - else |
---|
8071 | | - if (!texname.startsWith("/")) |
---|
8072 | | - 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 | + } |
---|
8073 | 8088 | |
---|
8074 | 8089 | if (CACHETEXTURE) |
---|
8075 | 8090 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
8169 | 8184 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8170 | 8185 | |
---|
8171 | 8186 | |
---|
8172 | | - if (texturedata != null) |
---|
| 8187 | + if (texturedata == null) |
---|
| 8188 | + throw new Exception(); |
---|
| 8189 | + |
---|
8173 | 8190 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8174 | 8191 | //texture = GetTexture(tex, bump); |
---|
8175 | 8192 | } |
---|
.. | .. |
---|
8291 | 8308 | return texture; |
---|
8292 | 8309 | } |
---|
8293 | 8310 | |
---|
8294 | | - 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 |
---|
8295 | 8312 | { |
---|
8296 | 8313 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8297 | 8314 | |
---|
.. | .. |
---|
8309 | 8326 | return texture!=null?texture.texture:null; |
---|
8310 | 8327 | } |
---|
8311 | 8328 | |
---|
8312 | | - 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 |
---|
8313 | 8330 | { |
---|
8314 | 8331 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8315 | 8332 | |
---|
8316 | 8333 | return texture!=null?texture.texturedata:null; |
---|
8317 | 8334 | } |
---|
8318 | 8335 | |
---|
8319 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8336 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8320 | 8337 | { |
---|
8321 | 8338 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8322 | 8339 | { |
---|
.. | .. |
---|
9382 | 9399 | //gl.glFlush(); |
---|
9383 | 9400 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9384 | 9401 | |
---|
9385 | | - if (ANIMATION && ABORTED) |
---|
| 9402 | + if (Globals.ANIMATION && ABORTED) |
---|
9386 | 9403 | { |
---|
9387 | 9404 | System.err.println(" ABORTED FRAME"); |
---|
9388 | 9405 | break; |
---|
.. | .. |
---|
9412 | 9429 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9413 | 9430 | |
---|
9414 | 9431 | // save image |
---|
9415 | | - if (ANIMATION && !ABORTED) |
---|
| 9432 | + if (Globals.ANIMATION && !ABORTED) |
---|
9416 | 9433 | { |
---|
9417 | 9434 | VPwidth = viewport[2]; |
---|
9418 | 9435 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9523 | 9540 | |
---|
9524 | 9541 | // imagecount++; |
---|
9525 | 9542 | |
---|
9526 | | - 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; |
---|
9527 | 9544 | |
---|
9528 | 9545 | if (!BOXMODE) |
---|
9529 | 9546 | { |
---|
9530 | | - 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) + ")"); |
---|
9531 | 9548 | } |
---|
9532 | 9549 | |
---|
9533 | 9550 | if (!BOXMODE) |
---|
.. | .. |
---|
9565 | 9582 | ABORTED = false; |
---|
9566 | 9583 | } |
---|
9567 | 9584 | else |
---|
9568 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9585 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9569 | 9586 | |
---|
9570 | 9587 | if (false) |
---|
9571 | 9588 | { |
---|
.. | .. |
---|
10228 | 10245 | |
---|
10229 | 10246 | public void display(GLAutoDrawable drawable) |
---|
10230 | 10247 | { |
---|
10231 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10248 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10232 | 10249 | { |
---|
10233 | | - GrafreeD.wav.save(); |
---|
10234 | | - GrafreeD.savesound = false; |
---|
10235 | | - GrafreeD.hassound = false; |
---|
| 10250 | + Grafreed.wav.save(); |
---|
| 10251 | + Grafreed.savesound = false; |
---|
| 10252 | + Grafreed.hassound = false; |
---|
10236 | 10253 | } |
---|
10237 | 10254 | // if (DEBUG_SELECTION) |
---|
10238 | 10255 | // { |
---|
.. | .. |
---|
10362 | 10379 | Object3D theobject = object; |
---|
10363 | 10380 | Object3D theparent = object.parent; |
---|
10364 | 10381 | object.parent = null; |
---|
10365 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10382 | + object = (Object3D)Grafreed.clone(object); |
---|
10366 | 10383 | object.Stripify(); |
---|
10367 | 10384 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10368 | 10385 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10375 | 10392 | ambientOcclusion = false; |
---|
10376 | 10393 | } |
---|
10377 | 10394 | |
---|
10378 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10395 | + if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10379 | 10396 | { |
---|
10380 | 10397 | //if (RENDERSHADOW) // ? |
---|
10381 | 10398 | if (!IsFrozen()) |
---|
10382 | 10399 | { |
---|
10383 | 10400 | // dec 2012 |
---|
10384 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10401 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10385 | 10402 | { |
---|
10386 | 10403 | Globals.framecount++; |
---|
10387 | 10404 | shadowbuffer.display(); |
---|
.. | .. |
---|
10783 | 10800 | // Bump noise |
---|
10784 | 10801 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10785 | 10802 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10786 | | - 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 | + |
---|
10787 | 10813 | |
---|
10788 | 10814 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10789 | 10815 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11247 | 11273 | { |
---|
11248 | 11274 | renderpass++; |
---|
11249 | 11275 | // System.out.println("Draw object... "); |
---|
| 11276 | + STEP = 1; |
---|
11250 | 11277 | if (FAST) // in case there is no script |
---|
11251 | | - STEP = 16; |
---|
| 11278 | + STEP = 8; |
---|
| 11279 | + |
---|
| 11280 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11281 | + { |
---|
| 11282 | + STEP *= 4; |
---|
| 11283 | + } |
---|
11252 | 11284 | |
---|
11253 | 11285 | //object.FullInvariants(); |
---|
11254 | 11286 | |
---|
.. | .. |
---|
11262 | 11294 | e.printStackTrace(); |
---|
11263 | 11295 | } |
---|
11264 | 11296 | |
---|
11265 | | - if (GrafreeD.RENDERME > 0) |
---|
11266 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11297 | + if (Grafreed.RENDERME > 0) |
---|
| 11298 | + Grafreed.RENDERME--; // mechante magouille |
---|
11267 | 11299 | |
---|
11268 | 11300 | Globals.ONESTEP = false; |
---|
11269 | 11301 | } |
---|
.. | .. |
---|
11333 | 11365 | |
---|
11334 | 11366 | usedtextures.clear(); |
---|
11335 | 11367 | |
---|
11336 | | - 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 | + } |
---|
11337 | 11376 | } |
---|
11338 | 11377 | //System.out.println("--> " + stackdepth); |
---|
11339 | 11378 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11424 | 11463 | if (checker != null && DrawMode() == DEFAULT) |
---|
11425 | 11464 | { |
---|
11426 | 11465 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11427 | | - 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 | + } |
---|
11428 | 11474 | // NEAREST |
---|
11429 | 11475 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11430 | 11476 | DrawChecker(gl); |
---|
.. | .. |
---|
11506 | 11552 | return; |
---|
11507 | 11553 | } |
---|
11508 | 11554 | |
---|
11509 | | - String string = obj.GetToolTip(); |
---|
| 11555 | + String string = obj.toString(); //.GetToolTip(); |
---|
11510 | 11556 | |
---|
11511 | 11557 | GL gl = GetGL(); |
---|
11512 | 11558 | |
---|
.. | .. |
---|
12456 | 12502 | |
---|
12457 | 12503 | // display shadow only (bump == 0) |
---|
12458 | 12504 | "SUB temp.x, half.x, shadow.x;" + |
---|
12459 | | - "MOV temp.y, -params6.x;" + |
---|
12460 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12505 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12506 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12461 | 12507 | "SUB temp.y, one.x, temp.z;" + |
---|
12462 | 12508 | "MUL temp.x, temp.x, temp.y;" + |
---|
12463 | 12509 | "KIL temp.x;" + |
---|
.. | .. |
---|
12586 | 12632 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12587 | 12633 | |
---|
12588 | 12634 | "SUB temp.x, one.x, ndotl.x;" + |
---|
12589 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
12590 | | - "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 |
---|
12591 | 12639 | "MUL temp.x, temp.x, temp.y;" + |
---|
12592 | 12640 | |
---|
12593 | 12641 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12786 | 12834 | //once = true; |
---|
12787 | 12835 | } |
---|
12788 | 12836 | |
---|
12789 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 12837 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12790 | 12838 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12791 | 12839 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12792 | 12840 | |
---|
.. | .. |
---|
12919 | 12967 | |
---|
12920 | 12968 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12921 | 12969 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 12970 | + |
---|
| 12971 | + // Compare fragment depth in light space with shadowmap. |
---|
12922 | 12972 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12923 | 12973 | "SGE temp.y, temp.x, zero.x;" + |
---|
12924 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 12974 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 12975 | + |
---|
| 12976 | + // Reverse comparison |
---|
12925 | 12977 | "SUB temp.x, one.x, temp.x;" + |
---|
12926 | 12978 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12927 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 12979 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12928 | 12980 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12929 | 12981 | |
---|
12930 | 12982 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12938 | 12990 | // No shadow for backface |
---|
12939 | 12991 | "DP3 temp.x, normal, lightd;" + |
---|
12940 | 12992 | "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;" + |
---|
12941 | 12997 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12942 | 12998 | ""; |
---|
12943 | 12999 | } |
---|
.. | .. |
---|
13496 | 13552 | public void mousePressed(MouseEvent e) |
---|
13497 | 13553 | { |
---|
13498 | 13554 | //System.out.println("mousePressed: " + e); |
---|
13499 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13555 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13500 | 13556 | } |
---|
13501 | 13557 | |
---|
13502 | 13558 | static long prevtime = 0; |
---|
.. | .. |
---|
13523 | 13579 | |
---|
13524 | 13580 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
13525 | 13581 | |
---|
| 13582 | + if (BUTTONLESSWHEEL) |
---|
13526 | 13583 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
13527 | 13584 | { |
---|
13528 | 13585 | return; |
---|
.. | .. |
---|
13531 | 13588 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13532 | 13589 | |
---|
13533 | 13590 | // TIMER |
---|
13534 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13591 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
13535 | 13592 | { |
---|
13536 | 13593 | keepboxmode = BOXMODE; |
---|
13537 | 13594 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13571 | 13628 | // mode |= META; |
---|
13572 | 13629 | //} |
---|
13573 | 13630 | |
---|
13574 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13575 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13631 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13632 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13576 | 13633 | anchorX = ax; |
---|
13577 | 13634 | anchorY = ay; |
---|
13578 | 13635 | prevX = px; |
---|
.. | .. |
---|
13632 | 13689 | // wasliveok = true; |
---|
13633 | 13690 | // waslive = false; |
---|
13634 | 13691 | |
---|
| 13692 | + // May 2019 Forget it: |
---|
| 13693 | + if (true) |
---|
| 13694 | + return; |
---|
| 13695 | + |
---|
13635 | 13696 | // source == timer |
---|
13636 | 13697 | if (mouseDown) |
---|
13637 | 13698 | { |
---|
.. | .. |
---|
13670 | 13731 | |
---|
13671 | 13732 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13672 | 13733 | |
---|
13673 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13734 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13674 | 13735 | { |
---|
13675 | 13736 | if (!wasliveok) |
---|
13676 | 13737 | return; |
---|
.. | .. |
---|
13687 | 13748 | // touched = true; // main DL |
---|
13688 | 13749 | if (isRenderer) |
---|
13689 | 13750 | { |
---|
13690 | | - SetMouseMode(modifiers); |
---|
| 13751 | + SetMouseMode(modifiers, modifiersex); |
---|
13691 | 13752 | } |
---|
13692 | 13753 | |
---|
13693 | 13754 | selectX = anchorX = x; |
---|
.. | .. |
---|
13700 | 13761 | clicked = true; |
---|
13701 | 13762 | hold = false; |
---|
13702 | 13763 | |
---|
13703 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13764 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13704 | 13765 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13705 | 13766 | { |
---|
13706 | 13767 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13731 | 13792 | info.camera = renderCamera; |
---|
13732 | 13793 | info.x = x; |
---|
13733 | 13794 | info.y = y; |
---|
13734 | | - info.modifiers = modifiers; |
---|
| 13795 | + info.modifiers = modifiersex; |
---|
13735 | 13796 | editObj = object.doEditClick(info, 0); |
---|
13736 | 13797 | if (!editObj) |
---|
13737 | 13798 | { |
---|
.. | .. |
---|
13748 | 13809 | |
---|
13749 | 13810 | public void mouseDragged(MouseEvent e) |
---|
13750 | 13811 | { |
---|
| 13812 | + //System.out.println("mouseDragged: " + e); |
---|
13751 | 13813 | if (isRenderer) |
---|
13752 | 13814 | movingcamera = true; |
---|
13753 | 13815 | //if (drawing) |
---|
13754 | 13816 | //return; |
---|
13755 | | - //System.out.println("mouseDragged: " + e); |
---|
13756 | 13817 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13757 | 13818 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13758 | 13819 | { |
---|
.. | .. |
---|
13760 | 13821 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13761 | 13822 | } |
---|
13762 | 13823 | else |
---|
13763 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13824 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13764 | 13825 | |
---|
13765 | 13826 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13766 | 13827 | } |
---|
.. | .. |
---|
13933 | 13994 | |
---|
13934 | 13995 | public void run() |
---|
13935 | 13996 | { |
---|
| 13997 | + new Exception().printStackTrace(); |
---|
13936 | 13998 | System.exit(0); |
---|
13937 | 13999 | for (;;) |
---|
13938 | 14000 | { |
---|
.. | .. |
---|
13996 | 14058 | { |
---|
13997 | 14059 | Globals.lighttouched = true; |
---|
13998 | 14060 | } |
---|
13999 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14061 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14000 | 14062 | } |
---|
14001 | 14063 | //else |
---|
14002 | 14064 | } |
---|
.. | .. |
---|
14096 | 14158 | int X, Y; |
---|
14097 | 14159 | boolean SX, SY; |
---|
14098 | 14160 | |
---|
14099 | | - void drag(int x, int y, int modifiers) |
---|
| 14161 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14100 | 14162 | { |
---|
14101 | 14163 | if (IsFrozen()) |
---|
14102 | 14164 | { |
---|
.. | .. |
---|
14105 | 14167 | |
---|
14106 | 14168 | drag = true; // NEW |
---|
14107 | 14169 | |
---|
14108 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14170 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14109 | 14171 | |
---|
14110 | 14172 | X = x; |
---|
14111 | 14173 | Y = y; |
---|
14112 | 14174 | // floating state for animation |
---|
14113 | | - MODIFIERS = modifiers; |
---|
14114 | | - modifiers &= ~1024; |
---|
| 14175 | + MODIFIERS = modifiersex; |
---|
| 14176 | + modifiersex &= ~1024; |
---|
14115 | 14177 | if (false) // modifiers != 0) |
---|
14116 | 14178 | { |
---|
14117 | 14179 | //new Exception().printStackTrace(); |
---|
14118 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14180 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14119 | 14181 | System.out.println("SHIFT = " + SHIFT); |
---|
14120 | 14182 | System.out.println("CONTROL = " + COMMAND); |
---|
14121 | 14183 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14135 | 14197 | info.camera = renderCamera; |
---|
14136 | 14198 | info.x = x; |
---|
14137 | 14199 | info.y = y; |
---|
14138 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14200 | + object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14139 | 14201 | } else |
---|
14140 | 14202 | { |
---|
14141 | 14203 | if (x < startX) |
---|
.. | .. |
---|
14287 | 14349 | public void mouseMoved(MouseEvent e) |
---|
14288 | 14350 | { |
---|
14289 | 14351 | //System.out.println("mouseMoved: " + e); |
---|
14290 | | - |
---|
14291 | 14352 | if (isRenderer) |
---|
14292 | 14353 | return; |
---|
14293 | 14354 | |
---|
.. | .. |
---|
14313 | 14374 | public void mouseReleased(MouseEvent e) |
---|
14314 | 14375 | { |
---|
14315 | 14376 | movingcamera = false; |
---|
| 14377 | + X = Y = 0; |
---|
14316 | 14378 | //System.out.println("mouseReleased: " + e); |
---|
14317 | 14379 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14318 | 14380 | } |
---|
.. | .. |
---|
14335 | 14397 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14336 | 14398 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14337 | 14399 | |
---|
14338 | | - if (control || command || IsFrozen()) |
---|
| 14400 | +// No delay if (control || command || IsFrozen()) |
---|
14339 | 14401 | timeout = true; |
---|
14340 | | - else |
---|
| 14402 | +// ?? May 2019 else |
---|
14341 | 14403 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14342 | 14404 | mouseDown = false; |
---|
14343 | 14405 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14447 | 14509 | System.out.println("keyReleased: " + e); |
---|
14448 | 14510 | } |
---|
14449 | 14511 | |
---|
14450 | | - void SetMouseMode(int modifiers) |
---|
| 14512 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14451 | 14513 | { |
---|
14452 | 14514 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14453 | 14515 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14459 | 14521 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14460 | 14522 | // return; |
---|
14461 | 14523 | //System.out.println("SetMode = " + modifiers); |
---|
14462 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14524 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14463 | 14525 | { |
---|
14464 | 14526 | mouseMode |= ZOOM; |
---|
14465 | 14527 | } |
---|
14466 | 14528 | |
---|
14467 | 14529 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14468 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14530 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14469 | 14531 | { |
---|
14470 | 14532 | mouseMode |= VR; // BACKFORTH; |
---|
14471 | 14533 | } |
---|
14472 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14534 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14473 | 14535 | { |
---|
14474 | 14536 | mouseMode |= SELECT; |
---|
14475 | 14537 | } |
---|
14476 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14538 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14477 | 14539 | { |
---|
14478 | 14540 | mouseMode |= SELECT; |
---|
14479 | 14541 | } |
---|
14480 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14542 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14481 | 14543 | { |
---|
14482 | 14544 | mouseMode &= ~VR; |
---|
14483 | 14545 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14506 | 14568 | |
---|
14507 | 14569 | if (isRenderer) // |
---|
14508 | 14570 | { |
---|
14509 | | - SetMouseMode(modifiers); |
---|
| 14571 | + SetMouseMode(0, modifiers); |
---|
14510 | 14572 | } |
---|
14511 | 14573 | |
---|
14512 | 14574 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14842 | 14904 | //RESIZETEXTURE ^= true; |
---|
14843 | 14905 | //break; |
---|
14844 | 14906 | case 'z': |
---|
14845 | | - RENDERSHADOW ^= true; |
---|
| 14907 | + Globals.RENDERSHADOW ^= true; |
---|
14846 | 14908 | Globals.lighttouched = true; |
---|
14847 | 14909 | repaint(); |
---|
14848 | 14910 | break; |
---|
.. | .. |
---|
14966 | 15028 | //mode = ROTATE; |
---|
14967 | 15029 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14968 | 15030 | { |
---|
14969 | | - SetMouseMode(modifiers); |
---|
| 15031 | + SetMouseMode(0, modifiers); |
---|
14970 | 15032 | } |
---|
14971 | 15033 | } |
---|
14972 | 15034 | |
---|
.. | .. |
---|
15100 | 15162 | |
---|
15101 | 15163 | protected void processMouseMotionEvent(MouseEvent e) |
---|
15102 | 15164 | { |
---|
15103 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
15104 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15165 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15166 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15167 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15105 | 15168 | { |
---|
15106 | 15169 | mouseMoved(e); |
---|
15107 | 15170 | } else |
---|
.. | .. |
---|
15131 | 15194 | |
---|
15132 | 15195 | void SelectParent() |
---|
15133 | 15196 | { |
---|
| 15197 | + new Exception().printStackTrace(); |
---|
15134 | 15198 | System.exit(0); |
---|
15135 | 15199 | Composite group = (Composite) object; |
---|
15136 | 15200 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15154 | 15218 | |
---|
15155 | 15219 | void SelectChildren() |
---|
15156 | 15220 | { |
---|
| 15221 | + new Exception().printStackTrace(); |
---|
15157 | 15222 | System.exit(0); |
---|
15158 | 15223 | /* |
---|
15159 | 15224 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15318 | 15383 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15319 | 15384 | //Image img = CreateImage(width, height); |
---|
15320 | 15385 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15386 | + |
---|
15321 | 15387 | Graphics gr = g; // img.getGraphics(); |
---|
| 15388 | + |
---|
15322 | 15389 | if (!hasMarquee) |
---|
15323 | 15390 | { |
---|
15324 | 15391 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15416 | 15483 | if (!isRenderer) |
---|
15417 | 15484 | { |
---|
15418 | 15485 | 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 | + } |
---|
15419 | 15498 | } |
---|
15420 | 15499 | } |
---|
| 15500 | + |
---|
15421 | 15501 | if (isRenderer) |
---|
15422 | 15502 | { |
---|
15423 | 15503 | //gr.setColor(Color.black); |
---|
15424 | 15504 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15425 | 15505 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15426 | 15506 | } |
---|
| 15507 | + |
---|
15427 | 15508 | if (hasMarquee) |
---|
15428 | 15509 | { |
---|
15429 | 15510 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15536 | 15617 | public boolean mouseDown(Event evt, int x, int y) |
---|
15537 | 15618 | { |
---|
15538 | 15619 | System.out.println("mouseDown: " + evt); |
---|
| 15620 | + System.exit(0); |
---|
15539 | 15621 | /* |
---|
15540 | 15622 | locked = true; |
---|
15541 | 15623 | drag = false; |
---|
.. | .. |
---|
15579 | 15661 | { |
---|
15580 | 15662 | keyPressed(0, modifiers); |
---|
15581 | 15663 | } |
---|
15582 | | - clickStart(x, y, modifiers); |
---|
| 15664 | + // clickStart(x, y, modifiers); |
---|
15583 | 15665 | return true; |
---|
15584 | 15666 | } |
---|
15585 | 15667 | |
---|
.. | .. |
---|
15697 | 15779 | { |
---|
15698 | 15780 | keyReleased(0, 0); |
---|
15699 | 15781 | } |
---|
15700 | | - drag(x, y, modifiers); |
---|
| 15782 | + drag(x, y, 0, modifiers); |
---|
15701 | 15783 | return true; |
---|
15702 | 15784 | } |
---|
15703 | 15785 | |
---|
.. | .. |
---|
16267 | 16349 | { |
---|
16268 | 16350 | if (!selection) |
---|
16269 | 16351 | { |
---|
| 16352 | + new Exception().printStackTrace(); |
---|
16270 | 16353 | System.exit(0); |
---|
16271 | 16354 | return; |
---|
16272 | 16355 | } |
---|
.. | .. |
---|
16394 | 16477 | 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])); |
---|
16395 | 16478 | } |
---|
16396 | 16479 | |
---|
16397 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16480 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16398 | 16481 | } |
---|
16399 | 16482 | } |
---|
16400 | 16483 | |
---|
16401 | 16484 | if (!movingcamera && !PAINTMODE) |
---|
16402 | 16485 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
16403 | 16486 | |
---|
16404 | | - 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) |
---|
16405 | 16488 | { |
---|
16406 | | - 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); |
---|
16407 | 16490 | |
---|
16408 | 16491 | Object3D group = new Object3D("inst" + paintcount++); |
---|
16409 | 16492 | |
---|
.. | .. |
---|
16559 | 16642 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16560 | 16643 | } |
---|
16561 | 16644 | |
---|
16562 | | - if (!RENDERSHADOW) |
---|
| 16645 | + if (!Globals.RENDERSHADOW) |
---|
16563 | 16646 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16564 | 16647 | |
---|
16565 | 16648 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16569 | 16652 | //gl.glColorMask(false, false, false, false); |
---|
16570 | 16653 | |
---|
16571 | 16654 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16572 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16655 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16573 | 16656 | { |
---|
16574 | 16657 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16575 | 16658 | |
---|