.. | .. |
---|
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; |
---|
.. | .. |
---|
13 | 14 | import //weka.core. |
---|
14 | 15 | matrix.Matrix; |
---|
15 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
16 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
17 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
18 | 21 | { |
---|
19 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
20 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
21 | 24 | |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 30 | + // |
---|
| 31 | + |
---|
22 | 32 | ScriptNode scriptnode; |
---|
| 33 | + |
---|
| 34 | + void InitOthers() |
---|
| 35 | + { |
---|
| 36 | + if (projectedVertices == null || projectedVertices.length <= 2) |
---|
| 37 | + { |
---|
| 38 | + projectedVertices = new Object3D.cVector2[3]; |
---|
| 39 | + } |
---|
| 40 | + for (int i = 0; i < 3; i++) |
---|
| 41 | + { |
---|
| 42 | + projectedVertices[i] = new cVector2(); // Others |
---|
| 43 | + } |
---|
| 44 | + projectedVertices[0].x = 100; // bump |
---|
| 45 | + } |
---|
23 | 46 | |
---|
24 | 47 | void MinMax(cVector minima, cVector maxima) |
---|
25 | 48 | { |
---|
.. | .. |
---|
86 | 109 | |
---|
87 | 110 | // transient boolean reduced; // for morph reduction |
---|
88 | 111 | |
---|
89 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
90 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
91 | 114 | |
---|
92 | | -transient Object3D transientsupport; // for cloning |
---|
93 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
94 | 117 | |
---|
95 | | -void SaveSupports() |
---|
96 | | -{ |
---|
97 | | - if (blockloop) |
---|
98 | | - return; |
---|
99 | | - |
---|
100 | | - transientsupport = support; |
---|
101 | | - transientlink2master = link2master; |
---|
102 | | - |
---|
103 | | - support = null; |
---|
104 | | - link2master = false; |
---|
105 | | - |
---|
106 | | - if (bRep != null) |
---|
| 118 | + void SaveSupports() |
---|
107 | 119 | { |
---|
108 | | - bRep.SaveSupports(); |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
| 122 | + |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
| 125 | + |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
109 | 143 | } |
---|
110 | | - |
---|
111 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
112 | 146 | { |
---|
113 | | - Object3D child = (Object3D) get(i); |
---|
114 | | - if (child == null) |
---|
115 | | - continue; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
| 169 | + } |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D("copy of " + this.name); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + if (blockloop) |
---|
| 223 | + return; |
---|
| 224 | + |
---|
116 | 225 | blockloop = true; |
---|
117 | | - child.SaveSupports(); |
---|
| 226 | + |
---|
| 227 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 228 | + |
---|
| 229 | + RestoreBigData(o); |
---|
| 230 | + |
---|
| 231 | + //hashtable.remove(GetUUID()); |
---|
| 232 | + |
---|
| 233 | + for (int i=0; i<Size(); i++) |
---|
| 234 | + { |
---|
| 235 | + get(i).RestoreBigData(hashtable); |
---|
| 236 | + } |
---|
| 237 | + |
---|
118 | 238 | blockloop = false; |
---|
119 | 239 | } |
---|
120 | | -} |
---|
121 | 240 | |
---|
122 | | -void RestoreSupports() |
---|
123 | | -{ |
---|
124 | | - if (blockloop) |
---|
125 | | - return; |
---|
126 | | - |
---|
127 | | - support = transientsupport; |
---|
128 | | - link2master = transientlink2master; |
---|
129 | | - transientsupport = null; |
---|
130 | | - transientlink2master = false; |
---|
131 | | - |
---|
132 | | - if (bRep != null) |
---|
| 241 | + void RestoreBigData(Object3D o) |
---|
133 | 242 | { |
---|
134 | | - bRep.RestoreSupports(); |
---|
| 243 | + this.bRep = o.bRep; |
---|
| 244 | + if (this.bRep != null) |
---|
| 245 | + this.bRep.support = o.transientrep; |
---|
| 246 | + // this.support = o.support; |
---|
| 247 | + // this.fileparent = o.fileparent; |
---|
135 | 248 | } |
---|
136 | | - |
---|
137 | | - for (int i = 0; i < Size(); i++) |
---|
138 | | - { |
---|
139 | | - Object3D child = (Object3D) get(i); |
---|
140 | | - if (child == null) |
---|
141 | | - continue; |
---|
142 | | - blockloop = true; |
---|
143 | | - child.RestoreSupports(); |
---|
144 | | - blockloop = false; |
---|
145 | | - } |
---|
146 | | -} |
---|
147 | 249 | |
---|
148 | 250 | // MOCAP SUPPORT |
---|
149 | 251 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
286 | 388 | } |
---|
287 | 389 | |
---|
288 | 390 | boolean live = false; |
---|
| 391 | + boolean dontselect = false; |
---|
289 | 392 | boolean hide = false; |
---|
290 | 393 | boolean link2master = false; // performs reset support/master at each frame |
---|
291 | 394 | boolean marked = false; // animation node |
---|
.. | .. |
---|
295 | 398 | boolean random = false; |
---|
296 | 399 | boolean speedup = false; |
---|
297 | 400 | boolean rewind = false; |
---|
| 401 | + |
---|
| 402 | + float NORMALPUSH = 0; |
---|
298 | 403 | |
---|
299 | 404 | Object3D support; |
---|
300 | 405 | |
---|
.. | .. |
---|
355 | 460 | |
---|
356 | 461 | int MemorySize() |
---|
357 | 462 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 463 | + if (true) // memorysize == 0) |
---|
359 | 464 | { |
---|
360 | 465 | try |
---|
361 | 466 | { |
---|
.. | .. |
---|
415 | 520 | { |
---|
416 | 521 | Object3D copy = this; |
---|
417 | 522 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 523 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 524 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 525 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 526 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 527 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 528 | } |
---|
424 | 529 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 530 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 531 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 532 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 533 | } |
---|
429 | 534 | |
---|
430 | 535 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 537 | //assert(this instanceof Camera); |
---|
433 | 538 | |
---|
434 | 539 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 540 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 541 | } |
---|
437 | 542 | |
---|
438 | 543 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 557 | //assert(this instanceof Camera); |
---|
453 | 558 | |
---|
454 | 559 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 560 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 561 | } |
---|
457 | 562 | |
---|
458 | 563 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
465 | 570 | toParent = LA.newMatrix(); |
---|
466 | 571 | fromParent = LA.newMatrix(); |
---|
467 | 572 | } |
---|
| 573 | + |
---|
468 | 574 | if (toParentMarked == null) |
---|
469 | 575 | { |
---|
470 | 576 | if (maxcount != 1) |
---|
471 | 577 | { |
---|
472 | 578 | new Exception().printStackTrace(); |
---|
473 | 579 | } |
---|
| 580 | + |
---|
474 | 581 | toParentMarked = LA.newMatrix(); |
---|
475 | 582 | fromParentMarked = LA.newMatrix(); |
---|
476 | 583 | } |
---|
.. | .. |
---|
587 | 694 | return; |
---|
588 | 695 | } |
---|
589 | 696 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 697 | + if (Globals.fromscript) |
---|
591 | 698 | { |
---|
592 | 699 | transformcount = 0; |
---|
593 | 700 | return; |
---|
.. | .. |
---|
745 | 852 | |
---|
746 | 853 | int GetTransformCount() |
---|
747 | 854 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 855 | + // patch pour serialization de Texture |
---|
749 | 856 | resetmaxcount(); |
---|
750 | 857 | resettransformcount(); |
---|
751 | 858 | resetstep(); |
---|
.. | .. |
---|
758 | 865 | if (step == 0) |
---|
759 | 866 | step = 1; |
---|
760 | 867 | if (maxcount == 0) |
---|
761 | | - maxcount = 2048; // 4; |
---|
| 868 | + maxcount = 128; // 2048; // 4; |
---|
762 | 869 | // if (acceleration == 0) |
---|
763 | 870 | // acceleration = 10; |
---|
764 | 871 | if (delay == 0) // serial |
---|
.. | .. |
---|
779 | 886 | // factor = CameraPane.STEP; |
---|
780 | 887 | // } |
---|
781 | 888 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 889 | + if (marked && Globals.isLIVE() && live && |
---|
| 890 | + //TEMP21aug2018 |
---|
| 891 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
| 892 | + currentframe != Globals.framecount) |
---|
783 | 893 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 894 | + currentframe = Globals.framecount; |
---|
785 | 895 | |
---|
786 | 896 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 897 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
790 | 900 | |
---|
791 | 901 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
792 | 902 | |
---|
793 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 903 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 904 | + (step == 1 && changedir)) |
---|
794 | 905 | { |
---|
795 | 906 | countdown = 1; |
---|
796 | 907 | delay = speedup?8:1; |
---|
.. | .. |
---|
862 | 973 | if (material == null || material.multiply) |
---|
863 | 974 | return true; |
---|
864 | 975 | |
---|
| 976 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
865 | 977 | return material.opacity > 0.99; |
---|
866 | 978 | } |
---|
867 | 979 | |
---|
.. | .. |
---|
893 | 1005 | fromParent = null; // LA.newMatrix(); |
---|
894 | 1006 | bRep = null; // new BoundaryRep(); |
---|
895 | 1007 | |
---|
| 1008 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1009 | + { |
---|
| 1010 | + name = oname; |
---|
| 1011 | + } |
---|
| 1012 | + |
---|
896 | 1013 | /* |
---|
897 | 1014 | float hue = (float)Math.random(); |
---|
898 | 1015 | Color col; |
---|
.. | .. |
---|
935 | 1052 | |
---|
936 | 1053 | public Object clone() |
---|
937 | 1054 | { |
---|
938 | | - return GrafreeD.clone(this); |
---|
| 1055 | + return Grafreed.clone(this); |
---|
939 | 1056 | } |
---|
940 | 1057 | |
---|
941 | 1058 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1563 | // if (other == null) |
---|
1447 | 1564 | // return; |
---|
1448 | 1565 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1566 | + if (other != null) |
---|
| 1567 | + { |
---|
| 1568 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1569 | + |
---|
| 1570 | + // Set default to 0.1 |
---|
| 1571 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
| 1572 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1573 | + } |
---|
| 1574 | + |
---|
| 1575 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1576 | |
---|
1451 | 1577 | //if (bRep != null) |
---|
1452 | 1578 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1827 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1828 | o.bRep = transientrep; |
---|
1703 | 1829 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1830 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1705 | 1831 | o.CreateMaterial(); |
---|
1706 | 1832 | o.SetAttributes(this, -1); |
---|
1707 | 1833 | //parent |
---|
.. | .. |
---|
1714 | 1840 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1841 | o.bRep = bRep; |
---|
1716 | 1842 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1843 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1718 | 1844 | o.CreateMaterial(); |
---|
1719 | 1845 | //o.overwriteThis(this, -1); |
---|
1720 | 1846 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1801 | 1927 | if (obj.name == null) |
---|
1802 | 1928 | continue; // can't be a null one |
---|
1803 | 1929 | |
---|
| 1930 | + // Try perfect match first. |
---|
1804 | 1931 | if (n.equals(obj.name)) |
---|
1805 | 1932 | { |
---|
1806 | 1933 | theobj = obj; |
---|
1807 | 1934 | count++; |
---|
1808 | 1935 | } |
---|
1809 | 1936 | } |
---|
| 1937 | + |
---|
| 1938 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1810 | 1939 | |
---|
1811 | 1940 | if (count != 1) |
---|
1812 | 1941 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
1816 | 1945 | if (obj.name == null) |
---|
1817 | 1946 | continue; // can't be a null one |
---|
1818 | 1947 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1948 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1949 | + //if (n.startsWith(obj.name)) |
---|
| 1950 | + if (n.contains(name)) |
---|
1821 | 1951 | { |
---|
1822 | 1952 | theobj = obj; |
---|
1823 | 1953 | count++; |
---|
.. | .. |
---|
2120 | 2250 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2251 | { |
---|
2122 | 2252 | 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 |
---|
| 2253 | + |
---|
| 2254 | + InitOthers(); |
---|
2132 | 2255 | |
---|
2133 | 2256 | if (this instanceof Camera) |
---|
2134 | 2257 | { |
---|
.. | .. |
---|
2272 | 2395 | } |
---|
2273 | 2396 | */ |
---|
2274 | 2397 | } |
---|
| 2398 | + else |
---|
| 2399 | + { |
---|
| 2400 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2401 | + } |
---|
2275 | 2402 | } |
---|
2276 | 2403 | |
---|
2277 | 2404 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
2278 | 2405 | { |
---|
2279 | 2406 | if (newWindow) |
---|
2280 | 2407 | { |
---|
| 2408 | + new Exception().printStackTrace(); |
---|
2281 | 2409 | System.exit(0); |
---|
2282 | 2410 | if (parent != null) |
---|
2283 | 2411 | { |
---|
.. | .. |
---|
2312 | 2440 | { |
---|
2313 | 2441 | editWindow.refreshContents(); |
---|
2314 | 2442 | } |
---|
| 2443 | + else |
---|
| 2444 | + { |
---|
| 2445 | + if (manipWindow != null) |
---|
| 2446 | + { |
---|
| 2447 | + manipWindow.refreshContents(); |
---|
| 2448 | + } |
---|
| 2449 | + } |
---|
| 2450 | + |
---|
2315 | 2451 | //if (parent != null) |
---|
2316 | 2452 | //parent.refreshEditWindow(); |
---|
2317 | 2453 | } |
---|
.. | .. |
---|
2454 | 2590 | return retval; |
---|
2455 | 2591 | } |
---|
2456 | 2592 | |
---|
2457 | | - void doEditDrag(ClickInfo info) |
---|
| 2593 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2458 | 2594 | { |
---|
2459 | 2595 | switch (doSomething) |
---|
2460 | 2596 | { |
---|
2461 | 2597 | case 1: // '\001' |
---|
2462 | 2598 | //super. |
---|
2463 | | - doEditDrag0(info); |
---|
| 2599 | + doEditDrag0(info, opposite); |
---|
2464 | 2600 | break; |
---|
2465 | 2601 | |
---|
2466 | 2602 | case 2: // '\002' |
---|
.. | .. |
---|
2473 | 2609 | { |
---|
2474 | 2610 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2475 | 2611 | //childToDrag.doEditDrag(info); |
---|
2476 | | - sel.doEditDrag(info); |
---|
| 2612 | + sel.doEditDrag(info, opposite); |
---|
2477 | 2613 | } else |
---|
2478 | 2614 | { |
---|
2479 | 2615 | //super. |
---|
2480 | | - doEditDrag0(info); |
---|
| 2616 | + doEditDrag0(info, opposite); |
---|
2481 | 2617 | } |
---|
2482 | 2618 | } |
---|
2483 | 2619 | break; |
---|
.. | .. |
---|
2587 | 2723 | void GenNormalsS(boolean crease) |
---|
2588 | 2724 | { |
---|
2589 | 2725 | selection.GenNormals(crease); |
---|
| 2726 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2727 | +// { |
---|
| 2728 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2729 | +// selectee.GenNormals(crease); |
---|
| 2730 | +// } |
---|
| 2731 | + |
---|
| 2732 | + //Touch(); |
---|
| 2733 | + } |
---|
| 2734 | + |
---|
| 2735 | + void GenNormalsMeshS() |
---|
| 2736 | + { |
---|
| 2737 | + selection.GenNormalsMesh(); |
---|
2590 | 2738 | // for (int i=0; i<selection.size(); i++) |
---|
2591 | 2739 | // { |
---|
2592 | 2740 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2732 | 2880 | blockloop = false; |
---|
2733 | 2881 | } |
---|
2734 | 2882 | |
---|
| 2883 | + void GenNormalsMesh() |
---|
| 2884 | + { |
---|
| 2885 | + if (blockloop) |
---|
| 2886 | + return; |
---|
| 2887 | + |
---|
| 2888 | + blockloop = true; |
---|
| 2889 | + GenNormalsMesh0(); |
---|
| 2890 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2891 | + { |
---|
| 2892 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2893 | + if (child == null) |
---|
| 2894 | + continue; |
---|
| 2895 | + child.GenNormalsMesh(); |
---|
| 2896 | +// Children().release(i); |
---|
| 2897 | + } |
---|
| 2898 | + blockloop = false; |
---|
| 2899 | + } |
---|
| 2900 | + |
---|
| 2901 | + void GenNormalsMINE() |
---|
| 2902 | + { |
---|
| 2903 | + if (blockloop) |
---|
| 2904 | + return; |
---|
| 2905 | + |
---|
| 2906 | + blockloop = true; |
---|
| 2907 | + GenNormalsMINE0(); |
---|
| 2908 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2909 | + { |
---|
| 2910 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2911 | + if (child == null) |
---|
| 2912 | + continue; |
---|
| 2913 | + child.GenNormalsMINE(); |
---|
| 2914 | +// Children().release(i); |
---|
| 2915 | + } |
---|
| 2916 | + blockloop = false; |
---|
| 2917 | + } |
---|
| 2918 | + |
---|
2735 | 2919 | void ClearColors() |
---|
2736 | 2920 | { |
---|
2737 | 2921 | if (blockloop) |
---|
.. | .. |
---|
2866 | 3050 | { |
---|
2867 | 3051 | if (bRep != null) |
---|
2868 | 3052 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 3053 | + bRep.GenUV(); //1); |
---|
| 3054 | + //bRep.UnfoldUV(); |
---|
2870 | 3055 | Touch(); |
---|
2871 | 3056 | } |
---|
2872 | 3057 | } |
---|
.. | .. |
---|
2876 | 3061 | if (bRep != null) |
---|
2877 | 3062 | { |
---|
2878 | 3063 | bRep.GenerateNormals(crease); |
---|
| 3064 | + Touch(); |
---|
| 3065 | + } |
---|
| 3066 | + } |
---|
| 3067 | + |
---|
| 3068 | + void GenNormalsMesh0() |
---|
| 3069 | + { |
---|
| 3070 | + if (bRep != null) |
---|
| 3071 | + { |
---|
| 3072 | + bRep.GenerateNormalsMesh(); |
---|
| 3073 | + Touch(); |
---|
| 3074 | + } |
---|
| 3075 | + } |
---|
| 3076 | + |
---|
| 3077 | + void GenNormalsMINE0() |
---|
| 3078 | + { |
---|
| 3079 | + if (bRep != null) |
---|
| 3080 | + { |
---|
| 3081 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 3082 | Touch(); |
---|
2880 | 3083 | } |
---|
2881 | 3084 | } |
---|
.. | .. |
---|
2932 | 3135 | blockloop = false; |
---|
2933 | 3136 | } |
---|
2934 | 3137 | |
---|
| 3138 | + void TransformChildren() |
---|
| 3139 | + { |
---|
| 3140 | + if (toParent != null) |
---|
| 3141 | + { |
---|
| 3142 | + for (int i=Size(); --i>=0;) |
---|
| 3143 | + { |
---|
| 3144 | + Object3D v = get(i); |
---|
| 3145 | + |
---|
| 3146 | + if (v.toParent == null) |
---|
| 3147 | + { |
---|
| 3148 | + v.toParent = LA.newMatrix(); |
---|
| 3149 | + v.fromParent = LA.newMatrix(); |
---|
| 3150 | + } |
---|
| 3151 | + |
---|
| 3152 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3153 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3154 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3155 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3156 | + } |
---|
| 3157 | + |
---|
| 3158 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3159 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3160 | + |
---|
| 3161 | + Touch(); |
---|
| 3162 | + } |
---|
| 3163 | + } |
---|
| 3164 | + |
---|
2935 | 3165 | void TransformGeometry() |
---|
2936 | 3166 | { |
---|
2937 | 3167 | Object3D obj = this; |
---|
.. | .. |
---|
3153 | 3383 | |
---|
3154 | 3384 | BoundaryRep sup = bRep.support; |
---|
3155 | 3385 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3386 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3157 | 3387 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3388 | + |
---|
| 3389 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3390 | + |
---|
3159 | 3391 | bRep = temprep; |
---|
3160 | 3392 | bRep.support = sup; |
---|
3161 | 3393 | Touch(); |
---|
.. | .. |
---|
3292 | 3524 | if (blockloop) |
---|
3293 | 3525 | return; |
---|
3294 | 3526 | |
---|
3295 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3527 | + if (//marked || // does not make sense |
---|
| 3528 | + (bRep != null || material != null)) // borderline... |
---|
3296 | 3529 | live = h; |
---|
3297 | 3530 | |
---|
3298 | 3531 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3313 | 3546 | return; |
---|
3314 | 3547 | |
---|
3315 | 3548 | //if (bRep != null) |
---|
3316 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3549 | + if (//marked || // does not make sense |
---|
| 3550 | + (bRep != null || material != null)) // borderline... |
---|
3317 | 3551 | link2master = h; |
---|
3318 | 3552 | |
---|
3319 | 3553 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3333 | 3567 | if (blockloop) |
---|
3334 | 3568 | return; |
---|
3335 | 3569 | |
---|
3336 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3570 | + if (//marked || // does not make sense |
---|
| 3571 | + (bRep != null || material != null)) // borderline... |
---|
3337 | 3572 | hide = h; |
---|
3338 | 3573 | |
---|
3339 | 3574 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3353 | 3588 | if (blockloop) |
---|
3354 | 3589 | return; |
---|
3355 | 3590 | |
---|
3356 | | - if (bRep != null && material != null) // borderline... |
---|
| 3591 | + if (bRep != null || material != null) // borderline... |
---|
3357 | 3592 | marked = h; |
---|
3358 | 3593 | |
---|
3359 | 3594 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3363 | 3598 | continue; |
---|
3364 | 3599 | blockloop = true; |
---|
3365 | 3600 | child.MarkLeaves(h); |
---|
| 3601 | + blockloop = false; |
---|
| 3602 | + // release(i); |
---|
| 3603 | + } |
---|
| 3604 | + } |
---|
| 3605 | + |
---|
| 3606 | + void RewindLeaves(boolean h) |
---|
| 3607 | + { |
---|
| 3608 | + if (blockloop) |
---|
| 3609 | + return; |
---|
| 3610 | + |
---|
| 3611 | + if (bRep != null || material != null) // borderline... |
---|
| 3612 | + rewind = h; |
---|
| 3613 | + |
---|
| 3614 | + for (int i = 0; i < Size(); i++) |
---|
| 3615 | + { |
---|
| 3616 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3617 | + if (child == null) |
---|
| 3618 | + continue; |
---|
| 3619 | + blockloop = true; |
---|
| 3620 | + child.RewindLeaves(h); |
---|
| 3621 | + blockloop = false; |
---|
| 3622 | + // release(i); |
---|
| 3623 | + } |
---|
| 3624 | + } |
---|
| 3625 | + |
---|
| 3626 | + void RandomLeaves(boolean h) |
---|
| 3627 | + { |
---|
| 3628 | + if (blockloop) |
---|
| 3629 | + return; |
---|
| 3630 | + |
---|
| 3631 | + if (bRep != null || material != null) // borderline... |
---|
| 3632 | + random = h; |
---|
| 3633 | + |
---|
| 3634 | + for (int i = 0; i < Size(); i++) |
---|
| 3635 | + { |
---|
| 3636 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3637 | + if (child == null) |
---|
| 3638 | + continue; |
---|
| 3639 | + blockloop = true; |
---|
| 3640 | + child.RandomLeaves(h); |
---|
3366 | 3641 | blockloop = false; |
---|
3367 | 3642 | // release(i); |
---|
3368 | 3643 | } |
---|
.. | .. |
---|
3677 | 3952 | if (child == null) |
---|
3678 | 3953 | continue; |
---|
3679 | 3954 | |
---|
3680 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3955 | + if (Grafreed.RENDERME > 0) |
---|
3681 | 3956 | { |
---|
3682 | 3957 | if (child instanceof Merge) |
---|
3683 | 3958 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3828 | 4103 | if (child == null) |
---|
3829 | 4104 | continue; |
---|
3830 | 4105 | |
---|
3831 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4106 | + if (Grafreed.RENDERME > 0) |
---|
3832 | 4107 | { |
---|
3833 | 4108 | if (child instanceof Merge) |
---|
3834 | 4109 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4298 | if (child == null) |
---|
4024 | 4299 | continue; |
---|
4025 | 4300 | |
---|
4026 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4301 | + if (Grafreed.RENDERME > 0) |
---|
4027 | 4302 | { |
---|
4028 | 4303 | if (child instanceof Merge) |
---|
4029 | 4304 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4386 | if (blockloop) |
---|
4112 | 4387 | return; |
---|
4113 | 4388 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4389 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4390 | { |
---|
4116 | 4391 | if (get(i).parent != this) |
---|
4117 | 4392 | { |
---|
.. | .. |
---|
4120 | 4395 | } |
---|
4121 | 4396 | blockloop = true; |
---|
4122 | 4397 | get(i).RepairParent(); |
---|
| 4398 | + blockloop = false; |
---|
| 4399 | + } |
---|
| 4400 | + } |
---|
| 4401 | + |
---|
| 4402 | + void RepairShadow() |
---|
| 4403 | + { |
---|
| 4404 | + if (blockloop) |
---|
| 4405 | + return; |
---|
| 4406 | + |
---|
| 4407 | + if (this.material != null) |
---|
| 4408 | + this.InitOthers(); |
---|
| 4409 | + |
---|
| 4410 | + for (int i=0; i<Size(); i++) |
---|
| 4411 | + { |
---|
| 4412 | + blockloop = true; |
---|
| 4413 | + get(i).RepairShadow(); |
---|
| 4414 | + blockloop = false; |
---|
| 4415 | + } |
---|
| 4416 | + } |
---|
| 4417 | + |
---|
| 4418 | + void RepairSOV() |
---|
| 4419 | + { |
---|
| 4420 | + if (blockloop) |
---|
| 4421 | + return; |
---|
| 4422 | + |
---|
| 4423 | + String texname = this.GetPigmentTexture(); |
---|
| 4424 | + |
---|
| 4425 | + if (texname.startsWith("sov")) |
---|
| 4426 | + { |
---|
| 4427 | + String[] s = texname.split("/"); |
---|
| 4428 | + |
---|
| 4429 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4430 | + |
---|
| 4431 | + texname = sname[0]; |
---|
| 4432 | + |
---|
| 4433 | + if (sname.length > 1) |
---|
| 4434 | + { |
---|
| 4435 | + texname += "Color.jpg"; |
---|
| 4436 | + } |
---|
| 4437 | + |
---|
| 4438 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4439 | + } |
---|
| 4440 | + |
---|
| 4441 | + texname = this.GetBumpTexture(); |
---|
| 4442 | + |
---|
| 4443 | + if (texname.startsWith("sov")) |
---|
| 4444 | + { |
---|
| 4445 | + String[] s = texname.split("/"); |
---|
| 4446 | + |
---|
| 4447 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4448 | + |
---|
| 4449 | + texname = sname[0]; |
---|
| 4450 | + |
---|
| 4451 | + if (sname.length > 1) |
---|
| 4452 | + { |
---|
| 4453 | + texname += "Bump.jpg"; |
---|
| 4454 | + } |
---|
| 4455 | + |
---|
| 4456 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4457 | + } |
---|
| 4458 | + |
---|
| 4459 | + for (int i=0; i<Size(); i++) |
---|
| 4460 | + { |
---|
| 4461 | + blockloop = true; |
---|
| 4462 | + get(i).RepairSOV(); |
---|
4123 | 4463 | blockloop = false; |
---|
4124 | 4464 | } |
---|
4125 | 4465 | } |
---|
.. | .. |
---|
4614 | 4954 | |
---|
4615 | 4955 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4616 | 4956 | { |
---|
4617 | | - if (hide) |
---|
| 4957 | + if (hide || dontselect) |
---|
4618 | 4958 | return null; |
---|
4619 | 4959 | |
---|
4620 | 4960 | if (count <= 0) |
---|
.. | .. |
---|
4638 | 4978 | } |
---|
4639 | 4979 | } |
---|
4640 | 4980 | |
---|
| 4981 | + ObjEditor GetWindow() |
---|
| 4982 | + { |
---|
| 4983 | + if (editWindow != null) |
---|
| 4984 | + return editWindow; |
---|
| 4985 | + |
---|
| 4986 | + return manipWindow; |
---|
| 4987 | + } |
---|
| 4988 | + |
---|
4641 | 4989 | cTreePath Select(int indexcount, boolean deselect) |
---|
4642 | 4990 | { |
---|
4643 | | - if (hide) |
---|
| 4991 | + if (hide || dontselect) |
---|
4644 | 4992 | return null; |
---|
4645 | 4993 | |
---|
4646 | 4994 | if (count <= 0) |
---|
.. | .. |
---|
4674 | 5022 | if (leaf != null) |
---|
4675 | 5023 | { |
---|
4676 | 5024 | cTreePath tp = new cTreePath(this, leaf); |
---|
4677 | | - if (editWindow != null) |
---|
| 5025 | + ObjEditor window = GetWindow(); |
---|
| 5026 | + if (window != null) |
---|
4678 | 5027 | { |
---|
4679 | 5028 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4680 | | - editWindow.Select(tp, deselect, true); |
---|
| 5029 | + window.Select(tp, deselect, true); |
---|
4681 | 5030 | } |
---|
4682 | 5031 | |
---|
4683 | 5032 | return tp; |
---|
.. | .. |
---|
4703 | 5052 | if (leaf != null) |
---|
4704 | 5053 | { |
---|
4705 | 5054 | cTreePath tp = new cTreePath(this, leaf); |
---|
4706 | | - if (editWindow != null) |
---|
| 5055 | + ObjEditor window = GetWindow(); |
---|
| 5056 | + if (window != null) |
---|
4707 | 5057 | { |
---|
4708 | | - editWindow.Select(tp, deselect, true); |
---|
| 5058 | + window.Select(tp, deselect, true); |
---|
4709 | 5059 | } |
---|
4710 | 5060 | |
---|
4711 | 5061 | return tp; |
---|
.. | .. |
---|
4790 | 5140 | return globalTransform; |
---|
4791 | 5141 | } |
---|
4792 | 5142 | |
---|
4793 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 5143 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4794 | 5144 | { |
---|
4795 | 5145 | /* |
---|
4796 | 5146 | if (AOdone) |
---|
.. | .. |
---|
4937 | 5287 | } else // |
---|
4938 | 5288 | if (editWindow != null) |
---|
4939 | 5289 | { |
---|
4940 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5290 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5291 | + Globals.lighttouched = true; |
---|
4941 | 5292 | } |
---|
4942 | 5293 | } |
---|
4943 | 5294 | |
---|
.. | .. |
---|
5091 | 5442 | |
---|
5092 | 5443 | // System.out.println("Fullname = " + fullname); |
---|
5093 | 5444 | |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return fullname.name; |
---|
| 5445 | + // Does not work on Windows due to C: |
---|
| 5446 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5447 | +// return fullname.name; |
---|
| 5448 | +// |
---|
| 5449 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5096 | 5450 | |
---|
5097 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5451 | + String[] split = fullname.name.split(":"); |
---|
| 5452 | + |
---|
| 5453 | + if (split.length == 0) |
---|
| 5454 | + { |
---|
| 5455 | + return ""; |
---|
| 5456 | + } |
---|
| 5457 | + |
---|
| 5458 | + if (split.length <= 2) |
---|
| 5459 | + { |
---|
| 5460 | + if (fullname.name.endsWith(":")) |
---|
| 5461 | + { |
---|
| 5462 | + // Windows |
---|
| 5463 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5464 | + } |
---|
| 5465 | + |
---|
| 5466 | + return split[0]; |
---|
| 5467 | + } |
---|
| 5468 | + |
---|
| 5469 | + // Windows |
---|
| 5470 | + assert(split.length == 4); |
---|
| 5471 | + |
---|
| 5472 | + return split[0] + ":" + split[1]; |
---|
5098 | 5473 | } |
---|
5099 | 5474 | |
---|
5100 | 5475 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5103 | 5478 | return ""; |
---|
5104 | 5479 | |
---|
5105 | 5480 | // System.out.println("Fullname = " + fullname); |
---|
5106 | | - if (fullname.name.indexOf(":") == -1) |
---|
5107 | | - return ""; |
---|
5108 | | - |
---|
5109 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5481 | + // Does not work on Windows due to C: |
---|
| 5482 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5483 | +// return ""; |
---|
| 5484 | +// |
---|
| 5485 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5486 | + String[] split = fullname.name.split(":"); |
---|
| 5487 | + |
---|
| 5488 | + if (split.length == 0) |
---|
| 5489 | + { |
---|
| 5490 | + return ""; |
---|
| 5491 | + } |
---|
| 5492 | + |
---|
| 5493 | + if (split.length == 1) |
---|
| 5494 | + { |
---|
| 5495 | + return ""; |
---|
| 5496 | + } |
---|
| 5497 | + |
---|
| 5498 | + if (split.length == 2) |
---|
| 5499 | + { |
---|
| 5500 | + if (fullname.name.endsWith(":")) |
---|
| 5501 | + { |
---|
| 5502 | + // Windows |
---|
| 5503 | + return ""; |
---|
| 5504 | + } |
---|
| 5505 | + |
---|
| 5506 | + return split[1]; |
---|
| 5507 | + } |
---|
| 5508 | + |
---|
| 5509 | + // Windows |
---|
| 5510 | + assert(split.length == 4); |
---|
| 5511 | + |
---|
| 5512 | + return split[2] + ":" + split[3]; |
---|
5110 | 5513 | } |
---|
5111 | 5514 | |
---|
5112 | 5515 | String GetPigmentTexture() |
---|
.. | .. |
---|
5180 | 5583 | System.out.print("; textures = " + textures); |
---|
5181 | 5584 | System.out.println("; usedtextures = " + usedtextures); |
---|
5182 | 5585 | |
---|
5183 | | - if (GetTextures() == null) |
---|
| 5586 | + if (GetTextures() == null) // What is that?? |
---|
5184 | 5587 | GetTextures().name = ":"; |
---|
5185 | 5588 | |
---|
5186 | 5589 | String texname = tex; |
---|
.. | .. |
---|
5211 | 5614 | child.ResetPigmentTexture(); |
---|
5212 | 5615 | blockloop = false; |
---|
5213 | 5616 | } |
---|
| 5617 | + } |
---|
| 5618 | + |
---|
| 5619 | + UUID GetUUID() |
---|
| 5620 | + { |
---|
| 5621 | + if (uuid == null) |
---|
| 5622 | + { |
---|
| 5623 | + // Serial |
---|
| 5624 | + uuid = UUID.randomUUID(); |
---|
| 5625 | + } |
---|
| 5626 | + |
---|
| 5627 | + return uuid; |
---|
| 5628 | + } |
---|
| 5629 | + |
---|
| 5630 | + Object3D GetObject(UUID uid) |
---|
| 5631 | + { |
---|
| 5632 | + if (blockloop) |
---|
| 5633 | + return null; |
---|
| 5634 | + |
---|
| 5635 | + if (GetUUID().equals(uid)) |
---|
| 5636 | + return this; |
---|
| 5637 | + |
---|
| 5638 | + int nb = Size(); |
---|
| 5639 | + for (int i = 0; i < nb; i++) |
---|
| 5640 | + { |
---|
| 5641 | + Object3D child = (Object3D) get(i); |
---|
| 5642 | + |
---|
| 5643 | + if (child == null) |
---|
| 5644 | + continue; |
---|
| 5645 | + |
---|
| 5646 | + blockloop = true; |
---|
| 5647 | + Object3D obj = child.GetObject(uid); |
---|
| 5648 | + blockloop = false; |
---|
| 5649 | + if (obj != null) |
---|
| 5650 | + return obj; |
---|
| 5651 | + } |
---|
| 5652 | + |
---|
| 5653 | + return null; |
---|
5214 | 5654 | } |
---|
5215 | 5655 | |
---|
5216 | 5656 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5249 | 5689 | } |
---|
5250 | 5690 | } |
---|
5251 | 5691 | |
---|
5252 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5692 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5253 | 5693 | { |
---|
5254 | 5694 | Draw(display, root, selected, blocked); |
---|
5255 | 5695 | } |
---|
5256 | 5696 | |
---|
5257 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5258 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5259 | | - static int materialdepth = 0; |
---|
5260 | | - |
---|
5261 | 5697 | boolean NeedSupport() |
---|
5262 | 5698 | { |
---|
5263 | 5699 | return |
---|
5264 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5700 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5265 | 5701 | // PROBLEM with CROWD!! |
---|
5266 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5702 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5267 | 5703 | } |
---|
5268 | 5704 | |
---|
| 5705 | + static boolean DEBUG_SELECTION = false; |
---|
5269 | 5706 | |
---|
5270 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5707 | + boolean IsLive() |
---|
| 5708 | + { |
---|
| 5709 | + if (live) |
---|
| 5710 | + return true; |
---|
| 5711 | + |
---|
| 5712 | + if (parent == null) |
---|
| 5713 | + return false; |
---|
| 5714 | + |
---|
| 5715 | + return parent.IsLive(); |
---|
| 5716 | + } |
---|
| 5717 | + |
---|
| 5718 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5271 | 5719 | { |
---|
5272 | 5720 | Invariants(); // june 2013 |
---|
5273 | 5721 | |
---|
.. | .. |
---|
5276 | 5724 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5277 | 5725 | } |
---|
5278 | 5726 | |
---|
5279 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
5280 | | - hide) |
---|
| 5727 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
| 5728 | + (hide || dontselect)) |
---|
5281 | 5729 | return; |
---|
5282 | 5730 | |
---|
5283 | 5731 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5295 | 5743 | if (this instanceof Checker) |
---|
5296 | 5744 | return; |
---|
5297 | 5745 | |
---|
5298 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5746 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5299 | 5747 | return; |
---|
5300 | 5748 | |
---|
5301 | 5749 | if (count <= 0) |
---|
.. | .. |
---|
5303 | 5751 | return; |
---|
5304 | 5752 | } |
---|
5305 | 5753 | |
---|
5306 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5307 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5754 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5755 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5308 | 5756 | { |
---|
5309 | 5757 | return; |
---|
5310 | 5758 | } |
---|
5311 | 5759 | |
---|
5312 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5760 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5313 | 5761 | |
---|
5314 | 5762 | /* |
---|
5315 | 5763 | if (touched) |
---|
.. | .. |
---|
5328 | 5776 | support = support; |
---|
5329 | 5777 | |
---|
5330 | 5778 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5331 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5779 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5332 | 5780 | |
---|
5333 | 5781 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5334 | 5782 | { |
---|
.. | .. |
---|
5345 | 5793 | |
---|
5346 | 5794 | boolean compiled = false; |
---|
5347 | 5795 | |
---|
5348 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5796 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5349 | 5797 | |
---|
5350 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
5351 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5798 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
| 5799 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5800 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5352 | 5801 | { |
---|
5353 | | - display.lighttouched = true; |
---|
| 5802 | + Globals.lighttouched = true; |
---|
5354 | 5803 | } // 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 && |
---|
| 5804 | + |
---|
| 5805 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5806 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5357 | 5807 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5358 | 5808 | { |
---|
5359 | 5809 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5361 | 5811 | //if (displaylist == -1 && usecalllists) |
---|
5362 | 5812 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5363 | 5813 | { |
---|
5364 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5814 | + bRep.displaylist = display.GenList(); |
---|
5365 | 5815 | assert(bRep.displaylist != 0); |
---|
5366 | 5816 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5367 | 5817 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5373 | 5823 | if (usecalllists) |
---|
5374 | 5824 | { |
---|
5375 | 5825 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5376 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5826 | + display.NewList(bRep.displaylist); |
---|
5377 | 5827 | } |
---|
| 5828 | + |
---|
5378 | 5829 | CallList(display, root, selected, blocked); |
---|
| 5830 | + |
---|
5379 | 5831 | // compiled = true; |
---|
5380 | 5832 | if (usecalllists) |
---|
5381 | 5833 | { |
---|
5382 | 5834 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5383 | | - gl.glEndList(); |
---|
| 5835 | + display.EndList(); |
---|
5384 | 5836 | } |
---|
5385 | 5837 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5386 | 5838 | // XXX touched = false; |
---|
5387 | | - display.lighttouched = true; // all panes... |
---|
| 5839 | + Globals.lighttouched = true; // all panes... |
---|
5388 | 5840 | } |
---|
5389 | 5841 | |
---|
5390 | 5842 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5423 | 5875 | |
---|
5424 | 5876 | // frustum culling |
---|
5425 | 5877 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5426 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5878 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5427 | 5879 | { |
---|
5428 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5880 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5429 | 5881 | { |
---|
5430 | 5882 | if (!link2master // tricky to cull in shadow mode. |
---|
5431 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5883 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5432 | 5884 | { |
---|
5433 | 5885 | //System.out.print("CULLED"); |
---|
5434 | 5886 | culled = true; |
---|
.. | .. |
---|
5436 | 5888 | } |
---|
5437 | 5889 | else |
---|
5438 | 5890 | //GetBRep().getBounds(v0, v1, this); |
---|
5439 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5891 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5440 | 5892 | culled = true; |
---|
5441 | 5893 | |
---|
5442 | 5894 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5472 | 5924 | |
---|
5473 | 5925 | |
---|
5474 | 5926 | if (!culled) |
---|
5475 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5927 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5476 | 5928 | { |
---|
5477 | 5929 | if (GetBRep() != null) |
---|
5478 | 5930 | { |
---|
5479 | | - CameraPane.NextIndex(this, gl); |
---|
| 5931 | + display.NextIndex(); |
---|
5480 | 5932 | // vertex color conflict : gl.glCallList(list); |
---|
5481 | 5933 | DrawNode(display, root, selected); |
---|
5482 | 5934 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5498 | 5950 | color[2] /= 2; |
---|
5499 | 5951 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5500 | 5952 | */ |
---|
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.options4[0] = material.cameralight/0.2f; |
---|
5523 | | - display.options4[1] = material.subsurface; |
---|
5524 | | - display.options4[2] = material.sheen; |
---|
5525 | | - |
---|
5526 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5527 | | - // display.options3[3] /= 4; |
---|
5528 | | - |
---|
5529 | | - /* |
---|
5530 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5531 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5532 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5533 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5534 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5535 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5536 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5537 | | - /**/ |
---|
5538 | | - } else |
---|
5539 | | - { |
---|
5540 | | - material.Draw(display, selected); |
---|
5541 | | - } |
---|
5542 | | - } else |
---|
5543 | | - { |
---|
5544 | | - if (selected && CameraPane.flash) |
---|
5545 | | - { |
---|
5546 | | - display.modelParams4[1] = 100; |
---|
5547 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5548 | | - } |
---|
5549 | | - } |
---|
| 5953 | + display.PushMaterial(this, selected); |
---|
5550 | 5954 | |
---|
5551 | 5955 | //System.out.println("call list " + list); |
---|
5552 | 5956 | //System.out.println(); |
---|
.. | .. |
---|
5565 | 5969 | tex = GetTextures(); |
---|
5566 | 5970 | } |
---|
5567 | 5971 | |
---|
5568 | | - display.BindTextures(tex, texres); |
---|
| 5972 | + boolean failedPigment = false; |
---|
| 5973 | + boolean failedBump = false; |
---|
| 5974 | + |
---|
| 5975 | + try |
---|
| 5976 | + { |
---|
| 5977 | + display.BindPigmentTexture(tex, texres); |
---|
| 5978 | + } |
---|
| 5979 | + catch (Exception e) |
---|
| 5980 | + { |
---|
| 5981 | + System.err.println("FAILED: " + this); |
---|
| 5982 | + failedPigment = true; |
---|
| 5983 | + } |
---|
| 5984 | + |
---|
| 5985 | + try |
---|
| 5986 | + { |
---|
| 5987 | + display.BindBumpTexture(tex, texres); |
---|
| 5988 | + } |
---|
| 5989 | + catch (Exception e) |
---|
| 5990 | + { |
---|
| 5991 | + //System.err.println("FAILED: " + this); |
---|
| 5992 | + failedBump = true; |
---|
| 5993 | + } |
---|
5569 | 5994 | |
---|
5570 | 5995 | if (!compiled) |
---|
5571 | 5996 | { |
---|
.. | .. |
---|
5581 | 6006 | |
---|
5582 | 6007 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5583 | 6008 | assert(bRep.displaylist != 0); |
---|
5584 | | - gl.glCallList(bRep.displaylist); |
---|
| 6009 | + display.CallList(bRep.displaylist); |
---|
5585 | 6010 | // june 2013 drawSelf(display, root, selected); |
---|
5586 | 6011 | } |
---|
5587 | 6012 | } |
---|
5588 | 6013 | } |
---|
5589 | 6014 | |
---|
5590 | | - display.ReleaseTextures(tex); |
---|
5591 | | - |
---|
5592 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5593 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5594 | | - if (material != null) |
---|
5595 | | - { |
---|
5596 | | - materialdepth -= 1; |
---|
5597 | | - if (materialdepth > 0) |
---|
5598 | | - { |
---|
5599 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5600 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5601 | | - } |
---|
5602 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5603 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5604 | | - { |
---|
5605 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5606 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5607 | | - } |
---|
| 6015 | + if (!failedBump) |
---|
| 6016 | + display.ReleaseBumpTexture(tex); |
---|
| 6017 | + |
---|
| 6018 | + if (!failedPigment) |
---|
| 6019 | + display.ReleasePigmentTexture(tex); |
---|
| 6020 | + |
---|
| 6021 | + display.PopMaterial(this, selected); |
---|
5608 | 6022 | } |
---|
5609 | 6023 | |
---|
5610 | 6024 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5646 | 6060 | // resetMasterNode(); |
---|
5647 | 6061 | } |
---|
5648 | 6062 | |
---|
5649 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 6063 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5650 | 6064 | { |
---|
5651 | 6065 | if (GetBRep() == null) |
---|
5652 | 6066 | { |
---|
.. | .. |
---|
5729 | 6143 | boolean flipV = false; // true; |
---|
5730 | 6144 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5731 | 6145 | |
---|
5732 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 6146 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5733 | 6147 | { |
---|
| 6148 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6149 | + return; |
---|
| 6150 | + |
---|
5734 | 6151 | if (hide) |
---|
5735 | 6152 | return; |
---|
5736 | 6153 | // shadow optimisation |
---|
.. | .. |
---|
5788 | 6205 | // // ??????????????????????????? Touch(); |
---|
5789 | 6206 | // } |
---|
5790 | 6207 | |
---|
5791 | | - if (material != null) |
---|
5792 | | - { |
---|
5793 | | - materialstack[materialdepth] = material; |
---|
5794 | | - selectedstack[materialdepth] = selected; |
---|
5795 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5796 | | - //System.out.println("material " + material); |
---|
5797 | | - //Applet3D.tracein("selected ", selected); |
---|
5798 | | - display.vector2buffer = projectedVertices; |
---|
5799 | | - material.Draw(display, selected); |
---|
5800 | | - } |
---|
| 6208 | +display.PushMaterial2(this, selected); |
---|
5801 | 6209 | |
---|
5802 | 6210 | Object3D child; |
---|
5803 | 6211 | boolean sel; |
---|
.. | .. |
---|
5849 | 6257 | */ |
---|
5850 | 6258 | //depth += 1; |
---|
5851 | 6259 | |
---|
5852 | | - if (material != null) |
---|
5853 | | - { |
---|
5854 | | - materialdepth -= 1; |
---|
5855 | | - if (materialdepth > 0) |
---|
5856 | | - { |
---|
5857 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5858 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5859 | | - } |
---|
5860 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5861 | | - //else |
---|
5862 | | - //material.Draw(display, false); |
---|
5863 | | - } |
---|
5864 | | - |
---|
| 6260 | +display.PopMaterial2(this); |
---|
5865 | 6261 | /* |
---|
5866 | 6262 | display.ReleaseTextures(tex); |
---|
5867 | 6263 | */ |
---|
.. | .. |
---|
5872 | 6268 | |
---|
5873 | 6269 | //static cVector min,max; |
---|
5874 | 6270 | |
---|
5875 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 6271 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5876 | 6272 | { |
---|
5877 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 6273 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5878 | 6274 | return; // no shadow for transparent objects |
---|
| 6275 | + |
---|
| 6276 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6277 | + return; |
---|
5879 | 6278 | |
---|
5880 | 6279 | if (hide) |
---|
5881 | 6280 | return; |
---|
.. | .. |
---|
5917 | 6316 | return; |
---|
5918 | 6317 | } |
---|
5919 | 6318 | |
---|
| 6319 | + //bRep.GenUV(1/material.diffuseness); |
---|
5920 | 6320 | // bRep.lock = true; |
---|
5921 | 6321 | |
---|
5922 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6322 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5923 | 6323 | |
---|
5924 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 6324 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5925 | 6325 | { |
---|
5926 | 6326 | int fc = bRep.FaceCount(); |
---|
5927 | 6327 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5936 | 6336 | |
---|
5937 | 6337 | bRep.getMinMax(min, max, 100); |
---|
5938 | 6338 | |
---|
5939 | | - gl.glBegin(gl.GL_LINES); |
---|
5940 | | - |
---|
5941 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5942 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5943 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5944 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5945 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5946 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5947 | | - |
---|
5948 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5949 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5950 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5951 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5952 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5953 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5954 | | - |
---|
5955 | | - gl.glEnd(); |
---|
| 6339 | + display.DrawBox(min, max); |
---|
5956 | 6340 | |
---|
5957 | 6341 | return; |
---|
5958 | 6342 | } |
---|
.. | .. |
---|
5996 | 6380 | { |
---|
5997 | 6381 | //throw new Error(); |
---|
5998 | 6382 | |
---|
5999 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6383 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
6000 | 6384 | |
---|
6001 | 6385 | int[] strips = bRep.getRawIndices(); |
---|
6002 | 6386 | |
---|
.. | .. |
---|
6006 | 6390 | new Exception().printStackTrace(); |
---|
6007 | 6391 | return; |
---|
6008 | 6392 | } |
---|
6009 | | - |
---|
6010 | | - // TRIANGLE STRIP ARRAY |
---|
6011 | | - if (bRep.trimmed) |
---|
| 6393 | + |
---|
| 6394 | + if (dontselect) |
---|
6012 | 6395 | { |
---|
6013 | | - float[] v = bRep.getRawVertices(); |
---|
6014 | | - float[] n = bRep.getRawNormals(); |
---|
6015 | | - float[] c = bRep.getRawColors(); |
---|
6016 | | - float[] uv = bRep.getRawUVMap(); |
---|
6017 | | - |
---|
6018 | | - int count2 = 0; |
---|
6019 | | - int count3 = 0; |
---|
6020 | | - |
---|
6021 | | - if (n.length > 0) |
---|
6022 | | - { |
---|
6023 | | - for (int i = 0; i < strips.length; i++) |
---|
6024 | | - { |
---|
6025 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6026 | | - |
---|
6027 | | - /* |
---|
6028 | | - boolean locked = false; |
---|
6029 | | - float eps = 0.1f; |
---|
6030 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6031 | | - |
---|
6032 | | - int dot = 0; |
---|
6033 | | - |
---|
6034 | | - if ((dot&1) == 0) |
---|
6035 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6036 | | - |
---|
6037 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6038 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6039 | | - else |
---|
6040 | | - { |
---|
6041 | | - locked = true; |
---|
6042 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6043 | | - } |
---|
6044 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6045 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6046 | | - if (hasnorm) |
---|
6047 | | - { |
---|
6048 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6049 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6050 | | - } |
---|
6051 | | - |
---|
6052 | | - if ((dot&4) == 0) |
---|
6053 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6054 | | - |
---|
6055 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6056 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6057 | | - else |
---|
6058 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6059 | | - |
---|
6060 | | - f.dot = dot; |
---|
6061 | | - */ |
---|
6062 | | - |
---|
6063 | | - if (!selectmode) |
---|
6064 | | - { |
---|
6065 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6066 | | - { |
---|
6067 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6068 | | - } else |
---|
6069 | | - { |
---|
6070 | | - gl.glNormal3f(0, 0, 1); |
---|
6071 | | - } |
---|
6072 | | - |
---|
6073 | | - if (c != null) |
---|
6074 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6075 | | - { |
---|
6076 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6077 | | - } |
---|
6078 | | - } |
---|
6079 | | - if (flipV) |
---|
6080 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6081 | | - else |
---|
6082 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6083 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6084 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6085 | | - |
---|
6086 | | - count2 += 2; |
---|
6087 | | - count3 += 3; |
---|
6088 | | - if (!selectmode) |
---|
6089 | | - { |
---|
6090 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6091 | | - { |
---|
6092 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6093 | | - } else |
---|
6094 | | - { |
---|
6095 | | - gl.glNormal3f(0, 0, 1); |
---|
6096 | | - } |
---|
6097 | | - if (c != null) |
---|
6098 | | - { |
---|
6099 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6100 | | - } |
---|
6101 | | - } |
---|
6102 | | - if (flipV) |
---|
6103 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6104 | | - else |
---|
6105 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6106 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6107 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6108 | | - |
---|
6109 | | - count2 += 2; |
---|
6110 | | - count3 += 3; |
---|
6111 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6112 | | - { |
---|
6113 | | - //gl.glTexCoord2d(...); |
---|
6114 | | - if (!selectmode) |
---|
6115 | | - { |
---|
6116 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6117 | | - { |
---|
6118 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6119 | | - } else |
---|
6120 | | - { |
---|
6121 | | - gl.glNormal3f(0, 0, 1); |
---|
6122 | | - } |
---|
6123 | | - if (c != null) |
---|
6124 | | - { |
---|
6125 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6126 | | - } |
---|
6127 | | - } |
---|
6128 | | - |
---|
6129 | | - if (flipV) |
---|
6130 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6131 | | - else |
---|
6132 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6133 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6134 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6135 | | - count2 += 2; |
---|
6136 | | - count3 += 3; |
---|
6137 | | - } |
---|
6138 | | - |
---|
6139 | | - gl.glEnd(); |
---|
6140 | | - } |
---|
6141 | | - } |
---|
6142 | | - |
---|
6143 | | - assert count3 == v.length; |
---|
| 6396 | + //bRep.GenerateNormalsMINE(); |
---|
6144 | 6397 | } |
---|
6145 | | - else // !trimmed |
---|
6146 | | - { |
---|
6147 | | - int count = 0; |
---|
6148 | | - for (int i = 0; i < strips.length; i++) |
---|
6149 | | - { |
---|
6150 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6151 | | - |
---|
6152 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6153 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6154 | | - |
---|
6155 | | - drawVertex(gl, p, selectmode); |
---|
6156 | | - drawVertex(gl, q, selectmode); |
---|
6157 | | - |
---|
6158 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6159 | | - { |
---|
6160 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6161 | | - |
---|
6162 | | -// if (j%2 == 0) |
---|
6163 | | -// drawFace(p, q, r, display, null); |
---|
6164 | | -// else |
---|
6165 | | -// drawFace(p, r, q, display, null); |
---|
6166 | | - |
---|
6167 | | -// p = q; |
---|
6168 | | -// q = r; |
---|
6169 | | - drawVertex(gl, r, selectmode); |
---|
6170 | | - } |
---|
6171 | | - |
---|
6172 | | - gl.glEnd(); |
---|
6173 | | - } |
---|
6174 | | - } |
---|
| 6398 | + |
---|
| 6399 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6175 | 6400 | } else // catch (Error e) |
---|
6176 | 6401 | { |
---|
6177 | 6402 | // TRIANGLE ARRAY |
---|
6178 | 6403 | if (IsOpaque()) // Static()) |
---|
6179 | 6404 | { |
---|
6180 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6405 | + display.StartTriangles(); |
---|
6181 | 6406 | int facecount = bRep.FaceCount(); |
---|
6182 | 6407 | for (int i = 0; i < facecount; i++) |
---|
6183 | 6408 | { |
---|
.. | .. |
---|
6240 | 6465 | // // r.norm.dot(v3) > -0.5) |
---|
6241 | 6466 | // // continue; |
---|
6242 | 6467 | |
---|
6243 | | - drawFace(p, q, r, display, face); |
---|
| 6468 | + display.DrawFace(this, p, q, r, face); |
---|
6244 | 6469 | } |
---|
6245 | | - gl.glEnd(); |
---|
| 6470 | + display.EndTriangles(); |
---|
6246 | 6471 | } |
---|
6247 | 6472 | else |
---|
6248 | 6473 | { |
---|
.. | .. |
---|
6271 | 6496 | //System.out.println("SORT"); |
---|
6272 | 6497 | |
---|
6273 | 6498 | java.util.Arrays.sort(facescompare); |
---|
6274 | | - |
---|
6275 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6499 | + |
---|
| 6500 | + display.StartTriangles(); |
---|
6276 | 6501 | for (int i = 0; i < facecount; i++) |
---|
6277 | 6502 | { |
---|
6278 | 6503 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6284 | 6509 | Vertex q = bRep.GetVertex(face.q); |
---|
6285 | 6510 | Vertex r = bRep.GetVertex(face.r); |
---|
6286 | 6511 | |
---|
6287 | | - drawFace(p, q, r, display, face); |
---|
| 6512 | + display.DrawFace(this, p, q, r, face); |
---|
6288 | 6513 | } |
---|
6289 | | - gl.glEnd(); |
---|
| 6514 | + display.EndTriangles(); |
---|
6290 | 6515 | } |
---|
6291 | 6516 | |
---|
6292 | 6517 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6293 | 6518 | { |
---|
| 6519 | + /* |
---|
6294 | 6520 | gl.glDisable(gl.GL_LIGHTING); |
---|
6295 | 6521 | float[] colorV = new float[3]; |
---|
6296 | 6522 | |
---|
.. | .. |
---|
6369 | 6595 | // gl.glEnd(); |
---|
6370 | 6596 | } |
---|
6371 | 6597 | } |
---|
| 6598 | + */ |
---|
6372 | 6599 | } |
---|
6373 | 6600 | } |
---|
6374 | 6601 | |
---|
.. | .. |
---|
6413 | 6640 | center.add(r); |
---|
6414 | 6641 | center.mul(1.0/3); |
---|
6415 | 6642 | |
---|
6416 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6643 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6417 | 6644 | |
---|
6418 | 6645 | distance = center.dot(center); |
---|
6419 | 6646 | } |
---|
.. | .. |
---|
6424 | 6651 | |
---|
6425 | 6652 | transient FaceCompare[] facescompare = null; |
---|
6426 | 6653 | |
---|
6427 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6428 | | - { |
---|
6429 | | - if (display.RENDERPROGRAM == 0) |
---|
6430 | | - { |
---|
6431 | | - float r = 0; |
---|
6432 | | - if (bRep != null) |
---|
6433 | | - { |
---|
6434 | | - if (bRep.stripified) |
---|
6435 | | - { |
---|
6436 | | - r = 1; |
---|
6437 | | - } |
---|
6438 | | - } |
---|
6439 | | - float g = 0; |
---|
6440 | | - if (bRep != null) |
---|
6441 | | - { |
---|
6442 | | - if (bRep.trimmed) |
---|
6443 | | - { |
---|
6444 | | - g = 1; |
---|
6445 | | - } |
---|
6446 | | - } |
---|
6447 | | - float b = 0; |
---|
6448 | | - if (support != null && link2master) |
---|
6449 | | - { |
---|
6450 | | - b = 1; |
---|
6451 | | - } |
---|
6452 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6453 | | - return; |
---|
6454 | | - } |
---|
6455 | | - |
---|
6456 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6457 | | - return; |
---|
6458 | | - |
---|
6459 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6460 | | -// if (true) return; |
---|
6461 | | -// float ao = p.AO; |
---|
6462 | | -// |
---|
6463 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6464 | | -// // ao = 1; |
---|
6465 | | -// |
---|
6466 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6467 | | - |
---|
6468 | | -// CameraPane.selectedpoint. |
---|
6469 | | -// getAverage(cStatic.point1, true); |
---|
6470 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6471 | | - { |
---|
6472 | | - return; |
---|
6473 | | - } |
---|
6474 | | - |
---|
6475 | | - cStatic.point1.set(0,0,0); |
---|
6476 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6477 | | - |
---|
6478 | | - cStatic.point1.sub(p0); |
---|
6479 | | - |
---|
6480 | | - |
---|
6481 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6482 | | -// { |
---|
6483 | | -// return; |
---|
6484 | | -// } |
---|
6485 | | - |
---|
6486 | | - //if (true) |
---|
6487 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6488 | | - { |
---|
6489 | | - return; |
---|
6490 | | - } |
---|
6491 | | - |
---|
6492 | | - float[] colorV = new float[3]; |
---|
6493 | | - |
---|
6494 | | - if (false) // marked) |
---|
6495 | | - { |
---|
6496 | | - // debug rigging weights |
---|
6497 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6498 | | - { |
---|
6499 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6500 | | - |
---|
6501 | | - // if (weight < 0.1) |
---|
6502 | | - // { |
---|
6503 | | - // assert(weight == 0); |
---|
6504 | | - // continue; |
---|
6505 | | - // } |
---|
6506 | | - |
---|
6507 | | - if (p0.vertexlinks[object] == -1) |
---|
6508 | | - continue; |
---|
6509 | | - |
---|
6510 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6511 | | - |
---|
6512 | | - int color = //1 << object; // |
---|
6513 | | - //p.vertexlinks.length; |
---|
6514 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6515 | | - colorV[2] += (color & 1) * weight; |
---|
6516 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6517 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6518 | | - } |
---|
6519 | | - } |
---|
6520 | | - else |
---|
6521 | | - { |
---|
6522 | | - if (drawingstarted) |
---|
6523 | | - { |
---|
6524 | | - // find next point |
---|
6525 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6526 | | - { |
---|
6527 | | - bRep.InitFaceIndices(); |
---|
6528 | | - } |
---|
6529 | | - |
---|
6530 | | - double ymin = p0.y; |
---|
6531 | | - |
---|
6532 | | - Vertex newp = p0; |
---|
6533 | | - |
---|
6534 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6535 | | - { |
---|
6536 | | - int fi = p0.faceindices[fii]; |
---|
6537 | | - |
---|
6538 | | - if (fi == -1) |
---|
6539 | | - break; |
---|
6540 | | - |
---|
6541 | | - Face f = bRep.GetFace(fi); |
---|
6542 | | - |
---|
6543 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6544 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6545 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6546 | | - |
---|
6547 | | - int swap = (int)(Math.random()*3); |
---|
6548 | | - |
---|
6549 | | -// for (int s=swap; --s>=0;) |
---|
6550 | | -// { |
---|
6551 | | -// Vertex t = p; |
---|
6552 | | -// p = q; |
---|
6553 | | -// q = r; |
---|
6554 | | -// r = t; |
---|
6555 | | -// } |
---|
6556 | | - if (ymin > p.y) |
---|
6557 | | - { |
---|
6558 | | - ymin = p.y; |
---|
6559 | | - newp = p; |
---|
6560 | | -// break; |
---|
6561 | | - } |
---|
6562 | | - if (ymin > q.y) |
---|
6563 | | - { |
---|
6564 | | - ymin = q.y; |
---|
6565 | | - newp = q; |
---|
6566 | | -// break; |
---|
6567 | | - } |
---|
6568 | | - if (ymin > r.y) |
---|
6569 | | - { |
---|
6570 | | - ymin = r.y; |
---|
6571 | | - newp = r; |
---|
6572 | | -// break; |
---|
6573 | | - } |
---|
6574 | | - } |
---|
6575 | | - |
---|
6576 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6577 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6578 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6579 | | - |
---|
6580 | | - drawingstarted = false; |
---|
6581 | | - |
---|
6582 | | - // return; |
---|
6583 | | - } |
---|
6584 | | - |
---|
6585 | | - if (false) // CameraPane.DRAW |
---|
6586 | | - { |
---|
6587 | | - p0.AO = colorV[0] = 2; |
---|
6588 | | - colorV[1] = 2; |
---|
6589 | | - colorV[2] = 2; |
---|
6590 | | - } |
---|
6591 | | - |
---|
6592 | | - CameraPane.pointflow.add(p0); |
---|
6593 | | - CameraPane.pointflow.Touch(); |
---|
6594 | | - } |
---|
6595 | | - |
---|
6596 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6597 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6598 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6599 | | - } |
---|
6600 | | - |
---|
6601 | 6654 | void Print(Vertex v) |
---|
6602 | 6655 | { |
---|
6603 | 6656 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6604 | 6657 | } |
---|
6605 | 6658 | |
---|
6606 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6607 | | - { |
---|
6608 | | - if (!selectmode) |
---|
6609 | | - { |
---|
6610 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6611 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6612 | | - |
---|
6613 | | - if (flipV) |
---|
6614 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6615 | | - else |
---|
6616 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6617 | | - } |
---|
6618 | | - |
---|
6619 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6620 | | - } |
---|
6621 | | - |
---|
6622 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6623 | | - CameraPane display, Face face) |
---|
6624 | | - { |
---|
6625 | | - if (pv.y == -10000 || |
---|
6626 | | - qv.y == -10000 || |
---|
6627 | | - rv.y == -10000) |
---|
6628 | | - return; |
---|
6629 | | - |
---|
6630 | | -// float b = f.nbiterations & 1; |
---|
6631 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6632 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6633 | | -// |
---|
6634 | | -// //if (f.weight == 10000) |
---|
6635 | | -// //{ |
---|
6636 | | -// // r = 1; g = b = 0; |
---|
6637 | | -// //} |
---|
6638 | | -// //else |
---|
6639 | | -// //{ |
---|
6640 | | -// // assert(f.weight < 10000); |
---|
6641 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6642 | | -// if (r<0) |
---|
6643 | | -// assert(r>=0); |
---|
6644 | | -// //} |
---|
6645 | | - |
---|
6646 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6647 | | - |
---|
6648 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6649 | | - |
---|
6650 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6651 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6652 | | - { |
---|
6653 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6654 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6655 | | - if (!hasnorm) |
---|
6656 | | - { |
---|
6657 | | - // System.out.println("FUCK!!"); |
---|
6658 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6659 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6660 | | - LA.vecCross(v0, v1, v2); |
---|
6661 | | - LA.vecNormalize(v2); |
---|
6662 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6663 | | - } |
---|
6664 | | - |
---|
6665 | | - if (hasnorm) |
---|
6666 | | - { |
---|
6667 | | -// if (!pv.norm.normalized()) |
---|
6668 | | -// assert(pv.norm.normalized()); |
---|
6669 | | - |
---|
6670 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6671 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6672 | | - } |
---|
6673 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6674 | | - SetColor(display, pv); |
---|
6675 | | - //gl.glColor4f(r, g, b, 1); |
---|
6676 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6677 | | - if (flipV) |
---|
6678 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6679 | | - else |
---|
6680 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6681 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6682 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6683 | | -// Print(pv); |
---|
6684 | | - if (hasnorm) |
---|
6685 | | - { |
---|
6686 | | -// assert(qv.norm.normalized()); |
---|
6687 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6688 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6689 | | - } |
---|
6690 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6691 | | - // boolean locked = false; |
---|
6692 | | - // float eps = 0.1f; |
---|
6693 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6694 | | - |
---|
6695 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6696 | | - |
---|
6697 | | - // if ((dot&1) == 0) |
---|
6698 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6699 | | - |
---|
6700 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6701 | | - if (flipV) |
---|
6702 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6703 | | - else |
---|
6704 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6705 | | - // else |
---|
6706 | | - // { |
---|
6707 | | - // locked = true; |
---|
6708 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6709 | | - // } |
---|
6710 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6711 | | - SetColor(display, qv); |
---|
6712 | | - //gl.glColor4f(r, g, b, 1); |
---|
6713 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6714 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6715 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6716 | | -// Print(qv); |
---|
6717 | | - if (hasnorm) |
---|
6718 | | - { |
---|
6719 | | -// assert(rv.norm.normalized()); |
---|
6720 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6721 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6722 | | - } |
---|
6723 | | - |
---|
6724 | | - // if ((dot&4) == 0) |
---|
6725 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6726 | | - |
---|
6727 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6728 | | - if (flipV) |
---|
6729 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6730 | | - else |
---|
6731 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6732 | | - // else |
---|
6733 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6734 | | - |
---|
6735 | | - // f.dot = dot; |
---|
6736 | | - |
---|
6737 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6738 | | - SetColor(display, rv); |
---|
6739 | | - //gl.glColor4f(r, g, b, 1); |
---|
6740 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6741 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6742 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6743 | | -// Print(rv); |
---|
6744 | | - //gl.glEnd(); |
---|
6745 | | - } |
---|
6746 | | - else |
---|
6747 | | - { |
---|
6748 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6749 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6750 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6751 | | - |
---|
6752 | | - } |
---|
6753 | | - |
---|
6754 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6755 | | - { |
---|
6756 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6757 | | - |
---|
6758 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6759 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6760 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6761 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6762 | | - gl.glEnd(); |
---|
6763 | | - |
---|
6764 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6765 | | - } |
---|
6766 | | - } |
---|
6767 | | - |
---|
6768 | 6659 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6769 | 6660 | { |
---|
6770 | 6661 | if (bRep == null) |
---|
.. | .. |
---|
7336 | 7227 | int spotw = spot.x + spot.width; |
---|
7337 | 7228 | int spoth = spot.y + spot.height; |
---|
7338 | 7229 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7339 | | - if (CameraPane.Xmin > spot.x) |
---|
7340 | | - { |
---|
7341 | | - CameraPane.Xmin = spot.x; |
---|
7342 | | - } |
---|
7343 | | - if (CameraPane.Xmax < spotw) |
---|
7344 | | - { |
---|
7345 | | - CameraPane.Xmax = spotw; |
---|
7346 | | - } |
---|
7347 | | - if (CameraPane.Ymin > spot.y) |
---|
7348 | | - { |
---|
7349 | | - CameraPane.Ymin = spot.y; |
---|
7350 | | - } |
---|
7351 | | - if (CameraPane.Ymax < spoth) |
---|
7352 | | - { |
---|
7353 | | - CameraPane.Ymax = spoth; |
---|
7354 | | - } |
---|
| 7230 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7231 | +// { |
---|
| 7232 | +// CameraPane.Xmin = spot.x; |
---|
| 7233 | +// } |
---|
| 7234 | +// if (CameraPane.Xmax < spotw) |
---|
| 7235 | +// { |
---|
| 7236 | +// CameraPane.Xmax = spotw; |
---|
| 7237 | +// } |
---|
| 7238 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7239 | +// { |
---|
| 7240 | +// CameraPane.Ymin = spot.y; |
---|
| 7241 | +// } |
---|
| 7242 | +// if (CameraPane.Ymax < spoth) |
---|
| 7243 | +// { |
---|
| 7244 | +// CameraPane.Ymax = spoth; |
---|
| 7245 | +// } |
---|
7355 | 7246 | spot.translate(32, 32); |
---|
7356 | 7247 | spotw = spot.x + spot.width; |
---|
7357 | 7248 | spoth = spot.y + spot.height; |
---|
7358 | | - info.g.setColor(Color.blue); |
---|
| 7249 | + info.g.setColor(Color.cyan); |
---|
7359 | 7250 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7360 | | - if (CameraPane.Xmin > spot.x) |
---|
7361 | | - { |
---|
7362 | | - CameraPane.Xmin = spot.x; |
---|
7363 | | - } |
---|
7364 | | - if (CameraPane.Xmax < spotw) |
---|
7365 | | - { |
---|
7366 | | - CameraPane.Xmax = spotw; |
---|
7367 | | - } |
---|
7368 | | - if (CameraPane.Ymin > spot.y) |
---|
7369 | | - { |
---|
7370 | | - CameraPane.Ymin = spot.y; |
---|
7371 | | - } |
---|
7372 | | - if (CameraPane.Ymax < spoth) |
---|
7373 | | - { |
---|
7374 | | - CameraPane.Ymax = spoth; |
---|
7375 | | - } |
---|
7376 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7377 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7251 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7252 | +// { |
---|
| 7253 | +// CameraPane.Xmin = spot.x; |
---|
| 7254 | +// } |
---|
| 7255 | +// if (CameraPane.Xmax < spotw) |
---|
| 7256 | +// { |
---|
| 7257 | +// CameraPane.Xmax = spotw; |
---|
| 7258 | +// } |
---|
| 7259 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7260 | +// { |
---|
| 7261 | +// CameraPane.Ymin = spot.y; |
---|
| 7262 | +// } |
---|
| 7263 | +// if (CameraPane.Ymax < spoth) |
---|
| 7264 | +// { |
---|
| 7265 | +// CameraPane.Ymax = spoth; |
---|
| 7266 | +// } |
---|
| 7267 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7268 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7378 | 7269 | spot.translate(0, -32); |
---|
7379 | | - info.g.setColor(Color.green); |
---|
| 7270 | + info.g.setColor(Color.yellow); |
---|
7380 | 7271 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7381 | | - if (CameraPane.Xmin > spot.x) |
---|
7382 | | - { |
---|
7383 | | - CameraPane.Xmin = spot.x; |
---|
7384 | | - } |
---|
7385 | | - if (CameraPane.Xmax < spotw) |
---|
7386 | | - { |
---|
7387 | | - CameraPane.Xmax = spotw; |
---|
7388 | | - } |
---|
7389 | | - if (CameraPane.Ymin > spot.y) |
---|
7390 | | - { |
---|
7391 | | - CameraPane.Ymin = spot.y; |
---|
7392 | | - } |
---|
7393 | | - if (CameraPane.Ymax < spoth) |
---|
7394 | | - { |
---|
7395 | | - CameraPane.Ymax = spoth; |
---|
7396 | | - } |
---|
| 7272 | + info.g.setColor(Color.green); |
---|
| 7273 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7274 | +// { |
---|
| 7275 | +// CameraPane.Xmin = spot.x; |
---|
| 7276 | +// } |
---|
| 7277 | +// if (CameraPane.Xmax < spotw) |
---|
| 7278 | +// { |
---|
| 7279 | +// CameraPane.Xmax = spotw; |
---|
| 7280 | +// } |
---|
| 7281 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7282 | +// { |
---|
| 7283 | +// CameraPane.Ymin = spot.y; |
---|
| 7284 | +// } |
---|
| 7285 | +// if (CameraPane.Ymax < spoth) |
---|
| 7286 | +// { |
---|
| 7287 | +// CameraPane.Ymax = spoth; |
---|
| 7288 | +// } |
---|
7397 | 7289 | info.g.drawArc(boundary.x, boundary.y, |
---|
7398 | 7290 | boundary.width, boundary.height, 0, 360); |
---|
7399 | 7291 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7400 | | - if (CameraPane.Xmin > boundary.x) |
---|
7401 | | - { |
---|
7402 | | - CameraPane.Xmin = boundary.x; |
---|
7403 | | - } |
---|
7404 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7405 | | - { |
---|
7406 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7407 | | - } |
---|
7408 | | - if (CameraPane.Ymin > boundary.y) |
---|
7409 | | - { |
---|
7410 | | - CameraPane.Ymin = boundary.y; |
---|
7411 | | - } |
---|
7412 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7413 | | - { |
---|
7414 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7415 | | - } |
---|
| 7292 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 7293 | +// { |
---|
| 7294 | +// CameraPane.Xmin = boundary.x; |
---|
| 7295 | +// } |
---|
| 7296 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 7297 | +// { |
---|
| 7298 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 7299 | +// } |
---|
| 7300 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 7301 | +// { |
---|
| 7302 | +// CameraPane.Ymin = boundary.y; |
---|
| 7303 | +// } |
---|
| 7304 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 7305 | +// { |
---|
| 7306 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 7307 | +// } |
---|
7416 | 7308 | return; |
---|
7417 | 7309 | } |
---|
7418 | 7310 | } |
---|
.. | .. |
---|
7429 | 7321 | startX = info.x; |
---|
7430 | 7322 | startY = info.y; |
---|
7431 | 7323 | |
---|
7432 | | - hitSomething = 0; |
---|
| 7324 | + hitSomething = -1; |
---|
7433 | 7325 | cVector origin = new cVector(); |
---|
7434 | 7326 | //LA.xformPos(origin, toParent, origin); |
---|
7435 | 7327 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7462 | 7354 | } |
---|
7463 | 7355 | |
---|
7464 | 7356 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7465 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7357 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7466 | 7358 | //System.out.println("modified = " + modified); |
---|
7467 | 7359 | //new Exception().printStackTrace(); |
---|
7468 | 7360 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7490 | 7382 | return true; |
---|
7491 | 7383 | } |
---|
7492 | 7384 | |
---|
7493 | | - void doEditDrag0(ClickInfo info) |
---|
| 7385 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7494 | 7386 | { |
---|
7495 | 7387 | if (hitSomething == 0) |
---|
7496 | 7388 | { |
---|
.. | .. |
---|
7505 | 7397 | //System.out.println("hitSomething = " + hitSomething); |
---|
7506 | 7398 | |
---|
7507 | 7399 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7400 | + |
---|
7508 | 7401 | cVector xlate = new cVector(); |
---|
7509 | 7402 | //cVector xlate2 = new cVector(); |
---|
7510 | 7403 | switch (hitSomething) |
---|
.. | .. |
---|
7515 | 7408 | |
---|
7516 | 7409 | case hitCenter: // Translate |
---|
7517 | 7410 | |
---|
7518 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7411 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7519 | 7412 | |
---|
7520 | | - if (modified) |
---|
| 7413 | + if (modified || opposite) |
---|
7521 | 7414 | { |
---|
7522 | 7415 | //assert(false); |
---|
7523 | 7416 | /* |
---|
.. | .. |
---|
7563 | 7456 | } |
---|
7564 | 7457 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7565 | 7458 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7566 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7459 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7567 | 7460 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7568 | 7461 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7569 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7462 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7570 | 7463 | //LA.vecCross(up, cVector.Z, right2); |
---|
7571 | 7464 | |
---|
7572 | 7465 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7611 | 7504 | |
---|
7612 | 7505 | if (modified) |
---|
7613 | 7506 | { |
---|
| 7507 | + // Rotate 90 degrees |
---|
7614 | 7508 | angle /= (Math.PI / 4); |
---|
7615 | 7509 | angle = Math.floor(angle + 0.5); |
---|
7616 | 7510 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7624 | 7518 | } |
---|
7625 | 7519 | /**/ |
---|
7626 | 7520 | |
---|
7627 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7521 | + switch (info.pane.RenderCamera().viewCode) |
---|
7628 | 7522 | { |
---|
7629 | 7523 | case 1: // '\001' |
---|
7630 | 7524 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7652 | 7546 | |
---|
7653 | 7547 | case hitScale: // scale |
---|
7654 | 7548 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7549 | + double sign = 1; |
---|
| 7550 | + if (hScale < 0) |
---|
| 7551 | + { |
---|
| 7552 | + sign = -1; |
---|
| 7553 | + } |
---|
| 7554 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7655 | 7555 | if (hScale < 0.01) |
---|
7656 | 7556 | { |
---|
7657 | | - hScale = 0.01; |
---|
| 7557 | + //hScale = 0.01; |
---|
7658 | 7558 | } |
---|
7659 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7660 | | - if (hScale < 0.01) |
---|
7661 | | - { |
---|
7662 | | - hScale = 0.01; |
---|
7663 | | - } |
---|
| 7559 | + |
---|
7664 | 7560 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7665 | | - if (vScale < 0.01) |
---|
| 7561 | + sign = 1; |
---|
| 7562 | + if (vScale < 0) |
---|
7666 | 7563 | { |
---|
7667 | | - vScale = 0.01; |
---|
| 7564 | + sign = -1; |
---|
7668 | 7565 | } |
---|
7669 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7566 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7670 | 7567 | if (vScale < 0.01) |
---|
7671 | 7568 | { |
---|
7672 | | - vScale = 0.01; |
---|
| 7569 | + //vScale = 0.01; |
---|
7673 | 7570 | } |
---|
7674 | 7571 | LA.matCopy(startMat, toParent); |
---|
7675 | 7572 | /**/ |
---|
.. | .. |
---|
7680 | 7577 | } |
---|
7681 | 7578 | /**/ |
---|
7682 | 7579 | |
---|
7683 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7580 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7581 | + |
---|
| 7582 | + if (totalScale < 0.01) |
---|
| 7583 | + { |
---|
| 7584 | + totalScale = 0.01; |
---|
| 7585 | + } |
---|
| 7586 | + |
---|
| 7587 | + switch (info.pane.RenderCamera().viewCode) |
---|
7684 | 7588 | { |
---|
7685 | 7589 | case 3: // '\001' |
---|
7686 | | - if (modified) |
---|
| 7590 | + if (modified || opposite) |
---|
7687 | 7591 | { |
---|
7688 | 7592 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7689 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7593 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7690 | 7594 | } // vScale, 1); |
---|
7691 | 7595 | else |
---|
7692 | 7596 | { |
---|
7693 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7597 | + // EXCEPTION! |
---|
| 7598 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7694 | 7599 | } // vScale, 1); |
---|
7695 | 7600 | break; |
---|
7696 | 7601 | |
---|
7697 | 7602 | case 2: // '\002' |
---|
7698 | | - if (modified) |
---|
| 7603 | + if (modified || opposite) |
---|
7699 | 7604 | { |
---|
7700 | 7605 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7701 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7606 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7702 | 7607 | } else |
---|
7703 | 7608 | { |
---|
7704 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7609 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7705 | 7610 | } |
---|
7706 | 7611 | break; |
---|
7707 | 7612 | |
---|
7708 | 7613 | case 1: // '\003' |
---|
7709 | | - if (modified) |
---|
| 7614 | + if (modified || opposite) |
---|
7710 | 7615 | { |
---|
7711 | 7616 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7712 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7617 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7713 | 7618 | } else |
---|
7714 | 7619 | { |
---|
7715 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7620 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7716 | 7621 | } |
---|
7717 | 7622 | break; |
---|
7718 | 7623 | } |
---|
.. | .. |
---|
7733 | 7638 | if (parent == null) |
---|
7734 | 7639 | { |
---|
7735 | 7640 | System.out.println("NULL PARENT"); |
---|
7736 | | - new Exception().printStackTrace(); |
---|
| 7641 | + //new Exception().printStackTrace(); |
---|
7737 | 7642 | } else |
---|
7738 | 7643 | { |
---|
7739 | 7644 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7845 | 7750 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7846 | 7751 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7847 | 7752 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7753 | + |
---|
| 7754 | + String objname; |
---|
| 7755 | + |
---|
7848 | 7756 | if (false) //parent != null) |
---|
7849 | 7757 | { |
---|
7850 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7758 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7851 | 7759 | } else |
---|
7852 | 7760 | { |
---|
7853 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7761 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7854 | 7762 | } // + super.toString(); |
---|
7855 | 7763 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7764 | + |
---|
| 7765 | + if (!Globals.ADVANCED) |
---|
| 7766 | + return objname; |
---|
| 7767 | + |
---|
| 7768 | + return objname + " " + System.identityHashCode(this); |
---|
7856 | 7769 | } |
---|
7857 | 7770 | |
---|
7858 | 7771 | public int hashCode() |
---|
.. | .. |
---|
7908 | 7821 | objectUI.closeUI(); |
---|
7909 | 7822 | if (editWindow != null) |
---|
7910 | 7823 | { |
---|
| 7824 | + editWindow.ctrlPanel.FlushUI(); |
---|
7911 | 7825 | editWindow.refreshContents(); |
---|
7912 | 7826 | } // ? new |
---|
7913 | 7827 | objectUI = null; |
---|
.. | .. |
---|
7916 | 7830 | { |
---|
7917 | 7831 | editWindow = null; |
---|
7918 | 7832 | } // ? |
---|
| 7833 | + } |
---|
| 7834 | + else |
---|
| 7835 | + { |
---|
| 7836 | + //editWindow.closeUI(); |
---|
7919 | 7837 | } |
---|
7920 | 7838 | } |
---|
7921 | 7839 | |
---|
.. | .. |
---|
7928 | 7846 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7929 | 7847 | |
---|
7930 | 7848 | Object3D /*Composite*/ parent; |
---|
7931 | | - Object3D /*Composite*/ fileparent; |
---|
| 7849 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7932 | 7850 | |
---|
7933 | 7851 | double[][] toParent; // dynamic matrix |
---|
7934 | 7852 | double[][] fromParent; |
---|
.. | .. |
---|
8043 | 7961 | { |
---|
8044 | 7962 | assert(bRep != null); |
---|
8045 | 7963 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
8046 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7964 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
8047 | 7965 | } |
---|
8048 | 7966 | else |
---|
8049 | 7967 | { |
---|
.. | .. |
---|
8074 | 7992 | } |
---|
8075 | 7993 | |
---|
8076 | 7994 | transient ObjEditor editWindow; |
---|
| 7995 | + transient ObjEditor manipWindow; |
---|
| 7996 | + |
---|
| 7997 | + transient boolean pinned; |
---|
| 7998 | + |
---|
8077 | 7999 | transient ObjectUI objectUI; |
---|
8078 | 8000 | public static int povDepth = 0; |
---|
8079 | 8001 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
8092 | 8014 | private static cVector edge2 = new cVector(); |
---|
8093 | 8015 | //private static cVector norm = new cVector(); |
---|
8094 | 8016 | /*transient private*/ int hitSomething; |
---|
8095 | | - private static final int hitCenter = 1; |
---|
8096 | | - private static final int hitScale = 2; |
---|
8097 | | - private static final int hitRotate = 3; |
---|
| 8017 | + static final int hitCenter = 1; |
---|
| 8018 | + static final int hitScale = 2; |
---|
| 8019 | + static final int hitRotate = 3; |
---|
8098 | 8020 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
8099 | 8021 | /*transient*/ private Point centerPt; |
---|
8100 | 8022 | /*transient*/ private int startX; |
---|
.. | .. |
---|
8126 | 8048 | { |
---|
8127 | 8049 | Object3D targ = this; |
---|
8128 | 8050 | |
---|
| 8051 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 8052 | + |
---|
8129 | 8053 | if (obj.material != null) |
---|
8130 | 8054 | { |
---|
8131 | 8055 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|