.. | .. |
---|
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 | |
---|
.. | .. |
---|
149 | 149 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 151 | } |
---|
| 152 | + |
---|
| 153 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
152 | 154 | |
---|
153 | 155 | void SetAsGLRenderer(boolean b) |
---|
154 | 156 | { |
---|
.. | .. |
---|
223 | 225 | public boolean IsBoxMode() |
---|
224 | 226 | { |
---|
225 | 227 | return BOXMODE; |
---|
| 228 | + } |
---|
| 229 | + |
---|
| 230 | + public boolean IsZoomBoxMode() |
---|
| 231 | + { |
---|
| 232 | + return ZOOMBOXMODE; |
---|
226 | 233 | } |
---|
227 | 234 | |
---|
228 | 235 | public void ClearDepth() |
---|
.. | .. |
---|
457 | 464 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
458 | 465 | { |
---|
459 | 466 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
460 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 467 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
461 | 468 | if (!hasnorm) |
---|
462 | 469 | { |
---|
463 | 470 | // System.out.println("FUCK!!"); |
---|
.. | .. |
---|
1612 | 1619 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
1613 | 1620 | if (!material.multiply) |
---|
1614 | 1621 | { |
---|
1615 | | - display.color = color; |
---|
| 1622 | + display.color = material.color; |
---|
1616 | 1623 | display.saturation = material.modulation; |
---|
1617 | 1624 | } |
---|
1618 | 1625 | else |
---|
1619 | 1626 | { |
---|
1620 | | - display.color *= color*2; |
---|
| 1627 | + display.color *= material.color*2; |
---|
1621 | 1628 | display.saturation *= material.modulation*2; |
---|
1622 | 1629 | } |
---|
1623 | 1630 | |
---|
1624 | 1631 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1625 | 1632 | |
---|
1626 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1633 | + float[] colorV = Grafreed.colorV; |
---|
1627 | 1634 | |
---|
1628 | 1635 | /**/ |
---|
1629 | 1636 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1883 | 1890 | void PushMatrix(double[][] matrix) |
---|
1884 | 1891 | { |
---|
1885 | 1892 | // GrafreeD.tracein(matrix); |
---|
1886 | | - PushMatrix(matrix,1); |
---|
| 1893 | + PushMatrix(matrix, 1); |
---|
1887 | 1894 | } |
---|
1888 | 1895 | |
---|
1889 | 1896 | void PushMatrix() |
---|
.. | .. |
---|
2135 | 2142 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2136 | 2143 | |
---|
2137 | 2144 | if (!Globals.isLIVE()) // save sound |
---|
2138 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2145 | + Grafreed.savesound = true; // wav.save(); |
---|
2139 | 2146 | // else |
---|
2140 | 2147 | repaint(); // start loop // may 2013 |
---|
2141 | 2148 | } |
---|
.. | .. |
---|
2168 | 2175 | public void ToggleBoxMode() |
---|
2169 | 2176 | { |
---|
2170 | 2177 | BOXMODE ^= true; |
---|
| 2178 | + } |
---|
| 2179 | + |
---|
| 2180 | + public void ToggleZoomBoxMode() |
---|
| 2181 | + { |
---|
| 2182 | + ZOOMBOXMODE ^= true; |
---|
2171 | 2183 | } |
---|
2172 | 2184 | |
---|
2173 | 2185 | public void ToggleSmoothFocus() |
---|
.. | .. |
---|
2255 | 2267 | LOOKAT ^= true; |
---|
2256 | 2268 | } |
---|
2257 | 2269 | |
---|
2258 | | - void ToggleRandom() |
---|
| 2270 | + void ToggleSwitch() |
---|
2259 | 2271 | { |
---|
2260 | | - RANDOM ^= true; |
---|
| 2272 | + SWITCH ^= true; |
---|
2261 | 2273 | } |
---|
2262 | 2274 | |
---|
2263 | 2275 | void ToggleHandles() |
---|
.. | .. |
---|
2364 | 2376 | { |
---|
2365 | 2377 | return currentGL; |
---|
2366 | 2378 | } |
---|
2367 | | - |
---|
| 2379 | + |
---|
2368 | 2380 | /**/ |
---|
2369 | 2381 | class CacheTexture |
---|
2370 | 2382 | { |
---|
.. | .. |
---|
4196 | 4208 | |
---|
4197 | 4209 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4198 | 4210 | { |
---|
| 4211 | + new Exception().printStackTrace(); |
---|
4199 | 4212 | System.exit(0); |
---|
4200 | 4213 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4201 | 4214 | |
---|
.. | .. |
---|
7908 | 7921 | ReleaseTexture(pigment, false); |
---|
7909 | 7922 | } |
---|
7910 | 7923 | |
---|
| 7924 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7925 | + { |
---|
| 7926 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7927 | + { |
---|
| 7928 | + return; |
---|
| 7929 | + } |
---|
| 7930 | + |
---|
| 7931 | + if (tex == null) |
---|
| 7932 | + { |
---|
| 7933 | + ReleaseTexture(null, false); |
---|
| 7934 | + return; |
---|
| 7935 | + } |
---|
| 7936 | + |
---|
| 7937 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7938 | + |
---|
| 7939 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7940 | + { |
---|
| 7941 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7942 | + // System.out.println("; bump = " + bump); |
---|
| 7943 | + } |
---|
| 7944 | + |
---|
| 7945 | + if (pigment.equals("")) |
---|
| 7946 | + { |
---|
| 7947 | + pigment = null; |
---|
| 7948 | + } |
---|
| 7949 | + |
---|
| 7950 | + ReleaseTexture(pigment, false); |
---|
| 7951 | + } |
---|
| 7952 | + |
---|
| 7953 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7954 | + { |
---|
| 7955 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7956 | + { |
---|
| 7957 | + return; |
---|
| 7958 | + } |
---|
| 7959 | + |
---|
| 7960 | + if (tex == null) |
---|
| 7961 | + { |
---|
| 7962 | + ReleaseTexture(null, true); |
---|
| 7963 | + return; |
---|
| 7964 | + } |
---|
| 7965 | + |
---|
| 7966 | + String bump = Object3D.GetBump(tex); |
---|
| 7967 | + |
---|
| 7968 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7969 | + { |
---|
| 7970 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7971 | + // System.out.println("; bump = " + bump); |
---|
| 7972 | + } |
---|
| 7973 | + |
---|
| 7974 | + if (bump.equals("")) |
---|
| 7975 | + { |
---|
| 7976 | + bump = null; |
---|
| 7977 | + } |
---|
| 7978 | + |
---|
| 7979 | + ReleaseTexture(bump, true); |
---|
| 7980 | + } |
---|
| 7981 | + |
---|
7911 | 7982 | void ReleaseTexture(String tex, boolean bump) |
---|
7912 | 7983 | { |
---|
7913 | 7984 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
.. | .. |
---|
8011 | 8082 | } |
---|
8012 | 8083 | } |
---|
8013 | 8084 | |
---|
8014 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8085 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8015 | 8086 | { |
---|
8016 | 8087 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8017 | 8088 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8056 | 8127 | return; // true; |
---|
8057 | 8128 | } |
---|
8058 | 8129 | |
---|
8059 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8130 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8131 | + { |
---|
| 8132 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8133 | + ambientOcclusion ) // || !textureon) |
---|
| 8134 | + { |
---|
| 8135 | + return; // false; |
---|
| 8136 | + } |
---|
| 8137 | + |
---|
| 8138 | + if (tex == null) |
---|
| 8139 | + { |
---|
| 8140 | + BindTexture(null,false,resolution); |
---|
| 8141 | + return; |
---|
| 8142 | + } |
---|
| 8143 | + |
---|
| 8144 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8145 | + |
---|
| 8146 | + usedtextures.put(pigment, pigment); |
---|
| 8147 | + |
---|
| 8148 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8149 | + { |
---|
| 8150 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8151 | + // System.out.println("; bump = " + bump); |
---|
| 8152 | + } |
---|
| 8153 | + |
---|
| 8154 | + if (pigment.equals("")) |
---|
| 8155 | + { |
---|
| 8156 | + pigment = null; |
---|
| 8157 | + } |
---|
| 8158 | + |
---|
| 8159 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8160 | + BindTexture(pigment, false, resolution); |
---|
| 8161 | + } |
---|
| 8162 | + |
---|
| 8163 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8164 | + { |
---|
| 8165 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8166 | + ambientOcclusion ) // || !textureon) |
---|
| 8167 | + { |
---|
| 8168 | + return; // false; |
---|
| 8169 | + } |
---|
| 8170 | + |
---|
| 8171 | + if (tex == null) |
---|
| 8172 | + { |
---|
| 8173 | + BindTexture(null,true,resolution); |
---|
| 8174 | + return; |
---|
| 8175 | + } |
---|
| 8176 | + |
---|
| 8177 | + String bump = Object3D.GetBump(tex); |
---|
| 8178 | + |
---|
| 8179 | + usedtextures.put(bump, bump); |
---|
| 8180 | + |
---|
| 8181 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8182 | + { |
---|
| 8183 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8184 | + // System.out.println("; bump = " + bump); |
---|
| 8185 | + } |
---|
| 8186 | + |
---|
| 8187 | + if (bump.equals("")) |
---|
| 8188 | + { |
---|
| 8189 | + bump = null; |
---|
| 8190 | + } |
---|
| 8191 | + |
---|
| 8192 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8193 | + BindTexture(bump, true, resolution); |
---|
| 8194 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8195 | + } |
---|
| 8196 | + |
---|
| 8197 | + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
| 8198 | + |
---|
| 8199 | + private boolean FileExists(String tex) |
---|
| 8200 | + { |
---|
| 8201 | + if (missingTextures.contains(tex)) |
---|
| 8202 | + { |
---|
| 8203 | + return false; |
---|
| 8204 | + } |
---|
| 8205 | + |
---|
| 8206 | + boolean fileExists = new File(tex).exists(); |
---|
| 8207 | + |
---|
| 8208 | + if (!fileExists) |
---|
| 8209 | + { |
---|
| 8210 | + // If file exists, the "new File()" is not executed sgain |
---|
| 8211 | + missingTextures.add(tex); |
---|
| 8212 | + } |
---|
| 8213 | + |
---|
| 8214 | + return fileExists; |
---|
| 8215 | + } |
---|
| 8216 | + |
---|
| 8217 | + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8060 | 8218 | { |
---|
8061 | 8219 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8062 | 8220 | |
---|
.. | .. |
---|
8064 | 8222 | { |
---|
8065 | 8223 | String texname = tex; |
---|
8066 | 8224 | |
---|
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; |
---|
| 8225 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8226 | + |
---|
| 8227 | +// String[] split = tex.split("Textures"); |
---|
| 8228 | +// if (split.length > 1) |
---|
| 8229 | +// texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
| 8230 | +// else |
---|
| 8231 | +// if (!texname.startsWith("/")) |
---|
| 8232 | +// texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8233 | + if (!FileExists(tex)) |
---|
| 8234 | + { |
---|
| 8235 | + texname = fallbackTextureName; |
---|
| 8236 | + } |
---|
8073 | 8237 | |
---|
8074 | 8238 | if (CACHETEXTURE) |
---|
8075 | 8239 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
8138 | 8302 | } |
---|
8139 | 8303 | |
---|
8140 | 8304 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8141 | | - if (!new File(cachename).exists()) |
---|
| 8305 | + if (!FileExists(cachename)) |
---|
8142 | 8306 | cachename = texname; |
---|
8143 | 8307 | else |
---|
8144 | 8308 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8160 | 8324 | } |
---|
8161 | 8325 | |
---|
8162 | 8326 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8163 | | - if (!new File(cachename).exists()) |
---|
| 8327 | + if (!FileExists(cachename)) |
---|
8164 | 8328 | cachename = texname; |
---|
8165 | 8329 | else |
---|
8166 | 8330 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8169 | 8333 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8170 | 8334 | |
---|
8171 | 8335 | |
---|
8172 | | - if (texturedata != null) |
---|
| 8336 | + if (texturedata == null) |
---|
| 8337 | + throw new Exception(); |
---|
| 8338 | + |
---|
8173 | 8339 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8174 | 8340 | //texture = GetTexture(tex, bump); |
---|
8175 | 8341 | } |
---|
.. | .. |
---|
8291 | 8457 | return texture; |
---|
8292 | 8458 | } |
---|
8293 | 8459 | |
---|
8294 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) |
---|
| 8460 | + com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8295 | 8461 | { |
---|
8296 | 8462 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8297 | 8463 | |
---|
.. | .. |
---|
8309 | 8475 | return texture!=null?texture.texture:null; |
---|
8310 | 8476 | } |
---|
8311 | 8477 | |
---|
8312 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8478 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
8313 | 8479 | { |
---|
8314 | 8480 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8315 | 8481 | |
---|
8316 | 8482 | return texture!=null?texture.texturedata:null; |
---|
8317 | 8483 | } |
---|
8318 | 8484 | |
---|
8319 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8485 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8320 | 8486 | { |
---|
8321 | 8487 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8322 | 8488 | { |
---|
.. | .. |
---|
9293 | 9459 | assert (parentcam != renderCamera); |
---|
9294 | 9460 | |
---|
9295 | 9461 | if (renderCamera != lightCamera) |
---|
9296 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9297 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9462 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9463 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9298 | 9464 | |
---|
9299 | 9465 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9300 | 9466 | |
---|
.. | .. |
---|
9309 | 9475 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9310 | 9476 | |
---|
9311 | 9477 | if (renderCamera != lightCamera) |
---|
9312 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9313 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9478 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9479 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9314 | 9480 | |
---|
9315 | 9481 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9316 | 9482 | |
---|
.. | .. |
---|
9382 | 9548 | //gl.glFlush(); |
---|
9383 | 9549 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9384 | 9550 | |
---|
9385 | | - if (ANIMATION && ABORTED) |
---|
| 9551 | + if (Globals.ANIMATION && ABORTED) |
---|
9386 | 9552 | { |
---|
9387 | 9553 | System.err.println(" ABORTED FRAME"); |
---|
9388 | 9554 | break; |
---|
.. | .. |
---|
9412 | 9578 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9413 | 9579 | |
---|
9414 | 9580 | // save image |
---|
9415 | | - if (ANIMATION && !ABORTED) |
---|
| 9581 | + if (Globals.ANIMATION && !ABORTED) |
---|
9416 | 9582 | { |
---|
9417 | 9583 | VPwidth = viewport[2]; |
---|
9418 | 9584 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9523 | 9689 | |
---|
9524 | 9690 | // imagecount++; |
---|
9525 | 9691 | |
---|
9526 | | - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
| 9692 | + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
9527 | 9693 | |
---|
9528 | 9694 | if (!BOXMODE) |
---|
9529 | 9695 | { |
---|
9530 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9696 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
9531 | 9697 | } |
---|
9532 | 9698 | |
---|
9533 | 9699 | if (!BOXMODE) |
---|
.. | .. |
---|
9565 | 9731 | ABORTED = false; |
---|
9566 | 9732 | } |
---|
9567 | 9733 | else |
---|
9568 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9734 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9569 | 9735 | |
---|
9570 | 9736 | if (false) |
---|
9571 | 9737 | { |
---|
.. | .. |
---|
10228 | 10394 | |
---|
10229 | 10395 | public void display(GLAutoDrawable drawable) |
---|
10230 | 10396 | { |
---|
10231 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10397 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10232 | 10398 | { |
---|
10233 | | - GrafreeD.wav.save(); |
---|
10234 | | - GrafreeD.savesound = false; |
---|
10235 | | - GrafreeD.hassound = false; |
---|
| 10399 | + Grafreed.wav.save(); |
---|
| 10400 | + Grafreed.savesound = false; |
---|
| 10401 | + Grafreed.hassound = false; |
---|
10236 | 10402 | } |
---|
10237 | 10403 | // if (DEBUG_SELECTION) |
---|
10238 | 10404 | // { |
---|
.. | .. |
---|
10362 | 10528 | Object3D theobject = object; |
---|
10363 | 10529 | Object3D theparent = object.parent; |
---|
10364 | 10530 | object.parent = null; |
---|
10365 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10531 | + object = (Object3D)Grafreed.clone(object); |
---|
10366 | 10532 | object.Stripify(); |
---|
10367 | 10533 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10368 | 10534 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10375 | 10541 | ambientOcclusion = false; |
---|
10376 | 10542 | } |
---|
10377 | 10543 | |
---|
10378 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10544 | + if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10379 | 10545 | { |
---|
10380 | 10546 | //if (RENDERSHADOW) // ? |
---|
10381 | 10547 | if (!IsFrozen()) |
---|
10382 | 10548 | { |
---|
10383 | 10549 | // dec 2012 |
---|
10384 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10550 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10385 | 10551 | { |
---|
10386 | 10552 | Globals.framecount++; |
---|
10387 | 10553 | shadowbuffer.display(); |
---|
.. | .. |
---|
10508 | 10674 | |
---|
10509 | 10675 | // if (parentcam != renderCamera) // not a light |
---|
10510 | 10676 | if (cam != lightCamera) |
---|
10511 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10512 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10677 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10678 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10513 | 10679 | |
---|
10514 | 10680 | for (int j = 0; j < 4; j++) |
---|
10515 | 10681 | { |
---|
.. | .. |
---|
10523 | 10689 | |
---|
10524 | 10690 | // if (parentcam != renderCamera) // not a light |
---|
10525 | 10691 | if (cam != lightCamera) |
---|
10526 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10527 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10692 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10693 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10528 | 10694 | |
---|
10529 | 10695 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10530 | 10696 | |
---|
.. | .. |
---|
10783 | 10949 | // Bump noise |
---|
10784 | 10950 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10785 | 10951 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10786 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 10952 | + |
---|
| 10953 | + try |
---|
| 10954 | + { |
---|
| 10955 | + BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 10956 | + } |
---|
| 10957 | + catch (Exception e) |
---|
| 10958 | + { |
---|
| 10959 | + System.err.println("FAILED: " + NOISE_TEXTURE); |
---|
| 10960 | + } |
---|
| 10961 | + |
---|
10787 | 10962 | |
---|
10788 | 10963 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10789 | 10964 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10908 | 11083 | System.err.println("parentcam != renderCamera"); |
---|
10909 | 11084 | |
---|
10910 | 11085 | // if (cam != lightCamera) |
---|
10911 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10912 | | - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013 |
---|
| 11086 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11087 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10913 | 11088 | } |
---|
10914 | 11089 | |
---|
10915 | 11090 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10930 | 11105 | if (true) // TODO |
---|
10931 | 11106 | { |
---|
10932 | 11107 | if (cam != lightCamera) |
---|
10933 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10934 | | - LA.xformDir(light0, parentcam.toParent, light0); // may 2013 |
---|
| 11108 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11109 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10935 | 11110 | } |
---|
10936 | 11111 | |
---|
10937 | 11112 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11247 | 11422 | { |
---|
11248 | 11423 | renderpass++; |
---|
11249 | 11424 | // System.out.println("Draw object... "); |
---|
| 11425 | + STEP = 1; |
---|
11250 | 11426 | if (FAST) // in case there is no script |
---|
11251 | | - STEP = 16; |
---|
| 11427 | + STEP = 8; |
---|
| 11428 | + |
---|
| 11429 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11430 | + { |
---|
| 11431 | + STEP *= 4; |
---|
| 11432 | + } |
---|
11252 | 11433 | |
---|
11253 | 11434 | //object.FullInvariants(); |
---|
11254 | 11435 | |
---|
.. | .. |
---|
11262 | 11443 | e.printStackTrace(); |
---|
11263 | 11444 | } |
---|
11264 | 11445 | |
---|
11265 | | - if (GrafreeD.RENDERME > 0) |
---|
11266 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11446 | + if (Grafreed.RENDERME > 0) |
---|
| 11447 | + Grafreed.RENDERME--; // mechante magouille |
---|
11267 | 11448 | |
---|
11268 | 11449 | Globals.ONESTEP = false; |
---|
11269 | 11450 | } |
---|
.. | .. |
---|
11333 | 11514 | |
---|
11334 | 11515 | usedtextures.clear(); |
---|
11335 | 11516 | |
---|
11336 | | - BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11517 | + try |
---|
| 11518 | + { |
---|
| 11519 | + BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11520 | + } |
---|
| 11521 | + catch (Exception e) |
---|
| 11522 | + { |
---|
| 11523 | + System.err.println("FAILED: " + DEFAULT_TEXTURES); |
---|
| 11524 | + } |
---|
11337 | 11525 | } |
---|
11338 | 11526 | //System.out.println("--> " + stackdepth); |
---|
11339 | 11527 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11424 | 11612 | if (checker != null && DrawMode() == DEFAULT) |
---|
11425 | 11613 | { |
---|
11426 | 11614 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11427 | | - BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11615 | + try |
---|
| 11616 | + { |
---|
| 11617 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11618 | + } |
---|
| 11619 | + catch (Exception e) |
---|
| 11620 | + { |
---|
| 11621 | + System.err.println("FAILED: " + checker.GetTextures()); |
---|
| 11622 | + } |
---|
11428 | 11623 | // NEAREST |
---|
11429 | 11624 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11430 | 11625 | DrawChecker(gl); |
---|
.. | .. |
---|
11506 | 11701 | return; |
---|
11507 | 11702 | } |
---|
11508 | 11703 | |
---|
11509 | | - String string = obj.GetToolTip(); |
---|
| 11704 | + String string = obj.toString(); //.GetToolTip(); |
---|
11510 | 11705 | |
---|
11511 | 11706 | GL gl = GetGL(); |
---|
11512 | 11707 | |
---|
.. | .. |
---|
11823 | 12018 | //obj.TransformToWorld(light, light); |
---|
11824 | 12019 | for (int i = tp.size(); --i >= 0;) |
---|
11825 | 12020 | { |
---|
11826 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11827 | | - LA.xformPos(light, tp.get(i).toParent, light); |
---|
| 12021 | + //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
| 12022 | + LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
11828 | 12023 | } |
---|
11829 | 12024 | |
---|
11830 | 12025 | |
---|
.. | .. |
---|
11841 | 12036 | parentcam = cameras[0]; |
---|
11842 | 12037 | } |
---|
11843 | 12038 | |
---|
11844 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11845 | | - LA.xformPos(light, parentcam.toParent, light); // may 2013 |
---|
| 12039 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 12040 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11846 | 12041 | |
---|
11847 | 12042 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11848 | 12043 | |
---|
.. | .. |
---|
12456 | 12651 | |
---|
12457 | 12652 | // display shadow only (bump == 0) |
---|
12458 | 12653 | "SUB temp.x, half.x, shadow.x;" + |
---|
12459 | | - "MOV temp.y, -params6.x;" + |
---|
12460 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12654 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12655 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12461 | 12656 | "SUB temp.y, one.x, temp.z;" + |
---|
12462 | 12657 | "MUL temp.x, temp.x, temp.y;" + |
---|
12463 | 12658 | "KIL temp.x;" + |
---|
.. | .. |
---|
12586 | 12781 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12587 | 12782 | |
---|
12588 | 12783 | "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 |
---|
| 12784 | + // Tuning for default skin |
---|
| 12785 | + //"ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 12786 | + "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen |
---|
| 12787 | + "ADD temp.y, one.y, options2.y;" + // subsurface |
---|
12591 | 12788 | "MUL temp.x, temp.x, temp.y;" + |
---|
12592 | 12789 | |
---|
12593 | 12790 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12786 | 12983 | //once = true; |
---|
12787 | 12984 | } |
---|
12788 | 12985 | |
---|
12789 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 12986 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12790 | 12987 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12791 | 12988 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12792 | 12989 | |
---|
.. | .. |
---|
12919 | 13116 | |
---|
12920 | 13117 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12921 | 13118 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13119 | + |
---|
| 13120 | + // Compare fragment depth in light space with shadowmap. |
---|
12922 | 13121 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12923 | 13122 | "SGE temp.y, temp.x, zero.x;" + |
---|
12924 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13123 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13124 | + |
---|
| 13125 | + // Reverse comparison |
---|
12925 | 13126 | "SUB temp.x, one.x, temp.x;" + |
---|
12926 | 13127 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12927 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13128 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12928 | 13129 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12929 | 13130 | |
---|
12930 | 13131 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12938 | 13139 | // No shadow for backface |
---|
12939 | 13140 | "DP3 temp.x, normal, lightd;" + |
---|
12940 | 13141 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
| 13142 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 13143 | + |
---|
| 13144 | + // No shadow when out of frustrum |
---|
| 13145 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
12941 | 13146 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12942 | 13147 | ""; |
---|
12943 | 13148 | } |
---|
.. | .. |
---|
13496 | 13701 | public void mousePressed(MouseEvent e) |
---|
13497 | 13702 | { |
---|
13498 | 13703 | //System.out.println("mousePressed: " + e); |
---|
13499 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13704 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13500 | 13705 | } |
---|
13501 | 13706 | |
---|
13502 | 13707 | static long prevtime = 0; |
---|
.. | .. |
---|
13523 | 13728 | |
---|
13524 | 13729 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
13525 | 13730 | |
---|
| 13731 | + if (BUTTONLESSWHEEL) |
---|
13526 | 13732 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
13527 | 13733 | { |
---|
13528 | 13734 | return; |
---|
.. | .. |
---|
13531 | 13737 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13532 | 13738 | |
---|
13533 | 13739 | // TIMER |
---|
13534 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13740 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
13535 | 13741 | { |
---|
13536 | 13742 | keepboxmode = BOXMODE; |
---|
13537 | 13743 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13571 | 13777 | // mode |= META; |
---|
13572 | 13778 | //} |
---|
13573 | 13779 | |
---|
13574 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13575 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13780 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13781 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13576 | 13782 | anchorX = ax; |
---|
13577 | 13783 | anchorY = ay; |
---|
13578 | 13784 | prevX = px; |
---|
.. | .. |
---|
13632 | 13838 | // wasliveok = true; |
---|
13633 | 13839 | // waslive = false; |
---|
13634 | 13840 | |
---|
| 13841 | + // May 2019 Forget it: |
---|
| 13842 | + if (true) |
---|
| 13843 | + return; |
---|
| 13844 | + |
---|
13635 | 13845 | // source == timer |
---|
13636 | 13846 | if (mouseDown) |
---|
13637 | 13847 | { |
---|
.. | .. |
---|
13670 | 13880 | |
---|
13671 | 13881 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13672 | 13882 | |
---|
13673 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13883 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13674 | 13884 | { |
---|
13675 | 13885 | if (!wasliveok) |
---|
13676 | 13886 | return; |
---|
.. | .. |
---|
13687 | 13897 | // touched = true; // main DL |
---|
13688 | 13898 | if (isRenderer) |
---|
13689 | 13899 | { |
---|
13690 | | - SetMouseMode(modifiers); |
---|
| 13900 | + SetMouseMode(modifiers, modifiersex); |
---|
13691 | 13901 | } |
---|
13692 | 13902 | |
---|
13693 | 13903 | selectX = anchorX = x; |
---|
.. | .. |
---|
13700 | 13910 | clicked = true; |
---|
13701 | 13911 | hold = false; |
---|
13702 | 13912 | |
---|
13703 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13913 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13704 | 13914 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13705 | 13915 | { |
---|
13706 | 13916 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13731 | 13941 | info.camera = renderCamera; |
---|
13732 | 13942 | info.x = x; |
---|
13733 | 13943 | info.y = y; |
---|
13734 | | - info.modifiers = modifiers; |
---|
| 13944 | + info.modifiers = modifiersex; |
---|
13735 | 13945 | editObj = object.doEditClick(info, 0); |
---|
13736 | 13946 | if (!editObj) |
---|
13737 | 13947 | { |
---|
.. | .. |
---|
13748 | 13958 | |
---|
13749 | 13959 | public void mouseDragged(MouseEvent e) |
---|
13750 | 13960 | { |
---|
| 13961 | + Globals.MOUSEDRAGGED = true; |
---|
| 13962 | + |
---|
| 13963 | + //System.out.println("mouseDragged: " + e); |
---|
13751 | 13964 | if (isRenderer) |
---|
13752 | 13965 | movingcamera = true; |
---|
| 13966 | + |
---|
13753 | 13967 | //if (drawing) |
---|
13754 | 13968 | //return; |
---|
13755 | | - //System.out.println("mouseDragged: " + e); |
---|
13756 | 13969 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13757 | 13970 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13758 | 13971 | { |
---|
.. | .. |
---|
13760 | 13973 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13761 | 13974 | } |
---|
13762 | 13975 | else |
---|
13763 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13976 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13764 | 13977 | |
---|
13765 | 13978 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13766 | 13979 | } |
---|
.. | .. |
---|
13933 | 14146 | |
---|
13934 | 14147 | public void run() |
---|
13935 | 14148 | { |
---|
| 14149 | + new Exception().printStackTrace(); |
---|
13936 | 14150 | System.exit(0); |
---|
13937 | 14151 | for (;;) |
---|
13938 | 14152 | { |
---|
.. | .. |
---|
13996 | 14210 | { |
---|
13997 | 14211 | Globals.lighttouched = true; |
---|
13998 | 14212 | } |
---|
13999 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14213 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14000 | 14214 | } |
---|
14001 | 14215 | //else |
---|
14002 | 14216 | } |
---|
.. | .. |
---|
14096 | 14310 | int X, Y; |
---|
14097 | 14311 | boolean SX, SY; |
---|
14098 | 14312 | |
---|
14099 | | - void drag(int x, int y, int modifiers) |
---|
| 14313 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14100 | 14314 | { |
---|
14101 | 14315 | if (IsFrozen()) |
---|
14102 | 14316 | { |
---|
.. | .. |
---|
14105 | 14319 | |
---|
14106 | 14320 | drag = true; // NEW |
---|
14107 | 14321 | |
---|
14108 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14322 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14109 | 14323 | |
---|
14110 | 14324 | X = x; |
---|
14111 | 14325 | Y = y; |
---|
14112 | 14326 | // floating state for animation |
---|
14113 | | - MODIFIERS = modifiers; |
---|
14114 | | - modifiers &= ~1024; |
---|
| 14327 | + MODIFIERS = modifiersex; |
---|
| 14328 | + modifiersex &= ~1024; |
---|
14115 | 14329 | if (false) // modifiers != 0) |
---|
14116 | 14330 | { |
---|
14117 | 14331 | //new Exception().printStackTrace(); |
---|
14118 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14332 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14119 | 14333 | System.out.println("SHIFT = " + SHIFT); |
---|
14120 | 14334 | System.out.println("CONTROL = " + COMMAND); |
---|
14121 | 14335 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14135 | 14349 | info.camera = renderCamera; |
---|
14136 | 14350 | info.x = x; |
---|
14137 | 14351 | info.y = y; |
---|
14138 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14352 | + object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14139 | 14353 | } else |
---|
14140 | 14354 | { |
---|
14141 | 14355 | if (x < startX) |
---|
.. | .. |
---|
14287 | 14501 | public void mouseMoved(MouseEvent e) |
---|
14288 | 14502 | { |
---|
14289 | 14503 | //System.out.println("mouseMoved: " + e); |
---|
14290 | | - |
---|
14291 | 14504 | if (isRenderer) |
---|
14292 | 14505 | return; |
---|
14293 | 14506 | |
---|
.. | .. |
---|
14312 | 14525 | |
---|
14313 | 14526 | public void mouseReleased(MouseEvent e) |
---|
14314 | 14527 | { |
---|
| 14528 | + Globals.MOUSEDRAGGED = false; |
---|
| 14529 | + |
---|
14315 | 14530 | movingcamera = false; |
---|
| 14531 | + X = Y = 0; |
---|
14316 | 14532 | //System.out.println("mouseReleased: " + e); |
---|
14317 | 14533 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14318 | 14534 | } |
---|
.. | .. |
---|
14335 | 14551 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14336 | 14552 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14337 | 14553 | |
---|
14338 | | - if (control || command || IsFrozen()) |
---|
| 14554 | +// No delay if (control || command || IsFrozen()) |
---|
14339 | 14555 | timeout = true; |
---|
14340 | | - else |
---|
| 14556 | +// ?? May 2019 else |
---|
14341 | 14557 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14342 | 14558 | mouseDown = false; |
---|
14343 | 14559 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14447 | 14663 | System.out.println("keyReleased: " + e); |
---|
14448 | 14664 | } |
---|
14449 | 14665 | |
---|
14450 | | - void SetMouseMode(int modifiers) |
---|
| 14666 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14451 | 14667 | { |
---|
14452 | 14668 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14453 | 14669 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14459 | 14675 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14460 | 14676 | // return; |
---|
14461 | 14677 | //System.out.println("SetMode = " + modifiers); |
---|
14462 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14678 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14463 | 14679 | { |
---|
14464 | 14680 | mouseMode |= ZOOM; |
---|
14465 | 14681 | } |
---|
14466 | 14682 | |
---|
14467 | 14683 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14468 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14684 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14469 | 14685 | { |
---|
14470 | 14686 | mouseMode |= VR; // BACKFORTH; |
---|
14471 | 14687 | } |
---|
14472 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14688 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14473 | 14689 | { |
---|
14474 | 14690 | mouseMode |= SELECT; |
---|
14475 | 14691 | } |
---|
14476 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14692 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14477 | 14693 | { |
---|
14478 | 14694 | mouseMode |= SELECT; |
---|
14479 | 14695 | } |
---|
14480 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14696 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14481 | 14697 | { |
---|
14482 | 14698 | mouseMode &= ~VR; |
---|
14483 | 14699 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14506 | 14722 | |
---|
14507 | 14723 | if (isRenderer) // |
---|
14508 | 14724 | { |
---|
14509 | | - SetMouseMode(modifiers); |
---|
| 14725 | + SetMouseMode(0, modifiers); |
---|
14510 | 14726 | } |
---|
14511 | 14727 | |
---|
14512 | 14728 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14842 | 15058 | //RESIZETEXTURE ^= true; |
---|
14843 | 15059 | //break; |
---|
14844 | 15060 | case 'z': |
---|
14845 | | - RENDERSHADOW ^= true; |
---|
| 15061 | + Globals.RENDERSHADOW ^= true; |
---|
14846 | 15062 | Globals.lighttouched = true; |
---|
14847 | 15063 | repaint(); |
---|
14848 | 15064 | break; |
---|
.. | .. |
---|
14966 | 15182 | //mode = ROTATE; |
---|
14967 | 15183 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14968 | 15184 | { |
---|
14969 | | - SetMouseMode(modifiers); |
---|
| 15185 | + SetMouseMode(0, modifiers); |
---|
14970 | 15186 | } |
---|
14971 | 15187 | } |
---|
14972 | 15188 | |
---|
.. | .. |
---|
15100 | 15316 | |
---|
15101 | 15317 | protected void processMouseMotionEvent(MouseEvent e) |
---|
15102 | 15318 | { |
---|
15103 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
15104 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15319 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15320 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15321 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15105 | 15322 | { |
---|
15106 | 15323 | mouseMoved(e); |
---|
15107 | 15324 | } else |
---|
.. | .. |
---|
15131 | 15348 | |
---|
15132 | 15349 | void SelectParent() |
---|
15133 | 15350 | { |
---|
| 15351 | + new Exception().printStackTrace(); |
---|
15134 | 15352 | System.exit(0); |
---|
15135 | 15353 | Composite group = (Composite) object; |
---|
15136 | 15354 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15154 | 15372 | |
---|
15155 | 15373 | void SelectChildren() |
---|
15156 | 15374 | { |
---|
| 15375 | + new Exception().printStackTrace(); |
---|
15157 | 15376 | System.exit(0); |
---|
15158 | 15377 | /* |
---|
15159 | 15378 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15318 | 15537 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15319 | 15538 | //Image img = CreateImage(width, height); |
---|
15320 | 15539 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15540 | + |
---|
15321 | 15541 | Graphics gr = g; // img.getGraphics(); |
---|
| 15542 | + |
---|
15322 | 15543 | if (!hasMarquee) |
---|
15323 | 15544 | { |
---|
15324 | 15545 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15416 | 15637 | if (!isRenderer) |
---|
15417 | 15638 | { |
---|
15418 | 15639 | object.drawEditHandles(info, 0); |
---|
| 15640 | + |
---|
| 15641 | + if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15642 | + { |
---|
| 15643 | + switch (object.selection.get(0).hitSomething) |
---|
| 15644 | + { |
---|
| 15645 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15646 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15647 | + break; |
---|
| 15648 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15649 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15650 | + break; |
---|
| 15651 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15652 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15653 | + break; |
---|
| 15654 | + } |
---|
| 15655 | + |
---|
| 15656 | + } |
---|
15419 | 15657 | } |
---|
15420 | 15658 | } |
---|
| 15659 | + |
---|
15421 | 15660 | if (isRenderer) |
---|
15422 | 15661 | { |
---|
15423 | 15662 | //gr.setColor(Color.black); |
---|
15424 | 15663 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15425 | 15664 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15426 | 15665 | } |
---|
| 15666 | + |
---|
15427 | 15667 | if (hasMarquee) |
---|
15428 | 15668 | { |
---|
15429 | 15669 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15536 | 15776 | public boolean mouseDown(Event evt, int x, int y) |
---|
15537 | 15777 | { |
---|
15538 | 15778 | System.out.println("mouseDown: " + evt); |
---|
| 15779 | + System.exit(0); |
---|
15539 | 15780 | /* |
---|
15540 | 15781 | locked = true; |
---|
15541 | 15782 | drag = false; |
---|
.. | .. |
---|
15579 | 15820 | { |
---|
15580 | 15821 | keyPressed(0, modifiers); |
---|
15581 | 15822 | } |
---|
15582 | | - clickStart(x, y, modifiers); |
---|
| 15823 | + // clickStart(x, y, modifiers); |
---|
15583 | 15824 | return true; |
---|
15584 | 15825 | } |
---|
15585 | 15826 | |
---|
.. | .. |
---|
15697 | 15938 | { |
---|
15698 | 15939 | keyReleased(0, 0); |
---|
15699 | 15940 | } |
---|
15700 | | - drag(x, y, modifiers); |
---|
| 15941 | + drag(x, y, 0, modifiers); |
---|
15701 | 15942 | return true; |
---|
15702 | 15943 | } |
---|
15703 | 15944 | |
---|
.. | .. |
---|
15829 | 16070 | Object3D object; |
---|
15830 | 16071 | static Object3D trackedobject; |
---|
15831 | 16072 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15832 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16073 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15833 | 16074 | /*static*/ Camera eyeCamera; |
---|
15834 | 16075 | /*static*/ Camera lightCamera; |
---|
15835 | 16076 | int cameracount; |
---|
.. | .. |
---|
16267 | 16508 | { |
---|
16268 | 16509 | if (!selection) |
---|
16269 | 16510 | { |
---|
| 16511 | + new Exception().printStackTrace(); |
---|
16270 | 16512 | System.exit(0); |
---|
16271 | 16513 | return; |
---|
16272 | 16514 | } |
---|
.. | .. |
---|
16394 | 16636 | 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 | 16637 | } |
---|
16396 | 16638 | |
---|
16397 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16639 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16398 | 16640 | } |
---|
16399 | 16641 | } |
---|
16400 | 16642 | |
---|
16401 | 16643 | if (!movingcamera && !PAINTMODE) |
---|
16402 | 16644 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
16403 | 16645 | |
---|
16404 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16646 | + if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16405 | 16647 | { |
---|
16406 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16648 | + Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16407 | 16649 | |
---|
16408 | 16650 | Object3D group = new Object3D("inst" + paintcount++); |
---|
16409 | 16651 | |
---|
.. | .. |
---|
16559 | 16801 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16560 | 16802 | } |
---|
16561 | 16803 | |
---|
16562 | | - if (!RENDERSHADOW) |
---|
| 16804 | + if (!Globals.RENDERSHADOW) |
---|
16563 | 16805 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16564 | 16806 | |
---|
16565 | 16807 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16569 | 16811 | //gl.glColorMask(false, false, false, false); |
---|
16570 | 16812 | |
---|
16571 | 16813 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16572 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16814 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16573 | 16815 | { |
---|
16574 | 16816 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16575 | 16817 | |
---|