.. | .. |
---|
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; |
---|
.. | .. |
---|
299 | 300 | } |
---|
300 | 301 | |
---|
301 | 302 | boolean live = false; |
---|
| 303 | + boolean dontselect = false; |
---|
302 | 304 | boolean hide = false; |
---|
303 | 305 | boolean link2master = false; // performs reset support/master at each frame |
---|
304 | 306 | boolean marked = false; // animation node |
---|
.. | .. |
---|
796 | 798 | |
---|
797 | 799 | if (marked && Globals.isLIVE() && live && |
---|
798 | 800 | //TEMP21aug2018 |
---|
799 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 801 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
800 | 802 | currentframe != Globals.framecount) |
---|
801 | 803 | { |
---|
802 | 804 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
911 | 913 | fromParent = null; // LA.newMatrix(); |
---|
912 | 914 | bRep = null; // new BoundaryRep(); |
---|
913 | 915 | |
---|
| 916 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 917 | + { |
---|
| 918 | + name = oname; |
---|
| 919 | + } |
---|
| 920 | + |
---|
914 | 921 | /* |
---|
915 | 922 | float hue = (float)Math.random(); |
---|
916 | 923 | Color col; |
---|
.. | .. |
---|
953 | 960 | |
---|
954 | 961 | public Object clone() |
---|
955 | 962 | { |
---|
956 | | - return GrafreeD.clone(this); |
---|
| 963 | + return Grafreed.clone(this); |
---|
957 | 964 | } |
---|
958 | 965 | |
---|
959 | 966 | Object3D copyExpand() |
---|
.. | .. |
---|
1469 | 1476 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1470 | 1477 | |
---|
1471 | 1478 | // Set default to 0.1 |
---|
1472 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1479 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1473 | 1480 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1474 | 1481 | } |
---|
1475 | 1482 | |
---|
.. | .. |
---|
1728 | 1735 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1729 | 1736 | o.bRep = transientrep; |
---|
1730 | 1737 | if (clone) |
---|
1731 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1738 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1732 | 1739 | o.CreateMaterial(); |
---|
1733 | 1740 | o.SetAttributes(this, -1); |
---|
1734 | 1741 | //parent |
---|
.. | .. |
---|
1741 | 1748 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1742 | 1749 | o.bRep = bRep; |
---|
1743 | 1750 | if (clone) |
---|
1744 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1751 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1745 | 1752 | o.CreateMaterial(); |
---|
1746 | 1753 | //o.overwriteThis(this, -1); |
---|
1747 | 1754 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1828 | 1835 | if (obj.name == null) |
---|
1829 | 1836 | continue; // can't be a null one |
---|
1830 | 1837 | |
---|
| 1838 | + // Try perfect match first. |
---|
1831 | 1839 | if (n.equals(obj.name)) |
---|
1832 | 1840 | { |
---|
1833 | 1841 | theobj = obj; |
---|
1834 | 1842 | count++; |
---|
1835 | 1843 | } |
---|
1836 | 1844 | } |
---|
| 1845 | + |
---|
| 1846 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1837 | 1847 | |
---|
1838 | 1848 | if (count != 1) |
---|
1839 | 1849 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2299 | 2309 | { |
---|
2300 | 2310 | if (newWindow) |
---|
2301 | 2311 | { |
---|
| 2312 | + new Exception().printStackTrace(); |
---|
2302 | 2313 | System.exit(0); |
---|
2303 | 2314 | if (parent != null) |
---|
2304 | 2315 | { |
---|
.. | .. |
---|
2475 | 2486 | return retval; |
---|
2476 | 2487 | } |
---|
2477 | 2488 | |
---|
2478 | | - void doEditDrag(ClickInfo info) |
---|
| 2489 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2479 | 2490 | { |
---|
2480 | 2491 | switch (doSomething) |
---|
2481 | 2492 | { |
---|
2482 | 2493 | case 1: // '\001' |
---|
2483 | 2494 | //super. |
---|
2484 | | - doEditDrag0(info); |
---|
| 2495 | + doEditDrag0(info, opposite); |
---|
2485 | 2496 | break; |
---|
2486 | 2497 | |
---|
2487 | 2498 | case 2: // '\002' |
---|
.. | .. |
---|
2494 | 2505 | { |
---|
2495 | 2506 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2496 | 2507 | //childToDrag.doEditDrag(info); |
---|
2497 | | - sel.doEditDrag(info); |
---|
| 2508 | + sel.doEditDrag(info, opposite); |
---|
2498 | 2509 | } else |
---|
2499 | 2510 | { |
---|
2500 | 2511 | //super. |
---|
2501 | | - doEditDrag0(info); |
---|
| 2512 | + doEditDrag0(info, opposite); |
---|
2502 | 2513 | } |
---|
2503 | 2514 | } |
---|
2504 | 2515 | break; |
---|
.. | .. |
---|
2905 | 2916 | { |
---|
2906 | 2917 | if (bRep != null) |
---|
2907 | 2918 | { |
---|
2908 | | - bRep.GenUV(); |
---|
| 2919 | + bRep.GenUV(); //1); |
---|
| 2920 | + //bRep.UnfoldUV(); |
---|
2909 | 2921 | Touch(); |
---|
2910 | 2922 | } |
---|
2911 | 2923 | } |
---|
.. | .. |
---|
2980 | 2992 | blockloop = false; |
---|
2981 | 2993 | } |
---|
2982 | 2994 | |
---|
| 2995 | + void TransformChildren() |
---|
| 2996 | + { |
---|
| 2997 | + if (toParent != null) |
---|
| 2998 | + { |
---|
| 2999 | + for (int i=Size(); --i>=0;) |
---|
| 3000 | + { |
---|
| 3001 | + Object3D v = get(i); |
---|
| 3002 | + |
---|
| 3003 | + if (v.toParent == null) |
---|
| 3004 | + { |
---|
| 3005 | + v.toParent = LA.newMatrix(); |
---|
| 3006 | + v.fromParent = LA.newMatrix(); |
---|
| 3007 | + } |
---|
| 3008 | + |
---|
| 3009 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3010 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3011 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3012 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3013 | + } |
---|
| 3014 | + |
---|
| 3015 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3016 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3017 | + |
---|
| 3018 | + Touch(); |
---|
| 3019 | + } |
---|
| 3020 | + } |
---|
| 3021 | + |
---|
2983 | 3022 | void TransformGeometry() |
---|
2984 | 3023 | { |
---|
2985 | 3024 | Object3D obj = this; |
---|
.. | .. |
---|
3201 | 3240 | |
---|
3202 | 3241 | BoundaryRep sup = bRep.support; |
---|
3203 | 3242 | bRep.support = null; |
---|
3204 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3243 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3205 | 3244 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3206 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3245 | + |
---|
| 3246 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3247 | + |
---|
3207 | 3248 | bRep = temprep; |
---|
3208 | 3249 | bRep.support = sup; |
---|
3209 | 3250 | Touch(); |
---|
.. | .. |
---|
3725 | 3766 | if (child == null) |
---|
3726 | 3767 | continue; |
---|
3727 | 3768 | |
---|
3728 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3769 | + if (Grafreed.RENDERME > 0) |
---|
3729 | 3770 | { |
---|
3730 | 3771 | if (child instanceof Merge) |
---|
3731 | 3772 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3876 | 3917 | if (child == null) |
---|
3877 | 3918 | continue; |
---|
3878 | 3919 | |
---|
3879 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3920 | + if (Grafreed.RENDERME > 0) |
---|
3880 | 3921 | { |
---|
3881 | 3922 | if (child instanceof Merge) |
---|
3882 | 3923 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4071 | 4112 | if (child == null) |
---|
4072 | 4113 | continue; |
---|
4073 | 4114 | |
---|
4074 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4115 | + if (Grafreed.RENDERME > 0) |
---|
4075 | 4116 | { |
---|
4076 | 4117 | if (child instanceof Merge) |
---|
4077 | 4118 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4678 | 4719 | |
---|
4679 | 4720 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4680 | 4721 | { |
---|
4681 | | - if (hide) |
---|
| 4722 | + if (hide || dontselect) |
---|
4682 | 4723 | return null; |
---|
4683 | 4724 | |
---|
4684 | 4725 | if (count <= 0) |
---|
.. | .. |
---|
4704 | 4745 | |
---|
4705 | 4746 | cTreePath Select(int indexcount, boolean deselect) |
---|
4706 | 4747 | { |
---|
4707 | | - if (hide) |
---|
| 4748 | + if (hide || dontselect) |
---|
4708 | 4749 | return null; |
---|
4709 | 4750 | |
---|
4710 | 4751 | if (count <= 0) |
---|
.. | .. |
---|
5156 | 5197 | |
---|
5157 | 5198 | // System.out.println("Fullname = " + fullname); |
---|
5158 | 5199 | |
---|
5159 | | - if (fullname.name.indexOf(":") == -1) |
---|
5160 | | - return fullname.name; |
---|
| 5200 | + // Does not work on Windows due to C: |
---|
| 5201 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5202 | +// return fullname.name; |
---|
| 5203 | +// |
---|
| 5204 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5161 | 5205 | |
---|
5162 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5206 | + String[] split = fullname.name.split(":"); |
---|
| 5207 | + |
---|
| 5208 | + if (split.length == 0) |
---|
| 5209 | + { |
---|
| 5210 | + return ""; |
---|
| 5211 | + } |
---|
| 5212 | + |
---|
| 5213 | + if (split.length <= 2) |
---|
| 5214 | + { |
---|
| 5215 | + if (fullname.name.endsWith(":")) |
---|
| 5216 | + { |
---|
| 5217 | + // Windows |
---|
| 5218 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5219 | + } |
---|
| 5220 | + |
---|
| 5221 | + return split[0]; |
---|
| 5222 | + } |
---|
| 5223 | + |
---|
| 5224 | + // Windows |
---|
| 5225 | + assert(split.length == 4); |
---|
| 5226 | + |
---|
| 5227 | + return split[0] + ":" + split[1]; |
---|
5163 | 5228 | } |
---|
5164 | 5229 | |
---|
5165 | 5230 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5168 | 5233 | return ""; |
---|
5169 | 5234 | |
---|
5170 | 5235 | // 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()); |
---|
| 5236 | + // Does not work on Windows due to C: |
---|
| 5237 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5238 | +// return ""; |
---|
| 5239 | +// |
---|
| 5240 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5241 | + String[] split = fullname.name.split(":"); |
---|
| 5242 | + |
---|
| 5243 | + if (split.length == 0) |
---|
| 5244 | + { |
---|
| 5245 | + return ""; |
---|
| 5246 | + } |
---|
| 5247 | + |
---|
| 5248 | + if (split.length == 1) |
---|
| 5249 | + { |
---|
| 5250 | + return ""; |
---|
| 5251 | + } |
---|
| 5252 | + |
---|
| 5253 | + if (split.length == 2) |
---|
| 5254 | + { |
---|
| 5255 | + if (fullname.name.endsWith(":")) |
---|
| 5256 | + { |
---|
| 5257 | + // Windows |
---|
| 5258 | + return ""; |
---|
| 5259 | + } |
---|
| 5260 | + |
---|
| 5261 | + return split[1]; |
---|
| 5262 | + } |
---|
| 5263 | + |
---|
| 5264 | + // Windows |
---|
| 5265 | + assert(split.length == 4); |
---|
| 5266 | + |
---|
| 5267 | + return split[2] + ":" + split[3]; |
---|
5175 | 5268 | } |
---|
5176 | 5269 | |
---|
5177 | 5270 | String GetPigmentTexture() |
---|
.. | .. |
---|
5245 | 5338 | System.out.print("; textures = " + textures); |
---|
5246 | 5339 | System.out.println("; usedtextures = " + usedtextures); |
---|
5247 | 5340 | |
---|
5248 | | - if (GetTextures() == null) |
---|
| 5341 | + if (GetTextures() == null) // What is that?? |
---|
5249 | 5342 | GetTextures().name = ":"; |
---|
5250 | 5343 | |
---|
5251 | 5344 | String texname = tex; |
---|
.. | .. |
---|
5322 | 5415 | boolean NeedSupport() |
---|
5323 | 5416 | { |
---|
5324 | 5417 | return |
---|
5325 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5418 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
5326 | 5419 | // PROBLEM with CROWD!! |
---|
5327 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5420 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5328 | 5421 | } |
---|
5329 | 5422 | |
---|
5330 | 5423 | static boolean DEBUG_SELECTION = false; |
---|
.. | .. |
---|
5339 | 5432 | } |
---|
5340 | 5433 | |
---|
5341 | 5434 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5342 | | - hide) |
---|
| 5435 | + (hide || dontselect)) |
---|
5343 | 5436 | return; |
---|
5344 | 5437 | |
---|
5345 | 5438 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5371 | 5464 | return; |
---|
5372 | 5465 | } |
---|
5373 | 5466 | |
---|
5374 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5467 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5375 | 5468 | |
---|
5376 | 5469 | /* |
---|
5377 | 5470 | if (touched) |
---|
.. | .. |
---|
5423 | 5516 | //if (displaylist == -1 && usecalllists) |
---|
5424 | 5517 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5425 | 5518 | { |
---|
5426 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5519 | + bRep.displaylist = display.GenList(); |
---|
5427 | 5520 | assert(bRep.displaylist != 0); |
---|
5428 | 5521 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5429 | 5522 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5435 | 5528 | if (usecalllists) |
---|
5436 | 5529 | { |
---|
5437 | 5530 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5438 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5531 | + display.NewList(bRep.displaylist); |
---|
5439 | 5532 | } |
---|
| 5533 | + |
---|
5440 | 5534 | CallList(display, root, selected, blocked); |
---|
| 5535 | + |
---|
5441 | 5536 | // compiled = true; |
---|
5442 | 5537 | if (usecalllists) |
---|
5443 | 5538 | { |
---|
5444 | 5539 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5445 | | - gl.glEndList(); |
---|
| 5540 | + display.EndList(); |
---|
5446 | 5541 | } |
---|
5447 | 5542 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5448 | 5543 | // XXX touched = false; |
---|
.. | .. |
---|
5490 | 5585 | if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5491 | 5586 | { |
---|
5492 | 5587 | if (!link2master // tricky to cull in shadow mode. |
---|
5493 | | - && GetBRep().FrustumCull(this, gl, display.LightCamera(), true)) |
---|
| 5588 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5494 | 5589 | { |
---|
5495 | 5590 | //System.out.print("CULLED"); |
---|
5496 | 5591 | culled = true; |
---|
.. | .. |
---|
5498 | 5593 | } |
---|
5499 | 5594 | else |
---|
5500 | 5595 | //GetBRep().getBounds(v0, v1, this); |
---|
5501 | | - if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false)) |
---|
| 5596 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5502 | 5597 | culled = true; |
---|
5503 | 5598 | |
---|
5504 | 5599 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5538 | 5633 | { |
---|
5539 | 5634 | if (GetBRep() != null) |
---|
5540 | 5635 | { |
---|
5541 | | - CameraPane.NextIndex(this, gl); |
---|
| 5636 | + display.NextIndex(); |
---|
5542 | 5637 | // vertex color conflict : gl.glCallList(list); |
---|
5543 | 5638 | DrawNode(display, root, selected); |
---|
5544 | 5639 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5579 | 5674 | tex = GetTextures(); |
---|
5580 | 5675 | } |
---|
5581 | 5676 | |
---|
5582 | | - display.BindTextures(tex, texres); |
---|
| 5677 | + boolean failed = false; |
---|
| 5678 | + |
---|
| 5679 | + try |
---|
| 5680 | + { |
---|
| 5681 | + display.BindTextures(tex, texres); |
---|
| 5682 | + } |
---|
| 5683 | + catch (Exception e) |
---|
| 5684 | + { |
---|
| 5685 | + System.err.println("FAILED: " + this); |
---|
| 5686 | + failed = true; |
---|
| 5687 | + } |
---|
5583 | 5688 | |
---|
5584 | 5689 | if (!compiled) |
---|
5585 | 5690 | { |
---|
.. | .. |
---|
5595 | 5700 | |
---|
5596 | 5701 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5597 | 5702 | assert(bRep.displaylist != 0); |
---|
5598 | | - gl.glCallList(bRep.displaylist); |
---|
| 5703 | + display.CallList(bRep.displaylist); |
---|
5599 | 5704 | // june 2013 drawSelf(display, root, selected); |
---|
5600 | 5705 | } |
---|
5601 | 5706 | } |
---|
5602 | 5707 | } |
---|
5603 | 5708 | |
---|
5604 | | - display.ReleaseTextures(tex); |
---|
| 5709 | + if (!failed) |
---|
| 5710 | + display.ReleaseTextures(tex); |
---|
5605 | 5711 | |
---|
5606 | 5712 | display.PopMaterial(this, selected); |
---|
5607 | 5713 | } |
---|
.. | .. |
---|
5730 | 5836 | |
---|
5731 | 5837 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5732 | 5838 | { |
---|
| 5839 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5840 | + return; |
---|
| 5841 | + |
---|
5733 | 5842 | if (hide) |
---|
5734 | 5843 | return; |
---|
5735 | 5844 | // shadow optimisation |
---|
.. | .. |
---|
5855 | 5964 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5856 | 5965 | return; // no shadow for transparent objects |
---|
5857 | 5966 | |
---|
| 5967 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 5968 | + return; |
---|
| 5969 | + |
---|
5858 | 5970 | if (hide) |
---|
5859 | 5971 | return; |
---|
5860 | 5972 | |
---|
.. | .. |
---|
5895 | 6007 | return; |
---|
5896 | 6008 | } |
---|
5897 | 6009 | |
---|
| 6010 | + //bRep.GenUV(1/material.diffuseness); |
---|
5898 | 6011 | // bRep.lock = true; |
---|
5899 | 6012 | |
---|
5900 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6013 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5901 | 6014 | |
---|
5902 | 6015 | if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5903 | 6016 | { |
---|
.. | .. |
---|
5914 | 6027 | |
---|
5915 | 6028 | bRep.getMinMax(min, max, 100); |
---|
5916 | 6029 | |
---|
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(); |
---|
| 6030 | + display.DrawBox(min, max); |
---|
5934 | 6031 | |
---|
5935 | 6032 | return; |
---|
5936 | 6033 | } |
---|
.. | .. |
---|
5984 | 6081 | new Exception().printStackTrace(); |
---|
5985 | 6082 | return; |
---|
5986 | 6083 | } |
---|
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 | | - } |
---|
| 6084 | + |
---|
| 6085 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6153 | 6086 | } else // catch (Error e) |
---|
6154 | 6087 | { |
---|
6155 | 6088 | // TRIANGLE ARRAY |
---|
6156 | 6089 | if (IsOpaque()) // Static()) |
---|
6157 | 6090 | { |
---|
6158 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6091 | + display.StartTriangles(); |
---|
6159 | 6092 | int facecount = bRep.FaceCount(); |
---|
6160 | 6093 | for (int i = 0; i < facecount; i++) |
---|
6161 | 6094 | { |
---|
.. | .. |
---|
6220 | 6153 | |
---|
6221 | 6154 | display.DrawFace(this, p, q, r, face); |
---|
6222 | 6155 | } |
---|
6223 | | - gl.glEnd(); |
---|
| 6156 | + display.EndTriangles(); |
---|
6224 | 6157 | } |
---|
6225 | 6158 | else |
---|
6226 | 6159 | { |
---|
.. | .. |
---|
6249 | 6182 | //System.out.println("SORT"); |
---|
6250 | 6183 | |
---|
6251 | 6184 | java.util.Arrays.sort(facescompare); |
---|
6252 | | - |
---|
6253 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6185 | + |
---|
| 6186 | + display.StartTriangles(); |
---|
6254 | 6187 | for (int i = 0; i < facecount; i++) |
---|
6255 | 6188 | { |
---|
6256 | 6189 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6264 | 6197 | |
---|
6265 | 6198 | display.DrawFace(this, p, q, r, face); |
---|
6266 | 6199 | } |
---|
6267 | | - gl.glEnd(); |
---|
| 6200 | + display.EndTriangles(); |
---|
6268 | 6201 | } |
---|
6269 | 6202 | |
---|
6270 | 6203 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6271 | 6204 | { |
---|
| 6205 | + /* |
---|
6272 | 6206 | gl.glDisable(gl.GL_LIGHTING); |
---|
6273 | 6207 | float[] colorV = new float[3]; |
---|
6274 | 6208 | |
---|
.. | .. |
---|
6347 | 6281 | // gl.glEnd(); |
---|
6348 | 6282 | } |
---|
6349 | 6283 | } |
---|
| 6284 | + */ |
---|
6350 | 6285 | } |
---|
6351 | 6286 | } |
---|
6352 | 6287 | |
---|
.. | .. |
---|
6405 | 6340 | void Print(Vertex v) |
---|
6406 | 6341 | { |
---|
6407 | 6342 | //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 | 6343 | } |
---|
6425 | 6344 | |
---|
6426 | 6345 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
.. | .. |
---|
7120 | 7039 | } |
---|
7121 | 7040 | |
---|
7122 | 7041 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7123 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7042 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7124 | 7043 | //System.out.println("modified = " + modified); |
---|
7125 | 7044 | //new Exception().printStackTrace(); |
---|
7126 | 7045 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7148 | 7067 | return true; |
---|
7149 | 7068 | } |
---|
7150 | 7069 | |
---|
7151 | | - void doEditDrag0(ClickInfo info) |
---|
| 7070 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7152 | 7071 | { |
---|
7153 | 7072 | if (hitSomething == 0) |
---|
7154 | 7073 | { |
---|
.. | .. |
---|
7175 | 7094 | |
---|
7176 | 7095 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7177 | 7096 | |
---|
7178 | | - if (modified) |
---|
| 7097 | + if (modified || opposite) |
---|
7179 | 7098 | { |
---|
7180 | 7099 | //assert(false); |
---|
7181 | 7100 | /* |
---|
.. | .. |
---|
7269 | 7188 | |
---|
7270 | 7189 | if (modified) |
---|
7271 | 7190 | { |
---|
| 7191 | + // Rotate 90 degrees |
---|
7272 | 7192 | angle /= (Math.PI / 4); |
---|
7273 | 7193 | angle = Math.floor(angle + 0.5); |
---|
7274 | 7194 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7503 | 7423 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7504 | 7424 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7505 | 7425 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7426 | + |
---|
| 7427 | + String objname; |
---|
| 7428 | + |
---|
7506 | 7429 | if (false) //parent != null) |
---|
7507 | 7430 | { |
---|
7508 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7431 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7509 | 7432 | } else |
---|
7510 | 7433 | { |
---|
7511 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7434 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7512 | 7435 | } // + super.toString(); |
---|
7513 | 7436 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7437 | + |
---|
| 7438 | + if (!Globals.ADVANCED) |
---|
| 7439 | + return objname; |
---|
| 7440 | + |
---|
| 7441 | + return objname + " " + System.identityHashCode(this); |
---|
7514 | 7442 | } |
---|
7515 | 7443 | |
---|
7516 | 7444 | public int hashCode() |
---|
.. | .. |
---|
7566 | 7494 | objectUI.closeUI(); |
---|
7567 | 7495 | if (editWindow != null) |
---|
7568 | 7496 | { |
---|
| 7497 | + editWindow.ctrlPanel.FlushUI(); |
---|
7569 | 7498 | editWindow.refreshContents(); |
---|
7570 | 7499 | } // ? new |
---|
7571 | 7500 | objectUI = null; |
---|
.. | .. |
---|
7701 | 7630 | { |
---|
7702 | 7631 | assert(bRep != null); |
---|
7703 | 7632 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7704 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7633 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7705 | 7634 | } |
---|
7706 | 7635 | else |
---|
7707 | 7636 | { |
---|