.. | .. |
---|
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 |
---|
.. | .. |
---|
1611 | 1624 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1612 | 1625 | } |
---|
1613 | 1626 | |
---|
1614 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1627 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1615 | 1628 | { |
---|
1616 | 1629 | CameraPane display = this; |
---|
1617 | 1630 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1646 | 1659 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1647 | 1660 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1648 | 1661 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1649 | | - colorV[3] = material.opacity; |
---|
| 1662 | + colorV[3] = 1; // material.opacity; |
---|
1650 | 1663 | |
---|
1651 | 1664 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1652 | 1665 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1754 | 1767 | display.modelParams7[2] = 0; |
---|
1755 | 1768 | display.modelParams7[3] = 0; |
---|
1756 | 1769 | |
---|
1757 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1770 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1758 | 1771 | |
---|
1759 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1772 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1760 | 1773 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1761 | 1774 | { |
---|
1762 | 1775 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
2052 | 2065 | //System.err.println("Oeil on"); |
---|
2053 | 2066 | OEIL = true; |
---|
2054 | 2067 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
2055 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 2068 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
2056 | 2069 | //pingthread.StepToTarget(true); |
---|
2057 | 2070 | } |
---|
2058 | 2071 | |
---|
.. | .. |
---|
2267 | 2280 | |
---|
2268 | 2281 | void ToggleDebug() |
---|
2269 | 2282 | { |
---|
2270 | | - DEBUG ^= true; |
---|
| 2283 | + Globals.DEBUG ^= true; |
---|
2271 | 2284 | } |
---|
2272 | 2285 | |
---|
2273 | 2286 | void ToggleLookAt() |
---|
.. | .. |
---|
9367 | 9380 | jy8[3] = 0.5f; |
---|
9368 | 9381 | } |
---|
9369 | 9382 | |
---|
9370 | | - 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 |
---|
9371 | 9384 | float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation |
---|
9372 | 9385 | float[] options3 = new float[]{1, 1, 1, 0}; // fog color |
---|
9373 | 9386 | float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen |
---|
9374 | 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 | + |
---|
9375 | 9412 | static int imagecount = 0; // movie generation |
---|
9376 | 9413 | |
---|
9377 | 9414 | static int jitter = 0; |
---|
.. | .. |
---|
10482 | 10519 | ANTIALIAS = 0; |
---|
10483 | 10520 | //System.out.println("RESTART"); |
---|
10484 | 10521 | AAtimer.restart(); |
---|
| 10522 | + Globals.TIMERRUNNING = true; |
---|
10485 | 10523 | } |
---|
10486 | 10524 | } |
---|
10487 | 10525 | } |
---|
.. | .. |
---|
10549 | 10587 | ambientOcclusion = false; |
---|
10550 | 10588 | } |
---|
10551 | 10589 | |
---|
10552 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10590 | + if (//Globals.lighttouched && |
---|
| 10591 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10553 | 10592 | { |
---|
10554 | 10593 | //if (RENDERSHADOW) // ? |
---|
10555 | 10594 | if (!IsFrozen()) |
---|
.. | .. |
---|
10989 | 11028 | |
---|
10990 | 11029 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
10991 | 11030 | |
---|
10992 | | -//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST); |
---|
10993 | | -//gl.glEnable(gl.GL_POLYGON_SMOOTH); |
---|
10994 | | -//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); |
---|
10995 | 11034 | } else |
---|
10996 | 11035 | { |
---|
10997 | 11036 | //gl.glDisable(GL.GL_TEXTURE_2D); |
---|
.. | .. |
---|
11002 | 11041 | //System.out.println("BLENDING ON"); |
---|
11003 | 11042 | gl.glEnable(GL.GL_BLEND); |
---|
11004 | 11043 | gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); |
---|
11005 | | - |
---|
| 11044 | +// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE); |
---|
11006 | 11045 | gl.glMatrixMode(gl.GL_PROJECTION); |
---|
11007 | 11046 | gl.glLoadIdentity(); |
---|
11008 | 11047 | |
---|
.. | .. |
---|
11459 | 11498 | |
---|
11460 | 11499 | static boolean zoomonce = false; |
---|
11461 | 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 | + |
---|
11462 | 11519 | void DrawObject(GL gl, boolean draw) |
---|
11463 | 11520 | { |
---|
| 11521 | + // To clear camera values |
---|
| 11522 | + ResetOptions(); |
---|
| 11523 | + |
---|
11464 | 11524 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
11465 | 11525 | // DrawMode() = SELECTION; |
---|
11466 | 11526 | //GL gl = getGL(); |
---|
11467 | 11527 | if ((TRACK || SHADOWTRACK) || zoomonce) |
---|
11468 | 11528 | { |
---|
11469 | 11529 | if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode) |
---|
11470 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 11530 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
11471 | 11531 | pingthread.StepToTarget(true); // true); |
---|
11472 | 11532 | // zoomonce = false; |
---|
11473 | 11533 | } |
---|
.. | .. |
---|
11539 | 11599 | |
---|
11540 | 11600 | if (DrawMode() == DEFAULT) |
---|
11541 | 11601 | { |
---|
11542 | | - if (DEBUG) |
---|
| 11602 | + if (Globals.DEBUG) |
---|
11543 | 11603 | { |
---|
| 11604 | + CreateSelectedPoint(); |
---|
11544 | 11605 | float radius = 0.05f; |
---|
11545 | 11606 | if (selectedpoint.radius != radius) |
---|
11546 | 11607 | { |
---|
.. | .. |
---|
12027 | 12088 | for (int i = tp.size(); --i >= 0;) |
---|
12028 | 12089 | { |
---|
12029 | 12090 | //for (int count = tp.get(i).GetTransformCount(); --count>=0;) |
---|
12030 | | - LA.xformPos(light, tp.get(i).GlobalTransform(), light); |
---|
| 12091 | + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light); |
---|
12031 | 12092 | } |
---|
12032 | 12093 | |
---|
12033 | 12094 | |
---|
.. | .. |
---|
13297 | 13358 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13298 | 13359 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13299 | 13360 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13300 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13361 | + |
---|
| 13362 | + //Object3D.cVector2[] vector2buffer; |
---|
13301 | 13363 | |
---|
13302 | 13364 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13303 | 13365 | // OUT : diff, spec |
---|
.. | .. |
---|
13313 | 13375 | "DP3 " + dest + ".z," + "normals," + "eye;" + |
---|
13314 | 13376 | "MAX " + dest + ".w," + dest + ".z," + "eps.x;" + |
---|
13315 | 13377 | //"MOV " + dest + ".w," + "normal.z;" + |
---|
13316 | | - "MUL " + dest + ".z," + "params2.w," + dest + ".x;" + |
---|
13317 | | - "MUL " + dest + ".z," + dest + ".z," + dest + ".x;" + |
---|
13318 | | - //"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 |
---|
13319 | 13382 | "POW " + dest + ".w," + dest + ".w," + dest + ".z;" + |
---|
13320 | 13383 | "RCP " + dest + ".w," + dest + ".w;" + |
---|
13321 | 13384 | //"RSQ " + dest + ".w," + dest + ".w;" + |
---|
.. | .. |
---|
13820 | 13883 | else |
---|
13821 | 13884 | if (evt.getSource() == AAtimer) |
---|
13822 | 13885 | { |
---|
| 13886 | + Globals.TIMERRUNNING = false; |
---|
13823 | 13887 | if (mouseDown) |
---|
13824 | 13888 | { |
---|
13825 | 13889 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13879 | 13943 | |
---|
13880 | 13944 | // fev 2014??? |
---|
13881 | 13945 | if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode) |
---|
13882 | | - object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
| 13946 | + object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK); |
---|
13883 | 13947 | pingthread.StepToTarget(true); // true); |
---|
13884 | 13948 | } |
---|
13885 | 13949 | // if (!LIVE) |
---|
.. | .. |
---|
13894 | 13958 | return; |
---|
13895 | 13959 | |
---|
13896 | 13960 | AAtimer.restart(); // |
---|
| 13961 | + Globals.TIMERRUNNING = true; |
---|
13897 | 13962 | |
---|
13898 | 13963 | // waslive = LIVE; |
---|
13899 | 13964 | // LIVE = false; |
---|
.. | .. |
---|
14232 | 14297 | void GoDown(int mod) |
---|
14233 | 14298 | { |
---|
14234 | 14299 | MODIFIERS |= COMMAND; |
---|
14235 | | - /* |
---|
| 14300 | + /**/ |
---|
14236 | 14301 | if((mod&SHIFT) == SHIFT) |
---|
14237 | 14302 | manipCamera.RotatePosition(0, -speed); |
---|
14238 | 14303 | else |
---|
14239 | | - manipCamera.BackForth(0, -speed*delta, getWidth()); |
---|
14240 | | - */ |
---|
| 14304 | + manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14305 | + /**/ |
---|
14241 | 14306 | if ((mod & SHIFT) == SHIFT) |
---|
14242 | 14307 | { |
---|
14243 | 14308 | mouseMode = mouseMode; // VR?? |
---|
.. | .. |
---|
14253 | 14318 | void GoUp(int mod) |
---|
14254 | 14319 | { |
---|
14255 | 14320 | MODIFIERS |= COMMAND; |
---|
14256 | | - /* |
---|
| 14321 | + /**/ |
---|
14257 | 14322 | if((mod&SHIFT) == SHIFT) |
---|
14258 | 14323 | manipCamera.RotatePosition(0, speed); |
---|
14259 | 14324 | else |
---|
14260 | | - manipCamera.BackForth(0, speed*delta, getWidth()); |
---|
14261 | | - */ |
---|
| 14325 | + manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14326 | + /**/ |
---|
14262 | 14327 | if ((mod & SHIFT) == SHIFT) |
---|
14263 | 14328 | { |
---|
14264 | 14329 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14274 | 14339 | void GoLeft(int mod) |
---|
14275 | 14340 | { |
---|
14276 | 14341 | MODIFIERS |= COMMAND; |
---|
14277 | | - /* |
---|
| 14342 | + /**/ |
---|
14278 | 14343 | if((mod&SHIFT) == SHIFT) |
---|
14279 | | - manipCamera.RotatePosition(speed, 0); |
---|
14280 | | - else |
---|
14281 | 14344 | manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14282 | | - */ |
---|
| 14345 | + else |
---|
| 14346 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14347 | + /**/ |
---|
14283 | 14348 | if ((mod & SHIFT) == SHIFT) |
---|
14284 | 14349 | { |
---|
14285 | 14350 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14295 | 14360 | void GoRight(int mod) |
---|
14296 | 14361 | { |
---|
14297 | 14362 | MODIFIERS |= COMMAND; |
---|
14298 | | - /* |
---|
| 14363 | + /**/ |
---|
14299 | 14364 | if((mod&SHIFT) == SHIFT) |
---|
14300 | | - manipCamera.RotatePosition(-speed, 0); |
---|
14301 | | - else |
---|
14302 | 14365 | manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14303 | | - */ |
---|
| 14366 | + else |
---|
| 14367 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14368 | + /**/ |
---|
14304 | 14369 | if ((mod & SHIFT) == SHIFT) |
---|
14305 | 14370 | { |
---|
14306 | 14371 | mouseMode = mouseMode; |
---|
.. | .. |
---|
14357 | 14422 | info.camera = renderCamera; |
---|
14358 | 14423 | info.x = x; |
---|
14359 | 14424 | info.y = y; |
---|
14360 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14425 | + object.GetWindow().copy |
---|
| 14426 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14361 | 14427 | } else |
---|
14362 | 14428 | { |
---|
14363 | 14429 | if (x < startX) |
---|
.. | .. |
---|
14521 | 14587 | ci.camera = renderCamera; |
---|
14522 | 14588 | if (!isRenderer) |
---|
14523 | 14589 | { |
---|
14524 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14590 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14591 | + //Object3D copy = editWindow.copy; |
---|
| 14592 | + if (object.doEditClick(ci, 0)) |
---|
14525 | 14593 | { |
---|
14526 | 14594 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14527 | 14595 | } else |
---|
.. | .. |
---|
14536 | 14604 | Globals.MOUSEDRAGGED = false; |
---|
14537 | 14605 | |
---|
14538 | 14606 | movingcamera = false; |
---|
14539 | | - X = Y = 0; |
---|
| 14607 | + X = 0; // getBounds().width/2; |
---|
| 14608 | + Y = 0; // getBounds().height/2; |
---|
14540 | 14609 | //System.out.println("mouseReleased: " + e); |
---|
14541 | 14610 | clickEnd(e.getX(), e.getY(), e.getModifiersEx()); |
---|
14542 | 14611 | } |
---|
.. | .. |
---|
14877 | 14946 | case 'E' : COMPACT ^= true; |
---|
14878 | 14947 | repaint(); |
---|
14879 | 14948 | break; |
---|
14880 | | - case 'W' : DEBUGHSB ^= true; |
---|
| 14949 | + case 'W' : // Wide Window (fullscreen) |
---|
| 14950 | + //DEBUGHSB ^= true; |
---|
| 14951 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
14881 | 14952 | repaint(); |
---|
14882 | 14953 | break; |
---|
14883 | 14954 | case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break; |
---|
.. | .. |
---|
14902 | 14973 | RevertCamera(); |
---|
14903 | 14974 | repaint(); |
---|
14904 | 14975 | break; |
---|
14905 | | - case 'L': |
---|
14906 | 14976 | case 'l': |
---|
| 14977 | + //case 'L': |
---|
14907 | 14978 | if (lightMode) |
---|
14908 | 14979 | { |
---|
14909 | 14980 | lightMode = false; |
---|
.. | .. |
---|
15046 | 15117 | case '_': |
---|
15047 | 15118 | kompactbit = 5; |
---|
15048 | 15119 | break; |
---|
15049 | | - case '+': |
---|
15050 | | - kompactbit = 6; |
---|
15051 | | - break; |
---|
| 15120 | +// case '+': |
---|
| 15121 | +// kompactbit = 6; |
---|
| 15122 | +// break; |
---|
15052 | 15123 | case ' ': |
---|
15053 | 15124 | lightMode ^= true; |
---|
15054 | 15125 | Globals.lighttouched = true; |
---|
.. | .. |
---|
15060 | 15131 | case ESC: |
---|
15061 | 15132 | RENDERPROGRAM += 1; |
---|
15062 | 15133 | RENDERPROGRAM %= 3; |
---|
| 15134 | + |
---|
15063 | 15135 | repaint(); |
---|
15064 | 15136 | break; |
---|
15065 | 15137 | case 'Z': |
---|
.. | .. |
---|
15099 | 15171 | case DELETE: |
---|
15100 | 15172 | ClearSelection(); |
---|
15101 | 15173 | break; |
---|
15102 | | - /* |
---|
15103 | 15174 | case '+': |
---|
| 15175 | + |
---|
| 15176 | + /* |
---|
15104 | 15177 | //fontsize += 1; |
---|
15105 | 15178 | bbzoom *= 2; |
---|
15106 | 15179 | repaint(); |
---|
.. | .. |
---|
15117 | 15190 | case '=': |
---|
15118 | 15191 | IncDepth(); |
---|
15119 | 15192 | //fontsize += 1; |
---|
15120 | | - object.editWindow.refreshContents(true); |
---|
| 15193 | + object.GetWindow().refreshContents(true); |
---|
15121 | 15194 | maskbit = 6; |
---|
15122 | 15195 | break; |
---|
15123 | 15196 | case '-': //if (PixelThreshold>1) PixelThreshold /= 2; |
---|
15124 | 15197 | DecDepth(); |
---|
15125 | 15198 | maskbit = 5; |
---|
15126 | 15199 | //if(fontsize > 1) fontsize -= 1; |
---|
15127 | | - if (object.editWindow == null) |
---|
15128 | | - new Exception().printStackTrace(); |
---|
15129 | | - else |
---|
15130 | | - object.editWindow.refreshContents(true); |
---|
| 15200 | +// if (object.editWindow == null) |
---|
| 15201 | +// new Exception().printStackTrace(); |
---|
| 15202 | +// else |
---|
| 15203 | + object.GetWindow().refreshContents(true); |
---|
15131 | 15204 | break; |
---|
15132 | 15205 | case '{': |
---|
15133 | 15206 | manipCamera.shaper_fovy /= 1.1; |
---|
.. | .. |
---|
15351 | 15424 | } |
---|
15352 | 15425 | */ |
---|
15353 | 15426 | |
---|
15354 | | - object.editWindow.EditSelection(); |
---|
| 15427 | + object.GetWindow().EditSelection(false); |
---|
15355 | 15428 | } |
---|
15356 | 15429 | |
---|
15357 | 15430 | void SelectParent() |
---|
.. | .. |
---|
15368 | 15441 | { |
---|
15369 | 15442 | //selectees.remove(i); |
---|
15370 | 15443 | System.out.println("select parent of " + elem); |
---|
15371 | | - group.editWindow.Select(elem.parent.GetTreePath(), first, true); |
---|
| 15444 | + group.GetWindow().Select(elem.parent.GetTreePath(), first, true); |
---|
15372 | 15445 | } else |
---|
15373 | 15446 | { |
---|
15374 | | - group.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15447 | + group.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15375 | 15448 | } |
---|
15376 | 15449 | |
---|
15377 | 15450 | first = false; |
---|
.. | .. |
---|
15413 | 15486 | for (int j = 0; j < group.children.size(); j++) |
---|
15414 | 15487 | { |
---|
15415 | 15488 | elem = (Object3D) group.children.elementAt(j); |
---|
15416 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15489 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15417 | 15490 | first = false; |
---|
15418 | 15491 | } |
---|
15419 | 15492 | } else |
---|
15420 | 15493 | { |
---|
15421 | | - object.editWindow.Select(elem.GetTreePath(), first, true); |
---|
| 15494 | + object.GetWindow().Select(elem.GetTreePath(), first, true); |
---|
15422 | 15495 | } |
---|
15423 | 15496 | |
---|
15424 | 15497 | first = false; |
---|
.. | .. |
---|
15429 | 15502 | { |
---|
15430 | 15503 | //Composite group = (Composite) object; |
---|
15431 | 15504 | Object3D group = object; |
---|
15432 | | - group.editWindow.loadClipboard(true); // ClearSelection(false); |
---|
| 15505 | + group.GetWindow().loadClipboard(true); // ClearSelection(false); |
---|
15433 | 15506 | } |
---|
15434 | 15507 | |
---|
15435 | 15508 | void ResetTransform(int mask) |
---|
15436 | 15509 | { |
---|
15437 | 15510 | //Composite group = (Composite) object; |
---|
15438 | 15511 | Object3D group = object; |
---|
15439 | | - group.editWindow.ResetTransform(mask); |
---|
| 15512 | + group.GetWindow().ResetTransform(mask); |
---|
15440 | 15513 | } |
---|
15441 | 15514 | |
---|
15442 | 15515 | void FlipTransform() |
---|
15443 | 15516 | { |
---|
15444 | 15517 | //Composite group = (Composite) object; |
---|
15445 | 15518 | Object3D group = object; |
---|
15446 | | - group.editWindow.FlipTransform(); |
---|
| 15519 | + group.GetWindow().FlipTransform(); |
---|
15447 | 15520 | // group.editWindow.ReduceMesh(true); |
---|
15448 | 15521 | } |
---|
15449 | 15522 | |
---|
.. | .. |
---|
15451 | 15524 | { |
---|
15452 | 15525 | //Composite group = (Composite) object; |
---|
15453 | 15526 | Object3D group = object; |
---|
15454 | | - group.editWindow.PrintMemory(); |
---|
| 15527 | + group.GetWindow().PrintMemory(); |
---|
15455 | 15528 | // group.editWindow.ReduceMesh(true); |
---|
15456 | 15529 | } |
---|
15457 | 15530 | |
---|
.. | .. |
---|
15459 | 15532 | { |
---|
15460 | 15533 | //Composite group = (Composite) object; |
---|
15461 | 15534 | Object3D group = object; |
---|
15462 | | - group.editWindow.ResetCentroid(); |
---|
| 15535 | + group.GetWindow().ResetCentroid(); |
---|
15463 | 15536 | } |
---|
15464 | 15537 | |
---|
15465 | 15538 | void IncDepth() |
---|
.. | .. |
---|
15644 | 15717 | */ |
---|
15645 | 15718 | if (!isRenderer) |
---|
15646 | 15719 | { |
---|
15647 | | - object.drawEditHandles(info, 0); |
---|
15648 | | - |
---|
15649 | | - if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0) |
---|
| 15720 | + if (object.selection.Size() > 0) |
---|
15650 | 15721 | { |
---|
15651 | | - switch (object.selection.get(0).hitSomething) |
---|
| 15722 | + int hitSomething = object.selection.get(0).hitSomething; |
---|
| 15723 | + |
---|
| 15724 | + info.DX = 0; |
---|
| 15725 | + info.DY = 0; |
---|
| 15726 | + info.W = 1; |
---|
| 15727 | + if (hitSomething == Object3D.hitCenter) |
---|
15652 | 15728 | { |
---|
15653 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
15654 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15655 | | - break; |
---|
15656 | | - case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
15657 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15658 | | - break; |
---|
15659 | | - case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
15660 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
15661 | | - break; |
---|
| 15729 | + info.DX = X; |
---|
| 15730 | + if (X != 0) |
---|
| 15731 | + info.DX -= info.bounds.width/2; |
---|
| 15732 | + |
---|
| 15733 | + info.DY = Y; |
---|
| 15734 | + if (Y != 0) |
---|
| 15735 | + info.DY -= info.bounds.height/2; |
---|
15662 | 15736 | } |
---|
15663 | | - |
---|
| 15737 | + |
---|
| 15738 | + object.drawEditHandles(info, 0); |
---|
| 15739 | + |
---|
| 15740 | + if (drag && (X != 0 || Y != 0)) |
---|
| 15741 | + { |
---|
| 15742 | + switch (hitSomething) |
---|
| 15743 | + { |
---|
| 15744 | + case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 15745 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15746 | + break; |
---|
| 15747 | + case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
| 15748 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15749 | + break; |
---|
| 15750 | + case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
| 15751 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
| 15752 | + break; |
---|
| 15753 | + } |
---|
| 15754 | + |
---|
| 15755 | + } |
---|
15664 | 15756 | } |
---|
15665 | 15757 | } |
---|
15666 | 15758 | } |
---|
.. | .. |
---|
16363 | 16455 | cStatic.objectstack[materialdepth++] = checker; |
---|
16364 | 16456 | //System.out.println("material " + material); |
---|
16365 | 16457 | //Applet3D.tracein(this, selected); |
---|
16366 | | - vector2buffer = checker.projectedVertices; |
---|
| 16458 | + //vector2buffer = checker.projectedVertices; |
---|
16367 | 16459 | |
---|
16368 | 16460 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16369 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16461 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16370 | 16462 | |
---|
16371 | 16463 | materialdepth -= 1; |
---|
16372 | 16464 | if (materialdepth > 0) |
---|
16373 | 16465 | { |
---|
16374 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16375 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16466 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16467 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16376 | 16468 | } |
---|
16377 | 16469 | //checker.GetMaterial().opacity = 1f; |
---|
16378 | 16470 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16596 | 16688 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16597 | 16689 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
16598 | 16690 | |
---|
| 16691 | + CreateSelectedPoint(); |
---|
| 16692 | + |
---|
16599 | 16693 | // Will fit the mesh !!! |
---|
16600 | 16694 | selectedpoint.toParent[0][0] = 0.0001; |
---|
16601 | 16695 | selectedpoint.toParent[1][1] = 0.0001; |
---|
.. | .. |
---|
16649 | 16743 | } |
---|
16650 | 16744 | |
---|
16651 | 16745 | if (!movingcamera && !PAINTMODE) |
---|
16652 | | - object.editWindow.ScreenFitPoint(); // fev 2014 |
---|
| 16746 | + object.GetWindow().ScreenFitPoint(); // fev 2014 |
---|
16653 | 16747 | |
---|
16654 | 16748 | if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) |
---|
16655 | 16749 | { |
---|
.. | .. |
---|
16661 | 16755 | |
---|
16662 | 16756 | group.add(paintobj); // link |
---|
16663 | 16757 | |
---|
16664 | | - object.editWindow.SnapObject(group); |
---|
| 16758 | + object.GetWindow().SnapObject(group); |
---|
16665 | 16759 | |
---|
16666 | | - Object3D folder = object.editWindow.copy; |
---|
| 16760 | + Object3D folder = object.GetWindow().copy; |
---|
16667 | 16761 | |
---|
16668 | | - if (object.editWindow.copy.selection.Size() > 0) |
---|
16669 | | - folder = object.editWindow.copy.selection.elementAt(0); |
---|
| 16762 | + if (object.GetWindow().copy.selection.Size() > 0) |
---|
| 16763 | + folder = object.GetWindow().copy.selection.elementAt(0); |
---|
16670 | 16764 | |
---|
16671 | 16765 | folder.add(group); |
---|
16672 | 16766 | |
---|
16673 | | - object.editWindow.ResetModel(); |
---|
16674 | | - object.editWindow.refreshContents(); |
---|
| 16767 | + object.GetWindow().ResetModel(); |
---|
| 16768 | + object.GetWindow().refreshContents(); |
---|
16675 | 16769 | } |
---|
16676 | 16770 | else |
---|
16677 | 16771 | paintcount = 0; |
---|
.. | .. |
---|
16710 | 16804 | //System.out.println("objects[color] = " + objects[color]); |
---|
16711 | 16805 | //objects[color].Select(); |
---|
16712 | 16806 | indexcount = 0; |
---|
| 16807 | + ObjEditor window = object.GetWindow(); |
---|
| 16808 | + if (window != null && deselect) |
---|
| 16809 | + { |
---|
| 16810 | + window.Select(null, deselect, true); |
---|
| 16811 | + } |
---|
16713 | 16812 | object.Select(color, deselect); |
---|
16714 | 16813 | } |
---|
16715 | 16814 | |
---|
.. | .. |
---|
17235 | 17334 | int AAbuffersize = 0; |
---|
17236 | 17335 | |
---|
17237 | 17336 | //double[] selectedpoint = new double[3]; |
---|
17238 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17337 | + static Superellipsoid selectedpoint; |
---|
17239 | 17338 | static Sphere previousselectedpoint = null; |
---|
17240 | | - static Sphere debugpointG = new Sphere(); |
---|
17241 | | - static Sphere debugpointP = new Sphere(); |
---|
17242 | | - static Sphere debugpointC = new Sphere(); |
---|
17243 | | - static Sphere debugpointR = new Sphere(); |
---|
| 17339 | + static Sphere debugpointG; |
---|
| 17340 | + static Sphere debugpointP; |
---|
| 17341 | + static Sphere debugpointC; |
---|
| 17342 | + static Sphere debugpointR; |
---|
17244 | 17343 | |
---|
17245 | 17344 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17246 | 17345 | |
---|
17247 | | - static |
---|
17248 | | - { |
---|
17249 | | - for (int i=0; i<8; i++) |
---|
17250 | | - { |
---|
17251 | | - debugpoints[i] = new Sphere(); |
---|
17252 | | - } |
---|
17253 | | - } |
---|
17254 | | - |
---|
17255 | 17346 | static void InitPoints(float radius) |
---|
17256 | 17347 | { |
---|
17257 | 17348 | for (int i=0; i<8; i++) |
---|