.. | .. |
---|
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() |
---|
.. | .. |
---|
10541 | 10548 | ambientOcclusion = false; |
---|
10542 | 10549 | } |
---|
10543 | 10550 | |
---|
10544 | | - if (Globals.lighttouched && DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
| 10551 | + if (//Globals.lighttouched && |
---|
| 10552 | + DrawMode() == DEFAULT) // && !lightMode) // && !FROZEN) |
---|
10545 | 10553 | { |
---|
10546 | 10554 | //if (RENDERSHADOW) // ? |
---|
10547 | 10555 | if (!IsFrozen()) |
---|
.. | .. |
---|
11451 | 11459 | |
---|
11452 | 11460 | static boolean zoomonce = false; |
---|
11453 | 11461 | |
---|
| 11462 | + static void CreateSelectedPoint() |
---|
| 11463 | + { |
---|
| 11464 | + if (selectedpoint == null) |
---|
| 11465 | + { |
---|
| 11466 | + debugpointG = new Sphere(); |
---|
| 11467 | + debugpointP = new Sphere(); |
---|
| 11468 | + debugpointC = new Sphere(); |
---|
| 11469 | + debugpointR = new Sphere(); |
---|
| 11470 | + |
---|
| 11471 | + selectedpoint = new Superellipsoid(); |
---|
| 11472 | + |
---|
| 11473 | + for (int i=0; i<8; i++) |
---|
| 11474 | + { |
---|
| 11475 | + debugpoints[i] = new Sphere(); |
---|
| 11476 | + } |
---|
| 11477 | + } |
---|
| 11478 | + } |
---|
| 11479 | + |
---|
11454 | 11480 | void DrawObject(GL gl, boolean draw) |
---|
11455 | 11481 | { |
---|
11456 | 11482 | //System.out.println("DRAW OBJECT " + mouseDown); |
---|
.. | .. |
---|
11531 | 11557 | |
---|
11532 | 11558 | if (DrawMode() == DEFAULT) |
---|
11533 | 11559 | { |
---|
11534 | | - if (DEBUG) |
---|
| 11560 | + if (Globals.DEBUG) |
---|
11535 | 11561 | { |
---|
| 11562 | + CreateSelectedPoint(); |
---|
11536 | 11563 | float radius = 0.05f; |
---|
11537 | 11564 | if (selectedpoint.radius != radius) |
---|
11538 | 11565 | { |
---|
.. | .. |
---|
13289 | 13316 | /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias |
---|
13290 | 13317 | /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough |
---|
13291 | 13318 | /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power |
---|
13292 | | - Object3D.cVector2[] vector2buffer; |
---|
| 13319 | + |
---|
| 13320 | + //Object3D.cVector2[] vector2buffer; |
---|
13293 | 13321 | |
---|
13294 | 13322 | // IN : ndotl, ndoth, xxx, NdotL //, snininess, lightarea |
---|
13295 | 13323 | // OUT : diff, spec |
---|
.. | .. |
---|
14349 | 14377 | info.camera = renderCamera; |
---|
14350 | 14378 | info.x = x; |
---|
14351 | 14379 | info.y = y; |
---|
14352 | | - object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
| 14380 | + object.manipWindow.copy |
---|
| 14381 | + .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
---|
14353 | 14382 | } else |
---|
14354 | 14383 | { |
---|
14355 | 14384 | if (x < startX) |
---|
.. | .. |
---|
14513 | 14542 | ci.camera = renderCamera; |
---|
14514 | 14543 | if (!isRenderer) |
---|
14515 | 14544 | { |
---|
14516 | | - if (object.editWindow.copy.doEditClick(ci, 0)) |
---|
| 14545 | + //ObjEditor editWindow = object.editWindow; |
---|
| 14546 | + //Object3D copy = editWindow.copy; |
---|
| 14547 | + if (object.doEditClick(ci, 0)) |
---|
14517 | 14548 | { |
---|
14518 | 14549 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
---|
14519 | 14550 | } else |
---|
.. | .. |
---|
14894 | 14925 | RevertCamera(); |
---|
14895 | 14926 | repaint(); |
---|
14896 | 14927 | break; |
---|
14897 | | - case 'L': |
---|
14898 | 14928 | case 'l': |
---|
| 14929 | + lightMode ^= true; |
---|
| 14930 | + Globals.lighttouched = true; |
---|
| 14931 | + manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
| 14932 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14933 | + repaint(); |
---|
| 14934 | + break; |
---|
| 14935 | + case 'L': |
---|
14899 | 14936 | if (lightMode) |
---|
14900 | 14937 | { |
---|
14901 | 14938 | lightMode = false; |
---|
.. | .. |
---|
15042 | 15079 | kompactbit = 6; |
---|
15043 | 15080 | break; |
---|
15044 | 15081 | case ' ': |
---|
15045 | | - lightMode ^= true; |
---|
15046 | | - Globals.lighttouched = true; |
---|
15047 | | - manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera; |
---|
15048 | | - targetLookAt.set(manipCamera.lookAt); |
---|
| 15082 | + ObjEditor.theFrame.ToggleFullScreen(); |
---|
15049 | 15083 | repaint(); |
---|
15050 | 15084 | break; |
---|
15051 | 15085 | //case '`' : |
---|
15052 | 15086 | case ESC: |
---|
15053 | 15087 | RENDERPROGRAM += 1; |
---|
15054 | 15088 | RENDERPROGRAM %= 3; |
---|
| 15089 | + |
---|
15055 | 15090 | repaint(); |
---|
15056 | 15091 | break; |
---|
15057 | 15092 | case 'Z': |
---|
.. | .. |
---|
16355 | 16390 | cStatic.objectstack[materialdepth++] = checker; |
---|
16356 | 16391 | //System.out.println("material " + material); |
---|
16357 | 16392 | //Applet3D.tracein(this, selected); |
---|
16358 | | - vector2buffer = checker.projectedVertices; |
---|
| 16393 | + //vector2buffer = checker.projectedVertices; |
---|
16359 | 16394 | |
---|
16360 | 16395 | //checker.GetMaterial().Draw(this, false); // true); |
---|
16361 | | - DrawMaterial(checker.GetMaterial(), false); // true); |
---|
| 16396 | + DrawMaterial(checker.GetMaterial(), false, checker.projectedVertices); // true); |
---|
16362 | 16397 | |
---|
16363 | 16398 | materialdepth -= 1; |
---|
16364 | 16399 | if (materialdepth > 0) |
---|
16365 | 16400 | { |
---|
16366 | | - vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
16367 | | - DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1]); |
---|
| 16401 | + //vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
| 16402 | + DrawMaterial(materialstack[materialdepth - 1], selectedstack[materialdepth - 1], cStatic.objectstack[materialdepth - 1].projectedVertices); |
---|
16368 | 16403 | } |
---|
16369 | 16404 | //checker.GetMaterial().opacity = 1f; |
---|
16370 | 16405 | ////checker.GetMaterial().ambient = 1f; |
---|
.. | .. |
---|
16587 | 16622 | // System.err.println("view = " + view[4] + " " + view[5] + " " + view[6] + " " + view[7]); |
---|
16588 | 16623 | // System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]); |
---|
16589 | 16624 | // System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]); |
---|
| 16625 | + |
---|
| 16626 | + CreateSelectedPoint(); |
---|
16590 | 16627 | |
---|
16591 | 16628 | // Will fit the mesh !!! |
---|
16592 | 16629 | selectedpoint.toParent[0][0] = 0.0001; |
---|
.. | .. |
---|
17227 | 17264 | int AAbuffersize = 0; |
---|
17228 | 17265 | |
---|
17229 | 17266 | //double[] selectedpoint = new double[3]; |
---|
17230 | | - static Superellipsoid selectedpoint = new Superellipsoid(); |
---|
| 17267 | + static Superellipsoid selectedpoint; |
---|
17231 | 17268 | 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(); |
---|
| 17269 | + static Sphere debugpointG; |
---|
| 17270 | + static Sphere debugpointP; |
---|
| 17271 | + static Sphere debugpointC; |
---|
| 17272 | + static Sphere debugpointR; |
---|
17236 | 17273 | |
---|
17237 | 17274 | static Sphere debugpoints[] = new Sphere[8]; |
---|
17238 | 17275 | |
---|
17239 | | - static |
---|
17240 | | - { |
---|
17241 | | - for (int i=0; i<8; i++) |
---|
17242 | | - { |
---|
17243 | | - debugpoints[i] = new Sphere(); |
---|
17244 | | - } |
---|
17245 | | - } |
---|
17246 | | - |
---|
17247 | 17276 | static void InitPoints(float radius) |
---|
17248 | 17277 | { |
---|
17249 | 17278 | for (int i=0; i<8; i++) |
---|