.. | .. |
---|
150 | 150 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 151 | } |
---|
152 | 152 | |
---|
| 153 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
| 154 | + |
---|
153 | 155 | void SetAsGLRenderer(boolean b) |
---|
154 | 156 | { |
---|
155 | 157 | isRenderer = b; |
---|
.. | .. |
---|
462 | 464 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
463 | 465 | { |
---|
464 | 466 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
465 | | - 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 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 469 | + ; |
---|
466 | 470 | if (!hasnorm) |
---|
467 | 471 | { |
---|
468 | | - // System.out.println("FUCK!!"); |
---|
| 472 | + // System.out.println("Mesh normal"); |
---|
469 | 473 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
470 | 474 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
471 | 475 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1190 | 1194 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1191 | 1195 | } |
---|
1192 | 1196 | } |
---|
| 1197 | + |
---|
1193 | 1198 | if (flipV) |
---|
1194 | 1199 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1195 | 1200 | else |
---|
1196 | 1201 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1202 | + |
---|
1197 | 1203 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1198 | 1204 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1199 | 1205 | |
---|
.. | .. |
---|
1213 | 1219 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1214 | 1220 | } |
---|
1215 | 1221 | } |
---|
| 1222 | + |
---|
1216 | 1223 | if (flipV) |
---|
1217 | 1224 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1218 | 1225 | else |
---|
1219 | 1226 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1227 | + |
---|
1220 | 1228 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1221 | 1229 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1222 | 1230 | |
---|
.. | .. |
---|
1244 | 1252 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1245 | 1253 | else |
---|
1246 | 1254 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1255 | + |
---|
1247 | 1256 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1248 | 1257 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1258 | + |
---|
1249 | 1259 | count2 += 2; |
---|
1250 | 1260 | count3 += 3; |
---|
1251 | 1261 | } |
---|
.. | .. |
---|
1628 | 1638 | |
---|
1629 | 1639 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1630 | 1640 | |
---|
1631 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1641 | + float[] colorV = Grafreed.colorV; |
---|
1632 | 1642 | |
---|
1633 | 1643 | /**/ |
---|
1634 | 1644 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1888 | 1898 | void PushMatrix(double[][] matrix) |
---|
1889 | 1899 | { |
---|
1890 | 1900 | // GrafreeD.tracein(matrix); |
---|
1891 | | - PushMatrix(matrix,1); |
---|
| 1901 | + PushMatrix(matrix, 1); |
---|
1892 | 1902 | } |
---|
1893 | 1903 | |
---|
1894 | 1904 | void PushMatrix() |
---|
.. | .. |
---|
2140 | 2150 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2141 | 2151 | |
---|
2142 | 2152 | if (!Globals.isLIVE()) // save sound |
---|
2143 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2153 | + Grafreed.savesound = true; // wav.save(); |
---|
2144 | 2154 | // else |
---|
2145 | 2155 | repaint(); // start loop // may 2013 |
---|
2146 | 2156 | } |
---|
.. | .. |
---|
2265 | 2275 | LOOKAT ^= true; |
---|
2266 | 2276 | } |
---|
2267 | 2277 | |
---|
2268 | | - void ToggleRandom() |
---|
| 2278 | + void ToggleSwitch() |
---|
2269 | 2279 | { |
---|
2270 | 2280 | SWITCH ^= true; |
---|
2271 | 2281 | } |
---|
.. | .. |
---|
2374 | 2384 | { |
---|
2375 | 2385 | return currentGL; |
---|
2376 | 2386 | } |
---|
2377 | | - |
---|
| 2387 | + |
---|
2378 | 2388 | /**/ |
---|
2379 | 2389 | class CacheTexture |
---|
2380 | 2390 | { |
---|
.. | .. |
---|
7919 | 7929 | ReleaseTexture(pigment, false); |
---|
7920 | 7930 | } |
---|
7921 | 7931 | |
---|
| 7932 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7933 | + { |
---|
| 7934 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7935 | + { |
---|
| 7936 | + return; |
---|
| 7937 | + } |
---|
| 7938 | + |
---|
| 7939 | + if (tex == null) |
---|
| 7940 | + { |
---|
| 7941 | + ReleaseTexture(null, false); |
---|
| 7942 | + return; |
---|
| 7943 | + } |
---|
| 7944 | + |
---|
| 7945 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7946 | + |
---|
| 7947 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7948 | + { |
---|
| 7949 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7950 | + // System.out.println("; bump = " + bump); |
---|
| 7951 | + } |
---|
| 7952 | + |
---|
| 7953 | + if (pigment.equals("")) |
---|
| 7954 | + { |
---|
| 7955 | + pigment = null; |
---|
| 7956 | + } |
---|
| 7957 | + |
---|
| 7958 | + ReleaseTexture(pigment, false); |
---|
| 7959 | + } |
---|
| 7960 | + |
---|
| 7961 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7962 | + { |
---|
| 7963 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7964 | + { |
---|
| 7965 | + return; |
---|
| 7966 | + } |
---|
| 7967 | + |
---|
| 7968 | + if (tex == null) |
---|
| 7969 | + { |
---|
| 7970 | + ReleaseTexture(null, true); |
---|
| 7971 | + return; |
---|
| 7972 | + } |
---|
| 7973 | + |
---|
| 7974 | + String bump = Object3D.GetBump(tex); |
---|
| 7975 | + |
---|
| 7976 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7977 | + { |
---|
| 7978 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7979 | + // System.out.println("; bump = " + bump); |
---|
| 7980 | + } |
---|
| 7981 | + |
---|
| 7982 | + if (bump.equals("")) |
---|
| 7983 | + { |
---|
| 7984 | + bump = null; |
---|
| 7985 | + } |
---|
| 7986 | + |
---|
| 7987 | + ReleaseTexture(bump, true); |
---|
| 7988 | + } |
---|
| 7989 | + |
---|
7922 | 7990 | void ReleaseTexture(String tex, boolean bump) |
---|
7923 | 7991 | { |
---|
7924 | 7992 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
.. | .. |
---|
8022 | 8090 | } |
---|
8023 | 8091 | } |
---|
8024 | 8092 | |
---|
8025 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8093 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8026 | 8094 | { |
---|
8027 | 8095 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8028 | 8096 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8067 | 8135 | return; // true; |
---|
8068 | 8136 | } |
---|
8069 | 8137 | |
---|
8070 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8138 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8139 | + { |
---|
| 8140 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8141 | + ambientOcclusion ) // || !textureon) |
---|
| 8142 | + { |
---|
| 8143 | + return; // false; |
---|
| 8144 | + } |
---|
| 8145 | + |
---|
| 8146 | + if (tex == null) |
---|
| 8147 | + { |
---|
| 8148 | + BindTexture(null,false,resolution); |
---|
| 8149 | + return; |
---|
| 8150 | + } |
---|
| 8151 | + |
---|
| 8152 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8153 | + |
---|
| 8154 | + usedtextures.put(pigment, pigment); |
---|
| 8155 | + |
---|
| 8156 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8157 | + { |
---|
| 8158 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8159 | + // System.out.println("; bump = " + bump); |
---|
| 8160 | + } |
---|
| 8161 | + |
---|
| 8162 | + if (pigment.equals("")) |
---|
| 8163 | + { |
---|
| 8164 | + pigment = null; |
---|
| 8165 | + } |
---|
| 8166 | + |
---|
| 8167 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8168 | + BindTexture(pigment, false, resolution); |
---|
| 8169 | + } |
---|
| 8170 | + |
---|
| 8171 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8172 | + { |
---|
| 8173 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8174 | + ambientOcclusion ) // || !textureon) |
---|
| 8175 | + { |
---|
| 8176 | + return; // false; |
---|
| 8177 | + } |
---|
| 8178 | + |
---|
| 8179 | + if (tex == null) |
---|
| 8180 | + { |
---|
| 8181 | + BindTexture(null,true,resolution); |
---|
| 8182 | + return; |
---|
| 8183 | + } |
---|
| 8184 | + |
---|
| 8185 | + String bump = Object3D.GetBump(tex); |
---|
| 8186 | + |
---|
| 8187 | + usedtextures.put(bump, bump); |
---|
| 8188 | + |
---|
| 8189 | + if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8190 | + { |
---|
| 8191 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8192 | + // System.out.println("; bump = " + bump); |
---|
| 8193 | + } |
---|
| 8194 | + |
---|
| 8195 | + if (bump.equals("")) |
---|
| 8196 | + { |
---|
| 8197 | + bump = null; |
---|
| 8198 | + } |
---|
| 8199 | + |
---|
| 8200 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8201 | + BindTexture(bump, true, resolution); |
---|
| 8202 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8203 | + } |
---|
| 8204 | + |
---|
| 8205 | + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
| 8206 | + |
---|
| 8207 | + private boolean FileExists(String tex) |
---|
| 8208 | + { |
---|
| 8209 | + if (missingTextures.contains(tex)) |
---|
| 8210 | + { |
---|
| 8211 | + return false; |
---|
| 8212 | + } |
---|
| 8213 | + |
---|
| 8214 | + boolean fileExists = new File(tex).exists(); |
---|
| 8215 | + |
---|
| 8216 | + if (!fileExists) |
---|
| 8217 | + { |
---|
| 8218 | + // If file exists, the "new File()" is not executed sgain |
---|
| 8219 | + missingTextures.add(tex); |
---|
| 8220 | + } |
---|
| 8221 | + |
---|
| 8222 | + return fileExists; |
---|
| 8223 | + } |
---|
| 8224 | + |
---|
| 8225 | + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8071 | 8226 | { |
---|
8072 | 8227 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8073 | 8228 | |
---|
.. | .. |
---|
8075 | 8230 | { |
---|
8076 | 8231 | String texname = tex; |
---|
8077 | 8232 | |
---|
| 8233 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8234 | + |
---|
8078 | 8235 | // String[] split = tex.split("Textures"); |
---|
8079 | 8236 | // if (split.length > 1) |
---|
8080 | 8237 | // texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8081 | 8238 | // else |
---|
8082 | 8239 | // if (!texname.startsWith("/")) |
---|
8083 | 8240 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8084 | | - if (!new File(tex).exists()) |
---|
| 8241 | + if (!FileExists(tex)) |
---|
8085 | 8242 | { |
---|
8086 | | - texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname; |
---|
| 8243 | + texname = fallbackTextureName; |
---|
8087 | 8244 | } |
---|
8088 | 8245 | |
---|
8089 | 8246 | if (CACHETEXTURE) |
---|
.. | .. |
---|
8153 | 8310 | } |
---|
8154 | 8311 | |
---|
8155 | 8312 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8156 | | - if (!new File(cachename).exists()) |
---|
| 8313 | + if (!FileExists(cachename)) |
---|
8157 | 8314 | cachename = texname; |
---|
8158 | 8315 | else |
---|
8159 | 8316 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8175 | 8332 | } |
---|
8176 | 8333 | |
---|
8177 | 8334 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8178 | | - if (!new File(cachename).exists()) |
---|
| 8335 | + if (!FileExists(cachename)) |
---|
8179 | 8336 | cachename = texname; |
---|
8180 | 8337 | else |
---|
8181 | 8338 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8184 | 8341 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8185 | 8342 | |
---|
8186 | 8343 | |
---|
8187 | | - if (texturedata != null) |
---|
| 8344 | + if (texturedata == null) |
---|
| 8345 | + throw new Exception(); |
---|
| 8346 | + |
---|
8188 | 8347 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8189 | 8348 | //texture = GetTexture(tex, bump); |
---|
8190 | 8349 | } |
---|
.. | .. |
---|
8306 | 8465 | return texture; |
---|
8307 | 8466 | } |
---|
8308 | 8467 | |
---|
8309 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) |
---|
| 8468 | + com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8310 | 8469 | { |
---|
8311 | 8470 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8312 | 8471 | |
---|
.. | .. |
---|
8324 | 8483 | return texture!=null?texture.texture:null; |
---|
8325 | 8484 | } |
---|
8326 | 8485 | |
---|
8327 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8486 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
8328 | 8487 | { |
---|
8329 | 8488 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8330 | 8489 | |
---|
8331 | 8490 | return texture!=null?texture.texturedata:null; |
---|
8332 | 8491 | } |
---|
8333 | 8492 | |
---|
8334 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8493 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8335 | 8494 | { |
---|
8336 | 8495 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8337 | 8496 | { |
---|
.. | .. |
---|
9308 | 9467 | assert (parentcam != renderCamera); |
---|
9309 | 9468 | |
---|
9310 | 9469 | if (renderCamera != lightCamera) |
---|
9311 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9312 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9470 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9471 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9313 | 9472 | |
---|
9314 | 9473 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9315 | 9474 | |
---|
.. | .. |
---|
9324 | 9483 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9325 | 9484 | |
---|
9326 | 9485 | if (renderCamera != lightCamera) |
---|
9327 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9328 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9486 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9487 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9329 | 9488 | |
---|
9330 | 9489 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9331 | 9490 | |
---|
.. | .. |
---|
9542 | 9701 | |
---|
9543 | 9702 | if (!BOXMODE) |
---|
9544 | 9703 | { |
---|
9545 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9704 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
9546 | 9705 | } |
---|
9547 | 9706 | |
---|
9548 | 9707 | if (!BOXMODE) |
---|
.. | .. |
---|
9580 | 9739 | ABORTED = false; |
---|
9581 | 9740 | } |
---|
9582 | 9741 | else |
---|
9583 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9742 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9584 | 9743 | |
---|
9585 | 9744 | if (false) |
---|
9586 | 9745 | { |
---|
.. | .. |
---|
10243 | 10402 | |
---|
10244 | 10403 | public void display(GLAutoDrawable drawable) |
---|
10245 | 10404 | { |
---|
10246 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10405 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10247 | 10406 | { |
---|
10248 | | - GrafreeD.wav.save(); |
---|
10249 | | - GrafreeD.savesound = false; |
---|
10250 | | - GrafreeD.hassound = false; |
---|
| 10407 | + Grafreed.wav.save(); |
---|
| 10408 | + Grafreed.savesound = false; |
---|
| 10409 | + Grafreed.hassound = false; |
---|
10251 | 10410 | } |
---|
10252 | 10411 | // if (DEBUG_SELECTION) |
---|
10253 | 10412 | // { |
---|
.. | .. |
---|
10377 | 10536 | Object3D theobject = object; |
---|
10378 | 10537 | Object3D theparent = object.parent; |
---|
10379 | 10538 | object.parent = null; |
---|
10380 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10539 | + object = (Object3D)Grafreed.clone(object); |
---|
10381 | 10540 | object.Stripify(); |
---|
10382 | 10541 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10383 | 10542 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10390 | 10549 | ambientOcclusion = false; |
---|
10391 | 10550 | } |
---|
10392 | 10551 | |
---|
10393 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10552 | + if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10394 | 10553 | { |
---|
10395 | 10554 | //if (RENDERSHADOW) // ? |
---|
10396 | 10555 | if (!IsFrozen()) |
---|
10397 | 10556 | { |
---|
10398 | 10557 | // dec 2012 |
---|
10399 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10558 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10400 | 10559 | { |
---|
10401 | 10560 | Globals.framecount++; |
---|
10402 | 10561 | shadowbuffer.display(); |
---|
.. | .. |
---|
10523 | 10682 | |
---|
10524 | 10683 | // if (parentcam != renderCamera) // not a light |
---|
10525 | 10684 | if (cam != lightCamera) |
---|
10526 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10527 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10685 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10686 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10528 | 10687 | |
---|
10529 | 10688 | for (int j = 0; j < 4; j++) |
---|
10530 | 10689 | { |
---|
.. | .. |
---|
10538 | 10697 | |
---|
10539 | 10698 | // if (parentcam != renderCamera) // not a light |
---|
10540 | 10699 | if (cam != lightCamera) |
---|
10541 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10542 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10700 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10701 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10543 | 10702 | |
---|
10544 | 10703 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10545 | 10704 | |
---|
.. | .. |
---|
10798 | 10957 | // Bump noise |
---|
10799 | 10958 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10800 | 10959 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10801 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 10960 | + |
---|
| 10961 | + try |
---|
| 10962 | + { |
---|
| 10963 | + BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 10964 | + } |
---|
| 10965 | + catch (Exception e) |
---|
| 10966 | + { |
---|
| 10967 | + System.err.println("FAILED: " + NOISE_TEXTURE); |
---|
| 10968 | + } |
---|
| 10969 | + |
---|
10802 | 10970 | |
---|
10803 | 10971 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10804 | 10972 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10923 | 11091 | System.err.println("parentcam != renderCamera"); |
---|
10924 | 11092 | |
---|
10925 | 11093 | // if (cam != lightCamera) |
---|
10926 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10927 | | - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013 |
---|
| 11094 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11095 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10928 | 11096 | } |
---|
10929 | 11097 | |
---|
10930 | 11098 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10945 | 11113 | if (true) // TODO |
---|
10946 | 11114 | { |
---|
10947 | 11115 | if (cam != lightCamera) |
---|
10948 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10949 | | - LA.xformDir(light0, parentcam.toParent, light0); // may 2013 |
---|
| 11116 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11117 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10950 | 11118 | } |
---|
10951 | 11119 | |
---|
10952 | 11120 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11283 | 11451 | e.printStackTrace(); |
---|
11284 | 11452 | } |
---|
11285 | 11453 | |
---|
11286 | | - if (GrafreeD.RENDERME > 0) |
---|
11287 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11454 | + if (Grafreed.RENDERME > 0) |
---|
| 11455 | + Grafreed.RENDERME--; // mechante magouille |
---|
11288 | 11456 | |
---|
11289 | 11457 | Globals.ONESTEP = false; |
---|
11290 | 11458 | } |
---|
.. | .. |
---|
11354 | 11522 | |
---|
11355 | 11523 | usedtextures.clear(); |
---|
11356 | 11524 | |
---|
11357 | | - BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11525 | + try |
---|
| 11526 | + { |
---|
| 11527 | + BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11528 | + } |
---|
| 11529 | + catch (Exception e) |
---|
| 11530 | + { |
---|
| 11531 | + System.err.println("FAILED: " + DEFAULT_TEXTURES); |
---|
| 11532 | + } |
---|
11358 | 11533 | } |
---|
11359 | 11534 | //System.out.println("--> " + stackdepth); |
---|
11360 | 11535 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11445 | 11620 | if (checker != null && DrawMode() == DEFAULT) |
---|
11446 | 11621 | { |
---|
11447 | 11622 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11448 | | - BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11623 | + try |
---|
| 11624 | + { |
---|
| 11625 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11626 | + } |
---|
| 11627 | + catch (Exception e) |
---|
| 11628 | + { |
---|
| 11629 | + System.err.println("FAILED: " + checker.GetTextures()); |
---|
| 11630 | + } |
---|
11449 | 11631 | // NEAREST |
---|
11450 | 11632 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11451 | 11633 | DrawChecker(gl); |
---|
.. | .. |
---|
11527 | 11709 | return; |
---|
11528 | 11710 | } |
---|
11529 | 11711 | |
---|
11530 | | - String string = obj.GetToolTip(); |
---|
| 11712 | + String string = obj.toString(); //.GetToolTip(); |
---|
11531 | 11713 | |
---|
11532 | 11714 | GL gl = GetGL(); |
---|
11533 | 11715 | |
---|
.. | .. |
---|
11844 | 12026 | //obj.TransformToWorld(light, light); |
---|
11845 | 12027 | for (int i = tp.size(); --i >= 0;) |
---|
11846 | 12028 | { |
---|
11847 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11848 | | - LA.xformPos(light, tp.get(i).toParent, light); |
---|
| 12029 | + //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
| 12030 | + LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
11849 | 12031 | } |
---|
11850 | 12032 | |
---|
11851 | 12033 | |
---|
.. | .. |
---|
11862 | 12044 | parentcam = cameras[0]; |
---|
11863 | 12045 | } |
---|
11864 | 12046 | |
---|
11865 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11866 | | - LA.xformPos(light, parentcam.toParent, light); // may 2013 |
---|
| 12047 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 12048 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11867 | 12049 | |
---|
11868 | 12050 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11869 | 12051 | |
---|
.. | .. |
---|
12477 | 12659 | |
---|
12478 | 12660 | // display shadow only (bump == 0) |
---|
12479 | 12661 | "SUB temp.x, half.x, shadow.x;" + |
---|
12480 | | - "MOV temp.y, -params6.x;" + |
---|
12481 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12662 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12663 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12482 | 12664 | "SUB temp.y, one.x, temp.z;" + |
---|
12483 | 12665 | "MUL temp.x, temp.x, temp.y;" + |
---|
12484 | 12666 | "KIL temp.x;" + |
---|
.. | .. |
---|
12809 | 12991 | //once = true; |
---|
12810 | 12992 | } |
---|
12811 | 12993 | |
---|
12812 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 12994 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12813 | 12995 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12814 | 12996 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12815 | 12997 | |
---|
.. | .. |
---|
12942 | 13124 | |
---|
12943 | 13125 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12944 | 13126 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13127 | + |
---|
| 13128 | + // Compare fragment depth in light space with shadowmap. |
---|
12945 | 13129 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12946 | 13130 | "SGE temp.y, temp.x, zero.x;" + |
---|
12947 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13131 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13132 | + |
---|
| 13133 | + // Reverse comparison |
---|
12948 | 13134 | "SUB temp.x, one.x, temp.x;" + |
---|
12949 | 13135 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12950 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13136 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12951 | 13137 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12952 | 13138 | |
---|
12953 | 13139 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12961 | 13147 | // No shadow for backface |
---|
12962 | 13148 | "DP3 temp.x, normal, lightd;" + |
---|
12963 | 13149 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
| 13150 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 13151 | + |
---|
| 13152 | + // No shadow when out of frustrum |
---|
| 13153 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
12964 | 13154 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12965 | 13155 | ""; |
---|
12966 | 13156 | } |
---|
.. | .. |
---|
13519 | 13709 | public void mousePressed(MouseEvent e) |
---|
13520 | 13710 | { |
---|
13521 | 13711 | //System.out.println("mousePressed: " + e); |
---|
13522 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13712 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13523 | 13713 | } |
---|
13524 | 13714 | |
---|
13525 | 13715 | static long prevtime = 0; |
---|
.. | .. |
---|
13595 | 13785 | // mode |= META; |
---|
13596 | 13786 | //} |
---|
13597 | 13787 | |
---|
13598 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13599 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13788 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13789 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13600 | 13790 | anchorX = ax; |
---|
13601 | 13791 | anchorY = ay; |
---|
13602 | 13792 | prevX = px; |
---|
.. | .. |
---|
13656 | 13846 | // wasliveok = true; |
---|
13657 | 13847 | // waslive = false; |
---|
13658 | 13848 | |
---|
| 13849 | + // May 2019 Forget it: |
---|
| 13850 | + if (true) |
---|
| 13851 | + return; |
---|
| 13852 | + |
---|
13659 | 13853 | // source == timer |
---|
13660 | 13854 | if (mouseDown) |
---|
13661 | 13855 | { |
---|
.. | .. |
---|
13694 | 13888 | |
---|
13695 | 13889 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13696 | 13890 | |
---|
13697 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13891 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13698 | 13892 | { |
---|
13699 | 13893 | if (!wasliveok) |
---|
13700 | 13894 | return; |
---|
.. | .. |
---|
13711 | 13905 | // touched = true; // main DL |
---|
13712 | 13906 | if (isRenderer) |
---|
13713 | 13907 | { |
---|
13714 | | - SetMouseMode(modifiers); |
---|
| 13908 | + SetMouseMode(modifiers, modifiersex); |
---|
13715 | 13909 | } |
---|
13716 | 13910 | |
---|
13717 | 13911 | selectX = anchorX = x; |
---|
.. | .. |
---|
13724 | 13918 | clicked = true; |
---|
13725 | 13919 | hold = false; |
---|
13726 | 13920 | |
---|
13727 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13921 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13728 | 13922 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13729 | 13923 | { |
---|
13730 | 13924 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13755 | 13949 | info.camera = renderCamera; |
---|
13756 | 13950 | info.x = x; |
---|
13757 | 13951 | info.y = y; |
---|
13758 | | - info.modifiers = modifiers; |
---|
| 13952 | + info.modifiers = modifiersex; |
---|
13759 | 13953 | editObj = object.doEditClick(info, 0); |
---|
13760 | 13954 | if (!editObj) |
---|
13761 | 13955 | { |
---|
.. | .. |
---|
13772 | 13966 | |
---|
13773 | 13967 | public void mouseDragged(MouseEvent e) |
---|
13774 | 13968 | { |
---|
| 13969 | + Globals.MOUSEDRAGGED = true; |
---|
| 13970 | + |
---|
13775 | 13971 | //System.out.println("mouseDragged: " + e); |
---|
13776 | 13972 | if (isRenderer) |
---|
13777 | 13973 | movingcamera = true; |
---|
| 13974 | + |
---|
13778 | 13975 | //if (drawing) |
---|
13779 | 13976 | //return; |
---|
13780 | 13977 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
.. | .. |
---|
13784 | 13981 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13785 | 13982 | } |
---|
13786 | 13983 | else |
---|
13787 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13984 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13788 | 13985 | |
---|
13789 | 13986 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13790 | 13987 | } |
---|
.. | .. |
---|
14021 | 14218 | { |
---|
14022 | 14219 | Globals.lighttouched = true; |
---|
14023 | 14220 | } |
---|
14024 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14221 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14025 | 14222 | } |
---|
14026 | 14223 | //else |
---|
14027 | 14224 | } |
---|
.. | .. |
---|
14121 | 14318 | int X, Y; |
---|
14122 | 14319 | boolean SX, SY; |
---|
14123 | 14320 | |
---|
14124 | | - void drag(int x, int y, int modifiers) |
---|
| 14321 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14125 | 14322 | { |
---|
14126 | 14323 | if (IsFrozen()) |
---|
14127 | 14324 | { |
---|
.. | .. |
---|
14130 | 14327 | |
---|
14131 | 14328 | drag = true; // NEW |
---|
14132 | 14329 | |
---|
14133 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14330 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14134 | 14331 | |
---|
14135 | 14332 | X = x; |
---|
14136 | 14333 | Y = y; |
---|
14137 | 14334 | // floating state for animation |
---|
14138 | | - MODIFIERS = modifiers; |
---|
14139 | | - modifiers &= ~1024; |
---|
| 14335 | + MODIFIERS = modifiersex; |
---|
| 14336 | + modifiersex &= ~1024; |
---|
14140 | 14337 | if (false) // modifiers != 0) |
---|
14141 | 14338 | { |
---|
14142 | 14339 | //new Exception().printStackTrace(); |
---|
14143 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14340 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14144 | 14341 | System.out.println("SHIFT = " + SHIFT); |
---|
14145 | 14342 | System.out.println("CONTROL = " + COMMAND); |
---|
14146 | 14343 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14160 | 14357 | info.camera = renderCamera; |
---|
14161 | 14358 | info.x = x; |
---|
14162 | 14359 | info.y = y; |
---|
14163 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14360 | + object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14164 | 14361 | } else |
---|
14165 | 14362 | { |
---|
14166 | 14363 | if (x < startX) |
---|
.. | .. |
---|
14336 | 14533 | |
---|
14337 | 14534 | public void mouseReleased(MouseEvent e) |
---|
14338 | 14535 | { |
---|
| 14536 | + Globals.MOUSEDRAGGED = false; |
---|
| 14537 | + |
---|
14339 | 14538 | movingcamera = false; |
---|
| 14539 | + X = Y = 0; |
---|
14340 | 14540 | //System.out.println("mouseReleased: " + e); |
---|
14341 | 14541 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14342 | 14542 | } |
---|
.. | .. |
---|
14359 | 14559 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14360 | 14560 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14361 | 14561 | |
---|
14362 | | - if (control || command || IsFrozen()) |
---|
| 14562 | +// No delay if (control || command || IsFrozen()) |
---|
14363 | 14563 | timeout = true; |
---|
14364 | | - else |
---|
| 14564 | +// ?? May 2019 else |
---|
14365 | 14565 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14366 | 14566 | mouseDown = false; |
---|
14367 | 14567 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14471 | 14671 | System.out.println("keyReleased: " + e); |
---|
14472 | 14672 | } |
---|
14473 | 14673 | |
---|
14474 | | - void SetMouseMode(int modifiers) |
---|
| 14674 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14475 | 14675 | { |
---|
14476 | 14676 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14477 | 14677 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14483 | 14683 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14484 | 14684 | // return; |
---|
14485 | 14685 | //System.out.println("SetMode = " + modifiers); |
---|
14486 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14686 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14487 | 14687 | { |
---|
14488 | 14688 | mouseMode |= ZOOM; |
---|
14489 | 14689 | } |
---|
.. | .. |
---|
14493 | 14693 | { |
---|
14494 | 14694 | mouseMode |= VR; // BACKFORTH; |
---|
14495 | 14695 | } |
---|
14496 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14696 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14497 | 14697 | { |
---|
14498 | 14698 | mouseMode |= SELECT; |
---|
14499 | 14699 | } |
---|
14500 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14700 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14501 | 14701 | { |
---|
14502 | 14702 | mouseMode |= SELECT; |
---|
14503 | 14703 | } |
---|
14504 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14704 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14505 | 14705 | { |
---|
14506 | 14706 | mouseMode &= ~VR; |
---|
14507 | 14707 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14530 | 14730 | |
---|
14531 | 14731 | if (isRenderer) // |
---|
14532 | 14732 | { |
---|
14533 | | - SetMouseMode(modifiers); |
---|
| 14733 | + SetMouseMode(0, modifiers); |
---|
14534 | 14734 | } |
---|
14535 | 14735 | |
---|
14536 | 14736 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14866 | 15066 | //RESIZETEXTURE ^= true; |
---|
14867 | 15067 | //break; |
---|
14868 | 15068 | case 'z': |
---|
14869 | | - RENDERSHADOW ^= true; |
---|
| 15069 | + Globals.RENDERSHADOW ^= true; |
---|
14870 | 15070 | Globals.lighttouched = true; |
---|
14871 | 15071 | repaint(); |
---|
14872 | 15072 | break; |
---|
.. | .. |
---|
14990 | 15190 | //mode = ROTATE; |
---|
14991 | 15191 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14992 | 15192 | { |
---|
14993 | | - SetMouseMode(modifiers); |
---|
| 15193 | + SetMouseMode(0, modifiers); |
---|
14994 | 15194 | } |
---|
14995 | 15195 | } |
---|
14996 | 15196 | |
---|
.. | .. |
---|
15345 | 15545 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15346 | 15546 | //Image img = CreateImage(width, height); |
---|
15347 | 15547 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15548 | + |
---|
15348 | 15549 | Graphics gr = g; // img.getGraphics(); |
---|
| 15550 | + |
---|
15349 | 15551 | if (!hasMarquee) |
---|
15350 | 15552 | { |
---|
15351 | 15553 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15443 | 15645 | if (!isRenderer) |
---|
15444 | 15646 | { |
---|
15445 | 15647 | object.drawEditHandles(info, 0); |
---|
| 15648 | + |
---|
| 15649 | + if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15650 | + { |
---|
| 15651 | + switch (object.selection.get(0).hitSomething) |
---|
| 15652 | + { |
---|
| 15653 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15654 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15655 | + break; |
---|
| 15656 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15657 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15658 | + break; |
---|
| 15659 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15660 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15661 | + break; |
---|
| 15662 | + } |
---|
| 15663 | + |
---|
| 15664 | + } |
---|
15446 | 15665 | } |
---|
15447 | 15666 | } |
---|
| 15667 | + |
---|
15448 | 15668 | if (isRenderer) |
---|
15449 | 15669 | { |
---|
15450 | 15670 | //gr.setColor(Color.black); |
---|
15451 | 15671 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15452 | 15672 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15453 | 15673 | } |
---|
| 15674 | + |
---|
15454 | 15675 | if (hasMarquee) |
---|
15455 | 15676 | { |
---|
15456 | 15677 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15563 | 15784 | public boolean mouseDown(Event evt, int x, int y) |
---|
15564 | 15785 | { |
---|
15565 | 15786 | System.out.println("mouseDown: " + evt); |
---|
| 15787 | + System.exit(0); |
---|
15566 | 15788 | /* |
---|
15567 | 15789 | locked = true; |
---|
15568 | 15790 | drag = false; |
---|
.. | .. |
---|
15606 | 15828 | { |
---|
15607 | 15829 | keyPressed(0, modifiers); |
---|
15608 | 15830 | } |
---|
15609 | | - clickStart(x, y, modifiers); |
---|
| 15831 | + // clickStart(x, y, modifiers); |
---|
15610 | 15832 | return true; |
---|
15611 | 15833 | } |
---|
15612 | 15834 | |
---|
.. | .. |
---|
15724 | 15946 | { |
---|
15725 | 15947 | keyReleased(0, 0); |
---|
15726 | 15948 | } |
---|
15727 | | - drag(x, y, modifiers); |
---|
| 15949 | + drag(x, y, 0, modifiers); |
---|
15728 | 15950 | return true; |
---|
15729 | 15951 | } |
---|
15730 | 15952 | |
---|
.. | .. |
---|
15856 | 16078 | Object3D object; |
---|
15857 | 16079 | static Object3D trackedobject; |
---|
15858 | 16080 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15859 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16081 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15860 | 16082 | /*static*/ Camera eyeCamera; |
---|
15861 | 16083 | /*static*/ Camera lightCamera; |
---|
15862 | 16084 | int cameracount; |
---|
.. | .. |
---|
16422 | 16644 | 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])); |
---|
16423 | 16645 | } |
---|
16424 | 16646 | |
---|
16425 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16647 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16426 | 16648 | } |
---|
16427 | 16649 | } |
---|
16428 | 16650 | |
---|
16429 | 16651 | if (!movingcamera && !PAINTMODE) |
---|
16430 | 16652 | object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
16431 | 16653 | |
---|
16432 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16654 | + if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16433 | 16655 | { |
---|
16434 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16656 | + Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16435 | 16657 | |
---|
16436 | 16658 | Object3D group = new Object3D("inst" + paintcount++); |
---|
16437 | 16659 | |
---|
.. | .. |
---|
16587 | 16809 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16588 | 16810 | } |
---|
16589 | 16811 | |
---|
16590 | | - if (!RENDERSHADOW) |
---|
| 16812 | + if (!Globals.RENDERSHADOW) |
---|
16591 | 16813 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16592 | 16814 | |
---|
16593 | 16815 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16597 | 16819 | //gl.glColorMask(false, false, false, false); |
---|
16598 | 16820 | |
---|
16599 | 16821 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16600 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16822 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16601 | 16823 | { |
---|
16602 | 16824 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16603 | 16825 | |
---|