.. | .. |
---|
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; |
---|
.. | .. |
---|
359 | 358 | /**/ |
---|
360 | 359 | } else |
---|
361 | 360 | { |
---|
362 | | - DrawMaterial(material, selected); |
---|
| 361 | + DrawMaterial(material, selected, obj.projectedVertices); |
---|
363 | 362 | } |
---|
364 | 363 | } else |
---|
365 | 364 | { |
---|
.. | .. |
---|
383 | 382 | cStatic.objectstack[materialdepth++] = obj; |
---|
384 | 383 | //System.out.println("material " + material); |
---|
385 | 384 | //Applet3D.tracein("selected ", selected); |
---|
386 | | - display.vector2buffer = obj.projectedVertices; |
---|
387 | | - display.DrawMaterial(material, selected); |
---|
| 385 | + //display.vector2buffer = obj.projectedVertices; |
---|
| 386 | + display.DrawMaterial(material, selected, obj.projectedVertices); |
---|
388 | 387 | } |
---|
389 | 388 | } |
---|
390 | 389 | |
---|
.. | .. |
---|
401 | 400 | materialdepth -= 1; |
---|
402 | 401 | if (materialdepth > 0) |
---|
403 | 402 | { |
---|
404 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
405 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 403 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 404 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
406 | 405 | } |
---|
407 | 406 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
408 | 407 | } else if (selected && CameraPane.flash && obj.GetMaterial() != null) |
---|
.. | .. |
---|
422 | 421 | materialdepth -= 1; |
---|
423 | 422 | if (materialdepth > 0) |
---|
424 | 423 | { |
---|
425 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
426 | | - display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 424 | + //display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 425 | + display.DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
427 | 426 | } |
---|
428 | 427 | //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
429 | 428 | //else |
---|
.. | .. |
---|
464 | 463 | if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
465 | 464 | { |
---|
466 | 465 | //gl.glBegin(gl.GL_TRIANGLES); |
---|
467 | | - boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
| 466 | + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0) |
---|
| 467 | + // TEST LIVE NORMALS && !obj.dontselect |
---|
| 468 | + ; |
---|
468 | 469 | if (!hasnorm) |
---|
469 | 470 | { |
---|
470 | | - // System.out.println("FUCK!!"); |
---|
| 471 | + // System.out.println("Mesh normal"); |
---|
471 | 472 | LA.vecSub(pv/*.pos*/, qv/*.pos*/, obj.v0); |
---|
472 | 473 | LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1); |
---|
473 | 474 | LA.vecCross(obj.v0, obj.v1, obj.v2); |
---|
.. | .. |
---|
1192 | 1193 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1193 | 1194 | } |
---|
1194 | 1195 | } |
---|
| 1196 | + |
---|
1195 | 1197 | if (flipV) |
---|
1196 | 1198 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1197 | 1199 | else |
---|
1198 | 1200 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1201 | + |
---|
1199 | 1202 | //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1200 | 1203 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1201 | 1204 | |
---|
.. | .. |
---|
1215 | 1218 | gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
1216 | 1219 | } |
---|
1217 | 1220 | } |
---|
| 1221 | + |
---|
1218 | 1222 | if (flipV) |
---|
1219 | 1223 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1220 | 1224 | else |
---|
1221 | 1225 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1226 | + |
---|
1222 | 1227 | //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
1223 | 1228 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
1224 | 1229 | |
---|
.. | .. |
---|
1246 | 1251 | gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
1247 | 1252 | else |
---|
1248 | 1253 | gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
| 1254 | + |
---|
1249 | 1255 | //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
1250 | 1256 | gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
| 1257 | + |
---|
1251 | 1258 | count2 += 2; |
---|
1252 | 1259 | count3 += 3; |
---|
1253 | 1260 | } |
---|
.. | .. |
---|
1603 | 1610 | // gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
1604 | 1611 | } |
---|
1605 | 1612 | |
---|
1606 | | - void DrawMaterial(cMaterial material, boolean selected) |
---|
| 1613 | + void DrawMaterial(cMaterial material, boolean selected, Object3D.cVector2[] others) |
---|
1607 | 1614 | { |
---|
1608 | 1615 | CameraPane display = this; |
---|
1609 | 1616 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
1638 | 1645 | colorV[0] = display.modelParams0[0] * material.diffuse; |
---|
1639 | 1646 | colorV[1] = display.modelParams0[1] * material.diffuse; |
---|
1640 | 1647 | colorV[2] = display.modelParams0[2] * material.diffuse; |
---|
1641 | | - colorV[3] = material.opacity; |
---|
| 1648 | + colorV[3] = 1; // material.opacity; |
---|
1642 | 1649 | |
---|
1643 | 1650 | gl.glColor4f(colorV[0], colorV[1], colorV[2], material.opacity); |
---|
1644 | 1651 | //System.out.println("Opacity = " + opacity); |
---|
.. | .. |
---|
1746 | 1753 | display.modelParams7[2] = 0; |
---|
1747 | 1754 | display.modelParams7[3] = 0; |
---|
1748 | 1755 | |
---|
1749 | | - display.modelParams6[0] = 100; // criss de bug de bump |
---|
| 1756 | + //display.modelParams6[0] = 100; // criss de bug de bump |
---|
1750 | 1757 | |
---|
1751 | | - Object3D.cVector2[] extparams = display.vector2buffer; |
---|
| 1758 | + Object3D.cVector2[] extparams = others; // display.vector2buffer; |
---|
1752 | 1759 | if (extparams != null && extparams.length > 0 && extparams[0] != null) |
---|
1753 | 1760 | { |
---|
1754 | 1761 | display.modelParams6[0] = extparams[0].x / 1000.0f; // bump |
---|
.. | .. |
---|
2259 | 2266 | |
---|
2260 | 2267 | void ToggleDebug() |
---|
2261 | 2268 | { |
---|
2262 | | - DEBUG ^= true; |
---|
| 2269 | + Globals.DEBUG ^= true; |
---|
2263 | 2270 | } |
---|
2264 | 2271 | |
---|
2265 | 2272 | void ToggleLookAt() |
---|
.. | .. |
---|
10474 | 10481 | ANTIALIAS = 0; |
---|
10475 | 10482 | //System.out.println("RESTART"); |
---|
10476 | 10483 | AAtimer.restart(); |
---|
| 10484 | + Globals.TIMERRUNNING = true; |
---|
10477 | 10485 | } |
---|
10478 | 10486 | } |
---|
10479 | 10487 | } |
---|
.. | .. |
---|
10541 | 10549 | ambientOcclusion = false; |
---|
10542 | 10550 | } |
---|
10543 | 10551 | |
---|
10544 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10552 | + if (//Globals.lighttouched && |
---|
| 10553 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10545 | 10554 | { |
---|
10546 | 10555 | //if (RENDERSHADOW) // ? |
---|
10547 | 10556 | if (!IsFrozen()) |
---|
.. | .. |
---|
11451 | 11460 | |
---|
11452 | 11461 | static boolean zoomonce = false; |
---|
11453 | 11462 | |
---|
| 11463 | + static void CreateSelectedPoint() |
---|
| 11464 | + { |
---|
| 11465 | + if (selectedpoint == null) |
---|
| 11466 | + { |
---|
| 11467 | + debugpointG = new Sphere(); |
---|
| 11468 | + debugpointP = new Sphere(); |
---|
| 11469 | + debugpointC = new Sphere(); |
---|
| 11470 | + debugpointR = new Sphere(); |
---|
| 11471 | + |
---|
| 11472 | + selectedpoint = new Superellipsoid(); |
---|
| 11473 | + |
---|
| 11474 | + for (int i=0; i<8; i++) |
---|
| 11475 | + { |
---|
| 11476 | + debugpoints[i] = new Sphere(); |
---|
| 11477 | + } |
---|
| 11478 | + } |
---|
| 11479 | + } |
---|
| 11480 | + |
---|
11454 | 11481 | void DrawObject(GL gl, boolean draw) |
---|
11455 | 11482 | { |
---|
11456 | 11483 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
.. | .. |
---|
11531 | 11558 | |
---|
11532 | 11559 | if (DrawMode() == DEFAULT) |
---|
11533 | 11560 | { |
---|
11534 | | - if (DEBUG) |
---|
| 11561 | + if (Globals.DEBUG) |
---|
11535 | 11562 | { |
---|
| 11563 | + CreateSelectedPoint(); |
---|
11536 | 11564 | float radius = 0.05f; |
---|
11537 | 11565 | if (selectedpoint.radius != radius) |
---|
11538 | 11566 | { |
---|
.. | .. |
---|
13289 | 13317 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13290 | 13318 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13291 | 13319 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13292 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13320 | + |
---|
| 13321 | + //Object3D.cVector2[] vector2buffer; |
---|
13293 | 13322 | |
---|
13294 | 13323 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13295 | 13324 | // OUT : diff, spec |
---|
.. | .. |
---|
13812 | 13841 | else |
---|
13813 | 13842 | if (evt.getSource() == AAtimer) |
---|
13814 | 13843 | { |
---|
| 13844 | + Globals.TIMERRUNNING = false; |
---|
13815 | 13845 | if (mouseDown) |
---|
13816 | 13846 | { |
---|
13817 | 13847 | //new Exception().printStackTrace(); |
---|
.. | .. |
---|
13886 | 13916 | return; |
---|
13887 | 13917 | |
---|
13888 | 13918 | AAtimer.restart(); // |
---|
| 13919 | + Globals.TIMERRUNNING = true; |
---|
13889 | 13920 | |
---|
13890 | 13921 | // waslive = LIVE; |
---|
13891 | 13922 | // LIVE = false; |
---|
.. | .. |
---|
14349 | 14380 | info.camera = renderCamera; |
---|
14350 | 14381 | info.x = x; |
---|
14351 | 14382 | info.y = y; |
---|
14352 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14383 | + object.GetWindow().copy |
---|
| 14384 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14353 | 14385 | } else |
---|
14354 | 14386 | { |
---|
14355 | 14387 | if (x < startX) |
---|
.. | .. |
---|
14513 | 14545 | ci.camera = renderCamera; |
---|
14514 | 14546 | if (!isRenderer) |
---|
14515 | 14547 | { |
---|
14516 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14548 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14549 | + //Object3D copy = editWindow.copy; |
---|
| 14550 | + if (object.doEditClick(ci, 0)) |
---|
14517 | 14551 | { |
---|
14518 | 14552 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14519 | 14553 | } else |
---|
.. | .. |
---|
14894 | 14928 | RevertCamera(); |
---|
14895 | 14929 | repaint(); |
---|
14896 | 14930 | break; |
---|
14897 | | - case 'L': |
---|
14898 | 14931 | case 'l': |
---|
| 14932 | + lightMode ^= true; |
---|
| 14933 | + Globals.lighttouched = true; |
---|
| 14934 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 14935 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14936 | + repaint(); |
---|
| 14937 | + break; |
---|
| 14938 | + case 'L': |
---|
14899 | 14939 | if (lightMode) |
---|
14900 | 14940 | { |
---|
14901 | 14941 | lightMode = false; |
---|
.. | .. |
---|
15042 | 15082 | kompactbit = 6; |
---|
15043 | 15083 | break; |
---|
15044 | 15084 | case ' ': |
---|
15045 | | - lightMode ^= true; |
---|
15046 | | - Globals.lighttouched = true; |
---|
15047 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
15048 | | - targetLookAt.set(manipCamera.lookAt); |
---|
| 15085 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
15049 | 15086 | repaint(); |
---|
15050 | 15087 | break; |
---|
15051 | 15088 | //case '`' : |
---|
15052 | 15089 | case ESC: |
---|
15053 | 15090 | RENDERPROGRAM += 1; |
---|
15054 | 15091 | RENDERPROGRAM %= 3; |
---|
| 15092 | + |
---|
15055 | 15093 | repaint(); |
---|
15056 | 15094 | break; |
---|
15057 | 15095 | case 'Z': |
---|
.. | .. |
---|
15343 | 15381 | } |
---|
15344 | 15382 | */ |
---|
15345 | 15383 | |
---|
15346 | | - object.editWindow.EditSelection(); |
---|
| 15384 | + object.editWindow.EditSelection(false); |
---|
15347 | 15385 | } |
---|
15348 | 15386 | |
---|
15349 | 15387 | void SelectParent() |
---|
.. | .. |
---|
16355 | 16393 | cStatic.objectstack[materialdepth++] = checker; |
---|
16356 | 16394 | //System.out.println("material " + material); |
---|
16357 | 16395 | //Applet3D.tracein(this, selected); |
---|
16358 | | - vector2buffer = checker.projectedVertices; |
---|
| 16396 | + //vector2buffer = checker.projectedVertices; |
---|
16359 | 16397 | |
---|
16360 | 16398 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16361 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16399 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16362 | 16400 | |
---|
16363 | 16401 | materialdepth -= 1; |
---|
16364 | 16402 | if (materialdepth > 0) |
---|
16365 | 16403 | { |
---|
16366 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16367 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16404 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16405 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16368 | 16406 | } |
---|
16369 | 16407 | //checker.GetMaterial().opacity = 1f; |
---|
16370 | 16408 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16587 | 16625 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16588 | 16626 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16589 | 16627 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16628 | + |
---|
| 16629 | + CreateSelectedPoint(); |
---|
16590 | 16630 | |
---|
16591 | 16631 | // Will fit the mesh !!! |
---|
16592 | 16632 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
17227 | 17267 | int AAbuffersize = 0; |
---|
17228 | 17268 | |
---|
17229 | 17269 | //double[] selectedpoint = new double[3]; |
---|
17230 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17270 | + static Superellipsoid selectedpoint; |
---|
17231 | 17271 | 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(); |
---|
| 17272 | + static Sphere debugpointG; |
---|
| 17273 | + static Sphere debugpointP; |
---|
| 17274 | + static Sphere debugpointC; |
---|
| 17275 | + static Sphere debugpointR; |
---|
17236 | 17276 | |
---|
17237 | 17277 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17238 | 17278 | |
---|
17239 | | - static |
---|
17240 | | - { |
---|
17241 | | - for (int i=0; i<8; i++) |
---|
17242 | | - { |
---|
17243 | | - debugpoints[i] = new Sphere(); |
---|
17244 | | - } |
---|
17245 | | - } |
---|
17246 | | - |
---|
17247 | 17279 | static void InitPoints(float radius) |
---|
17248 | 17280 | { |
---|
17249 | 17281 | for (int i=0; i<8; i++) |
---|