.. | .. |
---|
5 | 5 | import java.util.Vector; |
---|
6 | 6 | |
---|
7 | 7 | import javax.media.j3d.Transform3D; |
---|
| 8 | +import javax.media.opengl.GL; |
---|
8 | 9 | import javax.vecmath.Vector3d; |
---|
9 | 10 | |
---|
10 | 11 | import javax.imageio.ImageIO; |
---|
.. | .. |
---|
430 | 431 | { |
---|
431 | 432 | Object3D copy = this; |
---|
432 | 433 | |
---|
433 | | - Camera parentcam = CameraPane.theRenderer.ManipCamera(); |
---|
| 434 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
434 | 435 | |
---|
435 | | - if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[0]) |
---|
| 436 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
436 | 437 | { |
---|
437 | | - parentcam = CameraPane.theRenderer.Cameras()[1]; |
---|
| 438 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
438 | 439 | } |
---|
439 | 440 | |
---|
440 | | - if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[1]) |
---|
| 441 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
441 | 442 | { |
---|
442 | | - parentcam = CameraPane.theRenderer.Cameras()[0]; |
---|
| 443 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
443 | 444 | } |
---|
444 | 445 | |
---|
445 | 446 | if (this == parentcam) |
---|
.. | .. |
---|
447 | 448 | //assert(this instanceof Camera); |
---|
448 | 449 | |
---|
449 | 450 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
450 | | - LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.toParent, CameraPane.theRenderer.TargetLookAt()); |
---|
| 451 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
451 | 452 | } |
---|
452 | 453 | |
---|
453 | 454 | copy.marked ^= true; |
---|
.. | .. |
---|
467 | 468 | //assert(this instanceof Camera); |
---|
468 | 469 | |
---|
469 | 470 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
470 | | - LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.fromParent, CameraPane.theRenderer.TargetLookAt()); |
---|
| 471 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
471 | 472 | } |
---|
472 | 473 | |
---|
473 | 474 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
796 | 797 | |
---|
797 | 798 | if (marked && Globals.isLIVE() && live && |
---|
798 | 799 | //TEMP21aug2018 |
---|
799 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 800 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
800 | 801 | currentframe != Globals.framecount) |
---|
801 | 802 | { |
---|
802 | 803 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
911 | 912 | fromParent = null; // LA.newMatrix(); |
---|
912 | 913 | bRep = null; // new BoundaryRep(); |
---|
913 | 914 | |
---|
| 915 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 916 | + { |
---|
| 917 | + name = oname; |
---|
| 918 | + } |
---|
| 919 | + |
---|
914 | 920 | /* |
---|
915 | 921 | float hue = (float)Math.random(); |
---|
916 | 922 | Color col; |
---|
.. | .. |
---|
953 | 959 | |
---|
954 | 960 | public Object clone() |
---|
955 | 961 | { |
---|
956 | | - return GrafreeD.clone(this); |
---|
| 962 | + return Grafreed.clone(this); |
---|
957 | 963 | } |
---|
958 | 964 | |
---|
959 | 965 | Object3D copyExpand() |
---|
.. | .. |
---|
1469 | 1475 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1470 | 1476 | |
---|
1471 | 1477 | // Set default to 0.1 |
---|
1472 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1478 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1473 | 1479 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1474 | 1480 | } |
---|
1475 | 1481 | |
---|
.. | .. |
---|
1728 | 1734 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1729 | 1735 | o.bRep = transientrep; |
---|
1730 | 1736 | if (clone) |
---|
1731 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1737 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1732 | 1738 | o.CreateMaterial(); |
---|
1733 | 1739 | o.SetAttributes(this, -1); |
---|
1734 | 1740 | //parent |
---|
.. | .. |
---|
1741 | 1747 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1742 | 1748 | o.bRep = bRep; |
---|
1743 | 1749 | if (clone) |
---|
1744 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1750 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1745 | 1751 | o.CreateMaterial(); |
---|
1746 | 1752 | //o.overwriteThis(this, -1); |
---|
1747 | 1753 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
2299 | 2305 | { |
---|
2300 | 2306 | if (newWindow) |
---|
2301 | 2307 | { |
---|
| 2308 | + new Exception().printStackTrace(); |
---|
2302 | 2309 | System.exit(0); |
---|
2303 | 2310 | if (parent != null) |
---|
2304 | 2311 | { |
---|
.. | .. |
---|
2475 | 2482 | return retval; |
---|
2476 | 2483 | } |
---|
2477 | 2484 | |
---|
2478 | | - void doEditDrag(ClickInfo info) |
---|
| 2485 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2479 | 2486 | { |
---|
2480 | 2487 | switch (doSomething) |
---|
2481 | 2488 | { |
---|
2482 | 2489 | case 1: // '\001' |
---|
2483 | 2490 | //super. |
---|
2484 | | - doEditDrag0(info); |
---|
| 2491 | + doEditDrag0(info, opposite); |
---|
2485 | 2492 | break; |
---|
2486 | 2493 | |
---|
2487 | 2494 | case 2: // '\002' |
---|
.. | .. |
---|
2494 | 2501 | { |
---|
2495 | 2502 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2496 | 2503 | //childToDrag.doEditDrag(info); |
---|
2497 | | - sel.doEditDrag(info); |
---|
| 2504 | + sel.doEditDrag(info, opposite); |
---|
2498 | 2505 | } else |
---|
2499 | 2506 | { |
---|
2500 | 2507 | //super. |
---|
2501 | | - doEditDrag0(info); |
---|
| 2508 | + doEditDrag0(info, opposite); |
---|
2502 | 2509 | } |
---|
2503 | 2510 | } |
---|
2504 | 2511 | break; |
---|
.. | .. |
---|
2905 | 2912 | { |
---|
2906 | 2913 | if (bRep != null) |
---|
2907 | 2914 | { |
---|
2908 | | - bRep.GenUV(); |
---|
| 2915 | + bRep.GenUV(); //1); |
---|
| 2916 | + //bRep.UnfoldUV(); |
---|
2909 | 2917 | Touch(); |
---|
2910 | 2918 | } |
---|
2911 | 2919 | } |
---|
.. | .. |
---|
2980 | 2988 | blockloop = false; |
---|
2981 | 2989 | } |
---|
2982 | 2990 | |
---|
| 2991 | + void TransformChildren() |
---|
| 2992 | + { |
---|
| 2993 | + if (toParent != null) |
---|
| 2994 | + { |
---|
| 2995 | + for (int i=Size(); --i>=0;) |
---|
| 2996 | + { |
---|
| 2997 | + Object3D v = get(i); |
---|
| 2998 | + |
---|
| 2999 | + if (v.toParent == null) |
---|
| 3000 | + { |
---|
| 3001 | + v.toParent = LA.newMatrix(); |
---|
| 3002 | + v.fromParent = LA.newMatrix(); |
---|
| 3003 | + } |
---|
| 3004 | + |
---|
| 3005 | + LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3006 | + LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3007 | + } |
---|
| 3008 | + |
---|
| 3009 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3010 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3011 | + |
---|
| 3012 | + Touch(); |
---|
| 3013 | + } |
---|
| 3014 | + } |
---|
| 3015 | + |
---|
2983 | 3016 | void TransformGeometry() |
---|
2984 | 3017 | { |
---|
2985 | 3018 | Object3D obj = this; |
---|
.. | .. |
---|
3201 | 3234 | |
---|
3202 | 3235 | BoundaryRep sup = bRep.support; |
---|
3203 | 3236 | bRep.support = null; |
---|
3204 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3237 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3205 | 3238 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3206 | 3239 | temprep.SplitInTwo(reduction34, onlyone); |
---|
3207 | 3240 | bRep = temprep; |
---|
.. | .. |
---|
3725 | 3758 | if (child == null) |
---|
3726 | 3759 | continue; |
---|
3727 | 3760 | |
---|
3728 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3761 | + if (Grafreed.RENDERME > 0) |
---|
3729 | 3762 | { |
---|
3730 | 3763 | if (child instanceof Merge) |
---|
3731 | 3764 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3876 | 3909 | if (child == null) |
---|
3877 | 3910 | continue; |
---|
3878 | 3911 | |
---|
3879 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3912 | + if (Grafreed.RENDERME > 0) |
---|
3880 | 3913 | { |
---|
3881 | 3914 | if (child instanceof Merge) |
---|
3882 | 3915 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4071 | 4104 | if (child == null) |
---|
4072 | 4105 | continue; |
---|
4073 | 4106 | |
---|
4074 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4107 | + if (Grafreed.RENDERME > 0) |
---|
4075 | 4108 | { |
---|
4076 | 4109 | if (child instanceof Merge) |
---|
4077 | 4110 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
5156 | 5189 | |
---|
5157 | 5190 | // System.out.println("Fullname = " + fullname); |
---|
5158 | 5191 | |
---|
5159 | | - if (fullname.name.indexOf(":") == -1) |
---|
5160 | | - return fullname.name; |
---|
| 5192 | + // Does not work on Windows due to C: |
---|
| 5193 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5194 | +// return fullname.name; |
---|
| 5195 | +// |
---|
| 5196 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5161 | 5197 | |
---|
5162 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5198 | + String[] split = fullname.name.split(":"); |
---|
| 5199 | + |
---|
| 5200 | + if (split.length == 0) |
---|
| 5201 | + { |
---|
| 5202 | + return ""; |
---|
| 5203 | + } |
---|
| 5204 | + |
---|
| 5205 | + if (split.length <= 2) |
---|
| 5206 | + { |
---|
| 5207 | + if (fullname.name.endsWith(":")) |
---|
| 5208 | + { |
---|
| 5209 | + // Windows |
---|
| 5210 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5211 | + } |
---|
| 5212 | + |
---|
| 5213 | + return split[0]; |
---|
| 5214 | + } |
---|
| 5215 | + |
---|
| 5216 | + // Windows |
---|
| 5217 | + assert(split.length == 4); |
---|
| 5218 | + |
---|
| 5219 | + return split[0] + ":" + split[1]; |
---|
5163 | 5220 | } |
---|
5164 | 5221 | |
---|
5165 | 5222 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5168 | 5225 | return ""; |
---|
5169 | 5226 | |
---|
5170 | 5227 | // System.out.println("Fullname = " + fullname); |
---|
5171 | | - if (fullname.name.indexOf(":") == -1) |
---|
5172 | | - return ""; |
---|
5173 | | - |
---|
5174 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5228 | + // Does not work on Windows due to C: |
---|
| 5229 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5230 | +// return ""; |
---|
| 5231 | +// |
---|
| 5232 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5233 | + String[] split = fullname.name.split(":"); |
---|
| 5234 | + |
---|
| 5235 | + if (split.length == 0) |
---|
| 5236 | + { |
---|
| 5237 | + return ""; |
---|
| 5238 | + } |
---|
| 5239 | + |
---|
| 5240 | + if (split.length == 1) |
---|
| 5241 | + { |
---|
| 5242 | + return ""; |
---|
| 5243 | + } |
---|
| 5244 | + |
---|
| 5245 | + if (split.length == 2) |
---|
| 5246 | + { |
---|
| 5247 | + if (fullname.name.endsWith(":")) |
---|
| 5248 | + { |
---|
| 5249 | + // Windows |
---|
| 5250 | + return ""; |
---|
| 5251 | + } |
---|
| 5252 | + |
---|
| 5253 | + return split[1]; |
---|
| 5254 | + } |
---|
| 5255 | + |
---|
| 5256 | + // Windows |
---|
| 5257 | + assert(split.length == 4); |
---|
| 5258 | + |
---|
| 5259 | + return split[2] + ":" + split[3]; |
---|
5175 | 5260 | } |
---|
5176 | 5261 | |
---|
5177 | 5262 | String GetPigmentTexture() |
---|
.. | .. |
---|
5245 | 5330 | System.out.print("; textures = " + textures); |
---|
5246 | 5331 | System.out.println("; usedtextures = " + usedtextures); |
---|
5247 | 5332 | |
---|
5248 | | - if (GetTextures() == null) |
---|
| 5333 | + if (GetTextures() == null) // What is that?? |
---|
5249 | 5334 | GetTextures().name = ":"; |
---|
5250 | 5335 | |
---|
5251 | 5336 | String texname = tex; |
---|
.. | .. |
---|
5324 | 5409 | return |
---|
5325 | 5410 | CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
5326 | 5411 | // PROBLEM with CROWD!! |
---|
5327 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5412 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5328 | 5413 | } |
---|
5329 | 5414 | |
---|
5330 | 5415 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5371 | 5456 | return; |
---|
5372 | 5457 | } |
---|
5373 | 5458 | |
---|
5374 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5459 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5375 | 5460 | |
---|
5376 | 5461 | /* |
---|
5377 | 5462 | if (touched) |
---|
.. | .. |
---|
5423 | 5508 | //if (displaylist == -1 && usecalllists) |
---|
5424 | 5509 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5425 | 5510 | { |
---|
5426 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5511 | + bRep.displaylist = display.GenList(); |
---|
5427 | 5512 | assert(bRep.displaylist != 0); |
---|
5428 | 5513 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5429 | 5514 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5435 | 5520 | if (usecalllists) |
---|
5436 | 5521 | { |
---|
5437 | 5522 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5438 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5523 | + display.NewList(bRep.displaylist); |
---|
5439 | 5524 | } |
---|
| 5525 | + |
---|
5440 | 5526 | CallList(display, root, selected, blocked); |
---|
| 5527 | + |
---|
5441 | 5528 | // compiled = true; |
---|
5442 | 5529 | if (usecalllists) |
---|
5443 | 5530 | { |
---|
5444 | 5531 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5445 | | - gl.glEndList(); |
---|
| 5532 | + display.EndList(); |
---|
5446 | 5533 | } |
---|
5447 | 5534 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5448 | 5535 | // XXX touched = false; |
---|
.. | .. |
---|
5490 | 5577 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5491 | 5578 | { |
---|
5492 | 5579 | if (!link2master // tricky to cull in shadow mode. |
---|
5493 | | - && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
| 5580 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5494 | 5581 | { |
---|
5495 | 5582 | //System.out.print("CULLED"); |
---|
5496 | 5583 | culled = true; |
---|
.. | .. |
---|
5498 | 5585 | } |
---|
5499 | 5586 | else |
---|
5500 | 5587 | //GetBRep().getBounds(v0, v1, this); |
---|
5501 | | - if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
| 5588 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5502 | 5589 | culled = true; |
---|
5503 | 5590 | |
---|
5504 | 5591 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5538 | 5625 | { |
---|
5539 | 5626 | if (GetBRep() != null) |
---|
5540 | 5627 | { |
---|
5541 | | - CameraPane.NextIndex(this, gl); |
---|
| 5628 | + display.NextIndex(); |
---|
5542 | 5629 | // vertex color conflict : gl.glCallList(list); |
---|
5543 | 5630 | DrawNode(display, root, selected); |
---|
5544 | 5631 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5595 | 5682 | |
---|
5596 | 5683 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5597 | 5684 | assert(bRep.displaylist != 0); |
---|
5598 | | - gl.glCallList(bRep.displaylist); |
---|
| 5685 | + display.CallList(bRep.displaylist); |
---|
5599 | 5686 | // june 2013 drawSelf(display, root, selected); |
---|
5600 | 5687 | } |
---|
5601 | 5688 | } |
---|
.. | .. |
---|
5895 | 5982 | return; |
---|
5896 | 5983 | } |
---|
5897 | 5984 | |
---|
| 5985 | + //bRep.GenUV(1/material.diffuseness); |
---|
5898 | 5986 | // bRep.lock = true; |
---|
5899 | 5987 | |
---|
5900 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5988 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5901 | 5989 | |
---|
5902 | 5990 | if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5903 | 5991 | { |
---|
.. | .. |
---|
5914 | 6002 | |
---|
5915 | 6003 | bRep.getMinMax(min, max, 100); |
---|
5916 | 6004 | |
---|
5917 | | - gl.glBegin(gl.GL_LINES); |
---|
5918 | | - |
---|
5919 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5920 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5921 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5922 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5923 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5924 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5925 | | - |
---|
5926 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5927 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5928 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5929 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5930 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5931 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5932 | | - |
---|
5933 | | - gl.glEnd(); |
---|
| 6005 | + display.DrawBox(min, max); |
---|
5934 | 6006 | |
---|
5935 | 6007 | return; |
---|
5936 | 6008 | } |
---|
.. | .. |
---|
5984 | 6056 | new Exception().printStackTrace(); |
---|
5985 | 6057 | return; |
---|
5986 | 6058 | } |
---|
5987 | | - |
---|
5988 | | - // TRIANGLE STRIP ARRAY |
---|
5989 | | - if (bRep.trimmed) |
---|
5990 | | - { |
---|
5991 | | - float[] v = bRep.getRawVertices(); |
---|
5992 | | - float[] n = bRep.getRawNormals(); |
---|
5993 | | - float[] c = bRep.getRawColors(); |
---|
5994 | | - float[] uv = bRep.getRawUVMap(); |
---|
5995 | | - |
---|
5996 | | - int count2 = 0; |
---|
5997 | | - int count3 = 0; |
---|
5998 | | - |
---|
5999 | | - if (n.length > 0) |
---|
6000 | | - { |
---|
6001 | | - for (int i = 0; i < strips.length; i++) |
---|
6002 | | - { |
---|
6003 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6004 | | - |
---|
6005 | | - /* |
---|
6006 | | - boolean locked = false; |
---|
6007 | | - float eps = 0.1f; |
---|
6008 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6009 | | - |
---|
6010 | | - int dot = 0; |
---|
6011 | | - |
---|
6012 | | - if ((dot&1) == 0) |
---|
6013 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6014 | | - |
---|
6015 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6016 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6017 | | - else |
---|
6018 | | - { |
---|
6019 | | - locked = true; |
---|
6020 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6021 | | - } |
---|
6022 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6023 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6024 | | - if (hasnorm) |
---|
6025 | | - { |
---|
6026 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6027 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6028 | | - } |
---|
6029 | | - |
---|
6030 | | - if ((dot&4) == 0) |
---|
6031 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6032 | | - |
---|
6033 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6034 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6035 | | - else |
---|
6036 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6037 | | - |
---|
6038 | | - f.dot = dot; |
---|
6039 | | - */ |
---|
6040 | | - |
---|
6041 | | - if (!selectmode) |
---|
6042 | | - { |
---|
6043 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6044 | | - { |
---|
6045 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6046 | | - } else |
---|
6047 | | - { |
---|
6048 | | - gl.glNormal3f(0, 0, 1); |
---|
6049 | | - } |
---|
6050 | | - |
---|
6051 | | - if (c != null) |
---|
6052 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6053 | | - { |
---|
6054 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6055 | | - } |
---|
6056 | | - } |
---|
6057 | | - if (flipV) |
---|
6058 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6059 | | - else |
---|
6060 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6061 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6062 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6063 | | - |
---|
6064 | | - count2 += 2; |
---|
6065 | | - count3 += 3; |
---|
6066 | | - if (!selectmode) |
---|
6067 | | - { |
---|
6068 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6069 | | - { |
---|
6070 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6071 | | - } else |
---|
6072 | | - { |
---|
6073 | | - gl.glNormal3f(0, 0, 1); |
---|
6074 | | - } |
---|
6075 | | - if (c != null) |
---|
6076 | | - { |
---|
6077 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6078 | | - } |
---|
6079 | | - } |
---|
6080 | | - if (flipV) |
---|
6081 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6082 | | - else |
---|
6083 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6084 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6085 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6086 | | - |
---|
6087 | | - count2 += 2; |
---|
6088 | | - count3 += 3; |
---|
6089 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6090 | | - { |
---|
6091 | | - //gl.glTexCoord2d(...); |
---|
6092 | | - if (!selectmode) |
---|
6093 | | - { |
---|
6094 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6095 | | - { |
---|
6096 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6097 | | - } else |
---|
6098 | | - { |
---|
6099 | | - gl.glNormal3f(0, 0, 1); |
---|
6100 | | - } |
---|
6101 | | - if (c != null) |
---|
6102 | | - { |
---|
6103 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6104 | | - } |
---|
6105 | | - } |
---|
6106 | | - |
---|
6107 | | - if (flipV) |
---|
6108 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6109 | | - else |
---|
6110 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6111 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6112 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6113 | | - count2 += 2; |
---|
6114 | | - count3 += 3; |
---|
6115 | | - } |
---|
6116 | | - |
---|
6117 | | - gl.glEnd(); |
---|
6118 | | - } |
---|
6119 | | - } |
---|
6120 | | - |
---|
6121 | | - assert count3 == v.length; |
---|
6122 | | - } |
---|
6123 | | - else // !trimmed |
---|
6124 | | - { |
---|
6125 | | - int count = 0; |
---|
6126 | | - for (int i = 0; i < strips.length; i++) |
---|
6127 | | - { |
---|
6128 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6129 | | - |
---|
6130 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6131 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6132 | | - |
---|
6133 | | - drawVertex(gl, p, selectmode); |
---|
6134 | | - drawVertex(gl, q, selectmode); |
---|
6135 | | - |
---|
6136 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6137 | | - { |
---|
6138 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6139 | | - |
---|
6140 | | -// if (j%2 == 0) |
---|
6141 | | -// drawFace(p, q, r, display, null); |
---|
6142 | | -// else |
---|
6143 | | -// drawFace(p, r, q, display, null); |
---|
6144 | | - |
---|
6145 | | -// p = q; |
---|
6146 | | -// q = r; |
---|
6147 | | - drawVertex(gl, r, selectmode); |
---|
6148 | | - } |
---|
6149 | | - |
---|
6150 | | - gl.glEnd(); |
---|
6151 | | - } |
---|
6152 | | - } |
---|
| 6059 | + |
---|
| 6060 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6153 | 6061 | } else // catch (Error e) |
---|
6154 | 6062 | { |
---|
6155 | 6063 | // TRIANGLE ARRAY |
---|
6156 | 6064 | if (IsOpaque()) // Static()) |
---|
6157 | 6065 | { |
---|
6158 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6066 | + display.StartTriangles(); |
---|
6159 | 6067 | int facecount = bRep.FaceCount(); |
---|
6160 | 6068 | for (int i = 0; i < facecount; i++) |
---|
6161 | 6069 | { |
---|
.. | .. |
---|
6220 | 6128 | |
---|
6221 | 6129 | display.DrawFace(this, p, q, r, face); |
---|
6222 | 6130 | } |
---|
6223 | | - gl.glEnd(); |
---|
| 6131 | + display.EndTriangles(); |
---|
6224 | 6132 | } |
---|
6225 | 6133 | else |
---|
6226 | 6134 | { |
---|
.. | .. |
---|
6249 | 6157 | //System.out.println("SORT"); |
---|
6250 | 6158 | |
---|
6251 | 6159 | java.util.Arrays.sort(facescompare); |
---|
6252 | | - |
---|
6253 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6160 | + |
---|
| 6161 | + display.StartTriangles(); |
---|
6254 | 6162 | for (int i = 0; i < facecount; i++) |
---|
6255 | 6163 | { |
---|
6256 | 6164 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6264 | 6172 | |
---|
6265 | 6173 | display.DrawFace(this, p, q, r, face); |
---|
6266 | 6174 | } |
---|
6267 | | - gl.glEnd(); |
---|
| 6175 | + display.EndTriangles(); |
---|
6268 | 6176 | } |
---|
6269 | 6177 | |
---|
6270 | 6178 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6271 | 6179 | { |
---|
| 6180 | + /* |
---|
6272 | 6181 | gl.glDisable(gl.GL_LIGHTING); |
---|
6273 | 6182 | float[] colorV = new float[3]; |
---|
6274 | 6183 | |
---|
.. | .. |
---|
6347 | 6256 | // gl.glEnd(); |
---|
6348 | 6257 | } |
---|
6349 | 6258 | } |
---|
| 6259 | + */ |
---|
6350 | 6260 | } |
---|
6351 | 6261 | } |
---|
6352 | 6262 | |
---|
.. | .. |
---|
6391 | 6301 | center.add(r); |
---|
6392 | 6302 | center.mul(1.0/3); |
---|
6393 | 6303 | |
---|
6394 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6304 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6395 | 6305 | |
---|
6396 | 6306 | distance = center.dot(center); |
---|
6397 | 6307 | } |
---|
.. | .. |
---|
6405 | 6315 | void Print(Vertex v) |
---|
6406 | 6316 | { |
---|
6407 | 6317 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6408 | | - } |
---|
6409 | | - |
---|
6410 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6411 | | - { |
---|
6412 | | - if (!selectmode) |
---|
6413 | | - { |
---|
6414 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6415 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6416 | | - |
---|
6417 | | - if (flipV) |
---|
6418 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6419 | | - else |
---|
6420 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6421 | | - } |
---|
6422 | | - |
---|
6423 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6424 | 6318 | } |
---|
6425 | 6319 | |
---|
6426 | 6320 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
.. | .. |
---|
7120 | 7014 | } |
---|
7121 | 7015 | |
---|
7122 | 7016 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7123 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7017 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7124 | 7018 | //System.out.println("modified = " + modified); |
---|
7125 | 7019 | //new Exception().printStackTrace(); |
---|
7126 | 7020 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7148 | 7042 | return true; |
---|
7149 | 7043 | } |
---|
7150 | 7044 | |
---|
7151 | | - void doEditDrag0(ClickInfo info) |
---|
| 7045 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7152 | 7046 | { |
---|
7153 | 7047 | if (hitSomething == 0) |
---|
7154 | 7048 | { |
---|
.. | .. |
---|
7173 | 7067 | |
---|
7174 | 7068 | case hitCenter: // Translate |
---|
7175 | 7069 | |
---|
7176 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7070 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7177 | 7071 | |
---|
7178 | | - if (modified) |
---|
| 7072 | + if (modified || opposite) |
---|
7179 | 7073 | { |
---|
7180 | 7074 | //assert(false); |
---|
7181 | 7075 | /* |
---|
.. | .. |
---|
7221 | 7115 | } |
---|
7222 | 7116 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7223 | 7117 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7224 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7118 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7225 | 7119 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7226 | 7120 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7227 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7121 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7228 | 7122 | //LA.vecCross(up, cVector.Z, right2); |
---|
7229 | 7123 | |
---|
7230 | 7124 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7269 | 7163 | |
---|
7270 | 7164 | if (modified) |
---|
7271 | 7165 | { |
---|
| 7166 | + // Rotate 90 degrees |
---|
7272 | 7167 | angle /= (Math.PI / 4); |
---|
7273 | 7168 | angle = Math.floor(angle + 0.5); |
---|
7274 | 7169 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7282 | 7177 | } |
---|
7283 | 7178 | /**/ |
---|
7284 | 7179 | |
---|
7285 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7180 | + switch (info.pane.RenderCamera().viewCode) |
---|
7286 | 7181 | { |
---|
7287 | 7182 | case 1: // '\001' |
---|
7288 | 7183 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7338 | 7233 | } |
---|
7339 | 7234 | /**/ |
---|
7340 | 7235 | |
---|
7341 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7236 | + switch (info.pane.RenderCamera().viewCode) |
---|
7342 | 7237 | { |
---|
7343 | 7238 | case 3: // '\001' |
---|
7344 | 7239 | if (modified) |
---|
.. | .. |
---|
7503 | 7398 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7504 | 7399 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7505 | 7400 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7401 | + |
---|
| 7402 | + String objname; |
---|
| 7403 | + |
---|
7506 | 7404 | if (false) //parent != null) |
---|
7507 | 7405 | { |
---|
7508 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7406 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7509 | 7407 | } else |
---|
7510 | 7408 | { |
---|
7511 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7409 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7512 | 7410 | } // + super.toString(); |
---|
7513 | 7411 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7412 | + |
---|
| 7413 | + if (!Globals.ADVANCED) |
---|
| 7414 | + return objname; |
---|
| 7415 | + |
---|
| 7416 | + return objname + " " + System.identityHashCode(this); |
---|
7514 | 7417 | } |
---|
7515 | 7418 | |
---|
7516 | 7419 | public int hashCode() |
---|
.. | .. |
---|
7566 | 7469 | objectUI.closeUI(); |
---|
7567 | 7470 | if (editWindow != null) |
---|
7568 | 7471 | { |
---|
| 7472 | + editWindow.ctrlPanel.FlushUI(); |
---|
7569 | 7473 | editWindow.refreshContents(); |
---|
7570 | 7474 | } // ? new |
---|
7571 | 7475 | objectUI = null; |
---|
.. | .. |
---|
7701 | 7605 | { |
---|
7702 | 7606 | assert(bRep != null); |
---|
7703 | 7607 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7704 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7608 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7705 | 7609 | } |
---|
7706 | 7610 | else |
---|
7707 | 7611 | { |
---|