.. | .. |
---|
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; |
---|
.. | .. |
---|
20 | 21 | static final long serialVersionUID = 5022536242724664900L; |
---|
21 | 22 | |
---|
22 | 23 | ScriptNode scriptnode; |
---|
| 24 | + |
---|
| 25 | + void InitOthers() |
---|
| 26 | + { |
---|
| 27 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 28 | + { |
---|
| 29 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 30 | + } |
---|
| 31 | + for (int i = 0; i < 3; i++) |
---|
| 32 | + { |
---|
| 33 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 34 | + } |
---|
| 35 | + projectedVertices[0].x = 100; // bump |
---|
| 36 | + } |
---|
23 | 37 | |
---|
24 | 38 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 39 | { |
---|
.. | .. |
---|
296 | 310 | boolean speedup = false; |
---|
297 | 311 | boolean rewind = false; |
---|
298 | 312 | |
---|
| 313 | + float NORMALPUSH = 0; |
---|
| 314 | + |
---|
299 | 315 | Object3D support; |
---|
300 | 316 | |
---|
301 | 317 | Object3D GetObject() |
---|
.. | .. |
---|
355 | 371 | |
---|
356 | 372 | int MemorySize() |
---|
357 | 373 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 374 | + if (true) // memorysize == 0) |
---|
359 | 375 | { |
---|
360 | 376 | try |
---|
361 | 377 | { |
---|
.. | .. |
---|
415 | 431 | { |
---|
416 | 432 | Object3D copy = this; |
---|
417 | 433 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 434 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 435 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 436 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 437 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 438 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 439 | } |
---|
424 | 440 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 441 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 442 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 443 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 444 | } |
---|
429 | 445 | |
---|
430 | 446 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 448 | //assert(this instanceof Camera); |
---|
433 | 449 | |
---|
434 | 450 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 451 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 452 | } |
---|
437 | 453 | |
---|
438 | 454 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 468 | //assert(this instanceof Camera); |
---|
453 | 469 | |
---|
454 | 470 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 471 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 472 | } |
---|
457 | 473 | |
---|
458 | 474 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
587 | 603 | return; |
---|
588 | 604 | } |
---|
589 | 605 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 606 | + if (Globals.fromscript) |
---|
591 | 607 | { |
---|
592 | 608 | transformcount = 0; |
---|
593 | 609 | return; |
---|
.. | .. |
---|
745 | 761 | |
---|
746 | 762 | int GetTransformCount() |
---|
747 | 763 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 764 | + // patch pour serialization de Texture |
---|
749 | 765 | resetmaxcount(); |
---|
750 | 766 | resettransformcount(); |
---|
751 | 767 | resetstep(); |
---|
.. | .. |
---|
779 | 795 | // factor = CameraPane.STEP; |
---|
780 | 796 | // } |
---|
781 | 797 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 798 | + if (marked && Globals.isLIVE() && live && |
---|
| 799 | + //TEMP21aug2018 |
---|
| 800 | + Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 801 | + currentframe != Globals.framecount) |
---|
783 | 802 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 803 | + currentframe = Globals.framecount; |
---|
785 | 804 | |
---|
786 | 805 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 806 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
935 | 954 | |
---|
936 | 955 | public Object clone() |
---|
937 | 956 | { |
---|
938 | | - return GraphreeD.clone(this); |
---|
| 957 | + return GrafreeD.clone(this); |
---|
939 | 958 | } |
---|
940 | 959 | |
---|
941 | 960 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1465 | // if (other == null) |
---|
1447 | 1466 | // return; |
---|
1448 | 1467 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1468 | + if (other != null) |
---|
| 1469 | + { |
---|
| 1470 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1471 | + |
---|
| 1472 | + // Set default to 0.1 |
---|
| 1473 | + BoundaryRep.SEUIL /= 2; |
---|
| 1474 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1475 | + } |
---|
| 1476 | + |
---|
| 1477 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1478 | |
---|
1451 | 1479 | //if (bRep != null) |
---|
1452 | 1480 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1729 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1730 | o.bRep = transientrep; |
---|
1703 | 1731 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1732 | + o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
1705 | 1733 | o.CreateMaterial(); |
---|
1706 | 1734 | o.SetAttributes(this, -1); |
---|
1707 | 1735 | //parent |
---|
.. | .. |
---|
1714 | 1742 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1743 | o.bRep = bRep; |
---|
1716 | 1744 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1745 | + o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
1718 | 1746 | o.CreateMaterial(); |
---|
1719 | 1747 | //o.overwriteThis(this, -1); |
---|
1720 | 1748 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1756 | 1784 | // { |
---|
1757 | 1785 | // assert(bRep == null); |
---|
1758 | 1786 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1759 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1787 | +// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
1760 | 1788 | // o.CreateMaterial(); |
---|
1761 | 1789 | // parent.addChild(o); |
---|
1762 | 1790 | // } |
---|
.. | .. |
---|
1765 | 1793 | // { |
---|
1766 | 1794 | // assert(transientrep == null); |
---|
1767 | 1795 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1768 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1796 | +// o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
1769 | 1797 | // o.CreateMaterial(); |
---|
1770 | 1798 | // parent.addChild(o); |
---|
1771 | 1799 | // } |
---|
.. | .. |
---|
1816 | 1844 | if (obj.name == null) |
---|
1817 | 1845 | continue; // can't be a null one |
---|
1818 | 1846 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1847 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1848 | + //if (n.startsWith(obj.name)) |
---|
| 1849 | + if (n.contains(name)) |
---|
1821 | 1850 | { |
---|
1822 | 1851 | theobj = obj; |
---|
1823 | 1852 | count++; |
---|
.. | .. |
---|
2120 | 2149 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2150 | { |
---|
2122 | 2151 | material = new cMaterial(GetMaterial()); |
---|
2123 | | - if (projectedVertices == null || projectedVertices.length <= 2) |
---|
2124 | | - { |
---|
2125 | | - projectedVertices = new Object3D.cVector2[3]; |
---|
2126 | | - } |
---|
2127 | | - for (int i = 0; i < 3; i++) |
---|
2128 | | - { |
---|
2129 | | - projectedVertices[i] = new cVector2(); // Others |
---|
2130 | | - } |
---|
2131 | | - projectedVertices[0].x = 100; // bump |
---|
| 2152 | + |
---|
| 2153 | + InitOthers(); |
---|
2132 | 2154 | |
---|
2133 | 2155 | if (this instanceof Camera) |
---|
2134 | 2156 | { |
---|
.. | .. |
---|
2732 | 2754 | blockloop = false; |
---|
2733 | 2755 | } |
---|
2734 | 2756 | |
---|
| 2757 | + void GenNormalsMINE() |
---|
| 2758 | + { |
---|
| 2759 | + if (blockloop) |
---|
| 2760 | + return; |
---|
| 2761 | + |
---|
| 2762 | + blockloop = true; |
---|
| 2763 | + GenNormalsMINE0(); |
---|
| 2764 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2765 | + { |
---|
| 2766 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2767 | + if (child == null) |
---|
| 2768 | + continue; |
---|
| 2769 | + child.GenNormalsMINE(); |
---|
| 2770 | +// Children().release(i); |
---|
| 2771 | + } |
---|
| 2772 | + blockloop = false; |
---|
| 2773 | + } |
---|
| 2774 | + |
---|
2735 | 2775 | void ClearColors() |
---|
2736 | 2776 | { |
---|
2737 | 2777 | if (blockloop) |
---|
.. | .. |
---|
2866 | 2906 | { |
---|
2867 | 2907 | if (bRep != null) |
---|
2868 | 2908 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 2909 | + bRep.GenUV(); //1); |
---|
| 2910 | + //bRep.UnfoldUV(); |
---|
2870 | 2911 | Touch(); |
---|
2871 | 2912 | } |
---|
2872 | 2913 | } |
---|
.. | .. |
---|
2876 | 2917 | if (bRep != null) |
---|
2877 | 2918 | { |
---|
2878 | 2919 | bRep.GenerateNormals(crease); |
---|
| 2920 | + Touch(); |
---|
| 2921 | + } |
---|
| 2922 | + } |
---|
| 2923 | + |
---|
| 2924 | + void GenNormalsMINE0() |
---|
| 2925 | + { |
---|
| 2926 | + if (bRep != null) |
---|
| 2927 | + { |
---|
| 2928 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 2929 | Touch(); |
---|
2880 | 2930 | } |
---|
2881 | 2931 | } |
---|
.. | .. |
---|
3153 | 3203 | |
---|
3154 | 3204 | BoundaryRep sup = bRep.support; |
---|
3155 | 3205 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 3206 | + BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
3157 | 3207 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | 3208 | temprep.SplitInTwo(reduction34, onlyone); |
---|
3159 | 3209 | bRep = temprep; |
---|
.. | .. |
---|
3677 | 3727 | if (child == null) |
---|
3678 | 3728 | continue; |
---|
3679 | 3729 | |
---|
3680 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3730 | + if (GrafreeD.RENDERME > 0) |
---|
3681 | 3731 | { |
---|
3682 | 3732 | if (child instanceof Merge) |
---|
3683 | 3733 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3828 | 3878 | if (child == null) |
---|
3829 | 3879 | continue; |
---|
3830 | 3880 | |
---|
3831 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3881 | + if (GrafreeD.RENDERME > 0) |
---|
3832 | 3882 | { |
---|
3833 | 3883 | if (child instanceof Merge) |
---|
3834 | 3884 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4073 | if (child == null) |
---|
4024 | 4074 | continue; |
---|
4025 | 4075 | |
---|
4026 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4076 | + if (GrafreeD.RENDERME > 0) |
---|
4027 | 4077 | { |
---|
4028 | 4078 | if (child instanceof Merge) |
---|
4029 | 4079 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4161 | if (blockloop) |
---|
4112 | 4162 | return; |
---|
4113 | 4163 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4164 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4165 | { |
---|
4116 | 4166 | if (get(i).parent != this) |
---|
4117 | 4167 | { |
---|
.. | .. |
---|
4120 | 4170 | } |
---|
4121 | 4171 | blockloop = true; |
---|
4122 | 4172 | get(i).RepairParent(); |
---|
| 4173 | + blockloop = false; |
---|
| 4174 | + } |
---|
| 4175 | + } |
---|
| 4176 | + |
---|
| 4177 | + void RepairShadow() |
---|
| 4178 | + { |
---|
| 4179 | + if (blockloop) |
---|
| 4180 | + return; |
---|
| 4181 | + |
---|
| 4182 | + if (this.material != null) |
---|
| 4183 | + this.InitOthers(); |
---|
| 4184 | + |
---|
| 4185 | + for (int i=0; i<Size(); i++) |
---|
| 4186 | + { |
---|
| 4187 | + blockloop = true; |
---|
| 4188 | + get(i).RepairShadow(); |
---|
4123 | 4189 | blockloop = false; |
---|
4124 | 4190 | } |
---|
4125 | 4191 | } |
---|
.. | .. |
---|
4790 | 4856 | return globalTransform; |
---|
4791 | 4857 | } |
---|
4792 | 4858 | |
---|
4793 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 4859 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4794 | 4860 | { |
---|
4795 | 4861 | /* |
---|
4796 | 4862 | if (AOdone) |
---|
.. | .. |
---|
4937 | 5003 | } else // |
---|
4938 | 5004 | if (editWindow != null) |
---|
4939 | 5005 | { |
---|
4940 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5006 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5007 | + Globals.lighttouched = true; |
---|
4941 | 5008 | } |
---|
4942 | 5009 | } |
---|
4943 | 5010 | |
---|
.. | .. |
---|
5249 | 5316 | } |
---|
5250 | 5317 | } |
---|
5251 | 5318 | |
---|
5252 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5319 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5253 | 5320 | { |
---|
5254 | 5321 | Draw(display, root, selected, blocked); |
---|
5255 | 5322 | } |
---|
5256 | 5323 | |
---|
5257 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5258 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5259 | | - static int materialdepth = 0; |
---|
5260 | | - |
---|
5261 | 5324 | boolean NeedSupport() |
---|
5262 | 5325 | { |
---|
5263 | 5326 | return |
---|
5264 | 5327 | CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
5265 | 5328 | // PROBLEM with CROWD!! |
---|
5266 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5329 | + && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
5267 | 5330 | } |
---|
5268 | 5331 | |
---|
| 5332 | + static boolean DEBUG_SELECTION = false; |
---|
5269 | 5333 | |
---|
5270 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5334 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5271 | 5335 | { |
---|
5272 | 5336 | Invariants(); // june 2013 |
---|
5273 | 5337 | |
---|
.. | .. |
---|
5276 | 5340 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5277 | 5341 | } |
---|
5278 | 5342 | |
---|
5279 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
| 5343 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5280 | 5344 | hide) |
---|
5281 | 5345 | return; |
---|
5282 | 5346 | |
---|
.. | .. |
---|
5295 | 5359 | if (this instanceof Checker) |
---|
5296 | 5360 | return; |
---|
5297 | 5361 | |
---|
5298 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5362 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5299 | 5363 | return; |
---|
5300 | 5364 | |
---|
5301 | 5365 | if (count <= 0) |
---|
.. | .. |
---|
5303 | 5367 | return; |
---|
5304 | 5368 | } |
---|
5305 | 5369 | |
---|
5306 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5307 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5370 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5371 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5308 | 5372 | { |
---|
5309 | 5373 | return; |
---|
5310 | 5374 | } |
---|
5311 | 5375 | |
---|
5312 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5376 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5313 | 5377 | |
---|
5314 | 5378 | /* |
---|
5315 | 5379 | if (touched) |
---|
.. | .. |
---|
5345 | 5409 | |
---|
5346 | 5410 | boolean compiled = false; |
---|
5347 | 5411 | |
---|
5348 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5412 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5349 | 5413 | |
---|
5350 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
| 5414 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5351 | 5415 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5352 | 5416 | { |
---|
5353 | | - display.lighttouched = true; |
---|
| 5417 | + Globals.lighttouched = true; |
---|
5354 | 5418 | } // all panes... |
---|
5355 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5356 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5419 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5420 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5357 | 5421 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5358 | 5422 | { |
---|
5359 | 5423 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5361 | 5425 | //if (displaylist == -1 && usecalllists) |
---|
5362 | 5426 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5363 | 5427 | { |
---|
5364 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5428 | + bRep.displaylist = display.GenList(); |
---|
5365 | 5429 | assert(bRep.displaylist != 0); |
---|
5366 | 5430 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5367 | 5431 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5373 | 5437 | if (usecalllists) |
---|
5374 | 5438 | { |
---|
5375 | 5439 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5376 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5440 | + display.NewList(bRep.displaylist); |
---|
5377 | 5441 | } |
---|
| 5442 | + |
---|
5378 | 5443 | CallList(display, root, selected, blocked); |
---|
| 5444 | + |
---|
5379 | 5445 | // compiled = true; |
---|
5380 | 5446 | if (usecalllists) |
---|
5381 | 5447 | { |
---|
5382 | 5448 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5383 | | - gl.glEndList(); |
---|
| 5449 | + display.EndList(); |
---|
5384 | 5450 | } |
---|
5385 | 5451 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5386 | 5452 | // XXX touched = false; |
---|
5387 | | - display.lighttouched = true; // all panes... |
---|
| 5453 | + Globals.lighttouched = true; // all panes... |
---|
5388 | 5454 | } |
---|
5389 | 5455 | |
---|
5390 | 5456 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5423 | 5489 | |
---|
5424 | 5490 | // frustum culling |
---|
5425 | 5491 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5426 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5492 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5427 | 5493 | { |
---|
5428 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5494 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5429 | 5495 | { |
---|
5430 | 5496 | if (!link2master // tricky to cull in shadow mode. |
---|
5431 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5497 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5432 | 5498 | { |
---|
5433 | 5499 | //System.out.print("CULLED"); |
---|
5434 | 5500 | culled = true; |
---|
.. | .. |
---|
5436 | 5502 | } |
---|
5437 | 5503 | else |
---|
5438 | 5504 | //GetBRep().getBounds(v0, v1, this); |
---|
5439 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5505 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5440 | 5506 | culled = true; |
---|
5441 | 5507 | |
---|
5442 | 5508 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5472 | 5538 | |
---|
5473 | 5539 | |
---|
5474 | 5540 | if (!culled) |
---|
5475 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5541 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5476 | 5542 | { |
---|
5477 | 5543 | if (GetBRep() != null) |
---|
5478 | 5544 | { |
---|
5479 | | - CameraPane.NextIndex(this, gl); |
---|
| 5545 | + display.NextIndex(); |
---|
5480 | 5546 | // vertex color conflict : gl.glCallList(list); |
---|
5481 | 5547 | DrawNode(display, root, selected); |
---|
5482 | 5548 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5498 | 5564 | color[2] /= 2; |
---|
5499 | 5565 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5500 | 5566 | */ |
---|
5501 | | - if (material != null) |
---|
5502 | | - { |
---|
5503 | | - materialstack[materialdepth] = material; |
---|
5504 | | - selectedstack[materialdepth] = selected; |
---|
5505 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5506 | | - //System.out.println("material " + material); |
---|
5507 | | - //Applet3D.tracein(this, selected); |
---|
5508 | | - display.vector2buffer = projectedVertices; |
---|
5509 | | - if (this instanceof Camera) |
---|
5510 | | - { |
---|
5511 | | - display.options1[0] = material.shift; |
---|
5512 | | - //System.out.println("shift " + material.shift); |
---|
5513 | | - display.options1[1] = material.lightarea; |
---|
5514 | | - display.options1[2] = material.shadowbias; |
---|
5515 | | - display.options1[3] = material.aniso; |
---|
5516 | | - display.options1[4] = material.anisoV; |
---|
5517 | | - display.options2[0] = material.opacity; |
---|
5518 | | - display.options2[1] = material.diffuse; |
---|
5519 | | - display.options2[2] = material.factor; |
---|
5520 | | - |
---|
5521 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5522 | | - display.options3[3] = material.cameralight/0.2f; |
---|
5523 | | - |
---|
5524 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5525 | | - // display.options3[3] /= 4; |
---|
5526 | | - |
---|
5527 | | - /* |
---|
5528 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5529 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5530 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5531 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5532 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5533 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5534 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5535 | | - /**/ |
---|
5536 | | - } else |
---|
5537 | | - { |
---|
5538 | | - material.Draw(display, selected); |
---|
5539 | | - } |
---|
5540 | | - } else |
---|
5541 | | - { |
---|
5542 | | - if (selected && CameraPane.flash) |
---|
5543 | | - { |
---|
5544 | | - display.modelParams4[1] = 100; |
---|
5545 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5546 | | - } |
---|
5547 | | - } |
---|
| 5567 | + display.PushMaterial(this, selected); |
---|
5548 | 5568 | |
---|
5549 | 5569 | //System.out.println("call list " + list); |
---|
5550 | 5570 | //System.out.println(); |
---|
.. | .. |
---|
5579 | 5599 | |
---|
5580 | 5600 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5581 | 5601 | assert(bRep.displaylist != 0); |
---|
5582 | | - gl.glCallList(bRep.displaylist); |
---|
| 5602 | + display.CallList(bRep.displaylist); |
---|
5583 | 5603 | // june 2013 drawSelf(display, root, selected); |
---|
5584 | 5604 | } |
---|
5585 | 5605 | } |
---|
5586 | 5606 | } |
---|
5587 | 5607 | |
---|
5588 | 5608 | display.ReleaseTextures(tex); |
---|
5589 | | - |
---|
5590 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5591 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5592 | | - if (material != null) |
---|
5593 | | - { |
---|
5594 | | - materialdepth -= 1; |
---|
5595 | | - if (materialdepth > 0) |
---|
5596 | | - { |
---|
5597 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5598 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5599 | | - } |
---|
5600 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5601 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5602 | | - { |
---|
5603 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5604 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5605 | | - } |
---|
| 5609 | + |
---|
| 5610 | + display.PopMaterial(this, selected); |
---|
5606 | 5611 | } |
---|
5607 | 5612 | |
---|
5608 | 5613 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5644 | 5649 | // resetMasterNode(); |
---|
5645 | 5650 | } |
---|
5646 | 5651 | |
---|
5647 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5652 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5648 | 5653 | { |
---|
5649 | 5654 | if (GetBRep() == null) |
---|
5650 | 5655 | { |
---|
.. | .. |
---|
5727 | 5732 | boolean flipV = false; // true; |
---|
5728 | 5733 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5729 | 5734 | |
---|
5730 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5735 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5731 | 5736 | { |
---|
5732 | 5737 | if (hide) |
---|
5733 | 5738 | return; |
---|
.. | .. |
---|
5786 | 5791 | // // ??????????????????????????? Touch(); |
---|
5787 | 5792 | // } |
---|
5788 | 5793 | |
---|
5789 | | - if (material != null) |
---|
5790 | | - { |
---|
5791 | | - materialstack[materialdepth] = material; |
---|
5792 | | - selectedstack[materialdepth] = selected; |
---|
5793 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5794 | | - //System.out.println("material " + material); |
---|
5795 | | - //Applet3D.tracein("selected ", selected); |
---|
5796 | | - display.vector2buffer = projectedVertices; |
---|
5797 | | - material.Draw(display, selected); |
---|
5798 | | - } |
---|
| 5794 | +display.PushMaterial2(this, selected); |
---|
5799 | 5795 | |
---|
5800 | 5796 | Object3D child; |
---|
5801 | 5797 | boolean sel; |
---|
.. | .. |
---|
5819 | 5815 | if (!child.HasTransparency()) |
---|
5820 | 5816 | { |
---|
5821 | 5817 | sel = root != null && root.selection != null && root.selection.indexOf(child) != -1; |
---|
5822 | | - // GraphreeD.tracein("draw ", child); |
---|
| 5818 | + // GrafreeD.tracein("draw ", child); |
---|
5823 | 5819 | boolean wasblocked = blockdraw; |
---|
5824 | 5820 | blockdraw = true; |
---|
5825 | 5821 | child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected()); |
---|
5826 | 5822 | blockdraw = false; |
---|
5827 | | - // GraphreeD.traceout("draw ", child); |
---|
| 5823 | + // GrafreeD.traceout("draw ", child); |
---|
5828 | 5824 | } |
---|
5829 | 5825 | |
---|
5830 | 5826 | release(i); |
---|
.. | .. |
---|
5847 | 5843 | */ |
---|
5848 | 5844 | //depth += 1; |
---|
5849 | 5845 | |
---|
5850 | | - if (material != null) |
---|
5851 | | - { |
---|
5852 | | - materialdepth -= 1; |
---|
5853 | | - if (materialdepth > 0) |
---|
5854 | | - { |
---|
5855 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5856 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5857 | | - } |
---|
5858 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5859 | | - //else |
---|
5860 | | - //material.Draw(display, false); |
---|
5861 | | - } |
---|
5862 | | - |
---|
| 5846 | +display.PopMaterial2(this); |
---|
5863 | 5847 | /* |
---|
5864 | 5848 | display.ReleaseTextures(tex); |
---|
5865 | 5849 | */ |
---|
.. | .. |
---|
5870 | 5854 | |
---|
5871 | 5855 | //static cVector min,max; |
---|
5872 | 5856 | |
---|
5873 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 5857 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5874 | 5858 | { |
---|
5875 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 5859 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5876 | 5860 | return; // no shadow for transparent objects |
---|
5877 | 5861 | |
---|
5878 | 5862 | if (hide) |
---|
.. | .. |
---|
5915 | 5899 | return; |
---|
5916 | 5900 | } |
---|
5917 | 5901 | |
---|
| 5902 | + //bRep.GenUV(1/material.diffuseness); |
---|
5918 | 5903 | // bRep.lock = true; |
---|
5919 | 5904 | |
---|
5920 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5905 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5921 | 5906 | |
---|
5922 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 5907 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5923 | 5908 | { |
---|
5924 | 5909 | int fc = bRep.FaceCount(); |
---|
5925 | 5910 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5934 | 5919 | |
---|
5935 | 5920 | bRep.getMinMax(min, max, 100); |
---|
5936 | 5921 | |
---|
5937 | | - gl.glBegin(gl.GL_LINES); |
---|
5938 | | - |
---|
5939 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5940 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5941 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5942 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5943 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5944 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5945 | | - |
---|
5946 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5947 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5948 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5949 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5950 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5951 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5952 | | - |
---|
5953 | | - gl.glEnd(); |
---|
| 5922 | + display.DrawBox(min, max); |
---|
5954 | 5923 | |
---|
5955 | 5924 | return; |
---|
5956 | 5925 | } |
---|
.. | .. |
---|
5994 | 5963 | { |
---|
5995 | 5964 | //throw new Error(); |
---|
5996 | 5965 | |
---|
5997 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5966 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5998 | 5967 | |
---|
5999 | 5968 | int[] strips = bRep.getRawIndices(); |
---|
6000 | 5969 | |
---|
.. | .. |
---|
6004 | 5973 | new Exception().printStackTrace(); |
---|
6005 | 5974 | return; |
---|
6006 | 5975 | } |
---|
6007 | | - |
---|
6008 | | - // TRIANGLE STRIP ARRAY |
---|
6009 | | - if (bRep.trimmed) |
---|
6010 | | - { |
---|
6011 | | - float[] v = bRep.getRawVertices(); |
---|
6012 | | - float[] n = bRep.getRawNormals(); |
---|
6013 | | - float[] c = bRep.getRawColors(); |
---|
6014 | | - float[] uv = bRep.getRawUVMap(); |
---|
6015 | | - |
---|
6016 | | - int count2 = 0; |
---|
6017 | | - int count3 = 0; |
---|
6018 | | - |
---|
6019 | | - if (n.length > 0) |
---|
6020 | | - { |
---|
6021 | | - for (int i = 0; i < strips.length; i++) |
---|
6022 | | - { |
---|
6023 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6024 | | - |
---|
6025 | | - /* |
---|
6026 | | - boolean locked = false; |
---|
6027 | | - float eps = 0.1f; |
---|
6028 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6029 | | - |
---|
6030 | | - int dot = 0; |
---|
6031 | | - |
---|
6032 | | - if ((dot&1) == 0) |
---|
6033 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6034 | | - |
---|
6035 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6036 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6037 | | - else |
---|
6038 | | - { |
---|
6039 | | - locked = true; |
---|
6040 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6041 | | - } |
---|
6042 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6043 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6044 | | - if (hasnorm) |
---|
6045 | | - { |
---|
6046 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6047 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6048 | | - } |
---|
6049 | | - |
---|
6050 | | - if ((dot&4) == 0) |
---|
6051 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6052 | | - |
---|
6053 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6054 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6055 | | - else |
---|
6056 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6057 | | - |
---|
6058 | | - f.dot = dot; |
---|
6059 | | - */ |
---|
6060 | | - |
---|
6061 | | - if (!selectmode) |
---|
6062 | | - { |
---|
6063 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6064 | | - { |
---|
6065 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6066 | | - } else |
---|
6067 | | - { |
---|
6068 | | - gl.glNormal3f(0, 0, 1); |
---|
6069 | | - } |
---|
6070 | | - |
---|
6071 | | - if (c != null) |
---|
6072 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6073 | | - { |
---|
6074 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6075 | | - } |
---|
6076 | | - } |
---|
6077 | | - if (flipV) |
---|
6078 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6079 | | - else |
---|
6080 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6081 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6082 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6083 | | - |
---|
6084 | | - count2 += 2; |
---|
6085 | | - count3 += 3; |
---|
6086 | | - if (!selectmode) |
---|
6087 | | - { |
---|
6088 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6089 | | - { |
---|
6090 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6091 | | - } else |
---|
6092 | | - { |
---|
6093 | | - gl.glNormal3f(0, 0, 1); |
---|
6094 | | - } |
---|
6095 | | - if (c != null) |
---|
6096 | | - { |
---|
6097 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6098 | | - } |
---|
6099 | | - } |
---|
6100 | | - if (flipV) |
---|
6101 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6102 | | - else |
---|
6103 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6104 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6105 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6106 | | - |
---|
6107 | | - count2 += 2; |
---|
6108 | | - count3 += 3; |
---|
6109 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6110 | | - { |
---|
6111 | | - //gl.glTexCoord2d(...); |
---|
6112 | | - if (!selectmode) |
---|
6113 | | - { |
---|
6114 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6115 | | - { |
---|
6116 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6117 | | - } else |
---|
6118 | | - { |
---|
6119 | | - gl.glNormal3f(0, 0, 1); |
---|
6120 | | - } |
---|
6121 | | - if (c != null) |
---|
6122 | | - { |
---|
6123 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6124 | | - } |
---|
6125 | | - } |
---|
6126 | | - |
---|
6127 | | - if (flipV) |
---|
6128 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6129 | | - else |
---|
6130 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6131 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6132 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6133 | | - count2 += 2; |
---|
6134 | | - count3 += 3; |
---|
6135 | | - } |
---|
6136 | | - |
---|
6137 | | - gl.glEnd(); |
---|
6138 | | - } |
---|
6139 | | - } |
---|
6140 | | - |
---|
6141 | | - assert count3 == v.length; |
---|
6142 | | - } |
---|
6143 | | - else // !trimmed |
---|
6144 | | - { |
---|
6145 | | - int count = 0; |
---|
6146 | | - for (int i = 0; i < strips.length; i++) |
---|
6147 | | - { |
---|
6148 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6149 | | - |
---|
6150 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6151 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6152 | | - |
---|
6153 | | - drawVertex(gl, p, selectmode); |
---|
6154 | | - drawVertex(gl, q, selectmode); |
---|
6155 | | - |
---|
6156 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6157 | | - { |
---|
6158 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6159 | | - |
---|
6160 | | -// if (j%2 == 0) |
---|
6161 | | -// drawFace(p, q, r, display, null); |
---|
6162 | | -// else |
---|
6163 | | -// drawFace(p, r, q, display, null); |
---|
6164 | | - |
---|
6165 | | -// p = q; |
---|
6166 | | -// q = r; |
---|
6167 | | - drawVertex(gl, r, selectmode); |
---|
6168 | | - } |
---|
6169 | | - |
---|
6170 | | - gl.glEnd(); |
---|
6171 | | - } |
---|
6172 | | - } |
---|
| 5976 | + |
---|
| 5977 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6173 | 5978 | } else // catch (Error e) |
---|
6174 | 5979 | { |
---|
6175 | 5980 | // TRIANGLE ARRAY |
---|
6176 | 5981 | if (IsOpaque()) // Static()) |
---|
6177 | 5982 | { |
---|
6178 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 5983 | + display.StartTriangles(); |
---|
6179 | 5984 | int facecount = bRep.FaceCount(); |
---|
6180 | 5985 | for (int i = 0; i < facecount; i++) |
---|
6181 | 5986 | { |
---|
.. | .. |
---|
6238 | 6043 | // // r.norm.dot(v3) > -0.5) |
---|
6239 | 6044 | // // continue; |
---|
6240 | 6045 | |
---|
6241 | | - drawFace(p, q, r, display, face); |
---|
| 6046 | + display.DrawFace(this, p, q, r, face); |
---|
6242 | 6047 | } |
---|
6243 | | - gl.glEnd(); |
---|
| 6048 | + display.EndTriangles(); |
---|
6244 | 6049 | } |
---|
6245 | 6050 | else |
---|
6246 | 6051 | { |
---|
.. | .. |
---|
6269 | 6074 | //System.out.println("SORT"); |
---|
6270 | 6075 | |
---|
6271 | 6076 | java.util.Arrays.sort(facescompare); |
---|
6272 | | - |
---|
6273 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6077 | + |
---|
| 6078 | + display.StartTriangles(); |
---|
6274 | 6079 | for (int i = 0; i < facecount; i++) |
---|
6275 | 6080 | { |
---|
6276 | 6081 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6282 | 6087 | Vertex q = bRep.GetVertex(face.q); |
---|
6283 | 6088 | Vertex r = bRep.GetVertex(face.r); |
---|
6284 | 6089 | |
---|
6285 | | - drawFace(p, q, r, display, face); |
---|
| 6090 | + display.DrawFace(this, p, q, r, face); |
---|
6286 | 6091 | } |
---|
6287 | | - gl.glEnd(); |
---|
| 6092 | + display.EndTriangles(); |
---|
6288 | 6093 | } |
---|
6289 | 6094 | |
---|
6290 | 6095 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6291 | 6096 | { |
---|
| 6097 | + /* |
---|
6292 | 6098 | gl.glDisable(gl.GL_LIGHTING); |
---|
6293 | 6099 | float[] colorV = new float[3]; |
---|
6294 | 6100 | |
---|
.. | .. |
---|
6367 | 6173 | // gl.glEnd(); |
---|
6368 | 6174 | } |
---|
6369 | 6175 | } |
---|
| 6176 | + */ |
---|
6370 | 6177 | } |
---|
6371 | 6178 | } |
---|
6372 | 6179 | |
---|
.. | .. |
---|
6411 | 6218 | center.add(r); |
---|
6412 | 6219 | center.mul(1.0/3); |
---|
6413 | 6220 | |
---|
6414 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6221 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6415 | 6222 | |
---|
6416 | 6223 | distance = center.dot(center); |
---|
6417 | 6224 | } |
---|
.. | .. |
---|
6422 | 6229 | |
---|
6423 | 6230 | transient FaceCompare[] facescompare = null; |
---|
6424 | 6231 | |
---|
6425 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6426 | | - { |
---|
6427 | | - if (display.RENDERPROGRAM == 0) |
---|
6428 | | - { |
---|
6429 | | - float r = 0; |
---|
6430 | | - if (bRep != null) |
---|
6431 | | - { |
---|
6432 | | - if (bRep.stripified) |
---|
6433 | | - { |
---|
6434 | | - r = 1; |
---|
6435 | | - } |
---|
6436 | | - } |
---|
6437 | | - float g = 0; |
---|
6438 | | - if (bRep != null) |
---|
6439 | | - { |
---|
6440 | | - if (bRep.trimmed) |
---|
6441 | | - { |
---|
6442 | | - g = 1; |
---|
6443 | | - } |
---|
6444 | | - } |
---|
6445 | | - float b = 0; |
---|
6446 | | - if (support != null && link2master) |
---|
6447 | | - { |
---|
6448 | | - b = 1; |
---|
6449 | | - } |
---|
6450 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6451 | | - return; |
---|
6452 | | - } |
---|
6453 | | - |
---|
6454 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6455 | | - return; |
---|
6456 | | - |
---|
6457 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6458 | | -// if (true) return; |
---|
6459 | | -// float ao = p.AO; |
---|
6460 | | -// |
---|
6461 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6462 | | -// // ao = 1; |
---|
6463 | | -// |
---|
6464 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6465 | | - |
---|
6466 | | -// CameraPane.selectedpoint. |
---|
6467 | | -// getAverage(cStatic.point1, true); |
---|
6468 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6469 | | - { |
---|
6470 | | - return; |
---|
6471 | | - } |
---|
6472 | | - |
---|
6473 | | - cStatic.point1.set(0,0,0); |
---|
6474 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6475 | | - |
---|
6476 | | - cStatic.point1.sub(p0); |
---|
6477 | | - |
---|
6478 | | - |
---|
6479 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6480 | | -// { |
---|
6481 | | -// return; |
---|
6482 | | -// } |
---|
6483 | | - |
---|
6484 | | - //if (true) |
---|
6485 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6486 | | - { |
---|
6487 | | - return; |
---|
6488 | | - } |
---|
6489 | | - |
---|
6490 | | - float[] colorV = new float[3]; |
---|
6491 | | - |
---|
6492 | | - if (false) // marked) |
---|
6493 | | - { |
---|
6494 | | - // debug rigging weights |
---|
6495 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6496 | | - { |
---|
6497 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6498 | | - |
---|
6499 | | - // if (weight < 0.1) |
---|
6500 | | - // { |
---|
6501 | | - // assert(weight == 0); |
---|
6502 | | - // continue; |
---|
6503 | | - // } |
---|
6504 | | - |
---|
6505 | | - if (p0.vertexlinks[object] == -1) |
---|
6506 | | - continue; |
---|
6507 | | - |
---|
6508 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6509 | | - |
---|
6510 | | - int color = //1 << object; // |
---|
6511 | | - //p.vertexlinks.length; |
---|
6512 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6513 | | - colorV[2] += (color & 1) * weight; |
---|
6514 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6515 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6516 | | - } |
---|
6517 | | - } |
---|
6518 | | - else |
---|
6519 | | - { |
---|
6520 | | - if (drawingstarted) |
---|
6521 | | - { |
---|
6522 | | - // find next point |
---|
6523 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6524 | | - { |
---|
6525 | | - bRep.InitFaceIndices(); |
---|
6526 | | - } |
---|
6527 | | - |
---|
6528 | | - double ymin = p0.y; |
---|
6529 | | - |
---|
6530 | | - Vertex newp = p0; |
---|
6531 | | - |
---|
6532 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6533 | | - { |
---|
6534 | | - int fi = p0.faceindices[fii]; |
---|
6535 | | - |
---|
6536 | | - if (fi == -1) |
---|
6537 | | - break; |
---|
6538 | | - |
---|
6539 | | - Face f = bRep.GetFace(fi); |
---|
6540 | | - |
---|
6541 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6542 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6543 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6544 | | - |
---|
6545 | | - int swap = (int)(Math.random()*3); |
---|
6546 | | - |
---|
6547 | | -// for (int s=swap; --s>=0;) |
---|
6548 | | -// { |
---|
6549 | | -// Vertex t = p; |
---|
6550 | | -// p = q; |
---|
6551 | | -// q = r; |
---|
6552 | | -// r = t; |
---|
6553 | | -// } |
---|
6554 | | - if (ymin > p.y) |
---|
6555 | | - { |
---|
6556 | | - ymin = p.y; |
---|
6557 | | - newp = p; |
---|
6558 | | -// break; |
---|
6559 | | - } |
---|
6560 | | - if (ymin > q.y) |
---|
6561 | | - { |
---|
6562 | | - ymin = q.y; |
---|
6563 | | - newp = q; |
---|
6564 | | -// break; |
---|
6565 | | - } |
---|
6566 | | - if (ymin > r.y) |
---|
6567 | | - { |
---|
6568 | | - ymin = r.y; |
---|
6569 | | - newp = r; |
---|
6570 | | -// break; |
---|
6571 | | - } |
---|
6572 | | - } |
---|
6573 | | - |
---|
6574 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6575 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6576 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6577 | | - |
---|
6578 | | - drawingstarted = false; |
---|
6579 | | - |
---|
6580 | | - // return; |
---|
6581 | | - } |
---|
6582 | | - |
---|
6583 | | - if (false) // CameraPane.DRAW |
---|
6584 | | - { |
---|
6585 | | - p0.AO = colorV[0] = 2; |
---|
6586 | | - colorV[1] = 2; |
---|
6587 | | - colorV[2] = 2; |
---|
6588 | | - } |
---|
6589 | | - |
---|
6590 | | - CameraPane.pointflow.add(p0); |
---|
6591 | | - CameraPane.pointflow.Touch(); |
---|
6592 | | - } |
---|
6593 | | - |
---|
6594 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6595 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6596 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6597 | | - } |
---|
6598 | | - |
---|
6599 | 6232 | void Print(Vertex v) |
---|
6600 | 6233 | { |
---|
6601 | 6234 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6602 | 6235 | } |
---|
6603 | 6236 | |
---|
6604 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6605 | | - { |
---|
6606 | | - if (!selectmode) |
---|
6607 | | - { |
---|
6608 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6609 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6610 | | - |
---|
6611 | | - if (flipV) |
---|
6612 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6613 | | - else |
---|
6614 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6615 | | - } |
---|
6616 | | - |
---|
6617 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6618 | | - } |
---|
6619 | | - |
---|
6620 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6621 | | - CameraPane display, Face face) |
---|
6622 | | - { |
---|
6623 | | - if (pv.y == -10000 || |
---|
6624 | | - qv.y == -10000 || |
---|
6625 | | - rv.y == -10000) |
---|
6626 | | - return; |
---|
6627 | | - |
---|
6628 | | -// float b = f.nbiterations & 1; |
---|
6629 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6630 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6631 | | -// |
---|
6632 | | -// //if (f.weight == 10000) |
---|
6633 | | -// //{ |
---|
6634 | | -// // r = 1; g = b = 0; |
---|
6635 | | -// //} |
---|
6636 | | -// //else |
---|
6637 | | -// //{ |
---|
6638 | | -// // assert(f.weight < 10000); |
---|
6639 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6640 | | -// if (r<0) |
---|
6641 | | -// assert(r>=0); |
---|
6642 | | -// //} |
---|
6643 | | - |
---|
6644 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6645 | | - |
---|
6646 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6647 | | - |
---|
6648 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6649 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6650 | | - { |
---|
6651 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6652 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6653 | | - if (!hasnorm) |
---|
6654 | | - { |
---|
6655 | | - // System.out.println("FUCK!!"); |
---|
6656 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6657 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6658 | | - LA.vecCross(v0, v1, v2); |
---|
6659 | | - LA.vecNormalize(v2); |
---|
6660 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6661 | | - } |
---|
6662 | | - |
---|
6663 | | - if (hasnorm) |
---|
6664 | | - { |
---|
6665 | | -// if (!pv.norm.normalized()) |
---|
6666 | | -// assert(pv.norm.normalized()); |
---|
6667 | | - |
---|
6668 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6669 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6670 | | - } |
---|
6671 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6672 | | - SetColor(display, pv); |
---|
6673 | | - //gl.glColor4f(r, g, b, 1); |
---|
6674 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6675 | | - if (flipV) |
---|
6676 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6677 | | - else |
---|
6678 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6679 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6680 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6681 | | -// Print(pv); |
---|
6682 | | - if (hasnorm) |
---|
6683 | | - { |
---|
6684 | | -// assert(qv.norm.normalized()); |
---|
6685 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6686 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6687 | | - } |
---|
6688 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6689 | | - // boolean locked = false; |
---|
6690 | | - // float eps = 0.1f; |
---|
6691 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6692 | | - |
---|
6693 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6694 | | - |
---|
6695 | | - // if ((dot&1) == 0) |
---|
6696 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6697 | | - |
---|
6698 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6699 | | - if (flipV) |
---|
6700 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6701 | | - else |
---|
6702 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6703 | | - // else |
---|
6704 | | - // { |
---|
6705 | | - // locked = true; |
---|
6706 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6707 | | - // } |
---|
6708 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6709 | | - SetColor(display, qv); |
---|
6710 | | - //gl.glColor4f(r, g, b, 1); |
---|
6711 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6712 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6713 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6714 | | -// Print(qv); |
---|
6715 | | - if (hasnorm) |
---|
6716 | | - { |
---|
6717 | | -// assert(rv.norm.normalized()); |
---|
6718 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6719 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6720 | | - } |
---|
6721 | | - |
---|
6722 | | - // if ((dot&4) == 0) |
---|
6723 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6724 | | - |
---|
6725 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6726 | | - if (flipV) |
---|
6727 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6728 | | - else |
---|
6729 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6730 | | - // else |
---|
6731 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6732 | | - |
---|
6733 | | - // f.dot = dot; |
---|
6734 | | - |
---|
6735 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6736 | | - SetColor(display, rv); |
---|
6737 | | - //gl.glColor4f(r, g, b, 1); |
---|
6738 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6739 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6740 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6741 | | -// Print(rv); |
---|
6742 | | - //gl.glEnd(); |
---|
6743 | | - } |
---|
6744 | | - else |
---|
6745 | | - { |
---|
6746 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6747 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6748 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6749 | | - |
---|
6750 | | - } |
---|
6751 | | - |
---|
6752 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6753 | | - { |
---|
6754 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6755 | | - |
---|
6756 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6757 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6758 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6759 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6760 | | - gl.glEnd(); |
---|
6761 | | - |
---|
6762 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6763 | | - } |
---|
6764 | | - } |
---|
6765 | | - |
---|
6766 | 6237 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6767 | 6238 | { |
---|
6768 | 6239 | if (bRep == null) |
---|
.. | .. |
---|
7334 | 6805 | int spotw = spot.x + spot.width; |
---|
7335 | 6806 | int spoth = spot.y + spot.height; |
---|
7336 | 6807 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7337 | | - if (CameraPane.Xmin > spot.x) |
---|
7338 | | - { |
---|
7339 | | - CameraPane.Xmin = spot.x; |
---|
7340 | | - } |
---|
7341 | | - if (CameraPane.Xmax < spotw) |
---|
7342 | | - { |
---|
7343 | | - CameraPane.Xmax = spotw; |
---|
7344 | | - } |
---|
7345 | | - if (CameraPane.Ymin > spot.y) |
---|
7346 | | - { |
---|
7347 | | - CameraPane.Ymin = spot.y; |
---|
7348 | | - } |
---|
7349 | | - if (CameraPane.Ymax < spoth) |
---|
7350 | | - { |
---|
7351 | | - CameraPane.Ymax = spoth; |
---|
7352 | | - } |
---|
| 6808 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6809 | +// { |
---|
| 6810 | +// CameraPane.Xmin = spot.x; |
---|
| 6811 | +// } |
---|
| 6812 | +// if (CameraPane.Xmax < spotw) |
---|
| 6813 | +// { |
---|
| 6814 | +// CameraPane.Xmax = spotw; |
---|
| 6815 | +// } |
---|
| 6816 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6817 | +// { |
---|
| 6818 | +// CameraPane.Ymin = spot.y; |
---|
| 6819 | +// } |
---|
| 6820 | +// if (CameraPane.Ymax < spoth) |
---|
| 6821 | +// { |
---|
| 6822 | +// CameraPane.Ymax = spoth; |
---|
| 6823 | +// } |
---|
7353 | 6824 | spot.translate(32, 32); |
---|
7354 | 6825 | spotw = spot.x + spot.width; |
---|
7355 | 6826 | spoth = spot.y + spot.height; |
---|
7356 | 6827 | info.g.setColor(Color.blue); |
---|
7357 | 6828 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7358 | | - if (CameraPane.Xmin > spot.x) |
---|
7359 | | - { |
---|
7360 | | - CameraPane.Xmin = spot.x; |
---|
7361 | | - } |
---|
7362 | | - if (CameraPane.Xmax < spotw) |
---|
7363 | | - { |
---|
7364 | | - CameraPane.Xmax = spotw; |
---|
7365 | | - } |
---|
7366 | | - if (CameraPane.Ymin > spot.y) |
---|
7367 | | - { |
---|
7368 | | - CameraPane.Ymin = spot.y; |
---|
7369 | | - } |
---|
7370 | | - if (CameraPane.Ymax < spoth) |
---|
7371 | | - { |
---|
7372 | | - CameraPane.Ymax = spoth; |
---|
7373 | | - } |
---|
| 6829 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6830 | +// { |
---|
| 6831 | +// CameraPane.Xmin = spot.x; |
---|
| 6832 | +// } |
---|
| 6833 | +// if (CameraPane.Xmax < spotw) |
---|
| 6834 | +// { |
---|
| 6835 | +// CameraPane.Xmax = spotw; |
---|
| 6836 | +// } |
---|
| 6837 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6838 | +// { |
---|
| 6839 | +// CameraPane.Ymin = spot.y; |
---|
| 6840 | +// } |
---|
| 6841 | +// if (CameraPane.Ymax < spoth) |
---|
| 6842 | +// { |
---|
| 6843 | +// CameraPane.Ymax = spoth; |
---|
| 6844 | +// } |
---|
7374 | 6845 | info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7375 | 6846 | info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
7376 | 6847 | spot.translate(0, -32); |
---|
7377 | 6848 | info.g.setColor(Color.green); |
---|
7378 | 6849 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7379 | | - if (CameraPane.Xmin > spot.x) |
---|
7380 | | - { |
---|
7381 | | - CameraPane.Xmin = spot.x; |
---|
7382 | | - } |
---|
7383 | | - if (CameraPane.Xmax < spotw) |
---|
7384 | | - { |
---|
7385 | | - CameraPane.Xmax = spotw; |
---|
7386 | | - } |
---|
7387 | | - if (CameraPane.Ymin > spot.y) |
---|
7388 | | - { |
---|
7389 | | - CameraPane.Ymin = spot.y; |
---|
7390 | | - } |
---|
7391 | | - if (CameraPane.Ymax < spoth) |
---|
7392 | | - { |
---|
7393 | | - CameraPane.Ymax = spoth; |
---|
7394 | | - } |
---|
| 6850 | +// if (CameraPane.Xmin > spot.x) |
---|
| 6851 | +// { |
---|
| 6852 | +// CameraPane.Xmin = spot.x; |
---|
| 6853 | +// } |
---|
| 6854 | +// if (CameraPane.Xmax < spotw) |
---|
| 6855 | +// { |
---|
| 6856 | +// CameraPane.Xmax = spotw; |
---|
| 6857 | +// } |
---|
| 6858 | +// if (CameraPane.Ymin > spot.y) |
---|
| 6859 | +// { |
---|
| 6860 | +// CameraPane.Ymin = spot.y; |
---|
| 6861 | +// } |
---|
| 6862 | +// if (CameraPane.Ymax < spoth) |
---|
| 6863 | +// { |
---|
| 6864 | +// CameraPane.Ymax = spoth; |
---|
| 6865 | +// } |
---|
7395 | 6866 | info.g.drawArc(boundary.x, boundary.y, |
---|
7396 | 6867 | boundary.width, boundary.height, 0, 360); |
---|
7397 | 6868 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7398 | | - if (CameraPane.Xmin > boundary.x) |
---|
7399 | | - { |
---|
7400 | | - CameraPane.Xmin = boundary.x; |
---|
7401 | | - } |
---|
7402 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7403 | | - { |
---|
7404 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7405 | | - } |
---|
7406 | | - if (CameraPane.Ymin > boundary.y) |
---|
7407 | | - { |
---|
7408 | | - CameraPane.Ymin = boundary.y; |
---|
7409 | | - } |
---|
7410 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7411 | | - { |
---|
7412 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7413 | | - } |
---|
| 6869 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 6870 | +// { |
---|
| 6871 | +// CameraPane.Xmin = boundary.x; |
---|
| 6872 | +// } |
---|
| 6873 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 6874 | +// { |
---|
| 6875 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 6876 | +// } |
---|
| 6877 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 6878 | +// { |
---|
| 6879 | +// CameraPane.Ymin = boundary.y; |
---|
| 6880 | +// } |
---|
| 6881 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 6882 | +// { |
---|
| 6883 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 6884 | +// } |
---|
7414 | 6885 | return; |
---|
7415 | 6886 | } |
---|
7416 | 6887 | } |
---|
.. | .. |
---|
7513 | 6984 | |
---|
7514 | 6985 | case hitCenter: // Translate |
---|
7515 | 6986 | |
---|
7516 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 6987 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7517 | 6988 | |
---|
7518 | 6989 | if (modified) |
---|
7519 | 6990 | { |
---|
.. | .. |
---|
7561 | 7032 | } |
---|
7562 | 7033 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7563 | 7034 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7564 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7035 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7565 | 7036 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7566 | 7037 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7567 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7038 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7568 | 7039 | //LA.vecCross(up, cVector.Z, right2); |
---|
7569 | 7040 | |
---|
7570 | 7041 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7622 | 7093 | } |
---|
7623 | 7094 | /**/ |
---|
7624 | 7095 | |
---|
7625 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7096 | + switch (info.pane.RenderCamera().viewCode) |
---|
7626 | 7097 | { |
---|
7627 | 7098 | case 1: // '\001' |
---|
7628 | 7099 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7678 | 7149 | } |
---|
7679 | 7150 | /**/ |
---|
7680 | 7151 | |
---|
7681 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7152 | + switch (info.pane.RenderCamera().viewCode) |
---|
7682 | 7153 | { |
---|
7683 | 7154 | case 3: // '\001' |
---|
7684 | 7155 | if (modified) |
---|
.. | .. |
---|
7731 | 7202 | if (parent == null) |
---|
7732 | 7203 | { |
---|
7733 | 7204 | System.out.println("NULL PARENT"); |
---|
7734 | | - new Exception().printStackTrace(); |
---|
| 7205 | + //new Exception().printStackTrace(); |
---|
7735 | 7206 | } else |
---|
7736 | 7207 | { |
---|
7737 | 7208 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
8041 | 7512 | { |
---|
8042 | 7513 | assert(bRep != null); |
---|
8043 | 7514 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
8044 | | - GraphreeD.Assert(support.bRep == bRep.support); |
---|
| 7515 | + GrafreeD.Assert(support.bRep == bRep.support); |
---|
8045 | 7516 | } |
---|
8046 | 7517 | else |
---|
8047 | 7518 | { |
---|
.. | .. |
---|
8124 | 7595 | { |
---|
8125 | 7596 | Object3D targ = this; |
---|
8126 | 7597 | |
---|
| 7598 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7599 | + |
---|
8127 | 7600 | if (obj.material != null) |
---|
8128 | 7601 | { |
---|
8129 | 7602 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|