.. | .. |
---|
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 |
---|
.. | .. |
---|
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()) |
---|
.. | .. |
---|
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(); |
---|
.. | .. |
---|
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 |
---|
.. | .. |
---|
13820 | 13882 | else |
---|
13821 | 13883 | if (evt.getSource() == AAtimer) |
---|
13822 | 13884 | { |
---|
| 13885 | + Globals.TIMERRUNNING = false; |
---|
13823 | 13886 | if (mouseDown) |
---|
13824 | 13887 | { |
---|
13825 | 13888 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13894 | 13957 | return; |
---|
13895 | 13958 | |
---|
13896 | 13959 | AAtimer.restart(); // |
---|
| 13960 | + Globals.TIMERRUNNING = true; |
---|
13897 | 13961 | |
---|
13898 | 13962 | // waslive = LIVE; |
---|
13899 | 13963 | // LIVE = false; |
---|
.. | .. |
---|
14357 | 14421 | info.camera = renderCamera; |
---|
14358 | 14422 | info.x = x; |
---|
14359 | 14423 | info.y = y; |
---|
14360 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14424 | + object.GetWindow().copy |
---|
| 14425 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14361 | 14426 | } else |
---|
14362 | 14427 | { |
---|
14363 | 14428 | if (x < startX) |
---|
.. | .. |
---|
14521 | 14586 | ci.camera = renderCamera; |
---|
14522 | 14587 | if (!isRenderer) |
---|
14523 | 14588 | { |
---|
14524 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14589 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14590 | + //Object3D copy = editWindow.copy; |
---|
| 14591 | + if (object.doEditClick(ci, 0)) |
---|
14525 | 14592 | { |
---|
14526 | 14593 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14527 | 14594 | } else |
---|
.. | .. |
---|
14902 | 14969 | RevertCamera(); |
---|
14903 | 14970 | repaint(); |
---|
14904 | 14971 | break; |
---|
14905 | | - case 'L': |
---|
14906 | 14972 | case 'l': |
---|
| 14973 | + lightMode ^= true; |
---|
| 14974 | + Globals.lighttouched = true; |
---|
| 14975 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 14976 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14977 | + repaint(); |
---|
| 14978 | + break; |
---|
| 14979 | + case 'L': |
---|
14907 | 14980 | if (lightMode) |
---|
14908 | 14981 | { |
---|
14909 | 14982 | lightMode = false; |
---|
.. | .. |
---|
15050 | 15123 | kompactbit = 6; |
---|
15051 | 15124 | break; |
---|
15052 | 15125 | case ' ': |
---|
15053 | | - lightMode ^= true; |
---|
15054 | | - Globals.lighttouched = true; |
---|
15055 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
15056 | | - targetLookAt.set(manipCamera.lookAt); |
---|
| 15126 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
15057 | 15127 | repaint(); |
---|
15058 | 15128 | break; |
---|
15059 | 15129 | //case '`' : |
---|
15060 | 15130 | case ESC: |
---|
15061 | 15131 | RENDERPROGRAM += 1; |
---|
15062 | 15132 | RENDERPROGRAM %= 3; |
---|
| 15133 | + |
---|
15063 | 15134 | repaint(); |
---|
15064 | 15135 | break; |
---|
15065 | 15136 | case 'Z': |
---|
.. | .. |
---|
15351 | 15422 | } |
---|
15352 | 15423 | */ |
---|
15353 | 15424 | |
---|
15354 | | - object.editWindow.EditSelection(); |
---|
| 15425 | + object.editWindow.EditSelection(false); |
---|
15355 | 15426 | } |
---|
15356 | 15427 | |
---|
15357 | 15428 | void SelectParent() |
---|
.. | .. |
---|
16363 | 16434 | cStatic.objectstack[materialdepth++] = checker; |
---|
16364 | 16435 | //System.out.println("material " + material); |
---|
16365 | 16436 | //Applet3D.tracein(this, selected); |
---|
16366 | | - vector2buffer = checker.projectedVertices; |
---|
| 16437 | + //vector2buffer = checker.projectedVertices; |
---|
16367 | 16438 | |
---|
16368 | 16439 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16369 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16440 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16370 | 16441 | |
---|
16371 | 16442 | materialdepth -= 1; |
---|
16372 | 16443 | if (materialdepth > 0) |
---|
16373 | 16444 | { |
---|
16374 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16375 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16445 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16446 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16376 | 16447 | } |
---|
16377 | 16448 | //checker.GetMaterial().opacity = 1f; |
---|
16378 | 16449 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16596 | 16667 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16597 | 16668 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
16598 | 16669 | |
---|
| 16670 | + CreateSelectedPoint(); |
---|
| 16671 | + |
---|
16599 | 16672 | // Will fit the mesh !!! |
---|
16600 | 16673 | selectedpoint.toParent[0][0] = 0.0001; |
---|
16601 | 16674 | selectedpoint.toParent[1][1] = 0.0001; |
---|
.. | .. |
---|
16710 | 16783 | //System.out.println("objects[color] = " + objects[color]); |
---|
16711 | 16784 | //objects[color].Select(); |
---|
16712 | 16785 | indexcount = 0; |
---|
| 16786 | + ObjEditor window = object.GetWindow(); |
---|
| 16787 | + if (window != null && deselect) |
---|
| 16788 | + { |
---|
| 16789 | + window.Select(null, deselect, true); |
---|
| 16790 | + } |
---|
16713 | 16791 | object.Select(color, deselect); |
---|
16714 | 16792 | } |
---|
16715 | 16793 | |
---|
.. | .. |
---|
17235 | 17313 | int AAbuffersize = 0; |
---|
17236 | 17314 | |
---|
17237 | 17315 | //double[] selectedpoint = new double[3]; |
---|
17238 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17316 | + static Superellipsoid selectedpoint; |
---|
17239 | 17317 | 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(); |
---|
| 17318 | + static Sphere debugpointG; |
---|
| 17319 | + static Sphere debugpointP; |
---|
| 17320 | + static Sphere debugpointC; |
---|
| 17321 | + static Sphere debugpointR; |
---|
17244 | 17322 | |
---|
17245 | 17323 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17246 | 17324 | |
---|
17247 | | - static |
---|
17248 | | - { |
---|
17249 | | - for (int i=0; i<8; i++) |
---|
17250 | | - { |
---|
17251 | | - debugpoints[i] = new Sphere(); |
---|
17252 | | - } |
---|
17253 | | - } |
---|
17254 | | - |
---|
17255 | 17325 | static void InitPoints(float radius) |
---|
17256 | 17326 | { |
---|
17257 | 17327 | for (int i=0; i<8; i++) |
---|