.. | .. |
---|
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(); |
---|
109 | | - } |
---|
110 | | - |
---|
111 | | - for (int i = 0; i < Size(); i++) |
---|
112 | | - { |
---|
113 | | - Object3D child = (Object3D) get(i); |
---|
114 | | - if (child == null) |
---|
115 | | - continue; |
---|
116 | | - blockloop = true; |
---|
117 | | - child.SaveSupports(); |
---|
118 | | - blockloop = false; |
---|
119 | | - } |
---|
120 | | -} |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
121 | 122 | |
---|
122 | | -void RestoreSupports() |
---|
123 | | -{ |
---|
124 | | - if (blockloop) |
---|
125 | | - return; |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
126 | 125 | |
---|
127 | | - support = transientsupport; |
---|
128 | | - link2master = transientlink2master; |
---|
129 | | - transientsupport = null; |
---|
130 | | - transientlink2master = false; |
---|
131 | | - |
---|
132 | | - if (bRep != null) |
---|
133 | | - { |
---|
134 | | - bRep.RestoreSupports(); |
---|
| 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 | + } |
---|
135 | 143 | } |
---|
136 | | - |
---|
137 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
138 | 146 | { |
---|
139 | | - Object3D child = (Object3D) get(i); |
---|
140 | | - if (child == null) |
---|
141 | | - continue; |
---|
142 | | - blockloop = true; |
---|
143 | | - child.RestoreSupports(); |
---|
144 | | - blockloop = false; |
---|
| 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 | + } |
---|
145 | 169 | } |
---|
146 | | -} |
---|
| 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(); |
---|
| 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 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 223 | + |
---|
| 224 | + RestoreBigData(o); |
---|
| 225 | + |
---|
| 226 | + hashtable.remove(GetUUID()); |
---|
| 227 | + |
---|
| 228 | + for (int i=0; i<Size(); i++) |
---|
| 229 | + { |
---|
| 230 | + get(i).RestoreBigData(hashtable); |
---|
| 231 | + } |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + void RestoreBigData(Object3D o) |
---|
| 235 | + { |
---|
| 236 | + this.bRep = o.bRep; |
---|
| 237 | + if (this.bRep != null) |
---|
| 238 | + this.bRep.support = o.transientrep; |
---|
| 239 | + // this.support = o.support; |
---|
| 240 | + // this.fileparent = o.fileparent; |
---|
| 241 | + } |
---|
147 | 242 | |
---|
148 | 243 | // MOCAP SUPPORT |
---|
149 | 244 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
286 | 381 | } |
---|
287 | 382 | |
---|
288 | 383 | boolean live = false; |
---|
| 384 | + boolean dontselect = false; |
---|
289 | 385 | boolean hide = false; |
---|
290 | 386 | boolean link2master = false; // performs reset support/master at each frame |
---|
291 | 387 | boolean marked = false; // animation node |
---|
.. | .. |
---|
295 | 391 | boolean random = false; |
---|
296 | 392 | boolean speedup = false; |
---|
297 | 393 | boolean rewind = false; |
---|
| 394 | + |
---|
| 395 | + float NORMALPUSH = 0; |
---|
298 | 396 | |
---|
299 | 397 | Object3D support; |
---|
300 | 398 | |
---|
.. | .. |
---|
355 | 453 | |
---|
356 | 454 | int MemorySize() |
---|
357 | 455 | { |
---|
358 | | - if (memorysize == 0) |
---|
| 456 | + if (true) // memorysize == 0) |
---|
359 | 457 | { |
---|
360 | 458 | try |
---|
361 | 459 | { |
---|
.. | .. |
---|
415 | 513 | { |
---|
416 | 514 | Object3D copy = this; |
---|
417 | 515 | |
---|
418 | | - Camera parentcam = CameraPane.theRenderer.manipCamera; |
---|
| 516 | + Camera parentcam = Globals.theRenderer.ManipCamera(); |
---|
419 | 517 | |
---|
420 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0]) |
---|
| 518 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0]) |
---|
421 | 519 | { |
---|
422 | | - parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 520 | + parentcam = Globals.theRenderer.Cameras()[1]; |
---|
423 | 521 | } |
---|
424 | 522 | |
---|
425 | | - if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1]) |
---|
| 523 | + if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1]) |
---|
426 | 524 | { |
---|
427 | | - parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 525 | + parentcam = Globals.theRenderer.Cameras()[0]; |
---|
428 | 526 | } |
---|
429 | 527 | |
---|
430 | 528 | if (this == parentcam) |
---|
.. | .. |
---|
432 | 530 | //assert(this instanceof Camera); |
---|
433 | 531 | |
---|
434 | 532 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
435 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt); |
---|
| 533 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt()); |
---|
436 | 534 | } |
---|
437 | 535 | |
---|
438 | 536 | copy.marked ^= true; |
---|
.. | .. |
---|
452 | 550 | //assert(this instanceof Camera); |
---|
453 | 551 | |
---|
454 | 552 | for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
455 | | - LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt); |
---|
| 553 | + LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt()); |
---|
456 | 554 | } |
---|
457 | 555 | |
---|
458 | 556 | copy.Touch(); // display list issue |
---|
.. | .. |
---|
465 | 563 | toParent = LA.newMatrix(); |
---|
466 | 564 | fromParent = LA.newMatrix(); |
---|
467 | 565 | } |
---|
| 566 | + |
---|
468 | 567 | if (toParentMarked == null) |
---|
469 | 568 | { |
---|
470 | 569 | if (maxcount != 1) |
---|
471 | 570 | { |
---|
472 | 571 | new Exception().printStackTrace(); |
---|
473 | 572 | } |
---|
| 573 | + |
---|
474 | 574 | toParentMarked = LA.newMatrix(); |
---|
475 | 575 | fromParentMarked = LA.newMatrix(); |
---|
476 | 576 | } |
---|
.. | .. |
---|
587 | 687 | return; |
---|
588 | 688 | } |
---|
589 | 689 | |
---|
590 | | - if (CameraPane.fromscript) |
---|
| 690 | + if (Globals.fromscript) |
---|
591 | 691 | { |
---|
592 | 692 | transformcount = 0; |
---|
593 | 693 | return; |
---|
.. | .. |
---|
745 | 845 | |
---|
746 | 846 | int GetTransformCount() |
---|
747 | 847 | { |
---|
748 | | - // marde pour serialization de Texture |
---|
| 848 | + // patch pour serialization de Texture |
---|
749 | 849 | resetmaxcount(); |
---|
750 | 850 | resettransformcount(); |
---|
751 | 851 | resetstep(); |
---|
.. | .. |
---|
758 | 858 | if (step == 0) |
---|
759 | 859 | step = 1; |
---|
760 | 860 | if (maxcount == 0) |
---|
761 | | - maxcount = 2048; // 4; |
---|
| 861 | + maxcount = 128; // 2048; // 4; |
---|
762 | 862 | // if (acceleration == 0) |
---|
763 | 863 | // acceleration = 10; |
---|
764 | 864 | if (delay == 0) // serial |
---|
.. | .. |
---|
779 | 879 | // factor = CameraPane.STEP; |
---|
780 | 880 | // } |
---|
781 | 881 | |
---|
782 | | - if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount) |
---|
| 882 | + if (marked && Globals.isLIVE() && live && |
---|
| 883 | + //TEMP21aug2018 |
---|
| 884 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 885 | + currentframe != Globals.framecount) |
---|
783 | 886 | { |
---|
784 | | - currentframe = CameraPane.framecount; |
---|
| 887 | + currentframe = Globals.framecount; |
---|
785 | 888 | |
---|
786 | 889 | // System.err.println("transformcount = " + transformcount); |
---|
787 | 890 | // System.err.println("factor = " + factor); |
---|
.. | .. |
---|
893 | 996 | fromParent = null; // LA.newMatrix(); |
---|
894 | 997 | bRep = null; // new BoundaryRep(); |
---|
895 | 998 | |
---|
| 999 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1000 | + { |
---|
| 1001 | + name = oname; |
---|
| 1002 | + } |
---|
| 1003 | + |
---|
896 | 1004 | /* |
---|
897 | 1005 | float hue = (float)Math.random(); |
---|
898 | 1006 | Color col; |
---|
.. | .. |
---|
935 | 1043 | |
---|
936 | 1044 | public Object clone() |
---|
937 | 1045 | { |
---|
938 | | - return GraphreeD.clone(this); |
---|
| 1046 | + return Grafreed.clone(this); |
---|
939 | 1047 | } |
---|
940 | 1048 | |
---|
941 | 1049 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1554 | // if (other == null) |
---|
1447 | 1555 | // return; |
---|
1448 | 1556 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1557 | + if (other != null) |
---|
| 1558 | + { |
---|
| 1559 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1560 | + |
---|
| 1561 | + // Set default to 0.1 |
---|
| 1562 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
| 1563 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1564 | + } |
---|
| 1565 | + |
---|
| 1566 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1567 | |
---|
1451 | 1568 | //if (bRep != null) |
---|
1452 | 1569 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1818 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1819 | o.bRep = transientrep; |
---|
1703 | 1820 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1821 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1705 | 1822 | o.CreateMaterial(); |
---|
1706 | 1823 | o.SetAttributes(this, -1); |
---|
1707 | 1824 | //parent |
---|
.. | .. |
---|
1714 | 1831 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1832 | o.bRep = bRep; |
---|
1716 | 1833 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1834 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1718 | 1835 | o.CreateMaterial(); |
---|
1719 | 1836 | //o.overwriteThis(this, -1); |
---|
1720 | 1837 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1756 | 1873 | // { |
---|
1757 | 1874 | // assert(bRep == null); |
---|
1758 | 1875 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1759 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1876 | +// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
1760 | 1877 | // o.CreateMaterial(); |
---|
1761 | 1878 | // parent.addChild(o); |
---|
1762 | 1879 | // } |
---|
.. | .. |
---|
1765 | 1882 | // { |
---|
1766 | 1883 | // assert(transientrep == null); |
---|
1767 | 1884 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1768 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1885 | +// o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
1769 | 1886 | // o.CreateMaterial(); |
---|
1770 | 1887 | // parent.addChild(o); |
---|
1771 | 1888 | // } |
---|
.. | .. |
---|
1801 | 1918 | if (obj.name == null) |
---|
1802 | 1919 | continue; // can't be a null one |
---|
1803 | 1920 | |
---|
| 1921 | + // Try perfect match first. |
---|
1804 | 1922 | if (n.equals(obj.name)) |
---|
1805 | 1923 | { |
---|
1806 | 1924 | theobj = obj; |
---|
1807 | 1925 | count++; |
---|
1808 | 1926 | } |
---|
1809 | 1927 | } |
---|
| 1928 | + |
---|
| 1929 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1810 | 1930 | |
---|
1811 | 1931 | if (count != 1) |
---|
1812 | 1932 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
1816 | 1936 | if (obj.name == null) |
---|
1817 | 1937 | continue; // can't be a null one |
---|
1818 | 1938 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1939 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1940 | + //if (n.startsWith(obj.name)) |
---|
| 1941 | + if (n.contains(name)) |
---|
1821 | 1942 | { |
---|
1822 | 1943 | theobj = obj; |
---|
1823 | 1944 | count++; |
---|
.. | .. |
---|
2120 | 2241 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2242 | { |
---|
2122 | 2243 | 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 |
---|
| 2244 | + |
---|
| 2245 | + InitOthers(); |
---|
2132 | 2246 | |
---|
2133 | 2247 | if (this instanceof Camera) |
---|
2134 | 2248 | { |
---|
.. | .. |
---|
2278 | 2392 | { |
---|
2279 | 2393 | if (newWindow) |
---|
2280 | 2394 | { |
---|
| 2395 | + new Exception().printStackTrace(); |
---|
2281 | 2396 | System.exit(0); |
---|
2282 | 2397 | if (parent != null) |
---|
2283 | 2398 | { |
---|
.. | .. |
---|
2454 | 2569 | return retval; |
---|
2455 | 2570 | } |
---|
2456 | 2571 | |
---|
2457 | | - void doEditDrag(ClickInfo info) |
---|
| 2572 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2458 | 2573 | { |
---|
2459 | 2574 | switch (doSomething) |
---|
2460 | 2575 | { |
---|
2461 | 2576 | case 1: // '\001' |
---|
2462 | 2577 | //super. |
---|
2463 | | - doEditDrag0(info); |
---|
| 2578 | + doEditDrag0(info, opposite); |
---|
2464 | 2579 | break; |
---|
2465 | 2580 | |
---|
2466 | 2581 | case 2: // '\002' |
---|
.. | .. |
---|
2473 | 2588 | { |
---|
2474 | 2589 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2475 | 2590 | //childToDrag.doEditDrag(info); |
---|
2476 | | - sel.doEditDrag(info); |
---|
| 2591 | + sel.doEditDrag(info, opposite); |
---|
2477 | 2592 | } else |
---|
2478 | 2593 | { |
---|
2479 | 2594 | //super. |
---|
2480 | | - doEditDrag0(info); |
---|
| 2595 | + doEditDrag0(info, opposite); |
---|
2481 | 2596 | } |
---|
2482 | 2597 | } |
---|
2483 | 2598 | break; |
---|
.. | .. |
---|
2587 | 2702 | void GenNormalsS(boolean crease) |
---|
2588 | 2703 | { |
---|
2589 | 2704 | selection.GenNormals(crease); |
---|
| 2705 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2706 | +// { |
---|
| 2707 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2708 | +// selectee.GenNormals(crease); |
---|
| 2709 | +// } |
---|
| 2710 | + |
---|
| 2711 | + //Touch(); |
---|
| 2712 | + } |
---|
| 2713 | + |
---|
| 2714 | + void GenNormalsMeshS() |
---|
| 2715 | + { |
---|
| 2716 | + selection.GenNormalsMesh(); |
---|
2590 | 2717 | // for (int i=0; i<selection.size(); i++) |
---|
2591 | 2718 | // { |
---|
2592 | 2719 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2732 | 2859 | blockloop = false; |
---|
2733 | 2860 | } |
---|
2734 | 2861 | |
---|
| 2862 | + void GenNormalsMesh() |
---|
| 2863 | + { |
---|
| 2864 | + if (blockloop) |
---|
| 2865 | + return; |
---|
| 2866 | + |
---|
| 2867 | + blockloop = true; |
---|
| 2868 | + GenNormalsMesh0(); |
---|
| 2869 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2870 | + { |
---|
| 2871 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2872 | + if (child == null) |
---|
| 2873 | + continue; |
---|
| 2874 | + child.GenNormalsMesh(); |
---|
| 2875 | +// Children().release(i); |
---|
| 2876 | + } |
---|
| 2877 | + blockloop = false; |
---|
| 2878 | + } |
---|
| 2879 | + |
---|
| 2880 | + void GenNormalsMINE() |
---|
| 2881 | + { |
---|
| 2882 | + if (blockloop) |
---|
| 2883 | + return; |
---|
| 2884 | + |
---|
| 2885 | + blockloop = true; |
---|
| 2886 | + GenNormalsMINE0(); |
---|
| 2887 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2888 | + { |
---|
| 2889 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2890 | + if (child == null) |
---|
| 2891 | + continue; |
---|
| 2892 | + child.GenNormalsMINE(); |
---|
| 2893 | +// Children().release(i); |
---|
| 2894 | + } |
---|
| 2895 | + blockloop = false; |
---|
| 2896 | + } |
---|
| 2897 | + |
---|
2735 | 2898 | void ClearColors() |
---|
2736 | 2899 | { |
---|
2737 | 2900 | if (blockloop) |
---|
.. | .. |
---|
2866 | 3029 | { |
---|
2867 | 3030 | if (bRep != null) |
---|
2868 | 3031 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 3032 | + bRep.GenUV(); //1); |
---|
| 3033 | + //bRep.UnfoldUV(); |
---|
2870 | 3034 | Touch(); |
---|
2871 | 3035 | } |
---|
2872 | 3036 | } |
---|
.. | .. |
---|
2876 | 3040 | if (bRep != null) |
---|
2877 | 3041 | { |
---|
2878 | 3042 | bRep.GenerateNormals(crease); |
---|
| 3043 | + Touch(); |
---|
| 3044 | + } |
---|
| 3045 | + } |
---|
| 3046 | + |
---|
| 3047 | + void GenNormalsMesh0() |
---|
| 3048 | + { |
---|
| 3049 | + if (bRep != null) |
---|
| 3050 | + { |
---|
| 3051 | + bRep.GenerateNormalsMesh(); |
---|
| 3052 | + Touch(); |
---|
| 3053 | + } |
---|
| 3054 | + } |
---|
| 3055 | + |
---|
| 3056 | + void GenNormalsMINE0() |
---|
| 3057 | + { |
---|
| 3058 | + if (bRep != null) |
---|
| 3059 | + { |
---|
| 3060 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 3061 | Touch(); |
---|
2880 | 3062 | } |
---|
2881 | 3063 | } |
---|
.. | .. |
---|
2932 | 3114 | blockloop = false; |
---|
2933 | 3115 | } |
---|
2934 | 3116 | |
---|
| 3117 | + void TransformChildren() |
---|
| 3118 | + { |
---|
| 3119 | + if (toParent != null) |
---|
| 3120 | + { |
---|
| 3121 | + for (int i=Size(); --i>=0;) |
---|
| 3122 | + { |
---|
| 3123 | + Object3D v = get(i); |
---|
| 3124 | + |
---|
| 3125 | + if (v.toParent == null) |
---|
| 3126 | + { |
---|
| 3127 | + v.toParent = LA.newMatrix(); |
---|
| 3128 | + v.fromParent = LA.newMatrix(); |
---|
| 3129 | + } |
---|
| 3130 | + |
---|
| 3131 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3132 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3133 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3134 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3135 | + } |
---|
| 3136 | + |
---|
| 3137 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3138 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3139 | + |
---|
| 3140 | + Touch(); |
---|
| 3141 | + } |
---|
| 3142 | + } |
---|
| 3143 | + |
---|
2935 | 3144 | void TransformGeometry() |
---|
2936 | 3145 | { |
---|
2937 | 3146 | Object3D obj = this; |
---|
.. | .. |
---|
3153 | 3362 | |
---|
3154 | 3363 | BoundaryRep sup = bRep.support; |
---|
3155 | 3364 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 3365 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3157 | 3366 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3367 | + |
---|
| 3368 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3369 | + |
---|
3159 | 3370 | bRep = temprep; |
---|
3160 | 3371 | bRep.support = sup; |
---|
3161 | 3372 | Touch(); |
---|
.. | .. |
---|
3677 | 3888 | if (child == null) |
---|
3678 | 3889 | continue; |
---|
3679 | 3890 | |
---|
3680 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3891 | + if (Grafreed.RENDERME > 0) |
---|
3681 | 3892 | { |
---|
3682 | 3893 | if (child instanceof Merge) |
---|
3683 | 3894 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3717 | 3928 | |
---|
3718 | 3929 | boolean getCentroid(cVector centroid, boolean xform) |
---|
3719 | 3930 | { |
---|
3720 | | - assert(false); |
---|
| 3931 | +// for speaker assert(false); |
---|
3721 | 3932 | if (blockloop) |
---|
3722 | 3933 | return false; |
---|
3723 | 3934 | |
---|
.. | .. |
---|
3828 | 4039 | if (child == null) |
---|
3829 | 4040 | continue; |
---|
3830 | 4041 | |
---|
3831 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4042 | + if (Grafreed.RENDERME > 0) |
---|
3832 | 4043 | { |
---|
3833 | 4044 | if (child instanceof Merge) |
---|
3834 | 4045 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4234 | if (child == null) |
---|
4024 | 4235 | continue; |
---|
4025 | 4236 | |
---|
4026 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4237 | + if (Grafreed.RENDERME > 0) |
---|
4027 | 4238 | { |
---|
4028 | 4239 | if (child instanceof Merge) |
---|
4029 | 4240 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4322 | if (blockloop) |
---|
4112 | 4323 | return; |
---|
4113 | 4324 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4325 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4326 | { |
---|
4116 | 4327 | if (get(i).parent != this) |
---|
4117 | 4328 | { |
---|
.. | .. |
---|
4120 | 4331 | } |
---|
4121 | 4332 | blockloop = true; |
---|
4122 | 4333 | get(i).RepairParent(); |
---|
| 4334 | + blockloop = false; |
---|
| 4335 | + } |
---|
| 4336 | + } |
---|
| 4337 | + |
---|
| 4338 | + void RepairShadow() |
---|
| 4339 | + { |
---|
| 4340 | + if (blockloop) |
---|
| 4341 | + return; |
---|
| 4342 | + |
---|
| 4343 | + if (this.material != null) |
---|
| 4344 | + this.InitOthers(); |
---|
| 4345 | + |
---|
| 4346 | + for (int i=0; i<Size(); i++) |
---|
| 4347 | + { |
---|
| 4348 | + blockloop = true; |
---|
| 4349 | + get(i).RepairShadow(); |
---|
| 4350 | + blockloop = false; |
---|
| 4351 | + } |
---|
| 4352 | + } |
---|
| 4353 | + |
---|
| 4354 | + void RepairSOV() |
---|
| 4355 | + { |
---|
| 4356 | + if (blockloop) |
---|
| 4357 | + return; |
---|
| 4358 | + |
---|
| 4359 | + String texname = this.GetPigmentTexture(); |
---|
| 4360 | + |
---|
| 4361 | + if (texname.startsWith("sov")) |
---|
| 4362 | + { |
---|
| 4363 | + String[] s = texname.split("/"); |
---|
| 4364 | + |
---|
| 4365 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4366 | + |
---|
| 4367 | + texname = sname[0]; |
---|
| 4368 | + |
---|
| 4369 | + if (sname.length > 1) |
---|
| 4370 | + { |
---|
| 4371 | + texname += "Color.jpg"; |
---|
| 4372 | + } |
---|
| 4373 | + |
---|
| 4374 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4375 | + } |
---|
| 4376 | + |
---|
| 4377 | + texname = this.GetBumpTexture(); |
---|
| 4378 | + |
---|
| 4379 | + if (texname.startsWith("sov")) |
---|
| 4380 | + { |
---|
| 4381 | + String[] s = texname.split("/"); |
---|
| 4382 | + |
---|
| 4383 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4384 | + |
---|
| 4385 | + texname = sname[0]; |
---|
| 4386 | + |
---|
| 4387 | + if (sname.length > 1) |
---|
| 4388 | + { |
---|
| 4389 | + texname += "Bump.jpg"; |
---|
| 4390 | + } |
---|
| 4391 | + |
---|
| 4392 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4393 | + } |
---|
| 4394 | + |
---|
| 4395 | + for (int i=0; i<Size(); i++) |
---|
| 4396 | + { |
---|
| 4397 | + blockloop = true; |
---|
| 4398 | + get(i).RepairSOV(); |
---|
4123 | 4399 | blockloop = false; |
---|
4124 | 4400 | } |
---|
4125 | 4401 | } |
---|
.. | .. |
---|
4515 | 4791 | |
---|
4516 | 4792 | Object3D GetFileRoot() |
---|
4517 | 4793 | { |
---|
| 4794 | + if (overflow) |
---|
| 4795 | + return null; |
---|
| 4796 | + |
---|
| 4797 | + overflow = true; |
---|
| 4798 | + |
---|
| 4799 | + Object3D pfr = null; |
---|
| 4800 | + |
---|
4518 | 4801 | if (parent == null && fileparent == null) |
---|
4519 | | - return this; |
---|
| 4802 | + pfr = this; |
---|
4520 | 4803 | |
---|
4521 | 4804 | if (parent == null && fileparent != null) // V4.gfd??? |
---|
4522 | | - return fileparent; |
---|
| 4805 | + pfr = fileparent; |
---|
4523 | 4806 | |
---|
4524 | | - if (parent == null) |
---|
4525 | | - return this; |
---|
| 4807 | + if (pfr == null && parent == null) |
---|
| 4808 | + pfr = this; |
---|
4526 | 4809 | |
---|
4527 | | - return parent.GetFileRoot(); |
---|
| 4810 | + if (pfr == null) |
---|
| 4811 | + pfr = parent.GetFileRoot(); |
---|
| 4812 | + |
---|
| 4813 | + overflow = false; |
---|
| 4814 | + |
---|
| 4815 | + return pfr; |
---|
4528 | 4816 | } |
---|
4529 | 4817 | |
---|
4530 | 4818 | cTreePath GetPath() |
---|
.. | .. |
---|
4602 | 4890 | |
---|
4603 | 4891 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4604 | 4892 | { |
---|
4605 | | - if (hide) |
---|
| 4893 | + if (hide || dontselect) |
---|
4606 | 4894 | return null; |
---|
4607 | 4895 | |
---|
4608 | 4896 | if (count <= 0) |
---|
.. | .. |
---|
4628 | 4916 | |
---|
4629 | 4917 | cTreePath Select(int indexcount, boolean deselect) |
---|
4630 | 4918 | { |
---|
4631 | | - if (hide) |
---|
| 4919 | + if (hide || dontselect) |
---|
4632 | 4920 | return null; |
---|
4633 | 4921 | |
---|
4634 | 4922 | if (count <= 0) |
---|
.. | .. |
---|
4778 | 5066 | return globalTransform; |
---|
4779 | 5067 | } |
---|
4780 | 5068 | |
---|
4781 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 5069 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4782 | 5070 | { |
---|
4783 | 5071 | /* |
---|
4784 | 5072 | if (AOdone) |
---|
.. | .. |
---|
4925 | 5213 | } else // |
---|
4926 | 5214 | if (editWindow != null) |
---|
4927 | 5215 | { |
---|
4928 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5216 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5217 | + Globals.lighttouched = true; |
---|
4929 | 5218 | } |
---|
4930 | 5219 | } |
---|
4931 | 5220 | |
---|
.. | .. |
---|
5079 | 5368 | |
---|
5080 | 5369 | // System.out.println("Fullname = " + fullname); |
---|
5081 | 5370 | |
---|
5082 | | - if (fullname.name.indexOf(":") == -1) |
---|
5083 | | - return fullname.name; |
---|
| 5371 | + // Does not work on Windows due to C: |
---|
| 5372 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5373 | +// return fullname.name; |
---|
| 5374 | +// |
---|
| 5375 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5084 | 5376 | |
---|
5085 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5377 | + String[] split = fullname.name.split(":"); |
---|
| 5378 | + |
---|
| 5379 | + if (split.length == 0) |
---|
| 5380 | + { |
---|
| 5381 | + return ""; |
---|
| 5382 | + } |
---|
| 5383 | + |
---|
| 5384 | + if (split.length <= 2) |
---|
| 5385 | + { |
---|
| 5386 | + if (fullname.name.endsWith(":")) |
---|
| 5387 | + { |
---|
| 5388 | + // Windows |
---|
| 5389 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5390 | + } |
---|
| 5391 | + |
---|
| 5392 | + return split[0]; |
---|
| 5393 | + } |
---|
| 5394 | + |
---|
| 5395 | + // Windows |
---|
| 5396 | + assert(split.length == 4); |
---|
| 5397 | + |
---|
| 5398 | + return split[0] + ":" + split[1]; |
---|
5086 | 5399 | } |
---|
5087 | 5400 | |
---|
5088 | 5401 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5091 | 5404 | return ""; |
---|
5092 | 5405 | |
---|
5093 | 5406 | // System.out.println("Fullname = " + fullname); |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return ""; |
---|
5096 | | - |
---|
5097 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5407 | + // Does not work on Windows due to C: |
---|
| 5408 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5409 | +// return ""; |
---|
| 5410 | +// |
---|
| 5411 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5412 | + String[] split = fullname.name.split(":"); |
---|
| 5413 | + |
---|
| 5414 | + if (split.length == 0) |
---|
| 5415 | + { |
---|
| 5416 | + return ""; |
---|
| 5417 | + } |
---|
| 5418 | + |
---|
| 5419 | + if (split.length == 1) |
---|
| 5420 | + { |
---|
| 5421 | + return ""; |
---|
| 5422 | + } |
---|
| 5423 | + |
---|
| 5424 | + if (split.length == 2) |
---|
| 5425 | + { |
---|
| 5426 | + if (fullname.name.endsWith(":")) |
---|
| 5427 | + { |
---|
| 5428 | + // Windows |
---|
| 5429 | + return ""; |
---|
| 5430 | + } |
---|
| 5431 | + |
---|
| 5432 | + return split[1]; |
---|
| 5433 | + } |
---|
| 5434 | + |
---|
| 5435 | + // Windows |
---|
| 5436 | + assert(split.length == 4); |
---|
| 5437 | + |
---|
| 5438 | + return split[2] + ":" + split[3]; |
---|
5098 | 5439 | } |
---|
5099 | 5440 | |
---|
5100 | 5441 | String GetPigmentTexture() |
---|
.. | .. |
---|
5168 | 5509 | System.out.print("; textures = " + textures); |
---|
5169 | 5510 | System.out.println("; usedtextures = " + usedtextures); |
---|
5170 | 5511 | |
---|
5171 | | - if (GetTextures() == null) |
---|
| 5512 | + if (GetTextures() == null) // What is that?? |
---|
5172 | 5513 | GetTextures().name = ":"; |
---|
5173 | 5514 | |
---|
5174 | 5515 | String texname = tex; |
---|
.. | .. |
---|
5199 | 5540 | child.ResetPigmentTexture(); |
---|
5200 | 5541 | blockloop = false; |
---|
5201 | 5542 | } |
---|
| 5543 | + } |
---|
| 5544 | + |
---|
| 5545 | + UUID GetUUID() |
---|
| 5546 | + { |
---|
| 5547 | + if (uuid == null) |
---|
| 5548 | + { |
---|
| 5549 | + // Serial |
---|
| 5550 | + uuid = UUID.randomUUID(); |
---|
| 5551 | + } |
---|
| 5552 | + |
---|
| 5553 | + return uuid; |
---|
| 5554 | + } |
---|
| 5555 | + |
---|
| 5556 | + Object3D GetObject(UUID uid) |
---|
| 5557 | + { |
---|
| 5558 | + if (blockloop) |
---|
| 5559 | + return null; |
---|
| 5560 | + |
---|
| 5561 | + if (GetUUID().equals(uid)) |
---|
| 5562 | + return this; |
---|
| 5563 | + |
---|
| 5564 | + int nb = Size(); |
---|
| 5565 | + for (int i = 0; i < nb; i++) |
---|
| 5566 | + { |
---|
| 5567 | + Object3D child = (Object3D) get(i); |
---|
| 5568 | + |
---|
| 5569 | + if (child == null) |
---|
| 5570 | + continue; |
---|
| 5571 | + |
---|
| 5572 | + blockloop = true; |
---|
| 5573 | + Object3D obj = child.GetObject(uid); |
---|
| 5574 | + blockloop = false; |
---|
| 5575 | + if (obj != null) |
---|
| 5576 | + return obj; |
---|
| 5577 | + } |
---|
| 5578 | + |
---|
| 5579 | + return null; |
---|
5202 | 5580 | } |
---|
5203 | 5581 | |
---|
5204 | 5582 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5237 | 5615 | } |
---|
5238 | 5616 | } |
---|
5239 | 5617 | |
---|
5240 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5618 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5241 | 5619 | { |
---|
5242 | 5620 | Draw(display, root, selected, blocked); |
---|
5243 | 5621 | } |
---|
5244 | 5622 | |
---|
5245 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5246 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5247 | | - static int materialdepth = 0; |
---|
5248 | | - |
---|
5249 | 5623 | boolean NeedSupport() |
---|
5250 | 5624 | { |
---|
5251 | 5625 | return |
---|
5252 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5626 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5253 | 5627 | // PROBLEM with CROWD!! |
---|
5254 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5628 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5255 | 5629 | } |
---|
5256 | 5630 | |
---|
| 5631 | + static boolean DEBUG_SELECTION = false; |
---|
5257 | 5632 | |
---|
5258 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5633 | + boolean IsLive() |
---|
| 5634 | + { |
---|
| 5635 | + if (live) |
---|
| 5636 | + return true; |
---|
| 5637 | + |
---|
| 5638 | + if (parent == null) |
---|
| 5639 | + return false; |
---|
| 5640 | + |
---|
| 5641 | + return parent.IsLive(); |
---|
| 5642 | + } |
---|
| 5643 | + |
---|
| 5644 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5259 | 5645 | { |
---|
5260 | 5646 | Invariants(); // june 2013 |
---|
5261 | 5647 | |
---|
.. | .. |
---|
5264 | 5650 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5265 | 5651 | } |
---|
5266 | 5652 | |
---|
5267 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
5268 | | - hide) |
---|
| 5653 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
| 5654 | + (hide || dontselect)) |
---|
5269 | 5655 | return; |
---|
5270 | 5656 | |
---|
5271 | 5657 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5280 | 5666 | if (name != null && name.contains("sclera")) |
---|
5281 | 5667 | name = name; |
---|
5282 | 5668 | |
---|
5283 | | - if (this instanceof CheckerIG) |
---|
| 5669 | + if (this instanceof Checker) |
---|
5284 | 5670 | return; |
---|
5285 | 5671 | |
---|
5286 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5672 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5287 | 5673 | return; |
---|
5288 | 5674 | |
---|
5289 | 5675 | if (count <= 0) |
---|
.. | .. |
---|
5291 | 5677 | return; |
---|
5292 | 5678 | } |
---|
5293 | 5679 | |
---|
5294 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5295 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5680 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5681 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5296 | 5682 | { |
---|
5297 | 5683 | return; |
---|
5298 | 5684 | } |
---|
5299 | 5685 | |
---|
5300 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5686 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5301 | 5687 | |
---|
5302 | 5688 | /* |
---|
5303 | 5689 | if (touched) |
---|
.. | .. |
---|
5316 | 5702 | support = support; |
---|
5317 | 5703 | |
---|
5318 | 5704 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5319 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5705 | + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5320 | 5706 | |
---|
5321 | 5707 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5322 | 5708 | { |
---|
.. | .. |
---|
5333 | 5719 | |
---|
5334 | 5720 | boolean compiled = false; |
---|
5335 | 5721 | |
---|
5336 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5722 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5337 | 5723 | |
---|
5338 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
5339 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5724 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
| 5725 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5726 | + (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5340 | 5727 | { |
---|
5341 | | - display.lighttouched = true; |
---|
| 5728 | + Globals.lighttouched = true; |
---|
5342 | 5729 | } // all panes... |
---|
5343 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5344 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5730 | + |
---|
| 5731 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5732 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5345 | 5733 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5346 | 5734 | { |
---|
5347 | 5735 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5349 | 5737 | //if (displaylist == -1 && usecalllists) |
---|
5350 | 5738 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5351 | 5739 | { |
---|
5352 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5740 | + bRep.displaylist = display.GenList(); |
---|
5353 | 5741 | assert(bRep.displaylist != 0); |
---|
5354 | 5742 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5355 | 5743 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5361 | 5749 | if (usecalllists) |
---|
5362 | 5750 | { |
---|
5363 | 5751 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5364 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5752 | + display.NewList(bRep.displaylist); |
---|
5365 | 5753 | } |
---|
| 5754 | + |
---|
5366 | 5755 | CallList(display, root, selected, blocked); |
---|
| 5756 | + |
---|
5367 | 5757 | // compiled = true; |
---|
5368 | 5758 | if (usecalllists) |
---|
5369 | 5759 | { |
---|
5370 | 5760 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5371 | | - gl.glEndList(); |
---|
| 5761 | + display.EndList(); |
---|
5372 | 5762 | } |
---|
5373 | 5763 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5374 | 5764 | // XXX touched = false; |
---|
5375 | | - display.lighttouched = true; // all panes... |
---|
| 5765 | + Globals.lighttouched = true; // all panes... |
---|
5376 | 5766 | } |
---|
5377 | 5767 | |
---|
5378 | 5768 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5411 | 5801 | |
---|
5412 | 5802 | // frustum culling |
---|
5413 | 5803 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5414 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5804 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5415 | 5805 | { |
---|
5416 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5806 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5417 | 5807 | { |
---|
5418 | 5808 | if (!link2master // tricky to cull in shadow mode. |
---|
5419 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5809 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5420 | 5810 | { |
---|
5421 | 5811 | //System.out.print("CULLED"); |
---|
5422 | 5812 | culled = true; |
---|
.. | .. |
---|
5424 | 5814 | } |
---|
5425 | 5815 | else |
---|
5426 | 5816 | //GetBRep().getBounds(v0, v1, this); |
---|
5427 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5817 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5428 | 5818 | culled = true; |
---|
5429 | 5819 | |
---|
5430 | 5820 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5460 | 5850 | |
---|
5461 | 5851 | |
---|
5462 | 5852 | if (!culled) |
---|
5463 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5853 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5464 | 5854 | { |
---|
5465 | 5855 | if (GetBRep() != null) |
---|
5466 | 5856 | { |
---|
5467 | | - CameraPane.NextIndex(this, gl); |
---|
| 5857 | + display.NextIndex(); |
---|
5468 | 5858 | // vertex color conflict : gl.glCallList(list); |
---|
5469 | 5859 | DrawNode(display, root, selected); |
---|
5470 | 5860 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5486 | 5876 | color[2] /= 2; |
---|
5487 | 5877 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5488 | 5878 | */ |
---|
5489 | | - if (material != null) |
---|
5490 | | - { |
---|
5491 | | - materialstack[materialdepth] = material; |
---|
5492 | | - selectedstack[materialdepth] = selected; |
---|
5493 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5494 | | - //System.out.println("material " + material); |
---|
5495 | | - //Applet3D.tracein(this, selected); |
---|
5496 | | - display.vector2buffer = projectedVertices; |
---|
5497 | | - if (this instanceof Camera) |
---|
5498 | | - { |
---|
5499 | | - display.options1[0] = material.shift; |
---|
5500 | | - //System.out.println("shift " + material.shift); |
---|
5501 | | - display.options1[1] = material.lightarea; |
---|
5502 | | - display.options1[2] = material.shadowbias; |
---|
5503 | | - display.options1[3] = material.aniso; |
---|
5504 | | - display.options1[4] = material.anisoV; |
---|
5505 | | - display.options2[0] = material.opacity; |
---|
5506 | | - display.options2[1] = material.diffuse; |
---|
5507 | | - display.options2[2] = material.factor; |
---|
5508 | | - |
---|
5509 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5510 | | - display.options3[3] = material.cameralight/0.2f; |
---|
5511 | | - |
---|
5512 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5513 | | - // display.options3[3] /= 4; |
---|
5514 | | - |
---|
5515 | | - /* |
---|
5516 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5517 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5518 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5519 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5520 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5521 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5522 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5523 | | - /**/ |
---|
5524 | | - } else |
---|
5525 | | - { |
---|
5526 | | - material.Draw(display, selected); |
---|
5527 | | - } |
---|
5528 | | - } else |
---|
5529 | | - { |
---|
5530 | | - if (selected && CameraPane.flash) |
---|
5531 | | - { |
---|
5532 | | - display.modelParams4[1] = 100; |
---|
5533 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5534 | | - } |
---|
5535 | | - } |
---|
| 5879 | + display.PushMaterial(this, selected); |
---|
5536 | 5880 | |
---|
5537 | 5881 | //System.out.println("call list " + list); |
---|
5538 | 5882 | //System.out.println(); |
---|
.. | .. |
---|
5551 | 5895 | tex = GetTextures(); |
---|
5552 | 5896 | } |
---|
5553 | 5897 | |
---|
5554 | | - display.BindTextures(tex, texres); |
---|
| 5898 | + boolean failedPigment = false; |
---|
| 5899 | + boolean failedBump = false; |
---|
| 5900 | + |
---|
| 5901 | + try |
---|
| 5902 | + { |
---|
| 5903 | + display.BindPigmentTexture(tex, texres); |
---|
| 5904 | + } |
---|
| 5905 | + catch (Exception e) |
---|
| 5906 | + { |
---|
| 5907 | + System.err.println("FAILED: " + this); |
---|
| 5908 | + failedPigment = true; |
---|
| 5909 | + } |
---|
| 5910 | + |
---|
| 5911 | + try |
---|
| 5912 | + { |
---|
| 5913 | + display.BindBumpTexture(tex, texres); |
---|
| 5914 | + } |
---|
| 5915 | + catch (Exception e) |
---|
| 5916 | + { |
---|
| 5917 | + //System.err.println("FAILED: " + this); |
---|
| 5918 | + failedBump = true; |
---|
| 5919 | + } |
---|
5555 | 5920 | |
---|
5556 | 5921 | if (!compiled) |
---|
5557 | 5922 | { |
---|
.. | .. |
---|
5567 | 5932 | |
---|
5568 | 5933 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5569 | 5934 | assert(bRep.displaylist != 0); |
---|
5570 | | - gl.glCallList(bRep.displaylist); |
---|
| 5935 | + display.CallList(bRep.displaylist); |
---|
5571 | 5936 | // june 2013 drawSelf(display, root, selected); |
---|
5572 | 5937 | } |
---|
5573 | 5938 | } |
---|
5574 | 5939 | } |
---|
5575 | 5940 | |
---|
5576 | | - display.ReleaseTextures(tex); |
---|
5577 | | - |
---|
5578 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5579 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5580 | | - if (material != null) |
---|
5581 | | - { |
---|
5582 | | - materialdepth -= 1; |
---|
5583 | | - if (materialdepth > 0) |
---|
5584 | | - { |
---|
5585 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5586 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5587 | | - } |
---|
5588 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5589 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5590 | | - { |
---|
5591 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5592 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5593 | | - } |
---|
| 5941 | + if (!failedBump) |
---|
| 5942 | + display.ReleaseBumpTexture(tex); |
---|
| 5943 | + |
---|
| 5944 | + if (!failedPigment) |
---|
| 5945 | + display.ReleasePigmentTexture(tex); |
---|
| 5946 | + |
---|
| 5947 | + display.PopMaterial(this, selected); |
---|
5594 | 5948 | } |
---|
5595 | 5949 | |
---|
5596 | 5950 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5632 | 5986 | // resetMasterNode(); |
---|
5633 | 5987 | } |
---|
5634 | 5988 | |
---|
5635 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5989 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5636 | 5990 | { |
---|
5637 | 5991 | if (GetBRep() == null) |
---|
5638 | 5992 | { |
---|
.. | .. |
---|
5715 | 6069 | boolean flipV = false; // true; |
---|
5716 | 6070 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5717 | 6071 | |
---|
5718 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 6072 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5719 | 6073 | { |
---|
| 6074 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6075 | + return; |
---|
| 6076 | + |
---|
5720 | 6077 | if (hide) |
---|
5721 | 6078 | return; |
---|
5722 | 6079 | // shadow optimisation |
---|
.. | .. |
---|
5774 | 6131 | // // ??????????????????????????? Touch(); |
---|
5775 | 6132 | // } |
---|
5776 | 6133 | |
---|
5777 | | - if (material != null) |
---|
5778 | | - { |
---|
5779 | | - materialstack[materialdepth] = material; |
---|
5780 | | - selectedstack[materialdepth] = selected; |
---|
5781 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5782 | | - //System.out.println("material " + material); |
---|
5783 | | - //Applet3D.tracein("selected ", selected); |
---|
5784 | | - display.vector2buffer = projectedVertices; |
---|
5785 | | - material.Draw(display, selected); |
---|
5786 | | - } |
---|
| 6134 | +display.PushMaterial2(this, selected); |
---|
5787 | 6135 | |
---|
5788 | 6136 | Object3D child; |
---|
5789 | 6137 | boolean sel; |
---|
.. | .. |
---|
5807 | 6155 | if (!child.HasTransparency()) |
---|
5808 | 6156 | { |
---|
5809 | 6157 | sel = root != null && root.selection != null && root.selection.indexOf(child) != -1; |
---|
5810 | | - // GraphreeD.tracein("draw ", child); |
---|
| 6158 | + // GrafreeD.tracein("draw ", child); |
---|
5811 | 6159 | boolean wasblocked = blockdraw; |
---|
5812 | 6160 | blockdraw = true; |
---|
5813 | 6161 | child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected()); |
---|
5814 | 6162 | blockdraw = false; |
---|
5815 | | - // GraphreeD.traceout("draw ", child); |
---|
| 6163 | + // GrafreeD.traceout("draw ", child); |
---|
5816 | 6164 | } |
---|
5817 | 6165 | |
---|
5818 | 6166 | release(i); |
---|
.. | .. |
---|
5835 | 6183 | */ |
---|
5836 | 6184 | //depth += 1; |
---|
5837 | 6185 | |
---|
5838 | | - if (material != null) |
---|
5839 | | - { |
---|
5840 | | - materialdepth -= 1; |
---|
5841 | | - if (materialdepth > 0) |
---|
5842 | | - { |
---|
5843 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5844 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5845 | | - } |
---|
5846 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5847 | | - //else |
---|
5848 | | - //material.Draw(display, false); |
---|
5849 | | - } |
---|
5850 | | - |
---|
| 6186 | +display.PopMaterial2(this); |
---|
5851 | 6187 | /* |
---|
5852 | 6188 | display.ReleaseTextures(tex); |
---|
5853 | 6189 | */ |
---|
.. | .. |
---|
5858 | 6194 | |
---|
5859 | 6195 | //static cVector min,max; |
---|
5860 | 6196 | |
---|
5861 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 6197 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5862 | 6198 | { |
---|
5863 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 6199 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5864 | 6200 | return; // no shadow for transparent objects |
---|
| 6201 | + |
---|
| 6202 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6203 | + return; |
---|
5865 | 6204 | |
---|
5866 | 6205 | if (hide) |
---|
5867 | 6206 | return; |
---|
.. | .. |
---|
5903 | 6242 | return; |
---|
5904 | 6243 | } |
---|
5905 | 6244 | |
---|
| 6245 | + //bRep.GenUV(1/material.diffuseness); |
---|
5906 | 6246 | // bRep.lock = true; |
---|
5907 | 6247 | |
---|
5908 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6248 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5909 | 6249 | |
---|
5910 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 6250 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5911 | 6251 | { |
---|
5912 | 6252 | int fc = bRep.FaceCount(); |
---|
5913 | 6253 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5922 | 6262 | |
---|
5923 | 6263 | bRep.getMinMax(min, max, 100); |
---|
5924 | 6264 | |
---|
5925 | | - gl.glBegin(gl.GL_LINES); |
---|
5926 | | - |
---|
5927 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5928 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5929 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5930 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5931 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5932 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5933 | | - |
---|
5934 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5935 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5936 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5937 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5938 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5939 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5940 | | - |
---|
5941 | | - gl.glEnd(); |
---|
| 6265 | + display.DrawBox(min, max); |
---|
5942 | 6266 | |
---|
5943 | 6267 | return; |
---|
5944 | 6268 | } |
---|
.. | .. |
---|
5982 | 6306 | { |
---|
5983 | 6307 | //throw new Error(); |
---|
5984 | 6308 | |
---|
5985 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6309 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5986 | 6310 | |
---|
5987 | 6311 | int[] strips = bRep.getRawIndices(); |
---|
5988 | 6312 | |
---|
.. | .. |
---|
5992 | 6316 | new Exception().printStackTrace(); |
---|
5993 | 6317 | return; |
---|
5994 | 6318 | } |
---|
5995 | | - |
---|
5996 | | - // TRIANGLE STRIP ARRAY |
---|
5997 | | - if (bRep.trimmed) |
---|
5998 | | - { |
---|
5999 | | - float[] v = bRep.getRawVertices(); |
---|
6000 | | - float[] n = bRep.getRawNormals(); |
---|
6001 | | - float[] c = bRep.getRawColors(); |
---|
6002 | | - float[] uv = bRep.getRawUVMap(); |
---|
6003 | | - |
---|
6004 | | - int count2 = 0; |
---|
6005 | | - int count3 = 0; |
---|
6006 | | - |
---|
6007 | | - if (n.length > 0) |
---|
6008 | | - { |
---|
6009 | | - for (int i = 0; i < strips.length; i++) |
---|
6010 | | - { |
---|
6011 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6012 | | - |
---|
6013 | | - /* |
---|
6014 | | - boolean locked = false; |
---|
6015 | | - float eps = 0.1f; |
---|
6016 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6017 | | - |
---|
6018 | | - int dot = 0; |
---|
6019 | | - |
---|
6020 | | - if ((dot&1) == 0) |
---|
6021 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6022 | | - |
---|
6023 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6024 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6025 | | - else |
---|
6026 | | - { |
---|
6027 | | - locked = true; |
---|
6028 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6029 | | - } |
---|
6030 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6031 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6032 | | - if (hasnorm) |
---|
6033 | | - { |
---|
6034 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6035 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6036 | | - } |
---|
6037 | | - |
---|
6038 | | - if ((dot&4) == 0) |
---|
6039 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6040 | | - |
---|
6041 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6042 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6043 | | - else |
---|
6044 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6045 | | - |
---|
6046 | | - f.dot = dot; |
---|
6047 | | - */ |
---|
6048 | | - |
---|
6049 | | - if (!selectmode) |
---|
6050 | | - { |
---|
6051 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6052 | | - { |
---|
6053 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6054 | | - } else |
---|
6055 | | - { |
---|
6056 | | - gl.glNormal3f(0, 0, 1); |
---|
6057 | | - } |
---|
6058 | | - |
---|
6059 | | - if (c != null) |
---|
6060 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6061 | | - { |
---|
6062 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6063 | | - } |
---|
6064 | | - } |
---|
6065 | | - if (flipV) |
---|
6066 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6067 | | - else |
---|
6068 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6069 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6070 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6071 | | - |
---|
6072 | | - count2 += 2; |
---|
6073 | | - count3 += 3; |
---|
6074 | | - if (!selectmode) |
---|
6075 | | - { |
---|
6076 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6077 | | - { |
---|
6078 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6079 | | - } else |
---|
6080 | | - { |
---|
6081 | | - gl.glNormal3f(0, 0, 1); |
---|
6082 | | - } |
---|
6083 | | - if (c != null) |
---|
6084 | | - { |
---|
6085 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6086 | | - } |
---|
6087 | | - } |
---|
6088 | | - if (flipV) |
---|
6089 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6090 | | - else |
---|
6091 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6092 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6093 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6094 | | - |
---|
6095 | | - count2 += 2; |
---|
6096 | | - count3 += 3; |
---|
6097 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6098 | | - { |
---|
6099 | | - //gl.glTexCoord2d(...); |
---|
6100 | | - if (!selectmode) |
---|
6101 | | - { |
---|
6102 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6103 | | - { |
---|
6104 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6105 | | - } else |
---|
6106 | | - { |
---|
6107 | | - gl.glNormal3f(0, 0, 1); |
---|
6108 | | - } |
---|
6109 | | - if (c != null) |
---|
6110 | | - { |
---|
6111 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6112 | | - } |
---|
6113 | | - } |
---|
6114 | | - |
---|
6115 | | - if (flipV) |
---|
6116 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6117 | | - else |
---|
6118 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6119 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6120 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6121 | | - count2 += 2; |
---|
6122 | | - count3 += 3; |
---|
6123 | | - } |
---|
6124 | | - |
---|
6125 | | - gl.glEnd(); |
---|
6126 | | - } |
---|
6127 | | - } |
---|
6128 | | - |
---|
6129 | | - assert count3 == v.length; |
---|
6130 | | - } |
---|
6131 | | - else // !trimmed |
---|
6132 | | - { |
---|
6133 | | - int count = 0; |
---|
6134 | | - for (int i = 0; i < strips.length; i++) |
---|
6135 | | - { |
---|
6136 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6137 | | - |
---|
6138 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6139 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6140 | | - |
---|
6141 | | - drawVertex(gl, p, selectmode); |
---|
6142 | | - drawVertex(gl, q, selectmode); |
---|
6143 | | - |
---|
6144 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6145 | | - { |
---|
6146 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6147 | | - |
---|
6148 | | -// if (j%2 == 0) |
---|
6149 | | -// drawFace(p, q, r, display, null); |
---|
6150 | | -// else |
---|
6151 | | -// drawFace(p, r, q, display, null); |
---|
6152 | | - |
---|
6153 | | -// p = q; |
---|
6154 | | -// q = r; |
---|
6155 | | - drawVertex(gl, r, selectmode); |
---|
6156 | | - } |
---|
6157 | | - |
---|
6158 | | - gl.glEnd(); |
---|
6159 | | - } |
---|
6160 | | - } |
---|
| 6319 | + |
---|
| 6320 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6161 | 6321 | } else // catch (Error e) |
---|
6162 | 6322 | { |
---|
6163 | 6323 | // TRIANGLE ARRAY |
---|
6164 | 6324 | if (IsOpaque()) // Static()) |
---|
6165 | 6325 | { |
---|
6166 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6326 | + display.StartTriangles(); |
---|
6167 | 6327 | int facecount = bRep.FaceCount(); |
---|
6168 | 6328 | for (int i = 0; i < facecount; i++) |
---|
6169 | 6329 | { |
---|
.. | .. |
---|
6226 | 6386 | // // r.norm.dot(v3) > -0.5) |
---|
6227 | 6387 | // // continue; |
---|
6228 | 6388 | |
---|
6229 | | - drawFace(p, q, r, display, face); |
---|
| 6389 | + display.DrawFace(this, p, q, r, face); |
---|
6230 | 6390 | } |
---|
6231 | | - gl.glEnd(); |
---|
| 6391 | + display.EndTriangles(); |
---|
6232 | 6392 | } |
---|
6233 | 6393 | else |
---|
6234 | 6394 | { |
---|
.. | .. |
---|
6257 | 6417 | //System.out.println("SORT"); |
---|
6258 | 6418 | |
---|
6259 | 6419 | java.util.Arrays.sort(facescompare); |
---|
6260 | | - |
---|
6261 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6420 | + |
---|
| 6421 | + display.StartTriangles(); |
---|
6262 | 6422 | for (int i = 0; i < facecount; i++) |
---|
6263 | 6423 | { |
---|
6264 | 6424 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6270 | 6430 | Vertex q = bRep.GetVertex(face.q); |
---|
6271 | 6431 | Vertex r = bRep.GetVertex(face.r); |
---|
6272 | 6432 | |
---|
6273 | | - drawFace(p, q, r, display, face); |
---|
| 6433 | + display.DrawFace(this, p, q, r, face); |
---|
6274 | 6434 | } |
---|
6275 | | - gl.glEnd(); |
---|
| 6435 | + display.EndTriangles(); |
---|
6276 | 6436 | } |
---|
6277 | 6437 | |
---|
6278 | 6438 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6279 | 6439 | { |
---|
| 6440 | + /* |
---|
6280 | 6441 | gl.glDisable(gl.GL_LIGHTING); |
---|
6281 | 6442 | float[] colorV = new float[3]; |
---|
6282 | 6443 | |
---|
.. | .. |
---|
6355 | 6516 | // gl.glEnd(); |
---|
6356 | 6517 | } |
---|
6357 | 6518 | } |
---|
| 6519 | + */ |
---|
6358 | 6520 | } |
---|
6359 | 6521 | } |
---|
6360 | 6522 | |
---|
.. | .. |
---|
6399 | 6561 | center.add(r); |
---|
6400 | 6562 | center.mul(1.0/3); |
---|
6401 | 6563 | |
---|
6402 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6564 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6403 | 6565 | |
---|
6404 | 6566 | distance = center.dot(center); |
---|
6405 | 6567 | } |
---|
.. | .. |
---|
6410 | 6572 | |
---|
6411 | 6573 | transient FaceCompare[] facescompare = null; |
---|
6412 | 6574 | |
---|
6413 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6414 | | - { |
---|
6415 | | - if (display.RENDERPROGRAM == 0) |
---|
6416 | | - { |
---|
6417 | | - float r = 0; |
---|
6418 | | - if (bRep != null) |
---|
6419 | | - { |
---|
6420 | | - if (bRep.stripified) |
---|
6421 | | - { |
---|
6422 | | - r = 1; |
---|
6423 | | - } |
---|
6424 | | - } |
---|
6425 | | - float g = 0; |
---|
6426 | | - if (bRep != null) |
---|
6427 | | - { |
---|
6428 | | - if (bRep.trimmed) |
---|
6429 | | - { |
---|
6430 | | - g = 1; |
---|
6431 | | - } |
---|
6432 | | - } |
---|
6433 | | - float b = 0; |
---|
6434 | | - if (support != null && link2master) |
---|
6435 | | - { |
---|
6436 | | - b = 1; |
---|
6437 | | - } |
---|
6438 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6439 | | - return; |
---|
6440 | | - } |
---|
6441 | | - |
---|
6442 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6443 | | - return; |
---|
6444 | | - |
---|
6445 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6446 | | -// if (true) return; |
---|
6447 | | -// float ao = p.AO; |
---|
6448 | | -// |
---|
6449 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6450 | | -// // ao = 1; |
---|
6451 | | -// |
---|
6452 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6453 | | - |
---|
6454 | | -// CameraPane.selectedpoint. |
---|
6455 | | -// getAverage(cStatic.point1, true); |
---|
6456 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6457 | | - { |
---|
6458 | | - return; |
---|
6459 | | - } |
---|
6460 | | - |
---|
6461 | | - cStatic.point1.set(0,0,0); |
---|
6462 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6463 | | - |
---|
6464 | | - cStatic.point1.sub(p0); |
---|
6465 | | - |
---|
6466 | | - |
---|
6467 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6468 | | -// { |
---|
6469 | | -// return; |
---|
6470 | | -// } |
---|
6471 | | - |
---|
6472 | | - //if (true) |
---|
6473 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6474 | | - { |
---|
6475 | | - return; |
---|
6476 | | - } |
---|
6477 | | - |
---|
6478 | | - float[] colorV = new float[3]; |
---|
6479 | | - |
---|
6480 | | - if (false) // marked) |
---|
6481 | | - { |
---|
6482 | | - // debug rigging weights |
---|
6483 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6484 | | - { |
---|
6485 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6486 | | - |
---|
6487 | | - // if (weight < 0.1) |
---|
6488 | | - // { |
---|
6489 | | - // assert(weight == 0); |
---|
6490 | | - // continue; |
---|
6491 | | - // } |
---|
6492 | | - |
---|
6493 | | - if (p0.vertexlinks[object] == -1) |
---|
6494 | | - continue; |
---|
6495 | | - |
---|
6496 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6497 | | - |
---|
6498 | | - int color = //1 << object; // |
---|
6499 | | - //p.vertexlinks.length; |
---|
6500 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6501 | | - colorV[2] += (color & 1) * weight; |
---|
6502 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6503 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6504 | | - } |
---|
6505 | | - } |
---|
6506 | | - else |
---|
6507 | | - { |
---|
6508 | | - if (drawingstarted) |
---|
6509 | | - { |
---|
6510 | | - // find next point |
---|
6511 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6512 | | - { |
---|
6513 | | - bRep.InitFaceIndices(); |
---|
6514 | | - } |
---|
6515 | | - |
---|
6516 | | - double ymin = p0.y; |
---|
6517 | | - |
---|
6518 | | - Vertex newp = p0; |
---|
6519 | | - |
---|
6520 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6521 | | - { |
---|
6522 | | - int fi = p0.faceindices[fii]; |
---|
6523 | | - |
---|
6524 | | - if (fi == -1) |
---|
6525 | | - break; |
---|
6526 | | - |
---|
6527 | | - Face f = bRep.GetFace(fi); |
---|
6528 | | - |
---|
6529 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6530 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6531 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6532 | | - |
---|
6533 | | - int swap = (int)(Math.random()*3); |
---|
6534 | | - |
---|
6535 | | -// for (int s=swap; --s>=0;) |
---|
6536 | | -// { |
---|
6537 | | -// Vertex t = p; |
---|
6538 | | -// p = q; |
---|
6539 | | -// q = r; |
---|
6540 | | -// r = t; |
---|
6541 | | -// } |
---|
6542 | | - if (ymin > p.y) |
---|
6543 | | - { |
---|
6544 | | - ymin = p.y; |
---|
6545 | | - newp = p; |
---|
6546 | | -// break; |
---|
6547 | | - } |
---|
6548 | | - if (ymin > q.y) |
---|
6549 | | - { |
---|
6550 | | - ymin = q.y; |
---|
6551 | | - newp = q; |
---|
6552 | | -// break; |
---|
6553 | | - } |
---|
6554 | | - if (ymin > r.y) |
---|
6555 | | - { |
---|
6556 | | - ymin = r.y; |
---|
6557 | | - newp = r; |
---|
6558 | | -// break; |
---|
6559 | | - } |
---|
6560 | | - } |
---|
6561 | | - |
---|
6562 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6563 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6564 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6565 | | - |
---|
6566 | | - drawingstarted = false; |
---|
6567 | | - |
---|
6568 | | - // return; |
---|
6569 | | - } |
---|
6570 | | - |
---|
6571 | | - if (false) // CameraPane.DRAW |
---|
6572 | | - { |
---|
6573 | | - p0.AO = colorV[0] = 2; |
---|
6574 | | - colorV[1] = 2; |
---|
6575 | | - colorV[2] = 2; |
---|
6576 | | - } |
---|
6577 | | - |
---|
6578 | | - CameraPane.pointflow.add(p0); |
---|
6579 | | - CameraPane.pointflow.Touch(); |
---|
6580 | | - } |
---|
6581 | | - |
---|
6582 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6583 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6584 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6585 | | - } |
---|
6586 | | - |
---|
6587 | 6575 | void Print(Vertex v) |
---|
6588 | 6576 | { |
---|
6589 | 6577 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6590 | 6578 | } |
---|
6591 | 6579 | |
---|
6592 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6593 | | - { |
---|
6594 | | - if (!selectmode) |
---|
6595 | | - { |
---|
6596 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6597 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6598 | | - |
---|
6599 | | - if (flipV) |
---|
6600 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6601 | | - else |
---|
6602 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6603 | | - } |
---|
6604 | | - |
---|
6605 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6606 | | - } |
---|
6607 | | - |
---|
6608 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6609 | | - CameraPane display, Face face) |
---|
6610 | | - { |
---|
6611 | | - if (pv.y == -10000 || |
---|
6612 | | - qv.y == -10000 || |
---|
6613 | | - rv.y == -10000) |
---|
6614 | | - return; |
---|
6615 | | - |
---|
6616 | | -// float b = f.nbiterations & 1; |
---|
6617 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6618 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6619 | | -// |
---|
6620 | | -// //if (f.weight == 10000) |
---|
6621 | | -// //{ |
---|
6622 | | -// // r = 1; g = b = 0; |
---|
6623 | | -// //} |
---|
6624 | | -// //else |
---|
6625 | | -// //{ |
---|
6626 | | -// // assert(f.weight < 10000); |
---|
6627 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6628 | | -// if (r<0) |
---|
6629 | | -// assert(r>=0); |
---|
6630 | | -// //} |
---|
6631 | | - |
---|
6632 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6633 | | - |
---|
6634 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6635 | | - |
---|
6636 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6637 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6638 | | - { |
---|
6639 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6640 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6641 | | - if (!hasnorm) |
---|
6642 | | - { |
---|
6643 | | - // System.out.println("FUCK!!"); |
---|
6644 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6645 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6646 | | - LA.vecCross(v0, v1, v2); |
---|
6647 | | - LA.vecNormalize(v2); |
---|
6648 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6649 | | - } |
---|
6650 | | - |
---|
6651 | | - if (hasnorm) |
---|
6652 | | - { |
---|
6653 | | -// if (!pv.norm.normalized()) |
---|
6654 | | -// assert(pv.norm.normalized()); |
---|
6655 | | - |
---|
6656 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6657 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6658 | | - } |
---|
6659 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6660 | | - SetColor(display, pv); |
---|
6661 | | - //gl.glColor4f(r, g, b, 1); |
---|
6662 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6663 | | - if (flipV) |
---|
6664 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6665 | | - else |
---|
6666 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6667 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6668 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6669 | | -// Print(pv); |
---|
6670 | | - if (hasnorm) |
---|
6671 | | - { |
---|
6672 | | -// assert(qv.norm.normalized()); |
---|
6673 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6674 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6675 | | - } |
---|
6676 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6677 | | - // boolean locked = false; |
---|
6678 | | - // float eps = 0.1f; |
---|
6679 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6680 | | - |
---|
6681 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6682 | | - |
---|
6683 | | - // if ((dot&1) == 0) |
---|
6684 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6685 | | - |
---|
6686 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6687 | | - if (flipV) |
---|
6688 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6689 | | - else |
---|
6690 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6691 | | - // else |
---|
6692 | | - // { |
---|
6693 | | - // locked = true; |
---|
6694 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6695 | | - // } |
---|
6696 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6697 | | - SetColor(display, qv); |
---|
6698 | | - //gl.glColor4f(r, g, b, 1); |
---|
6699 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6700 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6701 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6702 | | -// Print(qv); |
---|
6703 | | - if (hasnorm) |
---|
6704 | | - { |
---|
6705 | | -// assert(rv.norm.normalized()); |
---|
6706 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6707 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6708 | | - } |
---|
6709 | | - |
---|
6710 | | - // if ((dot&4) == 0) |
---|
6711 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6712 | | - |
---|
6713 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6714 | | - if (flipV) |
---|
6715 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6716 | | - else |
---|
6717 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6718 | | - // else |
---|
6719 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6720 | | - |
---|
6721 | | - // f.dot = dot; |
---|
6722 | | - |
---|
6723 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6724 | | - SetColor(display, rv); |
---|
6725 | | - //gl.glColor4f(r, g, b, 1); |
---|
6726 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6727 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6728 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6729 | | -// Print(rv); |
---|
6730 | | - //gl.glEnd(); |
---|
6731 | | - } |
---|
6732 | | - else |
---|
6733 | | - { |
---|
6734 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6735 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6736 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6737 | | - |
---|
6738 | | - } |
---|
6739 | | - |
---|
6740 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6741 | | - { |
---|
6742 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6743 | | - |
---|
6744 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6745 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6746 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6747 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6748 | | - gl.glEnd(); |
---|
6749 | | - |
---|
6750 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6751 | | - } |
---|
6752 | | - } |
---|
6753 | | - |
---|
6754 | 6580 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6755 | 6581 | { |
---|
6756 | 6582 | if (bRep == null) |
---|
.. | .. |
---|
7322 | 7148 | int spotw = spot.x + spot.width; |
---|
7323 | 7149 | int spoth = spot.y + spot.height; |
---|
7324 | 7150 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7325 | | - if (CameraPane.Xmin > spot.x) |
---|
7326 | | - { |
---|
7327 | | - CameraPane.Xmin = spot.x; |
---|
7328 | | - } |
---|
7329 | | - if (CameraPane.Xmax < spotw) |
---|
7330 | | - { |
---|
7331 | | - CameraPane.Xmax = spotw; |
---|
7332 | | - } |
---|
7333 | | - if (CameraPane.Ymin > spot.y) |
---|
7334 | | - { |
---|
7335 | | - CameraPane.Ymin = spot.y; |
---|
7336 | | - } |
---|
7337 | | - if (CameraPane.Ymax < spoth) |
---|
7338 | | - { |
---|
7339 | | - CameraPane.Ymax = spoth; |
---|
7340 | | - } |
---|
| 7151 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7152 | +// { |
---|
| 7153 | +// CameraPane.Xmin = spot.x; |
---|
| 7154 | +// } |
---|
| 7155 | +// if (CameraPane.Xmax < spotw) |
---|
| 7156 | +// { |
---|
| 7157 | +// CameraPane.Xmax = spotw; |
---|
| 7158 | +// } |
---|
| 7159 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7160 | +// { |
---|
| 7161 | +// CameraPane.Ymin = spot.y; |
---|
| 7162 | +// } |
---|
| 7163 | +// if (CameraPane.Ymax < spoth) |
---|
| 7164 | +// { |
---|
| 7165 | +// CameraPane.Ymax = spoth; |
---|
| 7166 | +// } |
---|
7341 | 7167 | spot.translate(32, 32); |
---|
7342 | 7168 | spotw = spot.x + spot.width; |
---|
7343 | 7169 | spoth = spot.y + spot.height; |
---|
7344 | | - info.g.setColor(Color.blue); |
---|
| 7170 | + info.g.setColor(Color.cyan); |
---|
7345 | 7171 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7346 | | - if (CameraPane.Xmin > spot.x) |
---|
7347 | | - { |
---|
7348 | | - CameraPane.Xmin = spot.x; |
---|
7349 | | - } |
---|
7350 | | - if (CameraPane.Xmax < spotw) |
---|
7351 | | - { |
---|
7352 | | - CameraPane.Xmax = spotw; |
---|
7353 | | - } |
---|
7354 | | - if (CameraPane.Ymin > spot.y) |
---|
7355 | | - { |
---|
7356 | | - CameraPane.Ymin = spot.y; |
---|
7357 | | - } |
---|
7358 | | - if (CameraPane.Ymax < spoth) |
---|
7359 | | - { |
---|
7360 | | - CameraPane.Ymax = spoth; |
---|
7361 | | - } |
---|
7362 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7363 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7172 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7173 | +// { |
---|
| 7174 | +// CameraPane.Xmin = spot.x; |
---|
| 7175 | +// } |
---|
| 7176 | +// if (CameraPane.Xmax < spotw) |
---|
| 7177 | +// { |
---|
| 7178 | +// CameraPane.Xmax = spotw; |
---|
| 7179 | +// } |
---|
| 7180 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7181 | +// { |
---|
| 7182 | +// CameraPane.Ymin = spot.y; |
---|
| 7183 | +// } |
---|
| 7184 | +// if (CameraPane.Ymax < spoth) |
---|
| 7185 | +// { |
---|
| 7186 | +// CameraPane.Ymax = spoth; |
---|
| 7187 | +// } |
---|
| 7188 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7189 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7364 | 7190 | spot.translate(0, -32); |
---|
7365 | | - info.g.setColor(Color.green); |
---|
| 7191 | + info.g.setColor(Color.yellow); |
---|
7366 | 7192 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7367 | | - if (CameraPane.Xmin > spot.x) |
---|
7368 | | - { |
---|
7369 | | - CameraPane.Xmin = spot.x; |
---|
7370 | | - } |
---|
7371 | | - if (CameraPane.Xmax < spotw) |
---|
7372 | | - { |
---|
7373 | | - CameraPane.Xmax = spotw; |
---|
7374 | | - } |
---|
7375 | | - if (CameraPane.Ymin > spot.y) |
---|
7376 | | - { |
---|
7377 | | - CameraPane.Ymin = spot.y; |
---|
7378 | | - } |
---|
7379 | | - if (CameraPane.Ymax < spoth) |
---|
7380 | | - { |
---|
7381 | | - CameraPane.Ymax = spoth; |
---|
7382 | | - } |
---|
| 7193 | + info.g.setColor(Color.green); |
---|
| 7194 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7195 | +// { |
---|
| 7196 | +// CameraPane.Xmin = spot.x; |
---|
| 7197 | +// } |
---|
| 7198 | +// if (CameraPane.Xmax < spotw) |
---|
| 7199 | +// { |
---|
| 7200 | +// CameraPane.Xmax = spotw; |
---|
| 7201 | +// } |
---|
| 7202 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7203 | +// { |
---|
| 7204 | +// CameraPane.Ymin = spot.y; |
---|
| 7205 | +// } |
---|
| 7206 | +// if (CameraPane.Ymax < spoth) |
---|
| 7207 | +// { |
---|
| 7208 | +// CameraPane.Ymax = spoth; |
---|
| 7209 | +// } |
---|
7383 | 7210 | info.g.drawArc(boundary.x, boundary.y, |
---|
7384 | 7211 | boundary.width, boundary.height, 0, 360); |
---|
7385 | 7212 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7386 | | - if (CameraPane.Xmin > boundary.x) |
---|
7387 | | - { |
---|
7388 | | - CameraPane.Xmin = boundary.x; |
---|
7389 | | - } |
---|
7390 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7391 | | - { |
---|
7392 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7393 | | - } |
---|
7394 | | - if (CameraPane.Ymin > boundary.y) |
---|
7395 | | - { |
---|
7396 | | - CameraPane.Ymin = boundary.y; |
---|
7397 | | - } |
---|
7398 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7399 | | - { |
---|
7400 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7401 | | - } |
---|
| 7213 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 7214 | +// { |
---|
| 7215 | +// CameraPane.Xmin = boundary.x; |
---|
| 7216 | +// } |
---|
| 7217 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 7218 | +// { |
---|
| 7219 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 7220 | +// } |
---|
| 7221 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 7222 | +// { |
---|
| 7223 | +// CameraPane.Ymin = boundary.y; |
---|
| 7224 | +// } |
---|
| 7225 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 7226 | +// { |
---|
| 7227 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 7228 | +// } |
---|
7402 | 7229 | return; |
---|
7403 | 7230 | } |
---|
7404 | 7231 | } |
---|
.. | .. |
---|
7415 | 7242 | startX = info.x; |
---|
7416 | 7243 | startY = info.y; |
---|
7417 | 7244 | |
---|
7418 | | - hitSomething = 0; |
---|
| 7245 | + hitSomething = -1; |
---|
7419 | 7246 | cVector origin = new cVector(); |
---|
7420 | 7247 | //LA.xformPos(origin, toParent, origin); |
---|
7421 | 7248 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7448 | 7275 | } |
---|
7449 | 7276 | |
---|
7450 | 7277 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7451 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7278 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7452 | 7279 | //System.out.println("modified = " + modified); |
---|
7453 | 7280 | //new Exception().printStackTrace(); |
---|
7454 | 7281 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7476 | 7303 | return true; |
---|
7477 | 7304 | } |
---|
7478 | 7305 | |
---|
7479 | | - void doEditDrag0(ClickInfo info) |
---|
| 7306 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7480 | 7307 | { |
---|
7481 | 7308 | if (hitSomething == 0) |
---|
7482 | 7309 | { |
---|
.. | .. |
---|
7491 | 7318 | //System.out.println("hitSomething = " + hitSomething); |
---|
7492 | 7319 | |
---|
7493 | 7320 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7321 | + |
---|
7494 | 7322 | cVector xlate = new cVector(); |
---|
7495 | 7323 | //cVector xlate2 = new cVector(); |
---|
7496 | 7324 | switch (hitSomething) |
---|
.. | .. |
---|
7501 | 7329 | |
---|
7502 | 7330 | case hitCenter: // Translate |
---|
7503 | 7331 | |
---|
7504 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7332 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7505 | 7333 | |
---|
7506 | | - if (modified) |
---|
| 7334 | + if (modified || opposite) |
---|
7507 | 7335 | { |
---|
7508 | 7336 | //assert(false); |
---|
7509 | 7337 | /* |
---|
.. | .. |
---|
7549 | 7377 | } |
---|
7550 | 7378 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7551 | 7379 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7552 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7380 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7553 | 7381 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7554 | 7382 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7555 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7383 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7556 | 7384 | //LA.vecCross(up, cVector.Z, right2); |
---|
7557 | 7385 | |
---|
7558 | 7386 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7597 | 7425 | |
---|
7598 | 7426 | if (modified) |
---|
7599 | 7427 | { |
---|
| 7428 | + // Rotate 90 degrees |
---|
7600 | 7429 | angle /= (Math.PI / 4); |
---|
7601 | 7430 | angle = Math.floor(angle + 0.5); |
---|
7602 | 7431 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7610 | 7439 | } |
---|
7611 | 7440 | /**/ |
---|
7612 | 7441 | |
---|
7613 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7442 | + switch (info.pane.RenderCamera().viewCode) |
---|
7614 | 7443 | { |
---|
7615 | 7444 | case 1: // '\001' |
---|
7616 | 7445 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7638 | 7467 | |
---|
7639 | 7468 | case hitScale: // scale |
---|
7640 | 7469 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7470 | + double sign = 1; |
---|
| 7471 | + if (hScale < 0) |
---|
| 7472 | + { |
---|
| 7473 | + sign = -1; |
---|
| 7474 | + } |
---|
| 7475 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7641 | 7476 | if (hScale < 0.01) |
---|
7642 | 7477 | { |
---|
7643 | | - hScale = 0.01; |
---|
| 7478 | + //hScale = 0.01; |
---|
7644 | 7479 | } |
---|
7645 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7646 | | - if (hScale < 0.01) |
---|
7647 | | - { |
---|
7648 | | - hScale = 0.01; |
---|
7649 | | - } |
---|
| 7480 | + |
---|
7650 | 7481 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7651 | | - if (vScale < 0.01) |
---|
| 7482 | + sign = 1; |
---|
| 7483 | + if (vScale < 0) |
---|
7652 | 7484 | { |
---|
7653 | | - vScale = 0.01; |
---|
| 7485 | + sign = -1; |
---|
7654 | 7486 | } |
---|
7655 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7487 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7656 | 7488 | if (vScale < 0.01) |
---|
7657 | 7489 | { |
---|
7658 | | - vScale = 0.01; |
---|
| 7490 | + //vScale = 0.01; |
---|
7659 | 7491 | } |
---|
7660 | 7492 | LA.matCopy(startMat, toParent); |
---|
7661 | 7493 | /**/ |
---|
.. | .. |
---|
7666 | 7498 | } |
---|
7667 | 7499 | /**/ |
---|
7668 | 7500 | |
---|
7669 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7501 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7502 | + |
---|
| 7503 | + if (totalScale < 0.01) |
---|
| 7504 | + { |
---|
| 7505 | + totalScale = 0.01; |
---|
| 7506 | + } |
---|
| 7507 | + |
---|
| 7508 | + switch (info.pane.RenderCamera().viewCode) |
---|
7670 | 7509 | { |
---|
7671 | 7510 | case 3: // '\001' |
---|
7672 | | - if (modified) |
---|
| 7511 | + if (modified || opposite) |
---|
7673 | 7512 | { |
---|
7674 | 7513 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7675 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7514 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7676 | 7515 | } // vScale, 1); |
---|
7677 | 7516 | else |
---|
7678 | 7517 | { |
---|
7679 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7518 | + // EXCEPTION! |
---|
| 7519 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7680 | 7520 | } // vScale, 1); |
---|
7681 | 7521 | break; |
---|
7682 | 7522 | |
---|
7683 | 7523 | case 2: // '\002' |
---|
7684 | | - if (modified) |
---|
| 7524 | + if (modified || opposite) |
---|
7685 | 7525 | { |
---|
7686 | 7526 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7687 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7527 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7688 | 7528 | } else |
---|
7689 | 7529 | { |
---|
7690 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7530 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7691 | 7531 | } |
---|
7692 | 7532 | break; |
---|
7693 | 7533 | |
---|
7694 | 7534 | case 1: // '\003' |
---|
7695 | | - if (modified) |
---|
| 7535 | + if (modified || opposite) |
---|
7696 | 7536 | { |
---|
7697 | 7537 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7698 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7538 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7699 | 7539 | } else |
---|
7700 | 7540 | { |
---|
7701 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7541 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7702 | 7542 | } |
---|
7703 | 7543 | break; |
---|
7704 | 7544 | } |
---|
.. | .. |
---|
7719 | 7559 | if (parent == null) |
---|
7720 | 7560 | { |
---|
7721 | 7561 | System.out.println("NULL PARENT"); |
---|
7722 | | - new Exception().printStackTrace(); |
---|
| 7562 | + //new Exception().printStackTrace(); |
---|
7723 | 7563 | } else |
---|
7724 | 7564 | { |
---|
7725 | 7565 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7735 | 7575 | info.pane.repaint(); |
---|
7736 | 7576 | } |
---|
7737 | 7577 | |
---|
| 7578 | + boolean overflow = false; |
---|
| 7579 | + |
---|
7738 | 7580 | void TransformToWorld(cVector out) // , cVector out) |
---|
7739 | 7581 | { |
---|
| 7582 | + if (overflow) |
---|
| 7583 | + return; |
---|
| 7584 | + |
---|
| 7585 | + overflow = true; |
---|
| 7586 | + |
---|
7740 | 7587 | // june 2013 ??? assert (in == out); |
---|
7741 | 7588 | cVector in = out; |
---|
7742 | 7589 | if (toParent != null && !(this instanceof Texture || this instanceof TextureNode)) |
---|
.. | .. |
---|
7753 | 7600 | { |
---|
7754 | 7601 | (parent!=null?parent:fileparent).TransformToWorld(out); //, out); |
---|
7755 | 7602 | } |
---|
| 7603 | + |
---|
| 7604 | + overflow = false; |
---|
7756 | 7605 | } |
---|
7757 | 7606 | |
---|
7758 | 7607 | void TransformToLocal(cVector out) //, cVector out) |
---|
.. | .. |
---|
7822 | 7671 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7823 | 7672 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7824 | 7673 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7674 | + |
---|
| 7675 | + String objname; |
---|
| 7676 | + |
---|
7825 | 7677 | if (false) //parent != null) |
---|
7826 | 7678 | { |
---|
7827 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7679 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7828 | 7680 | } else |
---|
7829 | 7681 | { |
---|
7830 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7682 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7831 | 7683 | } // + super.toString(); |
---|
7832 | 7684 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7685 | + |
---|
| 7686 | + if (!Globals.ADVANCED) |
---|
| 7687 | + return objname; |
---|
| 7688 | + |
---|
| 7689 | + return objname + " " + System.identityHashCode(this); |
---|
7833 | 7690 | } |
---|
7834 | 7691 | |
---|
7835 | 7692 | public int hashCode() |
---|
.. | .. |
---|
7885 | 7742 | objectUI.closeUI(); |
---|
7886 | 7743 | if (editWindow != null) |
---|
7887 | 7744 | { |
---|
| 7745 | + editWindow.ctrlPanel.FlushUI(); |
---|
7888 | 7746 | editWindow.refreshContents(); |
---|
7889 | 7747 | } // ? new |
---|
7890 | 7748 | objectUI = null; |
---|
.. | .. |
---|
7905 | 7763 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7906 | 7764 | |
---|
7907 | 7765 | Object3D /*Composite*/ parent; |
---|
7908 | | - Object3D /*Composite*/ fileparent; |
---|
| 7766 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7909 | 7767 | |
---|
7910 | 7768 | double[][] toParent; // dynamic matrix |
---|
7911 | 7769 | double[][] fromParent; |
---|
.. | .. |
---|
7995 | 7853 | max = new cVector(); |
---|
7996 | 7854 | } |
---|
7997 | 7855 | |
---|
7998 | | - Object3D sourcenode = GetFileRoot(); |
---|
7999 | | - |
---|
8000 | | - if (!sourcenode.name.contains("rclab")) |
---|
| 7856 | + if (false) // Can crawl!! |
---|
8001 | 7857 | { |
---|
8002 | | - getBounds(min, max, true); |
---|
| 7858 | + Object3D sourcenode = GetFileRoot(); |
---|
8003 | 7859 | |
---|
8004 | | - if (min.y != Double.POSITIVE_INFINITY && min.y > 2) |
---|
| 7860 | + if (sourcenode != null && !sourcenode.name.contains("rclab")) |
---|
8005 | 7861 | { |
---|
8006 | | -// sourcenode.getBounds(min, max, true); |
---|
8007 | | - sourcenode.getBounds(v0, v1, true); |
---|
8008 | | -// sourcenode.toParent = sourcenode.toParent; |
---|
8009 | | -// get(0).toParent = get(0).toParent; |
---|
8010 | | -// sourcenode.GlobalTransform(); |
---|
| 7862 | + getBounds(min, max, true); |
---|
| 7863 | + |
---|
| 7864 | + if (min.y != Double.POSITIVE_INFINITY && min.y > 2) |
---|
| 7865 | + { |
---|
| 7866 | + // sourcenode.getBounds(min, max, true); |
---|
| 7867 | + sourcenode.getBounds(v0, v1, true); |
---|
| 7868 | + // sourcenode.toParent = sourcenode.toParent; |
---|
| 7869 | + // get(0).toParent = get(0).toParent; |
---|
| 7870 | + // sourcenode.GlobalTransform(); |
---|
| 7871 | + } |
---|
8011 | 7872 | } |
---|
8012 | 7873 | } |
---|
8013 | 7874 | |
---|
.. | .. |
---|
8016 | 7877 | if (support != null) |
---|
8017 | 7878 | { |
---|
8018 | 7879 | assert(bRep != null); |
---|
8019 | | - GraphreeD.Assert(support.bRep == bRep.support); |
---|
| 7880 | + if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
| 7881 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
8020 | 7882 | } |
---|
8021 | 7883 | else |
---|
8022 | 7884 | { |
---|
.. | .. |
---|
8065 | 7927 | private static cVector edge2 = new cVector(); |
---|
8066 | 7928 | //private static cVector norm = new cVector(); |
---|
8067 | 7929 | /*transient private*/ int hitSomething; |
---|
8068 | | - private static final int hitCenter = 1; |
---|
8069 | | - private static final int hitScale = 2; |
---|
8070 | | - private static final int hitRotate = 3; |
---|
| 7930 | + static final int hitCenter = 1; |
---|
| 7931 | + static final int hitScale = 2; |
---|
| 7932 | + static final int hitRotate = 3; |
---|
8071 | 7933 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
8072 | 7934 | /*transient*/ private Point centerPt; |
---|
8073 | 7935 | /*transient*/ private int startX; |
---|
.. | .. |
---|
8099 | 7961 | { |
---|
8100 | 7962 | Object3D targ = this; |
---|
8101 | 7963 | |
---|
| 7964 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 7965 | + |
---|
8102 | 7966 | if (obj.material != null) |
---|
8103 | 7967 | { |
---|
8104 | 7968 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|