.. | .. |
---|
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; |
---|
.. | .. |
---|
86 | 84 | static boolean FULLSCREEN = false; |
---|
87 | 85 | static boolean SUPPORT = true; |
---|
88 | 86 | static boolean INERTIA = true; |
---|
89 | | -static boolean FAST = true; // false; |
---|
| 87 | +static boolean FAST = false; |
---|
90 | 88 | static boolean SLOWPOSE = false; |
---|
91 | 89 | static boolean FOOTCONTACT = true; |
---|
92 | 90 | |
---|
.. | .. |
---|
108 | 106 | static boolean OEIL = true; |
---|
109 | 107 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
110 | 108 | static boolean LOOKAT = true; |
---|
111 | | -static boolean RANDOM = true; // false; |
---|
| 109 | +static boolean SWITCH = true; // false; |
---|
112 | 110 | static boolean HANDLES = false; // selection doesn't work!! |
---|
113 | 111 | static boolean PAINTMODE = false; |
---|
114 | 112 | |
---|
.. | .. |
---|
151 | 149 | defaultcaps.setAccumBlueBits(16); |
---|
152 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
153 | 151 | } |
---|
| 152 | + |
---|
| 153 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
154 | 154 | |
---|
155 | 155 | void SetAsGLRenderer(boolean b) |
---|
156 | 156 | { |
---|
.. | .. |
---|
464 | 464 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 465 | { |
---|
466 | 466 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - 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); |
---|
468 | 468 | if (!hasnorm) |
---|
469 | 469 | { |
---|
470 | 470 | // System.out.println("FUCK!!"); |
---|
.. | .. |
---|
1630 | 1630 | |
---|
1631 | 1631 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1632 | 1632 | |
---|
1633 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1633 | + float[] colorV = Grafreed.colorV; |
---|
1634 | 1634 | |
---|
1635 | 1635 | /**/ |
---|
1636 | 1636 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1890 | 1890 | void PushMatrix(double[][] matrix) |
---|
1891 | 1891 | { |
---|
1892 | 1892 | // GrafreeD.tracein(matrix); |
---|
1893 | | - PushMatrix(matrix,1); |
---|
| 1893 | + PushMatrix(matrix, 1); |
---|
1894 | 1894 | } |
---|
1895 | 1895 | |
---|
1896 | 1896 | void PushMatrix() |
---|
.. | .. |
---|
2142 | 2142 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2143 | 2143 | |
---|
2144 | 2144 | if (!Globals.isLIVE()) // save sound |
---|
2145 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2145 | + Grafreed.savesound = true; // wav.save(); |
---|
2146 | 2146 | // else |
---|
2147 | 2147 | repaint(); // start loop // may 2013 |
---|
2148 | 2148 | } |
---|
.. | .. |
---|
2267 | 2267 | LOOKAT ^= true; |
---|
2268 | 2268 | } |
---|
2269 | 2269 | |
---|
2270 | | - void ToggleRandom() |
---|
| 2270 | + void ToggleSwitch() |
---|
2271 | 2271 | { |
---|
2272 | | - RANDOM ^= true; |
---|
| 2272 | + SWITCH ^= true; |
---|
2273 | 2273 | } |
---|
2274 | 2274 | |
---|
2275 | 2275 | void ToggleHandles() |
---|
.. | .. |
---|
2376 | 2376 | { |
---|
2377 | 2377 | return currentGL; |
---|
2378 | 2378 | } |
---|
2379 | | - |
---|
| 2379 | + |
---|
2380 | 2380 | /**/ |
---|
2381 | 2381 | class CacheTexture |
---|
2382 | 2382 | { |
---|
.. | .. |
---|
4208 | 4208 | |
---|
4209 | 4209 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4210 | 4210 | { |
---|
| 4211 | + new Exception().printStackTrace(); |
---|
4211 | 4212 | System.exit(0); |
---|
4212 | 4213 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4213 | 4214 | |
---|
.. | .. |
---|
7920 | 7921 | ReleaseTexture(pigment, false); |
---|
7921 | 7922 | } |
---|
7922 | 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 | + |
---|
7923 | 7982 | void ReleaseTexture(String tex, boolean bump) |
---|
7924 | 7983 | { |
---|
7925 | 7984 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
.. | .. |
---|
8023 | 8082 | } |
---|
8024 | 8083 | } |
---|
8025 | 8084 | |
---|
8026 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8085 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8027 | 8086 | { |
---|
8028 | 8087 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8029 | 8088 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8068 | 8127 | return; // true; |
---|
8069 | 8128 | } |
---|
8070 | 8129 | |
---|
8071 | | - 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 |
---|
8072 | 8218 | { |
---|
8073 | 8219 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8074 | 8220 | |
---|
.. | .. |
---|
8076 | 8222 | { |
---|
8077 | 8223 | String texname = tex; |
---|
8078 | 8224 | |
---|
8079 | | - String[] split = tex.split("Textures"); |
---|
8080 | | - if (split.length > 1) |
---|
8081 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8082 | | - else |
---|
8083 | | - if (!texname.startsWith("/")) |
---|
8084 | | - texname = "/Users/nbriere/Textures/" + texname; |
---|
| 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 | + } |
---|
8085 | 8237 | |
---|
8086 | 8238 | if (CACHETEXTURE) |
---|
8087 | 8239 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
8150 | 8302 | } |
---|
8151 | 8303 | |
---|
8152 | 8304 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8153 | | - if (!new File(cachename).exists()) |
---|
| 8305 | + if (!FileExists(cachename)) |
---|
8154 | 8306 | cachename = texname; |
---|
8155 | 8307 | else |
---|
8156 | 8308 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8172 | 8324 | } |
---|
8173 | 8325 | |
---|
8174 | 8326 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8175 | | - if (!new File(cachename).exists()) |
---|
| 8327 | + if (!FileExists(cachename)) |
---|
8176 | 8328 | cachename = texname; |
---|
8177 | 8329 | else |
---|
8178 | 8330 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8181 | 8333 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8182 | 8334 | |
---|
8183 | 8335 | |
---|
8184 | | - if (texturedata != null) |
---|
| 8336 | + if (texturedata == null) |
---|
| 8337 | + throw new Exception(); |
---|
| 8338 | + |
---|
8185 | 8339 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8186 | 8340 | //texture = GetTexture(tex, bump); |
---|
8187 | 8341 | } |
---|
.. | .. |
---|
8303 | 8457 | return texture; |
---|
8304 | 8458 | } |
---|
8305 | 8459 | |
---|
8306 | | - 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 |
---|
8307 | 8461 | { |
---|
8308 | 8462 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8309 | 8463 | |
---|
.. | .. |
---|
8321 | 8475 | return texture!=null?texture.texture:null; |
---|
8322 | 8476 | } |
---|
8323 | 8477 | |
---|
8324 | | - 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 |
---|
8325 | 8479 | { |
---|
8326 | 8480 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8327 | 8481 | |
---|
8328 | 8482 | return texture!=null?texture.texturedata:null; |
---|
8329 | 8483 | } |
---|
8330 | 8484 | |
---|
8331 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8485 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8332 | 8486 | { |
---|
8333 | 8487 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8334 | 8488 | { |
---|
.. | .. |
---|
9305 | 9459 | assert (parentcam != renderCamera); |
---|
9306 | 9460 | |
---|
9307 | 9461 | if (renderCamera != lightCamera) |
---|
9308 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9309 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9462 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9463 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9310 | 9464 | |
---|
9311 | 9465 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9312 | 9466 | |
---|
.. | .. |
---|
9321 | 9475 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9322 | 9476 | |
---|
9323 | 9477 | if (renderCamera != lightCamera) |
---|
9324 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9325 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9478 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9479 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9326 | 9480 | |
---|
9327 | 9481 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9328 | 9482 | |
---|
.. | .. |
---|
9394 | 9548 | //gl.glFlush(); |
---|
9395 | 9549 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9396 | 9550 | |
---|
9397 | | - if (ANIMATION && ABORTED) |
---|
| 9551 | + if (Globals.ANIMATION && ABORTED) |
---|
9398 | 9552 | { |
---|
9399 | 9553 | System.err.println(" ABORTED FRAME"); |
---|
9400 | 9554 | break; |
---|
.. | .. |
---|
9424 | 9578 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9425 | 9579 | |
---|
9426 | 9580 | // save image |
---|
9427 | | - if (ANIMATION && !ABORTED) |
---|
| 9581 | + if (Globals.ANIMATION && !ABORTED) |
---|
9428 | 9582 | { |
---|
9429 | 9583 | VPwidth = viewport[2]; |
---|
9430 | 9584 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9535 | 9689 | |
---|
9536 | 9690 | // imagecount++; |
---|
9537 | 9691 | |
---|
9538 | | - 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; |
---|
9539 | 9693 | |
---|
9540 | 9694 | if (!BOXMODE) |
---|
9541 | 9695 | { |
---|
9542 | | - 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) + ")"); |
---|
9543 | 9697 | } |
---|
9544 | 9698 | |
---|
9545 | 9699 | if (!BOXMODE) |
---|
.. | .. |
---|
9577 | 9731 | ABORTED = false; |
---|
9578 | 9732 | } |
---|
9579 | 9733 | else |
---|
9580 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9734 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9581 | 9735 | |
---|
9582 | 9736 | if (false) |
---|
9583 | 9737 | { |
---|
.. | .. |
---|
10240 | 10394 | |
---|
10241 | 10395 | public void display(GLAutoDrawable drawable) |
---|
10242 | 10396 | { |
---|
10243 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10397 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10244 | 10398 | { |
---|
10245 | | - GrafreeD.wav.save(); |
---|
10246 | | - GrafreeD.savesound = false; |
---|
10247 | | - GrafreeD.hassound = false; |
---|
| 10399 | + Grafreed.wav.save(); |
---|
| 10400 | + Grafreed.savesound = false; |
---|
| 10401 | + Grafreed.hassound = false; |
---|
10248 | 10402 | } |
---|
10249 | 10403 | // if (DEBUG_SELECTION) |
---|
10250 | 10404 | // { |
---|
.. | .. |
---|
10374 | 10528 | Object3D theobject = object; |
---|
10375 | 10529 | Object3D theparent = object.parent; |
---|
10376 | 10530 | object.parent = null; |
---|
10377 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10531 | + object = (Object3D)Grafreed.clone(object); |
---|
10378 | 10532 | object.Stripify(); |
---|
10379 | 10533 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10380 | 10534 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10387 | 10541 | ambientOcclusion = false; |
---|
10388 | 10542 | } |
---|
10389 | 10543 | |
---|
10390 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10544 | + if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10391 | 10545 | { |
---|
10392 | 10546 | //if (RENDERSHADOW) // ? |
---|
10393 | 10547 | if (!IsFrozen()) |
---|
10394 | 10548 | { |
---|
10395 | 10549 | // dec 2012 |
---|
10396 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10550 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10397 | 10551 | { |
---|
10398 | 10552 | Globals.framecount++; |
---|
10399 | 10553 | shadowbuffer.display(); |
---|
.. | .. |
---|
10520 | 10674 | |
---|
10521 | 10675 | // if (parentcam != renderCamera) // not a light |
---|
10522 | 10676 | if (cam != lightCamera) |
---|
10523 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10524 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10677 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10678 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10525 | 10679 | |
---|
10526 | 10680 | for (int j = 0; j < 4; j++) |
---|
10527 | 10681 | { |
---|
.. | .. |
---|
10535 | 10689 | |
---|
10536 | 10690 | // if (parentcam != renderCamera) // not a light |
---|
10537 | 10691 | if (cam != lightCamera) |
---|
10538 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10539 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10692 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10693 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10540 | 10694 | |
---|
10541 | 10695 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10542 | 10696 | |
---|
.. | .. |
---|
10795 | 10949 | // Bump noise |
---|
10796 | 10950 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10797 | 10951 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10798 | | - 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 | + |
---|
10799 | 10962 | |
---|
10800 | 10963 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10801 | 10964 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10920 | 11083 | System.err.println("parentcam != renderCamera"); |
---|
10921 | 11084 | |
---|
10922 | 11085 | // if (cam != lightCamera) |
---|
10923 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10924 | | - 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 |
---|
10925 | 11088 | } |
---|
10926 | 11089 | |
---|
10927 | 11090 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10942 | 11105 | if (true) // TODO |
---|
10943 | 11106 | { |
---|
10944 | 11107 | if (cam != lightCamera) |
---|
10945 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10946 | | - 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 |
---|
10947 | 11110 | } |
---|
10948 | 11111 | |
---|
10949 | 11112 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11259 | 11422 | { |
---|
11260 | 11423 | renderpass++; |
---|
11261 | 11424 | // System.out.println("Draw object... "); |
---|
| 11425 | + STEP = 1; |
---|
11262 | 11426 | if (FAST) // in case there is no script |
---|
11263 | | - STEP = 16; |
---|
| 11427 | + STEP = 8; |
---|
| 11428 | + |
---|
| 11429 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11430 | + { |
---|
| 11431 | + STEP *= 4; |
---|
| 11432 | + } |
---|
11264 | 11433 | |
---|
11265 | 11434 | //object.FullInvariants(); |
---|
11266 | 11435 | |
---|
.. | .. |
---|
11274 | 11443 | e.printStackTrace(); |
---|
11275 | 11444 | } |
---|
11276 | 11445 | |
---|
11277 | | - if (GrafreeD.RENDERME > 0) |
---|
11278 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11446 | + if (Grafreed.RENDERME > 0) |
---|
| 11447 | + Grafreed.RENDERME--; // mechante magouille |
---|
11279 | 11448 | |
---|
11280 | 11449 | Globals.ONESTEP = false; |
---|
11281 | 11450 | } |
---|
.. | .. |
---|
11345 | 11514 | |
---|
11346 | 11515 | usedtextures.clear(); |
---|
11347 | 11516 | |
---|
11348 | | - 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 | + } |
---|
11349 | 11525 | } |
---|
11350 | 11526 | //System.out.println("--> " + stackdepth); |
---|
11351 | 11527 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11436 | 11612 | if (checker != null && DrawMode() == DEFAULT) |
---|
11437 | 11613 | { |
---|
11438 | 11614 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11439 | | - 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 | + } |
---|
11440 | 11623 | // NEAREST |
---|
11441 | 11624 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11442 | 11625 | DrawChecker(gl); |
---|
.. | .. |
---|
11518 | 11701 | return; |
---|
11519 | 11702 | } |
---|
11520 | 11703 | |
---|
11521 | | - String string = obj.GetToolTip(); |
---|
| 11704 | + String string = obj.toString(); //.GetToolTip(); |
---|
11522 | 11705 | |
---|
11523 | 11706 | GL gl = GetGL(); |
---|
11524 | 11707 | |
---|
.. | .. |
---|
11835 | 12018 | //obj.TransformToWorld(light, light); |
---|
11836 | 12019 | for (int i = tp.size(); --i >= 0;) |
---|
11837 | 12020 | { |
---|
11838 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11839 | | - 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); |
---|
11840 | 12023 | } |
---|
11841 | 12024 | |
---|
11842 | 12025 | |
---|
.. | .. |
---|
11853 | 12036 | parentcam = cameras[0]; |
---|
11854 | 12037 | } |
---|
11855 | 12038 | |
---|
11856 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11857 | | - 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 |
---|
11858 | 12041 | |
---|
11859 | 12042 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11860 | 12043 | |
---|
.. | .. |
---|
12468 | 12651 | |
---|
12469 | 12652 | // display shadow only (bump == 0) |
---|
12470 | 12653 | "SUB temp.x, half.x, shadow.x;" + |
---|
12471 | | - "MOV temp.y, -params6.x;" + |
---|
12472 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12654 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12655 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12473 | 12656 | "SUB temp.y, one.x, temp.z;" + |
---|
12474 | 12657 | "MUL temp.x, temp.x, temp.y;" + |
---|
12475 | 12658 | "KIL temp.x;" + |
---|
.. | .. |
---|
12598 | 12781 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12599 | 12782 | |
---|
12600 | 12783 | "SUB temp.x, one.x, ndotl.x;" + |
---|
12601 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
12602 | | - "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 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 |
---|
12603 | 12788 | "MUL temp.x, temp.x, temp.y;" + |
---|
12604 | 12789 | |
---|
12605 | 12790 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12747 | 12932 | "MUL final.y, fragment.texcoord[0].x, c256;" + |
---|
12748 | 12933 | "FLR final.x, final.y;" + |
---|
12749 | 12934 | "SUB final.y, final.y, final.x;" + |
---|
12750 | | - //"MUL final.x, final.x, c256i;" + |
---|
| 12935 | + "MUL final.x, final.x, c256i;" + |
---|
12751 | 12936 | "MOV final.z, zero.x;" + |
---|
12752 | 12937 | "MOV final.a, one.w;":"" |
---|
12753 | 12938 | ) + |
---|
.. | .. |
---|
12755 | 12940 | "MUL final.y, fragment.texcoord[0].y, c256;" + |
---|
12756 | 12941 | "FLR final.x, final.y;" + |
---|
12757 | 12942 | "SUB final.y, final.y, final.x;" + |
---|
12758 | | - //"MUL final.x, final.x, c256i;" + |
---|
| 12943 | + "MUL final.x, final.x, c256i;" + |
---|
12759 | 12944 | "MOV final.z, zero.x;" + |
---|
12760 | 12945 | "MOV final.a, one.w;":"" |
---|
12761 | 12946 | ) + |
---|
.. | .. |
---|
12798 | 12983 | //once = true; |
---|
12799 | 12984 | } |
---|
12800 | 12985 | |
---|
12801 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 12986 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12802 | 12987 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12803 | 12988 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12804 | 12989 | |
---|
.. | .. |
---|
12931 | 13116 | |
---|
12932 | 13117 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12933 | 13118 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13119 | + |
---|
| 13120 | + // Compare fragment depth in light space with shadowmap. |
---|
12934 | 13121 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12935 | 13122 | "SGE temp.y, temp.x, zero.x;" + |
---|
12936 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13123 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13124 | + |
---|
| 13125 | + // Reverse comparison |
---|
12937 | 13126 | "SUB temp.x, one.x, temp.x;" + |
---|
12938 | 13127 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12939 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13128 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12940 | 13129 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12941 | 13130 | |
---|
12942 | 13131 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12950 | 13139 | // No shadow for backface |
---|
12951 | 13140 | "DP3 temp.x, normal, lightd;" + |
---|
12952 | 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;" + |
---|
12953 | 13146 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12954 | 13147 | ""; |
---|
12955 | 13148 | } |
---|
.. | .. |
---|
13508 | 13701 | public void mousePressed(MouseEvent e) |
---|
13509 | 13702 | { |
---|
13510 | 13703 | //System.out.println("mousePressed: " + e); |
---|
13511 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13704 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13512 | 13705 | } |
---|
13513 | 13706 | |
---|
13514 | 13707 | static long prevtime = 0; |
---|
.. | .. |
---|
13584 | 13777 | // mode |= META; |
---|
13585 | 13778 | //} |
---|
13586 | 13779 | |
---|
13587 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13588 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13780 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13781 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13589 | 13782 | anchorX = ax; |
---|
13590 | 13783 | anchorY = ay; |
---|
13591 | 13784 | prevX = px; |
---|
.. | .. |
---|
13645 | 13838 | // wasliveok = true; |
---|
13646 | 13839 | // waslive = false; |
---|
13647 | 13840 | |
---|
| 13841 | + // May 2019 Forget it: |
---|
| 13842 | + if (true) |
---|
| 13843 | + return; |
---|
| 13844 | + |
---|
13648 | 13845 | // source == timer |
---|
13649 | 13846 | if (mouseDown) |
---|
13650 | 13847 | { |
---|
.. | .. |
---|
13683 | 13880 | |
---|
13684 | 13881 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13685 | 13882 | |
---|
13686 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13883 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13687 | 13884 | { |
---|
13688 | 13885 | if (!wasliveok) |
---|
13689 | 13886 | return; |
---|
.. | .. |
---|
13700 | 13897 | // touched = true; // main DL |
---|
13701 | 13898 | if (isRenderer) |
---|
13702 | 13899 | { |
---|
13703 | | - SetMouseMode(modifiers); |
---|
| 13900 | + SetMouseMode(modifiers, modifiersex); |
---|
13704 | 13901 | } |
---|
13705 | 13902 | |
---|
13706 | 13903 | selectX = anchorX = x; |
---|
.. | .. |
---|
13713 | 13910 | clicked = true; |
---|
13714 | 13911 | hold = false; |
---|
13715 | 13912 | |
---|
13716 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13913 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13717 | 13914 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13718 | 13915 | { |
---|
13719 | 13916 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13744 | 13941 | info.camera = renderCamera; |
---|
13745 | 13942 | info.x = x; |
---|
13746 | 13943 | info.y = y; |
---|
13747 | | - info.modifiers = modifiers; |
---|
| 13944 | + info.modifiers = modifiersex; |
---|
13748 | 13945 | editObj = object.doEditClick(info, 0); |
---|
13749 | 13946 | if (!editObj) |
---|
13750 | 13947 | { |
---|
.. | .. |
---|
13761 | 13958 | |
---|
13762 | 13959 | public void mouseDragged(MouseEvent e) |
---|
13763 | 13960 | { |
---|
| 13961 | + Globals.MOUSEDRAGGED = true; |
---|
| 13962 | + |
---|
13764 | 13963 | //System.out.println("mouseDragged: " + e); |
---|
13765 | 13964 | if (isRenderer) |
---|
13766 | 13965 | movingcamera = true; |
---|
| 13966 | + |
---|
13767 | 13967 | //if (drawing) |
---|
13768 | 13968 | //return; |
---|
13769 | 13969 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
.. | .. |
---|
13773 | 13973 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13774 | 13974 | } |
---|
13775 | 13975 | else |
---|
13776 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13976 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13777 | 13977 | |
---|
13778 | 13978 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13779 | 13979 | } |
---|
.. | .. |
---|
13946 | 14146 | |
---|
13947 | 14147 | public void run() |
---|
13948 | 14148 | { |
---|
| 14149 | + new Exception().printStackTrace(); |
---|
13949 | 14150 | System.exit(0); |
---|
13950 | 14151 | for (;;) |
---|
13951 | 14152 | { |
---|
.. | .. |
---|
14009 | 14210 | { |
---|
14010 | 14211 | Globals.lighttouched = true; |
---|
14011 | 14212 | } |
---|
14012 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14213 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14013 | 14214 | } |
---|
14014 | 14215 | //else |
---|
14015 | 14216 | } |
---|
.. | .. |
---|
14109 | 14310 | int X, Y; |
---|
14110 | 14311 | boolean SX, SY; |
---|
14111 | 14312 | |
---|
14112 | | - void drag(int x, int y, int modifiers) |
---|
| 14313 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14113 | 14314 | { |
---|
14114 | 14315 | if (IsFrozen()) |
---|
14115 | 14316 | { |
---|
.. | .. |
---|
14118 | 14319 | |
---|
14119 | 14320 | drag = true; // NEW |
---|
14120 | 14321 | |
---|
14121 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14322 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14122 | 14323 | |
---|
14123 | 14324 | X = x; |
---|
14124 | 14325 | Y = y; |
---|
14125 | 14326 | // floating state for animation |
---|
14126 | | - MODIFIERS = modifiers; |
---|
14127 | | - modifiers &= ~1024; |
---|
| 14327 | + MODIFIERS = modifiersex; |
---|
| 14328 | + modifiersex &= ~1024; |
---|
14128 | 14329 | if (false) // modifiers != 0) |
---|
14129 | 14330 | { |
---|
14130 | 14331 | //new Exception().printStackTrace(); |
---|
14131 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14332 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14132 | 14333 | System.out.println("SHIFT = " + SHIFT); |
---|
14133 | 14334 | System.out.println("CONTROL = " + COMMAND); |
---|
14134 | 14335 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14148 | 14349 | info.camera = renderCamera; |
---|
14149 | 14350 | info.x = x; |
---|
14150 | 14351 | info.y = y; |
---|
14151 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14352 | + object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14152 | 14353 | } else |
---|
14153 | 14354 | { |
---|
14154 | 14355 | if (x < startX) |
---|
.. | .. |
---|
14324 | 14525 | |
---|
14325 | 14526 | public void mouseReleased(MouseEvent e) |
---|
14326 | 14527 | { |
---|
| 14528 | + Globals.MOUSEDRAGGED = false; |
---|
| 14529 | + |
---|
14327 | 14530 | movingcamera = false; |
---|
| 14531 | + X = Y = 0; |
---|
14328 | 14532 | //System.out.println("mouseReleased: " + e); |
---|
14329 | 14533 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14330 | 14534 | } |
---|
.. | .. |
---|
14347 | 14551 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14348 | 14552 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14349 | 14553 | |
---|
14350 | | - if (control || command || IsFrozen()) |
---|
| 14554 | +// No delay if (control || command || IsFrozen()) |
---|
14351 | 14555 | timeout = true; |
---|
14352 | | - else |
---|
| 14556 | +// ?? May 2019 else |
---|
14353 | 14557 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14354 | 14558 | mouseDown = false; |
---|
14355 | 14559 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14459 | 14663 | System.out.println("keyReleased: " + e); |
---|
14460 | 14664 | } |
---|
14461 | 14665 | |
---|
14462 | | - void SetMouseMode(int modifiers) |
---|
| 14666 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14463 | 14667 | { |
---|
14464 | 14668 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14465 | 14669 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14471 | 14675 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14472 | 14676 | // return; |
---|
14473 | 14677 | //System.out.println("SetMode = " + modifiers); |
---|
14474 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14678 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14475 | 14679 | { |
---|
14476 | 14680 | mouseMode |= ZOOM; |
---|
14477 | 14681 | } |
---|
14478 | 14682 | |
---|
14479 | 14683 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14480 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14684 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14481 | 14685 | { |
---|
14482 | 14686 | mouseMode |= VR; // BACKFORTH; |
---|
14483 | 14687 | } |
---|
14484 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14688 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14485 | 14689 | { |
---|
14486 | 14690 | mouseMode |= SELECT; |
---|
14487 | 14691 | } |
---|
14488 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14692 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14489 | 14693 | { |
---|
14490 | 14694 | mouseMode |= SELECT; |
---|
14491 | 14695 | } |
---|
14492 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14696 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14493 | 14697 | { |
---|
14494 | 14698 | mouseMode &= ~VR; |
---|
14495 | 14699 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14518 | 14722 | |
---|
14519 | 14723 | if (isRenderer) // |
---|
14520 | 14724 | { |
---|
14521 | | - SetMouseMode(modifiers); |
---|
| 14725 | + SetMouseMode(0, modifiers); |
---|
14522 | 14726 | } |
---|
14523 | 14727 | |
---|
14524 | 14728 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14854 | 15058 | //RESIZETEXTURE ^= true; |
---|
14855 | 15059 | //break; |
---|
14856 | 15060 | case 'z': |
---|
14857 | | - RENDERSHADOW ^= true; |
---|
| 15061 | + Globals.RENDERSHADOW ^= true; |
---|
14858 | 15062 | Globals.lighttouched = true; |
---|
14859 | 15063 | repaint(); |
---|
14860 | 15064 | break; |
---|
.. | .. |
---|
14978 | 15182 | //mode = ROTATE; |
---|
14979 | 15183 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14980 | 15184 | { |
---|
14981 | | - SetMouseMode(modifiers); |
---|
| 15185 | + SetMouseMode(0, modifiers); |
---|
14982 | 15186 | } |
---|
14983 | 15187 | } |
---|
14984 | 15188 | |
---|
.. | .. |
---|
15114 | 15318 | { |
---|
15115 | 15319 | //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
15116 | 15320 | //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
15117 | | - if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
| 15321 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15118 | 15322 | { |
---|
15119 | 15323 | mouseMoved(e); |
---|
15120 | 15324 | } else |
---|
.. | .. |
---|
15144 | 15348 | |
---|
15145 | 15349 | void SelectParent() |
---|
15146 | 15350 | { |
---|
| 15351 | + new Exception().printStackTrace(); |
---|
15147 | 15352 | System.exit(0); |
---|
15148 | 15353 | Composite group = (Composite) object; |
---|
15149 | 15354 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15167 | 15372 | |
---|
15168 | 15373 | void SelectChildren() |
---|
15169 | 15374 | { |
---|
| 15375 | + new Exception().printStackTrace(); |
---|
15170 | 15376 | System.exit(0); |
---|
15171 | 15377 | /* |
---|
15172 | 15378 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15331 | 15537 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15332 | 15538 | //Image img = CreateImage(width, height); |
---|
15333 | 15539 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15540 | + |
---|
15334 | 15541 | Graphics gr = g; // img.getGraphics(); |
---|
| 15542 | + |
---|
15335 | 15543 | if (!hasMarquee) |
---|
15336 | 15544 | { |
---|
15337 | 15545 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15429 | 15637 | if (!isRenderer) |
---|
15430 | 15638 | { |
---|
15431 | 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 | + } |
---|
15432 | 15657 | } |
---|
15433 | 15658 | } |
---|
| 15659 | + |
---|
15434 | 15660 | if (isRenderer) |
---|
15435 | 15661 | { |
---|
15436 | 15662 | //gr.setColor(Color.black); |
---|
15437 | 15663 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15438 | 15664 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15439 | 15665 | } |
---|
| 15666 | + |
---|
15440 | 15667 | if (hasMarquee) |
---|
15441 | 15668 | { |
---|
15442 | 15669 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15549 | 15776 | public boolean mouseDown(Event evt, int x, int y) |
---|
15550 | 15777 | { |
---|
15551 | 15778 | System.out.println("mouseDown: " + evt); |
---|
| 15779 | + System.exit(0); |
---|
15552 | 15780 | /* |
---|
15553 | 15781 | locked = true; |
---|
15554 | 15782 | drag = false; |
---|
.. | .. |
---|
15592 | 15820 | { |
---|
15593 | 15821 | keyPressed(0, modifiers); |
---|
15594 | 15822 | } |
---|
15595 | | - clickStart(x, y, modifiers); |
---|
| 15823 | + // clickStart(x, y, modifiers); |
---|
15596 | 15824 | return true; |
---|
15597 | 15825 | } |
---|
15598 | 15826 | |
---|
.. | .. |
---|
15710 | 15938 | { |
---|
15711 | 15939 | keyReleased(0, 0); |
---|
15712 | 15940 | } |
---|
15713 | | - drag(x, y, modifiers); |
---|
| 15941 | + drag(x, y, 0, modifiers); |
---|
15714 | 15942 | return true; |
---|
15715 | 15943 | } |
---|
15716 | 15944 | |
---|
.. | .. |
---|
15842 | 16070 | Object3D object; |
---|
15843 | 16071 | static Object3D trackedobject; |
---|
15844 | 16072 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15845 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16073 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15846 | 16074 | /*static*/ Camera eyeCamera; |
---|
15847 | 16075 | /*static*/ Camera lightCamera; |
---|
15848 | 16076 | int cameracount; |
---|
.. | .. |
---|
16280 | 16508 | { |
---|
16281 | 16509 | if (!selection) |
---|
16282 | 16510 | { |
---|
| 16511 | + new Exception().printStackTrace(); |
---|
16283 | 16512 | System.exit(0); |
---|
16284 | 16513 | return; |
---|
16285 | 16514 | } |
---|
.. | .. |
---|
16407 | 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])); |
---|
16408 | 16637 | } |
---|
16409 | 16638 | |
---|
16410 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16639 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16411 | 16640 | } |
---|
16412 | 16641 | } |
---|
16413 | 16642 | |
---|
16414 | 16643 | if (!movingcamera && !PAINTMODE) |
---|
16415 | 16644 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
16416 | 16645 | |
---|
16417 | | - 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) |
---|
16418 | 16647 | { |
---|
16419 | | - 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); |
---|
16420 | 16649 | |
---|
16421 | 16650 | Object3D group = new Object3D("inst" + paintcount++); |
---|
16422 | 16651 | |
---|
.. | .. |
---|
16572 | 16801 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16573 | 16802 | } |
---|
16574 | 16803 | |
---|
16575 | | - if (!RENDERSHADOW) |
---|
| 16804 | + if (!Globals.RENDERSHADOW) |
---|
16576 | 16805 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16577 | 16806 | |
---|
16578 | 16807 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16582 | 16811 | //gl.glColorMask(false, false, false, false); |
---|
16583 | 16812 | |
---|
16584 | 16813 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16585 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16814 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16586 | 16815 | { |
---|
16587 | 16816 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16588 | 16817 | |
---|