.. | .. |
---|
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); |
---|
.. | .. |
---|
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); |
---|
.. | .. |
---|
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 | |
---|
.. | .. |
---|
14335 | 14396 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14336 | 14397 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14337 | 14398 | |
---|
14338 | | - if (control || command || IsFrozen()) |
---|
| 14399 | +// No delay if (control || command || IsFrozen()) |
---|
14339 | 14400 | timeout = true; |
---|
14340 | | - else |
---|
| 14401 | +// ?? May 2019 else |
---|
14341 | 14402 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14342 | 14403 | mouseDown = false; |
---|
14343 | 14404 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14447 | 14508 | System.out.println("keyReleased: " + e); |
---|
14448 | 14509 | } |
---|
14449 | 14510 | |
---|
14450 | | - void SetMouseMode(int modifiers) |
---|
| 14511 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14451 | 14512 | { |
---|
14452 | 14513 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14453 | 14514 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14459 | 14520 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14460 | 14521 | // return; |
---|
14461 | 14522 | //System.out.println("SetMode = " + modifiers); |
---|
14462 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14523 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14463 | 14524 | { |
---|
14464 | 14525 | mouseMode |= ZOOM; |
---|
14465 | 14526 | } |
---|
14466 | 14527 | |
---|
14467 | 14528 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14468 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14529 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14469 | 14530 | { |
---|
14470 | 14531 | mouseMode |= VR; // BACKFORTH; |
---|
14471 | 14532 | } |
---|
14472 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14533 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14473 | 14534 | { |
---|
14474 | 14535 | mouseMode |= SELECT; |
---|
14475 | 14536 | } |
---|
14476 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14537 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14477 | 14538 | { |
---|
14478 | 14539 | mouseMode |= SELECT; |
---|
14479 | 14540 | } |
---|
14480 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14541 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14481 | 14542 | { |
---|
14482 | 14543 | mouseMode &= ~VR; |
---|
14483 | 14544 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14506 | 14567 | |
---|
14507 | 14568 | if (isRenderer) // |
---|
14508 | 14569 | { |
---|
14509 | | - SetMouseMode(modifiers); |
---|
| 14570 | + SetMouseMode(0, modifiers); |
---|
14510 | 14571 | } |
---|
14511 | 14572 | |
---|
14512 | 14573 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14842 | 14903 | //RESIZETEXTURE ^= true; |
---|
14843 | 14904 | //break; |
---|
14844 | 14905 | case 'z': |
---|
14845 | | - RENDERSHADOW ^= true; |
---|
| 14906 | + Globals.RENDERSHADOW ^= true; |
---|
14846 | 14907 | Globals.lighttouched = true; |
---|
14847 | 14908 | repaint(); |
---|
14848 | 14909 | break; |
---|
.. | .. |
---|
14966 | 15027 | //mode = ROTATE; |
---|
14967 | 15028 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14968 | 15029 | { |
---|
14969 | | - SetMouseMode(modifiers); |
---|
| 15030 | + SetMouseMode(0, modifiers); |
---|
14970 | 15031 | } |
---|
14971 | 15032 | } |
---|
14972 | 15033 | |
---|
.. | .. |
---|
15100 | 15161 | |
---|
15101 | 15162 | protected void processMouseMotionEvent(MouseEvent e) |
---|
15102 | 15163 | { |
---|
15103 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
15104 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15164 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15165 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15166 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15105 | 15167 | { |
---|
15106 | 15168 | mouseMoved(e); |
---|
15107 | 15169 | } else |
---|
.. | .. |
---|
15131 | 15193 | |
---|
15132 | 15194 | void SelectParent() |
---|
15133 | 15195 | { |
---|
| 15196 | + new Exception().printStackTrace(); |
---|
15134 | 15197 | System.exit(0); |
---|
15135 | 15198 | Composite group = (Composite) object; |
---|
15136 | 15199 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15154 | 15217 | |
---|
15155 | 15218 | void SelectChildren() |
---|
15156 | 15219 | { |
---|
| 15220 | + new Exception().printStackTrace(); |
---|
15157 | 15221 | System.exit(0); |
---|
15158 | 15222 | /* |
---|
15159 | 15223 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15536 | 15600 | public boolean mouseDown(Event evt, int x, int y) |
---|
15537 | 15601 | { |
---|
15538 | 15602 | System.out.println("mouseDown: " + evt); |
---|
| 15603 | + System.exit(0); |
---|
15539 | 15604 | /* |
---|
15540 | 15605 | locked = true; |
---|
15541 | 15606 | drag = false; |
---|
.. | .. |
---|
15579 | 15644 | { |
---|
15580 | 15645 | keyPressed(0, modifiers); |
---|
15581 | 15646 | } |
---|
15582 | | - clickStart(x, y, modifiers); |
---|
| 15647 | + // clickStart(x, y, modifiers); |
---|
15583 | 15648 | return true; |
---|
15584 | 15649 | } |
---|
15585 | 15650 | |
---|
.. | .. |
---|
15697 | 15762 | { |
---|
15698 | 15763 | keyReleased(0, 0); |
---|
15699 | 15764 | } |
---|
15700 | | - drag(x, y, modifiers); |
---|
| 15765 | + drag(x, y, 0, modifiers); |
---|
15701 | 15766 | return true; |
---|
15702 | 15767 | } |
---|
15703 | 15768 | |
---|
.. | .. |
---|
16267 | 16332 | { |
---|
16268 | 16333 | if (!selection) |
---|
16269 | 16334 | { |
---|
| 16335 | + new Exception().printStackTrace(); |
---|
16270 | 16336 | System.exit(0); |
---|
16271 | 16337 | return; |
---|
16272 | 16338 | } |
---|
.. | .. |
---|
16394 | 16460 | 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 | 16461 | } |
---|
16396 | 16462 | |
---|
16397 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16463 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16398 | 16464 | } |
---|
16399 | 16465 | } |
---|
16400 | 16466 | |
---|
16401 | 16467 | if (!movingcamera && !PAINTMODE) |
---|
16402 | 16468 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
16403 | 16469 | |
---|
16404 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16470 | + if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16405 | 16471 | { |
---|
16406 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16472 | + Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16407 | 16473 | |
---|
16408 | 16474 | Object3D group = new Object3D("inst" + paintcount++); |
---|
16409 | 16475 | |
---|
.. | .. |
---|
16559 | 16625 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16560 | 16626 | } |
---|
16561 | 16627 | |
---|
16562 | | - if (!RENDERSHADOW) |
---|
| 16628 | + if (!Globals.RENDERSHADOW) |
---|
16563 | 16629 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16564 | 16630 | |
---|
16565 | 16631 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16569 | 16635 | //gl.glColorMask(false, false, false, false); |
---|
16570 | 16636 | |
---|
16571 | 16637 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16572 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16638 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16573 | 16639 | { |
---|
16574 | 16640 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16575 | 16641 | |
---|