.. | .. |
---|
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); |
---|
.. | .. |
---|
790 | 893 | |
---|
791 | 894 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
792 | 895 | |
---|
793 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 896 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 897 | + (step == 1 && changedir)) |
---|
794 | 898 | { |
---|
795 | 899 | countdown = 1; |
---|
796 | 900 | delay = speedup?8:1; |
---|
.. | .. |
---|
893 | 997 | fromParent = null; // LA.newMatrix(); |
---|
894 | 998 | bRep = null; // new BoundaryRep(); |
---|
895 | 999 | |
---|
| 1000 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1001 | + { |
---|
| 1002 | + name = oname; |
---|
| 1003 | + } |
---|
| 1004 | + |
---|
896 | 1005 | /* |
---|
897 | 1006 | float hue = (float)Math.random(); |
---|
898 | 1007 | Color col; |
---|
.. | .. |
---|
935 | 1044 | |
---|
936 | 1045 | public Object clone() |
---|
937 | 1046 | { |
---|
938 | | - return GraphreeD.clone(this); |
---|
| 1047 | + return Grafreed.clone(this); |
---|
939 | 1048 | } |
---|
940 | 1049 | |
---|
941 | 1050 | Object3D copyExpand() |
---|
.. | .. |
---|
1446 | 1555 | // if (other == null) |
---|
1447 | 1556 | // return; |
---|
1448 | 1557 | |
---|
1449 | | - System.out.println("Link support this = " + this + "; other = " + other); |
---|
| 1558 | + if (other != null) |
---|
| 1559 | + { |
---|
| 1560 | + BoundaryRep.SEUIL = other.material.cameralight; |
---|
| 1561 | + |
---|
| 1562 | + // Set default to 0.1 |
---|
| 1563 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
| 1564 | + System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
| 1565 | + } |
---|
| 1566 | + |
---|
| 1567 | + System.out.println("Link this = " + this + "; support = " + other); |
---|
1450 | 1568 | |
---|
1451 | 1569 | //if (bRep != null) |
---|
1452 | 1570 | // bRep.linkVerticesThis(other.bRep); |
---|
.. | .. |
---|
1701 | 1819 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1702 | 1820 | o.bRep = transientrep; |
---|
1703 | 1821 | if (clone) |
---|
1704 | | - o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1822 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1705 | 1823 | o.CreateMaterial(); |
---|
1706 | 1824 | o.SetAttributes(this, -1); |
---|
1707 | 1825 | //parent |
---|
.. | .. |
---|
1714 | 1832 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1715 | 1833 | o.bRep = bRep; |
---|
1716 | 1834 | if (clone) |
---|
1717 | | - o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1835 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1718 | 1836 | o.CreateMaterial(); |
---|
1719 | 1837 | //o.overwriteThis(this, -1); |
---|
1720 | 1838 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1756 | 1874 | // { |
---|
1757 | 1875 | // assert(bRep == null); |
---|
1758 | 1876 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1759 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep); |
---|
| 1877 | +// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
1760 | 1878 | // o.CreateMaterial(); |
---|
1761 | 1879 | // parent.addChild(o); |
---|
1762 | 1880 | // } |
---|
.. | .. |
---|
1765 | 1883 | // { |
---|
1766 | 1884 | // assert(transientrep == null); |
---|
1767 | 1885 | // Object3D o = new Object3D("Geometry:" + this.name); |
---|
1768 | | -// o.bRep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 1886 | +// o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
1769 | 1887 | // o.CreateMaterial(); |
---|
1770 | 1888 | // parent.addChild(o); |
---|
1771 | 1889 | // } |
---|
.. | .. |
---|
1801 | 1919 | if (obj.name == null) |
---|
1802 | 1920 | continue; // can't be a null one |
---|
1803 | 1921 | |
---|
| 1922 | + // Try perfect match first. |
---|
1804 | 1923 | if (n.equals(obj.name)) |
---|
1805 | 1924 | { |
---|
1806 | 1925 | theobj = obj; |
---|
1807 | 1926 | count++; |
---|
1808 | 1927 | } |
---|
1809 | 1928 | } |
---|
| 1929 | + |
---|
| 1930 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1810 | 1931 | |
---|
1811 | 1932 | if (count != 1) |
---|
1812 | 1933 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
1816 | 1937 | if (obj.name == null) |
---|
1817 | 1938 | continue; // can't be a null one |
---|
1818 | 1939 | |
---|
1819 | | - //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count |
---|
1820 | | - if (n.startsWith(obj.name)) |
---|
| 1940 | + String name = obj.name.split(":")[0]; // Poser generates a count |
---|
| 1941 | + //if (n.startsWith(obj.name)) |
---|
| 1942 | + if (n.contains(name)) |
---|
1821 | 1943 | { |
---|
1822 | 1944 | theobj = obj; |
---|
1823 | 1945 | count++; |
---|
.. | .. |
---|
2120 | 2242 | if (/*parent != null &&*/ material == null) |
---|
2121 | 2243 | { |
---|
2122 | 2244 | 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 |
---|
| 2245 | + |
---|
| 2246 | + InitOthers(); |
---|
2132 | 2247 | |
---|
2133 | 2248 | if (this instanceof Camera) |
---|
2134 | 2249 | { |
---|
.. | .. |
---|
2272 | 2387 | } |
---|
2273 | 2388 | */ |
---|
2274 | 2389 | } |
---|
| 2390 | + else |
---|
| 2391 | + { |
---|
| 2392 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2393 | + } |
---|
2275 | 2394 | } |
---|
2276 | 2395 | |
---|
2277 | 2396 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
2278 | 2397 | { |
---|
2279 | 2398 | if (newWindow) |
---|
2280 | 2399 | { |
---|
| 2400 | + new Exception().printStackTrace(); |
---|
2281 | 2401 | System.exit(0); |
---|
2282 | 2402 | if (parent != null) |
---|
2283 | 2403 | { |
---|
.. | .. |
---|
2454 | 2574 | return retval; |
---|
2455 | 2575 | } |
---|
2456 | 2576 | |
---|
2457 | | - void doEditDrag(ClickInfo info) |
---|
| 2577 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2458 | 2578 | { |
---|
2459 | 2579 | switch (doSomething) |
---|
2460 | 2580 | { |
---|
2461 | 2581 | case 1: // '\001' |
---|
2462 | 2582 | //super. |
---|
2463 | | - doEditDrag0(info); |
---|
| 2583 | + doEditDrag0(info, opposite); |
---|
2464 | 2584 | break; |
---|
2465 | 2585 | |
---|
2466 | 2586 | case 2: // '\002' |
---|
.. | .. |
---|
2473 | 2593 | { |
---|
2474 | 2594 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2475 | 2595 | //childToDrag.doEditDrag(info); |
---|
2476 | | - sel.doEditDrag(info); |
---|
| 2596 | + sel.doEditDrag(info, opposite); |
---|
2477 | 2597 | } else |
---|
2478 | 2598 | { |
---|
2479 | 2599 | //super. |
---|
2480 | | - doEditDrag0(info); |
---|
| 2600 | + doEditDrag0(info, opposite); |
---|
2481 | 2601 | } |
---|
2482 | 2602 | } |
---|
2483 | 2603 | break; |
---|
.. | .. |
---|
2587 | 2707 | void GenNormalsS(boolean crease) |
---|
2588 | 2708 | { |
---|
2589 | 2709 | selection.GenNormals(crease); |
---|
| 2710 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2711 | +// { |
---|
| 2712 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2713 | +// selectee.GenNormals(crease); |
---|
| 2714 | +// } |
---|
| 2715 | + |
---|
| 2716 | + //Touch(); |
---|
| 2717 | + } |
---|
| 2718 | + |
---|
| 2719 | + void GenNormalsMeshS() |
---|
| 2720 | + { |
---|
| 2721 | + selection.GenNormalsMesh(); |
---|
2590 | 2722 | // for (int i=0; i<selection.size(); i++) |
---|
2591 | 2723 | // { |
---|
2592 | 2724 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2732 | 2864 | blockloop = false; |
---|
2733 | 2865 | } |
---|
2734 | 2866 | |
---|
| 2867 | + void GenNormalsMesh() |
---|
| 2868 | + { |
---|
| 2869 | + if (blockloop) |
---|
| 2870 | + return; |
---|
| 2871 | + |
---|
| 2872 | + blockloop = true; |
---|
| 2873 | + GenNormalsMesh0(); |
---|
| 2874 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2875 | + { |
---|
| 2876 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2877 | + if (child == null) |
---|
| 2878 | + continue; |
---|
| 2879 | + child.GenNormalsMesh(); |
---|
| 2880 | +// Children().release(i); |
---|
| 2881 | + } |
---|
| 2882 | + blockloop = false; |
---|
| 2883 | + } |
---|
| 2884 | + |
---|
| 2885 | + void GenNormalsMINE() |
---|
| 2886 | + { |
---|
| 2887 | + if (blockloop) |
---|
| 2888 | + return; |
---|
| 2889 | + |
---|
| 2890 | + blockloop = true; |
---|
| 2891 | + GenNormalsMINE0(); |
---|
| 2892 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2893 | + { |
---|
| 2894 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2895 | + if (child == null) |
---|
| 2896 | + continue; |
---|
| 2897 | + child.GenNormalsMINE(); |
---|
| 2898 | +// Children().release(i); |
---|
| 2899 | + } |
---|
| 2900 | + blockloop = false; |
---|
| 2901 | + } |
---|
| 2902 | + |
---|
2735 | 2903 | void ClearColors() |
---|
2736 | 2904 | { |
---|
2737 | 2905 | if (blockloop) |
---|
.. | .. |
---|
2866 | 3034 | { |
---|
2867 | 3035 | if (bRep != null) |
---|
2868 | 3036 | { |
---|
2869 | | - bRep.GenUV(); |
---|
| 3037 | + bRep.GenUV(); //1); |
---|
| 3038 | + //bRep.UnfoldUV(); |
---|
2870 | 3039 | Touch(); |
---|
2871 | 3040 | } |
---|
2872 | 3041 | } |
---|
.. | .. |
---|
2876 | 3045 | if (bRep != null) |
---|
2877 | 3046 | { |
---|
2878 | 3047 | bRep.GenerateNormals(crease); |
---|
| 3048 | + Touch(); |
---|
| 3049 | + } |
---|
| 3050 | + } |
---|
| 3051 | + |
---|
| 3052 | + void GenNormalsMesh0() |
---|
| 3053 | + { |
---|
| 3054 | + if (bRep != null) |
---|
| 3055 | + { |
---|
| 3056 | + bRep.GenerateNormalsMesh(); |
---|
| 3057 | + Touch(); |
---|
| 3058 | + } |
---|
| 3059 | + } |
---|
| 3060 | + |
---|
| 3061 | + void GenNormalsMINE0() |
---|
| 3062 | + { |
---|
| 3063 | + if (bRep != null) |
---|
| 3064 | + { |
---|
| 3065 | + bRep.GenerateNormalsMINE(); |
---|
2879 | 3066 | Touch(); |
---|
2880 | 3067 | } |
---|
2881 | 3068 | } |
---|
.. | .. |
---|
2932 | 3119 | blockloop = false; |
---|
2933 | 3120 | } |
---|
2934 | 3121 | |
---|
| 3122 | + void TransformChildren() |
---|
| 3123 | + { |
---|
| 3124 | + if (toParent != null) |
---|
| 3125 | + { |
---|
| 3126 | + for (int i=Size(); --i>=0;) |
---|
| 3127 | + { |
---|
| 3128 | + Object3D v = get(i); |
---|
| 3129 | + |
---|
| 3130 | + if (v.toParent == null) |
---|
| 3131 | + { |
---|
| 3132 | + v.toParent = LA.newMatrix(); |
---|
| 3133 | + v.fromParent = LA.newMatrix(); |
---|
| 3134 | + } |
---|
| 3135 | + |
---|
| 3136 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3137 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3138 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3139 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3140 | + } |
---|
| 3141 | + |
---|
| 3142 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3143 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3144 | + |
---|
| 3145 | + Touch(); |
---|
| 3146 | + } |
---|
| 3147 | + } |
---|
| 3148 | + |
---|
2935 | 3149 | void TransformGeometry() |
---|
2936 | 3150 | { |
---|
2937 | 3151 | Object3D obj = this; |
---|
.. | .. |
---|
3153 | 3367 | |
---|
3154 | 3368 | BoundaryRep sup = bRep.support; |
---|
3155 | 3369 | bRep.support = null; |
---|
3156 | | - BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep); |
---|
| 3370 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3157 | 3371 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3158 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3372 | + |
---|
| 3373 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3374 | + |
---|
3159 | 3375 | bRep = temprep; |
---|
3160 | 3376 | bRep.support = sup; |
---|
3161 | 3377 | Touch(); |
---|
.. | .. |
---|
3292 | 3508 | if (blockloop) |
---|
3293 | 3509 | return; |
---|
3294 | 3510 | |
---|
3295 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3511 | + if (//marked || // does not make sense |
---|
| 3512 | + (bRep != null || material != null)) // borderline... |
---|
3296 | 3513 | live = h; |
---|
3297 | 3514 | |
---|
3298 | 3515 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3313 | 3530 | return; |
---|
3314 | 3531 | |
---|
3315 | 3532 | //if (bRep != null) |
---|
3316 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3533 | + if (//marked || // does not make sense |
---|
| 3534 | + (bRep != null || material != null)) // borderline... |
---|
3317 | 3535 | link2master = h; |
---|
3318 | 3536 | |
---|
3319 | 3537 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3333 | 3551 | if (blockloop) |
---|
3334 | 3552 | return; |
---|
3335 | 3553 | |
---|
3336 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3554 | + if (//marked || // does not make sense |
---|
| 3555 | + (bRep != null || material != null)) // borderline... |
---|
3337 | 3556 | hide = h; |
---|
3338 | 3557 | |
---|
3339 | 3558 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3353 | 3572 | if (blockloop) |
---|
3354 | 3573 | return; |
---|
3355 | 3574 | |
---|
3356 | | - if (bRep != null && material != null) // borderline... |
---|
| 3575 | + if (bRep != null || material != null) // borderline... |
---|
3357 | 3576 | marked = h; |
---|
3358 | 3577 | |
---|
3359 | 3578 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3363 | 3582 | continue; |
---|
3364 | 3583 | blockloop = true; |
---|
3365 | 3584 | child.MarkLeaves(h); |
---|
| 3585 | + blockloop = false; |
---|
| 3586 | + // release(i); |
---|
| 3587 | + } |
---|
| 3588 | + } |
---|
| 3589 | + |
---|
| 3590 | + void RewindLeaves(boolean h) |
---|
| 3591 | + { |
---|
| 3592 | + if (blockloop) |
---|
| 3593 | + return; |
---|
| 3594 | + |
---|
| 3595 | + if (bRep != null || material != null) // borderline... |
---|
| 3596 | + rewind = h; |
---|
| 3597 | + |
---|
| 3598 | + for (int i = 0; i < Size(); i++) |
---|
| 3599 | + { |
---|
| 3600 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3601 | + if (child == null) |
---|
| 3602 | + continue; |
---|
| 3603 | + blockloop = true; |
---|
| 3604 | + child.RewindLeaves(h); |
---|
| 3605 | + blockloop = false; |
---|
| 3606 | + // release(i); |
---|
| 3607 | + } |
---|
| 3608 | + } |
---|
| 3609 | + |
---|
| 3610 | + void RandomLeaves(boolean h) |
---|
| 3611 | + { |
---|
| 3612 | + if (blockloop) |
---|
| 3613 | + return; |
---|
| 3614 | + |
---|
| 3615 | + if (bRep != null || material != null) // borderline... |
---|
| 3616 | + random = h; |
---|
| 3617 | + |
---|
| 3618 | + for (int i = 0; i < Size(); i++) |
---|
| 3619 | + { |
---|
| 3620 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3621 | + if (child == null) |
---|
| 3622 | + continue; |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + child.RandomLeaves(h); |
---|
3366 | 3625 | blockloop = false; |
---|
3367 | 3626 | // release(i); |
---|
3368 | 3627 | } |
---|
.. | .. |
---|
3677 | 3936 | if (child == null) |
---|
3678 | 3937 | continue; |
---|
3679 | 3938 | |
---|
3680 | | - if (GraphreeD.RENDERME > 0) |
---|
| 3939 | + if (Grafreed.RENDERME > 0) |
---|
3681 | 3940 | { |
---|
3682 | 3941 | if (child instanceof Merge) |
---|
3683 | 3942 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3828 | 4087 | if (child == null) |
---|
3829 | 4088 | continue; |
---|
3830 | 4089 | |
---|
3831 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4090 | + if (Grafreed.RENDERME > 0) |
---|
3832 | 4091 | { |
---|
3833 | 4092 | if (child instanceof Merge) |
---|
3834 | 4093 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4023 | 4282 | if (child == null) |
---|
4024 | 4283 | continue; |
---|
4025 | 4284 | |
---|
4026 | | - if (GraphreeD.RENDERME > 0) |
---|
| 4285 | + if (Grafreed.RENDERME > 0) |
---|
4027 | 4286 | { |
---|
4028 | 4287 | if (child instanceof Merge) |
---|
4029 | 4288 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4111 | 4370 | if (blockloop) |
---|
4112 | 4371 | return; |
---|
4113 | 4372 | |
---|
4114 | | - for (int i=0; i<size(); i++) |
---|
| 4373 | + for (int i=0; i<Size(); i++) |
---|
4115 | 4374 | { |
---|
4116 | 4375 | if (get(i).parent != this) |
---|
4117 | 4376 | { |
---|
.. | .. |
---|
4120 | 4379 | } |
---|
4121 | 4380 | blockloop = true; |
---|
4122 | 4381 | get(i).RepairParent(); |
---|
| 4382 | + blockloop = false; |
---|
| 4383 | + } |
---|
| 4384 | + } |
---|
| 4385 | + |
---|
| 4386 | + void RepairShadow() |
---|
| 4387 | + { |
---|
| 4388 | + if (blockloop) |
---|
| 4389 | + return; |
---|
| 4390 | + |
---|
| 4391 | + if (this.material != null) |
---|
| 4392 | + this.InitOthers(); |
---|
| 4393 | + |
---|
| 4394 | + for (int i=0; i<Size(); i++) |
---|
| 4395 | + { |
---|
| 4396 | + blockloop = true; |
---|
| 4397 | + get(i).RepairShadow(); |
---|
| 4398 | + blockloop = false; |
---|
| 4399 | + } |
---|
| 4400 | + } |
---|
| 4401 | + |
---|
| 4402 | + void RepairSOV() |
---|
| 4403 | + { |
---|
| 4404 | + if (blockloop) |
---|
| 4405 | + return; |
---|
| 4406 | + |
---|
| 4407 | + String texname = this.GetPigmentTexture(); |
---|
| 4408 | + |
---|
| 4409 | + if (texname.startsWith("sov")) |
---|
| 4410 | + { |
---|
| 4411 | + String[] s = texname.split("/"); |
---|
| 4412 | + |
---|
| 4413 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4414 | + |
---|
| 4415 | + texname = sname[0]; |
---|
| 4416 | + |
---|
| 4417 | + if (sname.length > 1) |
---|
| 4418 | + { |
---|
| 4419 | + texname += "Color.jpg"; |
---|
| 4420 | + } |
---|
| 4421 | + |
---|
| 4422 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4423 | + } |
---|
| 4424 | + |
---|
| 4425 | + texname = this.GetBumpTexture(); |
---|
| 4426 | + |
---|
| 4427 | + if (texname.startsWith("sov")) |
---|
| 4428 | + { |
---|
| 4429 | + String[] s = texname.split("/"); |
---|
| 4430 | + |
---|
| 4431 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4432 | + |
---|
| 4433 | + texname = sname[0]; |
---|
| 4434 | + |
---|
| 4435 | + if (sname.length > 1) |
---|
| 4436 | + { |
---|
| 4437 | + texname += "Bump.jpg"; |
---|
| 4438 | + } |
---|
| 4439 | + |
---|
| 4440 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + for (int i=0; i<Size(); i++) |
---|
| 4444 | + { |
---|
| 4445 | + blockloop = true; |
---|
| 4446 | + get(i).RepairSOV(); |
---|
4123 | 4447 | blockloop = false; |
---|
4124 | 4448 | } |
---|
4125 | 4449 | } |
---|
.. | .. |
---|
4614 | 4938 | |
---|
4615 | 4939 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4616 | 4940 | { |
---|
4617 | | - if (hide) |
---|
| 4941 | + if (hide || dontselect) |
---|
4618 | 4942 | return null; |
---|
4619 | 4943 | |
---|
4620 | 4944 | if (count <= 0) |
---|
.. | .. |
---|
4640 | 4964 | |
---|
4641 | 4965 | cTreePath Select(int indexcount, boolean deselect) |
---|
4642 | 4966 | { |
---|
4643 | | - if (hide) |
---|
| 4967 | + if (hide || dontselect) |
---|
4644 | 4968 | return null; |
---|
4645 | 4969 | |
---|
4646 | 4970 | if (count <= 0) |
---|
.. | .. |
---|
4790 | 5114 | return globalTransform; |
---|
4791 | 5115 | } |
---|
4792 | 5116 | |
---|
4793 | | - void PreprocessOcclusion(CameraPane cp) |
---|
| 5117 | + void PreprocessOcclusion(iCameraPane cp) |
---|
4794 | 5118 | { |
---|
4795 | 5119 | /* |
---|
4796 | 5120 | if (AOdone) |
---|
.. | .. |
---|
4937 | 5261 | } else // |
---|
4938 | 5262 | if (editWindow != null) |
---|
4939 | 5263 | { |
---|
4940 | | - editWindow.cameraView.lighttouched = true; |
---|
| 5264 | + //editWindow.cameraView.lighttouched = true; |
---|
| 5265 | + Globals.lighttouched = true; |
---|
4941 | 5266 | } |
---|
4942 | 5267 | } |
---|
4943 | 5268 | |
---|
.. | .. |
---|
5091 | 5416 | |
---|
5092 | 5417 | // System.out.println("Fullname = " + fullname); |
---|
5093 | 5418 | |
---|
5094 | | - if (fullname.name.indexOf(":") == -1) |
---|
5095 | | - return fullname.name; |
---|
| 5419 | + // Does not work on Windows due to C: |
---|
| 5420 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5421 | +// return fullname.name; |
---|
| 5422 | +// |
---|
| 5423 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5096 | 5424 | |
---|
5097 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5425 | + String[] split = fullname.name.split(":"); |
---|
| 5426 | + |
---|
| 5427 | + if (split.length == 0) |
---|
| 5428 | + { |
---|
| 5429 | + return ""; |
---|
| 5430 | + } |
---|
| 5431 | + |
---|
| 5432 | + if (split.length <= 2) |
---|
| 5433 | + { |
---|
| 5434 | + if (fullname.name.endsWith(":")) |
---|
| 5435 | + { |
---|
| 5436 | + // Windows |
---|
| 5437 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5438 | + } |
---|
| 5439 | + |
---|
| 5440 | + return split[0]; |
---|
| 5441 | + } |
---|
| 5442 | + |
---|
| 5443 | + // Windows |
---|
| 5444 | + assert(split.length == 4); |
---|
| 5445 | + |
---|
| 5446 | + return split[0] + ":" + split[1]; |
---|
5098 | 5447 | } |
---|
5099 | 5448 | |
---|
5100 | 5449 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5103 | 5452 | return ""; |
---|
5104 | 5453 | |
---|
5105 | 5454 | // System.out.println("Fullname = " + fullname); |
---|
5106 | | - if (fullname.name.indexOf(":") == -1) |
---|
5107 | | - return ""; |
---|
5108 | | - |
---|
5109 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5455 | + // Does not work on Windows due to C: |
---|
| 5456 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5457 | +// return ""; |
---|
| 5458 | +// |
---|
| 5459 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5460 | + String[] split = fullname.name.split(":"); |
---|
| 5461 | + |
---|
| 5462 | + if (split.length == 0) |
---|
| 5463 | + { |
---|
| 5464 | + return ""; |
---|
| 5465 | + } |
---|
| 5466 | + |
---|
| 5467 | + if (split.length == 1) |
---|
| 5468 | + { |
---|
| 5469 | + return ""; |
---|
| 5470 | + } |
---|
| 5471 | + |
---|
| 5472 | + if (split.length == 2) |
---|
| 5473 | + { |
---|
| 5474 | + if (fullname.name.endsWith(":")) |
---|
| 5475 | + { |
---|
| 5476 | + // Windows |
---|
| 5477 | + return ""; |
---|
| 5478 | + } |
---|
| 5479 | + |
---|
| 5480 | + return split[1]; |
---|
| 5481 | + } |
---|
| 5482 | + |
---|
| 5483 | + // Windows |
---|
| 5484 | + assert(split.length == 4); |
---|
| 5485 | + |
---|
| 5486 | + return split[2] + ":" + split[3]; |
---|
5110 | 5487 | } |
---|
5111 | 5488 | |
---|
5112 | 5489 | String GetPigmentTexture() |
---|
.. | .. |
---|
5180 | 5557 | System.out.print("; textures = " + textures); |
---|
5181 | 5558 | System.out.println("; usedtextures = " + usedtextures); |
---|
5182 | 5559 | |
---|
5183 | | - if (GetTextures() == null) |
---|
| 5560 | + if (GetTextures() == null) // What is that?? |
---|
5184 | 5561 | GetTextures().name = ":"; |
---|
5185 | 5562 | |
---|
5186 | 5563 | String texname = tex; |
---|
.. | .. |
---|
5211 | 5588 | child.ResetPigmentTexture(); |
---|
5212 | 5589 | blockloop = false; |
---|
5213 | 5590 | } |
---|
| 5591 | + } |
---|
| 5592 | + |
---|
| 5593 | + UUID GetUUID() |
---|
| 5594 | + { |
---|
| 5595 | + if (uuid == null) |
---|
| 5596 | + { |
---|
| 5597 | + // Serial |
---|
| 5598 | + uuid = UUID.randomUUID(); |
---|
| 5599 | + } |
---|
| 5600 | + |
---|
| 5601 | + return uuid; |
---|
| 5602 | + } |
---|
| 5603 | + |
---|
| 5604 | + Object3D GetObject(UUID uid) |
---|
| 5605 | + { |
---|
| 5606 | + if (blockloop) |
---|
| 5607 | + return null; |
---|
| 5608 | + |
---|
| 5609 | + if (GetUUID().equals(uid)) |
---|
| 5610 | + return this; |
---|
| 5611 | + |
---|
| 5612 | + int nb = Size(); |
---|
| 5613 | + for (int i = 0; i < nb; i++) |
---|
| 5614 | + { |
---|
| 5615 | + Object3D child = (Object3D) get(i); |
---|
| 5616 | + |
---|
| 5617 | + if (child == null) |
---|
| 5618 | + continue; |
---|
| 5619 | + |
---|
| 5620 | + blockloop = true; |
---|
| 5621 | + Object3D obj = child.GetObject(uid); |
---|
| 5622 | + blockloop = false; |
---|
| 5623 | + if (obj != null) |
---|
| 5624 | + return obj; |
---|
| 5625 | + } |
---|
| 5626 | + |
---|
| 5627 | + return null; |
---|
5214 | 5628 | } |
---|
5215 | 5629 | |
---|
5216 | 5630 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5249 | 5663 | } |
---|
5250 | 5664 | } |
---|
5251 | 5665 | |
---|
5252 | | - void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5666 | + void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5253 | 5667 | { |
---|
5254 | 5668 | Draw(display, root, selected, blocked); |
---|
5255 | 5669 | } |
---|
5256 | 5670 | |
---|
5257 | | - static cMaterial[] materialstack = new cMaterial[65536]; |
---|
5258 | | - static boolean[] selectedstack = new boolean[65536]; |
---|
5259 | | - static int materialdepth = 0; |
---|
5260 | | - |
---|
5261 | 5671 | boolean NeedSupport() |
---|
5262 | 5672 | { |
---|
5263 | 5673 | return |
---|
5264 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5674 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5265 | 5675 | // PROBLEM with CROWD!! |
---|
5266 | | - && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD); |
---|
| 5676 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5267 | 5677 | } |
---|
5268 | 5678 | |
---|
| 5679 | + static boolean DEBUG_SELECTION = false; |
---|
5269 | 5680 | |
---|
5270 | | - void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 5681 | + boolean IsLive() |
---|
| 5682 | + { |
---|
| 5683 | + if (live) |
---|
| 5684 | + return true; |
---|
| 5685 | + |
---|
| 5686 | + if (parent == null) |
---|
| 5687 | + return false; |
---|
| 5688 | + |
---|
| 5689 | + return parent.IsLive(); |
---|
| 5690 | + } |
---|
| 5691 | + |
---|
| 5692 | + void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5271 | 5693 | { |
---|
5272 | 5694 | Invariants(); // june 2013 |
---|
5273 | 5695 | |
---|
.. | .. |
---|
5276 | 5698 | // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame); |
---|
5277 | 5699 | } |
---|
5278 | 5700 | |
---|
5279 | | - if (display.drawMode == CameraPane.SELECTION && |
---|
5280 | | - hide) |
---|
| 5701 | + if (display.DrawMode() == iCameraPane.SELECTION && |
---|
| 5702 | + (hide || dontselect)) |
---|
5281 | 5703 | return; |
---|
5282 | 5704 | |
---|
5283 | 5705 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5295 | 5717 | if (this instanceof Checker) |
---|
5296 | 5718 | return; |
---|
5297 | 5719 | |
---|
5298 | | - if (display.drawMode == display.SHADOW && PASSTEST) |
---|
| 5720 | + if (display.DrawMode() == display.SHADOW && PASSTEST) |
---|
5299 | 5721 | return; |
---|
5300 | 5722 | |
---|
5301 | 5723 | if (count <= 0) |
---|
.. | .. |
---|
5303 | 5725 | return; |
---|
5304 | 5726 | } |
---|
5305 | 5727 | |
---|
5306 | | - if ((//display.drawMode == CameraPane.SHADOW || |
---|
5307 | | - display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency()) |
---|
| 5728 | + if ((//display.DrawMode() == CameraPane.SHADOW || |
---|
| 5729 | + display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency()) |
---|
5308 | 5730 | { |
---|
5309 | 5731 | return; |
---|
5310 | 5732 | } |
---|
5311 | 5733 | |
---|
5312 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 5734 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5313 | 5735 | |
---|
5314 | 5736 | /* |
---|
5315 | 5737 | if (touched) |
---|
.. | .. |
---|
5328 | 5750 | support = support; |
---|
5329 | 5751 | |
---|
5330 | 5752 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5331 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5753 | + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5332 | 5754 | |
---|
5333 | 5755 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5334 | 5756 | { |
---|
.. | .. |
---|
5345 | 5767 | |
---|
5346 | 5768 | boolean compiled = false; |
---|
5347 | 5769 | |
---|
5348 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 5770 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5349 | 5771 | |
---|
5350 | | - if (!selectmode && //display.drawMode != display.SELECTION && |
---|
5351 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5772 | + if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
| 5773 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5774 | + (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5352 | 5775 | { |
---|
5353 | | - display.lighttouched = true; |
---|
| 5776 | + Globals.lighttouched = true; |
---|
5354 | 5777 | } // all panes... |
---|
5355 | | - //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW && |
---|
5356 | | - if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW && |
---|
| 5778 | + |
---|
| 5779 | + //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
| 5780 | + if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5357 | 5781 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5358 | 5782 | { |
---|
5359 | 5783 | if (!(this instanceof Composite)) |
---|
.. | .. |
---|
5361 | 5785 | //if (displaylist == -1 && usecalllists) |
---|
5362 | 5786 | if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
5363 | 5787 | { |
---|
5364 | | - bRep.displaylist = gl.glGenLists(1); |
---|
| 5788 | + bRep.displaylist = display.GenList(); |
---|
5365 | 5789 | assert(bRep.displaylist != 0); |
---|
5366 | 5790 | // System.err.println("glGenLists: " + bRep.displaylist + " for " + this); |
---|
5367 | 5791 | //System.out.println("\tgen list " + list); |
---|
.. | .. |
---|
5373 | 5797 | if (usecalllists) |
---|
5374 | 5798 | { |
---|
5375 | 5799 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5376 | | - gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE); |
---|
| 5800 | + display.NewList(bRep.displaylist); |
---|
5377 | 5801 | } |
---|
| 5802 | + |
---|
5378 | 5803 | CallList(display, root, selected, blocked); |
---|
| 5804 | + |
---|
5379 | 5805 | // compiled = true; |
---|
5380 | 5806 | if (usecalllists) |
---|
5381 | 5807 | { |
---|
5382 | 5808 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5383 | | - gl.glEndList(); |
---|
| 5809 | + display.EndList(); |
---|
5384 | 5810 | } |
---|
5385 | 5811 | //gl.glDrawBuffer(gl.GL_BACK); |
---|
5386 | 5812 | // XXX touched = false; |
---|
5387 | | - display.lighttouched = true; // all panes... |
---|
| 5813 | + Globals.lighttouched = true; // all panes... |
---|
5388 | 5814 | } |
---|
5389 | 5815 | |
---|
5390 | 5816 | touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
.. | .. |
---|
5423 | 5849 | |
---|
5424 | 5850 | // frustum culling |
---|
5425 | 5851 | if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid |
---|
5426 | | - && display.drawMode != CameraPane.SELECTION) |
---|
| 5852 | + && display.DrawMode() != iCameraPane.SELECTION) |
---|
5427 | 5853 | { |
---|
5428 | | - if (display.drawMode == CameraPane.SHADOW) |
---|
| 5854 | + if (display.DrawMode() == iCameraPane.SHADOW) |
---|
5429 | 5855 | { |
---|
5430 | 5856 | if (!link2master // tricky to cull in shadow mode. |
---|
5431 | | - && GetBRep().FrustumCull(this, gl, display.lightCamera, true)) |
---|
| 5857 | + && GetBRep().FrustumCull(this, null, display.LightCamera(), true)) |
---|
5432 | 5858 | { |
---|
5433 | 5859 | //System.out.print("CULLED"); |
---|
5434 | 5860 | culled = true; |
---|
.. | .. |
---|
5436 | 5862 | } |
---|
5437 | 5863 | else |
---|
5438 | 5864 | //GetBRep().getBounds(v0, v1, this); |
---|
5439 | | - if (GetBRep().FrustumCull(this, gl, display.renderCamera, false)) |
---|
| 5865 | + if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false)) |
---|
5440 | 5866 | culled = true; |
---|
5441 | 5867 | |
---|
5442 | 5868 | // LA.xformPos(v0, display.renderCamera.toScreen, v0); |
---|
.. | .. |
---|
5472 | 5898 | |
---|
5473 | 5899 | |
---|
5474 | 5900 | if (!culled) |
---|
5475 | | - if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION) |
---|
| 5901 | + if (display.DrawMode() == display.SELECTION || display.IsDebugSelection()) |
---|
5476 | 5902 | { |
---|
5477 | 5903 | if (GetBRep() != null) |
---|
5478 | 5904 | { |
---|
5479 | | - CameraPane.NextIndex(this, gl); |
---|
| 5905 | + display.NextIndex(); |
---|
5480 | 5906 | // vertex color conflict : gl.glCallList(list); |
---|
5481 | 5907 | DrawNode(display, root, selected); |
---|
5482 | 5908 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5498 | 5924 | color[2] /= 2; |
---|
5499 | 5925 | gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0); |
---|
5500 | 5926 | */ |
---|
5501 | | - if (material != null) |
---|
5502 | | - { |
---|
5503 | | - materialstack[materialdepth] = material; |
---|
5504 | | - selectedstack[materialdepth] = selected; |
---|
5505 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5506 | | - //System.out.println("material " + material); |
---|
5507 | | - //Applet3D.tracein(this, selected); |
---|
5508 | | - display.vector2buffer = projectedVertices; |
---|
5509 | | - if (this instanceof Camera) |
---|
5510 | | - { |
---|
5511 | | - display.options1[0] = material.shift; |
---|
5512 | | - //System.out.println("shift " + material.shift); |
---|
5513 | | - display.options1[1] = material.lightarea; |
---|
5514 | | - display.options1[2] = material.shadowbias; |
---|
5515 | | - display.options1[3] = material.aniso; |
---|
5516 | | - display.options1[4] = material.anisoV; |
---|
5517 | | - display.options2[0] = material.opacity; |
---|
5518 | | - display.options2[1] = material.diffuse; |
---|
5519 | | - display.options2[2] = material.factor; |
---|
5520 | | - |
---|
5521 | | - cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3); |
---|
5522 | | - display.options3[3] = material.cameralight/0.2f; |
---|
5523 | | - |
---|
5524 | | - // if (display.CURRENTANTIALIAS > 0) |
---|
5525 | | - // display.options3[3] /= 4; |
---|
5526 | | - |
---|
5527 | | - /* |
---|
5528 | | - System.out.println("Focus = " + display.options1[0]); |
---|
5529 | | - System.out.println("Aperture = " + display.options1[1]); |
---|
5530 | | - System.out.println("ShadowBlur = " + display.options1[2]); |
---|
5531 | | - System.out.println("Antialiasing = " + display.options1[3]); |
---|
5532 | | - System.out.println("Fog = " + display.options2[0]); |
---|
5533 | | - System.out.println("Intensity = " + display.options2[1]); |
---|
5534 | | - System.out.println("Elevation = " + display.options2[2]); |
---|
5535 | | - /**/ |
---|
5536 | | - } else |
---|
5537 | | - { |
---|
5538 | | - material.Draw(display, selected); |
---|
5539 | | - } |
---|
5540 | | - } else |
---|
5541 | | - { |
---|
5542 | | - if (selected && CameraPane.flash) |
---|
5543 | | - { |
---|
5544 | | - display.modelParams4[1] = 100; |
---|
5545 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5546 | | - } |
---|
5547 | | - } |
---|
| 5927 | + display.PushMaterial(this, selected); |
---|
5548 | 5928 | |
---|
5549 | 5929 | //System.out.println("call list " + list); |
---|
5550 | 5930 | //System.out.println(); |
---|
.. | .. |
---|
5563 | 5943 | tex = GetTextures(); |
---|
5564 | 5944 | } |
---|
5565 | 5945 | |
---|
5566 | | - display.BindTextures(tex, texres); |
---|
| 5946 | + boolean failedPigment = false; |
---|
| 5947 | + boolean failedBump = false; |
---|
| 5948 | + |
---|
| 5949 | + try |
---|
| 5950 | + { |
---|
| 5951 | + display.BindPigmentTexture(tex, texres); |
---|
| 5952 | + } |
---|
| 5953 | + catch (Exception e) |
---|
| 5954 | + { |
---|
| 5955 | + System.err.println("FAILED: " + this); |
---|
| 5956 | + failedPigment = true; |
---|
| 5957 | + } |
---|
| 5958 | + |
---|
| 5959 | + try |
---|
| 5960 | + { |
---|
| 5961 | + display.BindBumpTexture(tex, texres); |
---|
| 5962 | + } |
---|
| 5963 | + catch (Exception e) |
---|
| 5964 | + { |
---|
| 5965 | + //System.err.println("FAILED: " + this); |
---|
| 5966 | + failedBump = true; |
---|
| 5967 | + } |
---|
5567 | 5968 | |
---|
5568 | 5969 | if (!compiled) |
---|
5569 | 5970 | { |
---|
.. | .. |
---|
5579 | 5980 | |
---|
5580 | 5981 | // System.err.println("glCallList: " + bRep.displaylist + " for " + this); |
---|
5581 | 5982 | assert(bRep.displaylist != 0); |
---|
5582 | | - gl.glCallList(bRep.displaylist); |
---|
| 5983 | + display.CallList(bRep.displaylist); |
---|
5583 | 5984 | // june 2013 drawSelf(display, root, selected); |
---|
5584 | 5985 | } |
---|
5585 | 5986 | } |
---|
5586 | 5987 | } |
---|
5587 | 5988 | |
---|
5588 | | - display.ReleaseTextures(tex); |
---|
5589 | | - |
---|
5590 | | - //if (parent != null && parent.GetMaterial() != null) |
---|
5591 | | - // parent.GetMaterial().Draw(display, parent.IsSelected(this)); |
---|
5592 | | - if (material != null) |
---|
5593 | | - { |
---|
5594 | | - materialdepth -= 1; |
---|
5595 | | - if (materialdepth > 0) |
---|
5596 | | - { |
---|
5597 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5598 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5599 | | - } |
---|
5600 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5601 | | - } else if (selected && CameraPane.flash && GetMaterial() != null) |
---|
5602 | | - { |
---|
5603 | | - display.modelParams4[1] = GetMaterial().cameralight; |
---|
5604 | | - gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0); |
---|
5605 | | - } |
---|
| 5989 | + if (!failedBump) |
---|
| 5990 | + display.ReleaseBumpTexture(tex); |
---|
| 5991 | + |
---|
| 5992 | + if (!failedPigment) |
---|
| 5993 | + display.ReleasePigmentTexture(tex); |
---|
| 5994 | + |
---|
| 5995 | + display.PopMaterial(this, selected); |
---|
5606 | 5996 | } |
---|
5607 | 5997 | |
---|
5608 | 5998 | if (this instanceof Texture || this instanceof TextureNode) |
---|
.. | .. |
---|
5644 | 6034 | // resetMasterNode(); |
---|
5645 | 6035 | } |
---|
5646 | 6036 | |
---|
5647 | | - void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 6037 | + void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5648 | 6038 | { |
---|
5649 | 6039 | if (GetBRep() == null) |
---|
5650 | 6040 | { |
---|
.. | .. |
---|
5727 | 6117 | boolean flipV = false; // true; |
---|
5728 | 6118 | int texres = 0; // 0 = low, 1 = normal, 2 = high res texture |
---|
5729 | 6119 | |
---|
5730 | | - void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
| 6120 | + void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5731 | 6121 | { |
---|
| 6122 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6123 | + return; |
---|
| 6124 | + |
---|
5732 | 6125 | if (hide) |
---|
5733 | 6126 | return; |
---|
5734 | 6127 | // shadow optimisation |
---|
.. | .. |
---|
5786 | 6179 | // // ??????????????????????????? Touch(); |
---|
5787 | 6180 | // } |
---|
5788 | 6181 | |
---|
5789 | | - if (material != null) |
---|
5790 | | - { |
---|
5791 | | - materialstack[materialdepth] = material; |
---|
5792 | | - selectedstack[materialdepth] = selected; |
---|
5793 | | - cStatic.objectstack[materialdepth++] = this; |
---|
5794 | | - //System.out.println("material " + material); |
---|
5795 | | - //Applet3D.tracein("selected ", selected); |
---|
5796 | | - display.vector2buffer = projectedVertices; |
---|
5797 | | - material.Draw(display, selected); |
---|
5798 | | - } |
---|
| 6182 | +display.PushMaterial2(this, selected); |
---|
5799 | 6183 | |
---|
5800 | 6184 | Object3D child; |
---|
5801 | 6185 | boolean sel; |
---|
.. | .. |
---|
5819 | 6203 | if (!child.HasTransparency()) |
---|
5820 | 6204 | { |
---|
5821 | 6205 | sel = root != null && root.selection != null && root.selection.indexOf(child) != -1; |
---|
5822 | | - // GraphreeD.tracein("draw ", child); |
---|
| 6206 | + // GrafreeD.tracein("draw ", child); |
---|
5823 | 6207 | boolean wasblocked = blockdraw; |
---|
5824 | 6208 | blockdraw = true; |
---|
5825 | 6209 | child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected()); |
---|
5826 | 6210 | blockdraw = false; |
---|
5827 | | - // GraphreeD.traceout("draw ", child); |
---|
| 6211 | + // GrafreeD.traceout("draw ", child); |
---|
5828 | 6212 | } |
---|
5829 | 6213 | |
---|
5830 | 6214 | release(i); |
---|
.. | .. |
---|
5847 | 6231 | */ |
---|
5848 | 6232 | //depth += 1; |
---|
5849 | 6233 | |
---|
5850 | | - if (material != null) |
---|
5851 | | - { |
---|
5852 | | - materialdepth -= 1; |
---|
5853 | | - if (materialdepth > 0) |
---|
5854 | | - { |
---|
5855 | | - display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices; |
---|
5856 | | - materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]); |
---|
5857 | | - } |
---|
5858 | | - //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???"); |
---|
5859 | | - //else |
---|
5860 | | - //material.Draw(display, false); |
---|
5861 | | - } |
---|
5862 | | - |
---|
| 6234 | +display.PopMaterial2(this); |
---|
5863 | 6235 | /* |
---|
5864 | 6236 | display.ReleaseTextures(tex); |
---|
5865 | 6237 | */ |
---|
.. | .. |
---|
5870 | 6242 | |
---|
5871 | 6243 | //static cVector min,max; |
---|
5872 | 6244 | |
---|
5873 | | - void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
| 6245 | + void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected) |
---|
5874 | 6246 | { |
---|
5875 | | - if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 6247 | + if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5876 | 6248 | return; // no shadow for transparent objects |
---|
| 6249 | + |
---|
| 6250 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6251 | + return; |
---|
5877 | 6252 | |
---|
5878 | 6253 | if (hide) |
---|
5879 | 6254 | return; |
---|
.. | .. |
---|
5915 | 6290 | return; |
---|
5916 | 6291 | } |
---|
5917 | 6292 | |
---|
| 6293 | + //bRep.GenUV(1/material.diffuseness); |
---|
5918 | 6294 | // bRep.lock = true; |
---|
5919 | 6295 | |
---|
5920 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
| 6296 | + //javax.media.opengl.GL gl = display.GetGL(); |
---|
5921 | 6297 | |
---|
5922 | | - if (CameraPane.BOXMODE) // || CameraPane.movingcamera) |
---|
| 6298 | + if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera) |
---|
5923 | 6299 | { |
---|
5924 | 6300 | int fc = bRep.FaceCount(); |
---|
5925 | 6301 | int vc = bRep.VertexCount(); |
---|
.. | .. |
---|
5934 | 6310 | |
---|
5935 | 6311 | bRep.getMinMax(min, max, 100); |
---|
5936 | 6312 | |
---|
5937 | | - gl.glBegin(gl.GL_LINES); |
---|
5938 | | - |
---|
5939 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5940 | | - gl.glVertex3d(min.x, min.y, max.z); |
---|
5941 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5942 | | - gl.glVertex3d(min.x, max.y, min.z); |
---|
5943 | | - gl.glVertex3d(min.x, min.y, min.z); |
---|
5944 | | - gl.glVertex3d(max.x, min.y, min.z); |
---|
5945 | | - |
---|
5946 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5947 | | - gl.glVertex3d(min.x, max.y, max.z); |
---|
5948 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5949 | | - gl.glVertex3d(max.x, min.y, max.z); |
---|
5950 | | - gl.glVertex3d(max.x, max.y, max.z); |
---|
5951 | | - gl.glVertex3d(max.x, max.y, min.z); |
---|
5952 | | - |
---|
5953 | | - gl.glEnd(); |
---|
| 6313 | + display.DrawBox(min, max); |
---|
5954 | 6314 | |
---|
5955 | 6315 | return; |
---|
5956 | 6316 | } |
---|
.. | .. |
---|
5994 | 6354 | { |
---|
5995 | 6355 | //throw new Error(); |
---|
5996 | 6356 | |
---|
5997 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
| 6357 | + boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5998 | 6358 | |
---|
5999 | 6359 | int[] strips = bRep.getRawIndices(); |
---|
6000 | 6360 | |
---|
.. | .. |
---|
6004 | 6364 | new Exception().printStackTrace(); |
---|
6005 | 6365 | return; |
---|
6006 | 6366 | } |
---|
6007 | | - |
---|
6008 | | - // TRIANGLE STRIP ARRAY |
---|
6009 | | - if (bRep.trimmed) |
---|
| 6367 | + |
---|
| 6368 | + if (dontselect) |
---|
6010 | 6369 | { |
---|
6011 | | - float[] v = bRep.getRawVertices(); |
---|
6012 | | - float[] n = bRep.getRawNormals(); |
---|
6013 | | - float[] c = bRep.getRawColors(); |
---|
6014 | | - float[] uv = bRep.getRawUVMap(); |
---|
6015 | | - |
---|
6016 | | - int count2 = 0; |
---|
6017 | | - int count3 = 0; |
---|
6018 | | - |
---|
6019 | | - if (n.length > 0) |
---|
6020 | | - { |
---|
6021 | | - for (int i = 0; i < strips.length; i++) |
---|
6022 | | - { |
---|
6023 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6024 | | - |
---|
6025 | | - /* |
---|
6026 | | - boolean locked = false; |
---|
6027 | | - float eps = 0.1f; |
---|
6028 | | - boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6029 | | - |
---|
6030 | | - int dot = 0; |
---|
6031 | | - |
---|
6032 | | - if ((dot&1) == 0) |
---|
6033 | | - dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6034 | | - |
---|
6035 | | - if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6036 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6037 | | - else |
---|
6038 | | - { |
---|
6039 | | - locked = true; |
---|
6040 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6041 | | - } |
---|
6042 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6043 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6044 | | - if (hasnorm) |
---|
6045 | | - { |
---|
6046 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6047 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6048 | | - } |
---|
6049 | | - |
---|
6050 | | - if ((dot&4) == 0) |
---|
6051 | | - dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6052 | | - |
---|
6053 | | - if (wrap || !locked && (dot&8) != 0) |
---|
6054 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6055 | | - else |
---|
6056 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6057 | | - |
---|
6058 | | - f.dot = dot; |
---|
6059 | | - */ |
---|
6060 | | - |
---|
6061 | | - if (!selectmode) |
---|
6062 | | - { |
---|
6063 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6064 | | - { |
---|
6065 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6066 | | - } else |
---|
6067 | | - { |
---|
6068 | | - gl.glNormal3f(0, 0, 1); |
---|
6069 | | - } |
---|
6070 | | - |
---|
6071 | | - if (c != null) |
---|
6072 | | - //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]); |
---|
6073 | | - { |
---|
6074 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6075 | | - } |
---|
6076 | | - } |
---|
6077 | | - if (flipV) |
---|
6078 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6079 | | - else |
---|
6080 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6081 | | - //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6082 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6083 | | - |
---|
6084 | | - count2 += 2; |
---|
6085 | | - count3 += 3; |
---|
6086 | | - if (!selectmode) |
---|
6087 | | - { |
---|
6088 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6089 | | - { |
---|
6090 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6091 | | - } else |
---|
6092 | | - { |
---|
6093 | | - gl.glNormal3f(0, 0, 1); |
---|
6094 | | - } |
---|
6095 | | - if (c != null) |
---|
6096 | | - { |
---|
6097 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6098 | | - } |
---|
6099 | | - } |
---|
6100 | | - if (flipV) |
---|
6101 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6102 | | - else |
---|
6103 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6104 | | - //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]); |
---|
6105 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6106 | | - |
---|
6107 | | - count2 += 2; |
---|
6108 | | - count3 += 3; |
---|
6109 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6110 | | - { |
---|
6111 | | - //gl.glTexCoord2d(...); |
---|
6112 | | - if (!selectmode) |
---|
6113 | | - { |
---|
6114 | | - if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0) |
---|
6115 | | - { |
---|
6116 | | - gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]); |
---|
6117 | | - } else |
---|
6118 | | - { |
---|
6119 | | - gl.glNormal3f(0, 0, 1); |
---|
6120 | | - } |
---|
6121 | | - if (c != null) |
---|
6122 | | - { |
---|
6123 | | - gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1); |
---|
6124 | | - } |
---|
6125 | | - } |
---|
6126 | | - |
---|
6127 | | - if (flipV) |
---|
6128 | | - gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]); |
---|
6129 | | - else |
---|
6130 | | - gl.glTexCoord2f(uv[count2], uv[count2 + 1]); |
---|
6131 | | - //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]); |
---|
6132 | | - gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]); |
---|
6133 | | - count2 += 2; |
---|
6134 | | - count3 += 3; |
---|
6135 | | - } |
---|
6136 | | - |
---|
6137 | | - gl.glEnd(); |
---|
6138 | | - } |
---|
6139 | | - } |
---|
6140 | | - |
---|
6141 | | - assert count3 == v.length; |
---|
| 6370 | + //bRep.GenerateNormalsMINE(); |
---|
6142 | 6371 | } |
---|
6143 | | - else // !trimmed |
---|
6144 | | - { |
---|
6145 | | - int count = 0; |
---|
6146 | | - for (int i = 0; i < strips.length; i++) |
---|
6147 | | - { |
---|
6148 | | - gl.glBegin(gl.GL_TRIANGLE_STRIP); |
---|
6149 | | - |
---|
6150 | | - Vertex p = bRep.GetVertex(bRep.indices[count++]); |
---|
6151 | | - Vertex q = bRep.GetVertex(bRep.indices[count++]); |
---|
6152 | | - |
---|
6153 | | - drawVertex(gl, p, selectmode); |
---|
6154 | | - drawVertex(gl, q, selectmode); |
---|
6155 | | - |
---|
6156 | | - for (int j = 0; j < strips[i] - 2; j++) |
---|
6157 | | - { |
---|
6158 | | - Vertex r = bRep.GetVertex(bRep.indices[count++]); |
---|
6159 | | - |
---|
6160 | | -// if (j%2 == 0) |
---|
6161 | | -// drawFace(p, q, r, display, null); |
---|
6162 | | -// else |
---|
6163 | | -// drawFace(p, r, q, display, null); |
---|
6164 | | - |
---|
6165 | | -// p = q; |
---|
6166 | | -// q = r; |
---|
6167 | | - drawVertex(gl, r, selectmode); |
---|
6168 | | - } |
---|
6169 | | - |
---|
6170 | | - gl.glEnd(); |
---|
6171 | | - } |
---|
6172 | | - } |
---|
| 6372 | + |
---|
| 6373 | + display.DrawGeometry(bRep, flipV, selectmode); |
---|
6173 | 6374 | } else // catch (Error e) |
---|
6174 | 6375 | { |
---|
6175 | 6376 | // TRIANGLE ARRAY |
---|
6176 | 6377 | if (IsOpaque()) // Static()) |
---|
6177 | 6378 | { |
---|
6178 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6379 | + display.StartTriangles(); |
---|
6179 | 6380 | int facecount = bRep.FaceCount(); |
---|
6180 | 6381 | for (int i = 0; i < facecount; i++) |
---|
6181 | 6382 | { |
---|
.. | .. |
---|
6238 | 6439 | // // r.norm.dot(v3) > -0.5) |
---|
6239 | 6440 | // // continue; |
---|
6240 | 6441 | |
---|
6241 | | - drawFace(p, q, r, display, face); |
---|
| 6442 | + display.DrawFace(this, p, q, r, face); |
---|
6242 | 6443 | } |
---|
6243 | | - gl.glEnd(); |
---|
| 6444 | + display.EndTriangles(); |
---|
6244 | 6445 | } |
---|
6245 | 6446 | else |
---|
6246 | 6447 | { |
---|
.. | .. |
---|
6269 | 6470 | //System.out.println("SORT"); |
---|
6270 | 6471 | |
---|
6271 | 6472 | java.util.Arrays.sort(facescompare); |
---|
6272 | | - |
---|
6273 | | - gl.glBegin(gl.GL_TRIANGLES); |
---|
| 6473 | + |
---|
| 6474 | + display.StartTriangles(); |
---|
6274 | 6475 | for (int i = 0; i < facecount; i++) |
---|
6275 | 6476 | { |
---|
6276 | 6477 | Face face = bRep.GetFace(facescompare[i].index); |
---|
.. | .. |
---|
6282 | 6483 | Vertex q = bRep.GetVertex(face.q); |
---|
6283 | 6484 | Vertex r = bRep.GetVertex(face.r); |
---|
6284 | 6485 | |
---|
6285 | | - drawFace(p, q, r, display, face); |
---|
| 6486 | + display.DrawFace(this, p, q, r, face); |
---|
6286 | 6487 | } |
---|
6287 | | - gl.glEnd(); |
---|
| 6488 | + display.EndTriangles(); |
---|
6288 | 6489 | } |
---|
6289 | 6490 | |
---|
6290 | 6491 | if (false) // live && support != null && support.bRep != null) // debug weights |
---|
6291 | 6492 | { |
---|
| 6493 | + /* |
---|
6292 | 6494 | gl.glDisable(gl.GL_LIGHTING); |
---|
6293 | 6495 | float[] colorV = new float[3]; |
---|
6294 | 6496 | |
---|
.. | .. |
---|
6367 | 6569 | // gl.glEnd(); |
---|
6368 | 6570 | } |
---|
6369 | 6571 | } |
---|
| 6572 | + */ |
---|
6370 | 6573 | } |
---|
6371 | 6574 | } |
---|
6372 | 6575 | |
---|
.. | .. |
---|
6411 | 6614 | center.add(r); |
---|
6412 | 6615 | center.mul(1.0/3); |
---|
6413 | 6616 | |
---|
6414 | | - center.sub(CameraPane.theRenderer.eyeCamera.location); |
---|
| 6617 | + center.sub(Globals.theRenderer.EyeCamera().location); |
---|
6415 | 6618 | |
---|
6416 | 6619 | distance = center.dot(center); |
---|
6417 | 6620 | } |
---|
.. | .. |
---|
6422 | 6625 | |
---|
6423 | 6626 | transient FaceCompare[] facescompare = null; |
---|
6424 | 6627 | |
---|
6425 | | - void SetColor(CameraPane display, Vertex p0) |
---|
6426 | | - { |
---|
6427 | | - if (display.RENDERPROGRAM == 0) |
---|
6428 | | - { |
---|
6429 | | - float r = 0; |
---|
6430 | | - if (bRep != null) |
---|
6431 | | - { |
---|
6432 | | - if (bRep.stripified) |
---|
6433 | | - { |
---|
6434 | | - r = 1; |
---|
6435 | | - } |
---|
6436 | | - } |
---|
6437 | | - float g = 0; |
---|
6438 | | - if (bRep != null) |
---|
6439 | | - { |
---|
6440 | | - if (bRep.trimmed) |
---|
6441 | | - { |
---|
6442 | | - g = 1; |
---|
6443 | | - } |
---|
6444 | | - } |
---|
6445 | | - float b = 0; |
---|
6446 | | - if (support != null && link2master) |
---|
6447 | | - { |
---|
6448 | | - b = 1; |
---|
6449 | | - } |
---|
6450 | | - display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO); |
---|
6451 | | - return; |
---|
6452 | | - } |
---|
6453 | | - |
---|
6454 | | - if (display.drawMode != CameraPane.SHADOW) |
---|
6455 | | - return; |
---|
6456 | | - |
---|
6457 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6458 | | -// if (true) return; |
---|
6459 | | -// float ao = p.AO; |
---|
6460 | | -// |
---|
6461 | | -// // if (ao == 0 && !bRep.AOdone) // transient problem! |
---|
6462 | | -// // ao = 1; |
---|
6463 | | -// |
---|
6464 | | -// gl.glColor4f(ao, ao, ao, 1); |
---|
6465 | | - |
---|
6466 | | -// CameraPane.selectedpoint. |
---|
6467 | | -// getAverage(cStatic.point1, true); |
---|
6468 | | - if (CameraPane.pointflow == null) // !random) // live) |
---|
6469 | | - { |
---|
6470 | | - return; |
---|
6471 | | - } |
---|
6472 | | - |
---|
6473 | | - cStatic.point1.set(0,0,0); |
---|
6474 | | - LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1); |
---|
6475 | | - |
---|
6476 | | - cStatic.point1.sub(p0); |
---|
6477 | | - |
---|
6478 | | - |
---|
6479 | | -// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta? |
---|
6480 | | -// { |
---|
6481 | | -// return; |
---|
6482 | | -// } |
---|
6483 | | - |
---|
6484 | | - //if (true) |
---|
6485 | | - if (cStatic.point1.dot(cStatic.point1) > 0.000001) |
---|
6486 | | - { |
---|
6487 | | - return; |
---|
6488 | | - } |
---|
6489 | | - |
---|
6490 | | - float[] colorV = new float[3]; |
---|
6491 | | - |
---|
6492 | | - if (false) // marked) |
---|
6493 | | - { |
---|
6494 | | - // debug rigging weights |
---|
6495 | | - for (int object = 0; object < p0.vertexlinks.length; object++) |
---|
6496 | | - { |
---|
6497 | | - float weight = p0.weights[object] / p0.totalweight; |
---|
6498 | | - |
---|
6499 | | - // if (weight < 0.1) |
---|
6500 | | - // { |
---|
6501 | | - // assert(weight == 0); |
---|
6502 | | - // continue; |
---|
6503 | | - // } |
---|
6504 | | - |
---|
6505 | | - if (p0.vertexlinks[object] == -1) |
---|
6506 | | - continue; |
---|
6507 | | - |
---|
6508 | | - Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]); |
---|
6509 | | - |
---|
6510 | | - int color = //1 << object; // |
---|
6511 | | - //p.vertexlinks.length; |
---|
6512 | | - support.bRep.supports[p0.closestsupport].links[object]; |
---|
6513 | | - colorV[2] += (color & 1) * weight; |
---|
6514 | | - colorV[1] += ((color & 2) >> 1) * weight; |
---|
6515 | | - colorV[0] += ((color & 4) >> 2) * weight; |
---|
6516 | | - } |
---|
6517 | | - } |
---|
6518 | | - else |
---|
6519 | | - { |
---|
6520 | | - if (drawingstarted) |
---|
6521 | | - { |
---|
6522 | | - // find next point |
---|
6523 | | - if (bRep.GetVertex(0).faceindices == null) |
---|
6524 | | - { |
---|
6525 | | - bRep.InitFaceIndices(); |
---|
6526 | | - } |
---|
6527 | | - |
---|
6528 | | - double ymin = p0.y; |
---|
6529 | | - |
---|
6530 | | - Vertex newp = p0; |
---|
6531 | | - |
---|
6532 | | - for (int fii = 0; fii < p0.faceindices.length; fii++) |
---|
6533 | | - { |
---|
6534 | | - int fi = p0.faceindices[fii]; |
---|
6535 | | - |
---|
6536 | | - if (fi == -1) |
---|
6537 | | - break; |
---|
6538 | | - |
---|
6539 | | - Face f = bRep.GetFace(fi); |
---|
6540 | | - |
---|
6541 | | - Vertex p = bRep.GetVertex(f.p); |
---|
6542 | | - Vertex q = bRep.GetVertex(f.q); |
---|
6543 | | - Vertex r = bRep.GetVertex(f.r); |
---|
6544 | | - |
---|
6545 | | - int swap = (int)(Math.random()*3); |
---|
6546 | | - |
---|
6547 | | -// for (int s=swap; --s>=0;) |
---|
6548 | | -// { |
---|
6549 | | -// Vertex t = p; |
---|
6550 | | -// p = q; |
---|
6551 | | -// q = r; |
---|
6552 | | -// r = t; |
---|
6553 | | -// } |
---|
6554 | | - if (ymin > p.y) |
---|
6555 | | - { |
---|
6556 | | - ymin = p.y; |
---|
6557 | | - newp = p; |
---|
6558 | | -// break; |
---|
6559 | | - } |
---|
6560 | | - if (ymin > q.y) |
---|
6561 | | - { |
---|
6562 | | - ymin = q.y; |
---|
6563 | | - newp = q; |
---|
6564 | | -// break; |
---|
6565 | | - } |
---|
6566 | | - if (ymin > r.y) |
---|
6567 | | - { |
---|
6568 | | - ymin = r.y; |
---|
6569 | | - newp = r; |
---|
6570 | | -// break; |
---|
6571 | | - } |
---|
6572 | | - } |
---|
6573 | | - |
---|
6574 | | - CameraPane.selectedpoint.toParent[3][0] = newp.x; |
---|
6575 | | - CameraPane.selectedpoint.toParent[3][1] = newp.y; |
---|
6576 | | - CameraPane.selectedpoint.toParent[3][2] = newp.z; |
---|
6577 | | - |
---|
6578 | | - drawingstarted = false; |
---|
6579 | | - |
---|
6580 | | - // return; |
---|
6581 | | - } |
---|
6582 | | - |
---|
6583 | | - if (false) // CameraPane.DRAW |
---|
6584 | | - { |
---|
6585 | | - p0.AO = colorV[0] = 2; |
---|
6586 | | - colorV[1] = 2; |
---|
6587 | | - colorV[2] = 2; |
---|
6588 | | - } |
---|
6589 | | - |
---|
6590 | | - CameraPane.pointflow.add(p0); |
---|
6591 | | - CameraPane.pointflow.Touch(); |
---|
6592 | | - } |
---|
6593 | | - |
---|
6594 | | -// gl.glColor3f(colorV[0], colorV[1], colorV[2]); |
---|
6595 | | -// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0); |
---|
6596 | | -// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0); |
---|
6597 | | - } |
---|
6598 | | - |
---|
6599 | 6628 | void Print(Vertex v) |
---|
6600 | 6629 | { |
---|
6601 | 6630 | //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")"); |
---|
6602 | 6631 | } |
---|
6603 | 6632 | |
---|
6604 | | - void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode) |
---|
6605 | | - { |
---|
6606 | | - if (!selectmode) |
---|
6607 | | - { |
---|
6608 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6609 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6610 | | - |
---|
6611 | | - if (flipV) |
---|
6612 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6613 | | - else |
---|
6614 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6615 | | - } |
---|
6616 | | - |
---|
6617 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6618 | | - } |
---|
6619 | | - |
---|
6620 | | - void drawFace(Vertex pv, Vertex qv, Vertex rv, |
---|
6621 | | - CameraPane display, Face face) |
---|
6622 | | - { |
---|
6623 | | - if (pv.y == -10000 || |
---|
6624 | | - qv.y == -10000 || |
---|
6625 | | - rv.y == -10000) |
---|
6626 | | - return; |
---|
6627 | | - |
---|
6628 | | -// float b = f.nbiterations & 1; |
---|
6629 | | -// float g = (f.nbiterations>>1) & 1; |
---|
6630 | | -// float r = (f.nbiterations>>2) & 1; |
---|
6631 | | -// |
---|
6632 | | -// //if (f.weight == 10000) |
---|
6633 | | -// //{ |
---|
6634 | | -// // r = 1; g = b = 0; |
---|
6635 | | -// //} |
---|
6636 | | -// //else |
---|
6637 | | -// //{ |
---|
6638 | | -// // assert(f.weight < 10000); |
---|
6639 | | -// r = g = b = (float)bRep.FaceWeight(f)*100; |
---|
6640 | | -// if (r<0) |
---|
6641 | | -// assert(r>=0); |
---|
6642 | | -// //} |
---|
6643 | | - |
---|
6644 | | - javax.media.opengl.GL gl = display.GetGL(); |
---|
6645 | | - |
---|
6646 | | - boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION; |
---|
6647 | | - |
---|
6648 | | - //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv); |
---|
6649 | | - if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) |
---|
6650 | | - { |
---|
6651 | | - //gl.glBegin(gl.GL_TRIANGLES); |
---|
6652 | | - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0); |
---|
6653 | | - if (!hasnorm) |
---|
6654 | | - { |
---|
6655 | | - // System.out.println("FUCK!!"); |
---|
6656 | | - LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0); |
---|
6657 | | - LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1); |
---|
6658 | | - LA.vecCross(v0, v1, v2); |
---|
6659 | | - LA.vecNormalize(v2); |
---|
6660 | | - gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z); |
---|
6661 | | - } |
---|
6662 | | - |
---|
6663 | | - if (hasnorm) |
---|
6664 | | - { |
---|
6665 | | -// if (!pv.norm.normalized()) |
---|
6666 | | -// assert(pv.norm.normalized()); |
---|
6667 | | - |
---|
6668 | | - //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z); |
---|
6669 | | - gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z); |
---|
6670 | | - } |
---|
6671 | | - gl.glColor4f(pv.AO, pv.AO, pv.AO, 1); |
---|
6672 | | - SetColor(display, pv); |
---|
6673 | | - //gl.glColor4f(r, g, b, 1); |
---|
6674 | | - //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1); |
---|
6675 | | - if (flipV) |
---|
6676 | | - gl.glTexCoord2f((float) pv.s, 1-(float) pv.t); |
---|
6677 | | - else |
---|
6678 | | - gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6679 | | - //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z); |
---|
6680 | | - gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z); |
---|
6681 | | -// Print(pv); |
---|
6682 | | - if (hasnorm) |
---|
6683 | | - { |
---|
6684 | | -// assert(qv.norm.normalized()); |
---|
6685 | | - //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z); |
---|
6686 | | - gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z); |
---|
6687 | | - } |
---|
6688 | | - //System.out.println("vertexq = " + qv.s + ", " + qv.t); |
---|
6689 | | - // boolean locked = false; |
---|
6690 | | - // float eps = 0.1f; |
---|
6691 | | - // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice |
---|
6692 | | - |
---|
6693 | | - // int dot = 0; //*/ (int)f.dot; |
---|
6694 | | - |
---|
6695 | | - // if ((dot&1) == 0) |
---|
6696 | | - // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1; |
---|
6697 | | - |
---|
6698 | | - // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) |
---|
6699 | | - if (flipV) |
---|
6700 | | - gl.glTexCoord2f((float) qv.s, 1-(float) qv.t); |
---|
6701 | | - else |
---|
6702 | | - gl.glTexCoord2f((float) qv.s, (float) qv.t); |
---|
6703 | | - // else |
---|
6704 | | - // { |
---|
6705 | | - // locked = true; |
---|
6706 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6707 | | - // } |
---|
6708 | | - gl.glColor4f(qv.AO, qv.AO, qv.AO, 1); |
---|
6709 | | - SetColor(display, qv); |
---|
6710 | | - //gl.glColor4f(r, g, b, 1); |
---|
6711 | | - //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1); |
---|
6712 | | - //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z); |
---|
6713 | | - gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z); |
---|
6714 | | -// Print(qv); |
---|
6715 | | - if (hasnorm) |
---|
6716 | | - { |
---|
6717 | | -// assert(rv.norm.normalized()); |
---|
6718 | | - //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z); |
---|
6719 | | - gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z); |
---|
6720 | | - } |
---|
6721 | | - |
---|
6722 | | - // if ((dot&4) == 0) |
---|
6723 | | - // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4; |
---|
6724 | | - |
---|
6725 | | - // if (wrap || !locked && (dot&8) != 0) |
---|
6726 | | - if (flipV) |
---|
6727 | | - gl.glTexCoord2f((float) rv.s, 1-(float) rv.t); |
---|
6728 | | - else |
---|
6729 | | - gl.glTexCoord2f((float) rv.s, (float) rv.t); |
---|
6730 | | - // else |
---|
6731 | | - // gl.glTexCoord2f((float) pv.s, (float) pv.t); |
---|
6732 | | - |
---|
6733 | | - // f.dot = dot; |
---|
6734 | | - |
---|
6735 | | - gl.glColor4f(rv.AO, rv.AO, rv.AO, 1); |
---|
6736 | | - SetColor(display, rv); |
---|
6737 | | - //gl.glColor4f(r, g, b, 1); |
---|
6738 | | - //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1); |
---|
6739 | | - //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z); |
---|
6740 | | - gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z); |
---|
6741 | | -// Print(rv); |
---|
6742 | | - //gl.glEnd(); |
---|
6743 | | - } |
---|
6744 | | - else |
---|
6745 | | - { |
---|
6746 | | - gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
6747 | | - gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z); |
---|
6748 | | - gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z); |
---|
6749 | | - |
---|
6750 | | - } |
---|
6751 | | - |
---|
6752 | | - if (false) // (attributes & WIREFRAME) != 0) |
---|
6753 | | - { |
---|
6754 | | - gl.glDisable(gl.GL_LIGHTING); |
---|
6755 | | - |
---|
6756 | | - gl.glBegin(gl.GL_LINE_LOOP); |
---|
6757 | | - gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z); |
---|
6758 | | - gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z); |
---|
6759 | | - gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z); |
---|
6760 | | - gl.glEnd(); |
---|
6761 | | - |
---|
6762 | | - gl.glEnable(gl.GL_LIGHTING); |
---|
6763 | | - } |
---|
6764 | | - } |
---|
6765 | | - |
---|
6766 | 6633 | void drawSelf(ClickInfo info, int level, boolean select) |
---|
6767 | 6634 | { |
---|
6768 | 6635 | if (bRep == null) |
---|
.. | .. |
---|
7334 | 7201 | int spotw = spot.x + spot.width; |
---|
7335 | 7202 | int spoth = spot.y + spot.height; |
---|
7336 | 7203 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7337 | | - if (CameraPane.Xmin > spot.x) |
---|
7338 | | - { |
---|
7339 | | - CameraPane.Xmin = spot.x; |
---|
7340 | | - } |
---|
7341 | | - if (CameraPane.Xmax < spotw) |
---|
7342 | | - { |
---|
7343 | | - CameraPane.Xmax = spotw; |
---|
7344 | | - } |
---|
7345 | | - if (CameraPane.Ymin > spot.y) |
---|
7346 | | - { |
---|
7347 | | - CameraPane.Ymin = spot.y; |
---|
7348 | | - } |
---|
7349 | | - if (CameraPane.Ymax < spoth) |
---|
7350 | | - { |
---|
7351 | | - CameraPane.Ymax = spoth; |
---|
7352 | | - } |
---|
| 7204 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7205 | +// { |
---|
| 7206 | +// CameraPane.Xmin = spot.x; |
---|
| 7207 | +// } |
---|
| 7208 | +// if (CameraPane.Xmax < spotw) |
---|
| 7209 | +// { |
---|
| 7210 | +// CameraPane.Xmax = spotw; |
---|
| 7211 | +// } |
---|
| 7212 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7213 | +// { |
---|
| 7214 | +// CameraPane.Ymin = spot.y; |
---|
| 7215 | +// } |
---|
| 7216 | +// if (CameraPane.Ymax < spoth) |
---|
| 7217 | +// { |
---|
| 7218 | +// CameraPane.Ymax = spoth; |
---|
| 7219 | +// } |
---|
7353 | 7220 | spot.translate(32, 32); |
---|
7354 | 7221 | spotw = spot.x + spot.width; |
---|
7355 | 7222 | spoth = spot.y + spot.height; |
---|
7356 | | - info.g.setColor(Color.blue); |
---|
| 7223 | + info.g.setColor(Color.cyan); |
---|
7357 | 7224 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7358 | | - if (CameraPane.Xmin > spot.x) |
---|
7359 | | - { |
---|
7360 | | - CameraPane.Xmin = spot.x; |
---|
7361 | | - } |
---|
7362 | | - if (CameraPane.Xmax < spotw) |
---|
7363 | | - { |
---|
7364 | | - CameraPane.Xmax = spotw; |
---|
7365 | | - } |
---|
7366 | | - if (CameraPane.Ymin > spot.y) |
---|
7367 | | - { |
---|
7368 | | - CameraPane.Ymin = spot.y; |
---|
7369 | | - } |
---|
7370 | | - if (CameraPane.Ymax < spoth) |
---|
7371 | | - { |
---|
7372 | | - CameraPane.Ymax = spoth; |
---|
7373 | | - } |
---|
7374 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
7375 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7225 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7226 | +// { |
---|
| 7227 | +// CameraPane.Xmin = spot.x; |
---|
| 7228 | +// } |
---|
| 7229 | +// if (CameraPane.Xmax < spotw) |
---|
| 7230 | +// { |
---|
| 7231 | +// CameraPane.Xmax = spotw; |
---|
| 7232 | +// } |
---|
| 7233 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7234 | +// { |
---|
| 7235 | +// CameraPane.Ymin = spot.y; |
---|
| 7236 | +// } |
---|
| 7237 | +// if (CameraPane.Ymax < spoth) |
---|
| 7238 | +// { |
---|
| 7239 | +// CameraPane.Ymax = spoth; |
---|
| 7240 | +// } |
---|
| 7241 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7242 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7376 | 7243 | spot.translate(0, -32); |
---|
7377 | | - info.g.setColor(Color.green); |
---|
| 7244 | + info.g.setColor(Color.yellow); |
---|
7378 | 7245 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7379 | | - if (CameraPane.Xmin > spot.x) |
---|
7380 | | - { |
---|
7381 | | - CameraPane.Xmin = spot.x; |
---|
7382 | | - } |
---|
7383 | | - if (CameraPane.Xmax < spotw) |
---|
7384 | | - { |
---|
7385 | | - CameraPane.Xmax = spotw; |
---|
7386 | | - } |
---|
7387 | | - if (CameraPane.Ymin > spot.y) |
---|
7388 | | - { |
---|
7389 | | - CameraPane.Ymin = spot.y; |
---|
7390 | | - } |
---|
7391 | | - if (CameraPane.Ymax < spoth) |
---|
7392 | | - { |
---|
7393 | | - CameraPane.Ymax = spoth; |
---|
7394 | | - } |
---|
| 7246 | + info.g.setColor(Color.green); |
---|
| 7247 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7248 | +// { |
---|
| 7249 | +// CameraPane.Xmin = spot.x; |
---|
| 7250 | +// } |
---|
| 7251 | +// if (CameraPane.Xmax < spotw) |
---|
| 7252 | +// { |
---|
| 7253 | +// CameraPane.Xmax = spotw; |
---|
| 7254 | +// } |
---|
| 7255 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7256 | +// { |
---|
| 7257 | +// CameraPane.Ymin = spot.y; |
---|
| 7258 | +// } |
---|
| 7259 | +// if (CameraPane.Ymax < spoth) |
---|
| 7260 | +// { |
---|
| 7261 | +// CameraPane.Ymax = spoth; |
---|
| 7262 | +// } |
---|
7395 | 7263 | info.g.drawArc(boundary.x, boundary.y, |
---|
7396 | 7264 | boundary.width, boundary.height, 0, 360); |
---|
7397 | 7265 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7398 | | - if (CameraPane.Xmin > boundary.x) |
---|
7399 | | - { |
---|
7400 | | - CameraPane.Xmin = boundary.x; |
---|
7401 | | - } |
---|
7402 | | - if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
7403 | | - { |
---|
7404 | | - CameraPane.Xmax = boundary.x + boundary.width; |
---|
7405 | | - } |
---|
7406 | | - if (CameraPane.Ymin > boundary.y) |
---|
7407 | | - { |
---|
7408 | | - CameraPane.Ymin = boundary.y; |
---|
7409 | | - } |
---|
7410 | | - if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
7411 | | - { |
---|
7412 | | - CameraPane.Ymax = boundary.y + boundary.height; |
---|
7413 | | - } |
---|
| 7266 | +// if (CameraPane.Xmin > boundary.x) |
---|
| 7267 | +// { |
---|
| 7268 | +// CameraPane.Xmin = boundary.x; |
---|
| 7269 | +// } |
---|
| 7270 | +// if (CameraPane.Xmax < boundary.x + boundary.width) |
---|
| 7271 | +// { |
---|
| 7272 | +// CameraPane.Xmax = boundary.x + boundary.width; |
---|
| 7273 | +// } |
---|
| 7274 | +// if (CameraPane.Ymin > boundary.y) |
---|
| 7275 | +// { |
---|
| 7276 | +// CameraPane.Ymin = boundary.y; |
---|
| 7277 | +// } |
---|
| 7278 | +// if (CameraPane.Ymax < boundary.y + boundary.height) |
---|
| 7279 | +// { |
---|
| 7280 | +// CameraPane.Ymax = boundary.y + boundary.height; |
---|
| 7281 | +// } |
---|
7414 | 7282 | return; |
---|
7415 | 7283 | } |
---|
7416 | 7284 | } |
---|
.. | .. |
---|
7427 | 7295 | startX = info.x; |
---|
7428 | 7296 | startY = info.y; |
---|
7429 | 7297 | |
---|
7430 | | - hitSomething = 0; |
---|
| 7298 | + hitSomething = -1; |
---|
7431 | 7299 | cVector origin = new cVector(); |
---|
7432 | 7300 | //LA.xformPos(origin, toParent, origin); |
---|
7433 | 7301 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7460 | 7328 | } |
---|
7461 | 7329 | |
---|
7462 | 7330 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7463 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7331 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7464 | 7332 | //System.out.println("modified = " + modified); |
---|
7465 | 7333 | //new Exception().printStackTrace(); |
---|
7466 | 7334 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7488 | 7356 | return true; |
---|
7489 | 7357 | } |
---|
7490 | 7358 | |
---|
7491 | | - void doEditDrag0(ClickInfo info) |
---|
| 7359 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
7492 | 7360 | { |
---|
7493 | 7361 | if (hitSomething == 0) |
---|
7494 | 7362 | { |
---|
.. | .. |
---|
7503 | 7371 | //System.out.println("hitSomething = " + hitSomething); |
---|
7504 | 7372 | |
---|
7505 | 7373 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7374 | + |
---|
7506 | 7375 | cVector xlate = new cVector(); |
---|
7507 | 7376 | //cVector xlate2 = new cVector(); |
---|
7508 | 7377 | switch (hitSomething) |
---|
.. | .. |
---|
7513 | 7382 | |
---|
7514 | 7383 | case hitCenter: // Translate |
---|
7515 | 7384 | |
---|
7516 | | - scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance(); |
---|
| 7385 | + scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7517 | 7386 | |
---|
7518 | | - if (modified) |
---|
| 7387 | + if (modified || opposite) |
---|
7519 | 7388 | { |
---|
7520 | 7389 | //assert(false); |
---|
7521 | 7390 | /* |
---|
.. | .. |
---|
7561 | 7430 | } |
---|
7562 | 7431 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7563 | 7432 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7564 | | - LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up); |
---|
| 7433 | + LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7565 | 7434 | LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
7566 | 7435 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7567 | | - LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away); |
---|
| 7436 | + LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7568 | 7437 | //LA.vecCross(up, cVector.Z, right2); |
---|
7569 | 7438 | |
---|
7570 | 7439 | cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
.. | .. |
---|
7609 | 7478 | |
---|
7610 | 7479 | if (modified) |
---|
7611 | 7480 | { |
---|
| 7481 | + // Rotate 90 degrees |
---|
7612 | 7482 | angle /= (Math.PI / 4); |
---|
7613 | 7483 | angle = Math.floor(angle + 0.5); |
---|
7614 | 7484 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7622 | 7492 | } |
---|
7623 | 7493 | /**/ |
---|
7624 | 7494 | |
---|
7625 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7495 | + switch (info.pane.RenderCamera().viewCode) |
---|
7626 | 7496 | { |
---|
7627 | 7497 | case 1: // '\001' |
---|
7628 | 7498 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7650 | 7520 | |
---|
7651 | 7521 | case hitScale: // scale |
---|
7652 | 7522 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7523 | + double sign = 1; |
---|
| 7524 | + if (hScale < 0) |
---|
| 7525 | + { |
---|
| 7526 | + sign = -1; |
---|
| 7527 | + } |
---|
| 7528 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7653 | 7529 | if (hScale < 0.01) |
---|
7654 | 7530 | { |
---|
7655 | | - hScale = 0.01; |
---|
| 7531 | + //hScale = 0.01; |
---|
7656 | 7532 | } |
---|
7657 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7658 | | - if (hScale < 0.01) |
---|
7659 | | - { |
---|
7660 | | - hScale = 0.01; |
---|
7661 | | - } |
---|
| 7533 | + |
---|
7662 | 7534 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7663 | | - if (vScale < 0.01) |
---|
| 7535 | + sign = 1; |
---|
| 7536 | + if (vScale < 0) |
---|
7664 | 7537 | { |
---|
7665 | | - vScale = 0.01; |
---|
| 7538 | + sign = -1; |
---|
7666 | 7539 | } |
---|
7667 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7540 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7668 | 7541 | if (vScale < 0.01) |
---|
7669 | 7542 | { |
---|
7670 | | - vScale = 0.01; |
---|
| 7543 | + //vScale = 0.01; |
---|
7671 | 7544 | } |
---|
7672 | 7545 | LA.matCopy(startMat, toParent); |
---|
7673 | 7546 | /**/ |
---|
.. | .. |
---|
7678 | 7551 | } |
---|
7679 | 7552 | /**/ |
---|
7680 | 7553 | |
---|
7681 | | - switch (info.pane.renderCamera.viewCode) |
---|
| 7554 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7555 | + |
---|
| 7556 | + if (totalScale < 0.01) |
---|
| 7557 | + { |
---|
| 7558 | + totalScale = 0.01; |
---|
| 7559 | + } |
---|
| 7560 | + |
---|
| 7561 | + switch (info.pane.RenderCamera().viewCode) |
---|
7682 | 7562 | { |
---|
7683 | 7563 | case 3: // '\001' |
---|
7684 | | - if (modified) |
---|
| 7564 | + if (modified || opposite) |
---|
7685 | 7565 | { |
---|
7686 | 7566 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7687 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7567 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7688 | 7568 | } // vScale, 1); |
---|
7689 | 7569 | else |
---|
7690 | 7570 | { |
---|
7691 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7571 | + // EXCEPTION! |
---|
| 7572 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7692 | 7573 | } // vScale, 1); |
---|
7693 | 7574 | break; |
---|
7694 | 7575 | |
---|
7695 | 7576 | case 2: // '\002' |
---|
7696 | | - if (modified) |
---|
| 7577 | + if (modified || opposite) |
---|
7697 | 7578 | { |
---|
7698 | 7579 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7699 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7580 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7700 | 7581 | } else |
---|
7701 | 7582 | { |
---|
7702 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7583 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7703 | 7584 | } |
---|
7704 | 7585 | break; |
---|
7705 | 7586 | |
---|
7706 | 7587 | case 1: // '\003' |
---|
7707 | | - if (modified) |
---|
| 7588 | + if (modified || opposite) |
---|
7708 | 7589 | { |
---|
7709 | 7590 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7710 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7591 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7711 | 7592 | } else |
---|
7712 | 7593 | { |
---|
7713 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7594 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7714 | 7595 | } |
---|
7715 | 7596 | break; |
---|
7716 | 7597 | } |
---|
.. | .. |
---|
7731 | 7612 | if (parent == null) |
---|
7732 | 7613 | { |
---|
7733 | 7614 | System.out.println("NULL PARENT"); |
---|
7734 | | - new Exception().printStackTrace(); |
---|
| 7615 | + //new Exception().printStackTrace(); |
---|
7735 | 7616 | } else |
---|
7736 | 7617 | { |
---|
7737 | 7618 | if (parent instanceof BezierPatch) |
---|
.. | .. |
---|
7843 | 7724 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7844 | 7725 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7845 | 7726 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7727 | + |
---|
| 7728 | + String objname; |
---|
| 7729 | + |
---|
7846 | 7730 | if (false) //parent != null) |
---|
7847 | 7731 | { |
---|
7848 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7732 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7849 | 7733 | } else |
---|
7850 | 7734 | { |
---|
7851 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7735 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7852 | 7736 | } // + super.toString(); |
---|
7853 | 7737 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7738 | + |
---|
| 7739 | + if (!Globals.ADVANCED) |
---|
| 7740 | + return objname; |
---|
| 7741 | + |
---|
| 7742 | + return objname + " " + System.identityHashCode(this); |
---|
7854 | 7743 | } |
---|
7855 | 7744 | |
---|
7856 | 7745 | public int hashCode() |
---|
.. | .. |
---|
7906 | 7795 | objectUI.closeUI(); |
---|
7907 | 7796 | if (editWindow != null) |
---|
7908 | 7797 | { |
---|
| 7798 | + editWindow.ctrlPanel.FlushUI(); |
---|
7909 | 7799 | editWindow.refreshContents(); |
---|
7910 | 7800 | } // ? new |
---|
7911 | 7801 | objectUI = null; |
---|
.. | .. |
---|
7914 | 7804 | { |
---|
7915 | 7805 | editWindow = null; |
---|
7916 | 7806 | } // ? |
---|
| 7807 | + } |
---|
| 7808 | + else |
---|
| 7809 | + { |
---|
| 7810 | + //editWindow.closeUI(); |
---|
7917 | 7811 | } |
---|
7918 | 7812 | } |
---|
7919 | 7813 | |
---|
.. | .. |
---|
7926 | 7820 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7927 | 7821 | |
---|
7928 | 7822 | Object3D /*Composite*/ parent; |
---|
7929 | | - Object3D /*Composite*/ fileparent; |
---|
| 7823 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7930 | 7824 | |
---|
7931 | 7825 | double[][] toParent; // dynamic matrix |
---|
7932 | 7826 | double[][] fromParent; |
---|
.. | .. |
---|
8041 | 7935 | { |
---|
8042 | 7936 | assert(bRep != null); |
---|
8043 | 7937 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
8044 | | - GraphreeD.Assert(support.bRep == bRep.support); |
---|
| 7938 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
8045 | 7939 | } |
---|
8046 | 7940 | else |
---|
8047 | 7941 | { |
---|
.. | .. |
---|
8090 | 7984 | private static cVector edge2 = new cVector(); |
---|
8091 | 7985 | //private static cVector norm = new cVector(); |
---|
8092 | 7986 | /*transient private*/ int hitSomething; |
---|
8093 | | - private static final int hitCenter = 1; |
---|
8094 | | - private static final int hitScale = 2; |
---|
8095 | | - private static final int hitRotate = 3; |
---|
| 7987 | + static final int hitCenter = 1; |
---|
| 7988 | + static final int hitScale = 2; |
---|
| 7989 | + static final int hitRotate = 3; |
---|
8096 | 7990 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
8097 | 7991 | /*transient*/ private Point centerPt; |
---|
8098 | 7992 | /*transient*/ private int startX; |
---|
.. | .. |
---|
8124 | 8018 | { |
---|
8125 | 8019 | Object3D targ = this; |
---|
8126 | 8020 | |
---|
| 8021 | + targ.NORMALPUSH = obj.NORMALPUSH; |
---|
| 8022 | + |
---|
8127 | 8023 | if (obj.material != null) |
---|
8128 | 8024 | { |
---|
8129 | 8025 | if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL)) |
---|