.. | .. |
---|
37 | 37 | static boolean[] selectedstack = new boolean[65536]; |
---|
38 | 38 | static int materialdepth = 0; |
---|
39 | 39 | |
---|
40 | | - static boolean DEBUG = false; |
---|
41 | 40 | static boolean FRUSTUM = false; // still bogus true; // frustum culling |
---|
42 | 41 | |
---|
43 | 42 | // camera change fix |
---|
.. | .. |
---|
61 | 60 | //boolean REDUCETEXTURE = true; |
---|
62 | 61 | boolean CACHETEXTURE = true; |
---|
63 | 62 | boolean CLEANCACHE = false; // true; |
---|
64 | | - boolean MIPMAP = false; // true; |
---|
| 63 | + boolean MIPMAP = true; // false; // true; |
---|
65 | 64 | boolean COMPRESSTEXTURE = false; |
---|
66 | 65 | boolean KOMPACTTEXTURE = false; // true; |
---|
67 | 66 | boolean RESIZETEXTURE = false; |
---|
.. | .. |
---|
327 | 326 | cStatic.objectstack[materialdepth++] = obj; |
---|
328 | 327 | //System.out.println("material " + material); |
---|
329 | 328 | //Applet3D.tracein(this, selected); |
---|
330 | | - display.vector2buffer = obj.projectedVertices; |
---|
| 329 | + //display.vector2buffer = obj.projectedVertices; |
---|
331 | 330 | if (obj instanceof Camera) |
---|
332 | 331 | { |
---|
333 | 332 | display.options1[0] = material.shift; |
---|
.. | .. |
---|
336 | 335 | display.options1[2] = material.shadowbias; |
---|
337 | 336 | display.options1[3] = material.aniso; |
---|
338 | 337 | display.options1[4] = material.anisoV; |
---|
| 338 | +// System.out.println("display.options1[0] " + display.options1[0]); |
---|
| 339 | +// System.out.println("display.options1[1] " + display.options1[1]); |
---|
| 340 | +// System.out.println("display.options1[2] " + display.options1[2]); |
---|
| 341 | +// System.out.println("display.options1[3] " + display.options1[3]); |
---|
| 342 | +// System.out.println("display.options1[4] " + display.options1[4]); |
---|
339 | 343 | display.options2[0] = material.opacity; |
---|
340 | 344 | display.options2[1] = material.diffuse; |
---|
341 | 345 | display.options2[2] = material.factor; |
---|
| 346 | +// System.out.println("display.options2[0] " + display.options2[0]); |
---|
| 347 | +// System.out.println("display.options2[1] " + display.options2[1]); |
---|
| 348 | +// System.out.println("display.options2[2] " + display.options2[2]); |
---|
342 | 349 | |
---|
343 | 350 | cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
| 351 | +// System.out.println("display.options3[0] " + display.options3[0]); |
---|
| 352 | +// System.out.println("display.options3[1] " + display.options3[1]); |
---|
| 353 | +// System.out.println("display.options3[2] " + display.options3[2]); |
---|
344 | 354 | display.options4[0] = material.cameralight/0.2f; |
---|
345 | 355 | display.options4[1] = material.subsurface; |
---|
346 | 356 | display.options4[2] = material.sheen; |
---|
| 357 | +// System.out.println("display.options4[0] " + display.options4[0]); |
---|
| 358 | +// System.out.println("display.options4[1] " + display.options4[1]); |
---|
| 359 | +// System.out.println("display.options4[2] " + display.options4[2]); |
---|
347 | 360 | |
---|
348 | 361 | // if (display.CURRENTANTIALIAS > 0) |
---|
349 | 362 | // display.options3[3] /= 4; |
---|
.. | .. |
---|
359 | 372 | /**/ |
---|
360 | 373 | } else |
---|
361 | 374 | { |
---|
362 | | - DrawMaterial(material, selected); |
---|
| 375 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
363 | 376 | } |
---|
364 | 377 | } else |
---|
365 | 378 | { |
---|
.. | .. |
---|
383 | 396 | cStatic.objectstack[materialdepth++] = obj; |
---|
384 | 397 | //System.out.println("material " + material); |
---|
385 | 398 | //Applet3D.tracein("selected ", selected); |
---|
386 | | - display.vector2buffer = obj.projectedVertices; |
---|
387 | | - display.DrawMaterial(material, selected); |
---|
| 399 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 400 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
388 | 401 | } |
---|
389 | 402 | } |
---|
390 | 403 | |
---|
.. | .. |
---|
401 | 414 | materialdepth -= 1; |
---|
402 | 415 | if (materialdepth > 0) |
---|
403 | 416 | { |
---|
404 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
405 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 417 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 418 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
406 | 419 | } |
---|
407 | 420 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
408 | 421 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
422 | 435 | materialdepth -= 1; |
---|
423 | 436 | if (materialdepth > 0) |
---|
424 | 437 | { |
---|
425 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
426 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 438 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 439 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
427 | 440 | } |
---|
428 | 441 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
429 | 442 | //else |
---|
.. | .. |
---|
464 | 477 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 478 | { |
---|
466 | 479 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 480 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0) |
---|
| 481 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 482 | + ; |
---|
468 | 483 | if (!hasnorm) |
---|
469 | 484 | { |
---|
470 | | - // System.out.println("FUCK!!"); |
---|
| 485 | + // System.out.println("Mesh normal"); |
---|
471 | 486 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
472 | 487 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
473 | 488 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1192 | 1207 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1193 | 1208 | } |
---|
1194 | 1209 | } |
---|
| 1210 | + |
---|
1195 | 1211 | if (flipV) |
---|
1196 | 1212 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1197 | 1213 | else |
---|
1198 | 1214 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1215 | + |
---|
1199 | 1216 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1200 | 1217 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1201 | 1218 | |
---|
.. | .. |
---|
1215 | 1232 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1216 | 1233 | } |
---|
1217 | 1234 | } |
---|
| 1235 | + |
---|
1218 | 1236 | if (flipV) |
---|
1219 | 1237 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1220 | 1238 | else |
---|
1221 | 1239 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1240 | + |
---|
1222 | 1241 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1223 | 1242 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1224 | 1243 | |
---|
.. | .. |
---|
1246 | 1265 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1247 | 1266 | else |
---|
1248 | 1267 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1268 | + |
---|
1249 | 1269 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1250 | 1270 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1271 | + |
---|
1251 | 1272 | count2 += 2; |
---|
1252 | 1273 | count3 += 3; |
---|
1253 | 1274 | } |
---|
.. | .. |
---|
1603 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1604 | 1625 | } |
---|
1605 | 1626 | |
---|
1606 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1607 | 1628 | { |
---|
1608 | 1629 | CameraPane display = this; |
---|
1609 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1638 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1639 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1640 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1641 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1642 | 1663 | |
---|
1643 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1644 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1746 | 1767 | display.modelParams7[2] = 0; |
---|
1747 | 1768 | display.modelParams7[3] = 0; |
---|
1748 | 1769 | |
---|
1749 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1750 | 1771 | |
---|
1751 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1752 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1753 | 1774 | { |
---|
1754 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
2044 | 2065 | //System.err.println("Oeil on"); |
---|
2045 | 2066 | OEIL = true; |
---|
2046 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2047 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2048 | 2069 | //pingthread.StepToTarget(true); |
---|
2049 | 2070 | } |
---|
2050 | 2071 | |
---|
.. | .. |
---|
2259 | 2280 | |
---|
2260 | 2281 | void ToggleDebug() |
---|
2261 | 2282 | { |
---|
2262 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2263 | 2284 | } |
---|
2264 | 2285 | |
---|
2265 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
2277 | 2298 | HANDLES ^= true; |
---|
2278 | 2299 | } |
---|
2279 | 2300 | |
---|
| 2301 | + Object3D paintFolder; |
---|
| 2302 | + |
---|
2280 | 2303 | void TogglePaint() |
---|
2281 | 2304 | { |
---|
2282 | 2305 | PAINTMODE ^= true; |
---|
2283 | 2306 | paintcount = 0; |
---|
| 2307 | + |
---|
| 2308 | + if (PAINTMODE) |
---|
| 2309 | + { |
---|
| 2310 | + paintFolder = GetFolder(); |
---|
| 2311 | + } |
---|
2284 | 2312 | } |
---|
2285 | 2313 | |
---|
2286 | 2314 | void SwapCamera(int a, int b) |
---|
.. | .. |
---|
2394 | 2422 | /**/ |
---|
2395 | 2423 | |
---|
2396 | 2424 | // TEXTURE static Texture texture; |
---|
2397 | | - static public java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/> textures |
---|
2398 | | - = new java.util.Hashtable<String, CacheTexture/*com.sun.opengl.util.texture.Texture*/>(); |
---|
2399 | | - 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 | + |
---|
2400 | 2429 | int pigmentdepth = 0; |
---|
2401 | 2430 | public com.sun.opengl.util.texture.Texture[] pigmentstack = new com.sun.opengl.util.texture.Texture[65536]; |
---|
2402 | 2431 | int bumpdepth = 0; |
---|
.. | .. |
---|
2418 | 2447 | true, |
---|
2419 | 2448 | com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2420 | 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) |
---|
2421 | 2477 | { |
---|
2422 | 2478 | throw new javax.media.opengl.GLException(e); |
---|
2423 | 2479 | } |
---|
.. | .. |
---|
3504 | 3560 | |
---|
3505 | 3561 | System.out.println("LOADING TEXTURE : " + name); |
---|
3506 | 3562 | |
---|
| 3563 | + Object x = texturedata.getMipmapData(); // .getBuffer(); |
---|
| 3564 | + |
---|
3507 | 3565 | // |
---|
3508 | 3566 | if (false) // compressbit > 0) |
---|
3509 | 3567 | { |
---|
.. | .. |
---|
7902 | 7960 | String pigment = Object3D.GetPigment(tex); |
---|
7903 | 7961 | String bump = Object3D.GetBump(tex); |
---|
7904 | 7962 | |
---|
7905 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7963 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7906 | 7964 | { |
---|
7907 | 7965 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7908 | 7966 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7936 | 7994 | |
---|
7937 | 7995 | String pigment = Object3D.GetPigment(tex); |
---|
7938 | 7996 | |
---|
7939 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7940 | 7998 | { |
---|
7941 | 7999 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7942 | 8000 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7965 | 8023 | |
---|
7966 | 8024 | String bump = Object3D.GetBump(tex); |
---|
7967 | 8025 | |
---|
7968 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8026 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7969 | 8027 | { |
---|
7970 | 8028 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7971 | 8029 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8084 | 8142 | |
---|
8085 | 8143 | /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
8086 | 8144 | { |
---|
8087 | | - if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
8088 | | - ambientOcclusion ) // || !textureon) |
---|
8089 | | - { |
---|
8090 | | - return; // false; |
---|
8091 | | - } |
---|
8092 | | - |
---|
8093 | | - if (tex == null) |
---|
8094 | | - { |
---|
8095 | | - BindTexture(null,false,resolution); |
---|
8096 | | - BindTexture(null,true,resolution); |
---|
8097 | | - return; |
---|
8098 | | - } |
---|
| 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; |
---|
8099 | 8186 | |
---|
8100 | | - String pigment = Object3D.GetPigment(tex); |
---|
8101 | | - String bump = Object3D.GetBump(tex); |
---|
8102 | | - |
---|
8103 | | - usedtextures.put(pigment, pigment); |
---|
8104 | | - usedtextures.put(bump, bump); |
---|
8105 | | - |
---|
8106 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8107 | | - { |
---|
8108 | | - // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8109 | | - // System.out.println("; bump = " + bump); |
---|
8110 | | - } |
---|
8111 | | - |
---|
8112 | | - if (bump.equals("")) |
---|
8113 | | - { |
---|
8114 | | - bump = null; |
---|
8115 | | - } |
---|
8116 | | - if (pigment.equals("")) |
---|
8117 | | - { |
---|
8118 | | - pigment = null; |
---|
8119 | | - } |
---|
8120 | | - |
---|
8121 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8122 | | - BindTexture(pigment, false, resolution); |
---|
8123 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8124 | | - BindTexture(bump, true, resolution); |
---|
8125 | | - GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8126 | | - |
---|
8127 | | - return; // true; |
---|
| 8187 | + BindPigmentTexture(tex, resolution); |
---|
| 8188 | + BindBumpTexture(tex, resolution); |
---|
8128 | 8189 | } |
---|
8129 | 8190 | |
---|
8130 | 8191 | /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8137 | 8198 | |
---|
8138 | 8199 | if (tex == null) |
---|
8139 | 8200 | { |
---|
8140 | | - BindTexture(null,false,resolution); |
---|
| 8201 | + BindTexture(null, null,false,resolution); |
---|
8141 | 8202 | return; |
---|
8142 | 8203 | } |
---|
8143 | 8204 | |
---|
8144 | 8205 | String pigment = Object3D.GetPigment(tex); |
---|
8145 | 8206 | |
---|
8146 | | - usedtextures.put(pigment, pigment); |
---|
| 8207 | + usedtextures.add(pigment); |
---|
8147 | 8208 | |
---|
8148 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8149 | 8210 | { |
---|
8150 | 8211 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8151 | 8212 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8157 | 8218 | } |
---|
8158 | 8219 | |
---|
8159 | 8220 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8160 | | - BindTexture(pigment, false, resolution); |
---|
| 8221 | + BindTexture(tex.pigmenttexture, pigment, false, resolution); |
---|
8161 | 8222 | } |
---|
8162 | 8223 | |
---|
8163 | 8224 | /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
.. | .. |
---|
8170 | 8231 | |
---|
8171 | 8232 | if (tex == null) |
---|
8172 | 8233 | { |
---|
8173 | | - BindTexture(null,true,resolution); |
---|
| 8234 | + BindTexture(null, null,true,resolution); |
---|
8174 | 8235 | return; |
---|
8175 | 8236 | } |
---|
8176 | 8237 | |
---|
8177 | 8238 | String bump = Object3D.GetBump(tex); |
---|
8178 | 8239 | |
---|
8179 | | - usedtextures.put(bump, bump); |
---|
| 8240 | + usedtextures.add(bump); |
---|
8180 | 8241 | |
---|
8181 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8242 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8182 | 8243 | { |
---|
8183 | 8244 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8184 | 8245 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8190 | 8251 | } |
---|
8191 | 8252 | |
---|
8192 | 8253 | GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
8193 | | - BindTexture(bump, true, resolution); |
---|
| 8254 | + BindTexture(tex.bumptexture, bump, true, resolution); |
---|
8194 | 8255 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8195 | 8256 | } |
---|
8196 | 8257 | |
---|
.. | .. |
---|
8214 | 8275 | return fileExists; |
---|
8215 | 8276 | } |
---|
8216 | 8277 | |
---|
8217 | | - CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8278 | + CacheTexture GetCacheTexture(java.awt.image.BufferedImage bim, String tex, boolean bump, int resolution) throws Exception |
---|
8218 | 8279 | { |
---|
8219 | | - CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; |
---|
| 8280 | + CacheTexture texturecache = null; |
---|
8220 | 8281 | |
---|
8221 | 8282 | if (tex != null) |
---|
8222 | 8283 | { |
---|
.. | .. |
---|
8236 | 8297 | } |
---|
8237 | 8298 | |
---|
8238 | 8299 | if (CACHETEXTURE) |
---|
8239 | | - texture = textures.get(texname); // TEXTURE CACHE |
---|
8240 | | - |
---|
8241 | | - TextureData texturedata = null; |
---|
8242 | | - |
---|
8243 | | - if (texture == null || texture.resolution < resolution) |
---|
8244 | 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 |
---|
8245 | 8316 | if (tex.equals("DEFAULT_TEXTURE")) // ||*/ tex.equals("")) |
---|
8246 | 8317 | { |
---|
8247 | 8318 | assert(!bump); |
---|
.. | .. |
---|
8253 | 8324 | // } |
---|
8254 | 8325 | // else |
---|
8255 | 8326 | // { |
---|
8256 | | - texture = textures.get(tex); |
---|
8257 | | - if (texture == null) |
---|
| 8327 | + texturecache = textures.get(tex); |
---|
| 8328 | + if (texturecache == null) |
---|
8258 | 8329 | { |
---|
8259 | | - texture = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
| 8330 | + texturecache = new CacheTexture(GetResourceTexture("default.png", bump),resolution); |
---|
8260 | 8331 | } |
---|
8261 | 8332 | // } |
---|
8262 | 8333 | } else |
---|
8263 | 8334 | if (tex.equals("DEFAULT_TEXTURE_BUMP")) // ||*/ tex.equals("")) |
---|
8264 | 8335 | { |
---|
8265 | 8336 | assert(bump); |
---|
8266 | | - texture = textures.get(tex); |
---|
8267 | | - if (texture == null) |
---|
8268 | | - 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); |
---|
8269 | 8340 | } else |
---|
8270 | 8341 | { |
---|
8271 | 8342 | //if (tex.equals("IMMORTAL")) |
---|
.. | .. |
---|
8275 | 8346 | //{ |
---|
8276 | 8347 | if (tex.equals("WHITE_NOISE")) |
---|
8277 | 8348 | { |
---|
8278 | | - texture = textures.get(tex); |
---|
8279 | | - if (texture == null) |
---|
8280 | | - 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); |
---|
8281 | 8352 | } else |
---|
8282 | 8353 | { |
---|
8283 | 8354 | if (textureon) |
---|
.. | .. |
---|
8336 | 8407 | if (texturedata == null) |
---|
8337 | 8408 | throw new Exception(); |
---|
8338 | 8409 | |
---|
8339 | | - texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
| 8410 | + texturecache = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution); |
---|
8340 | 8411 | //texture = GetTexture(tex, bump); |
---|
8341 | 8412 | } |
---|
8342 | 8413 | } |
---|
8343 | 8414 | //} |
---|
8344 | 8415 | } |
---|
8345 | 8416 | |
---|
8346 | | - if (/*CACHETEXTURE &&*/ texture != null && textureon) |
---|
| 8417 | + if (/*CACHETEXTURE &&*/ texturecache != null && textureon) |
---|
8347 | 8418 | { |
---|
8348 | 8419 | //return false; |
---|
8349 | 8420 | |
---|
8350 | 8421 | // System.out.println("CACHE +++++++++++++++ TEXTURE : " + texname + " (" + texture.getEstimatedMemorySize() + ")"); |
---|
8351 | | - if (texturedata != null && (texname.endsWith(".jpg") || texname.endsWith(".JPG"))) |
---|
| 8422 | + if (texturedata != null && texname.toLowerCase().endsWith(".jpg")) |
---|
8352 | 8423 | { |
---|
8353 | 8424 | // String ext = "_highres"; |
---|
8354 | 8425 | // if (REDUCETEXTURE) |
---|
.. | .. |
---|
8437 | 8508 | textures.remove(texname); |
---|
8438 | 8509 | } |
---|
8439 | 8510 | |
---|
8440 | | - texture.texturedata = texturedata; |
---|
8441 | | - textures.put(texname, texture); |
---|
| 8511 | + //texture.texturedata = texturedata; |
---|
| 8512 | + textures.put(texname, texturecache); |
---|
8442 | 8513 | |
---|
8443 | 8514 | // newtex = true; |
---|
8444 | 8515 | } |
---|
.. | .. |
---|
8454 | 8525 | } |
---|
8455 | 8526 | } |
---|
8456 | 8527 | |
---|
8457 | | - return texture; |
---|
| 8528 | + return texturecache; |
---|
8458 | 8529 | } |
---|
8459 | 8530 | |
---|
8460 | | - com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8531 | + com.sun.opengl.util.texture.Texture GetTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8461 | 8532 | { |
---|
8462 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8533 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8463 | 8534 | |
---|
8464 | 8535 | if (bump) |
---|
8465 | 8536 | { |
---|
.. | .. |
---|
8475 | 8546 | return texture!=null?texture.texture:null; |
---|
8476 | 8547 | } |
---|
8477 | 8548 | |
---|
8478 | | - public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception |
---|
| 8549 | + public com.sun.opengl.util.texture.TextureData GetTextureData(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8479 | 8550 | { |
---|
8480 | | - CacheTexture texture = GetCacheTexture(tex, bump, resolution); |
---|
| 8551 | + CacheTexture texture = GetCacheTexture(stream, tex, bump, resolution); |
---|
8481 | 8552 | |
---|
8482 | 8553 | return texture!=null?texture.texturedata:null; |
---|
8483 | 8554 | } |
---|
8484 | 8555 | |
---|
8485 | | - boolean BindTexture(String tex, boolean bump, int resolution) throws Exception |
---|
| 8556 | + boolean BindTexture(java.awt.image.BufferedImage stream, String tex, boolean bump, int resolution) throws Exception |
---|
8486 | 8557 | { |
---|
8487 | 8558 | if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
8488 | 8559 | { |
---|
8489 | 8560 | return false; |
---|
8490 | 8561 | } |
---|
8491 | 8562 | |
---|
8492 | | - boolean newtex = false; |
---|
| 8563 | + //boolean newtex = false; |
---|
8493 | 8564 | |
---|
8494 | | - com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
| 8565 | + com.sun.opengl.util.texture.Texture texture = GetTexture(stream, tex, bump, resolution); |
---|
8495 | 8566 | |
---|
8496 | 8567 | if (texture == null) |
---|
8497 | 8568 | return false; |
---|
.. | .. |
---|
8521 | 8592 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8522 | 8593 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8523 | 8594 | |
---|
8524 | | - return newtex; |
---|
| 8595 | + return true; // Warning: not used. |
---|
8525 | 8596 | } |
---|
8526 | 8597 | |
---|
8527 | 8598 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9359 | 9430 | jy8[3] = 0.5f; |
---|
9360 | 9431 | } |
---|
9361 | 9432 | |
---|
9362 | | - 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 |
---|
9363 | 9434 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9364 | 9435 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9365 | 9436 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9366 | 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 | + |
---|
9367 | 9462 | static int imagecount = 0; // movie generation |
---|
9368 | 9463 | |
---|
9369 | 9464 | static int jitter = 0; |
---|
.. | .. |
---|
10474 | 10569 | ANTIALIAS = 0; |
---|
10475 | 10570 | //System.out.println("RESTART"); |
---|
10476 | 10571 | AAtimer.restart(); |
---|
| 10572 | + Globals.TIMERRUNNING = true; |
---|
10477 | 10573 | } |
---|
10478 | 10574 | } |
---|
10479 | 10575 | } |
---|
.. | .. |
---|
10541 | 10637 | ambientOcclusion = false; |
---|
10542 | 10638 | } |
---|
10543 | 10639 | |
---|
10544 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10640 | + if (//Globals.lighttouched && |
---|
| 10641 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10545 | 10642 | { |
---|
10546 | 10643 | //if (RENDERSHADOW) // ? |
---|
10547 | 10644 | if (!IsFrozen()) |
---|
.. | .. |
---|
10952 | 11049 | |
---|
10953 | 11050 | try |
---|
10954 | 11051 | { |
---|
10955 | | - BindTexture(NOISE_TEXTURE, false, 2); |
---|
| 11052 | + BindTexture(null, NOISE_TEXTURE, false, 2); |
---|
10956 | 11053 | } |
---|
10957 | 11054 | catch (Exception e) |
---|
10958 | 11055 | { |
---|
.. | .. |
---|
10981 | 11078 | |
---|
10982 | 11079 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10983 | 11080 | |
---|
10984 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10985 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10986 | | -//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); |
---|
10987 | 11084 | } else |
---|
10988 | 11085 | { |
---|
10989 | 11086 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10994 | 11091 | //System.out.println("BLENDING ON"); |
---|
10995 | 11092 | gl.glEnable(GL.GL_BLEND); |
---|
10996 | 11093 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10997 | | - |
---|
| 11094 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10998 | 11095 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10999 | 11096 | gl.glLoadIdentity(); |
---|
11000 | 11097 | |
---|
.. | .. |
---|
11451 | 11548 | |
---|
11452 | 11549 | static boolean zoomonce = false; |
---|
11453 | 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 | + |
---|
11454 | 11569 | void DrawObject(GL gl, boolean draw) |
---|
11455 | 11570 | { |
---|
| 11571 | + // To clear camera values |
---|
| 11572 | + ResetOptions(); |
---|
| 11573 | + |
---|
11456 | 11574 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11457 | 11575 | // DrawMode() = SELECTION; |
---|
11458 | 11576 | //GL gl = getGL(); |
---|
11459 | 11577 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11460 | 11578 | { |
---|
11461 | 11579 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11462 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11580 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11463 | 11581 | pingthread.StepToTarget(true); // true); |
---|
11464 | 11582 | // zoomonce = false; |
---|
11465 | 11583 | } |
---|
.. | .. |
---|
11531 | 11649 | |
---|
11532 | 11650 | if (DrawMode() == DEFAULT) |
---|
11533 | 11651 | { |
---|
11534 | | - if (DEBUG) |
---|
| 11652 | + if (Globals.DEBUG) |
---|
11535 | 11653 | { |
---|
| 11654 | + CreateSelectedPoint(); |
---|
11536 | 11655 | float radius = 0.05f; |
---|
11537 | 11656 | if (selectedpoint.radius != radius) |
---|
11538 | 11657 | { |
---|
.. | .. |
---|
11595 | 11714 | if (tex.equals("WHITE_NOISE")) |
---|
11596 | 11715 | continue; |
---|
11597 | 11716 | |
---|
11598 | | - if (!usedtextures.containsKey(tex)) |
---|
| 11717 | + if (!usedtextures.contains(tex)) |
---|
11599 | 11718 | { |
---|
11600 | 11719 | // System.out.println("DISPOSE +++++++++++++++ " + tex); |
---|
11601 | 11720 | textures.get(tex).texture.dispose(); |
---|
.. | .. |
---|
12019 | 12138 | for (int i = tp.size(); --i >= 0;) |
---|
12020 | 12139 | { |
---|
12021 | 12140 | //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
12022 | | - LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
| 12141 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
12023 | 12142 | } |
---|
12024 | 12143 | |
---|
12025 | 12144 | |
---|
.. | .. |
---|
13289 | 13408 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13290 | 13409 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13291 | 13410 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13292 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13411 | + |
---|
| 13412 | + //Object3D.cVector2[] vector2buffer; |
---|
13293 | 13413 | |
---|
13294 | 13414 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13295 | 13415 | // OUT : diff, spec |
---|
.. | .. |
---|
13305 | 13425 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13306 | 13426 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13307 | 13427 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13308 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13309 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13310 | | - //"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 |
---|
13311 | 13432 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13312 | 13433 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13313 | 13434 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13812 | 13933 | else |
---|
13813 | 13934 | if (evt.getSource() == AAtimer) |
---|
13814 | 13935 | { |
---|
| 13936 | + Globals.TIMERRUNNING = false; |
---|
13815 | 13937 | if (mouseDown) |
---|
13816 | 13938 | { |
---|
13817 | 13939 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13871 | 13993 | |
---|
13872 | 13994 | // fev 2014??? |
---|
13873 | 13995 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13874 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13996 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13875 | 13997 | pingthread.StepToTarget(true); // true); |
---|
13876 | 13998 | } |
---|
13877 | 13999 | // if (!LIVE) |
---|
.. | .. |
---|
13886 | 14008 | return; |
---|
13887 | 14009 | |
---|
13888 | 14010 | AAtimer.restart(); // |
---|
| 14011 | + Globals.TIMERRUNNING = true; |
---|
13889 | 14012 | |
---|
13890 | 14013 | // waslive = LIVE; |
---|
13891 | 14014 | // LIVE = false; |
---|
.. | .. |
---|
14224 | 14347 | void GoDown(int mod) |
---|
14225 | 14348 | { |
---|
14226 | 14349 | MODIFIERS |= COMMAND; |
---|
14227 | | - /* |
---|
| 14350 | + /**/ |
---|
14228 | 14351 | if((mod&SHIFT) == SHIFT) |
---|
14229 | 14352 | manipCamera.RotatePosition(0, -speed); |
---|
14230 | 14353 | else |
---|
14231 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14232 | | - */ |
---|
| 14354 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14355 | + /**/ |
---|
14233 | 14356 | if ((mod & SHIFT) == SHIFT) |
---|
14234 | 14357 | { |
---|
14235 | 14358 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14245 | 14368 | void GoUp(int mod) |
---|
14246 | 14369 | { |
---|
14247 | 14370 | MODIFIERS |= COMMAND; |
---|
14248 | | - /* |
---|
| 14371 | + /**/ |
---|
14249 | 14372 | if((mod&SHIFT) == SHIFT) |
---|
14250 | 14373 | manipCamera.RotatePosition(0, speed); |
---|
14251 | 14374 | else |
---|
14252 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14253 | | - */ |
---|
| 14375 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14376 | + /**/ |
---|
14254 | 14377 | if ((mod & SHIFT) == SHIFT) |
---|
14255 | 14378 | { |
---|
14256 | 14379 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14266 | 14389 | void GoLeft(int mod) |
---|
14267 | 14390 | { |
---|
14268 | 14391 | MODIFIERS |= COMMAND; |
---|
14269 | | - /* |
---|
| 14392 | + /**/ |
---|
14270 | 14393 | if((mod&SHIFT) == SHIFT) |
---|
14271 | | - manipCamera.RotatePosition(speed, 0); |
---|
14272 | | - else |
---|
14273 | 14394 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14274 | | - */ |
---|
| 14395 | + else |
---|
| 14396 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14397 | + /**/ |
---|
14275 | 14398 | if ((mod & SHIFT) == SHIFT) |
---|
14276 | 14399 | { |
---|
14277 | 14400 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14287 | 14410 | void GoRight(int mod) |
---|
14288 | 14411 | { |
---|
14289 | 14412 | MODIFIERS |= COMMAND; |
---|
14290 | | - /* |
---|
| 14413 | + /**/ |
---|
14291 | 14414 | if((mod&SHIFT) == SHIFT) |
---|
14292 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14293 | | - else |
---|
14294 | 14415 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14295 | | - */ |
---|
| 14416 | + else |
---|
| 14417 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14418 | + /**/ |
---|
14296 | 14419 | if ((mod & SHIFT) == SHIFT) |
---|
14297 | 14420 | { |
---|
14298 | 14421 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14349 | 14472 | info.camera = renderCamera; |
---|
14350 | 14473 | info.x = x; |
---|
14351 | 14474 | info.y = y; |
---|
14352 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14475 | + object.GetWindow().copy |
---|
| 14476 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14353 | 14477 | } else |
---|
14354 | 14478 | { |
---|
14355 | 14479 | if (x < startX) |
---|
.. | .. |
---|
14513 | 14637 | ci.camera = renderCamera; |
---|
14514 | 14638 | if (!isRenderer) |
---|
14515 | 14639 | { |
---|
14516 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14640 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14641 | + //Object3D copy = editWindow.copy; |
---|
| 14642 | + if (object.doEditClick(ci, 0)) |
---|
14517 | 14643 | { |
---|
14518 | 14644 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14519 | 14645 | } else |
---|
.. | .. |
---|
14528 | 14654 | Globals.MOUSEDRAGGED = false; |
---|
14529 | 14655 | |
---|
14530 | 14656 | movingcamera = false; |
---|
14531 | | - X = Y = 0; |
---|
| 14657 | + X = 0; // getBounds().width/2; |
---|
| 14658 | + Y = 0; // getBounds().height/2; |
---|
14532 | 14659 | //System.out.println("mouseReleased: " + e); |
---|
14533 | 14660 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14534 | 14661 | } |
---|
.. | .. |
---|
14869 | 14996 | case 'E' : COMPACT ^= true; |
---|
14870 | 14997 | repaint(); |
---|
14871 | 14998 | break; |
---|
14872 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14999 | + case 'W' : // Wide Window (fullscreen) |
---|
| 15000 | + //DEBUGHSB ^= true; |
---|
| 15001 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14873 | 15002 | repaint(); |
---|
14874 | 15003 | break; |
---|
14875 | 15004 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14894 | 15023 | RevertCamera(); |
---|
14895 | 15024 | repaint(); |
---|
14896 | 15025 | break; |
---|
14897 | | - case 'L': |
---|
14898 | 15026 | case 'l': |
---|
| 15027 | + //case 'L': |
---|
14899 | 15028 | if (lightMode) |
---|
14900 | 15029 | { |
---|
14901 | 15030 | lightMode = false; |
---|
.. | .. |
---|
15038 | 15167 | case '_': |
---|
15039 | 15168 | kompactbit = 5; |
---|
15040 | 15169 | break; |
---|
15041 | | - case '+': |
---|
15042 | | - kompactbit = 6; |
---|
15043 | | - break; |
---|
| 15170 | +// case '+': |
---|
| 15171 | +// kompactbit = 6; |
---|
| 15172 | +// break; |
---|
15044 | 15173 | case ' ': |
---|
15045 | 15174 | lightMode ^= true; |
---|
15046 | 15175 | Globals.lighttouched = true; |
---|
.. | .. |
---|
15052 | 15181 | case ESC: |
---|
15053 | 15182 | RENDERPROGRAM += 1; |
---|
15054 | 15183 | RENDERPROGRAM %= 3; |
---|
| 15184 | + |
---|
15055 | 15185 | repaint(); |
---|
15056 | 15186 | break; |
---|
15057 | 15187 | case 'Z': |
---|
.. | .. |
---|
15091 | 15221 | case DELETE: |
---|
15092 | 15222 | ClearSelection(); |
---|
15093 | 15223 | break; |
---|
15094 | | - /* |
---|
15095 | 15224 | case '+': |
---|
| 15225 | + |
---|
| 15226 | + /* |
---|
15096 | 15227 | //fontsize += 1; |
---|
15097 | 15228 | bbzoom *= 2; |
---|
15098 | 15229 | repaint(); |
---|
.. | .. |
---|
15109 | 15240 | case '=': |
---|
15110 | 15241 | IncDepth(); |
---|
15111 | 15242 | //fontsize += 1; |
---|
15112 | | - object.editWindow.refreshContents(true); |
---|
| 15243 | + object.GetWindow().refreshContents(true); |
---|
15113 | 15244 | maskbit = 6; |
---|
15114 | 15245 | break; |
---|
15115 | 15246 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
15116 | 15247 | DecDepth(); |
---|
15117 | 15248 | maskbit = 5; |
---|
15118 | 15249 | //if(fontsize > 1) fontsize -= 1; |
---|
15119 | | - if (object.editWindow == null) |
---|
15120 | | - new Exception().printStackTrace(); |
---|
15121 | | - else |
---|
15122 | | - object.editWindow.refreshContents(true); |
---|
| 15250 | +// if (object.editWindow == null) |
---|
| 15251 | +// new Exception().printStackTrace(); |
---|
| 15252 | +// else |
---|
| 15253 | + object.GetWindow().refreshContents(true); |
---|
15123 | 15254 | break; |
---|
15124 | 15255 | case '{': |
---|
15125 | 15256 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15343 | 15474 | } |
---|
15344 | 15475 | */ |
---|
15345 | 15476 | |
---|
15346 | | - object.editWindow.EditSelection(); |
---|
| 15477 | + object.GetWindow().EditSelection(false); |
---|
15347 | 15478 | } |
---|
15348 | 15479 | |
---|
15349 | 15480 | void SelectParent() |
---|
.. | .. |
---|
15360 | 15491 | { |
---|
15361 | 15492 | //selectees.remove(i); |
---|
15362 | 15493 | System.out.println("select parent of " + elem); |
---|
15363 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15494 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15364 | 15495 | } else |
---|
15365 | 15496 | { |
---|
15366 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15497 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15367 | 15498 | } |
---|
15368 | 15499 | |
---|
15369 | 15500 | first = false; |
---|
.. | .. |
---|
15405 | 15536 | for (int j = 0; j < group.children.size(); j++) |
---|
15406 | 15537 | { |
---|
15407 | 15538 | elem = (Object3D) group.children.elementAt(j); |
---|
15408 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15539 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15409 | 15540 | first = false; |
---|
15410 | 15541 | } |
---|
15411 | 15542 | } else |
---|
15412 | 15543 | { |
---|
15413 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15544 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15414 | 15545 | } |
---|
15415 | 15546 | |
---|
15416 | 15547 | first = false; |
---|
.. | .. |
---|
15421 | 15552 | { |
---|
15422 | 15553 | //Composite group = (Composite) object; |
---|
15423 | 15554 | Object3D group = object; |
---|
15424 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15555 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15425 | 15556 | } |
---|
15426 | 15557 | |
---|
15427 | 15558 | void ResetTransform(int mask) |
---|
15428 | 15559 | { |
---|
15429 | 15560 | //Composite group = (Composite) object; |
---|
15430 | 15561 | Object3D group = object; |
---|
15431 | | - group.editWindow.ResetTransform(mask); |
---|
| 15562 | + group.GetWindow().ResetTransform(mask); |
---|
15432 | 15563 | } |
---|
15433 | 15564 | |
---|
15434 | 15565 | void FlipTransform() |
---|
15435 | 15566 | { |
---|
15436 | 15567 | //Composite group = (Composite) object; |
---|
15437 | 15568 | Object3D group = object; |
---|
15438 | | - group.editWindow.FlipTransform(); |
---|
| 15569 | + group.GetWindow().FlipTransform(); |
---|
15439 | 15570 | // group.editWindow.ReduceMesh(true); |
---|
15440 | 15571 | } |
---|
15441 | 15572 | |
---|
.. | .. |
---|
15443 | 15574 | { |
---|
15444 | 15575 | //Composite group = (Composite) object; |
---|
15445 | 15576 | Object3D group = object; |
---|
15446 | | - group.editWindow.PrintMemory(); |
---|
| 15577 | + group.GetWindow().PrintMemory(); |
---|
15447 | 15578 | // group.editWindow.ReduceMesh(true); |
---|
15448 | 15579 | } |
---|
15449 | 15580 | |
---|
.. | .. |
---|
15451 | 15582 | { |
---|
15452 | 15583 | //Composite group = (Composite) object; |
---|
15453 | 15584 | Object3D group = object; |
---|
15454 | | - group.editWindow.ResetCentroid(); |
---|
| 15585 | + group.GetWindow().ResetCentroid(); |
---|
15455 | 15586 | } |
---|
15456 | 15587 | |
---|
15457 | 15588 | void IncDepth() |
---|
.. | .. |
---|
15627 | 15758 | info.bounds.y += (height - desired) / 2; |
---|
15628 | 15759 | } |
---|
15629 | 15760 | } |
---|
| 15761 | + |
---|
15630 | 15762 | info.g = gr; |
---|
15631 | 15763 | info.camera = renderCamera; |
---|
15632 | 15764 | /* |
---|
.. | .. |
---|
15636 | 15768 | */ |
---|
15637 | 15769 | if (!isRenderer) |
---|
15638 | 15770 | { |
---|
15639 | | - object.drawEditHandles(info, 0); |
---|
15640 | | - |
---|
15641 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15771 | + Grafreed.Assert(object != null); |
---|
| 15772 | + Grafreed.Assert(object.selection != null); |
---|
| 15773 | + if (object.selection.Size() > 0) |
---|
15642 | 15774 | { |
---|
15643 | | - switch (object.selection.get(0).hitSomething) |
---|
| 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) |
---|
15644 | 15781 | { |
---|
15645 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
15646 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15647 | | - break; |
---|
15648 | | - case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
15649 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15650 | | - break; |
---|
15651 | | - case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
15652 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15653 | | - break; |
---|
| 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; |
---|
15654 | 15789 | } |
---|
15655 | | - |
---|
| 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 | + } |
---|
15656 | 15809 | } |
---|
15657 | 15810 | } |
---|
15658 | 15811 | } |
---|
.. | .. |
---|
16355 | 16508 | cStatic.objectstack[materialdepth++] = checker; |
---|
16356 | 16509 | //System.out.println("material " + material); |
---|
16357 | 16510 | //Applet3D.tracein(this, selected); |
---|
16358 | | - vector2buffer = checker.projectedVertices; |
---|
| 16511 | + //vector2buffer = checker.projectedVertices; |
---|
16359 | 16512 | |
---|
16360 | 16513 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16361 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16514 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16362 | 16515 | |
---|
16363 | 16516 | materialdepth -= 1; |
---|
16364 | 16517 | if (materialdepth > 0) |
---|
16365 | 16518 | { |
---|
16366 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16367 | | - 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); |
---|
16368 | 16521 | } |
---|
16369 | 16522 | //checker.GetMaterial().opacity = 1f; |
---|
16370 | 16523 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16450 | 16603 | } |
---|
16451 | 16604 | } |
---|
16452 | 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 | + |
---|
16453 | 16614 | class SelectBuffer implements GLEventListener |
---|
16454 | 16615 | { |
---|
16455 | 16616 | |
---|
.. | .. |
---|
16529 | 16690 | |
---|
16530 | 16691 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16531 | 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 | + |
---|
16532 | 16704 | //int tmp = selection_view; |
---|
16533 | 16705 | //selection_view = -1; |
---|
16534 | 16706 | int temp = DrawMode(); |
---|
.. | .. |
---|
16540 | 16712 | // temp = DEFAULT; // patch for selection debug |
---|
16541 | 16713 | Globals.drawMode = temp; // WARNING |
---|
16542 | 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 | + |
---|
16543 | 16726 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16544 | 16727 | |
---|
16545 | 16728 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16587 | 16770 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16588 | 16771 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16589 | 16772 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16773 | + |
---|
| 16774 | + CreateSelectedPoint(); |
---|
16590 | 16775 | |
---|
16591 | 16776 | // Will fit the mesh !!! |
---|
16592 | 16777 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16641 | 16826 | } |
---|
16642 | 16827 | |
---|
16643 | 16828 | if (!movingcamera && !PAINTMODE) |
---|
16644 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16829 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16645 | 16830 | |
---|
16646 | | - 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) |
---|
16647 | 16832 | { |
---|
16648 | | - 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); |
---|
16649 | 16834 | |
---|
16650 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16835 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16836 | + { |
---|
| 16837 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16651 | 16838 | |
---|
16652 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16653 | | - |
---|
16654 | | - group.add(paintobj); // link |
---|
16655 | | - |
---|
16656 | | - object.editWindow.SnapObject(group); |
---|
16657 | | - |
---|
16658 | | - Object3D folder = object.editWindow.copy; |
---|
16659 | | - |
---|
16660 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16661 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16662 | | - |
---|
16663 | | - folder.add(group); |
---|
16664 | | - |
---|
16665 | | - object.editWindow.ResetModel(); |
---|
16666 | | - 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 | + } |
---|
16667 | 16854 | } |
---|
16668 | 16855 | else |
---|
16669 | 16856 | paintcount = 0; |
---|
.. | .. |
---|
16702 | 16889 | //System.out.println("objects[color] = " + objects[color]); |
---|
16703 | 16890 | //objects[color].Select(); |
---|
16704 | 16891 | indexcount = 0; |
---|
| 16892 | + ObjEditor window = object.GetWindow(); |
---|
| 16893 | + if (window != null && deselect) |
---|
| 16894 | + { |
---|
| 16895 | + window.Select(null, deselect, true); |
---|
| 16896 | + } |
---|
16705 | 16897 | object.Select(color, deselect); |
---|
16706 | 16898 | } |
---|
16707 | 16899 | |
---|
.. | .. |
---|
17227 | 17419 | int AAbuffersize = 0; |
---|
17228 | 17420 | |
---|
17229 | 17421 | //double[] selectedpoint = new double[3]; |
---|
17230 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17422 | + static Superellipsoid selectedpoint; |
---|
17231 | 17423 | static Sphere previousselectedpoint = null; |
---|
17232 | | - static Sphere debugpointG = new Sphere(); |
---|
17233 | | - static Sphere debugpointP = new Sphere(); |
---|
17234 | | - static Sphere debugpointC = new Sphere(); |
---|
17235 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17424 | + static Sphere debugpointG; |
---|
| 17425 | + static Sphere debugpointP; |
---|
| 17426 | + static Sphere debugpointC; |
---|
| 17427 | + static Sphere debugpointR; |
---|
17236 | 17428 | |
---|
17237 | 17429 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17238 | 17430 | |
---|
17239 | | - static |
---|
17240 | | - { |
---|
17241 | | - for (int i=0; i<8; i++) |
---|
17242 | | - { |
---|
17243 | | - debugpoints[i] = new Sphere(); |
---|
17244 | | - } |
---|
17245 | | - } |
---|
17246 | | - |
---|
17247 | 17431 | static void InitPoints(float radius) |
---|
17248 | 17432 | { |
---|
17249 | 17433 | for (int i=0; i<8; i++) |
---|