.. | .. |
---|
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 |
---|
.. | .. |
---|
56 | 55 | static int CURRENTANTIALIAS = 0; // 1; |
---|
57 | 56 | /*static*/ boolean RENDERSHADOW = true; |
---|
58 | 57 | /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal |
---|
59 | | - static boolean ANIMATION = false; |
---|
60 | | - static String filename; |
---|
61 | 58 | |
---|
62 | 59 | boolean DISPLAYTEXT = false; |
---|
63 | 60 | //boolean REDUCETEXTURE = true; |
---|
.. | .. |
---|
86 | 83 | static boolean FULLSCREEN = false; |
---|
87 | 84 | static boolean SUPPORT = true; |
---|
88 | 85 | static boolean INERTIA = true; |
---|
89 | | -static boolean FAST = true; // false; |
---|
| 86 | +static boolean FAST = false; |
---|
90 | 87 | static boolean SLOWPOSE = false; |
---|
91 | 88 | static boolean FOOTCONTACT = true; |
---|
92 | 89 | |
---|
.. | .. |
---|
108 | 105 | static boolean OEIL = true; |
---|
109 | 106 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
110 | 107 | static boolean LOOKAT = true; |
---|
111 | | -static boolean RANDOM = true; // false; |
---|
| 108 | +static boolean SWITCH = true; // false; |
---|
112 | 109 | static boolean HANDLES = false; // selection doesn't work!! |
---|
113 | 110 | static boolean PAINTMODE = false; |
---|
114 | 111 | |
---|
.. | .. |
---|
151 | 148 | defaultcaps.setAccumBlueBits(16); |
---|
152 | 149 | defaultcaps.setAccumAlphaBits(16); |
---|
153 | 150 | } |
---|
| 151 | + |
---|
| 152 | + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
154 | 153 | |
---|
155 | 154 | void SetAsGLRenderer(boolean b) |
---|
156 | 155 | { |
---|
.. | .. |
---|
327 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
328 | 327 | //System.out.println("material " + material); |
---|
329 | 328 | //Applet3D.tracein(this, selected); |
---|
330 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
331 | 330 | if (obj instanceof Camera) |
---|
332 | 331 | { |
---|
333 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
336 | 335 | display.options1[2] = material.shadowbias; |
---|
337 | 336 | display.options1[3] = material.aniso; |
---|
338 | 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]); |
---|
339 | 343 | display.options2[0] = material.opacity; |
---|
340 | 344 | display.options2[1] = material.diffuse; |
---|
341 | 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]); |
---|
342 | 349 | |
---|
343 | 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]); |
---|
344 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
345 | 355 | display.options4[1] = material.subsurface; |
---|
346 | 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]); |
---|
347 | 360 | |
---|
348 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
349 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
359 | 372 | /**/ |
---|
360 | 373 | } else |
---|
361 | 374 | { |
---|
362 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
363 | 376 | } |
---|
364 | 377 | } else |
---|
365 | 378 | { |
---|
.. | .. |
---|
383 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
384 | 397 | //System.out.println("material " + material); |
---|
385 | 398 | //Applet3D.tracein("selected ", selected); |
---|
386 | | - display.vector2buffer = obj.projectedVertices; |
---|
387 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
388 | 401 | } |
---|
389 | 402 | } |
---|
390 | 403 | |
---|
.. | .. |
---|
401 | 414 | materialdepth -= 1; |
---|
402 | 415 | if (materialdepth > 0) |
---|
403 | 416 | { |
---|
404 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
405 | | - 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); |
---|
406 | 419 | } |
---|
407 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
408 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
422 | 435 | materialdepth -= 1; |
---|
423 | 436 | if (materialdepth > 0) |
---|
424 | 437 | { |
---|
425 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
426 | | - 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); |
---|
427 | 440 | } |
---|
428 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
429 | 442 | //else |
---|
.. | .. |
---|
464 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 478 | { |
---|
466 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - 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 | + ; |
---|
468 | 483 | if (!hasnorm) |
---|
469 | 484 | { |
---|
470 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
471 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
472 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
473 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1192 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1193 | 1208 | } |
---|
1194 | 1209 | } |
---|
| 1210 | + |
---|
1195 | 1211 | if (flipV) |
---|
1196 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1197 | 1213 | else |
---|
1198 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1199 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1200 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1201 | 1218 | |
---|
.. | .. |
---|
1215 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1216 | 1233 | } |
---|
1217 | 1234 | } |
---|
| 1235 | + |
---|
1218 | 1236 | if (flipV) |
---|
1219 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1220 | 1238 | else |
---|
1221 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1222 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1223 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1224 | 1243 | |
---|
.. | .. |
---|
1246 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1247 | 1266 | else |
---|
1248 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1249 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1250 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1251 | 1272 | count2 += 2; |
---|
1252 | 1273 | count3 += 3; |
---|
1253 | 1274 | } |
---|
.. | .. |
---|
1603 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1604 | 1625 | } |
---|
1605 | 1626 | |
---|
1606 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1607 | 1628 | { |
---|
1608 | 1629 | CameraPane display = this; |
---|
1609 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1630 | 1651 | |
---|
1631 | 1652 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1632 | 1653 | |
---|
1633 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1654 | + float[] colorV = Grafreed.colorV; |
---|
1634 | 1655 | |
---|
1635 | 1656 | /**/ |
---|
1636 | 1657 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1638 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1639 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1640 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1641 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1642 | 1663 | |
---|
1643 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1644 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1746 | 1767 | display.modelParams7[2] = 0; |
---|
1747 | 1768 | display.modelParams7[3] = 0; |
---|
1748 | 1769 | |
---|
1749 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1750 | 1771 | |
---|
1751 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1752 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1753 | 1774 | { |
---|
1754 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
1890 | 1911 | void PushMatrix(double[][] matrix) |
---|
1891 | 1912 | { |
---|
1892 | 1913 | // GrafreeD.tracein(matrix); |
---|
1893 | | - PushMatrix(matrix,1); |
---|
| 1914 | + PushMatrix(matrix, 1); |
---|
1894 | 1915 | } |
---|
1895 | 1916 | |
---|
1896 | 1917 | void PushMatrix() |
---|
.. | .. |
---|
2044 | 2065 | //System.err.println("Oeil on"); |
---|
2045 | 2066 | OEIL = true; |
---|
2046 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2047 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2048 | 2069 | //pingthread.StepToTarget(true); |
---|
2049 | 2070 | } |
---|
2050 | 2071 | |
---|
.. | .. |
---|
2142 | 2163 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2143 | 2164 | |
---|
2144 | 2165 | if (!Globals.isLIVE()) // save sound |
---|
2145 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2166 | + Grafreed.savesound = true; // wav.save(); |
---|
2146 | 2167 | // else |
---|
2147 | 2168 | repaint(); // start loop // may 2013 |
---|
2148 | 2169 | } |
---|
.. | .. |
---|
2259 | 2280 | |
---|
2260 | 2281 | void ToggleDebug() |
---|
2261 | 2282 | { |
---|
2262 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2263 | 2284 | } |
---|
2264 | 2285 | |
---|
2265 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2267 | 2288 | LOOKAT ^= true; |
---|
2268 | 2289 | } |
---|
2269 | 2290 | |
---|
2270 | | - void ToggleRandom() |
---|
| 2291 | + void ToggleSwitch() |
---|
2271 | 2292 | { |
---|
2272 | | - RANDOM ^= true; |
---|
| 2293 | + SWITCH ^= true; |
---|
2273 | 2294 | } |
---|
2274 | 2295 | |
---|
2275 | 2296 | void ToggleHandles() |
---|
.. | .. |
---|
2277 | 2298 | HANDLES ^= true; |
---|
2278 | 2299 | } |
---|
2279 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2280 | 2303 | void TogglePaint() |
---|
2281 | 2304 | { |
---|
2282 | 2305 | PAINTMODE ^= true; |
---|
2283 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2284 | 2312 | } |
---|
2285 | 2313 | |
---|
2286 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2376 | 2404 | { |
---|
2377 | 2405 | return currentGL; |
---|
2378 | 2406 | } |
---|
2379 | | - |
---|
| 2407 | + |
---|
2380 | 2408 | /**/ |
---|
2381 | 2409 | class CacheTexture |
---|
2382 | 2410 | { |
---|
.. | .. |
---|
4208 | 4236 | |
---|
4209 | 4237 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4210 | 4238 | { |
---|
| 4239 | + new Exception().printStackTrace(); |
---|
4211 | 4240 | System.exit(0); |
---|
4212 | 4241 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4213 | 4242 | |
---|
.. | .. |
---|
7901 | 7930 | String pigment = Object3D.GetPigment(tex); |
---|
7902 | 7931 | String bump = Object3D.GetBump(tex); |
---|
7903 | 7932 | |
---|
7904 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7933 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7905 | 7934 | { |
---|
7906 | 7935 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7907 | 7936 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7918 | 7947 | |
---|
7919 | 7948 | ReleaseTexture(bump, true); |
---|
7920 | 7949 | ReleaseTexture(pigment, false); |
---|
| 7950 | + } |
---|
| 7951 | + |
---|
| 7952 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7953 | + { |
---|
| 7954 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7955 | + { |
---|
| 7956 | + return; |
---|
| 7957 | + } |
---|
| 7958 | + |
---|
| 7959 | + if (tex == null) |
---|
| 7960 | + { |
---|
| 7961 | + ReleaseTexture(null, false); |
---|
| 7962 | + return; |
---|
| 7963 | + } |
---|
| 7964 | + |
---|
| 7965 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7966 | + |
---|
| 7967 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7968 | + { |
---|
| 7969 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7970 | + // System.out.println("; bump = " + bump); |
---|
| 7971 | + } |
---|
| 7972 | + |
---|
| 7973 | + if (pigment.equals("")) |
---|
| 7974 | + { |
---|
| 7975 | + pigment = null; |
---|
| 7976 | + } |
---|
| 7977 | + |
---|
| 7978 | + ReleaseTexture(pigment, false); |
---|
| 7979 | + } |
---|
| 7980 | + |
---|
| 7981 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7982 | + { |
---|
| 7983 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7984 | + { |
---|
| 7985 | + return; |
---|
| 7986 | + } |
---|
| 7987 | + |
---|
| 7988 | + if (tex == null) |
---|
| 7989 | + { |
---|
| 7990 | + ReleaseTexture(null, true); |
---|
| 7991 | + return; |
---|
| 7992 | + } |
---|
| 7993 | + |
---|
| 7994 | + String bump = Object3D.GetBump(tex); |
---|
| 7995 | + |
---|
| 7996 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + { |
---|
| 7998 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7999 | + // System.out.println("; bump = " + bump); |
---|
| 8000 | + } |
---|
| 8001 | + |
---|
| 8002 | + if (bump.equals("")) |
---|
| 8003 | + { |
---|
| 8004 | + bump = null; |
---|
| 8005 | + } |
---|
| 8006 | + |
---|
| 8007 | + ReleaseTexture(bump, true); |
---|
7921 | 8008 | } |
---|
7922 | 8009 | |
---|
7923 | 8010 | void ReleaseTexture(String tex, boolean bump) |
---|
.. | .. |
---|
8023 | 8110 | } |
---|
8024 | 8111 | } |
---|
8025 | 8112 | |
---|
8026 | | - /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE |
---|
| 8113 | + /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8027 | 8114 | { |
---|
8028 | 8115 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8029 | 8116 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8044 | 8131 | usedtextures.put(pigment, pigment); |
---|
8045 | 8132 | usedtextures.put(bump, bump); |
---|
8046 | 8133 | |
---|
8047 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8134 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8048 | 8135 | { |
---|
8049 | 8136 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8050 | 8137 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8068 | 8155 | return; // true; |
---|
8069 | 8156 | } |
---|
8070 | 8157 | |
---|
8071 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) |
---|
| 8158 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8159 | + { |
---|
| 8160 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8161 | + ambientOcclusion ) // || !textureon) |
---|
| 8162 | + { |
---|
| 8163 | + return; // false; |
---|
| 8164 | + } |
---|
| 8165 | + |
---|
| 8166 | + if (tex == null) |
---|
| 8167 | + { |
---|
| 8168 | + BindTexture(null,false,resolution); |
---|
| 8169 | + return; |
---|
| 8170 | + } |
---|
| 8171 | + |
---|
| 8172 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8173 | + |
---|
| 8174 | + usedtextures.put(pigment, pigment); |
---|
| 8175 | + |
---|
| 8176 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8177 | + { |
---|
| 8178 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8179 | + // System.out.println("; bump = " + bump); |
---|
| 8180 | + } |
---|
| 8181 | + |
---|
| 8182 | + if (pigment.equals("")) |
---|
| 8183 | + { |
---|
| 8184 | + pigment = null; |
---|
| 8185 | + } |
---|
| 8186 | + |
---|
| 8187 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8188 | + BindTexture(pigment, false, resolution); |
---|
| 8189 | + } |
---|
| 8190 | + |
---|
| 8191 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8192 | + { |
---|
| 8193 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8194 | + ambientOcclusion ) // || !textureon) |
---|
| 8195 | + { |
---|
| 8196 | + return; // false; |
---|
| 8197 | + } |
---|
| 8198 | + |
---|
| 8199 | + if (tex == null) |
---|
| 8200 | + { |
---|
| 8201 | + BindTexture(null,true,resolution); |
---|
| 8202 | + return; |
---|
| 8203 | + } |
---|
| 8204 | + |
---|
| 8205 | + String bump = Object3D.GetBump(tex); |
---|
| 8206 | + |
---|
| 8207 | + usedtextures.put(bump, bump); |
---|
| 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 (bump.equals("")) |
---|
| 8216 | + { |
---|
| 8217 | + bump = null; |
---|
| 8218 | + } |
---|
| 8219 | + |
---|
| 8220 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8221 | + BindTexture(bump, true, resolution); |
---|
| 8222 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8223 | + } |
---|
| 8224 | + |
---|
| 8225 | + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
| 8226 | + |
---|
| 8227 | + private boolean FileExists(String tex) |
---|
| 8228 | + { |
---|
| 8229 | + if (missingTextures.contains(tex)) |
---|
| 8230 | + { |
---|
| 8231 | + return false; |
---|
| 8232 | + } |
---|
| 8233 | + |
---|
| 8234 | + boolean fileExists = new File(tex).exists(); |
---|
| 8235 | + |
---|
| 8236 | + if (!fileExists) |
---|
| 8237 | + { |
---|
| 8238 | + // If file exists, the "new File()" is not executed sgain |
---|
| 8239 | + missingTextures.add(tex); |
---|
| 8240 | + } |
---|
| 8241 | + |
---|
| 8242 | + return fileExists; |
---|
| 8243 | + } |
---|
| 8244 | + |
---|
| 8245 | + CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8072 | 8246 | { |
---|
8073 | 8247 | CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
8074 | 8248 | |
---|
.. | .. |
---|
8076 | 8250 | { |
---|
8077 | 8251 | String texname = tex; |
---|
8078 | 8252 | |
---|
8079 | | - String[] split = tex.split("Textures"); |
---|
8080 | | - if (split.length > 1) |
---|
8081 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8082 | | - else |
---|
8083 | | - if (!texname.startsWith("/")) |
---|
8084 | | - texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8253 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8254 | + |
---|
| 8255 | +// String[] split = tex.split("Textures"); |
---|
| 8256 | +// if (split.length > 1) |
---|
| 8257 | +// texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
| 8258 | +// else |
---|
| 8259 | +// if (!texname.startsWith("/")) |
---|
| 8260 | +// texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8261 | + if (!FileExists(tex)) |
---|
| 8262 | + { |
---|
| 8263 | + texname = fallbackTextureName; |
---|
| 8264 | + } |
---|
8085 | 8265 | |
---|
8086 | 8266 | if (CACHETEXTURE) |
---|
8087 | 8267 | texture = textures.get(texname); // TEXTURE CACHE |
---|
.. | .. |
---|
8150 | 8330 | } |
---|
8151 | 8331 | |
---|
8152 | 8332 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8153 | | - if (!new File(cachename).exists()) |
---|
| 8333 | + if (!FileExists(cachename)) |
---|
8154 | 8334 | cachename = texname; |
---|
8155 | 8335 | else |
---|
8156 | 8336 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8172 | 8352 | } |
---|
8173 | 8353 | |
---|
8174 | 8354 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8175 | | - if (!new File(cachename).exists()) |
---|
| 8355 | + if (!FileExists(cachename)) |
---|
8176 | 8356 | cachename = texname; |
---|
8177 | 8357 | else |
---|
8178 | 8358 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8181 | 8361 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8182 | 8362 | |
---|
8183 | 8363 | |
---|
8184 | | - if (texturedata != null) |
---|
| 8364 | + if (texturedata == null) |
---|
| 8365 | + throw new Exception(); |
---|
| 8366 | + |
---|
8185 | 8367 | texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8186 | 8368 | //texture = GetTexture(tex, bump); |
---|
8187 | 8369 | } |
---|
.. | .. |
---|
8303 | 8485 | return texture; |
---|
8304 | 8486 | } |
---|
8305 | 8487 | |
---|
8306 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) |
---|
| 8488 | + com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8307 | 8489 | { |
---|
8308 | 8490 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8309 | 8491 | |
---|
.. | .. |
---|
8321 | 8503 | return texture!=null?texture.texture:null; |
---|
8322 | 8504 | } |
---|
8323 | 8505 | |
---|
8324 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) |
---|
| 8506 | + public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
8325 | 8507 | { |
---|
8326 | 8508 | CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
8327 | 8509 | |
---|
8328 | 8510 | return texture!=null?texture.texturedata:null; |
---|
8329 | 8511 | } |
---|
8330 | 8512 | |
---|
8331 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8513 | + boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
8332 | 8514 | { |
---|
8333 | 8515 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8334 | 8516 | { |
---|
8335 | 8517 | return false; |
---|
8336 | 8518 | } |
---|
8337 | 8519 | |
---|
8338 | | - boolean newtex = false; |
---|
| 8520 | + //boolean newtex = false; |
---|
8339 | 8521 | |
---|
8340 | 8522 | com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
8341 | 8523 | |
---|
.. | .. |
---|
8367 | 8549 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8368 | 8550 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8369 | 8551 | |
---|
8370 | | - return newtex; |
---|
| 8552 | + return true; // Warning: not used. |
---|
8371 | 8553 | } |
---|
8372 | 8554 | |
---|
8373 | 8555 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9205 | 9387 | jy8[3] = 0.5f; |
---|
9206 | 9388 | } |
---|
9207 | 9389 | |
---|
9208 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9390 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9209 | 9391 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9210 | 9392 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9211 | 9393 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9212 | 9394 | |
---|
| 9395 | + void ResetOptions() |
---|
| 9396 | + { |
---|
| 9397 | + options1[0] = 100; |
---|
| 9398 | + options1[1] = 0.025f; |
---|
| 9399 | + options1[2] = 0.01f; |
---|
| 9400 | + options1[3] = 0; |
---|
| 9401 | + options1[4] = 0; |
---|
| 9402 | + |
---|
| 9403 | + options2[0] = 0; |
---|
| 9404 | + options2[1] = 0.75f; |
---|
| 9405 | + options2[2] = 0; |
---|
| 9406 | + options2[3] = 0; |
---|
| 9407 | + |
---|
| 9408 | + options3[0] = 1; |
---|
| 9409 | + options3[1] = 1; |
---|
| 9410 | + options3[2] = 1; |
---|
| 9411 | + options3[3] = 0; |
---|
| 9412 | + |
---|
| 9413 | + options4[0] = 1; |
---|
| 9414 | + options4[1] = 0; |
---|
| 9415 | + options4[2] = 1; |
---|
| 9416 | + options4[3] = 0; |
---|
| 9417 | + } |
---|
| 9418 | + |
---|
9213 | 9419 | static int imagecount = 0; // movie generation |
---|
9214 | 9420 | |
---|
9215 | 9421 | static int jitter = 0; |
---|
.. | .. |
---|
9305 | 9511 | assert (parentcam != renderCamera); |
---|
9306 | 9512 | |
---|
9307 | 9513 | if (renderCamera != lightCamera) |
---|
9308 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9309 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9514 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9515 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9310 | 9516 | |
---|
9311 | 9517 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9312 | 9518 | |
---|
.. | .. |
---|
9321 | 9527 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9322 | 9528 | |
---|
9323 | 9529 | if (renderCamera != lightCamera) |
---|
9324 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9325 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9530 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9531 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9326 | 9532 | |
---|
9327 | 9533 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9328 | 9534 | |
---|
.. | .. |
---|
9394 | 9600 | //gl.glFlush(); |
---|
9395 | 9601 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9396 | 9602 | |
---|
9397 | | - if (ANIMATION && ABORTED) |
---|
| 9603 | + if (Globals.ANIMATION && ABORTED) |
---|
9398 | 9604 | { |
---|
9399 | 9605 | System.err.println(" ABORTED FRAME"); |
---|
9400 | 9606 | break; |
---|
.. | .. |
---|
9424 | 9630 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9425 | 9631 | |
---|
9426 | 9632 | // save image |
---|
9427 | | - if (ANIMATION && !ABORTED) |
---|
| 9633 | + if (Globals.ANIMATION && !ABORTED) |
---|
9428 | 9634 | { |
---|
9429 | 9635 | VPwidth = viewport[2]; |
---|
9430 | 9636 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9535 | 9741 | |
---|
9536 | 9742 | // imagecount++; |
---|
9537 | 9743 | |
---|
9538 | | - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
| 9744 | + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
9539 | 9745 | |
---|
9540 | 9746 | if (!BOXMODE) |
---|
9541 | 9747 | { |
---|
9542 | | - System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")"); |
---|
| 9748 | + System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")"); |
---|
9543 | 9749 | } |
---|
9544 | 9750 | |
---|
9545 | 9751 | if (!BOXMODE) |
---|
.. | .. |
---|
9577 | 9783 | ABORTED = false; |
---|
9578 | 9784 | } |
---|
9579 | 9785 | else |
---|
9580 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9786 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9581 | 9787 | |
---|
9582 | 9788 | if (false) |
---|
9583 | 9789 | { |
---|
.. | .. |
---|
10240 | 10446 | |
---|
10241 | 10447 | public void display(GLAutoDrawable drawable) |
---|
10242 | 10448 | { |
---|
10243 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10449 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10244 | 10450 | { |
---|
10245 | | - GrafreeD.wav.save(); |
---|
10246 | | - GrafreeD.savesound = false; |
---|
10247 | | - GrafreeD.hassound = false; |
---|
| 10451 | + Grafreed.wav.save(); |
---|
| 10452 | + Grafreed.savesound = false; |
---|
| 10453 | + Grafreed.hassound = false; |
---|
10248 | 10454 | } |
---|
10249 | 10455 | // if (DEBUG_SELECTION) |
---|
10250 | 10456 | // { |
---|
.. | .. |
---|
10320 | 10526 | ANTIALIAS = 0; |
---|
10321 | 10527 | //System.out.println("RESTART"); |
---|
10322 | 10528 | AAtimer.restart(); |
---|
| 10529 | + Globals.TIMERRUNNING = true; |
---|
10323 | 10530 | } |
---|
10324 | 10531 | } |
---|
10325 | 10532 | } |
---|
.. | .. |
---|
10374 | 10581 | Object3D theobject = object; |
---|
10375 | 10582 | Object3D theparent = object.parent; |
---|
10376 | 10583 | object.parent = null; |
---|
10377 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10584 | + object = (Object3D)Grafreed.clone(object); |
---|
10378 | 10585 | object.Stripify(); |
---|
10379 | 10586 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10380 | 10587 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10387 | 10594 | ambientOcclusion = false; |
---|
10388 | 10595 | } |
---|
10389 | 10596 | |
---|
10390 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10597 | + if (//Globals.lighttouched && |
---|
| 10598 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10391 | 10599 | { |
---|
10392 | 10600 | //if (RENDERSHADOW) // ? |
---|
10393 | 10601 | if (!IsFrozen()) |
---|
10394 | 10602 | { |
---|
10395 | 10603 | // dec 2012 |
---|
10396 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10604 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10397 | 10605 | { |
---|
10398 | 10606 | Globals.framecount++; |
---|
10399 | 10607 | shadowbuffer.display(); |
---|
.. | .. |
---|
10520 | 10728 | |
---|
10521 | 10729 | // if (parentcam != renderCamera) // not a light |
---|
10522 | 10730 | if (cam != lightCamera) |
---|
10523 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10524 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10731 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10732 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10525 | 10733 | |
---|
10526 | 10734 | for (int j = 0; j < 4; j++) |
---|
10527 | 10735 | { |
---|
.. | .. |
---|
10535 | 10743 | |
---|
10536 | 10744 | // if (parentcam != renderCamera) // not a light |
---|
10537 | 10745 | if (cam != lightCamera) |
---|
10538 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10539 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10746 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10747 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10540 | 10748 | |
---|
10541 | 10749 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10542 | 10750 | |
---|
.. | .. |
---|
10795 | 11003 | // Bump noise |
---|
10796 | 11004 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10797 | 11005 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10798 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11006 | + |
---|
| 11007 | + try |
---|
| 11008 | + { |
---|
| 11009 | + BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11010 | + } |
---|
| 11011 | + catch (Exception e) |
---|
| 11012 | + { |
---|
| 11013 | + System.err.println("FAILED: " + NOISE_TEXTURE); |
---|
| 11014 | + } |
---|
| 11015 | + |
---|
10799 | 11016 | |
---|
10800 | 11017 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10801 | 11018 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10818 | 11035 | |
---|
10819 | 11036 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10820 | 11037 | |
---|
10821 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10822 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10823 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11038 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11039 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11040 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
10824 | 11041 | } else |
---|
10825 | 11042 | { |
---|
10826 | 11043 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10831 | 11048 | //System.out.println("BLENDING ON"); |
---|
10832 | 11049 | gl.glEnable(GL.GL_BLEND); |
---|
10833 | 11050 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10834 | | - |
---|
| 11051 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10835 | 11052 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10836 | 11053 | gl.glLoadIdentity(); |
---|
10837 | 11054 | |
---|
.. | .. |
---|
10920 | 11137 | System.err.println("parentcam != renderCamera"); |
---|
10921 | 11138 | |
---|
10922 | 11139 | // if (cam != lightCamera) |
---|
10923 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10924 | | - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 2013 |
---|
| 11140 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11141 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10925 | 11142 | } |
---|
10926 | 11143 | |
---|
10927 | 11144 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10942 | 11159 | if (true) // TODO |
---|
10943 | 11160 | { |
---|
10944 | 11161 | if (cam != lightCamera) |
---|
10945 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10946 | | - LA.xformDir(light0, parentcam.toParent, light0); // may 2013 |
---|
| 11162 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 11163 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10947 | 11164 | } |
---|
10948 | 11165 | |
---|
10949 | 11166 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11259 | 11476 | { |
---|
11260 | 11477 | renderpass++; |
---|
11261 | 11478 | // System.out.println("Draw object... "); |
---|
| 11479 | + STEP = 1; |
---|
11262 | 11480 | if (FAST) // in case there is no script |
---|
11263 | | - STEP = 16; |
---|
| 11481 | + STEP = 8; |
---|
| 11482 | + |
---|
| 11483 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11484 | + { |
---|
| 11485 | + STEP *= 4; |
---|
| 11486 | + } |
---|
11264 | 11487 | |
---|
11265 | 11488 | //object.FullInvariants(); |
---|
11266 | 11489 | |
---|
.. | .. |
---|
11274 | 11497 | e.printStackTrace(); |
---|
11275 | 11498 | } |
---|
11276 | 11499 | |
---|
11277 | | - if (GrafreeD.RENDERME > 0) |
---|
11278 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11500 | + if (Grafreed.RENDERME > 0) |
---|
| 11501 | + Grafreed.RENDERME--; // mechante magouille |
---|
11279 | 11502 | |
---|
11280 | 11503 | Globals.ONESTEP = false; |
---|
11281 | 11504 | } |
---|
11282 | 11505 | |
---|
11283 | 11506 | static boolean zoomonce = false; |
---|
11284 | 11507 | |
---|
| 11508 | + static void CreateSelectedPoint() |
---|
| 11509 | + { |
---|
| 11510 | + if (selectedpoint == null) |
---|
| 11511 | + { |
---|
| 11512 | + debugpointG = new Sphere(); |
---|
| 11513 | + debugpointP = new Sphere(); |
---|
| 11514 | + debugpointC = new Sphere(); |
---|
| 11515 | + debugpointR = new Sphere(); |
---|
| 11516 | + |
---|
| 11517 | + selectedpoint = new Superellipsoid(); |
---|
| 11518 | + |
---|
| 11519 | + for (int i=0; i<8; i++) |
---|
| 11520 | + { |
---|
| 11521 | + debugpoints[i] = new Sphere(); |
---|
| 11522 | + } |
---|
| 11523 | + } |
---|
| 11524 | + } |
---|
| 11525 | + |
---|
11285 | 11526 | void DrawObject(GL gl, boolean draw) |
---|
11286 | 11527 | { |
---|
| 11528 | + // To clear camera values |
---|
| 11529 | + ResetOptions(); |
---|
| 11530 | + |
---|
11287 | 11531 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11288 | 11532 | // DrawMode() = SELECTION; |
---|
11289 | 11533 | //GL gl = getGL(); |
---|
11290 | 11534 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11291 | 11535 | { |
---|
11292 | 11536 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11293 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11537 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11294 | 11538 | pingthread.StepToTarget(true); // true); |
---|
11295 | 11539 | // zoomonce = false; |
---|
11296 | 11540 | } |
---|
.. | .. |
---|
11345 | 11589 | |
---|
11346 | 11590 | usedtextures.clear(); |
---|
11347 | 11591 | |
---|
11348 | | - BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11592 | + try |
---|
| 11593 | + { |
---|
| 11594 | + BindTextures(DEFAULT_TEXTURES, 2); |
---|
| 11595 | + } |
---|
| 11596 | + catch (Exception e) |
---|
| 11597 | + { |
---|
| 11598 | + System.err.println("FAILED: " + DEFAULT_TEXTURES); |
---|
| 11599 | + } |
---|
11349 | 11600 | } |
---|
11350 | 11601 | //System.out.println("--> " + stackdepth); |
---|
11351 | 11602 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11355 | 11606 | |
---|
11356 | 11607 | if (DrawMode() == DEFAULT) |
---|
11357 | 11608 | { |
---|
11358 | | - if (DEBUG) |
---|
| 11609 | + if (Globals.DEBUG) |
---|
11359 | 11610 | { |
---|
| 11611 | + CreateSelectedPoint(); |
---|
11360 | 11612 | float radius = 0.05f; |
---|
11361 | 11613 | if (selectedpoint.radius != radius) |
---|
11362 | 11614 | { |
---|
.. | .. |
---|
11436 | 11688 | if (checker != null && DrawMode() == DEFAULT) |
---|
11437 | 11689 | { |
---|
11438 | 11690 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11439 | | - BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11691 | + try |
---|
| 11692 | + { |
---|
| 11693 | + BindTextures(checker.GetTextures(), checker.texres); |
---|
| 11694 | + } |
---|
| 11695 | + catch (Exception e) |
---|
| 11696 | + { |
---|
| 11697 | + System.err.println("FAILED: " + checker.GetTextures()); |
---|
| 11698 | + } |
---|
11440 | 11699 | // NEAREST |
---|
11441 | 11700 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11442 | 11701 | DrawChecker(gl); |
---|
.. | .. |
---|
11518 | 11777 | return; |
---|
11519 | 11778 | } |
---|
11520 | 11779 | |
---|
11521 | | - String string = obj.GetToolTip(); |
---|
| 11780 | + String string = obj.toString(); //.GetToolTip(); |
---|
11522 | 11781 | |
---|
11523 | 11782 | GL gl = GetGL(); |
---|
11524 | 11783 | |
---|
.. | .. |
---|
11835 | 12094 | //obj.TransformToWorld(light, light); |
---|
11836 | 12095 | for (int i = tp.size(); --i >= 0;) |
---|
11837 | 12096 | { |
---|
11838 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11839 | | - LA.xformPos(light, tp.get(i).toParent, light); |
---|
| 12097 | + //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
| 12098 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
11840 | 12099 | } |
---|
11841 | 12100 | |
---|
11842 | 12101 | |
---|
.. | .. |
---|
11853 | 12112 | parentcam = cameras[0]; |
---|
11854 | 12113 | } |
---|
11855 | 12114 | |
---|
11856 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11857 | | - LA.xformPos(light, parentcam.toParent, light); // may 2013 |
---|
| 12115 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 12116 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11858 | 12117 | |
---|
11859 | 12118 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11860 | 12119 | |
---|
.. | .. |
---|
12468 | 12727 | |
---|
12469 | 12728 | // display shadow only (bump == 0) |
---|
12470 | 12729 | "SUB temp.x, half.x, shadow.x;" + |
---|
12471 | | - "MOV temp.y, -params6.x;" + |
---|
12472 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12730 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12731 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12473 | 12732 | "SUB temp.y, one.x, temp.z;" + |
---|
12474 | 12733 | "MUL temp.x, temp.x, temp.y;" + |
---|
12475 | 12734 | "KIL temp.x;" + |
---|
.. | .. |
---|
12598 | 12857 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12599 | 12858 | |
---|
12600 | 12859 | "SUB temp.x, one.x, ndotl.x;" + |
---|
12601 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
12602 | | - "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 12860 | + // Tuning for default skin |
---|
| 12861 | + //"ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 12862 | + "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen |
---|
| 12863 | + "ADD temp.y, one.y, options2.y;" + // subsurface |
---|
12603 | 12864 | "MUL temp.x, temp.x, temp.y;" + |
---|
12604 | 12865 | |
---|
12605 | 12866 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12798 | 13059 | //once = true; |
---|
12799 | 13060 | } |
---|
12800 | 13061 | |
---|
12801 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 13062 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12802 | 13063 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12803 | 13064 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12804 | 13065 | |
---|
.. | .. |
---|
12931 | 13192 | |
---|
12932 | 13193 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12933 | 13194 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13195 | + |
---|
| 13196 | + // Compare fragment depth in light space with shadowmap. |
---|
12934 | 13197 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12935 | 13198 | "SGE temp.y, temp.x, zero.x;" + |
---|
12936 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13199 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13200 | + |
---|
| 13201 | + // Reverse comparison |
---|
12937 | 13202 | "SUB temp.x, one.x, temp.x;" + |
---|
12938 | 13203 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12939 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13204 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12940 | 13205 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12941 | 13206 | |
---|
12942 | 13207 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12950 | 13215 | // No shadow for backface |
---|
12951 | 13216 | "DP3 temp.x, normal, lightd;" + |
---|
12952 | 13217 | "SLT temp.x, temp.x, zero.x;" + // shadoweps |
---|
| 13218 | + "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
| 13219 | + |
---|
| 13220 | + // No shadow when out of frustrum |
---|
| 13221 | + "SGE temp.x, " + depth + ".z, one.z;" + |
---|
12953 | 13222 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12954 | 13223 | ""; |
---|
12955 | 13224 | } |
---|
.. | .. |
---|
13096 | 13365 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13097 | 13366 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13098 | 13367 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13099 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13368 | + |
---|
| 13369 | + //Object3D.cVector2[] vector2buffer; |
---|
13100 | 13370 | |
---|
13101 | 13371 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13102 | 13372 | // OUT : diff, spec |
---|
.. | .. |
---|
13112 | 13382 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13113 | 13383 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13114 | 13384 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13115 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13116 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13117 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13385 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13386 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13387 | + |
---|
| 13388 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13118 | 13389 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13119 | 13390 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13120 | 13391 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13508 | 13779 | public void mousePressed(MouseEvent e) |
---|
13509 | 13780 | { |
---|
13510 | 13781 | //System.out.println("mousePressed: " + e); |
---|
13511 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13782 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13512 | 13783 | } |
---|
13513 | 13784 | |
---|
13514 | 13785 | static long prevtime = 0; |
---|
.. | .. |
---|
13584 | 13855 | // mode |= META; |
---|
13585 | 13856 | //} |
---|
13586 | 13857 | |
---|
13587 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13588 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13858 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13859 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13589 | 13860 | anchorX = ax; |
---|
13590 | 13861 | anchorY = ay; |
---|
13591 | 13862 | prevX = px; |
---|
.. | .. |
---|
13619 | 13890 | else |
---|
13620 | 13891 | if (evt.getSource() == AAtimer) |
---|
13621 | 13892 | { |
---|
| 13893 | + Globals.TIMERRUNNING = false; |
---|
13622 | 13894 | if (mouseDown) |
---|
13623 | 13895 | { |
---|
13624 | 13896 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13644 | 13916 | // LIVE = waslive; |
---|
13645 | 13917 | // wasliveok = true; |
---|
13646 | 13918 | // waslive = false; |
---|
| 13919 | + |
---|
| 13920 | + // May 2019 Forget it: |
---|
| 13921 | + if (true) |
---|
| 13922 | + return; |
---|
13647 | 13923 | |
---|
13648 | 13924 | // source == timer |
---|
13649 | 13925 | if (mouseDown) |
---|
.. | .. |
---|
13674 | 13950 | |
---|
13675 | 13951 | // fev 2014??? |
---|
13676 | 13952 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13677 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13953 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13678 | 13954 | pingthread.StepToTarget(true); // true); |
---|
13679 | 13955 | } |
---|
13680 | 13956 | // if (!LIVE) |
---|
.. | .. |
---|
13683 | 13959 | |
---|
13684 | 13960 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13685 | 13961 | |
---|
13686 | | - void clickStart(int x, int y, int modifiers) |
---|
| 13962 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13687 | 13963 | { |
---|
13688 | 13964 | if (!wasliveok) |
---|
13689 | 13965 | return; |
---|
13690 | 13966 | |
---|
13691 | 13967 | AAtimer.restart(); // |
---|
| 13968 | + Globals.TIMERRUNNING = true; |
---|
13692 | 13969 | |
---|
13693 | 13970 | // waslive = LIVE; |
---|
13694 | 13971 | // LIVE = false; |
---|
.. | .. |
---|
13700 | 13977 | // touched = true; // main DL |
---|
13701 | 13978 | if (isRenderer) |
---|
13702 | 13979 | { |
---|
13703 | | - SetMouseMode(modifiers); |
---|
| 13980 | + SetMouseMode(modifiers, modifiersex); |
---|
13704 | 13981 | } |
---|
13705 | 13982 | |
---|
13706 | 13983 | selectX = anchorX = x; |
---|
.. | .. |
---|
13713 | 13990 | clicked = true; |
---|
13714 | 13991 | hold = false; |
---|
13715 | 13992 | |
---|
13716 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 13993 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13717 | 13994 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13718 | 13995 | { |
---|
13719 | 13996 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13744 | 14021 | info.camera = renderCamera; |
---|
13745 | 14022 | info.x = x; |
---|
13746 | 14023 | info.y = y; |
---|
13747 | | - info.modifiers = modifiers; |
---|
| 14024 | + info.modifiers = modifiersex; |
---|
13748 | 14025 | editObj = object.doEditClick(info, 0); |
---|
13749 | 14026 | if (!editObj) |
---|
13750 | 14027 | { |
---|
.. | .. |
---|
13761 | 14038 | |
---|
13762 | 14039 | public void mouseDragged(MouseEvent e) |
---|
13763 | 14040 | { |
---|
| 14041 | + Globals.MOUSEDRAGGED = true; |
---|
| 14042 | + |
---|
13764 | 14043 | //System.out.println("mouseDragged: " + e); |
---|
13765 | 14044 | if (isRenderer) |
---|
13766 | 14045 | movingcamera = true; |
---|
| 14046 | + |
---|
13767 | 14047 | //if (drawing) |
---|
13768 | 14048 | //return; |
---|
13769 | 14049 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
.. | .. |
---|
13773 | 14053 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13774 | 14054 | } |
---|
13775 | 14055 | else |
---|
13776 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 14056 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13777 | 14057 | |
---|
13778 | 14058 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13779 | 14059 | } |
---|
.. | .. |
---|
13946 | 14226 | |
---|
13947 | 14227 | public void run() |
---|
13948 | 14228 | { |
---|
| 14229 | + new Exception().printStackTrace(); |
---|
13949 | 14230 | System.exit(0); |
---|
13950 | 14231 | for (;;) |
---|
13951 | 14232 | { |
---|
.. | .. |
---|
14009 | 14290 | { |
---|
14010 | 14291 | Globals.lighttouched = true; |
---|
14011 | 14292 | } |
---|
14012 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14293 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14013 | 14294 | } |
---|
14014 | 14295 | //else |
---|
14015 | 14296 | } |
---|
.. | .. |
---|
14023 | 14304 | void GoDown(int mod) |
---|
14024 | 14305 | { |
---|
14025 | 14306 | MODIFIERS |= COMMAND; |
---|
14026 | | - /* |
---|
| 14307 | + /**/ |
---|
14027 | 14308 | if((mod&SHIFT) == SHIFT) |
---|
14028 | 14309 | manipCamera.RotatePosition(0, -speed); |
---|
14029 | 14310 | else |
---|
14030 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14031 | | - */ |
---|
| 14311 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14312 | + /**/ |
---|
14032 | 14313 | if ((mod & SHIFT) == SHIFT) |
---|
14033 | 14314 | { |
---|
14034 | 14315 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14044 | 14325 | void GoUp(int mod) |
---|
14045 | 14326 | { |
---|
14046 | 14327 | MODIFIERS |= COMMAND; |
---|
14047 | | - /* |
---|
| 14328 | + /**/ |
---|
14048 | 14329 | if((mod&SHIFT) == SHIFT) |
---|
14049 | 14330 | manipCamera.RotatePosition(0, speed); |
---|
14050 | 14331 | else |
---|
14051 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14052 | | - */ |
---|
| 14332 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14333 | + /**/ |
---|
14053 | 14334 | if ((mod & SHIFT) == SHIFT) |
---|
14054 | 14335 | { |
---|
14055 | 14336 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14065 | 14346 | void GoLeft(int mod) |
---|
14066 | 14347 | { |
---|
14067 | 14348 | MODIFIERS |= COMMAND; |
---|
14068 | | - /* |
---|
| 14349 | + /**/ |
---|
14069 | 14350 | if((mod&SHIFT) == SHIFT) |
---|
14070 | | - manipCamera.RotatePosition(speed, 0); |
---|
14071 | | - else |
---|
14072 | 14351 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14073 | | - */ |
---|
| 14352 | + else |
---|
| 14353 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14354 | + /**/ |
---|
14074 | 14355 | if ((mod & SHIFT) == SHIFT) |
---|
14075 | 14356 | { |
---|
14076 | 14357 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14086 | 14367 | void GoRight(int mod) |
---|
14087 | 14368 | { |
---|
14088 | 14369 | MODIFIERS |= COMMAND; |
---|
14089 | | - /* |
---|
| 14370 | + /**/ |
---|
14090 | 14371 | if((mod&SHIFT) == SHIFT) |
---|
14091 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14092 | | - else |
---|
14093 | 14372 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14094 | | - */ |
---|
| 14373 | + else |
---|
| 14374 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14375 | + /**/ |
---|
14095 | 14376 | if ((mod & SHIFT) == SHIFT) |
---|
14096 | 14377 | { |
---|
14097 | 14378 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14109 | 14390 | int X, Y; |
---|
14110 | 14391 | boolean SX, SY; |
---|
14111 | 14392 | |
---|
14112 | | - void drag(int x, int y, int modifiers) |
---|
| 14393 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14113 | 14394 | { |
---|
14114 | 14395 | if (IsFrozen()) |
---|
14115 | 14396 | { |
---|
.. | .. |
---|
14118 | 14399 | |
---|
14119 | 14400 | drag = true; // NEW |
---|
14120 | 14401 | |
---|
14121 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14402 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14122 | 14403 | |
---|
14123 | 14404 | X = x; |
---|
14124 | 14405 | Y = y; |
---|
14125 | 14406 | // floating state for animation |
---|
14126 | | - MODIFIERS = modifiers; |
---|
14127 | | - modifiers &= ~1024; |
---|
| 14407 | + MODIFIERS = modifiersex; |
---|
| 14408 | + modifiersex &= ~1024; |
---|
14128 | 14409 | if (false) // modifiers != 0) |
---|
14129 | 14410 | { |
---|
14130 | 14411 | //new Exception().printStackTrace(); |
---|
14131 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14412 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14132 | 14413 | System.out.println("SHIFT = " + SHIFT); |
---|
14133 | 14414 | System.out.println("CONTROL = " + COMMAND); |
---|
14134 | 14415 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14148 | 14429 | info.camera = renderCamera; |
---|
14149 | 14430 | info.x = x; |
---|
14150 | 14431 | info.y = y; |
---|
14151 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14432 | + object.GetWindow().copy |
---|
| 14433 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14152 | 14434 | } else |
---|
14153 | 14435 | { |
---|
14154 | 14436 | if (x < startX) |
---|
.. | .. |
---|
14312 | 14594 | ci.camera = renderCamera; |
---|
14313 | 14595 | if (!isRenderer) |
---|
14314 | 14596 | { |
---|
14315 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14597 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14598 | + //Object3D copy = editWindow.copy; |
---|
| 14599 | + if (object.doEditClick(ci, 0)) |
---|
14316 | 14600 | { |
---|
14317 | 14601 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14318 | 14602 | } else |
---|
.. | .. |
---|
14324 | 14608 | |
---|
14325 | 14609 | public void mouseReleased(MouseEvent e) |
---|
14326 | 14610 | { |
---|
| 14611 | + Globals.MOUSEDRAGGED = false; |
---|
| 14612 | + |
---|
14327 | 14613 | movingcamera = false; |
---|
| 14614 | + X = 0; // getBounds().width/2; |
---|
| 14615 | + Y = 0; // getBounds().height/2; |
---|
14328 | 14616 | //System.out.println("mouseReleased: " + e); |
---|
14329 | 14617 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14330 | 14618 | } |
---|
.. | .. |
---|
14347 | 14635 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14348 | 14636 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14349 | 14637 | |
---|
14350 | | - if (control || command || IsFrozen()) |
---|
| 14638 | +// No delay if (control || command || IsFrozen()) |
---|
14351 | 14639 | timeout = true; |
---|
14352 | | - else |
---|
| 14640 | +// ?? May 2019 else |
---|
14353 | 14641 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14354 | 14642 | mouseDown = false; |
---|
14355 | 14643 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14459 | 14747 | System.out.println("keyReleased: " + e); |
---|
14460 | 14748 | } |
---|
14461 | 14749 | |
---|
14462 | | - void SetMouseMode(int modifiers) |
---|
| 14750 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14463 | 14751 | { |
---|
14464 | 14752 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14465 | 14753 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14471 | 14759 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14472 | 14760 | // return; |
---|
14473 | 14761 | //System.out.println("SetMode = " + modifiers); |
---|
14474 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14762 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14475 | 14763 | { |
---|
14476 | 14764 | mouseMode |= ZOOM; |
---|
14477 | 14765 | } |
---|
14478 | 14766 | |
---|
14479 | 14767 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14480 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14768 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14481 | 14769 | { |
---|
14482 | 14770 | mouseMode |= VR; // BACKFORTH; |
---|
14483 | 14771 | } |
---|
14484 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14772 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14485 | 14773 | { |
---|
14486 | 14774 | mouseMode |= SELECT; |
---|
14487 | 14775 | } |
---|
14488 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14776 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14489 | 14777 | { |
---|
14490 | 14778 | mouseMode |= SELECT; |
---|
14491 | 14779 | } |
---|
14492 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14780 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14493 | 14781 | { |
---|
14494 | 14782 | mouseMode &= ~VR; |
---|
14495 | 14783 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14518 | 14806 | |
---|
14519 | 14807 | if (isRenderer) // |
---|
14520 | 14808 | { |
---|
14521 | | - SetMouseMode(modifiers); |
---|
| 14809 | + SetMouseMode(0, modifiers); |
---|
14522 | 14810 | } |
---|
14523 | 14811 | |
---|
14524 | 14812 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14665 | 14953 | case 'E' : COMPACT ^= true; |
---|
14666 | 14954 | repaint(); |
---|
14667 | 14955 | break; |
---|
14668 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14956 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14957 | + //DEBUGHSB ^= true; |
---|
| 14958 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14669 | 14959 | repaint(); |
---|
14670 | 14960 | break; |
---|
14671 | 14961 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14690 | 14980 | RevertCamera(); |
---|
14691 | 14981 | repaint(); |
---|
14692 | 14982 | break; |
---|
14693 | | - case 'L': |
---|
14694 | 14983 | case 'l': |
---|
| 14984 | + //case 'L': |
---|
14695 | 14985 | if (lightMode) |
---|
14696 | 14986 | { |
---|
14697 | 14987 | lightMode = false; |
---|
.. | .. |
---|
14834 | 15124 | case '_': |
---|
14835 | 15125 | kompactbit = 5; |
---|
14836 | 15126 | break; |
---|
14837 | | - case '+': |
---|
14838 | | - kompactbit = 6; |
---|
14839 | | - break; |
---|
| 15127 | +// case '+': |
---|
| 15128 | +// kompactbit = 6; |
---|
| 15129 | +// break; |
---|
14840 | 15130 | case ' ': |
---|
14841 | 15131 | lightMode ^= true; |
---|
14842 | 15132 | Globals.lighttouched = true; |
---|
.. | .. |
---|
14848 | 15138 | case ESC: |
---|
14849 | 15139 | RENDERPROGRAM += 1; |
---|
14850 | 15140 | RENDERPROGRAM %= 3; |
---|
| 15141 | + |
---|
14851 | 15142 | repaint(); |
---|
14852 | 15143 | break; |
---|
14853 | 15144 | case 'Z': |
---|
14854 | 15145 | //RESIZETEXTURE ^= true; |
---|
14855 | 15146 | //break; |
---|
14856 | 15147 | case 'z': |
---|
14857 | | - RENDERSHADOW ^= true; |
---|
| 15148 | + Globals.RENDERSHADOW ^= true; |
---|
14858 | 15149 | Globals.lighttouched = true; |
---|
14859 | 15150 | repaint(); |
---|
14860 | 15151 | break; |
---|
.. | .. |
---|
14887 | 15178 | case DELETE: |
---|
14888 | 15179 | ClearSelection(); |
---|
14889 | 15180 | break; |
---|
14890 | | - /* |
---|
14891 | 15181 | case '+': |
---|
| 15182 | + |
---|
| 15183 | + /* |
---|
14892 | 15184 | //fontsize += 1; |
---|
14893 | 15185 | bbzoom *= 2; |
---|
14894 | 15186 | repaint(); |
---|
.. | .. |
---|
14905 | 15197 | case '=': |
---|
14906 | 15198 | IncDepth(); |
---|
14907 | 15199 | //fontsize += 1; |
---|
14908 | | - object.editWindow.refreshContents(true); |
---|
| 15200 | + object.GetWindow().refreshContents(true); |
---|
14909 | 15201 | maskbit = 6; |
---|
14910 | 15202 | break; |
---|
14911 | 15203 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
14912 | 15204 | DecDepth(); |
---|
14913 | 15205 | maskbit = 5; |
---|
14914 | 15206 | //if(fontsize > 1) fontsize -= 1; |
---|
14915 | | - if (object.editWindow == null) |
---|
14916 | | - new Exception().printStackTrace(); |
---|
14917 | | - else |
---|
14918 | | - object.editWindow.refreshContents(true); |
---|
| 15207 | +// if (object.editWindow == null) |
---|
| 15208 | +// new Exception().printStackTrace(); |
---|
| 15209 | +// else |
---|
| 15210 | + object.GetWindow().refreshContents(true); |
---|
14919 | 15211 | break; |
---|
14920 | 15212 | case '{': |
---|
14921 | 15213 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
14978 | 15270 | //mode = ROTATE; |
---|
14979 | 15271 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14980 | 15272 | { |
---|
14981 | | - SetMouseMode(modifiers); |
---|
| 15273 | + SetMouseMode(0, modifiers); |
---|
14982 | 15274 | } |
---|
14983 | 15275 | } |
---|
14984 | 15276 | |
---|
.. | .. |
---|
15114 | 15406 | { |
---|
15115 | 15407 | //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
15116 | 15408 | //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
15117 | | - if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
| 15409 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15118 | 15410 | { |
---|
15119 | 15411 | mouseMoved(e); |
---|
15120 | 15412 | } else |
---|
.. | .. |
---|
15139 | 15431 | } |
---|
15140 | 15432 | */ |
---|
15141 | 15433 | |
---|
15142 | | - object.editWindow.EditSelection(); |
---|
| 15434 | + object.GetWindow().EditSelection(false); |
---|
15143 | 15435 | } |
---|
15144 | 15436 | |
---|
15145 | 15437 | void SelectParent() |
---|
15146 | 15438 | { |
---|
| 15439 | + new Exception().printStackTrace(); |
---|
15147 | 15440 | System.exit(0); |
---|
15148 | 15441 | Composite group = (Composite) object; |
---|
15149 | 15442 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15155 | 15448 | { |
---|
15156 | 15449 | //selectees.remove(i); |
---|
15157 | 15450 | System.out.println("select parent of " + elem); |
---|
15158 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15451 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15159 | 15452 | } else |
---|
15160 | 15453 | { |
---|
15161 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15454 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15162 | 15455 | } |
---|
15163 | 15456 | |
---|
15164 | 15457 | first = false; |
---|
.. | .. |
---|
15167 | 15460 | |
---|
15168 | 15461 | void SelectChildren() |
---|
15169 | 15462 | { |
---|
| 15463 | + new Exception().printStackTrace(); |
---|
15170 | 15464 | System.exit(0); |
---|
15171 | 15465 | /* |
---|
15172 | 15466 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15199 | 15493 | for (int j = 0; j < group.children.size(); j++) |
---|
15200 | 15494 | { |
---|
15201 | 15495 | elem = (Object3D) group.children.elementAt(j); |
---|
15202 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15496 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15203 | 15497 | first = false; |
---|
15204 | 15498 | } |
---|
15205 | 15499 | } else |
---|
15206 | 15500 | { |
---|
15207 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15501 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15208 | 15502 | } |
---|
15209 | 15503 | |
---|
15210 | 15504 | first = false; |
---|
.. | .. |
---|
15215 | 15509 | { |
---|
15216 | 15510 | //Composite group = (Composite) object; |
---|
15217 | 15511 | Object3D group = object; |
---|
15218 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15512 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15219 | 15513 | } |
---|
15220 | 15514 | |
---|
15221 | 15515 | void ResetTransform(int mask) |
---|
15222 | 15516 | { |
---|
15223 | 15517 | //Composite group = (Composite) object; |
---|
15224 | 15518 | Object3D group = object; |
---|
15225 | | - group.editWindow.ResetTransform(mask); |
---|
| 15519 | + group.GetWindow().ResetTransform(mask); |
---|
15226 | 15520 | } |
---|
15227 | 15521 | |
---|
15228 | 15522 | void FlipTransform() |
---|
15229 | 15523 | { |
---|
15230 | 15524 | //Composite group = (Composite) object; |
---|
15231 | 15525 | Object3D group = object; |
---|
15232 | | - group.editWindow.FlipTransform(); |
---|
| 15526 | + group.GetWindow().FlipTransform(); |
---|
15233 | 15527 | // group.editWindow.ReduceMesh(true); |
---|
15234 | 15528 | } |
---|
15235 | 15529 | |
---|
.. | .. |
---|
15237 | 15531 | { |
---|
15238 | 15532 | //Composite group = (Composite) object; |
---|
15239 | 15533 | Object3D group = object; |
---|
15240 | | - group.editWindow.PrintMemory(); |
---|
| 15534 | + group.GetWindow().PrintMemory(); |
---|
15241 | 15535 | // group.editWindow.ReduceMesh(true); |
---|
15242 | 15536 | } |
---|
15243 | 15537 | |
---|
.. | .. |
---|
15245 | 15539 | { |
---|
15246 | 15540 | //Composite group = (Composite) object; |
---|
15247 | 15541 | Object3D group = object; |
---|
15248 | | - group.editWindow.ResetCentroid(); |
---|
| 15542 | + group.GetWindow().ResetCentroid(); |
---|
15249 | 15543 | } |
---|
15250 | 15544 | |
---|
15251 | 15545 | void IncDepth() |
---|
.. | .. |
---|
15331 | 15625 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15332 | 15626 | //Image img = CreateImage(width, height); |
---|
15333 | 15627 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15628 | + |
---|
15334 | 15629 | Graphics gr = g; // img.getGraphics(); |
---|
| 15630 | + |
---|
15335 | 15631 | if (!hasMarquee) |
---|
15336 | 15632 | { |
---|
15337 | 15633 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15419 | 15715 | info.bounds.y += (height - desired) / 2; |
---|
15420 | 15716 | } |
---|
15421 | 15717 | } |
---|
| 15718 | + |
---|
15422 | 15719 | info.g = gr; |
---|
15423 | 15720 | info.camera = renderCamera; |
---|
15424 | 15721 | /* |
---|
.. | .. |
---|
15428 | 15725 | */ |
---|
15429 | 15726 | if (!isRenderer) |
---|
15430 | 15727 | { |
---|
15431 | | - object.drawEditHandles(info, 0); |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
| 15730 | + if (object.selection.Size() > 0) |
---|
| 15731 | + { |
---|
| 15732 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15733 | + |
---|
| 15734 | + info.DX = 0; |
---|
| 15735 | + info.DY = 0; |
---|
| 15736 | + info.W = 1; |
---|
| 15737 | + if (hitSomething == Object3D.hitCenter) |
---|
| 15738 | + { |
---|
| 15739 | + info.DX = X; |
---|
| 15740 | + if (X != 0) |
---|
| 15741 | + info.DX -= info.bounds.width/2; |
---|
| 15742 | + |
---|
| 15743 | + info.DY = Y; |
---|
| 15744 | + if (Y != 0) |
---|
| 15745 | + info.DY -= info.bounds.height/2; |
---|
| 15746 | + } |
---|
| 15747 | + |
---|
| 15748 | + object.drawEditHandles(info, 0); |
---|
| 15749 | + |
---|
| 15750 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15751 | + { |
---|
| 15752 | + switch (hitSomething) |
---|
| 15753 | + { |
---|
| 15754 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15755 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15756 | + break; |
---|
| 15757 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15758 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15759 | + break; |
---|
| 15760 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15761 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15762 | + break; |
---|
| 15763 | + } |
---|
| 15764 | + |
---|
| 15765 | + } |
---|
| 15766 | + } |
---|
15432 | 15767 | } |
---|
15433 | 15768 | } |
---|
| 15769 | + |
---|
15434 | 15770 | if (isRenderer) |
---|
15435 | 15771 | { |
---|
15436 | 15772 | //gr.setColor(Color.black); |
---|
15437 | 15773 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15438 | 15774 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15439 | 15775 | } |
---|
| 15776 | + |
---|
15440 | 15777 | if (hasMarquee) |
---|
15441 | 15778 | { |
---|
15442 | 15779 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15549 | 15886 | public boolean mouseDown(Event evt, int x, int y) |
---|
15550 | 15887 | { |
---|
15551 | 15888 | System.out.println("mouseDown: " + evt); |
---|
| 15889 | + System.exit(0); |
---|
15552 | 15890 | /* |
---|
15553 | 15891 | locked = true; |
---|
15554 | 15892 | drag = false; |
---|
.. | .. |
---|
15592 | 15930 | { |
---|
15593 | 15931 | keyPressed(0, modifiers); |
---|
15594 | 15932 | } |
---|
15595 | | - clickStart(x, y, modifiers); |
---|
| 15933 | + // clickStart(x, y, modifiers); |
---|
15596 | 15934 | return true; |
---|
15597 | 15935 | } |
---|
15598 | 15936 | |
---|
.. | .. |
---|
15710 | 16048 | { |
---|
15711 | 16049 | keyReleased(0, 0); |
---|
15712 | 16050 | } |
---|
15713 | | - drag(x, y, modifiers); |
---|
| 16051 | + drag(x, y, 0, modifiers); |
---|
15714 | 16052 | return true; |
---|
15715 | 16053 | } |
---|
15716 | 16054 | |
---|
.. | .. |
---|
15842 | 16180 | Object3D object; |
---|
15843 | 16181 | static Object3D trackedobject; |
---|
15844 | 16182 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15845 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16183 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15846 | 16184 | /*static*/ Camera eyeCamera; |
---|
15847 | 16185 | /*static*/ Camera lightCamera; |
---|
15848 | 16186 | int cameracount; |
---|
.. | .. |
---|
16127 | 16465 | cStatic.objectstack[materialdepth++] = checker; |
---|
16128 | 16466 | //System.out.println("material " + material); |
---|
16129 | 16467 | //Applet3D.tracein(this, selected); |
---|
16130 | | - vector2buffer = checker.projectedVertices; |
---|
| 16468 | + //vector2buffer = checker.projectedVertices; |
---|
16131 | 16469 | |
---|
16132 | 16470 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16133 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16471 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16134 | 16472 | |
---|
16135 | 16473 | materialdepth -= 1; |
---|
16136 | 16474 | if (materialdepth > 0) |
---|
16137 | 16475 | { |
---|
16138 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16139 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16476 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16477 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16140 | 16478 | } |
---|
16141 | 16479 | //checker.GetMaterial().opacity = 1f; |
---|
16142 | 16480 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16222 | 16560 | } |
---|
16223 | 16561 | } |
---|
16224 | 16562 | |
---|
| 16563 | + private Object3D GetFolder() |
---|
| 16564 | + { |
---|
| 16565 | + Object3D folder = object.GetWindow().copy; |
---|
| 16566 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16567 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16568 | + return folder; |
---|
| 16569 | + } |
---|
| 16570 | + |
---|
16225 | 16571 | class SelectBuffer implements GLEventListener |
---|
16226 | 16572 | { |
---|
16227 | 16573 | |
---|
.. | .. |
---|
16280 | 16626 | { |
---|
16281 | 16627 | if (!selection) |
---|
16282 | 16628 | { |
---|
| 16629 | + new Exception().printStackTrace(); |
---|
16283 | 16630 | System.exit(0); |
---|
16284 | 16631 | return; |
---|
16285 | 16632 | } |
---|
.. | .. |
---|
16300 | 16647 | |
---|
16301 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16302 | 16649 | |
---|
| 16650 | + if (PAINTMODE) |
---|
| 16651 | + { |
---|
| 16652 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16653 | + { |
---|
| 16654 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16655 | + |
---|
| 16656 | + // Make what you paint not selectable. |
---|
| 16657 | + paintobj.ResetSelectable(); |
---|
| 16658 | + } |
---|
| 16659 | + } |
---|
| 16660 | + |
---|
16303 | 16661 | //int tmp = selection_view; |
---|
16304 | 16662 | //selection_view = -1; |
---|
16305 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16311 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16312 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16313 | 16671 | |
---|
| 16672 | + if (PAINTMODE) |
---|
| 16673 | + { |
---|
| 16674 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16675 | + { |
---|
| 16676 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16677 | + |
---|
| 16678 | + // Revert. |
---|
| 16679 | + paintobj.RestoreSelectable(); |
---|
| 16680 | + } |
---|
| 16681 | + } |
---|
| 16682 | + |
---|
16314 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16315 | 16684 | |
---|
16316 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16358 | 16727 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16359 | 16728 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16360 | 16729 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16730 | + |
---|
| 16731 | + CreateSelectedPoint(); |
---|
16361 | 16732 | |
---|
16362 | 16733 | // Will fit the mesh !!! |
---|
16363 | 16734 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16407 | 16778 | System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2])); |
---|
16408 | 16779 | } |
---|
16409 | 16780 | |
---|
16410 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16781 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16411 | 16782 | } |
---|
16412 | 16783 | } |
---|
16413 | 16784 | |
---|
16414 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16415 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16786 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16416 | 16787 | |
---|
16417 | | - if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16788 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16418 | 16789 | { |
---|
16419 | | - Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16420 | 16791 | |
---|
16421 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16792 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16422 | 16795 | |
---|
16423 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16424 | | - |
---|
16425 | | - group.add(paintobj); // link |
---|
16426 | | - |
---|
16427 | | - object.editWindow.SnapObject(group); |
---|
16428 | | - |
---|
16429 | | - Object3D folder = object.editWindow.copy; |
---|
16430 | | - |
---|
16431 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16432 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16433 | | - |
---|
16434 | | - folder.add(group); |
---|
16435 | | - |
---|
16436 | | - object.editWindow.ResetModel(); |
---|
16437 | | - object.editWindow.refreshContents(); |
---|
| 16796 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16797 | + |
---|
| 16798 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16799 | + |
---|
| 16800 | + inst.add(paintobj); // link |
---|
| 16801 | + |
---|
| 16802 | + object.GetWindow().SnapObject(inst); |
---|
| 16803 | + |
---|
| 16804 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16805 | + |
---|
| 16806 | + folder.add(inst); |
---|
| 16807 | + |
---|
| 16808 | + object.GetWindow().ResetModel(); |
---|
| 16809 | + object.GetWindow().refreshContents(); |
---|
| 16810 | + } |
---|
16438 | 16811 | } |
---|
16439 | 16812 | else |
---|
16440 | 16813 | paintcount = 0; |
---|
.. | .. |
---|
16473 | 16846 | //System.out.println("objects[color] = " + objects[color]); |
---|
16474 | 16847 | //objects[color].Select(); |
---|
16475 | 16848 | indexcount = 0; |
---|
| 16849 | + ObjEditor window = object.GetWindow(); |
---|
| 16850 | + if (window != null && deselect) |
---|
| 16851 | + { |
---|
| 16852 | + window.Select(null, deselect, true); |
---|
| 16853 | + } |
---|
16476 | 16854 | object.Select(color, deselect); |
---|
16477 | 16855 | } |
---|
16478 | 16856 | |
---|
.. | .. |
---|
16572 | 16950 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16573 | 16951 | } |
---|
16574 | 16952 | |
---|
16575 | | - if (!RENDERSHADOW) |
---|
| 16953 | + if (!Globals.RENDERSHADOW) |
---|
16576 | 16954 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16577 | 16955 | |
---|
16578 | 16956 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16582 | 16960 | //gl.glColorMask(false, false, false, false); |
---|
16583 | 16961 | |
---|
16584 | 16962 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16585 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 16963 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16586 | 16964 | { |
---|
16587 | 16965 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16588 | 16966 | |
---|
.. | .. |
---|
16998 | 17376 | int AAbuffersize = 0; |
---|
16999 | 17377 | |
---|
17000 | 17378 | //double[] selectedpoint = new double[3]; |
---|
17001 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17379 | + static Superellipsoid selectedpoint; |
---|
17002 | 17380 | static Sphere previousselectedpoint = null; |
---|
17003 | | - static Sphere debugpointG = new Sphere(); |
---|
17004 | | - static Sphere debugpointP = new Sphere(); |
---|
17005 | | - static Sphere debugpointC = new Sphere(); |
---|
17006 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17381 | + static Sphere debugpointG; |
---|
| 17382 | + static Sphere debugpointP; |
---|
| 17383 | + static Sphere debugpointC; |
---|
| 17384 | + static Sphere debugpointR; |
---|
17007 | 17385 | |
---|
17008 | 17386 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17009 | 17387 | |
---|
17010 | | - static |
---|
17011 | | - { |
---|
17012 | | - for (int i=0; i<8; i++) |
---|
17013 | | - { |
---|
17014 | | - debugpoints[i] = new Sphere(); |
---|
17015 | | - } |
---|
17016 | | - } |
---|
17017 | | - |
---|
17018 | 17388 | static void InitPoints(float radius) |
---|
17019 | 17389 | { |
---|
17020 | 17390 | for (int i=0; i<8; i++) |
---|