.. | .. |
---|
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; |
---|
64 | 61 | boolean CACHETEXTURE = true; |
---|
65 | 62 | boolean CLEANCACHE = false; // true; |
---|
66 | | - boolean MIPMAP = false; // true; |
---|
| 63 | + boolean MIPMAP = true; // false; // true; |
---|
67 | 64 | boolean COMPRESSTEXTURE = false; |
---|
68 | 65 | boolean KOMPACTTEXTURE = false; // true; |
---|
69 | 66 | boolean RESIZETEXTURE = false; |
---|
.. | .. |
---|
92 | 89 | |
---|
93 | 90 | static int tickcount = 0; // slow pose issue |
---|
94 | 91 | |
---|
| 92 | +static boolean BUTTONLESSWHEEL = false; |
---|
| 93 | +static boolean ZOOMBOXMODE = false; |
---|
95 | 94 | static boolean BOXMODE = false; |
---|
96 | 95 | static boolean IMAGEFLIP = false; |
---|
97 | 96 | static boolean SMOOTHFOCUS = false; |
---|
.. | .. |
---|
106 | 105 | static boolean OEIL = true; |
---|
107 | 106 | static boolean OEILONCE = false; // do oeilon then oeiloff |
---|
108 | 107 | static boolean LOOKAT = true; |
---|
109 | | -static boolean RANDOM = true; // false; |
---|
| 108 | +static boolean SWITCH = true; // false; |
---|
110 | 109 | static boolean HANDLES = false; // selection doesn't work!! |
---|
111 | 110 | static boolean PAINTMODE = false; |
---|
112 | 111 | |
---|
.. | .. |
---|
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 | { |
---|
.. | .. |
---|
223 | 224 | public boolean IsBoxMode() |
---|
224 | 225 | { |
---|
225 | 226 | return BOXMODE; |
---|
| 227 | + } |
---|
| 228 | + |
---|
| 229 | + public boolean IsZoomBoxMode() |
---|
| 230 | + { |
---|
| 231 | + return ZOOMBOXMODE; |
---|
226 | 232 | } |
---|
227 | 233 | |
---|
228 | 234 | public void ClearDepth() |
---|
.. | .. |
---|
320 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
321 | 327 | //System.out.println("material " + material); |
---|
322 | 328 | //Applet3D.tracein(this, selected); |
---|
323 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
324 | 330 | if (obj instanceof Camera) |
---|
325 | 331 | { |
---|
326 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
329 | 335 | display.options1[2] = material.shadowbias; |
---|
330 | 336 | display.options1[3] = material.aniso; |
---|
331 | 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]); |
---|
332 | 343 | display.options2[0] = material.opacity; |
---|
333 | 344 | display.options2[1] = material.diffuse; |
---|
334 | 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]); |
---|
335 | 349 | |
---|
336 | 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]); |
---|
337 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
338 | 355 | display.options4[1] = material.subsurface; |
---|
339 | 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]); |
---|
340 | 360 | |
---|
341 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
342 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
352 | 372 | /**/ |
---|
353 | 373 | } else |
---|
354 | 374 | { |
---|
355 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
356 | 376 | } |
---|
357 | 377 | } else |
---|
358 | 378 | { |
---|
.. | .. |
---|
376 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
377 | 397 | //System.out.println("material " + material); |
---|
378 | 398 | //Applet3D.tracein("selected ", selected); |
---|
379 | | - display.vector2buffer = obj.projectedVertices; |
---|
380 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
381 | 401 | } |
---|
382 | 402 | } |
---|
383 | 403 | |
---|
.. | .. |
---|
394 | 414 | materialdepth -= 1; |
---|
395 | 415 | if (materialdepth > 0) |
---|
396 | 416 | { |
---|
397 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
398 | | - 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); |
---|
399 | 419 | } |
---|
400 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
401 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
415 | 435 | materialdepth -= 1; |
---|
416 | 436 | if (materialdepth > 0) |
---|
417 | 437 | { |
---|
418 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
419 | | - 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); |
---|
420 | 440 | } |
---|
421 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
422 | 442 | //else |
---|
.. | .. |
---|
457 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
458 | 478 | { |
---|
459 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
460 | | - 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 | + ; |
---|
461 | 483 | if (!hasnorm) |
---|
462 | 484 | { |
---|
463 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
464 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
465 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
466 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1185 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1186 | 1208 | } |
---|
1187 | 1209 | } |
---|
| 1210 | + |
---|
1188 | 1211 | if (flipV) |
---|
1189 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1190 | 1213 | else |
---|
1191 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1192 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1193 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1194 | 1218 | |
---|
.. | .. |
---|
1208 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1209 | 1233 | } |
---|
1210 | 1234 | } |
---|
| 1235 | + |
---|
1211 | 1236 | if (flipV) |
---|
1212 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1213 | 1238 | else |
---|
1214 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1215 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1216 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1217 | 1243 | |
---|
.. | .. |
---|
1239 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1240 | 1266 | else |
---|
1241 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1242 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1243 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1244 | 1272 | count2 += 2; |
---|
1245 | 1273 | count3 += 3; |
---|
1246 | 1274 | } |
---|
.. | .. |
---|
1596 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1597 | 1625 | } |
---|
1598 | 1626 | |
---|
1599 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1600 | 1628 | { |
---|
1601 | 1629 | CameraPane display = this; |
---|
1602 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1612 | 1640 | //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0); |
---|
1613 | 1641 | if (!material.multiply) |
---|
1614 | 1642 | { |
---|
1615 | | - display.color = color; |
---|
| 1643 | + display.color = material.color; |
---|
1616 | 1644 | display.saturation = material.modulation; |
---|
1617 | 1645 | } |
---|
1618 | 1646 | else |
---|
1619 | 1647 | { |
---|
1620 | | - display.color *= color*2; |
---|
| 1648 | + display.color *= material.color*2; |
---|
1621 | 1649 | display.saturation *= material.modulation*2; |
---|
1622 | 1650 | } |
---|
1623 | 1651 | |
---|
1624 | 1652 | cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0); |
---|
1625 | 1653 | |
---|
1626 | | - float[] colorV = GrafreeD.colorV; |
---|
| 1654 | + float[] colorV = Grafreed.colorV; |
---|
1627 | 1655 | |
---|
1628 | 1656 | /**/ |
---|
1629 | 1657 | if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0) |
---|
.. | .. |
---|
1631 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1632 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1633 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1634 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1635 | 1663 | |
---|
1636 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1637 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1739 | 1767 | display.modelParams7[2] = 0; |
---|
1740 | 1768 | display.modelParams7[3] = 0; |
---|
1741 | 1769 | |
---|
1742 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1743 | 1771 | |
---|
1744 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1745 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1746 | 1774 | { |
---|
1747 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
1883 | 1911 | void PushMatrix(double[][] matrix) |
---|
1884 | 1912 | { |
---|
1885 | 1913 | // GrafreeD.tracein(matrix); |
---|
1886 | | - PushMatrix(matrix,1); |
---|
| 1914 | + PushMatrix(matrix, 1); |
---|
1887 | 1915 | } |
---|
1888 | 1916 | |
---|
1889 | 1917 | void PushMatrix() |
---|
.. | .. |
---|
2037 | 2065 | //System.err.println("Oeil on"); |
---|
2038 | 2066 | OEIL = true; |
---|
2039 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2040 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2041 | 2069 | //pingthread.StepToTarget(true); |
---|
2042 | 2070 | } |
---|
2043 | 2071 | |
---|
.. | .. |
---|
2135 | 2163 | System.err.println("LIVE = " + Globals.isLIVE()); |
---|
2136 | 2164 | |
---|
2137 | 2165 | if (!Globals.isLIVE()) // save sound |
---|
2138 | | - GrafreeD.savesound = true; // wav.save(); |
---|
| 2166 | + Grafreed.savesound = true; // wav.save(); |
---|
2139 | 2167 | // else |
---|
2140 | 2168 | repaint(); // start loop // may 2013 |
---|
2141 | 2169 | } |
---|
.. | .. |
---|
2168 | 2196 | public void ToggleBoxMode() |
---|
2169 | 2197 | { |
---|
2170 | 2198 | BOXMODE ^= true; |
---|
| 2199 | + } |
---|
| 2200 | + |
---|
| 2201 | + public void ToggleZoomBoxMode() |
---|
| 2202 | + { |
---|
| 2203 | + ZOOMBOXMODE ^= true; |
---|
2171 | 2204 | } |
---|
2172 | 2205 | |
---|
2173 | 2206 | public void ToggleSmoothFocus() |
---|
.. | .. |
---|
2247 | 2280 | |
---|
2248 | 2281 | void ToggleDebug() |
---|
2249 | 2282 | { |
---|
2250 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2251 | 2284 | } |
---|
2252 | 2285 | |
---|
2253 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2255 | 2288 | LOOKAT ^= true; |
---|
2256 | 2289 | } |
---|
2257 | 2290 | |
---|
2258 | | - void ToggleRandom() |
---|
| 2291 | + void ToggleSwitch() |
---|
2259 | 2292 | { |
---|
2260 | | - RANDOM ^= true; |
---|
| 2293 | + SWITCH ^= true; |
---|
2261 | 2294 | } |
---|
2262 | 2295 | |
---|
2263 | 2296 | void ToggleHandles() |
---|
.. | .. |
---|
2265 | 2298 | HANDLES ^= true; |
---|
2266 | 2299 | } |
---|
2267 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2268 | 2303 | void TogglePaint() |
---|
2269 | 2304 | { |
---|
2270 | 2305 | PAINTMODE ^= true; |
---|
2271 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2272 | 2312 | } |
---|
2273 | 2313 | |
---|
2274 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2364 | 2404 | { |
---|
2365 | 2405 | return currentGL; |
---|
2366 | 2406 | } |
---|
2367 | | - |
---|
| 2407 | + |
---|
2368 | 2408 | /**/ |
---|
2369 | 2409 | class CacheTexture |
---|
2370 | 2410 | { |
---|
.. | .. |
---|
2382 | 2422 | /**/ |
---|
2383 | 2423 | |
---|
2384 | 2424 | // TEXTURE static Texture texture; |
---|
2385 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2386 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2387 | | - 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 | + |
---|
2388 | 2429 | int pigmentdepth = 0; |
---|
2389 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2390 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2406 | 2447 | true, |
---|
2407 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2408 | 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) |
---|
2409 | 2477 | { |
---|
2410 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2411 | 2479 | } |
---|
.. | .. |
---|
3492 | 3560 | |
---|
3493 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3494 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3495 | 3565 | // |
---|
3496 | 3566 | if (false) // compressbit > 0) |
---|
3497 | 3567 | { |
---|
.. | .. |
---|
4196 | 4266 | |
---|
4197 | 4267 | com.sun.opengl.util.texture.Texture CompressTexture2(String name) |
---|
4198 | 4268 | { |
---|
| 4269 | + new Exception().printStackTrace(); |
---|
4199 | 4270 | System.exit(0); |
---|
4200 | 4271 | com.sun.opengl.util.texture.Texture texture = null; |
---|
4201 | 4272 | |
---|
.. | .. |
---|
7889 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
7890 | 7961 | String bump = Object3D.GetBump(tex); |
---|
7891 | 7962 | |
---|
7892 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7893 | 7964 | { |
---|
7894 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7895 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7906 | 7977 | |
---|
7907 | 7978 | ReleaseTexture(bump, true); |
---|
7908 | 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); |
---|
7909 | 8038 | } |
---|
7910 | 8039 | |
---|
7911 | 8040 | void ReleaseTexture(String tex, boolean bump) |
---|
.. | .. |
---|
8011 | 8140 | } |
---|
8012 | 8141 | } |
---|
8013 | 8142 | |
---|
8014 | | - /*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 |
---|
8015 | 8192 | { |
---|
8016 | 8193 | if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8017 | 8194 | ambientOcclusion ) // || !textureon) |
---|
.. | .. |
---|
8021 | 8198 | |
---|
8022 | 8199 | if (tex == null) |
---|
8023 | 8200 | { |
---|
8024 | | - BindTexture(null,false,resolution); |
---|
8025 | | - BindTexture(null,true,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8026 | 8202 | return; |
---|
8027 | 8203 | } |
---|
8028 | 8204 | |
---|
8029 | 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 | + |
---|
8030 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8031 | 8239 | |
---|
8032 | | - usedtextures.put(pigment, pigment); |
---|
8033 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8034 | 8241 | |
---|
8035 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8036 | 8243 | { |
---|
8037 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8038 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8042 | 8249 | { |
---|
8043 | 8250 | bump = null; |
---|
8044 | 8251 | } |
---|
8045 | | - if (pigment.equals("")) |
---|
8046 | | - { |
---|
8047 | | - pigment = null; |
---|
8048 | | - } |
---|
8049 | 8252 | |
---|
8050 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8051 | | - BindTexture(pigment, false, resolution); |
---|
8052 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8053 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8054 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8055 | | - |
---|
8056 | | - return; // true; |
---|
8057 | 8256 | } |
---|
8058 | 8257 | |
---|
8059 | | - 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) |
---|
8060 | 8261 | { |
---|
8061 | | - 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; |
---|
8062 | 8281 | |
---|
8063 | 8282 | if (tex != null) |
---|
8064 | 8283 | { |
---|
8065 | 8284 | String texname = tex; |
---|
8066 | 8285 | |
---|
8067 | | - String[] split = tex.split("Textures"); |
---|
8068 | | - if (split.length > 1) |
---|
8069 | | - texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
8070 | | - else |
---|
8071 | | - if (!texname.startsWith("/")) |
---|
8072 | | - texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8286 | + String fallbackTextureName = defaultDirectory + "/Textures/" + texname; |
---|
| 8287 | + |
---|
| 8288 | +// String[] split = tex.split("Textures"); |
---|
| 8289 | +// if (split.length > 1) |
---|
| 8290 | +// texname = "/Users/nbriere/Textures" + split[split.length-1]; |
---|
| 8291 | +// else |
---|
| 8292 | +// if (!texname.startsWith("/")) |
---|
| 8293 | +// texname = "/Users/nbriere/Textures/" + texname; |
---|
| 8294 | + if (!FileExists(tex)) |
---|
| 8295 | + { |
---|
| 8296 | + texname = fallbackTextureName; |
---|
| 8297 | + } |
---|
8073 | 8298 | |
---|
8074 | 8299 | if (CACHETEXTURE) |
---|
8075 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8076 | | - |
---|
8077 | | - TextureData texturedata = null; |
---|
8078 | | - |
---|
8079 | | - if (texture == null || texture.resolution < resolution) |
---|
8080 | 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 |
---|
8081 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8082 | 8317 | { |
---|
8083 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8089 | 8324 | // } |
---|
8090 | 8325 | // else |
---|
8091 | 8326 | // { |
---|
8092 | | - texture = textures.get(tex); |
---|
8093 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8094 | 8329 | { |
---|
8095 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8096 | 8331 | } |
---|
8097 | 8332 | // } |
---|
8098 | 8333 | } else |
---|
8099 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8100 | 8335 | { |
---|
8101 | 8336 | assert(bump); |
---|
8102 | | - texture = textures.get(tex); |
---|
8103 | | - if (texture == null) |
---|
8104 | | - 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); |
---|
8105 | 8340 | } else |
---|
8106 | 8341 | { |
---|
8107 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8111 | 8346 | //{ |
---|
8112 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8113 | 8348 | { |
---|
8114 | | - texture = textures.get(tex); |
---|
8115 | | - if (texture == null) |
---|
8116 | | - 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); |
---|
8117 | 8352 | } else |
---|
8118 | 8353 | { |
---|
8119 | 8354 | if (textureon) |
---|
.. | .. |
---|
8138 | 8373 | } |
---|
8139 | 8374 | |
---|
8140 | 8375 | cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; |
---|
8141 | | - if (!new File(cachename).exists()) |
---|
| 8376 | + if (!FileExists(cachename)) |
---|
8142 | 8377 | cachename = texname; |
---|
8143 | 8378 | else |
---|
8144 | 8379 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8160 | 8395 | } |
---|
8161 | 8396 | |
---|
8162 | 8397 | cachename = texname.substring(0, texname.length()-4)+ext+".png"; |
---|
8163 | | - if (!new File(cachename).exists()) |
---|
| 8398 | + if (!FileExists(cachename)) |
---|
8164 | 8399 | cachename = texname; |
---|
8165 | 8400 | else |
---|
8166 | 8401 | processbump = false; // don't process bump map again |
---|
.. | .. |
---|
8169 | 8404 | texturedata = GetFileTexture(cachename, processbump, resolution); |
---|
8170 | 8405 | |
---|
8171 | 8406 | |
---|
8172 | | - if (texturedata != null) |
---|
8173 | | - 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); |
---|
8174 | 8411 | //texture = GetTexture(tex, bump); |
---|
8175 | 8412 | } |
---|
8176 | 8413 | } |
---|
8177 | 8414 | //} |
---|
8178 | 8415 | } |
---|
8179 | 8416 | |
---|
8180 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8181 | 8418 | { |
---|
8182 | 8419 | //return false; |
---|
8183 | 8420 | |
---|
8184 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8185 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8186 | 8423 | { |
---|
8187 | 8424 | // String ext = "_highres"; |
---|
8188 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8271 | 8508 | textures.remove(texname); |
---|
8272 | 8509 | } |
---|
8273 | 8510 | |
---|
8274 | | - texture.texturedata = texturedata; |
---|
8275 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8276 | 8513 | |
---|
8277 | 8514 | // newtex = true; |
---|
8278 | 8515 | } |
---|
.. | .. |
---|
8288 | 8525 | } |
---|
8289 | 8526 | } |
---|
8290 | 8527 | |
---|
8291 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8292 | 8529 | } |
---|
8293 | 8530 | |
---|
8294 | | - 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 |
---|
8295 | 8532 | { |
---|
8296 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8297 | 8534 | |
---|
8298 | 8535 | if (bump) |
---|
8299 | 8536 | { |
---|
.. | .. |
---|
8309 | 8546 | return texture!=null?texture.texture:null; |
---|
8310 | 8547 | } |
---|
8311 | 8548 | |
---|
8312 | | - 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 |
---|
8313 | 8550 | { |
---|
8314 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8315 | 8552 | |
---|
8316 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8317 | 8554 | } |
---|
8318 | 8555 | |
---|
8319 | | - boolean BindTexture(String tex, boolean bump, int resolution) |
---|
| 8556 | + boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8320 | 8557 | { |
---|
8321 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8322 | 8559 | { |
---|
8323 | 8560 | return false; |
---|
8324 | 8561 | } |
---|
8325 | 8562 | |
---|
8326 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8327 | 8564 | |
---|
8328 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8329 | 8566 | |
---|
8330 | 8567 | if (texture == null) |
---|
8331 | 8568 | return false; |
---|
.. | .. |
---|
8355 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8356 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8357 | 8594 | |
---|
8358 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8359 | 8596 | } |
---|
8360 | 8597 | |
---|
8361 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9193 | 9430 | jy8[3] = 0.5f; |
---|
9194 | 9431 | } |
---|
9195 | 9432 | |
---|
9196 | | - 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 |
---|
9197 | 9434 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9198 | 9435 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9199 | 9436 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9200 | 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 | + |
---|
9201 | 9462 | static int imagecount = 0; // movie generation |
---|
9202 | 9463 | |
---|
9203 | 9464 | static int jitter = 0; |
---|
.. | .. |
---|
9293 | 9554 | assert (parentcam != renderCamera); |
---|
9294 | 9555 | |
---|
9295 | 9556 | if (renderCamera != lightCamera) |
---|
9296 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9297 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 9557 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9558 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9298 | 9559 | |
---|
9299 | 9560 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9300 | 9561 | |
---|
.. | .. |
---|
9309 | 9570 | LA.matCopy(renderCamera.fromScreen, matrix); |
---|
9310 | 9571 | |
---|
9311 | 9572 | if (renderCamera != lightCamera) |
---|
9312 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9313 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 9573 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 9574 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9314 | 9575 | |
---|
9315 | 9576 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9316 | 9577 | |
---|
.. | .. |
---|
9382 | 9643 | //gl.glFlush(); |
---|
9383 | 9644 | gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE); |
---|
9384 | 9645 | |
---|
9385 | | - if (ANIMATION && ABORTED) |
---|
| 9646 | + if (Globals.ANIMATION && ABORTED) |
---|
9386 | 9647 | { |
---|
9387 | 9648 | System.err.println(" ABORTED FRAME"); |
---|
9388 | 9649 | break; |
---|
.. | .. |
---|
9412 | 9673 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
---|
9413 | 9674 | |
---|
9414 | 9675 | // save image |
---|
9415 | | - if (ANIMATION && !ABORTED) |
---|
| 9676 | + if (Globals.ANIMATION && !ABORTED) |
---|
9416 | 9677 | { |
---|
9417 | 9678 | VPwidth = viewport[2]; |
---|
9418 | 9679 | VPheight = viewport[3]; |
---|
.. | .. |
---|
9523 | 9784 | |
---|
9524 | 9785 | // imagecount++; |
---|
9525 | 9786 | |
---|
9526 | | - String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
| 9787 | + String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext; |
---|
9527 | 9788 | |
---|
9528 | 9789 | if (!BOXMODE) |
---|
9529 | 9790 | { |
---|
9530 | | - 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) + ")"); |
---|
9531 | 9792 | } |
---|
9532 | 9793 | |
---|
9533 | 9794 | if (!BOXMODE) |
---|
.. | .. |
---|
9565 | 9826 | ABORTED = false; |
---|
9566 | 9827 | } |
---|
9567 | 9828 | else |
---|
9568 | | - GrafreeD.wav.cursor += 735 * ACSIZE; |
---|
| 9829 | + Grafreed.wav.cursor += 735 * ACSIZE; |
---|
9569 | 9830 | |
---|
9570 | 9831 | if (false) |
---|
9571 | 9832 | { |
---|
.. | .. |
---|
10228 | 10489 | |
---|
10229 | 10490 | public void display(GLAutoDrawable drawable) |
---|
10230 | 10491 | { |
---|
10231 | | - if (GrafreeD.savesound && GrafreeD.hassound) |
---|
| 10492 | + if (Grafreed.savesound && Grafreed.hassound) |
---|
10232 | 10493 | { |
---|
10233 | | - GrafreeD.wav.save(); |
---|
10234 | | - GrafreeD.savesound = false; |
---|
10235 | | - GrafreeD.hassound = false; |
---|
| 10494 | + Grafreed.wav.save(); |
---|
| 10495 | + Grafreed.savesound = false; |
---|
| 10496 | + Grafreed.hassound = false; |
---|
10236 | 10497 | } |
---|
10237 | 10498 | // if (DEBUG_SELECTION) |
---|
10238 | 10499 | // { |
---|
.. | .. |
---|
10308 | 10569 | ANTIALIAS = 0; |
---|
10309 | 10570 | //System.out.println("RESTART"); |
---|
10310 | 10571 | AAtimer.restart(); |
---|
| 10572 | + Globals.TIMERRUNNING = true; |
---|
10311 | 10573 | } |
---|
10312 | 10574 | } |
---|
10313 | 10575 | } |
---|
.. | .. |
---|
10362 | 10624 | Object3D theobject = object; |
---|
10363 | 10625 | Object3D theparent = object.parent; |
---|
10364 | 10626 | object.parent = null; |
---|
10365 | | - object = (Object3D)GrafreeD.clone(object); |
---|
| 10627 | + object = (Object3D)Grafreed.clone(object); |
---|
10366 | 10628 | object.Stripify(); |
---|
10367 | 10629 | if (theobject.selection == null || theobject.selection.Size() == 0) |
---|
10368 | 10630 | theobject.PreprocessOcclusion(this); |
---|
.. | .. |
---|
10375 | 10637 | ambientOcclusion = false; |
---|
10376 | 10638 | } |
---|
10377 | 10639 | |
---|
10378 | | - if (Globals.lighttouched && DrawMode() == DEFAULT && !lightMode) // && !FROZEN) |
---|
| 10640 | + if (//Globals.lighttouched && |
---|
| 10641 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10379 | 10642 | { |
---|
10380 | 10643 | //if (RENDERSHADOW) // ? |
---|
10381 | 10644 | if (!IsFrozen()) |
---|
10382 | 10645 | { |
---|
10383 | 10646 | // dec 2012 |
---|
10384 | | - if (!ambientOcclusion && !(!flash && !lightMode && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
| 10647 | + if (!ambientOcclusion && !(!flash && DrawMode() == DEFAULT && ANTIALIAS > 0)) |
---|
10385 | 10648 | { |
---|
10386 | 10649 | Globals.framecount++; |
---|
10387 | 10650 | shadowbuffer.display(); |
---|
.. | .. |
---|
10508 | 10771 | |
---|
10509 | 10772 | // if (parentcam != renderCamera) // not a light |
---|
10510 | 10773 | if (cam != lightCamera) |
---|
10511 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10512 | | - LA.matConcat(matrix, parentcam.toParent, matrix); |
---|
| 10774 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10775 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10513 | 10776 | |
---|
10514 | 10777 | for (int j = 0; j < 4; j++) |
---|
10515 | 10778 | { |
---|
.. | .. |
---|
10523 | 10786 | |
---|
10524 | 10787 | // if (parentcam != renderCamera) // not a light |
---|
10525 | 10788 | if (cam != lightCamera) |
---|
10526 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10527 | | - LA.matConcat(parentcam.fromParent, matrix, matrix); |
---|
| 10789 | + //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
| 10790 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10528 | 10791 | |
---|
10529 | 10792 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10530 | 10793 | |
---|
.. | .. |
---|
10783 | 11046 | // Bump noise |
---|
10784 | 11047 | gl.glActiveTexture(GL.GL_TEXTURE6); |
---|
10785 | 11048 | //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise); |
---|
10786 | | - 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 | + |
---|
10787 | 11059 | |
---|
10788 | 11060 | gl.glActiveTexture(GL.GL_TEXTURE0); |
---|
10789 | 11061 | gl.glEnable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10806 | 11078 | |
---|
10807 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10808 | 11080 | |
---|
10809 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10810 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10811 | | -//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); |
---|
10812 | 11084 | } else |
---|
10813 | 11085 | { |
---|
10814 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10819 | 11091 | //System.out.println("BLENDING ON"); |
---|
10820 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
10821 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10822 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10823 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10824 | 11096 | gl.glLoadIdentity(); |
---|
10825 | 11097 | |
---|
.. | .. |
---|
10908 | 11180 | System.err.println("parentcam != renderCamera"); |
---|
10909 | 11181 | |
---|
10910 | 11182 | // if (cam != lightCamera) |
---|
10911 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10912 | | - 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 |
---|
10913 | 11185 | } |
---|
10914 | 11186 | |
---|
10915 | 11187 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10930 | 11202 | if (true) // TODO |
---|
10931 | 11203 | { |
---|
10932 | 11204 | if (cam != lightCamera) |
---|
10933 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10934 | | - 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 |
---|
10935 | 11207 | } |
---|
10936 | 11208 | |
---|
10937 | 11209 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11247 | 11519 | { |
---|
11248 | 11520 | renderpass++; |
---|
11249 | 11521 | // System.out.println("Draw object... "); |
---|
| 11522 | + STEP = 1; |
---|
11250 | 11523 | if (FAST) // in case there is no script |
---|
11251 | | - STEP = 16; |
---|
| 11524 | + STEP = 8; |
---|
| 11525 | + |
---|
| 11526 | + if (CURRENTANTIALIAS == 0 || ACSIZE == 1) |
---|
| 11527 | + { |
---|
| 11528 | + STEP *= 4; |
---|
| 11529 | + } |
---|
11252 | 11530 | |
---|
11253 | 11531 | //object.FullInvariants(); |
---|
11254 | 11532 | |
---|
.. | .. |
---|
11262 | 11540 | e.printStackTrace(); |
---|
11263 | 11541 | } |
---|
11264 | 11542 | |
---|
11265 | | - if (GrafreeD.RENDERME > 0) |
---|
11266 | | - GrafreeD.RENDERME--; // mechante magouille |
---|
| 11543 | + if (Grafreed.RENDERME > 0) |
---|
| 11544 | + Grafreed.RENDERME--; // mechante magouille |
---|
11267 | 11545 | |
---|
11268 | 11546 | Globals.ONESTEP = false; |
---|
11269 | 11547 | } |
---|
11270 | 11548 | |
---|
11271 | 11549 | static boolean zoomonce = false; |
---|
11272 | 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 | + |
---|
11273 | 11569 | void DrawObject(GL gl, boolean draw) |
---|
11274 | 11570 | { |
---|
| 11571 | + // To clear camera values |
---|
| 11572 | + ResetOptions(); |
---|
| 11573 | + |
---|
11275 | 11574 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11276 | 11575 | // DrawMode() = SELECTION; |
---|
11277 | 11576 | //GL gl = getGL(); |
---|
11278 | 11577 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11279 | 11578 | { |
---|
11280 | 11579 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11281 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11580 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11282 | 11581 | pingthread.StepToTarget(true); // true); |
---|
11283 | 11582 | // zoomonce = false; |
---|
11284 | 11583 | } |
---|
.. | .. |
---|
11333 | 11632 | |
---|
11334 | 11633 | usedtextures.clear(); |
---|
11335 | 11634 | |
---|
11336 | | - 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 | + } |
---|
11337 | 11643 | } |
---|
11338 | 11644 | //System.out.println("--> " + stackdepth); |
---|
11339 | 11645 | // GrafreeD.traceon(); |
---|
.. | .. |
---|
11343 | 11649 | |
---|
11344 | 11650 | if (DrawMode() == DEFAULT) |
---|
11345 | 11651 | { |
---|
11346 | | - if (DEBUG) |
---|
| 11652 | + if (Globals.DEBUG) |
---|
11347 | 11653 | { |
---|
| 11654 | + CreateSelectedPoint(); |
---|
11348 | 11655 | float radius = 0.05f; |
---|
11349 | 11656 | if (selectedpoint.radius != radius) |
---|
11350 | 11657 | { |
---|
.. | .. |
---|
11407 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11408 | 11715 | continue; |
---|
11409 | 11716 | |
---|
11410 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11411 | 11718 | { |
---|
11412 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11413 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
11424 | 11731 | if (checker != null && DrawMode() == DEFAULT) |
---|
11425 | 11732 | { |
---|
11426 | 11733 | //BindTexture(IMMORTAL_TEXTURE); |
---|
11427 | | - 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 | + } |
---|
11428 | 11742 | // NEAREST |
---|
11429 | 11743 | GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR); |
---|
11430 | 11744 | DrawChecker(gl); |
---|
.. | .. |
---|
11506 | 11820 | return; |
---|
11507 | 11821 | } |
---|
11508 | 11822 | |
---|
11509 | | - String string = obj.GetToolTip(); |
---|
| 11823 | + String string = obj.toString(); //.GetToolTip(); |
---|
11510 | 11824 | |
---|
11511 | 11825 | GL gl = GetGL(); |
---|
11512 | 11826 | |
---|
.. | .. |
---|
11823 | 12137 | //obj.TransformToWorld(light, light); |
---|
11824 | 12138 | for (int i = tp.size(); --i >= 0;) |
---|
11825 | 12139 | { |
---|
11826 | | - for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
11827 | | - 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); |
---|
11828 | 12142 | } |
---|
11829 | 12143 | |
---|
11830 | 12144 | |
---|
.. | .. |
---|
11841 | 12155 | parentcam = cameras[0]; |
---|
11842 | 12156 | } |
---|
11843 | 12157 | |
---|
11844 | | - for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11845 | | - 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 |
---|
11846 | 12160 | |
---|
11847 | 12161 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11848 | 12162 | |
---|
.. | .. |
---|
12456 | 12770 | |
---|
12457 | 12771 | // display shadow only (bump == 0) |
---|
12458 | 12772 | "SUB temp.x, half.x, shadow.x;" + |
---|
12459 | | - "MOV temp.y, -params6.x;" + |
---|
12460 | | - "SLT temp.z, temp.y, zero.x;" + |
---|
| 12773 | + "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
| 12774 | + "SLT temp.z, temp.y, -one2048th.x;" + |
---|
12461 | 12775 | "SUB temp.y, one.x, temp.z;" + |
---|
12462 | 12776 | "MUL temp.x, temp.x, temp.y;" + |
---|
12463 | 12777 | "KIL temp.x;" + |
---|
.. | .. |
---|
12586 | 12900 | "MAX ndotl.x, ndotl.x, -ndotl.x;" + |
---|
12587 | 12901 | |
---|
12588 | 12902 | "SUB temp.x, one.x, ndotl.x;" + |
---|
12589 | | - "ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
12590 | | - "ADD temp.y, one.y, options2.y;" + // sursurface |
---|
| 12903 | + // Tuning for default skin |
---|
| 12904 | + //"ADD temp.x, temp.x, options2.z;" + // lightsheen |
---|
| 12905 | + "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen |
---|
| 12906 | + "ADD temp.y, one.y, options2.y;" + // subsurface |
---|
12591 | 12907 | "MUL temp.x, temp.x, temp.y;" + |
---|
12592 | 12908 | |
---|
12593 | 12909 | "MUL saturation, saturation, temp.xxxx;" + |
---|
.. | .. |
---|
12786 | 13102 | //once = true; |
---|
12787 | 13103 | } |
---|
12788 | 13104 | |
---|
12789 | | - System.out.print("Program #" + mode + "; length = " + program.length()); |
---|
| 13105 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
12790 | 13106 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
12791 | 13107 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
12792 | 13108 | |
---|
.. | .. |
---|
12919 | 13235 | |
---|
12920 | 13236 | "ADD " + depth + ".z, " + depth + ".z, temp.x;" + |
---|
12921 | 13237 | //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing! |
---|
| 13238 | + |
---|
| 13239 | + // Compare fragment depth in light space with shadowmap. |
---|
12922 | 13240 | "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
12923 | 13241 | "SGE temp.y, temp.x, zero.x;" + |
---|
12924 | | - "SUB " + shadow + ".y, one.x, temp.y;" + |
---|
| 13242 | + "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded |
---|
| 13243 | + |
---|
| 13244 | + // Reverse comparison |
---|
12925 | 13245 | "SUB temp.x, one.x, temp.x;" + |
---|
12926 | 13246 | "MUL " + shadow + ".x, temp.x, temp.y;" + |
---|
12927 | | - "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded |
---|
| 13247 | + "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse |
---|
12928 | 13248 | "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth |
---|
12929 | 13249 | |
---|
12930 | 13250 | "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" + |
---|
.. | .. |
---|
12938 | 13258 | // No shadow for backface |
---|
12939 | 13259 | "DP3 temp.x, normal, lightd;" + |
---|
12940 | 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;" + |
---|
12941 | 13265 | "LRP " + shadow + ", temp.x, one, " + shadow + ";" + |
---|
12942 | 13266 | ""; |
---|
12943 | 13267 | } |
---|
.. | .. |
---|
13084 | 13408 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13085 | 13409 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13086 | 13410 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13087 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13411 | + |
---|
| 13412 | + //Object3D.cVector2[] vector2buffer; |
---|
13088 | 13413 | |
---|
13089 | 13414 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13090 | 13415 | // OUT : diff, spec |
---|
.. | .. |
---|
13100 | 13425 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13101 | 13426 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13102 | 13427 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13103 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13104 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13105 | | - //"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 |
---|
13106 | 13432 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13107 | 13433 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13108 | 13434 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13496 | 13822 | public void mousePressed(MouseEvent e) |
---|
13497 | 13823 | { |
---|
13498 | 13824 | //System.out.println("mousePressed: " + e); |
---|
13499 | | - clickStart(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 13825 | + clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13500 | 13826 | } |
---|
13501 | 13827 | |
---|
13502 | 13828 | static long prevtime = 0; |
---|
.. | .. |
---|
13523 | 13849 | |
---|
13524 | 13850 | //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio); |
---|
13525 | 13851 | |
---|
| 13852 | + if (BUTTONLESSWHEEL) |
---|
13526 | 13853 | if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30) |
---|
13527 | 13854 | { |
---|
13528 | 13855 | return; |
---|
.. | .. |
---|
13531 | 13858 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
13532 | 13859 | |
---|
13533 | 13860 | // TIMER |
---|
13534 | | - if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
| 13861 | + if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR |
---|
13535 | 13862 | { |
---|
13536 | 13863 | keepboxmode = BOXMODE; |
---|
13537 | 13864 | keepsupport = SUPPORT; |
---|
.. | .. |
---|
13571 | 13898 | // mode |= META; |
---|
13572 | 13899 | //} |
---|
13573 | 13900 | |
---|
13574 | | - SetMouseMode(WHEEL | e.getModifiersEx()); |
---|
13575 | | - drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0); |
---|
| 13901 | + SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx()); |
---|
| 13902 | + drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0); |
---|
13576 | 13903 | anchorX = ax; |
---|
13577 | 13904 | anchorY = ay; |
---|
13578 | 13905 | prevX = px; |
---|
.. | .. |
---|
13606 | 13933 | else |
---|
13607 | 13934 | if (evt.getSource() == AAtimer) |
---|
13608 | 13935 | { |
---|
| 13936 | + Globals.TIMERRUNNING = false; |
---|
13609 | 13937 | if (mouseDown) |
---|
13610 | 13938 | { |
---|
13611 | 13939 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13631 | 13959 | // LIVE = waslive; |
---|
13632 | 13960 | // wasliveok = true; |
---|
13633 | 13961 | // waslive = false; |
---|
| 13962 | + |
---|
| 13963 | + // May 2019 Forget it: |
---|
| 13964 | + if (true) |
---|
| 13965 | + return; |
---|
13634 | 13966 | |
---|
13635 | 13967 | // source == timer |
---|
13636 | 13968 | if (mouseDown) |
---|
.. | .. |
---|
13661 | 13993 | |
---|
13662 | 13994 | // fev 2014??? |
---|
13663 | 13995 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13664 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13996 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13665 | 13997 | pingthread.StepToTarget(true); // true); |
---|
13666 | 13998 | } |
---|
13667 | 13999 | // if (!LIVE) |
---|
.. | .. |
---|
13670 | 14002 | |
---|
13671 | 14003 | javax.swing.Timer timer = new javax.swing.Timer(350, this); |
---|
13672 | 14004 | |
---|
13673 | | - void clickStart(int x, int y, int modifiers) |
---|
| 14005 | + void clickStart(int x, int y, int modifiers, int modifiersex) |
---|
13674 | 14006 | { |
---|
13675 | 14007 | if (!wasliveok) |
---|
13676 | 14008 | return; |
---|
13677 | 14009 | |
---|
13678 | 14010 | AAtimer.restart(); // |
---|
| 14011 | + Globals.TIMERRUNNING = true; |
---|
13679 | 14012 | |
---|
13680 | 14013 | // waslive = LIVE; |
---|
13681 | 14014 | // LIVE = false; |
---|
.. | .. |
---|
13687 | 14020 | // touched = true; // main DL |
---|
13688 | 14021 | if (isRenderer) |
---|
13689 | 14022 | { |
---|
13690 | | - SetMouseMode(modifiers); |
---|
| 14023 | + SetMouseMode(modifiers, modifiersex); |
---|
13691 | 14024 | } |
---|
13692 | 14025 | |
---|
13693 | 14026 | selectX = anchorX = x; |
---|
.. | .. |
---|
13700 | 14033 | clicked = true; |
---|
13701 | 14034 | hold = false; |
---|
13702 | 14035 | |
---|
13703 | | - if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection |
---|
| 14036 | + if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection |
---|
13704 | 14037 | // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection |
---|
13705 | 14038 | { |
---|
13706 | 14039 | // System.out.println("RESTART II " + modifiers); |
---|
.. | .. |
---|
13731 | 14064 | info.camera = renderCamera; |
---|
13732 | 14065 | info.x = x; |
---|
13733 | 14066 | info.y = y; |
---|
13734 | | - info.modifiers = modifiers; |
---|
| 14067 | + info.modifiers = modifiersex; |
---|
13735 | 14068 | editObj = object.doEditClick(info, 0); |
---|
13736 | 14069 | if (!editObj) |
---|
13737 | 14070 | { |
---|
.. | .. |
---|
13748 | 14081 | |
---|
13749 | 14082 | public void mouseDragged(MouseEvent e) |
---|
13750 | 14083 | { |
---|
| 14084 | + Globals.MOUSEDRAGGED = true; |
---|
| 14085 | + |
---|
| 14086 | + //System.out.println("mouseDragged: " + e); |
---|
13751 | 14087 | if (isRenderer) |
---|
13752 | 14088 | movingcamera = true; |
---|
| 14089 | + |
---|
13753 | 14090 | //if (drawing) |
---|
13754 | 14091 | //return; |
---|
13755 | | - //System.out.println("mouseDragged: " + e); |
---|
13756 | 14092 | if ((e.getModifiersEx() & CTRL) != 0 |
---|
13757 | 14093 | || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen()) |
---|
13758 | 14094 | { |
---|
.. | .. |
---|
13760 | 14096 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
13761 | 14097 | } |
---|
13762 | 14098 | else |
---|
13763 | | - drag(e.getX(), e.getY(), e.getModifiersEx()); |
---|
| 14099 | + drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx()); |
---|
13764 | 14100 | |
---|
13765 | 14101 | //try { Thread.sleep(1); } catch (Exception ex) {} |
---|
13766 | 14102 | } |
---|
.. | .. |
---|
13933 | 14269 | |
---|
13934 | 14270 | public void run() |
---|
13935 | 14271 | { |
---|
| 14272 | + new Exception().printStackTrace(); |
---|
13936 | 14273 | System.exit(0); |
---|
13937 | 14274 | for (;;) |
---|
13938 | 14275 | { |
---|
.. | .. |
---|
13996 | 14333 | { |
---|
13997 | 14334 | Globals.lighttouched = true; |
---|
13998 | 14335 | } |
---|
13999 | | - drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS); |
---|
| 14336 | + drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS); |
---|
14000 | 14337 | } |
---|
14001 | 14338 | //else |
---|
14002 | 14339 | } |
---|
.. | .. |
---|
14010 | 14347 | void GoDown(int mod) |
---|
14011 | 14348 | { |
---|
14012 | 14349 | MODIFIERS |= COMMAND; |
---|
14013 | | - /* |
---|
| 14350 | + /**/ |
---|
14014 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14015 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14016 | 14353 | else |
---|
14017 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14018 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14019 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14020 | 14357 | { |
---|
14021 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14031 | 14368 | void GoUp(int mod) |
---|
14032 | 14369 | { |
---|
14033 | 14370 | MODIFIERS |= COMMAND; |
---|
14034 | | - /* |
---|
| 14371 | + /**/ |
---|
14035 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14036 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14037 | 14374 | else |
---|
14038 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14039 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14040 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14041 | 14378 | { |
---|
14042 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14052 | 14389 | void GoLeft(int mod) |
---|
14053 | 14390 | { |
---|
14054 | 14391 | MODIFIERS |= COMMAND; |
---|
14055 | | - /* |
---|
| 14392 | + /**/ |
---|
14056 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14057 | | - manipCamera.RotatePosition(speed, 0); |
---|
14058 | | - else |
---|
14059 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14060 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14061 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14062 | 14399 | { |
---|
14063 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14073 | 14410 | void GoRight(int mod) |
---|
14074 | 14411 | { |
---|
14075 | 14412 | MODIFIERS |= COMMAND; |
---|
14076 | | - /* |
---|
| 14413 | + /**/ |
---|
14077 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14078 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14079 | | - else |
---|
14080 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14081 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14082 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14083 | 14420 | { |
---|
14084 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14096 | 14433 | int X, Y; |
---|
14097 | 14434 | boolean SX, SY; |
---|
14098 | 14435 | |
---|
14099 | | - void drag(int x, int y, int modifiers) |
---|
| 14436 | + void drag(int x, int y, int modifiers, int modifiersex) |
---|
14100 | 14437 | { |
---|
14101 | 14438 | if (IsFrozen()) |
---|
14102 | 14439 | { |
---|
.. | .. |
---|
14105 | 14442 | |
---|
14106 | 14443 | drag = true; // NEW |
---|
14107 | 14444 | |
---|
14108 | | - boolean continuous = (modifiers & COMMAND) == COMMAND; |
---|
| 14445 | + boolean continuous = (modifiersex & COMMAND) == COMMAND; |
---|
14109 | 14446 | |
---|
14110 | 14447 | X = x; |
---|
14111 | 14448 | Y = y; |
---|
14112 | 14449 | // floating state for animation |
---|
14113 | | - MODIFIERS = modifiers; |
---|
14114 | | - modifiers &= ~1024; |
---|
| 14450 | + MODIFIERS = modifiersex; |
---|
| 14451 | + modifiersex &= ~1024; |
---|
14115 | 14452 | if (false) // modifiers != 0) |
---|
14116 | 14453 | { |
---|
14117 | 14454 | //new Exception().printStackTrace(); |
---|
14118 | | - System.out.println("mouseDragged: " + modifiers); |
---|
| 14455 | + System.out.println("mouseDragged: " + modifiersex); |
---|
14119 | 14456 | System.out.println("SHIFT = " + SHIFT); |
---|
14120 | 14457 | System.out.println("CONTROL = " + COMMAND); |
---|
14121 | 14458 | System.out.println("META = " + META); |
---|
.. | .. |
---|
14135 | 14472 | info.camera = renderCamera; |
---|
14136 | 14473 | info.x = x; |
---|
14137 | 14474 | info.y = y; |
---|
14138 | | - object.editWindow.copy.doEditDrag(info); |
---|
| 14475 | + object.GetWindow().copy |
---|
| 14476 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14139 | 14477 | } else |
---|
14140 | 14478 | { |
---|
14141 | 14479 | if (x < startX) |
---|
.. | .. |
---|
14287 | 14625 | public void mouseMoved(MouseEvent e) |
---|
14288 | 14626 | { |
---|
14289 | 14627 | //System.out.println("mouseMoved: " + e); |
---|
14290 | | - |
---|
14291 | 14628 | if (isRenderer) |
---|
14292 | 14629 | return; |
---|
14293 | 14630 | |
---|
.. | .. |
---|
14300 | 14637 | ci.camera = renderCamera; |
---|
14301 | 14638 | if (!isRenderer) |
---|
14302 | 14639 | { |
---|
14303 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14640 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14641 | + //Object3D copy = editWindow.copy; |
---|
| 14642 | + if (object.doEditClick(ci, 0)) |
---|
14304 | 14643 | { |
---|
14305 | 14644 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14306 | 14645 | } else |
---|
.. | .. |
---|
14312 | 14651 | |
---|
14313 | 14652 | public void mouseReleased(MouseEvent e) |
---|
14314 | 14653 | { |
---|
| 14654 | + Globals.MOUSEDRAGGED = false; |
---|
| 14655 | + |
---|
14315 | 14656 | movingcamera = false; |
---|
| 14657 | + X = 0; // getBounds().width/2; |
---|
| 14658 | + Y = 0; // getBounds().height/2; |
---|
14316 | 14659 | //System.out.println("mouseReleased: " + e); |
---|
14317 | 14660 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14318 | 14661 | } |
---|
.. | .. |
---|
14335 | 14678 | boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection |
---|
14336 | 14679 | boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection |
---|
14337 | 14680 | |
---|
14338 | | - if (control || command || IsFrozen()) |
---|
| 14681 | +// No delay if (control || command || IsFrozen()) |
---|
14339 | 14682 | timeout = true; |
---|
14340 | | - else |
---|
| 14683 | +// ?? May 2019 else |
---|
14341 | 14684 | // timer.setDelay((modifiers & 128) != 0?0:350); |
---|
14342 | 14685 | mouseDown = false; |
---|
14343 | 14686 | if (!control && !command) // june 2013 |
---|
.. | .. |
---|
14447 | 14790 | System.out.println("keyReleased: " + e); |
---|
14448 | 14791 | } |
---|
14449 | 14792 | |
---|
14450 | | - void SetMouseMode(int modifiers) |
---|
| 14793 | + void SetMouseMode(int modifiers, int modifiersex) |
---|
14451 | 14794 | { |
---|
14452 | 14795 | //System.out.println("SetMouseMode = " + modifiers); |
---|
14453 | 14796 | //modifiers &= ~1024; |
---|
.. | .. |
---|
14459 | 14802 | //if (modifiers == 0) // || (modifiers == (1024 | CONTROL))) |
---|
14460 | 14803 | // return; |
---|
14461 | 14804 | //System.out.println("SetMode = " + modifiers); |
---|
14462 | | - if ((modifiers & WHEEL) == WHEEL) |
---|
| 14805 | + if ((modifiersex & WHEEL) == WHEEL) |
---|
14463 | 14806 | { |
---|
14464 | 14807 | mouseMode |= ZOOM; |
---|
14465 | 14808 | } |
---|
14466 | 14809 | |
---|
14467 | 14810 | boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); |
---|
14468 | | - if (capsLocked || (modifiers & META) == META) |
---|
| 14811 | + if (capsLocked) // || (modifiers & META) == META) |
---|
14469 | 14812 | { |
---|
14470 | 14813 | mouseMode |= VR; // BACKFORTH; |
---|
14471 | 14814 | } |
---|
14472 | | - if ((modifiers & CTRLCLICK) == CTRLCLICK) |
---|
| 14815 | + if ((modifiersex & CTRLCLICK) == CTRLCLICK) |
---|
14473 | 14816 | { |
---|
14474 | 14817 | mouseMode |= SELECT; |
---|
14475 | 14818 | } |
---|
14476 | | - if ((modifiers & COMMAND) == COMMAND) |
---|
| 14819 | + if ((modifiersex & COMMAND) == COMMAND) |
---|
14477 | 14820 | { |
---|
14478 | 14821 | mouseMode |= SELECT; |
---|
14479 | 14822 | } |
---|
14480 | | - if ((modifiers & SHIFT) == SHIFT || forcetranslate) |
---|
| 14823 | + if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0) |
---|
14481 | 14824 | { |
---|
14482 | 14825 | mouseMode &= ~VR; |
---|
14483 | 14826 | mouseMode |= TRANSLATE; |
---|
.. | .. |
---|
14506 | 14849 | |
---|
14507 | 14850 | if (isRenderer) // |
---|
14508 | 14851 | { |
---|
14509 | | - SetMouseMode(modifiers); |
---|
| 14852 | + SetMouseMode(0, modifiers); |
---|
14510 | 14853 | } |
---|
14511 | 14854 | |
---|
14512 | 14855 | Globals.theRenderer.keyPressed(key); |
---|
.. | .. |
---|
14653 | 14996 | case 'E' : COMPACT ^= true; |
---|
14654 | 14997 | repaint(); |
---|
14655 | 14998 | break; |
---|
14656 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14657 | 15002 | repaint(); |
---|
14658 | 15003 | break; |
---|
14659 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14678 | 15023 | RevertCamera(); |
---|
14679 | 15024 | repaint(); |
---|
14680 | 15025 | break; |
---|
14681 | | - case 'L': |
---|
14682 | 15026 | case 'l': |
---|
| 15027 | + //case 'L': |
---|
14683 | 15028 | if (lightMode) |
---|
14684 | 15029 | { |
---|
14685 | 15030 | lightMode = false; |
---|
.. | .. |
---|
14822 | 15167 | case '_': |
---|
14823 | 15168 | kompactbit = 5; |
---|
14824 | 15169 | break; |
---|
14825 | | - case '+': |
---|
14826 | | - kompactbit = 6; |
---|
14827 | | - break; |
---|
| 15170 | +// case '+': |
---|
| 15171 | +// kompactbit = 6; |
---|
| 15172 | +// break; |
---|
14828 | 15173 | case ' ': |
---|
14829 | 15174 | lightMode ^= true; |
---|
14830 | 15175 | Globals.lighttouched = true; |
---|
.. | .. |
---|
14836 | 15181 | case ESC: |
---|
14837 | 15182 | RENDERPROGRAM += 1; |
---|
14838 | 15183 | RENDERPROGRAM %= 3; |
---|
| 15184 | + |
---|
14839 | 15185 | repaint(); |
---|
14840 | 15186 | break; |
---|
14841 | 15187 | case 'Z': |
---|
14842 | 15188 | //RESIZETEXTURE ^= true; |
---|
14843 | 15189 | //break; |
---|
14844 | 15190 | case 'z': |
---|
14845 | | - RENDERSHADOW ^= true; |
---|
| 15191 | + Globals.RENDERSHADOW ^= true; |
---|
14846 | 15192 | Globals.lighttouched = true; |
---|
14847 | 15193 | repaint(); |
---|
14848 | 15194 | break; |
---|
.. | .. |
---|
14875 | 15221 | case DELETE: |
---|
14876 | 15222 | ClearSelection(); |
---|
14877 | 15223 | break; |
---|
14878 | | - /* |
---|
14879 | 15224 | case '+': |
---|
| 15225 | + |
---|
| 15226 | + /* |
---|
14880 | 15227 | //fontsize += 1; |
---|
14881 | 15228 | bbzoom *= 2; |
---|
14882 | 15229 | repaint(); |
---|
.. | .. |
---|
14893 | 15240 | case '=': |
---|
14894 | 15241 | IncDepth(); |
---|
14895 | 15242 | //fontsize += 1; |
---|
14896 | | - object.editWindow.refreshContents(true); |
---|
| 15243 | + object.GetWindow().refreshContents(true); |
---|
14897 | 15244 | maskbit = 6; |
---|
14898 | 15245 | break; |
---|
14899 | 15246 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
14900 | 15247 | DecDepth(); |
---|
14901 | 15248 | maskbit = 5; |
---|
14902 | 15249 | //if(fontsize > 1) fontsize -= 1; |
---|
14903 | | - if (object.editWindow == null) |
---|
14904 | | - new Exception().printStackTrace(); |
---|
14905 | | - else |
---|
14906 | | - object.editWindow.refreshContents(true); |
---|
| 15250 | +// if (object.editWindow == null) |
---|
| 15251 | +// new Exception().printStackTrace(); |
---|
| 15252 | +// else |
---|
| 15253 | + object.GetWindow().refreshContents(true); |
---|
14907 | 15254 | break; |
---|
14908 | 15255 | case '{': |
---|
14909 | 15256 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
14966 | 15313 | //mode = ROTATE; |
---|
14967 | 15314 | if ((MODIFIERS & COMMAND) == 0) // VR?? |
---|
14968 | 15315 | { |
---|
14969 | | - SetMouseMode(modifiers); |
---|
| 15316 | + SetMouseMode(0, modifiers); |
---|
14970 | 15317 | } |
---|
14971 | 15318 | } |
---|
14972 | 15319 | |
---|
.. | .. |
---|
15100 | 15447 | |
---|
15101 | 15448 | protected void processMouseMotionEvent(MouseEvent e) |
---|
15102 | 15449 | { |
---|
15103 | | - //System.out.println("processMouseMotionEvent: " + mouseMode); |
---|
15104 | | - if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15450 | + //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton()); |
---|
| 15451 | + //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0) |
---|
| 15452 | + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0) |
---|
15105 | 15453 | { |
---|
15106 | 15454 | mouseMoved(e); |
---|
15107 | 15455 | } else |
---|
.. | .. |
---|
15126 | 15474 | } |
---|
15127 | 15475 | */ |
---|
15128 | 15476 | |
---|
15129 | | - object.editWindow.EditSelection(); |
---|
| 15477 | + object.GetWindow().EditSelection(false); |
---|
15130 | 15478 | } |
---|
15131 | 15479 | |
---|
15132 | 15480 | void SelectParent() |
---|
15133 | 15481 | { |
---|
| 15482 | + new Exception().printStackTrace(); |
---|
15134 | 15483 | System.exit(0); |
---|
15135 | 15484 | Composite group = (Composite) object; |
---|
15136 | 15485 | java.util.Vector selectees = new java.util.Vector(group.selection); |
---|
.. | .. |
---|
15142 | 15491 | { |
---|
15143 | 15492 | //selectees.remove(i); |
---|
15144 | 15493 | System.out.println("select parent of " + elem); |
---|
15145 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15494 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15146 | 15495 | } else |
---|
15147 | 15496 | { |
---|
15148 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15497 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15149 | 15498 | } |
---|
15150 | 15499 | |
---|
15151 | 15500 | first = false; |
---|
.. | .. |
---|
15154 | 15503 | |
---|
15155 | 15504 | void SelectChildren() |
---|
15156 | 15505 | { |
---|
| 15506 | + new Exception().printStackTrace(); |
---|
15157 | 15507 | System.exit(0); |
---|
15158 | 15508 | /* |
---|
15159 | 15509 | Composite group = (Composite) object; |
---|
.. | .. |
---|
15186 | 15536 | for (int j = 0; j < group.children.size(); j++) |
---|
15187 | 15537 | { |
---|
15188 | 15538 | elem = (Object3D) group.children.elementAt(j); |
---|
15189 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15539 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15190 | 15540 | first = false; |
---|
15191 | 15541 | } |
---|
15192 | 15542 | } else |
---|
15193 | 15543 | { |
---|
15194 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15544 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15195 | 15545 | } |
---|
15196 | 15546 | |
---|
15197 | 15547 | first = false; |
---|
.. | .. |
---|
15202 | 15552 | { |
---|
15203 | 15553 | //Composite group = (Composite) object; |
---|
15204 | 15554 | Object3D group = object; |
---|
15205 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15555 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15206 | 15556 | } |
---|
15207 | 15557 | |
---|
15208 | 15558 | void ResetTransform(int mask) |
---|
15209 | 15559 | { |
---|
15210 | 15560 | //Composite group = (Composite) object; |
---|
15211 | 15561 | Object3D group = object; |
---|
15212 | | - group.editWindow.ResetTransform(mask); |
---|
| 15562 | + group.GetWindow().ResetTransform(mask); |
---|
15213 | 15563 | } |
---|
15214 | 15564 | |
---|
15215 | 15565 | void FlipTransform() |
---|
15216 | 15566 | { |
---|
15217 | 15567 | //Composite group = (Composite) object; |
---|
15218 | 15568 | Object3D group = object; |
---|
15219 | | - group.editWindow.FlipTransform(); |
---|
| 15569 | + group.GetWindow().FlipTransform(); |
---|
15220 | 15570 | // group.editWindow.ReduceMesh(true); |
---|
15221 | 15571 | } |
---|
15222 | 15572 | |
---|
.. | .. |
---|
15224 | 15574 | { |
---|
15225 | 15575 | //Composite group = (Composite) object; |
---|
15226 | 15576 | Object3D group = object; |
---|
15227 | | - group.editWindow.PrintMemory(); |
---|
| 15577 | + group.GetWindow().PrintMemory(); |
---|
15228 | 15578 | // group.editWindow.ReduceMesh(true); |
---|
15229 | 15579 | } |
---|
15230 | 15580 | |
---|
.. | .. |
---|
15232 | 15582 | { |
---|
15233 | 15583 | //Composite group = (Composite) object; |
---|
15234 | 15584 | Object3D group = object; |
---|
15235 | | - group.editWindow.ResetCentroid(); |
---|
| 15585 | + group.GetWindow().ResetCentroid(); |
---|
15236 | 15586 | } |
---|
15237 | 15587 | |
---|
15238 | 15588 | void IncDepth() |
---|
.. | .. |
---|
15318 | 15668 | info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
---|
15319 | 15669 | //Image img = CreateImage(width, height); |
---|
15320 | 15670 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
---|
| 15671 | + |
---|
15321 | 15672 | Graphics gr = g; // img.getGraphics(); |
---|
| 15673 | + |
---|
15322 | 15674 | if (!hasMarquee) |
---|
15323 | 15675 | { |
---|
15324 | 15676 | if (Xmin < Xmax) // !locked) |
---|
.. | .. |
---|
15406 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15407 | 15759 | } |
---|
15408 | 15760 | } |
---|
| 15761 | + |
---|
15409 | 15762 | info.g = gr; |
---|
15410 | 15763 | info.camera = renderCamera; |
---|
15411 | 15764 | /* |
---|
.. | .. |
---|
15415 | 15768 | */ |
---|
15416 | 15769 | if (!isRenderer) |
---|
15417 | 15770 | { |
---|
15418 | | - 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 | + } |
---|
15419 | 15810 | } |
---|
15420 | 15811 | } |
---|
| 15812 | + |
---|
15421 | 15813 | if (isRenderer) |
---|
15422 | 15814 | { |
---|
15423 | 15815 | //gr.setColor(Color.black); |
---|
15424 | 15816 | //gr.drawRect(info.bounds.x - 1, info.bounds.y - 1, info.bounds.width + 1, info.bounds.height + 1); |
---|
15425 | 15817 | //gr.drawRect(info.bounds.x - 2, info.bounds.y - 2, info.bounds.width + 3, info.bounds.height + 3); |
---|
15426 | 15818 | } |
---|
| 15819 | + |
---|
15427 | 15820 | if (hasMarquee) |
---|
15428 | 15821 | { |
---|
15429 | 15822 | gr.setXORMode(Color.white); |
---|
.. | .. |
---|
15536 | 15929 | public boolean mouseDown(Event evt, int x, int y) |
---|
15537 | 15930 | { |
---|
15538 | 15931 | System.out.println("mouseDown: " + evt); |
---|
| 15932 | + System.exit(0); |
---|
15539 | 15933 | /* |
---|
15540 | 15934 | locked = true; |
---|
15541 | 15935 | drag = false; |
---|
.. | .. |
---|
15579 | 15973 | { |
---|
15580 | 15974 | keyPressed(0, modifiers); |
---|
15581 | 15975 | } |
---|
15582 | | - clickStart(x, y, modifiers); |
---|
| 15976 | + // clickStart(x, y, modifiers); |
---|
15583 | 15977 | return true; |
---|
15584 | 15978 | } |
---|
15585 | 15979 | |
---|
.. | .. |
---|
15697 | 16091 | { |
---|
15698 | 16092 | keyReleased(0, 0); |
---|
15699 | 16093 | } |
---|
15700 | | - drag(x, y, modifiers); |
---|
| 16094 | + drag(x, y, 0, modifiers); |
---|
15701 | 16095 | return true; |
---|
15702 | 16096 | } |
---|
15703 | 16097 | |
---|
.. | .. |
---|
15829 | 16223 | Object3D object; |
---|
15830 | 16224 | static Object3D trackedobject; |
---|
15831 | 16225 | Camera renderCamera; // Light or Eye (or Occlusion) |
---|
15832 | | - /*static*/ Camera manipCamera; // Light or Eye |
---|
| 16226 | + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light |
---|
15833 | 16227 | /*static*/ Camera eyeCamera; |
---|
15834 | 16228 | /*static*/ Camera lightCamera; |
---|
15835 | 16229 | int cameracount; |
---|
.. | .. |
---|
16114 | 16508 | cStatic.objectstack[materialdepth++] = checker; |
---|
16115 | 16509 | //System.out.println("material " + material); |
---|
16116 | 16510 | //Applet3D.tracein(this, selected); |
---|
16117 | | - vector2buffer = checker.projectedVertices; |
---|
| 16511 | + //vector2buffer = checker.projectedVertices; |
---|
16118 | 16512 | |
---|
16119 | 16513 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16120 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16514 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16121 | 16515 | |
---|
16122 | 16516 | materialdepth -= 1; |
---|
16123 | 16517 | if (materialdepth > 0) |
---|
16124 | 16518 | { |
---|
16125 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16126 | | - 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); |
---|
16127 | 16521 | } |
---|
16128 | 16522 | //checker.GetMaterial().opacity = 1f; |
---|
16129 | 16523 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16209 | 16603 | } |
---|
16210 | 16604 | } |
---|
16211 | 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 | + |
---|
16212 | 16614 | class SelectBuffer implements GLEventListener |
---|
16213 | 16615 | { |
---|
16214 | 16616 | |
---|
.. | .. |
---|
16267 | 16669 | { |
---|
16268 | 16670 | if (!selection) |
---|
16269 | 16671 | { |
---|
| 16672 | + new Exception().printStackTrace(); |
---|
16270 | 16673 | System.exit(0); |
---|
16271 | 16674 | return; |
---|
16272 | 16675 | } |
---|
.. | .. |
---|
16287 | 16690 | |
---|
16288 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16289 | 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 | + |
---|
16290 | 16704 | //int tmp = selection_view; |
---|
16291 | 16705 | //selection_view = -1; |
---|
16292 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16298 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16299 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16300 | 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 | + |
---|
16301 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16302 | 16727 | |
---|
16303 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16345 | 16770 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16346 | 16771 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16347 | 16772 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16773 | + |
---|
| 16774 | + CreateSelectedPoint(); |
---|
16348 | 16775 | |
---|
16349 | 16776 | // Will fit the mesh !!! |
---|
16350 | 16777 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16394 | 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])); |
---|
16395 | 16822 | } |
---|
16396 | 16823 | |
---|
16397 | | - previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint); |
---|
| 16824 | + previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint); |
---|
16398 | 16825 | } |
---|
16399 | 16826 | } |
---|
16400 | 16827 | |
---|
16401 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16402 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16829 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16403 | 16830 | |
---|
16404 | | - 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) |
---|
16405 | 16832 | { |
---|
16406 | | - 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); |
---|
16407 | 16834 | |
---|
16408 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16835 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16409 | 16838 | |
---|
16410 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16411 | | - |
---|
16412 | | - group.add(paintobj); // link |
---|
16413 | | - |
---|
16414 | | - object.editWindow.SnapObject(group); |
---|
16415 | | - |
---|
16416 | | - Object3D folder = object.editWindow.copy; |
---|
16417 | | - |
---|
16418 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16419 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16420 | | - |
---|
16421 | | - folder.add(group); |
---|
16422 | | - |
---|
16423 | | - object.editWindow.ResetModel(); |
---|
16424 | | - 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 | + } |
---|
16425 | 16854 | } |
---|
16426 | 16855 | else |
---|
16427 | 16856 | paintcount = 0; |
---|
.. | .. |
---|
16460 | 16889 | //System.out.println("objects[color] = " + objects[color]); |
---|
16461 | 16890 | //objects[color].Select(); |
---|
16462 | 16891 | indexcount = 0; |
---|
| 16892 | + ObjEditor window = object.GetWindow(); |
---|
| 16893 | + if (window != null && deselect) |
---|
| 16894 | + { |
---|
| 16895 | + window.Select(null, deselect, true); |
---|
| 16896 | + } |
---|
16463 | 16897 | object.Select(color, deselect); |
---|
16464 | 16898 | } |
---|
16465 | 16899 | |
---|
.. | .. |
---|
16559 | 16993 | gl.glDisable(gl.GL_CULL_FACE); |
---|
16560 | 16994 | } |
---|
16561 | 16995 | |
---|
16562 | | - if (!RENDERSHADOW) |
---|
| 16996 | + if (!Globals.RENDERSHADOW) |
---|
16563 | 16997 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16564 | 16998 | |
---|
16565 | 16999 | // SB gl.glPolygonOffset(2.5f, 10); |
---|
.. | .. |
---|
16569 | 17003 | //gl.glColorMask(false, false, false, false); |
---|
16570 | 17004 | |
---|
16571 | 17005 | //render_scene_from_light_view(gl, drawable, 0, 0); |
---|
16572 | | - if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed()) |
---|
| 17006 | + if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed()) |
---|
16573 | 17007 | { |
---|
16574 | 17008 | gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
---|
16575 | 17009 | |
---|
.. | .. |
---|
16985 | 17419 | int AAbuffersize = 0; |
---|
16986 | 17420 | |
---|
16987 | 17421 | //double[] selectedpoint = new double[3]; |
---|
16988 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17422 | + static Superellipsoid selectedpoint; |
---|
16989 | 17423 | static Sphere previousselectedpoint = null; |
---|
16990 | | - static Sphere debugpointG = new Sphere(); |
---|
16991 | | - static Sphere debugpointP = new Sphere(); |
---|
16992 | | - static Sphere debugpointC = new Sphere(); |
---|
16993 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17424 | + static Sphere debugpointG; |
---|
| 17425 | + static Sphere debugpointP; |
---|
| 17426 | + static Sphere debugpointC; |
---|
| 17427 | + static Sphere debugpointR; |
---|
16994 | 17428 | |
---|
16995 | 17429 | static Sphere debugpoints[] = new Sphere[8]; |
---|
16996 | 17430 | |
---|
16997 | | - static |
---|
16998 | | - { |
---|
16999 | | - for (int i=0; i<8; i++) |
---|
17000 | | - { |
---|
17001 | | - debugpoints[i] = new Sphere(); |
---|
17002 | | - } |
---|
17003 | | - } |
---|
17004 | | - |
---|
17005 | 17431 | static void InitPoints(float radius) |
---|
17006 | 17432 | { |
---|
17007 | 17433 | for (int i=0; i<8; i++) |
---|