.. | .. |
---|
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 |
---|
.. | .. |
---|
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 |
---|
.. | .. |
---|
1890 | 1911 | void PushMatrix(double[][] matrix) |
---|
1891 | 1912 | { |
---|
1892 | 1913 | // GrafreeD.tracein(matrix); |
---|
1893 | | - PushMatrix(matrix,1); |
---|
| 1914 | + PushMatrix(matrix, 1); |
---|
1894 | 1915 | } |
---|
1895 | 1916 | |
---|
1896 | 1917 | void PushMatrix() |
---|
.. | .. |
---|
2044 | 2065 | //System.err.println("Oeil on"); |
---|
2045 | 2066 | OEIL = true; |
---|
2046 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2047 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2048 | 2069 | //pingthread.StepToTarget(true); |
---|
2049 | 2070 | } |
---|
2050 | 2071 | |
---|
.. | .. |
---|
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) |
---|
.. | .. |
---|
7902 | 7930 | String pigment = Object3D.GetPigment(tex); |
---|
7903 | 7931 | String bump = Object3D.GetBump(tex); |
---|
7904 | 7932 | |
---|
7905 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7933 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
7906 | 7934 | { |
---|
7907 | 7935 | // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
7908 | 7936 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
7919 | 7947 | |
---|
7920 | 7948 | ReleaseTexture(bump, true); |
---|
7921 | 7949 | ReleaseTexture(pigment, false); |
---|
| 7950 | + } |
---|
| 7951 | + |
---|
| 7952 | + public void ReleasePigmentTexture(cTexture tex) // INTERFACE |
---|
| 7953 | + { |
---|
| 7954 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7955 | + { |
---|
| 7956 | + return; |
---|
| 7957 | + } |
---|
| 7958 | + |
---|
| 7959 | + if (tex == null) |
---|
| 7960 | + { |
---|
| 7961 | + ReleaseTexture(null, false); |
---|
| 7962 | + return; |
---|
| 7963 | + } |
---|
| 7964 | + |
---|
| 7965 | + String pigment = Object3D.GetPigment(tex); |
---|
| 7966 | + |
---|
| 7967 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7968 | + { |
---|
| 7969 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7970 | + // System.out.println("; bump = " + bump); |
---|
| 7971 | + } |
---|
| 7972 | + |
---|
| 7973 | + if (pigment.equals("")) |
---|
| 7974 | + { |
---|
| 7975 | + pigment = null; |
---|
| 7976 | + } |
---|
| 7977 | + |
---|
| 7978 | + ReleaseTexture(pigment, false); |
---|
| 7979 | + } |
---|
| 7980 | + |
---|
| 7981 | + public void ReleaseBumpTexture(cTexture tex) // INTERFACE |
---|
| 7982 | + { |
---|
| 7983 | + if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) |
---|
| 7984 | + { |
---|
| 7985 | + return; |
---|
| 7986 | + } |
---|
| 7987 | + |
---|
| 7988 | + if (tex == null) |
---|
| 7989 | + { |
---|
| 7990 | + ReleaseTexture(null, true); |
---|
| 7991 | + return; |
---|
| 7992 | + } |
---|
| 7993 | + |
---|
| 7994 | + String bump = Object3D.GetBump(tex); |
---|
| 7995 | + |
---|
| 7996 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 7997 | + { |
---|
| 7998 | + // System.out.print("RELEASE +++++++++++++++ pigment = " + pigment); |
---|
| 7999 | + // System.out.println("; bump = " + bump); |
---|
| 8000 | + } |
---|
| 8001 | + |
---|
| 8002 | + if (bump.equals("")) |
---|
| 8003 | + { |
---|
| 8004 | + bump = null; |
---|
| 8005 | + } |
---|
| 8006 | + |
---|
| 8007 | + ReleaseTexture(bump, true); |
---|
7922 | 8008 | } |
---|
7923 | 8009 | |
---|
7924 | 8010 | void ReleaseTexture(String tex, boolean bump) |
---|
.. | .. |
---|
8045 | 8131 | usedtextures.put(pigment, pigment); |
---|
8046 | 8132 | usedtextures.put(bump, bump); |
---|
8047 | 8133 | |
---|
8048 | | - if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8134 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
8049 | 8135 | { |
---|
8050 | 8136 | // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
8051 | 8137 | // System.out.println("; bump = " + bump); |
---|
.. | .. |
---|
8067 | 8153 | GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8068 | 8154 | |
---|
8069 | 8155 | return; // true; |
---|
| 8156 | + } |
---|
| 8157 | + |
---|
| 8158 | + /*boolean*/ public void BindPigmentTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8159 | + { |
---|
| 8160 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8161 | + ambientOcclusion ) // || !textureon) |
---|
| 8162 | + { |
---|
| 8163 | + return; // false; |
---|
| 8164 | + } |
---|
| 8165 | + |
---|
| 8166 | + if (tex == null) |
---|
| 8167 | + { |
---|
| 8168 | + BindTexture(null,false,resolution); |
---|
| 8169 | + return; |
---|
| 8170 | + } |
---|
| 8171 | + |
---|
| 8172 | + String pigment = Object3D.GetPigment(tex); |
---|
| 8173 | + |
---|
| 8174 | + usedtextures.put(pigment, pigment); |
---|
| 8175 | + |
---|
| 8176 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8177 | + { |
---|
| 8178 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8179 | + // System.out.println("; bump = " + bump); |
---|
| 8180 | + } |
---|
| 8181 | + |
---|
| 8182 | + if (pigment.equals("")) |
---|
| 8183 | + { |
---|
| 8184 | + pigment = null; |
---|
| 8185 | + } |
---|
| 8186 | + |
---|
| 8187 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
| 8188 | + BindTexture(pigment, false, resolution); |
---|
| 8189 | + } |
---|
| 8190 | + |
---|
| 8191 | + /*boolean*/ public void BindBumpTexture(cTexture tex, int resolution) throws Exception // INTERFACE |
---|
| 8192 | + { |
---|
| 8193 | + if (// DrawMode() != 0 || /*tex == null ||*/ |
---|
| 8194 | + ambientOcclusion ) // || !textureon) |
---|
| 8195 | + { |
---|
| 8196 | + return; // false; |
---|
| 8197 | + } |
---|
| 8198 | + |
---|
| 8199 | + if (tex == null) |
---|
| 8200 | + { |
---|
| 8201 | + BindTexture(null,true,resolution); |
---|
| 8202 | + return; |
---|
| 8203 | + } |
---|
| 8204 | + |
---|
| 8205 | + String bump = Object3D.GetBump(tex); |
---|
| 8206 | + |
---|
| 8207 | + usedtextures.put(bump, bump); |
---|
| 8208 | + |
---|
| 8209 | + //if (!tex.equals(":") && !tex.equals(DEFAULT_TEXTURES)) |
---|
| 8210 | + { |
---|
| 8211 | + // System.out.print("BIND +++++++++++++++ pigment = " + pigment); |
---|
| 8212 | + // System.out.println("; bump = " + bump); |
---|
| 8213 | + } |
---|
| 8214 | + |
---|
| 8215 | + if (bump.equals("")) |
---|
| 8216 | + { |
---|
| 8217 | + bump = null; |
---|
| 8218 | + } |
---|
| 8219 | + |
---|
| 8220 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE2); |
---|
| 8221 | + BindTexture(bump, true, resolution); |
---|
| 8222 | + GetGL().glActiveTexture(GetGL().GL_TEXTURE0); |
---|
8070 | 8223 | } |
---|
8071 | 8224 | |
---|
8072 | 8225 | java.util.HashSet<String> missingTextures = new java.util.HashSet<String>(); |
---|
.. | .. |
---|
8364 | 8517 | return false; |
---|
8365 | 8518 | } |
---|
8366 | 8519 | |
---|
8367 | | - boolean newtex = false; |
---|
| 8520 | + //boolean newtex = false; |
---|
8368 | 8521 | |
---|
8369 | 8522 | com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); |
---|
8370 | 8523 | |
---|
.. | .. |
---|
8396 | 8549 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_S, GetGL().GL_REPEAT); |
---|
8397 | 8550 | texture.setTexParameteri(GetGL().GL_TEXTURE_WRAP_T, GetGL().GL_REPEAT); |
---|
8398 | 8551 | |
---|
8399 | | - return newtex; |
---|
| 8552 | + return true; // Warning: not used. |
---|
8400 | 8553 | } |
---|
8401 | 8554 | |
---|
8402 | 8555 | ShadowBuffer shadowPBuf; |
---|
.. | .. |
---|
9234 | 9387 | jy8[3] = 0.5f; |
---|
9235 | 9388 | } |
---|
9236 | 9389 | |
---|
9237 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9390 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9238 | 9391 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9239 | 9392 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9240 | 9393 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9241 | 9394 | |
---|
| 9395 | + void ResetOptions() |
---|
| 9396 | + { |
---|
| 9397 | + options1[0] = 100; |
---|
| 9398 | + options1[1] = 0.025f; |
---|
| 9399 | + options1[2] = 0.01f; |
---|
| 9400 | + options1[3] = 0; |
---|
| 9401 | + options1[4] = 0; |
---|
| 9402 | + |
---|
| 9403 | + options2[0] = 0; |
---|
| 9404 | + options2[1] = 0.75f; |
---|
| 9405 | + options2[2] = 0; |
---|
| 9406 | + options2[3] = 0; |
---|
| 9407 | + |
---|
| 9408 | + options3[0] = 1; |
---|
| 9409 | + options3[1] = 1; |
---|
| 9410 | + options3[2] = 1; |
---|
| 9411 | + options3[3] = 0; |
---|
| 9412 | + |
---|
| 9413 | + options4[0] = 1; |
---|
| 9414 | + options4[1] = 0; |
---|
| 9415 | + options4[2] = 1; |
---|
| 9416 | + options4[3] = 0; |
---|
| 9417 | + } |
---|
| 9418 | + |
---|
9242 | 9419 | static int imagecount = 0; // movie generation |
---|
9243 | 9420 | |
---|
9244 | 9421 | static int jitter = 0; |
---|
.. | .. |
---|
9335 | 9512 | |
---|
9336 | 9513 | if (renderCamera != lightCamera) |
---|
9337 | 9514 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9338 | | - LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix); |
---|
| 9515 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
9339 | 9516 | |
---|
9340 | 9517 | // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); |
---|
9341 | 9518 | |
---|
.. | .. |
---|
9351 | 9528 | |
---|
9352 | 9529 | if (renderCamera != lightCamera) |
---|
9353 | 9530 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
9354 | | - LA.matConcat(parentcam.GlobalTransform(), matrix, matrix); |
---|
| 9531 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
9355 | 9532 | |
---|
9356 | 9533 | // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); |
---|
9357 | 9534 | |
---|
.. | .. |
---|
10349 | 10526 | ANTIALIAS = 0; |
---|
10350 | 10527 | //System.out.println("RESTART"); |
---|
10351 | 10528 | AAtimer.restart(); |
---|
| 10529 | + Globals.TIMERRUNNING = true; |
---|
10352 | 10530 | } |
---|
10353 | 10531 | } |
---|
10354 | 10532 | } |
---|
.. | .. |
---|
10416 | 10594 | ambientOcclusion = false; |
---|
10417 | 10595 | } |
---|
10418 | 10596 | |
---|
10419 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10597 | + if (//Globals.lighttouched && |
---|
| 10598 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10420 | 10599 | { |
---|
10421 | 10600 | //if (RENDERSHADOW) // ? |
---|
10422 | 10601 | if (!IsFrozen()) |
---|
.. | .. |
---|
10550 | 10729 | // if (parentcam != renderCamera) // not a light |
---|
10551 | 10730 | if (cam != lightCamera) |
---|
10552 | 10731 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10553 | | - LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix); |
---|
| 10732 | + LA.matConcat(matrix, parentcam.GlobalTransform(), matrix); |
---|
10554 | 10733 | |
---|
10555 | 10734 | for (int j = 0; j < 4; j++) |
---|
10556 | 10735 | { |
---|
.. | .. |
---|
10565 | 10744 | // if (parentcam != renderCamera) // not a light |
---|
10566 | 10745 | if (cam != lightCamera) |
---|
10567 | 10746 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10568 | | - LA.matConcat(parentcam.GlobalTransform(), matrix, matrix); |
---|
| 10747 | + LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix); |
---|
10569 | 10748 | |
---|
10570 | 10749 | //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); |
---|
10571 | 10750 | |
---|
.. | .. |
---|
10856 | 11035 | |
---|
10857 | 11036 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10858 | 11037 | |
---|
10859 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10860 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10861 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11038 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11039 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11040 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
10862 | 11041 | } else |
---|
10863 | 11042 | { |
---|
10864 | 11043 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10869 | 11048 | //System.out.println("BLENDING ON"); |
---|
10870 | 11049 | gl.glEnable(GL.GL_BLEND); |
---|
10871 | 11050 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10872 | | - |
---|
| 11051 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10873 | 11052 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10874 | 11053 | gl.glLoadIdentity(); |
---|
10875 | 11054 | |
---|
.. | .. |
---|
10959 | 11138 | |
---|
10960 | 11139 | // if (cam != lightCamera) |
---|
10961 | 11140 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10962 | | - LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013 |
---|
| 11141 | + LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
10963 | 11142 | } |
---|
10964 | 11143 | |
---|
10965 | 11144 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
10981 | 11160 | { |
---|
10982 | 11161 | if (cam != lightCamera) |
---|
10983 | 11162 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
10984 | | - LA.xformDir(light0, parentcam.GlobalTransformInv(), light0); // may 2013 |
---|
| 11163 | + LA.xformDir(light0, parentcam.GlobalTransform(), light0); // may 2013 |
---|
10985 | 11164 | } |
---|
10986 | 11165 | |
---|
10987 | 11166 | LA.xformPos(light0, cam.toScreen, light0); |
---|
.. | .. |
---|
11326 | 11505 | |
---|
11327 | 11506 | static boolean zoomonce = false; |
---|
11328 | 11507 | |
---|
| 11508 | + static void CreateSelectedPoint() |
---|
| 11509 | + { |
---|
| 11510 | + if (selectedpoint == null) |
---|
| 11511 | + { |
---|
| 11512 | + debugpointG = new Sphere(); |
---|
| 11513 | + debugpointP = new Sphere(); |
---|
| 11514 | + debugpointC = new Sphere(); |
---|
| 11515 | + debugpointR = new Sphere(); |
---|
| 11516 | + |
---|
| 11517 | + selectedpoint = new Superellipsoid(); |
---|
| 11518 | + |
---|
| 11519 | + for (int i=0; i<8; i++) |
---|
| 11520 | + { |
---|
| 11521 | + debugpoints[i] = new Sphere(); |
---|
| 11522 | + } |
---|
| 11523 | + } |
---|
| 11524 | + } |
---|
| 11525 | + |
---|
11329 | 11526 | void DrawObject(GL gl, boolean draw) |
---|
11330 | 11527 | { |
---|
| 11528 | + // To clear camera values |
---|
| 11529 | + ResetOptions(); |
---|
| 11530 | + |
---|
11331 | 11531 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11332 | 11532 | // DrawMode() = SELECTION; |
---|
11333 | 11533 | //GL gl = getGL(); |
---|
11334 | 11534 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11335 | 11535 | { |
---|
11336 | 11536 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11337 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11537 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11338 | 11538 | pingthread.StepToTarget(true); // true); |
---|
11339 | 11539 | // zoomonce = false; |
---|
11340 | 11540 | } |
---|
.. | .. |
---|
11406 | 11606 | |
---|
11407 | 11607 | if (DrawMode() == DEFAULT) |
---|
11408 | 11608 | { |
---|
11409 | | - if (DEBUG) |
---|
| 11609 | + if (Globals.DEBUG) |
---|
11410 | 11610 | { |
---|
| 11611 | + CreateSelectedPoint(); |
---|
11411 | 11612 | float radius = 0.05f; |
---|
11412 | 11613 | if (selectedpoint.radius != radius) |
---|
11413 | 11614 | { |
---|
.. | .. |
---|
11912 | 12113 | } |
---|
11913 | 12114 | |
---|
11914 | 12115 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11915 | | - LA.xformPos(light, parentcam.GlobalTransformInv(), light); // may 2013 |
---|
| 12116 | + LA.xformPos(light, parentcam.GlobalTransform(), light); // may 2013 |
---|
11916 | 12117 | |
---|
11917 | 12118 | LA.xformPos(light, renderCamera.toScreen, light); |
---|
11918 | 12119 | |
---|
.. | .. |
---|
13164 | 13365 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13165 | 13366 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13166 | 13367 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13167 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13368 | + |
---|
| 13369 | + //Object3D.cVector2[] vector2buffer; |
---|
13168 | 13370 | |
---|
13169 | 13371 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13170 | 13372 | // OUT : diff, spec |
---|
.. | .. |
---|
13180 | 13382 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13181 | 13383 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13182 | 13384 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13183 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13184 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13185 | | - //"MOV " + dest + ".z," + "params2.w;" + |
---|
| 13385 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13386 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13387 | + |
---|
| 13388 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13186 | 13389 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13187 | 13390 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13188 | 13391 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13687 | 13890 | else |
---|
13688 | 13891 | if (evt.getSource() == AAtimer) |
---|
13689 | 13892 | { |
---|
| 13893 | + Globals.TIMERRUNNING = false; |
---|
13690 | 13894 | if (mouseDown) |
---|
13691 | 13895 | { |
---|
13692 | 13896 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13746 | 13950 | |
---|
13747 | 13951 | // fev 2014??? |
---|
13748 | 13952 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13749 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13953 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13750 | 13954 | pingthread.StepToTarget(true); // true); |
---|
13751 | 13955 | } |
---|
13752 | 13956 | // if (!LIVE) |
---|
.. | .. |
---|
13761 | 13965 | return; |
---|
13762 | 13966 | |
---|
13763 | 13967 | AAtimer.restart(); // |
---|
| 13968 | + Globals.TIMERRUNNING = true; |
---|
13764 | 13969 | |
---|
13765 | 13970 | // waslive = LIVE; |
---|
13766 | 13971 | // LIVE = false; |
---|
.. | .. |
---|
13833 | 14038 | |
---|
13834 | 14039 | public void mouseDragged(MouseEvent e) |
---|
13835 | 14040 | { |
---|
| 14041 | + Globals.MOUSEDRAGGED = true; |
---|
| 14042 | + |
---|
13836 | 14043 | //System.out.println("mouseDragged: " + e); |
---|
13837 | 14044 | if (isRenderer) |
---|
13838 | 14045 | movingcamera = true; |
---|
.. | .. |
---|
14097 | 14304 | void GoDown(int mod) |
---|
14098 | 14305 | { |
---|
14099 | 14306 | MODIFIERS |= COMMAND; |
---|
14100 | | - /* |
---|
| 14307 | + /**/ |
---|
14101 | 14308 | if((mod&SHIFT) == SHIFT) |
---|
14102 | 14309 | manipCamera.RotatePosition(0, -speed); |
---|
14103 | 14310 | else |
---|
14104 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14105 | | - */ |
---|
| 14311 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14312 | + /**/ |
---|
14106 | 14313 | if ((mod & SHIFT) == SHIFT) |
---|
14107 | 14314 | { |
---|
14108 | 14315 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14118 | 14325 | void GoUp(int mod) |
---|
14119 | 14326 | { |
---|
14120 | 14327 | MODIFIERS |= COMMAND; |
---|
14121 | | - /* |
---|
| 14328 | + /**/ |
---|
14122 | 14329 | if((mod&SHIFT) == SHIFT) |
---|
14123 | 14330 | manipCamera.RotatePosition(0, speed); |
---|
14124 | 14331 | else |
---|
14125 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14126 | | - */ |
---|
| 14332 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14333 | + /**/ |
---|
14127 | 14334 | if ((mod & SHIFT) == SHIFT) |
---|
14128 | 14335 | { |
---|
14129 | 14336 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14139 | 14346 | void GoLeft(int mod) |
---|
14140 | 14347 | { |
---|
14141 | 14348 | MODIFIERS |= COMMAND; |
---|
14142 | | - /* |
---|
| 14349 | + /**/ |
---|
14143 | 14350 | if((mod&SHIFT) == SHIFT) |
---|
14144 | | - manipCamera.RotatePosition(speed, 0); |
---|
14145 | | - else |
---|
14146 | 14351 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14147 | | - */ |
---|
| 14352 | + else |
---|
| 14353 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14354 | + /**/ |
---|
14148 | 14355 | if ((mod & SHIFT) == SHIFT) |
---|
14149 | 14356 | { |
---|
14150 | 14357 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14160 | 14367 | void GoRight(int mod) |
---|
14161 | 14368 | { |
---|
14162 | 14369 | MODIFIERS |= COMMAND; |
---|
14163 | | - /* |
---|
| 14370 | + /**/ |
---|
14164 | 14371 | if((mod&SHIFT) == SHIFT) |
---|
14165 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14166 | | - else |
---|
14167 | 14372 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14168 | | - */ |
---|
| 14373 | + else |
---|
| 14374 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14375 | + /**/ |
---|
14169 | 14376 | if ((mod & SHIFT) == SHIFT) |
---|
14170 | 14377 | { |
---|
14171 | 14378 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14222 | 14429 | info.camera = renderCamera; |
---|
14223 | 14430 | info.x = x; |
---|
14224 | 14431 | info.y = y; |
---|
14225 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14432 | + object.GetWindow().copy |
---|
| 14433 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14226 | 14434 | } else |
---|
14227 | 14435 | { |
---|
14228 | 14436 | if (x < startX) |
---|
.. | .. |
---|
14386 | 14594 | ci.camera = renderCamera; |
---|
14387 | 14595 | if (!isRenderer) |
---|
14388 | 14596 | { |
---|
14389 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14597 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14598 | + //Object3D copy = editWindow.copy; |
---|
| 14599 | + if (object.doEditClick(ci, 0)) |
---|
14390 | 14600 | { |
---|
14391 | 14601 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14392 | 14602 | } else |
---|
.. | .. |
---|
14398 | 14608 | |
---|
14399 | 14609 | public void mouseReleased(MouseEvent e) |
---|
14400 | 14610 | { |
---|
| 14611 | + Globals.MOUSEDRAGGED = false; |
---|
| 14612 | + |
---|
14401 | 14613 | movingcamera = false; |
---|
14402 | | - X = Y = 0; |
---|
| 14614 | + X = 0; // getBounds().width/2; |
---|
| 14615 | + Y = 0; // getBounds().height/2; |
---|
14403 | 14616 | //System.out.println("mouseReleased: " + e); |
---|
14404 | 14617 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14405 | 14618 | } |
---|
.. | .. |
---|
14740 | 14953 | case 'E' : COMPACT ^= true; |
---|
14741 | 14954 | repaint(); |
---|
14742 | 14955 | break; |
---|
14743 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14956 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14957 | + //DEBUGHSB ^= true; |
---|
| 14958 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14744 | 14959 | repaint(); |
---|
14745 | 14960 | break; |
---|
14746 | 14961 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14765 | 14980 | RevertCamera(); |
---|
14766 | 14981 | repaint(); |
---|
14767 | 14982 | break; |
---|
14768 | | - case 'L': |
---|
14769 | 14983 | case 'l': |
---|
| 14984 | + //case 'L': |
---|
14770 | 14985 | if (lightMode) |
---|
14771 | 14986 | { |
---|
14772 | 14987 | lightMode = false; |
---|
.. | .. |
---|
14909 | 15124 | case '_': |
---|
14910 | 15125 | kompactbit = 5; |
---|
14911 | 15126 | break; |
---|
14912 | | - case '+': |
---|
14913 | | - kompactbit = 6; |
---|
14914 | | - break; |
---|
| 15127 | +// case '+': |
---|
| 15128 | +// kompactbit = 6; |
---|
| 15129 | +// break; |
---|
14915 | 15130 | case ' ': |
---|
14916 | 15131 | lightMode ^= true; |
---|
14917 | 15132 | Globals.lighttouched = true; |
---|
.. | .. |
---|
14923 | 15138 | case ESC: |
---|
14924 | 15139 | RENDERPROGRAM += 1; |
---|
14925 | 15140 | RENDERPROGRAM %= 3; |
---|
| 15141 | + |
---|
14926 | 15142 | repaint(); |
---|
14927 | 15143 | break; |
---|
14928 | 15144 | case 'Z': |
---|
.. | .. |
---|
14962 | 15178 | case DELETE: |
---|
14963 | 15179 | ClearSelection(); |
---|
14964 | 15180 | break; |
---|
14965 | | - /* |
---|
14966 | 15181 | case '+': |
---|
| 15182 | + |
---|
| 15183 | + /* |
---|
14967 | 15184 | //fontsize += 1; |
---|
14968 | 15185 | bbzoom *= 2; |
---|
14969 | 15186 | repaint(); |
---|
.. | .. |
---|
14980 | 15197 | case '=': |
---|
14981 | 15198 | IncDepth(); |
---|
14982 | 15199 | //fontsize += 1; |
---|
14983 | | - object.editWindow.refreshContents(true); |
---|
| 15200 | + object.GetWindow().refreshContents(true); |
---|
14984 | 15201 | maskbit = 6; |
---|
14985 | 15202 | break; |
---|
14986 | 15203 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
14987 | 15204 | DecDepth(); |
---|
14988 | 15205 | maskbit = 5; |
---|
14989 | 15206 | //if(fontsize > 1) fontsize -= 1; |
---|
14990 | | - if (object.editWindow == null) |
---|
14991 | | - new Exception().printStackTrace(); |
---|
14992 | | - else |
---|
14993 | | - object.editWindow.refreshContents(true); |
---|
| 15207 | +// if (object.editWindow == null) |
---|
| 15208 | +// new Exception().printStackTrace(); |
---|
| 15209 | +// else |
---|
| 15210 | + object.GetWindow().refreshContents(true); |
---|
14994 | 15211 | break; |
---|
14995 | 15212 | case '{': |
---|
14996 | 15213 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15214 | 15431 | } |
---|
15215 | 15432 | */ |
---|
15216 | 15433 | |
---|
15217 | | - object.editWindow.EditSelection(); |
---|
| 15434 | + object.GetWindow().EditSelection(false); |
---|
15218 | 15435 | } |
---|
15219 | 15436 | |
---|
15220 | 15437 | void SelectParent() |
---|
.. | .. |
---|
15231 | 15448 | { |
---|
15232 | 15449 | //selectees.remove(i); |
---|
15233 | 15450 | System.out.println("select parent of " + elem); |
---|
15234 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15451 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15235 | 15452 | } else |
---|
15236 | 15453 | { |
---|
15237 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15454 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15238 | 15455 | } |
---|
15239 | 15456 | |
---|
15240 | 15457 | first = false; |
---|
.. | .. |
---|
15276 | 15493 | for (int j = 0; j < group.children.size(); j++) |
---|
15277 | 15494 | { |
---|
15278 | 15495 | elem = (Object3D) group.children.elementAt(j); |
---|
15279 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15496 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15280 | 15497 | first = false; |
---|
15281 | 15498 | } |
---|
15282 | 15499 | } else |
---|
15283 | 15500 | { |
---|
15284 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15501 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15285 | 15502 | } |
---|
15286 | 15503 | |
---|
15287 | 15504 | first = false; |
---|
.. | .. |
---|
15292 | 15509 | { |
---|
15293 | 15510 | //Composite group = (Composite) object; |
---|
15294 | 15511 | Object3D group = object; |
---|
15295 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15512 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15296 | 15513 | } |
---|
15297 | 15514 | |
---|
15298 | 15515 | void ResetTransform(int mask) |
---|
15299 | 15516 | { |
---|
15300 | 15517 | //Composite group = (Composite) object; |
---|
15301 | 15518 | Object3D group = object; |
---|
15302 | | - group.editWindow.ResetTransform(mask); |
---|
| 15519 | + group.GetWindow().ResetTransform(mask); |
---|
15303 | 15520 | } |
---|
15304 | 15521 | |
---|
15305 | 15522 | void FlipTransform() |
---|
15306 | 15523 | { |
---|
15307 | 15524 | //Composite group = (Composite) object; |
---|
15308 | 15525 | Object3D group = object; |
---|
15309 | | - group.editWindow.FlipTransform(); |
---|
| 15526 | + group.GetWindow().FlipTransform(); |
---|
15310 | 15527 | // group.editWindow.ReduceMesh(true); |
---|
15311 | 15528 | } |
---|
15312 | 15529 | |
---|
.. | .. |
---|
15314 | 15531 | { |
---|
15315 | 15532 | //Composite group = (Composite) object; |
---|
15316 | 15533 | Object3D group = object; |
---|
15317 | | - group.editWindow.PrintMemory(); |
---|
| 15534 | + group.GetWindow().PrintMemory(); |
---|
15318 | 15535 | // group.editWindow.ReduceMesh(true); |
---|
15319 | 15536 | } |
---|
15320 | 15537 | |
---|
.. | .. |
---|
15322 | 15539 | { |
---|
15323 | 15540 | //Composite group = (Composite) object; |
---|
15324 | 15541 | Object3D group = object; |
---|
15325 | | - group.editWindow.ResetCentroid(); |
---|
| 15542 | + group.GetWindow().ResetCentroid(); |
---|
15326 | 15543 | } |
---|
15327 | 15544 | |
---|
15328 | 15545 | void IncDepth() |
---|
.. | .. |
---|
15498 | 15715 | info.bounds.y += (height - desired) / 2; |
---|
15499 | 15716 | } |
---|
15500 | 15717 | } |
---|
| 15718 | + |
---|
15501 | 15719 | info.g = gr; |
---|
15502 | 15720 | info.camera = renderCamera; |
---|
15503 | 15721 | /* |
---|
.. | .. |
---|
15507 | 15725 | */ |
---|
15508 | 15726 | if (!isRenderer) |
---|
15509 | 15727 | { |
---|
15510 | | - object.drawEditHandles(info, 0); |
---|
15511 | | - |
---|
15512 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15728 | + Grafreed.Assert(object != null); |
---|
| 15729 | + Grafreed.Assert(object.selection != null); |
---|
| 15730 | + if (object.selection.Size() > 0) |
---|
15513 | 15731 | { |
---|
15514 | | - switch (object.selection.get(0).hitSomething) |
---|
| 15732 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15733 | + |
---|
| 15734 | + info.DX = 0; |
---|
| 15735 | + info.DY = 0; |
---|
| 15736 | + info.W = 1; |
---|
| 15737 | + if (hitSomething == Object3D.hitCenter) |
---|
15515 | 15738 | { |
---|
15516 | | - case Object3D.hitCenter: gr.setColor(Color.pink); break; |
---|
15517 | | - case Object3D.hitRotate: gr.setColor(Color.green); break; |
---|
15518 | | - case Object3D.hitScale: gr.setColor(Color.cyan); break; |
---|
| 15739 | + info.DX = X; |
---|
| 15740 | + if (X != 0) |
---|
| 15741 | + info.DX -= info.bounds.width/2; |
---|
| 15742 | + |
---|
| 15743 | + info.DY = Y; |
---|
| 15744 | + if (Y != 0) |
---|
| 15745 | + info.DY -= info.bounds.height/2; |
---|
15519 | 15746 | } |
---|
15520 | | - |
---|
15521 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15747 | + |
---|
| 15748 | + object.drawEditHandles(info, 0); |
---|
| 15749 | + |
---|
| 15750 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15751 | + { |
---|
| 15752 | + switch (hitSomething) |
---|
| 15753 | + { |
---|
| 15754 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15755 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15756 | + break; |
---|
| 15757 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15758 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15759 | + break; |
---|
| 15760 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15761 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15762 | + break; |
---|
| 15763 | + } |
---|
| 15764 | + |
---|
| 15765 | + } |
---|
15522 | 15766 | } |
---|
15523 | 15767 | } |
---|
15524 | 15768 | } |
---|
.. | .. |
---|
16221 | 16465 | cStatic.objectstack[materialdepth++] = checker; |
---|
16222 | 16466 | //System.out.println("material " + material); |
---|
16223 | 16467 | //Applet3D.tracein(this, selected); |
---|
16224 | | - vector2buffer = checker.projectedVertices; |
---|
| 16468 | + //vector2buffer = checker.projectedVertices; |
---|
16225 | 16469 | |
---|
16226 | 16470 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16227 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16471 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16228 | 16472 | |
---|
16229 | 16473 | materialdepth -= 1; |
---|
16230 | 16474 | if (materialdepth > 0) |
---|
16231 | 16475 | { |
---|
16232 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16233 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16476 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16477 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16234 | 16478 | } |
---|
16235 | 16479 | //checker.GetMaterial().opacity = 1f; |
---|
16236 | 16480 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16316 | 16560 | } |
---|
16317 | 16561 | } |
---|
16318 | 16562 | |
---|
| 16563 | + private Object3D GetFolder() |
---|
| 16564 | + { |
---|
| 16565 | + Object3D folder = object.GetWindow().copy; |
---|
| 16566 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16567 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16568 | + return folder; |
---|
| 16569 | + } |
---|
| 16570 | + |
---|
16319 | 16571 | class SelectBuffer implements GLEventListener |
---|
16320 | 16572 | { |
---|
16321 | 16573 | |
---|
.. | .. |
---|
16395 | 16647 | |
---|
16396 | 16648 | //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); |
---|
16397 | 16649 | |
---|
| 16650 | + if (PAINTMODE) |
---|
| 16651 | + { |
---|
| 16652 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16653 | + { |
---|
| 16654 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16655 | + |
---|
| 16656 | + // Make what you paint not selectable. |
---|
| 16657 | + paintobj.ResetSelectable(); |
---|
| 16658 | + } |
---|
| 16659 | + } |
---|
| 16660 | + |
---|
16398 | 16661 | //int tmp = selection_view; |
---|
16399 | 16662 | //selection_view = -1; |
---|
16400 | 16663 | int temp = DrawMode(); |
---|
.. | .. |
---|
16406 | 16669 | // temp = DEFAULT; // patch for selection debug |
---|
16407 | 16670 | Globals.drawMode = temp; // WARNING |
---|
16408 | 16671 | |
---|
| 16672 | + if (PAINTMODE) |
---|
| 16673 | + { |
---|
| 16674 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16675 | + { |
---|
| 16676 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
| 16677 | + |
---|
| 16678 | + // Revert. |
---|
| 16679 | + paintobj.RestoreSelectable(); |
---|
| 16680 | + } |
---|
| 16681 | + } |
---|
| 16682 | + |
---|
16409 | 16683 | //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); |
---|
16410 | 16684 | |
---|
16411 | 16685 | // trying different ways of getting the depth info over |
---|
.. | .. |
---|
16453 | 16727 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16454 | 16728 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16455 | 16729 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16730 | + |
---|
| 16731 | + CreateSelectedPoint(); |
---|
16456 | 16732 | |
---|
16457 | 16733 | // Will fit the mesh !!! |
---|
16458 | 16734 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
16507 | 16783 | } |
---|
16508 | 16784 | |
---|
16509 | 16785 | if (!movingcamera && !PAINTMODE) |
---|
16510 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16786 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16511 | 16787 | |
---|
16512 | | - if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
| 16788 | + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16513 | 16789 | { |
---|
16514 | | - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
| 16790 | + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); |
---|
16515 | 16791 | |
---|
16516 | | - Object3D group = new Object3D("inst" + paintcount++); |
---|
| 16792 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16793 | + { |
---|
| 16794 | + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); |
---|
16517 | 16795 | |
---|
16518 | | - group.CreateMaterial(); // use a void leaf to select instances |
---|
16519 | | - |
---|
16520 | | - group.add(paintobj); // link |
---|
16521 | | - |
---|
16522 | | - object.editWindow.SnapObject(group); |
---|
16523 | | - |
---|
16524 | | - Object3D folder = object.editWindow.copy; |
---|
16525 | | - |
---|
16526 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16527 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
16528 | | - |
---|
16529 | | - folder.add(group); |
---|
16530 | | - |
---|
16531 | | - object.editWindow.ResetModel(); |
---|
16532 | | - object.editWindow.refreshContents(); |
---|
| 16796 | + Object3D inst = new Object3D("inst" + paintcount++); |
---|
| 16797 | + |
---|
| 16798 | + inst.CreateMaterial(); // use a void leaf to select instances |
---|
| 16799 | + |
---|
| 16800 | + inst.add(paintobj); // link |
---|
| 16801 | + |
---|
| 16802 | + object.GetWindow().SnapObject(inst); |
---|
| 16803 | + |
---|
| 16804 | + Object3D folder = paintFolder; // GetFolder(); |
---|
| 16805 | + |
---|
| 16806 | + folder.add(inst); |
---|
| 16807 | + |
---|
| 16808 | + object.GetWindow().ResetModel(); |
---|
| 16809 | + object.GetWindow().refreshContents(); |
---|
| 16810 | + } |
---|
16533 | 16811 | } |
---|
16534 | 16812 | else |
---|
16535 | 16813 | paintcount = 0; |
---|
.. | .. |
---|
16568 | 16846 | //System.out.println("objects[color] = " + objects[color]); |
---|
16569 | 16847 | //objects[color].Select(); |
---|
16570 | 16848 | indexcount = 0; |
---|
| 16849 | + ObjEditor window = object.GetWindow(); |
---|
| 16850 | + if (window != null && deselect) |
---|
| 16851 | + { |
---|
| 16852 | + window.Select(null, deselect, true); |
---|
| 16853 | + } |
---|
16571 | 16854 | object.Select(color, deselect); |
---|
16572 | 16855 | } |
---|
16573 | 16856 | |
---|
.. | .. |
---|
17093 | 17376 | int AAbuffersize = 0; |
---|
17094 | 17377 | |
---|
17095 | 17378 | //double[] selectedpoint = new double[3]; |
---|
17096 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17379 | + static Superellipsoid selectedpoint; |
---|
17097 | 17380 | static Sphere previousselectedpoint = null; |
---|
17098 | | - static Sphere debugpointG = new Sphere(); |
---|
17099 | | - static Sphere debugpointP = new Sphere(); |
---|
17100 | | - static Sphere debugpointC = new Sphere(); |
---|
17101 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17381 | + static Sphere debugpointG; |
---|
| 17382 | + static Sphere debugpointP; |
---|
| 17383 | + static Sphere debugpointC; |
---|
| 17384 | + static Sphere debugpointR; |
---|
17102 | 17385 | |
---|
17103 | 17386 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17104 | 17387 | |
---|
17105 | | - static |
---|
17106 | | - { |
---|
17107 | | - for (int i=0; i<8; i++) |
---|
17108 | | - { |
---|
17109 | | - debugpoints[i] = new Sphere(); |
---|
17110 | | - } |
---|
17111 | | - } |
---|
17112 | | - |
---|
17113 | 17388 | static void InitPoints(float radius) |
---|
17114 | 17389 | { |
---|
17115 | 17390 | for (int i=0; i<8; i++) |
---|