.. | .. |
---|
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 |
---|
.. | .. |
---|
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() |
---|
.. | .. |
---|
9359 | 9380 | jy8[3] = 0.5f; |
---|
9360 | 9381 | } |
---|
9361 | 9382 | |
---|
9362 | | - float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
| 9383 | + float[] options1 = new float[]{100, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV |
---|
9363 | 9384 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9364 | 9385 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9365 | 9386 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9366 | 9387 | |
---|
| 9388 | + void ResetOptions() |
---|
| 9389 | + { |
---|
| 9390 | + options1[0] = 100; |
---|
| 9391 | + options1[1] = 0.025f; |
---|
| 9392 | + options1[2] = 0.01f; |
---|
| 9393 | + options1[3] = 0; |
---|
| 9394 | + options1[4] = 0; |
---|
| 9395 | + |
---|
| 9396 | + options2[0] = 0; |
---|
| 9397 | + options2[1] = 0.75f; |
---|
| 9398 | + options2[2] = 0; |
---|
| 9399 | + options2[3] = 0; |
---|
| 9400 | + |
---|
| 9401 | + options3[0] = 1; |
---|
| 9402 | + options3[1] = 1; |
---|
| 9403 | + options3[2] = 1; |
---|
| 9404 | + options3[3] = 0; |
---|
| 9405 | + |
---|
| 9406 | + options4[0] = 1; |
---|
| 9407 | + options4[1] = 0; |
---|
| 9408 | + options4[2] = 1; |
---|
| 9409 | + options4[3] = 0; |
---|
| 9410 | + } |
---|
| 9411 | + |
---|
9367 | 9412 | static int imagecount = 0; // movie generation |
---|
9368 | 9413 | |
---|
9369 | 9414 | static int jitter = 0; |
---|
.. | .. |
---|
10474 | 10519 | ANTIALIAS = 0; |
---|
10475 | 10520 | //System.out.println("RESTART"); |
---|
10476 | 10521 | AAtimer.restart(); |
---|
| 10522 | + Globals.TIMERRUNNING = true; |
---|
10477 | 10523 | } |
---|
10478 | 10524 | } |
---|
10479 | 10525 | } |
---|
.. | .. |
---|
10541 | 10587 | ambientOcclusion = false; |
---|
10542 | 10588 | } |
---|
10543 | 10589 | |
---|
10544 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10590 | + if (//Globals.lighttouched && |
---|
| 10591 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10545 | 10592 | { |
---|
10546 | 10593 | //if (RENDERSHADOW) // ? |
---|
10547 | 10594 | if (!IsFrozen()) |
---|
.. | .. |
---|
10981 | 11028 | |
---|
10982 | 11029 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10983 | 11030 | |
---|
10984 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10985 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10986 | | -//gl.glEnable(gl.GL_MULTISAMPLE); |
---|
| 11031 | +gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
| 11032 | +gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
| 11033 | +gl.glEnable(gl.GL_MULTISAMPLE); |
---|
10987 | 11034 | } else |
---|
10988 | 11035 | { |
---|
10989 | 11036 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
10994 | 11041 | //System.out.println("BLENDING ON"); |
---|
10995 | 11042 | gl.glEnable(GL.GL_BLEND); |
---|
10996 | 11043 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
10997 | | - |
---|
| 11044 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
10998 | 11045 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
10999 | 11046 | gl.glLoadIdentity(); |
---|
11000 | 11047 | |
---|
.. | .. |
---|
11451 | 11498 | |
---|
11452 | 11499 | static boolean zoomonce = false; |
---|
11453 | 11500 | |
---|
| 11501 | + static void CreateSelectedPoint() |
---|
| 11502 | + { |
---|
| 11503 | + if (selectedpoint == null) |
---|
| 11504 | + { |
---|
| 11505 | + debugpointG = new Sphere(); |
---|
| 11506 | + debugpointP = new Sphere(); |
---|
| 11507 | + debugpointC = new Sphere(); |
---|
| 11508 | + debugpointR = new Sphere(); |
---|
| 11509 | + |
---|
| 11510 | + selectedpoint = new Superellipsoid(); |
---|
| 11511 | + |
---|
| 11512 | + for (int i=0; i<8; i++) |
---|
| 11513 | + { |
---|
| 11514 | + debugpoints[i] = new Sphere(); |
---|
| 11515 | + } |
---|
| 11516 | + } |
---|
| 11517 | + } |
---|
| 11518 | + |
---|
11454 | 11519 | void DrawObject(GL gl, boolean draw) |
---|
11455 | 11520 | { |
---|
| 11521 | + // To clear camera values |
---|
| 11522 | + ResetOptions(); |
---|
| 11523 | + |
---|
11456 | 11524 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11457 | 11525 | // DrawMode() = SELECTION; |
---|
11458 | 11526 | //GL gl = getGL(); |
---|
11459 | 11527 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11460 | 11528 | { |
---|
11461 | 11529 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11462 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11530 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11463 | 11531 | pingthread.StepToTarget(true); // true); |
---|
11464 | 11532 | // zoomonce = false; |
---|
11465 | 11533 | } |
---|
.. | .. |
---|
11531 | 11599 | |
---|
11532 | 11600 | if (DrawMode() == DEFAULT) |
---|
11533 | 11601 | { |
---|
11534 | | - if (DEBUG) |
---|
| 11602 | + if (Globals.DEBUG) |
---|
11535 | 11603 | { |
---|
| 11604 | + CreateSelectedPoint(); |
---|
11536 | 11605 | float radius = 0.05f; |
---|
11537 | 11606 | if (selectedpoint.radius != radius) |
---|
11538 | 11607 | { |
---|
.. | .. |
---|
12019 | 12088 | for (int i = tp.size(); --i >= 0;) |
---|
12020 | 12089 | { |
---|
12021 | 12090 | //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
12022 | | - LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
| 12091 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
12023 | 12092 | } |
---|
12024 | 12093 | |
---|
12025 | 12094 | |
---|
.. | .. |
---|
13289 | 13358 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13290 | 13359 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13291 | 13360 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13292 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13361 | + |
---|
| 13362 | + //Object3D.cVector2[] vector2buffer; |
---|
13293 | 13363 | |
---|
13294 | 13364 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13295 | 13365 | // OUT : diff, spec |
---|
.. | .. |
---|
13305 | 13375 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13306 | 13376 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13307 | 13377 | //"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;" + |
---|
| 13378 | +// "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + // PRETTY HEURISTIC FOR VELVET |
---|
| 13379 | +// "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
| 13380 | + |
---|
| 13381 | + "MOV " + dest + ".z," + "params2.w;" + // EXACT |
---|
13311 | 13382 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13312 | 13383 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13313 | 13384 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13812 | 13883 | else |
---|
13813 | 13884 | if (evt.getSource() == AAtimer) |
---|
13814 | 13885 | { |
---|
| 13886 | + Globals.TIMERRUNNING = false; |
---|
13815 | 13887 | if (mouseDown) |
---|
13816 | 13888 | { |
---|
13817 | 13889 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13871 | 13943 | |
---|
13872 | 13944 | // fev 2014??? |
---|
13873 | 13945 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13874 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13946 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13875 | 13947 | pingthread.StepToTarget(true); // true); |
---|
13876 | 13948 | } |
---|
13877 | 13949 | // if (!LIVE) |
---|
.. | .. |
---|
13886 | 13958 | return; |
---|
13887 | 13959 | |
---|
13888 | 13960 | AAtimer.restart(); // |
---|
| 13961 | + Globals.TIMERRUNNING = true; |
---|
13889 | 13962 | |
---|
13890 | 13963 | // waslive = LIVE; |
---|
13891 | 13964 | // LIVE = false; |
---|
.. | .. |
---|
14224 | 14297 | void GoDown(int mod) |
---|
14225 | 14298 | { |
---|
14226 | 14299 | MODIFIERS |= COMMAND; |
---|
14227 | | - /* |
---|
| 14300 | + /**/ |
---|
14228 | 14301 | if((mod&SHIFT) == SHIFT) |
---|
14229 | 14302 | manipCamera.RotatePosition(0, -speed); |
---|
14230 | 14303 | else |
---|
14231 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14232 | | - */ |
---|
| 14304 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14305 | + /**/ |
---|
14233 | 14306 | if ((mod & SHIFT) == SHIFT) |
---|
14234 | 14307 | { |
---|
14235 | 14308 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14245 | 14318 | void GoUp(int mod) |
---|
14246 | 14319 | { |
---|
14247 | 14320 | MODIFIERS |= COMMAND; |
---|
14248 | | - /* |
---|
| 14321 | + /**/ |
---|
14249 | 14322 | if((mod&SHIFT) == SHIFT) |
---|
14250 | 14323 | manipCamera.RotatePosition(0, speed); |
---|
14251 | 14324 | else |
---|
14252 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14253 | | - */ |
---|
| 14325 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14326 | + /**/ |
---|
14254 | 14327 | if ((mod & SHIFT) == SHIFT) |
---|
14255 | 14328 | { |
---|
14256 | 14329 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14266 | 14339 | void GoLeft(int mod) |
---|
14267 | 14340 | { |
---|
14268 | 14341 | MODIFIERS |= COMMAND; |
---|
14269 | | - /* |
---|
| 14342 | + /**/ |
---|
14270 | 14343 | if((mod&SHIFT) == SHIFT) |
---|
14271 | | - manipCamera.RotatePosition(speed, 0); |
---|
14272 | | - else |
---|
14273 | 14344 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14274 | | - */ |
---|
| 14345 | + else |
---|
| 14346 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14347 | + /**/ |
---|
14275 | 14348 | if ((mod & SHIFT) == SHIFT) |
---|
14276 | 14349 | { |
---|
14277 | 14350 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14287 | 14360 | void GoRight(int mod) |
---|
14288 | 14361 | { |
---|
14289 | 14362 | MODIFIERS |= COMMAND; |
---|
14290 | | - /* |
---|
| 14363 | + /**/ |
---|
14291 | 14364 | if((mod&SHIFT) == SHIFT) |
---|
14292 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14293 | | - else |
---|
14294 | 14365 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14295 | | - */ |
---|
| 14366 | + else |
---|
| 14367 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14368 | + /**/ |
---|
14296 | 14369 | if ((mod & SHIFT) == SHIFT) |
---|
14297 | 14370 | { |
---|
14298 | 14371 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14349 | 14422 | info.camera = renderCamera; |
---|
14350 | 14423 | info.x = x; |
---|
14351 | 14424 | info.y = y; |
---|
14352 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14425 | + object.GetWindow().copy |
---|
| 14426 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14353 | 14427 | } else |
---|
14354 | 14428 | { |
---|
14355 | 14429 | if (x < startX) |
---|
.. | .. |
---|
14513 | 14587 | ci.camera = renderCamera; |
---|
14514 | 14588 | if (!isRenderer) |
---|
14515 | 14589 | { |
---|
14516 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14590 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14591 | + //Object3D copy = editWindow.copy; |
---|
| 14592 | + if (object.doEditClick(ci, 0)) |
---|
14517 | 14593 | { |
---|
14518 | 14594 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14519 | 14595 | } else |
---|
.. | .. |
---|
14528 | 14604 | Globals.MOUSEDRAGGED = false; |
---|
14529 | 14605 | |
---|
14530 | 14606 | movingcamera = false; |
---|
14531 | | - X = Y = 0; |
---|
| 14607 | + X = 0; // getBounds().width/2; |
---|
| 14608 | + Y = 0; // getBounds().height/2; |
---|
14532 | 14609 | //System.out.println("mouseReleased: " + e); |
---|
14533 | 14610 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14534 | 14611 | } |
---|
.. | .. |
---|
14869 | 14946 | case 'E' : COMPACT ^= true; |
---|
14870 | 14947 | repaint(); |
---|
14871 | 14948 | break; |
---|
14872 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14949 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14950 | + //DEBUGHSB ^= true; |
---|
| 14951 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14873 | 14952 | repaint(); |
---|
14874 | 14953 | break; |
---|
14875 | 14954 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14894 | 14973 | RevertCamera(); |
---|
14895 | 14974 | repaint(); |
---|
14896 | 14975 | break; |
---|
14897 | | - case 'L': |
---|
14898 | 14976 | case 'l': |
---|
| 14977 | + //case 'L': |
---|
14899 | 14978 | if (lightMode) |
---|
14900 | 14979 | { |
---|
14901 | 14980 | lightMode = false; |
---|
.. | .. |
---|
15038 | 15117 | case '_': |
---|
15039 | 15118 | kompactbit = 5; |
---|
15040 | 15119 | break; |
---|
15041 | | - case '+': |
---|
15042 | | - kompactbit = 6; |
---|
15043 | | - break; |
---|
| 15120 | +// case '+': |
---|
| 15121 | +// kompactbit = 6; |
---|
| 15122 | +// break; |
---|
15044 | 15123 | case ' ': |
---|
15045 | 15124 | lightMode ^= true; |
---|
15046 | 15125 | Globals.lighttouched = true; |
---|
.. | .. |
---|
15052 | 15131 | case ESC: |
---|
15053 | 15132 | RENDERPROGRAM += 1; |
---|
15054 | 15133 | RENDERPROGRAM %= 3; |
---|
| 15134 | + |
---|
15055 | 15135 | repaint(); |
---|
15056 | 15136 | break; |
---|
15057 | 15137 | case 'Z': |
---|
.. | .. |
---|
15091 | 15171 | case DELETE: |
---|
15092 | 15172 | ClearSelection(); |
---|
15093 | 15173 | break; |
---|
15094 | | - /* |
---|
15095 | 15174 | case '+': |
---|
| 15175 | + |
---|
| 15176 | + /* |
---|
15096 | 15177 | //fontsize += 1; |
---|
15097 | 15178 | bbzoom *= 2; |
---|
15098 | 15179 | repaint(); |
---|
.. | .. |
---|
15109 | 15190 | case '=': |
---|
15110 | 15191 | IncDepth(); |
---|
15111 | 15192 | //fontsize += 1; |
---|
15112 | | - object.editWindow.refreshContents(true); |
---|
| 15193 | + object.GetWindow().refreshContents(true); |
---|
15113 | 15194 | maskbit = 6; |
---|
15114 | 15195 | break; |
---|
15115 | 15196 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
15116 | 15197 | DecDepth(); |
---|
15117 | 15198 | maskbit = 5; |
---|
15118 | 15199 | //if(fontsize > 1) fontsize -= 1; |
---|
15119 | | - if (object.editWindow == null) |
---|
15120 | | - new Exception().printStackTrace(); |
---|
15121 | | - else |
---|
15122 | | - object.editWindow.refreshContents(true); |
---|
| 15200 | +// if (object.editWindow == null) |
---|
| 15201 | +// new Exception().printStackTrace(); |
---|
| 15202 | +// else |
---|
| 15203 | + object.GetWindow().refreshContents(true); |
---|
15123 | 15204 | break; |
---|
15124 | 15205 | case '{': |
---|
15125 | 15206 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15343 | 15424 | } |
---|
15344 | 15425 | */ |
---|
15345 | 15426 | |
---|
15346 | | - object.editWindow.EditSelection(); |
---|
| 15427 | + object.GetWindow().EditSelection(false); |
---|
15347 | 15428 | } |
---|
15348 | 15429 | |
---|
15349 | 15430 | void SelectParent() |
---|
.. | .. |
---|
15360 | 15441 | { |
---|
15361 | 15442 | //selectees.remove(i); |
---|
15362 | 15443 | System.out.println("select parent of " + elem); |
---|
15363 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15444 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15364 | 15445 | } else |
---|
15365 | 15446 | { |
---|
15366 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15447 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15367 | 15448 | } |
---|
15368 | 15449 | |
---|
15369 | 15450 | first = false; |
---|
.. | .. |
---|
15405 | 15486 | for (int j = 0; j < group.children.size(); j++) |
---|
15406 | 15487 | { |
---|
15407 | 15488 | elem = (Object3D) group.children.elementAt(j); |
---|
15408 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15489 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15409 | 15490 | first = false; |
---|
15410 | 15491 | } |
---|
15411 | 15492 | } else |
---|
15412 | 15493 | { |
---|
15413 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15494 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15414 | 15495 | } |
---|
15415 | 15496 | |
---|
15416 | 15497 | first = false; |
---|
.. | .. |
---|
15421 | 15502 | { |
---|
15422 | 15503 | //Composite group = (Composite) object; |
---|
15423 | 15504 | Object3D group = object; |
---|
15424 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15505 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15425 | 15506 | } |
---|
15426 | 15507 | |
---|
15427 | 15508 | void ResetTransform(int mask) |
---|
15428 | 15509 | { |
---|
15429 | 15510 | //Composite group = (Composite) object; |
---|
15430 | 15511 | Object3D group = object; |
---|
15431 | | - group.editWindow.ResetTransform(mask); |
---|
| 15512 | + group.GetWindow().ResetTransform(mask); |
---|
15432 | 15513 | } |
---|
15433 | 15514 | |
---|
15434 | 15515 | void FlipTransform() |
---|
15435 | 15516 | { |
---|
15436 | 15517 | //Composite group = (Composite) object; |
---|
15437 | 15518 | Object3D group = object; |
---|
15438 | | - group.editWindow.FlipTransform(); |
---|
| 15519 | + group.GetWindow().FlipTransform(); |
---|
15439 | 15520 | // group.editWindow.ReduceMesh(true); |
---|
15440 | 15521 | } |
---|
15441 | 15522 | |
---|
.. | .. |
---|
15443 | 15524 | { |
---|
15444 | 15525 | //Composite group = (Composite) object; |
---|
15445 | 15526 | Object3D group = object; |
---|
15446 | | - group.editWindow.PrintMemory(); |
---|
| 15527 | + group.GetWindow().PrintMemory(); |
---|
15447 | 15528 | // group.editWindow.ReduceMesh(true); |
---|
15448 | 15529 | } |
---|
15449 | 15530 | |
---|
.. | .. |
---|
15451 | 15532 | { |
---|
15452 | 15533 | //Composite group = (Composite) object; |
---|
15453 | 15534 | Object3D group = object; |
---|
15454 | | - group.editWindow.ResetCentroid(); |
---|
| 15535 | + group.GetWindow().ResetCentroid(); |
---|
15455 | 15536 | } |
---|
15456 | 15537 | |
---|
15457 | 15538 | void IncDepth() |
---|
.. | .. |
---|
15627 | 15708 | info.bounds.y += (height - desired) / 2; |
---|
15628 | 15709 | } |
---|
15629 | 15710 | } |
---|
| 15711 | + |
---|
15630 | 15712 | info.g = gr; |
---|
15631 | 15713 | info.camera = renderCamera; |
---|
15632 | 15714 | /* |
---|
.. | .. |
---|
15636 | 15718 | */ |
---|
15637 | 15719 | if (!isRenderer) |
---|
15638 | 15720 | { |
---|
15639 | | - object.drawEditHandles(info, 0); |
---|
15640 | | - |
---|
15641 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15721 | + Grafreed.Assert(object != null); |
---|
| 15722 | + Grafreed.Assert(object.selection != null); |
---|
| 15723 | + if (object.selection.Size() > 0) |
---|
15642 | 15724 | { |
---|
15643 | | - switch (object.selection.get(0).hitSomething) |
---|
| 15725 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15726 | + |
---|
| 15727 | + info.DX = 0; |
---|
| 15728 | + info.DY = 0; |
---|
| 15729 | + info.W = 1; |
---|
| 15730 | + if (hitSomething == Object3D.hitCenter) |
---|
15644 | 15731 | { |
---|
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; |
---|
| 15732 | + info.DX = X; |
---|
| 15733 | + if (X != 0) |
---|
| 15734 | + info.DX -= info.bounds.width/2; |
---|
| 15735 | + |
---|
| 15736 | + info.DY = Y; |
---|
| 15737 | + if (Y != 0) |
---|
| 15738 | + info.DY -= info.bounds.height/2; |
---|
15654 | 15739 | } |
---|
15655 | | - |
---|
| 15740 | + |
---|
| 15741 | + object.drawEditHandles(info, 0); |
---|
| 15742 | + |
---|
| 15743 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15744 | + { |
---|
| 15745 | + switch (hitSomething) |
---|
| 15746 | + { |
---|
| 15747 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15748 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15749 | + break; |
---|
| 15750 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15751 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15752 | + break; |
---|
| 15753 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15754 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15755 | + break; |
---|
| 15756 | + } |
---|
| 15757 | + |
---|
| 15758 | + } |
---|
15656 | 15759 | } |
---|
15657 | 15760 | } |
---|
15658 | 15761 | } |
---|
.. | .. |
---|
16355 | 16458 | cStatic.objectstack[materialdepth++] = checker; |
---|
16356 | 16459 | //System.out.println("material " + material); |
---|
16357 | 16460 | //Applet3D.tracein(this, selected); |
---|
16358 | | - vector2buffer = checker.projectedVertices; |
---|
| 16461 | + //vector2buffer = checker.projectedVertices; |
---|
16359 | 16462 | |
---|
16360 | 16463 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16361 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16464 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16362 | 16465 | |
---|
16363 | 16466 | materialdepth -= 1; |
---|
16364 | 16467 | if (materialdepth > 0) |
---|
16365 | 16468 | { |
---|
16366 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16367 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16469 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16470 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16368 | 16471 | } |
---|
16369 | 16472 | //checker.GetMaterial().opacity = 1f; |
---|
16370 | 16473 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16588 | 16691 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16589 | 16692 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
16590 | 16693 | |
---|
| 16694 | + CreateSelectedPoint(); |
---|
| 16695 | + |
---|
16591 | 16696 | // Will fit the mesh !!! |
---|
16592 | 16697 | selectedpoint.toParent[0][0] = 0.0001; |
---|
16593 | 16698 | selectedpoint.toParent[1][1] = 0.0001; |
---|
.. | .. |
---|
16641 | 16746 | } |
---|
16642 | 16747 | |
---|
16643 | 16748 | if (!movingcamera && !PAINTMODE) |
---|
16644 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16749 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16645 | 16750 | |
---|
16646 | 16751 | if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16647 | 16752 | { |
---|
.. | .. |
---|
16653 | 16758 | |
---|
16654 | 16759 | group.add(paintobj); // link |
---|
16655 | 16760 | |
---|
16656 | | - object.editWindow.SnapObject(group); |
---|
| 16761 | + object.GetWindow().SnapObject(group); |
---|
16657 | 16762 | |
---|
16658 | | - Object3D folder = object.editWindow.copy; |
---|
| 16763 | + Object3D folder = object.GetWindow().copy; |
---|
16659 | 16764 | |
---|
16660 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16661 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
| 16765 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16766 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
16662 | 16767 | |
---|
16663 | 16768 | folder.add(group); |
---|
16664 | 16769 | |
---|
16665 | | - object.editWindow.ResetModel(); |
---|
16666 | | - object.editWindow.refreshContents(); |
---|
| 16770 | + object.GetWindow().ResetModel(); |
---|
| 16771 | + object.GetWindow().refreshContents(); |
---|
16667 | 16772 | } |
---|
16668 | 16773 | else |
---|
16669 | 16774 | paintcount = 0; |
---|
.. | .. |
---|
16702 | 16807 | //System.out.println("objects[color] = " + objects[color]); |
---|
16703 | 16808 | //objects[color].Select(); |
---|
16704 | 16809 | indexcount = 0; |
---|
| 16810 | + ObjEditor window = object.GetWindow(); |
---|
| 16811 | + if (window != null && deselect) |
---|
| 16812 | + { |
---|
| 16813 | + window.Select(null, deselect, true); |
---|
| 16814 | + } |
---|
16705 | 16815 | object.Select(color, deselect); |
---|
16706 | 16816 | } |
---|
16707 | 16817 | |
---|
.. | .. |
---|
17227 | 17337 | int AAbuffersize = 0; |
---|
17228 | 17338 | |
---|
17229 | 17339 | //double[] selectedpoint = new double[3]; |
---|
17230 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17340 | + static Superellipsoid selectedpoint; |
---|
17231 | 17341 | 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(); |
---|
| 17342 | + static Sphere debugpointG; |
---|
| 17343 | + static Sphere debugpointP; |
---|
| 17344 | + static Sphere debugpointC; |
---|
| 17345 | + static Sphere debugpointR; |
---|
17236 | 17346 | |
---|
17237 | 17347 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17238 | 17348 | |
---|
17239 | | - static |
---|
17240 | | - { |
---|
17241 | | - for (int i=0; i<8; i++) |
---|
17242 | | - { |
---|
17243 | | - debugpoints[i] = new Sphere(); |
---|
17244 | | - } |
---|
17245 | | - } |
---|
17246 | | - |
---|
17247 | 17349 | static void InitPoints(float radius) |
---|
17248 | 17350 | { |
---|
17249 | 17351 | for (int i=0; i<8; i++) |
---|