.. | .. |
---|
37 | 37 | static boolean[] selectedstack = new boolean[65536]; |
---|
38 | 38 | static int materialdepth = 0; |
---|
39 | 39 | |
---|
40 | | - static boolean DEBUG = false; |
---|
41 | 40 | static boolean FRUSTUM = false; // still bogus true; // frustum culling |
---|
42 | 41 | |
---|
43 | 42 | // camera change fix |
---|
.. | .. |
---|
61 | 60 | //boolean REDUCETEXTURE = true; |
---|
62 | 61 | boolean CACHETEXTURE = true; |
---|
63 | 62 | boolean CLEANCACHE = false; // true; |
---|
64 | | - boolean MIPMAP = false; // true; |
---|
| 63 | + boolean MIPMAP = true; // false; // true; |
---|
65 | 64 | boolean COMPRESSTEXTURE = false; |
---|
66 | 65 | boolean KOMPACTTEXTURE = false; // true; |
---|
67 | 66 | boolean RESIZETEXTURE = false; |
---|
.. | .. |
---|
149 | 148 | defaultcaps.setAccumBlueBits(16); |
---|
150 | 149 | defaultcaps.setAccumAlphaBits(16); |
---|
151 | 150 | } |
---|
| 151 | + |
---|
| 152 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
152 | 153 | |
---|
153 | 154 | void SetAsGLRenderer(boolean b) |
---|
154 | 155 | { |
---|
.. | .. |
---|
325 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
326 | 327 | //System.out.println("material " + material); |
---|
327 | 328 | //Applet3D.tracein(this, selected); |
---|
328 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
329 | 330 | if (obj instanceof Camera) |
---|
330 | 331 | { |
---|
331 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
334 | 335 | display.options1[2] = material.shadowbias; |
---|
335 | 336 | display.options1[3] = material.aniso; |
---|
336 | 337 | display.options1[4] = material.anisoV; |
---|
| 338 | +// System.out.println("display.options1[0] " + display.options1[0]); |
---|
| 339 | +// System.out.println("display.options1[1] " + display.options1[1]); |
---|
| 340 | +// System.out.println("display.options1[2] " + display.options1[2]); |
---|
| 341 | +// System.out.println("display.options1[3] " + display.options1[3]); |
---|
| 342 | +// System.out.println("display.options1[4] " + display.options1[4]); |
---|
337 | 343 | display.options2[0] = material.opacity; |
---|
338 | 344 | display.options2[1] = material.diffuse; |
---|
339 | 345 | display.options2[2] = material.factor; |
---|
| 346 | +// System.out.println("display.options2[0] " + display.options2[0]); |
---|
| 347 | +// System.out.println("display.options2[1] " + display.options2[1]); |
---|
| 348 | +// System.out.println("display.options2[2] " + display.options2[2]); |
---|
340 | 349 | |
---|
341 | 350 | cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
| 351 | +// System.out.println("display.options3[0] " + display.options3[0]); |
---|
| 352 | +// System.out.println("display.options3[1] " + display.options3[1]); |
---|
| 353 | +// System.out.println("display.options3[2] " + display.options3[2]); |
---|
342 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
343 | 355 | display.options4[1] = material.subsurface; |
---|
344 | 356 | display.options4[2] = material.sheen; |
---|
| 357 | +// System.out.println("display.options4[0] " + display.options4[0]); |
---|
| 358 | +// System.out.println("display.options4[1] " + display.options4[1]); |
---|
| 359 | +// System.out.println("display.options4[2] " + display.options4[2]); |
---|
345 | 360 | |
---|
346 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
347 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
357 | 372 | /**/ |
---|
358 | 373 | } else |
---|
359 | 374 | { |
---|
360 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
361 | 376 | } |
---|
362 | 377 | } else |
---|
363 | 378 | { |
---|
.. | .. |
---|
381 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
382 | 397 | //System.out.println("material " + material); |
---|
383 | 398 | //Applet3D.tracein("selected ", selected); |
---|
384 | | - display.vector2buffer = obj.projectedVertices; |
---|
385 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
386 | 401 | } |
---|
387 | 402 | } |
---|
388 | 403 | |
---|
.. | .. |
---|
399 | 414 | materialdepth -= 1; |
---|
400 | 415 | if (materialdepth > 0) |
---|
401 | 416 | { |
---|
402 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
403 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 417 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 418 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
404 | 419 | } |
---|
405 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
406 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
420 | 435 | materialdepth -= 1; |
---|
421 | 436 | if (materialdepth > 0) |
---|
422 | 437 | { |
---|
423 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
424 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 438 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 439 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
425 | 440 | } |
---|
426 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
427 | 442 | //else |
---|
.. | .. |
---|
462 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
463 | 478 | { |
---|
464 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
465 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 480 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0) |
---|
| 481 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 482 | + ; |
---|
466 | 483 | if (!hasnorm) |
---|
467 | 484 | { |
---|
468 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
469 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
470 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
471 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1190 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1191 | 1208 | } |
---|
1192 | 1209 | } |
---|
| 1210 | + |
---|
1193 | 1211 | if (flipV) |
---|
1194 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1195 | 1213 | else |
---|
1196 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1197 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1198 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1199 | 1218 | |
---|
.. | .. |
---|
1213 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1214 | 1233 | } |
---|
1215 | 1234 | } |
---|
| 1235 | + |
---|
1216 | 1236 | if (flipV) |
---|
1217 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1218 | 1238 | else |
---|
1219 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1220 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1221 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1222 | 1243 | |
---|
.. | .. |
---|
1244 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1245 | 1266 | else |
---|
1246 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1247 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1248 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1249 | 1272 | count2 += 2; |
---|
1250 | 1273 | count3 += 3; |
---|
1251 | 1274 | } |
---|
.. | .. |
---|
1601 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1602 | 1625 | } |
---|
1603 | 1626 | |
---|
1604 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1605 | 1628 | { |
---|
1606 | 1629 | CameraPane display = this; |
---|
1607 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1628 | 1651 | |
---|
1629 | 1652 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1630 | 1653 | |
---|
1631 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1654 | + float[] colorV = Grafreed.colorV; |
---|
1632 | 1655 | |
---|
1633 | 1656 | /**/ |
---|
1634 | 1657 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1636 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1637 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1638 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1639 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1640 | 1663 | |
---|
1641 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1642 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1744 | 1767 | display.modelParams7[2] = 0; |
---|
1745 | 1768 | display.modelParams7[3] = 0; |
---|
1746 | 1769 | |
---|
1747 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1748 | 1771 | |
---|
1749 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1750 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1751 | 1774 | { |
---|
1752 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
1888 | 1911 | void PushMatrix(double[][] matrix) |
---|
1889 | 1912 | { |
---|
1890 | 1913 | // GrafreeD.tracein(matrix); |
---|
1891 | | - PushMatrix(matrix,1); |
---|
| 1914 | + PushMatrix(matrix, 1); |
---|
1892 | 1915 | } |
---|
1893 | 1916 | |
---|
1894 | 1917 | void PushMatrix() |
---|
.. | .. |
---|
2042 | 2065 | //System.err.println("Oeil on"); |
---|
2043 | 2066 | OEIL = true; |
---|
2044 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2045 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2046 | 2069 | //pingthread.StepToTarget(true); |
---|
2047 | 2070 | } |
---|
2048 | 2071 | |
---|
.. | .. |
---|
2140 | 2163 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2141 | 2164 | |
---|
2142 | 2165 | if (!Globals.isLIVE()) // save sound |
---|
2143 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2166 | + Grafreed.savesound = true; // wav.save(); |
---|
2144 | 2167 | // else |
---|
2145 | 2168 | repaint(); // start loop // may 2013 |
---|
2146 | 2169 | } |
---|
.. | .. |
---|
2257 | 2280 | |
---|
2258 | 2281 | void ToggleDebug() |
---|
2259 | 2282 | { |
---|
2260 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2261 | 2284 | } |
---|
2262 | 2285 | |
---|
2263 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2265 | 2288 | LOOKAT ^= true; |
---|
2266 | 2289 | } |
---|
2267 | 2290 | |
---|
2268 | | - void ToggleRandom() |
---|
| 2291 | + void ToggleSwitch() |
---|
2269 | 2292 | { |
---|
2270 | 2293 | SWITCH ^= true; |
---|
2271 | 2294 | } |
---|
.. | .. |
---|
2275 | 2298 | HANDLES ^= true; |
---|
2276 | 2299 | } |
---|
2277 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2278 | 2303 | void TogglePaint() |
---|
2279 | 2304 | { |
---|
2280 | 2305 | PAINTMODE ^= true; |
---|
2281 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2282 | 2312 | } |
---|
2283 | 2313 | |
---|
2284 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2374 | 2404 | { |
---|
2375 | 2405 | return currentGL; |
---|
2376 | 2406 | } |
---|
2377 | | - |
---|
| 2407 | + |
---|
2378 | 2408 | /**/ |
---|
2379 | 2409 | class CacheTexture |
---|
2380 | 2410 | { |
---|
.. | .. |
---|
2392 | 2422 | /**/ |
---|
2393 | 2423 | |
---|
2394 | 2424 | // TEXTURE static Texture texture; |
---|
2395 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2396 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2397 | | - static public java.util.Hashtable<String, String> usedtextures = new java.util.Hashtable<String, String>(); |
---|
| 2425 | + static public java.util.Hashtable<String, CacheTexture> textures = new java.util.Hashtable<String, CacheTexture>(); |
---|
| 2426 | + static public java.util.Hashtable<BufferedImage, CacheTexture> bimtextures = new java.util.Hashtable<BufferedImage, CacheTexture>(); |
---|
| 2427 | + static public java.util.HashSet<String> usedtextures = new java.util.HashSet<String>(); |
---|
| 2428 | + |
---|
2398 | 2429 | int pigmentdepth = 0; |
---|
2399 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2400 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2416 | 2447 | true, |
---|
2417 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2418 | 2449 | } catch (java.io.IOException e) |
---|
| 2450 | + { |
---|
| 2451 | + throw new javax.media.opengl.GLException(e); |
---|
| 2452 | + } |
---|
| 2453 | + |
---|
| 2454 | + if (bump) |
---|
| 2455 | + texturedata = ConvertBump(texturedata, false); |
---|
| 2456 | + |
---|
| 2457 | + com.sun.opengl.util.texture.Texture texture = |
---|
| 2458 | + com.sun.opengl.util.texture.TextureIO.newTexture(texturedata); |
---|
| 2459 | + |
---|
| 2460 | + texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_S, javax.media.opengl.GL.GL_REPEAT); |
---|
| 2461 | + texture.setTexParameteri(javax.media.opengl.GL.GL_TEXTURE_WRAP_T, javax.media.opengl.GL.GL_REPEAT); |
---|
| 2462 | + |
---|
| 2463 | + return texture; |
---|
| 2464 | + } |
---|
| 2465 | + |
---|
| 2466 | + com.sun.opengl.util.texture.Texture GetBimTexture(BufferedImage name, boolean bump) |
---|
| 2467 | + { |
---|
| 2468 | + TextureData texturedata = null; |
---|
| 2469 | + |
---|
| 2470 | + try |
---|
| 2471 | + { |
---|
| 2472 | + texturedata = |
---|
| 2473 | + com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
| 2474 | + name, |
---|
| 2475 | + true); |
---|
| 2476 | + } catch (Exception e) |
---|
2419 | 2477 | { |
---|
2420 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2421 | 2479 | } |
---|
.. | .. |
---|
3502 | 3560 | |
---|
3503 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3504 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3505 | 3565 | // |
---|
3506 | 3566 | if (false) // compressbit > 0) |
---|
3507 | 3567 | { |
---|
.. | .. |
---|
7900 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
7901 | 7961 | String bump = Object3D.GetBump(tex); |
---|
7902 | 7962 | |
---|
7903 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7904 | 7964 | { |
---|
7905 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7906 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7917 | 7977 | |
---|
7918 | 7978 | ReleaseTexture(bump, true); |
---|
7919 | 7979 | ReleaseTexture(pigment, false); |
---|
| 7980 | + } |
---|
| 7981 | + |
---|
| 7982 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7983 | + { |
---|
| 7984 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7985 | + { |
---|
| 7986 | + return; |
---|
| 7987 | + } |
---|
| 7988 | + |
---|
| 7989 | + if (tex == null) |
---|
| 7990 | + { |
---|
| 7991 | + ReleaseTexture(null, false); |
---|
| 7992 | + return; |
---|
| 7993 | + } |
---|
| 7994 | + |
---|
| 7995 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7996 | + |
---|
| 7997 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7998 | + { |
---|
| 7999 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 8000 | + // System.out.println("; bump = " + bump); |
---|
| 8001 | + } |
---|
| 8002 | + |
---|
| 8003 | + if (pigment.equals("")) |
---|
| 8004 | + { |
---|
| 8005 | + pigment = null; |
---|
| 8006 | + } |
---|
| 8007 | + |
---|
| 8008 | + ReleaseTexture(pigment, false); |
---|
| 8009 | + } |
---|
| 8010 | + |
---|
| 8011 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 8012 | + { |
---|
| 8013 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 8014 | + { |
---|
| 8015 | + return; |
---|
| 8016 | + } |
---|
| 8017 | + |
---|
| 8018 | + if (tex == null) |
---|
| 8019 | + { |
---|
| 8020 | + ReleaseTexture(null, true); |
---|
| 8021 | + return; |
---|
| 8022 | + } |
---|
| 8023 | + |
---|
| 8024 | + String bump = Object3D.GetBump(tex); |
---|
| 8025 | + |
---|
| 8026 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8027 | + { |
---|
| 8028 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 8029 | + // System.out.println("; bump = " + bump); |
---|
| 8030 | + } |
---|
| 8031 | + |
---|
| 8032 | + if (bump.equals("")) |
---|
| 8033 | + { |
---|
| 8034 | + bump = null; |
---|
| 8035 | + } |
---|
| 8036 | + |
---|
| 8037 | + ReleaseTexture(bump, true); |
---|
7920 | 8038 | } |
---|
7921 | 8039 | |
---|
7922 | 8040 | void ReleaseTexture(String tex, boolean bump) |
---|
.. | .. |
---|
8022 | 8140 | } |
---|
8023 | 8141 | } |
---|
8024 | 8142 | |
---|
8025 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8143 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8144 | + { |
---|
| 8145 | +// if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8146 | +// ambientOcclusion ) // || !textureon) |
---|
| 8147 | +// { |
---|
| 8148 | +// return; // false; |
---|
| 8149 | +// } |
---|
| 8150 | +// |
---|
| 8151 | +// if (tex == null) |
---|
| 8152 | +// { |
---|
| 8153 | +// BindTexture(null,false,resolution); |
---|
| 8154 | +// BindTexture(null,true,resolution); |
---|
| 8155 | +// return; |
---|
| 8156 | +// } |
---|
| 8157 | +// |
---|
| 8158 | +// String pigment = Object3D.GetPigment(tex); |
---|
| 8159 | +// String bump = Object3D.GetBump(tex); |
---|
| 8160 | +// |
---|
| 8161 | +// usedtextures.add(pigment); |
---|
| 8162 | +// usedtextures.add(bump); |
---|
| 8163 | +// |
---|
| 8164 | +// //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8165 | +// { |
---|
| 8166 | +// // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8167 | +// // System.out.println("; bump = " + bump); |
---|
| 8168 | +// } |
---|
| 8169 | +// |
---|
| 8170 | +// if (bump.equals("")) |
---|
| 8171 | +// { |
---|
| 8172 | +// bump = null; |
---|
| 8173 | +// } |
---|
| 8174 | +// if (pigment.equals("")) |
---|
| 8175 | +// { |
---|
| 8176 | +// pigment = null; |
---|
| 8177 | +// } |
---|
| 8178 | +// |
---|
| 8179 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8180 | +// BindTexture(pigment, false, resolution); |
---|
| 8181 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8182 | +// BindTexture(bump, true, resolution); |
---|
| 8183 | +// GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8184 | +// |
---|
| 8185 | +// return; // true; |
---|
| 8186 | + |
---|
| 8187 | + BindPigmentTexture(tex, resolution); |
---|
| 8188 | + BindBumpTexture(tex, resolution); |
---|
| 8189 | + } |
---|
| 8190 | + |
---|
| 8191 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8026 | 8192 | { |
---|
8027 | 8193 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8028 | 8194 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8032 | 8198 | |
---|
8033 | 8199 | if (tex == null) |
---|
8034 | 8200 | { |
---|
8035 | | - BindTexture(null,false,resolution); |
---|
8036 | | - BindTexture(null,true,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8037 | 8202 | return; |
---|
8038 | 8203 | } |
---|
8039 | 8204 | |
---|
8040 | 8205 | String pigment = Object3D.GetPigment(tex); |
---|
| 8206 | + |
---|
| 8207 | + usedtextures.add(pigment); |
---|
| 8208 | + |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8210 | + { |
---|
| 8211 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8212 | + // System.out.println("; bump = " + bump); |
---|
| 8213 | + } |
---|
| 8214 | + |
---|
| 8215 | + if (pigment.equals("")) |
---|
| 8216 | + { |
---|
| 8217 | + pigment = null; |
---|
| 8218 | + } |
---|
| 8219 | + |
---|
| 8220 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8221 | + BindTexture(tex.pigmenttexture, pigment, false, resolution); |
---|
| 8222 | + } |
---|
| 8223 | + |
---|
| 8224 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8225 | + { |
---|
| 8226 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8227 | + ambientOcclusion ) // || !textureon) |
---|
| 8228 | + { |
---|
| 8229 | + return; // false; |
---|
| 8230 | + } |
---|
| 8231 | + |
---|
| 8232 | + if (tex == null) |
---|
| 8233 | + { |
---|
| 8234 | + BindTexture(null, null,true,resolution); |
---|
| 8235 | + return; |
---|
| 8236 | + } |
---|
| 8237 | + |
---|
8041 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8042 | 8239 | |
---|
8043 | | - usedtextures.put(pigment, pigment); |
---|
8044 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8045 | 8241 | |
---|
8046 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8047 | 8243 | { |
---|
8048 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8049 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8053 | 8249 | { |
---|
8054 | 8250 | bump = null; |
---|
8055 | 8251 | } |
---|
8056 | | - if (pigment.equals("")) |
---|
8057 | | - { |
---|
8058 | | - pigment = null; |
---|
8059 | | - } |
---|
8060 | 8252 | |
---|
8061 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8062 | | - BindTexture(pigment, false, resolution); |
---|
8063 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8064 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8065 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8066 | | - |
---|
8067 | | - return; // true; |
---|
8068 | 8256 | } |
---|
8069 | 8257 | |
---|
8070 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8258 | + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
| 8259 | + |
---|
| 8260 | + private boolean FileExists(String tex) |
---|
8071 | 8261 | { |
---|
8072 | | - CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
| 8262 | + if (missingTextures.contains(tex)) |
---|
| 8263 | + { |
---|
| 8264 | + return false; |
---|
| 8265 | + } |
---|
| 8266 | + |
---|
| 8267 | + boolean fileExists = new File(tex).exists(); |
---|
| 8268 | + |
---|
| 8269 | + if (!fileExists) |
---|
| 8270 | + { |
---|
| 8271 | + // If file exists, the "new File()" is not executed sgain |
---|
| 8272 | + missingTextures.add(tex); |
---|
| 8273 | + } |
---|
| 8274 | + |
---|
| 8275 | + return fileExists; |
---|
| 8276 | + } |
---|
| 8277 | + |
---|
| 8278 | + CacheTexture GetCacheTexture(java.awt.image.BufferedImage bim, String tex, boolean bump, int resolution) throws Exception |
---|
| 8279 | + { |
---|
| 8280 | + CacheTexture texturecache = null; |
---|
8073 | 8281 | |
---|
8074 | 8282 | if (tex != null) |
---|
8075 | 8283 | { |
---|
8076 | 8284 | String texname = tex; |
---|
8077 | 8285 | |
---|
| 8286 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8287 | + |
---|
8078 | 8288 | // String[] split = tex.split("Textures"); |
---|
8079 | 8289 | // if (split.length > 1) |
---|
8080 | 8290 | // texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8081 | 8291 | // else |
---|
8082 | 8292 | // if (!texname.startsWith("/")) |
---|
8083 | 8293 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8084 | | - if (!new File(tex).exists()) |
---|
| 8294 | + if (!FileExists(tex)) |
---|
8085 | 8295 | { |
---|
8086 | | - texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname; |
---|
| 8296 | + texname = fallbackTextureName; |
---|
8087 | 8297 | } |
---|
8088 | 8298 | |
---|
8089 | 8299 | if (CACHETEXTURE) |
---|
8090 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8091 | | - |
---|
8092 | | - TextureData texturedata = null; |
---|
8093 | | - |
---|
8094 | | - if (texture == null || texture.resolution < resolution) |
---|
8095 | 8300 | { |
---|
| 8301 | + if (bim == null) |
---|
| 8302 | + texturecache = textures.get(texname); // TEXTURE CACHE |
---|
| 8303 | + else |
---|
| 8304 | + texturecache = bimtextures.get(bim); // TEXTURE CACHE |
---|
| 8305 | + } |
---|
| 8306 | + |
---|
| 8307 | + if (texturecache == null || texturecache.resolution < resolution) |
---|
| 8308 | + { |
---|
| 8309 | + TextureData texturedata = null; |
---|
| 8310 | + |
---|
| 8311 | + if (bim == null) |
---|
| 8312 | + { |
---|
| 8313 | + |
---|
| 8314 | + } |
---|
| 8315 | + else |
---|
8096 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8097 | 8317 | { |
---|
8098 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8104 | 8324 | // } |
---|
8105 | 8325 | // else |
---|
8106 | 8326 | // { |
---|
8107 | | - texture = textures.get(tex); |
---|
8108 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8109 | 8329 | { |
---|
8110 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8111 | 8331 | } |
---|
8112 | 8332 | // } |
---|
8113 | 8333 | } else |
---|
8114 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8115 | 8335 | { |
---|
8116 | 8336 | assert(bump); |
---|
8117 | | - texture = textures.get(tex); |
---|
8118 | | - if (texture == null) |
---|
8119 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8337 | + texturecache = textures.get(tex); |
---|
| 8338 | + if (texturecache == null) |
---|
| 8339 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8120 | 8340 | } else |
---|
8121 | 8341 | { |
---|
8122 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8126 | 8346 | //{ |
---|
8127 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8128 | 8348 | { |
---|
8129 | | - texture = textures.get(tex); |
---|
8130 | | - if (texture == null) |
---|
8131 | | - texture = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution); |
---|
| 8349 | + texturecache = textures.get(tex); |
---|
| 8350 | + if (texturecache == null) |
---|
| 8351 | + texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution); |
---|
8132 | 8352 | } else |
---|
8133 | 8353 | { |
---|
8134 | 8354 | if (textureon) |
---|
.. | .. |
---|
8153 | 8373 | } |
---|
8154 | 8374 | |
---|
8155 | 8375 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8156 | | - if (!new File(cachename).exists()) |
---|
| 8376 | + if (!FileExists(cachename)) |
---|
8157 | 8377 | cachename = texname; |
---|
8158 | 8378 | else |
---|
8159 | 8379 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8175 | 8395 | } |
---|
8176 | 8396 | |
---|
8177 | 8397 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8178 | | - if (!new File(cachename).exists()) |
---|
| 8398 | + if (!FileExists(cachename)) |
---|
8179 | 8399 | cachename = texname; |
---|
8180 | 8400 | else |
---|
8181 | 8401 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8184 | 8404 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8185 | 8405 | |
---|
8186 | 8406 | |
---|
8187 | | - if (texturedata != null) |
---|
8188 | | - texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
| 8407 | + if (texturedata == null) |
---|
| 8408 | + throw new Exception(); |
---|
| 8409 | + |
---|
| 8410 | + texturecache = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8189 | 8411 | //texture = GetTexture(tex, bump); |
---|
8190 | 8412 | } |
---|
8191 | 8413 | } |
---|
8192 | 8414 | //} |
---|
8193 | 8415 | } |
---|
8194 | 8416 | |
---|
8195 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8196 | 8418 | { |
---|
8197 | 8419 | //return false; |
---|
8198 | 8420 | |
---|
8199 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8200 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8201 | 8423 | { |
---|
8202 | 8424 | // String ext = "_highres"; |
---|
8203 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8286 | 8508 | textures.remove(texname); |
---|
8287 | 8509 | } |
---|
8288 | 8510 | |
---|
8289 | | - texture.texturedata = texturedata; |
---|
8290 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8291 | 8513 | |
---|
8292 | 8514 | // newtex = true; |
---|
8293 | 8515 | } |
---|
.. | .. |
---|
8303 | 8525 | } |
---|
8304 | 8526 | } |
---|
8305 | 8527 | |
---|
8306 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8307 | 8529 | } |
---|
8308 | 8530 | |
---|
8309 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) |
---|
| 8531 | + com.sun.opengl.util.texture.Texture GetTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8310 | 8532 | { |
---|
8311 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8312 | 8534 | |
---|
8313 | 8535 | if (bump) |
---|
8314 | 8536 | { |
---|
.. | .. |
---|
8324 | 8546 | return texture!=null?texture.texture:null; |
---|
8325 | 8547 | } |
---|
8326 | 8548 | |
---|
8327 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8549 | + public com.sun.opengl.util.texture.TextureData GetTextureData(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8328 | 8550 | { |
---|
8329 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8330 | 8552 | |
---|
8331 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8332 | 8554 | } |
---|
8333 | 8555 | |
---|
8334 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8556 | + boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8335 | 8557 | { |
---|
8336 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8337 | 8559 | { |
---|
8338 | 8560 | return false; |
---|
8339 | 8561 | } |
---|
8340 | 8562 | |
---|
8341 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8342 | 8564 | |
---|
8343 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8344 | 8566 | |
---|
8345 | 8567 | if (texture == null) |
---|
8346 | 8568 | return false; |
---|
.. | .. |
---|
8370 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8371 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8372 | 8594 | |
---|
8373 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8374 | 8596 | } |
---|
8375 | 8597 | |
---|
8376 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9208 | 9430 | jy8[3] = 0.5f; |
---|
9209 | 9431 | } |
---|
9210 | 9432 | |
---|
9211 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9433 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9212 | 9434 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9213 | 9435 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9214 | 9436 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9215 | 9437 | |
---|
| 9438 | + void ResetOptions() |
---|
| 9439 | + { |
---|
| 9440 | + options1[0] = 100; |
---|
| 9441 | + options1[1] = 0.025f; |
---|
| 9442 | + options1[2] = 0.01f; |
---|
| 9443 | + options1[3] = 0; |
---|
| 9444 | + options1[4] = 0; |
---|
| 9445 | + |
---|
| 9446 | + options2[0] = 0; |
---|
| 9447 | + options2[1] = 0.75f; |
---|
| 9448 | + options2[2] = 0; |
---|
| 9449 | + options2[3] = 0; |
---|
| 9450 | + |
---|
| 9451 | + options3[0] = 1; |
---|
| 9452 | + options3[1] = 1; |
---|
| 9453 | + options3[2] = 1; |
---|
| 9454 | + options3[3] = 0; |
---|
| 9455 | + |
---|
| 9456 | + options4[0] = 1; |
---|
| 9457 | + options4[1] = 0; |
---|
| 9458 | + options4[2] = 1; |
---|
| 9459 | + options4[3] = 0; |
---|
| 9460 | + } |
---|
| 9461 | + |
---|
9216 | 9462 | static int imagecount = 0; // movie generation |
---|
9217 | 9463 | |
---|
9218 | 9464 | static int jitter = 0; |
---|
.. | .. |
---|
9308 | 9554 | assert (parentcam != renderCamera); |
---|
9309 | 9555 | |
---|
9310 | 9556 | if (renderCamera != lightCamera) |
---|
9311 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9312 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9557 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9558 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9313 | 9559 | |
---|
9314 | 9560 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9315 | 9561 | |
---|
.. | .. |
---|
9324 | 9570 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9325 | 9571 | |
---|
9326 | 9572 | if (renderCamera != lightCamera) |
---|
9327 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9328 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9573 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9574 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9329 | 9575 | |
---|
9330 | 9576 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9331 | 9577 | |
---|
.. | .. |
---|
9542 | 9788 | |
---|
9543 | 9789 | if (!BOXMODE) |
---|
9544 | 9790 | { |
---|
9545 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9791 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
9546 | 9792 | } |
---|
9547 | 9793 | |
---|
9548 | 9794 | if (!BOXMODE) |
---|
.. | .. |
---|
9580 | 9826 | ABORTED = false; |
---|
9581 | 9827 | } |
---|
9582 | 9828 | else |
---|
9583 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9829 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9584 | 9830 | |
---|
9585 | 9831 | if (false) |
---|
9586 | 9832 | { |
---|
.. | .. |
---|
10243 | 10489 | |
---|
10244 | 10490 | public void display(GLAutoDrawable drawable) |
---|
10245 | 10491 | { |
---|
10246 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10492 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10247 | 10493 | { |
---|
10248 | | - GrafreeD.wav.save(); |
---|
10249 | | - GrafreeD.savesound = false; |
---|
10250 | | - GrafreeD.hassound = false; |
---|
| 10494 | + Grafreed.wav.save(); |
---|
| 10495 | + Grafreed.savesound = false; |
---|
| 10496 | + Grafreed.hassound = false; |
---|
10251 | 10497 | } |
---|
10252 | 10498 | // if (DEBUG_SELECTION) |
---|
10253 | 10499 | // { |
---|
.. | .. |
---|
10323 | 10569 | ANTIALIAS = 0; |
---|
10324 | 10570 | //System.out.println("RESTART"); |
---|
10325 | 10571 | AAtimer.restart(); |
---|
| 10572 | + Globals.TIMERRUNNING = true; |
---|
10326 | 10573 | } |
---|
10327 | 10574 | } |
---|
10328 | 10575 | } |
---|
.. | .. |
---|
10377 | 10624 | Object3D theobject = object; |
---|
10378 | 10625 | Object3D theparent = object.parent; |
---|
10379 | 10626 | object.parent = null; |
---|
10380 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10627 | + object = (Object3D)Grafreed.clone(object); |
---|
10381 | 10628 | object.Stripify(); |
---|
10382 | 10629 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10383 | 10630 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10390 | 10637 | ambientOcclusion = false; |
---|
10391 | 10638 | } |
---|
10392 | 10639 | |
---|
10393 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10640 | + if (//Globals.lighttouched && |
---|
| 10641 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10394 | 10642 | { |
---|
10395 | 10643 | //if (RENDERSHADOW) // ? |
---|
10396 | 10644 | if (!IsFrozen()) |
---|
10397 | 10645 | { |
---|
10398 | 10646 | // dec 2012 |
---|
10399 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10647 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10400 | 10648 | { |
---|
10401 | 10649 | Globals.framecount++; |
---|
10402 | 10650 | shadowbuffer.display(); |
---|
.. | .. |
---|
10523 | 10771 | |
---|
10524 | 10772 | // if (parentcam != renderCamera) // not a light |
---|
10525 | 10773 | if (cam != lightCamera) |
---|
10526 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10527 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10774 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10775 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10528 | 10776 | |
---|
10529 | 10777 | for (int j = 0; j < 4; j++) |
---|
10530 | 10778 | { |
---|
.. | .. |
---|
10538 | 10786 | |
---|
10539 | 10787 | // if (parentcam != renderCamera) // not a light |
---|
10540 | 10788 | if (cam != lightCamera) |
---|
10541 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10542 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10789 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10790 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10543 | 10791 | |
---|
10544 | 10792 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10545 | 10793 | |
---|
.. | .. |
---|
10798 | 11046 | // Bump noise |
---|
10799 | 11047 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10800 | 11048 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10801 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11049 | + |
---|
| 11050 | + try |
---|
| 11051 | + { |
---|
| 11052 | + BindTexture(null, NOISE_TEXTURE, false, 2); |
---|
| 11053 | + } |
---|
| 11054 | + catch (Exception e) |
---|
| 11055 | + { |
---|
| 11056 | + System.err.println("FAILED: " + NOISE_TEXTURE); |
---|
| 11057 | + } |
---|
| 11058 | + |
---|
10802 | 11059 | |
---|
10803 | 11060 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10804 | 11061 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10821 | 11078 | |
---|
10822 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10823 | 11080 | |
---|
10824 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10825 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10826 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11081 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11082 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11083 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
10827 | 11084 | } else |
---|
10828 | 11085 | { |
---|
10829 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10834 | 11091 | //System.out.println("BLENDING ON"); |
---|
10835 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
10836 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10837 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10838 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10839 | 11096 | gl.glLoadIdentity(); |
---|
10840 | 11097 | |
---|
.. | .. |
---|
10923 | 11180 | System.err.println("parentcam != renderCamera"); |
---|
10924 | 11181 | |
---|
10925 | 11182 | // if (cam != lightCamera) |
---|
10926 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10927 | | - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013 |
---|
| 11183 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11184 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10928 | 11185 | } |
---|
10929 | 11186 | |
---|
10930 | 11187 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10945 | 11202 | if (true) // TODO |
---|
10946 | 11203 | { |
---|
10947 | 11204 | if (cam != lightCamera) |
---|
10948 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10949 | | - LA.xformDir(light0, parentcam.toParent, light0); // may 2013 |
---|
| 11205 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11206 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10950 | 11207 | } |
---|
10951 | 11208 | |
---|
10952 | 11209 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11283 | 11540 | e.printStackTrace(); |
---|
11284 | 11541 | } |
---|
11285 | 11542 | |
---|
11286 | | - if (GrafreeD.RENDERME > 0) |
---|
11287 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11543 | + if (Grafreed.RENDERME > 0) |
---|
| 11544 | + Grafreed.RENDERME--; // mechante magouille |
---|
11288 | 11545 | |
---|
11289 | 11546 | Globals.ONESTEP = false; |
---|
11290 | 11547 | } |
---|
11291 | 11548 | |
---|
11292 | 11549 | static boolean zoomonce = false; |
---|
11293 | 11550 | |
---|
| 11551 | + static void CreateSelectedPoint() |
---|
| 11552 | + { |
---|
| 11553 | + if (selectedpoint == null) |
---|
| 11554 | + { |
---|
| 11555 | + debugpointG = new Sphere(); |
---|
| 11556 | + debugpointP = new Sphere(); |
---|
| 11557 | + debugpointC = new Sphere(); |
---|
| 11558 | + debugpointR = new Sphere(); |
---|
| 11559 | + |
---|
| 11560 | + selectedpoint = new Superellipsoid(); |
---|
| 11561 | + |
---|
| 11562 | + for (int i=0; i<8; i++) |
---|
| 11563 | + { |
---|
| 11564 | + debugpoints[i] = new Sphere(); |
---|
| 11565 | + } |
---|
| 11566 | + } |
---|
| 11567 | + } |
---|
| 11568 | + |
---|
11294 | 11569 | void DrawObject(GL gl, boolean draw) |
---|
11295 | 11570 | { |
---|
| 11571 | + // To clear camera values |
---|
| 11572 | + ResetOptions(); |
---|
| 11573 | + |
---|
11296 | 11574 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11297 | 11575 | // DrawMode() = SELECTION; |
---|
11298 | 11576 | //GL gl = getGL(); |
---|
11299 | 11577 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11300 | 11578 | { |
---|
11301 | 11579 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11302 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11580 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11303 | 11581 | pingthread.StepToTarget(true); // true); |
---|
11304 | 11582 | // zoomonce = false; |
---|
11305 | 11583 | } |
---|
.. | .. |
---|
11354 | 11632 | |
---|
11355 | 11633 | usedtextures.clear(); |
---|
11356 | 11634 | |
---|
11357 | | - BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11635 | + try |
---|
| 11636 | + { |
---|
| 11637 | + BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11638 | + } |
---|
| 11639 | + catch (Exception e) |
---|
| 11640 | + { |
---|
| 11641 | + System.err.println("FAILED: " + DEFAULT_TEXTURES); |
---|
| 11642 | + } |
---|
11358 | 11643 | } |
---|
11359 | 11644 | //System.out.println("--> " + stackdepth); |
---|
11360 | 11645 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11364 | 11649 | |
---|
11365 | 11650 | if (DrawMode() == DEFAULT) |
---|
11366 | 11651 | { |
---|
11367 | | - if (DEBUG) |
---|
| 11652 | + if (Globals.DEBUG) |
---|
11368 | 11653 | { |
---|
| 11654 | + CreateSelectedPoint(); |
---|
11369 | 11655 | float radius = 0.05f; |
---|
11370 | 11656 | if (selectedpoint.radius != radius) |
---|
11371 | 11657 | { |
---|
.. | .. |
---|
11428 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11429 | 11715 | continue; |
---|
11430 | 11716 | |
---|
11431 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11432 | 11718 | { |
---|
11433 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11434 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
11445 | 11731 | if (checker != null && DrawMode() == DEFAULT) |
---|
11446 | 11732 | { |
---|
11447 | 11733 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11448 | | - BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11734 | + try |
---|
| 11735 | + { |
---|
| 11736 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11737 | + } |
---|
| 11738 | + catch (Exception e) |
---|
| 11739 | + { |
---|
| 11740 | + System.err.println("FAILED: " + checker.GetTextures()); |
---|
| 11741 | + } |
---|
11449 | 11742 | // NEAREST |
---|
11450 | 11743 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11451 | 11744 | DrawChecker(gl); |
---|
.. | .. |
---|
11527 | 11820 | return; |
---|
11528 | 11821 | } |
---|
11529 | 11822 | |
---|
11530 | | - String string = obj.GetToolTip(); |
---|
| 11823 | + String string = obj.toString(); //.GetToolTip(); |
---|
11531 | 11824 | |
---|
11532 | 11825 | GL gl = GetGL(); |
---|
11533 | 11826 | |
---|
.. | .. |
---|
11844 | 12137 | //obj.TransformToWorld(light, light); |
---|
11845 | 12138 | for (int i = tp.size(); --i >= 0;) |
---|
11846 | 12139 | { |
---|
11847 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11848 | | - LA.xformPos(light, tp.get(i).toParent, light); |
---|
| 12140 | + //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
| 12141 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
11849 | 12142 | } |
---|
11850 | 12143 | |
---|
11851 | 12144 | |
---|
.. | .. |
---|
11862 | 12155 | parentcam = cameras[0]; |
---|
11863 | 12156 | } |
---|
11864 | 12157 | |
---|
11865 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11866 | | - LA.xformPos(light, parentcam.toParent, light); // may 2013 |
---|
| 12158 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 12159 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11867 | 12160 | |
---|
11868 | 12161 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11869 | 12162 | |
---|
.. | .. |
---|
12477 | 12770 | |
---|
12478 | 12771 | // display shadow only (bump == 0) |
---|
12479 | 12772 | "SUB temp.x, half.x, shadow.x;" + |
---|
12480 | | - "MOV temp.y, -params6.x;" + |
---|
12481 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12773 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12774 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12482 | 12775 | "SUB temp.y, one.x, temp.z;" + |
---|
12483 | 12776 | "MUL temp.x, temp.x, temp.y;" + |
---|
12484 | 12777 | "KIL temp.x;" + |
---|
.. | .. |
---|
12809 | 13102 | //once = true; |
---|
12810 | 13103 | } |
---|
12811 | 13104 | |
---|
12812 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 13105 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12813 | 13106 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12814 | 13107 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12815 | 13108 | |
---|
.. | .. |
---|
12942 | 13235 | |
---|
12943 | 13236 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12944 | 13237 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13238 | + |
---|
| 13239 | + // Compare fragment depth in light space with shadowmap. |
---|
12945 | 13240 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12946 | 13241 | "SGE temp.y, temp.x, zero.x;" + |
---|
12947 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13242 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13243 | + |
---|
| 13244 | + // Reverse comparison |
---|
12948 | 13245 | "SUB temp.x, one.x, temp.x;" + |
---|
12949 | 13246 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12950 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13247 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12951 | 13248 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12952 | 13249 | |
---|
12953 | 13250 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12961 | 13258 | // No shadow for backface |
---|
12962 | 13259 | "DP3 temp.x, normal, lightd;" + |
---|
12963 | 13260 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
| 13261 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 13262 | + |
---|
| 13263 | + // No shadow when out of frustrum |
---|
| 13264 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
12964 | 13265 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12965 | 13266 | ""; |
---|
12966 | 13267 | } |
---|
.. | .. |
---|
13107 | 13408 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13108 | 13409 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13109 | 13410 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13110 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13411 | + |
---|
| 13412 | + //Object3D.cVector2[] vector2buffer; |
---|
13111 | 13413 | |
---|
13112 | 13414 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13113 | 13415 | // OUT : diff, spec |
---|
.. | .. |
---|
13123 | 13425 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13124 | 13426 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13125 | 13427 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13126 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13127 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13128 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13428 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13429 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13430 | + |
---|
| 13431 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13129 | 13432 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13130 | 13433 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13131 | 13434 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13630 | 13933 | else |
---|
13631 | 13934 | if (evt.getSource() == AAtimer) |
---|
13632 | 13935 | { |
---|
| 13936 | + Globals.TIMERRUNNING = false; |
---|
13633 | 13937 | if (mouseDown) |
---|
13634 | 13938 | { |
---|
13635 | 13939 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13655 | 13959 | // LIVE = waslive; |
---|
13656 | 13960 | // wasliveok = true; |
---|
13657 | 13961 | // waslive = false; |
---|
| 13962 | + |
---|
| 13963 | + // May 2019 Forget it: |
---|
| 13964 | + if (true) |
---|
| 13965 | + return; |
---|
13658 | 13966 | |
---|
13659 | 13967 | // source == timer |
---|
13660 | 13968 | if (mouseDown) |
---|
.. | .. |
---|
13685 | 13993 | |
---|
13686 | 13994 | // fev 2014??? |
---|
13687 | 13995 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13688 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13996 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13689 | 13997 | pingthread.StepToTarget(true); // true); |
---|
13690 | 13998 | } |
---|
13691 | 13999 | // if (!LIVE) |
---|
.. | .. |
---|
13700 | 14008 | return; |
---|
13701 | 14009 | |
---|
13702 | 14010 | AAtimer.restart(); // |
---|
| 14011 | + Globals.TIMERRUNNING = true; |
---|
13703 | 14012 | |
---|
13704 | 14013 | // waslive = LIVE; |
---|
13705 | 14014 | // LIVE = false; |
---|
.. | .. |
---|
13772 | 14081 | |
---|
13773 | 14082 | public void mouseDragged(MouseEvent e) |
---|
13774 | 14083 | { |
---|
| 14084 | + Globals.MOUSEDRAGGED = true; |
---|
| 14085 | + |
---|
13775 | 14086 | //System.out.println("mouseDragged: " + e); |
---|
13776 | 14087 | if (isRenderer) |
---|
13777 | 14088 | movingcamera = true; |
---|
| 14089 | + |
---|
13778 | 14090 | //if (drawing) |
---|
13779 | 14091 | //return; |
---|
13780 | 14092 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
.. | .. |
---|
14035 | 14347 | void GoDown(int mod) |
---|
14036 | 14348 | { |
---|
14037 | 14349 | MODIFIERS |= COMMAND; |
---|
14038 | | - /* |
---|
| 14350 | + /**/ |
---|
14039 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14040 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14041 | 14353 | else |
---|
14042 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14043 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14044 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14045 | 14357 | { |
---|
14046 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14056 | 14368 | void GoUp(int mod) |
---|
14057 | 14369 | { |
---|
14058 | 14370 | MODIFIERS |= COMMAND; |
---|
14059 | | - /* |
---|
| 14371 | + /**/ |
---|
14060 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14061 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14062 | 14374 | else |
---|
14063 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14064 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14065 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14066 | 14378 | { |
---|
14067 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14077 | 14389 | void GoLeft(int mod) |
---|
14078 | 14390 | { |
---|
14079 | 14391 | MODIFIERS |= COMMAND; |
---|
14080 | | - /* |
---|
| 14392 | + /**/ |
---|
14081 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14082 | | - manipCamera.RotatePosition(speed, 0); |
---|
14083 | | - else |
---|
14084 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14085 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14086 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14087 | 14399 | { |
---|
14088 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14098 | 14410 | void GoRight(int mod) |
---|
14099 | 14411 | { |
---|
14100 | 14412 | MODIFIERS |= COMMAND; |
---|
14101 | | - /* |
---|
| 14413 | + /**/ |
---|
14102 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14103 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14104 | | - else |
---|
14105 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14106 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14107 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14108 | 14420 | { |
---|
14109 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14160 | 14472 | info.camera = renderCamera; |
---|
14161 | 14473 | info.x = x; |
---|
14162 | 14474 | info.y = y; |
---|
14163 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14475 | + object.GetWindow().copy |
---|
| 14476 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14164 | 14477 | } else |
---|
14165 | 14478 | { |
---|
14166 | 14479 | if (x < startX) |
---|
.. | .. |
---|
14324 | 14637 | ci.camera = renderCamera; |
---|
14325 | 14638 | if (!isRenderer) |
---|
14326 | 14639 | { |
---|
14327 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14640 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14641 | + //Object3D copy = editWindow.copy; |
---|
| 14642 | + if (object.doEditClick(ci, 0)) |
---|
14328 | 14643 | { |
---|
14329 | 14644 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14330 | 14645 | } else |
---|
.. | .. |
---|
14336 | 14651 | |
---|
14337 | 14652 | public void mouseReleased(MouseEvent e) |
---|
14338 | 14653 | { |
---|
| 14654 | + Globals.MOUSEDRAGGED = false; |
---|
| 14655 | + |
---|
14339 | 14656 | movingcamera = false; |
---|
| 14657 | + X = 0; // getBounds().width/2; |
---|
| 14658 | + Y = 0; // getBounds().height/2; |
---|
14340 | 14659 | //System.out.println("mouseReleased: " + e); |
---|
14341 | 14660 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14342 | 14661 | } |
---|
.. | .. |
---|
14359 | 14678 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14360 | 14679 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14361 | 14680 | |
---|
14362 | | - if (control || command || IsFrozen()) |
---|
| 14681 | +// No delay if (control || command || IsFrozen()) |
---|
14363 | 14682 | timeout = true; |
---|
14364 | 14683 | // ?? May 2019 else |
---|
14365 | 14684 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
.. | .. |
---|
14677 | 14996 | case 'E' : COMPACT ^= true; |
---|
14678 | 14997 | repaint(); |
---|
14679 | 14998 | break; |
---|
14680 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14681 | 15002 | repaint(); |
---|
14682 | 15003 | break; |
---|
14683 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14702 | 15023 | RevertCamera(); |
---|
14703 | 15024 | repaint(); |
---|
14704 | 15025 | break; |
---|
14705 | | - case 'L': |
---|
14706 | 15026 | case 'l': |
---|
| 15027 | + //case 'L': |
---|
14707 | 15028 | if (lightMode) |
---|
14708 | 15029 | { |
---|
14709 | 15030 | lightMode = false; |
---|
.. | .. |
---|
14846 | 15167 | case '_': |
---|
14847 | 15168 | kompactbit = 5; |
---|
14848 | 15169 | break; |
---|
14849 | | - case '+': |
---|
14850 | | - kompactbit = 6; |
---|
14851 | | - break; |
---|
| 15170 | +// case '+': |
---|
| 15171 | +// kompactbit = 6; |
---|
| 15172 | +// break; |
---|
14852 | 15173 | case ' ': |
---|
14853 | 15174 | lightMode ^= true; |
---|
14854 | 15175 | Globals.lighttouched = true; |
---|
.. | .. |
---|
14860 | 15181 | case ESC: |
---|
14861 | 15182 | RENDERPROGRAM += 1; |
---|
14862 | 15183 | RENDERPROGRAM %= 3; |
---|
| 15184 | + |
---|
14863 | 15185 | repaint(); |
---|
14864 | 15186 | break; |
---|
14865 | 15187 | case 'Z': |
---|
14866 | 15188 | //RESIZETEXTURE ^= true; |
---|
14867 | 15189 | //break; |
---|
14868 | 15190 | case 'z': |
---|
14869 | | - RENDERSHADOW ^= true; |
---|
| 15191 | + Globals.RENDERSHADOW ^= true; |
---|
14870 | 15192 | Globals.lighttouched = true; |
---|
14871 | 15193 | repaint(); |
---|
14872 | 15194 | break; |
---|
.. | .. |
---|
14899 | 15221 | case DELETE: |
---|
14900 | 15222 | ClearSelection(); |
---|
14901 | 15223 | break; |
---|
14902 | | - /* |
---|
14903 | 15224 | case '+': |
---|
| 15225 | + |
---|
| 15226 | + /* |
---|
14904 | 15227 | //fontsize += 1; |
---|
14905 | 15228 | bbzoom *= 2; |
---|
14906 | 15229 | repaint(); |
---|
.. | .. |
---|
14917 | 15240 | case '=': |
---|
14918 | 15241 | IncDepth(); |
---|
14919 | 15242 | //fontsize += 1; |
---|
14920 | | - object.editWindow.refreshContents(true); |
---|
| 15243 | + object.GetWindow().refreshContents(true); |
---|
14921 | 15244 | maskbit = 6; |
---|
14922 | 15245 | break; |
---|
14923 | 15246 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
14924 | 15247 | DecDepth(); |
---|
14925 | 15248 | maskbit = 5; |
---|
14926 | 15249 | //if(fontsize > 1) fontsize -= 1; |
---|
14927 | | - if (object.editWindow == null) |
---|
14928 | | - new Exception().printStackTrace(); |
---|
14929 | | - else |
---|
14930 | | - object.editWindow.refreshContents(true); |
---|
| 15250 | +// if (object.editWindow == null) |
---|
| 15251 | +// new Exception().printStackTrace(); |
---|
| 15252 | +// else |
---|
| 15253 | + object.GetWindow().refreshContents(true); |
---|
14931 | 15254 | break; |
---|
14932 | 15255 | case '{': |
---|
14933 | 15256 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15151 | 15474 | } |
---|
15152 | 15475 | */ |
---|
15153 | 15476 | |
---|
15154 | | - object.editWindow.EditSelection(); |
---|
| 15477 | + object.GetWindow().EditSelection(false); |
---|
15155 | 15478 | } |
---|
15156 | 15479 | |
---|
15157 | 15480 | void SelectParent() |
---|
.. | .. |
---|
15168 | 15491 | { |
---|
15169 | 15492 | //selectees.remove(i); |
---|
15170 | 15493 | System.out.println("select parent of " + elem); |
---|
15171 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15494 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15172 | 15495 | } else |
---|
15173 | 15496 | { |
---|
15174 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15497 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15175 | 15498 | } |
---|
15176 | 15499 | |
---|
15177 | 15500 | first = false; |
---|
.. | .. |
---|
15213 | 15536 | for (int j = 0; j < group.children.size(); j++) |
---|
15214 | 15537 | { |
---|
15215 | 15538 | elem = (Object3D) group.children.elementAt(j); |
---|
15216 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15539 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15217 | 15540 | first = false; |
---|
15218 | 15541 | } |
---|
15219 | 15542 | } else |
---|
15220 | 15543 | { |
---|
15221 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15544 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15222 | 15545 | } |
---|
15223 | 15546 | |
---|
15224 | 15547 | first = false; |
---|
.. | .. |
---|
15229 | 15552 | { |
---|
15230 | 15553 | //Composite group = (Composite) object; |
---|
15231 | 15554 | Object3D group = object; |
---|
15232 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15555 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15233 | 15556 | } |
---|
15234 | 15557 | |
---|
15235 | 15558 | void ResetTransform(int mask) |
---|
15236 | 15559 | { |
---|
15237 | 15560 | //Composite group = (Composite) object; |
---|
15238 | 15561 | Object3D group = object; |
---|
15239 | | - group.editWindow.ResetTransform(mask); |
---|
| 15562 | + group.GetWindow().ResetTransform(mask); |
---|
15240 | 15563 | } |
---|
15241 | 15564 | |
---|
15242 | 15565 | void FlipTransform() |
---|
15243 | 15566 | { |
---|
15244 | 15567 | //Composite group = (Composite) object; |
---|
15245 | 15568 | Object3D group = object; |
---|
15246 | | - group.editWindow.FlipTransform(); |
---|
| 15569 | + group.GetWindow().FlipTransform(); |
---|
15247 | 15570 | // group.editWindow.ReduceMesh(true); |
---|
15248 | 15571 | } |
---|
15249 | 15572 | |
---|
.. | .. |
---|
15251 | 15574 | { |
---|
15252 | 15575 | //Composite group = (Composite) object; |
---|
15253 | 15576 | Object3D group = object; |
---|
15254 | | - group.editWindow.PrintMemory(); |
---|
| 15577 | + group.GetWindow().PrintMemory(); |
---|
15255 | 15578 | // group.editWindow.ReduceMesh(true); |
---|
15256 | 15579 | } |
---|
15257 | 15580 | |
---|
.. | .. |
---|
15259 | 15582 | { |
---|
15260 | 15583 | //Composite group = (Composite) object; |
---|
15261 | 15584 | Object3D group = object; |
---|
15262 | | - group.editWindow.ResetCentroid(); |
---|
| 15585 | + group.GetWindow().ResetCentroid(); |
---|
15263 | 15586 | } |
---|
15264 | 15587 | |
---|
15265 | 15588 | void IncDepth() |
---|
.. | .. |
---|
15345 | 15668 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15346 | 15669 | //Image img = CreateImage(width, height); |
---|
15347 | 15670 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15671 | + |
---|
15348 | 15672 | Graphics gr = g; // img.getGraphics(); |
---|
| 15673 | + |
---|
15349 | 15674 | if (!hasMarquee) |
---|
15350 | 15675 | { |
---|
15351 | 15676 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15433 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15434 | 15759 | } |
---|
15435 | 15760 | } |
---|
| 15761 | + |
---|
15436 | 15762 | info.g = gr; |
---|
15437 | 15763 | info.camera = renderCamera; |
---|
15438 | 15764 | /* |
---|
.. | .. |
---|
15442 | 15768 | */ |
---|
15443 | 15769 | if (!isRenderer) |
---|
15444 | 15770 | { |
---|
15445 | | - object.drawEditHandles(info, 0); |
---|
| 15771 | + Grafreed.Assert(object != null); |
---|
| 15772 | + Grafreed.Assert(object.selection != null); |
---|
| 15773 | + if (object.selection.Size() > 0) |
---|
| 15774 | + { |
---|
| 15775 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15776 | + |
---|
| 15777 | + info.DX = 0; |
---|
| 15778 | + info.DY = 0; |
---|
| 15779 | + info.W = 1; |
---|
| 15780 | + if (hitSomething == Object3D.hitCenter) |
---|
| 15781 | + { |
---|
| 15782 | + info.DX = X; |
---|
| 15783 | + if (X != 0) |
---|
| 15784 | + info.DX -= info.bounds.width/2; |
---|
| 15785 | + |
---|
| 15786 | + info.DY = Y; |
---|
| 15787 | + if (Y != 0) |
---|
| 15788 | + info.DY -= info.bounds.height/2; |
---|
| 15789 | + } |
---|
| 15790 | + |
---|
| 15791 | + object.drawEditHandles(info, 0); |
---|
| 15792 | + |
---|
| 15793 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15794 | + { |
---|
| 15795 | + switch (hitSomething) |
---|
| 15796 | + { |
---|
| 15797 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15798 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15799 | + break; |
---|
| 15800 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15801 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15802 | + break; |
---|
| 15803 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15804 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15805 | + break; |
---|
| 15806 | + } |
---|
| 15807 | + |
---|
| 15808 | + } |
---|
| 15809 | + } |
---|
15446 | 15810 | } |
---|
15447 | 15811 | } |
---|
| 15812 | + |
---|
15448 | 15813 | if (isRenderer) |
---|
15449 | 15814 | { |
---|
15450 | 15815 | //gr.setColor(Color.black); |
---|
15451 | 15816 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15452 | 15817 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15453 | 15818 | } |
---|
| 15819 | + |
---|
15454 | 15820 | if (hasMarquee) |
---|
15455 | 15821 | { |
---|
15456 | 15822 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15857 | 16223 | Object3D object; |
---|
15858 | 16224 | static Object3D trackedobject; |
---|
15859 | 16225 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15860 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16226 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15861 | 16227 | /*static*/ Camera eyeCamera; |
---|
15862 | 16228 | /*static*/ Camera lightCamera; |
---|
15863 | 16229 | int cameracount; |
---|
.. | .. |
---|
16142 | 16508 | cStatic.objectstack[materialdepth++] = checker; |
---|
16143 | 16509 | //System.out.println("material " + material); |
---|
16144 | 16510 | //Applet3D.tracein(this, selected); |
---|
16145 | | - vector2buffer = checker.projectedVertices; |
---|
| 16511 | + //vector2buffer = checker.projectedVertices; |
---|
16146 | 16512 | |
---|
16147 | 16513 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16148 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16514 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16149 | 16515 | |
---|
16150 | 16516 | materialdepth -= 1; |
---|
16151 | 16517 | if (materialdepth > 0) |
---|
16152 | 16518 | { |
---|
16153 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16154 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16519 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16520 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16155 | 16521 | } |
---|
16156 | 16522 | //checker.GetMaterial().opacity = 1f; |
---|
16157 | 16523 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16237 | 16603 | } |
---|
16238 | 16604 | } |
---|
16239 | 16605 | |
---|
| 16606 | + private Object3D GetFolder() |
---|
| 16607 | + { |
---|
| 16608 | + Object3D folder = object.GetWindow().copy; |
---|
| 16609 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16610 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16611 | + return folder; |
---|
| 16612 | + } |
---|
| 16613 | + |
---|
16240 | 16614 | class SelectBuffer implements GLEventListener |
---|
16241 | 16615 | { |
---|
16242 | 16616 | |
---|
.. | .. |
---|
16316 | 16690 | |
---|
16317 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16318 | 16692 | |
---|
| 16693 | + if (PAINTMODE) |
---|
| 16694 | + { |
---|
| 16695 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16696 | + { |
---|
| 16697 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16698 | + |
---|
| 16699 | + // Make what you paint not selectable. |
---|
| 16700 | + paintobj.ResetSelectable(); |
---|
| 16701 | + } |
---|
| 16702 | + } |
---|
| 16703 | + |
---|
16319 | 16704 | //int tmp = selection_view; |
---|
16320 | 16705 | //selection_view = -1; |
---|
16321 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16327 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16328 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16329 | 16714 | |
---|
| 16715 | + if (PAINTMODE) |
---|
| 16716 | + { |
---|
| 16717 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16718 | + { |
---|
| 16719 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16720 | + |
---|
| 16721 | + // Revert. |
---|
| 16722 | + paintobj.RestoreSelectable(); |
---|
| 16723 | + } |
---|
| 16724 | + } |
---|
| 16725 | + |
---|
16330 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16331 | 16727 | |
---|
16332 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16374 | 16770 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16375 | 16771 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16376 | 16772 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16773 | + |
---|
| 16774 | + CreateSelectedPoint(); |
---|
16377 | 16775 | |
---|
16378 | 16776 | // Will fit the mesh !!! |
---|
16379 | 16777 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16423 | 16821 | 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])); |
---|
16424 | 16822 | } |
---|
16425 | 16823 | |
---|
16426 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16824 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16427 | 16825 | } |
---|
16428 | 16826 | } |
---|
16429 | 16827 | |
---|
16430 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16431 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16829 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16432 | 16830 | |
---|
16433 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16831 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16434 | 16832 | { |
---|
16435 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16833 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16436 | 16834 | |
---|
16437 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16835 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16438 | 16838 | |
---|
16439 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16440 | | - |
---|
16441 | | - group.add(paintobj); // link |
---|
16442 | | - |
---|
16443 | | - object.editWindow.SnapObject(group); |
---|
16444 | | - |
---|
16445 | | - Object3D folder = object.editWindow.copy; |
---|
16446 | | - |
---|
16447 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16448 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16449 | | - |
---|
16450 | | - folder.add(group); |
---|
16451 | | - |
---|
16452 | | - object.editWindow.ResetModel(); |
---|
16453 | | - object.editWindow.refreshContents(); |
---|
| 16839 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16840 | + |
---|
| 16841 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16842 | + |
---|
| 16843 | + inst.add(paintobj); // link |
---|
| 16844 | + |
---|
| 16845 | + object.GetWindow().SnapObject(inst); |
---|
| 16846 | + |
---|
| 16847 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16848 | + |
---|
| 16849 | + folder.add(inst); |
---|
| 16850 | + |
---|
| 16851 | + object.GetWindow().ResetModel(); |
---|
| 16852 | + object.GetWindow().refreshContents(); |
---|
| 16853 | + } |
---|
16454 | 16854 | } |
---|
16455 | 16855 | else |
---|
16456 | 16856 | paintcount = 0; |
---|
.. | .. |
---|
16489 | 16889 | //System.out.println("objects[color] = " + objects[color]); |
---|
16490 | 16890 | //objects[color].Select(); |
---|
16491 | 16891 | indexcount = 0; |
---|
| 16892 | + ObjEditor window = object.GetWindow(); |
---|
| 16893 | + if (window != null && deselect) |
---|
| 16894 | + { |
---|
| 16895 | + window.Select(null, deselect, true); |
---|
| 16896 | + } |
---|
16492 | 16897 | object.Select(color, deselect); |
---|
16493 | 16898 | } |
---|
16494 | 16899 | |
---|
.. | .. |
---|
16588 | 16993 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16589 | 16994 | } |
---|
16590 | 16995 | |
---|
16591 | | - if (!RENDERSHADOW) |
---|
| 16996 | + if (!Globals.RENDERSHADOW) |
---|
16592 | 16997 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16593 | 16998 | |
---|
16594 | 16999 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16598 | 17003 | //gl.glColorMask(false, false, false, false); |
---|
16599 | 17004 | |
---|
16600 | 17005 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16601 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 17006 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16602 | 17007 | { |
---|
16603 | 17008 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16604 | 17009 | |
---|
.. | .. |
---|
17014 | 17419 | int AAbuffersize = 0; |
---|
17015 | 17420 | |
---|
17016 | 17421 | //double[] selectedpoint = new double[3]; |
---|
17017 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17422 | + static Superellipsoid selectedpoint; |
---|
17018 | 17423 | static Sphere previousselectedpoint = null; |
---|
17019 | | - static Sphere debugpointG = new Sphere(); |
---|
17020 | | - static Sphere debugpointP = new Sphere(); |
---|
17021 | | - static Sphere debugpointC = new Sphere(); |
---|
17022 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17424 | + static Sphere debugpointG; |
---|
| 17425 | + static Sphere debugpointP; |
---|
| 17426 | + static Sphere debugpointC; |
---|
| 17427 | + static Sphere debugpointR; |
---|
17023 | 17428 | |
---|
17024 | 17429 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17025 | 17430 | |
---|
17026 | | - static |
---|
17027 | | - { |
---|
17028 | | - for (int i=0; i<8; i++) |
---|
17029 | | - { |
---|
17030 | | - debugpoints[i] = new Sphere(); |
---|
17031 | | - } |
---|
17032 | | - } |
---|
17033 | | - |
---|
17034 | 17431 | static void InitPoints(float radius) |
---|
17035 | 17432 | { |
---|
17036 | 17433 | for (int i=0; i<8; i++) |
---|