.. | .. |
---|
14 | 14 | import //weka.core. |
---|
15 | 15 | matrix.Matrix; |
---|
16 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
17 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
18 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
19 | 21 | { |
---|
20 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
21 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
22 | 24 | |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
| 27 | + // TEMPORARY for mocap undo. No need to be transient. |
---|
| 28 | + mocap.reader.BVHReader.BVHResult savebvh; |
---|
| 29 | + Object3D saveskeleton; |
---|
| 30 | + // |
---|
| 31 | + |
---|
| 32 | + byte[] versions[] = new byte[100][]; |
---|
| 33 | + int versionindex = -1; |
---|
| 34 | + |
---|
23 | 35 | ScriptNode scriptnode; |
---|
24 | 36 | |
---|
25 | 37 | void InitOthers() |
---|
.. | .. |
---|
100 | 112 | |
---|
101 | 113 | // transient boolean reduced; // for morph reduction |
---|
102 | 114 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 115 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 116 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
105 | 117 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 118 | + transient Object3D transientsupport; // for cloning |
---|
| 119 | + transient boolean transientlink2master; |
---|
108 | 120 | |
---|
109 | | -void SaveSupports() |
---|
110 | | -{ |
---|
111 | | - if (blockloop) |
---|
112 | | - return; |
---|
113 | | - |
---|
114 | | - transientsupport = support; |
---|
115 | | - transientlink2master = link2master; |
---|
116 | | - |
---|
117 | | - support = null; |
---|
118 | | - link2master = false; |
---|
119 | | - |
---|
120 | | - if (bRep != null) |
---|
| 121 | + void SaveSupports() |
---|
121 | 122 | { |
---|
122 | | - bRep.SaveSupports(); |
---|
| 123 | + if (blockloop) |
---|
| 124 | + return; |
---|
| 125 | + |
---|
| 126 | + transientsupport = support; |
---|
| 127 | + transientlink2master = link2master; |
---|
| 128 | + |
---|
| 129 | + support = null; |
---|
| 130 | + link2master = false; |
---|
| 131 | + |
---|
| 132 | + if (bRep != null) |
---|
| 133 | + { |
---|
| 134 | + bRep.SaveSupports(); |
---|
| 135 | + } |
---|
| 136 | + |
---|
| 137 | + for (int i = 0; i < Size(); i++) |
---|
| 138 | + { |
---|
| 139 | + Object3D child = (Object3D) get(i); |
---|
| 140 | + if (child == null) |
---|
| 141 | + continue; |
---|
| 142 | + blockloop = true; |
---|
| 143 | + child.SaveSupports(); |
---|
| 144 | + blockloop = false; |
---|
| 145 | + } |
---|
123 | 146 | } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
| 147 | + |
---|
| 148 | + void RestoreSupports() |
---|
126 | 149 | { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
| 150 | + if (blockloop) |
---|
| 151 | + return; |
---|
| 152 | + |
---|
| 153 | + support = transientsupport; |
---|
| 154 | + link2master = transientlink2master; |
---|
| 155 | + transientsupport = null; |
---|
| 156 | + transientlink2master = false; |
---|
| 157 | + |
---|
| 158 | + if (bRep != null) |
---|
| 159 | + { |
---|
| 160 | + bRep.RestoreSupports(); |
---|
| 161 | + } |
---|
| 162 | + |
---|
| 163 | + for (int i = 0; i < Size(); i++) |
---|
| 164 | + { |
---|
| 165 | + Object3D child = (Object3D) get(i); |
---|
| 166 | + if (child == null) |
---|
| 167 | + continue; |
---|
| 168 | + blockloop = true; |
---|
| 169 | + child.RestoreSupports(); |
---|
| 170 | + blockloop = false; |
---|
| 171 | + } |
---|
| 172 | + } |
---|
| 173 | + |
---|
| 174 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 175 | + { |
---|
| 176 | + Object3D o; |
---|
| 177 | + |
---|
| 178 | + if (hashtable.containsKey(GetUUID())) |
---|
| 179 | + { |
---|
| 180 | + o = hashtable.get(GetUUID()); |
---|
| 181 | + |
---|
| 182 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 183 | + //if (this.bRep != null) |
---|
| 184 | + // assert(this.bRep.support == o.transientrep); |
---|
| 185 | + if (this.support != null) |
---|
| 186 | + assert(this.support.bRep == o.transientrep); |
---|
| 187 | + } |
---|
| 188 | + else |
---|
| 189 | + { |
---|
| 190 | + o = new Object3D("copy of " + this.name); |
---|
| 191 | + |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
| 193 | + } |
---|
| 194 | + |
---|
| 195 | + if (!blockloop) |
---|
| 196 | + { |
---|
| 197 | + blockloop = true; |
---|
| 198 | + |
---|
| 199 | + for (int i=0; i<Size(); i++) |
---|
| 200 | + { |
---|
| 201 | + get(i).ExtractBigData(hashtable); |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | + blockloop = false; |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + ExtractBigData(o); |
---|
| 208 | + } |
---|
| 209 | + |
---|
| 210 | + void ExtractBigData(Object3D o) |
---|
| 211 | + { |
---|
| 212 | + if (o.bRep != null) |
---|
| 213 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 214 | + |
---|
| 215 | + o.bRep = this.bRep; |
---|
| 216 | +// July 2019 if (this.bRep != null) |
---|
| 217 | +// { |
---|
| 218 | +// o.transientrep = this.bRep.support; |
---|
| 219 | +// o.bRep.support = null; |
---|
| 220 | +// } |
---|
| 221 | + o.selection = this.selection; |
---|
| 222 | + |
---|
| 223 | + if (this.support != null) |
---|
| 224 | + { |
---|
| 225 | + if (o.transientrep != null) |
---|
| 226 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 227 | + |
---|
| 228 | + o.transientrep = this.support.bRep; |
---|
| 229 | + this.support.bRep = null; |
---|
| 230 | + } |
---|
| 231 | + |
---|
| 232 | + // o.support = this.support; |
---|
| 233 | + // o.fileparent = this.fileparent; |
---|
| 234 | + // if (this.bRep != null) |
---|
| 235 | + // o.bRep = this.bRep.support; |
---|
| 236 | + |
---|
| 237 | + this.bRep = null; |
---|
| 238 | + // if (this.bRep != null) |
---|
| 239 | + // this.bRep.support = null; |
---|
| 240 | + // this.support = null; |
---|
| 241 | + // this.fileparent = null; |
---|
| 242 | + } |
---|
| 243 | + |
---|
| 244 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 245 | + { |
---|
| 246 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 247 | + return; |
---|
| 248 | + |
---|
| 249 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 250 | + |
---|
| 251 | + RestoreBigData(o); |
---|
| 252 | + |
---|
| 253 | + if (blockloop) |
---|
| 254 | + return; |
---|
| 255 | + |
---|
130 | 256 | blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
| 257 | + |
---|
| 258 | + //hashtable.remove(GetUUID()); |
---|
| 259 | + |
---|
| 260 | + for (int i=0; i<Size(); i++) |
---|
| 261 | + { |
---|
| 262 | + get(i).RestoreBigData(hashtable); |
---|
| 263 | + } |
---|
| 264 | + |
---|
132 | 265 | blockloop = false; |
---|
133 | 266 | } |
---|
134 | | -} |
---|
135 | 267 | |
---|
136 | | -void RestoreSupports() |
---|
137 | | -{ |
---|
138 | | - if (blockloop) |
---|
139 | | - return; |
---|
140 | | - |
---|
141 | | - support = transientsupport; |
---|
142 | | - link2master = transientlink2master; |
---|
143 | | - transientsupport = null; |
---|
144 | | - transientlink2master = false; |
---|
145 | | - |
---|
146 | | - if (bRep != null) |
---|
| 268 | + void RestoreBigData(Object3D o) |
---|
147 | 269 | { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 270 | + this.bRep = o.bRep; |
---|
| 271 | + if (this.support != null && o.transientrep != null) |
---|
| 272 | + { |
---|
| 273 | + this.support.bRep = o.transientrep; |
---|
| 274 | + } |
---|
| 275 | + |
---|
| 276 | + this.selection = o.selection; |
---|
| 277 | +// July 2019 if (this.bRep != null) |
---|
| 278 | +// this.bRep.support = o.transientrep; |
---|
| 279 | + // this.support = o.support; |
---|
| 280 | + // this.fileparent = o.fileparent; |
---|
149 | 281 | } |
---|
150 | | - |
---|
151 | | - for (int i = 0; i < Size(); i++) |
---|
152 | | - { |
---|
153 | | - Object3D child = (Object3D) get(i); |
---|
154 | | - if (child == null) |
---|
155 | | - continue; |
---|
156 | | - blockloop = true; |
---|
157 | | - child.RestoreSupports(); |
---|
158 | | - blockloop = false; |
---|
159 | | - } |
---|
160 | | -} |
---|
161 | 282 | |
---|
162 | 283 | // MOCAP SUPPORT |
---|
163 | 284 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
300 | 421 | } |
---|
301 | 422 | |
---|
302 | 423 | boolean live = false; |
---|
| 424 | + boolean dontselect = false; |
---|
303 | 425 | boolean hide = false; |
---|
304 | 426 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 427 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 603 | toParent = LA.newMatrix(); |
---|
482 | 604 | fromParent = LA.newMatrix(); |
---|
483 | 605 | } |
---|
| 606 | + |
---|
484 | 607 | if (toParentMarked == null) |
---|
485 | 608 | { |
---|
486 | 609 | if (maxcount != 1) |
---|
487 | 610 | { |
---|
488 | 611 | new Exception().printStackTrace(); |
---|
489 | 612 | } |
---|
| 613 | + |
---|
490 | 614 | toParentMarked = LA.newMatrix(); |
---|
491 | 615 | fromParentMarked = LA.newMatrix(); |
---|
492 | 616 | } |
---|
.. | .. |
---|
774 | 898 | if (step == 0) |
---|
775 | 899 | step = 1; |
---|
776 | 900 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 901 | + maxcount = 128; // 2048; // 4; |
---|
778 | 902 | // if (acceleration == 0) |
---|
779 | 903 | // acceleration = 10; |
---|
780 | 904 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 921 | |
---|
798 | 922 | if (marked && Globals.isLIVE() && live && |
---|
799 | 923 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 924 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 925 | currentframe != Globals.framecount) |
---|
802 | 926 | { |
---|
803 | 927 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 933 | |
---|
810 | 934 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 935 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 936 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 937 | + (step == 1 && changedir)) |
---|
813 | 938 | { |
---|
814 | 939 | countdown = 1; |
---|
815 | 940 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1006 | if (material == null || material.multiply) |
---|
882 | 1007 | return true; |
---|
883 | 1008 | |
---|
| 1009 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1010 | return material.opacity > 0.99; |
---|
885 | 1011 | } |
---|
886 | 1012 | |
---|
.. | .. |
---|
912 | 1038 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1039 | bRep = null; // new BoundaryRep(); |
---|
914 | 1040 | |
---|
| 1041 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1042 | + { |
---|
| 1043 | + name = oname; |
---|
| 1044 | + } |
---|
| 1045 | + |
---|
915 | 1046 | /* |
---|
916 | 1047 | float hue = (float)Math.random(); |
---|
917 | 1048 | Color col; |
---|
.. | .. |
---|
954 | 1085 | |
---|
955 | 1086 | public Object clone() |
---|
956 | 1087 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1088 | + return Grafreed.clone(this); |
---|
958 | 1089 | } |
---|
959 | 1090 | |
---|
960 | 1091 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1407 | toParent = LA.newMatrix(); |
---|
1277 | 1408 | fromParent = LA.newMatrix(); |
---|
1278 | 1409 | } |
---|
| 1410 | + |
---|
1279 | 1411 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1412 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1413 | |
---|
.. | .. |
---|
1470 | 1602 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1603 | |
---|
1472 | 1604 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1605 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1606 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1607 | } |
---|
1476 | 1608 | |
---|
.. | .. |
---|
1729 | 1861 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1862 | o.bRep = transientrep; |
---|
1731 | 1863 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1864 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1865 | o.CreateMaterial(); |
---|
1734 | 1866 | o.SetAttributes(this, -1); |
---|
1735 | 1867 | //parent |
---|
.. | .. |
---|
1742 | 1874 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1875 | o.bRep = bRep; |
---|
1744 | 1876 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1877 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1878 | o.CreateMaterial(); |
---|
1747 | 1879 | //o.overwriteThis(this, -1); |
---|
1748 | 1880 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1961 | if (obj.name == null) |
---|
1830 | 1962 | continue; // can't be a null one |
---|
1831 | 1963 | |
---|
| 1964 | + // Try perfect match first. |
---|
1832 | 1965 | if (n.equals(obj.name)) |
---|
1833 | 1966 | { |
---|
1834 | 1967 | theobj = obj; |
---|
1835 | 1968 | count++; |
---|
1836 | 1969 | } |
---|
1837 | 1970 | } |
---|
| 1971 | + |
---|
| 1972 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1973 | |
---|
1839 | 1974 | if (count != 1) |
---|
1840 | 1975 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2429 | } |
---|
2295 | 2430 | */ |
---|
2296 | 2431 | } |
---|
| 2432 | + else |
---|
| 2433 | + { |
---|
| 2434 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2435 | + } |
---|
2297 | 2436 | } |
---|
2298 | 2437 | |
---|
2299 | 2438 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
2300 | 2439 | { |
---|
2301 | 2440 | if (newWindow) |
---|
2302 | 2441 | { |
---|
| 2442 | + new Exception().printStackTrace(); |
---|
2303 | 2443 | System.exit(0); |
---|
2304 | 2444 | if (parent != null) |
---|
2305 | 2445 | { |
---|
.. | .. |
---|
2334 | 2474 | { |
---|
2335 | 2475 | editWindow.refreshContents(); |
---|
2336 | 2476 | } |
---|
| 2477 | + else |
---|
| 2478 | + { |
---|
| 2479 | + if (manipWindow != null) |
---|
| 2480 | + { |
---|
| 2481 | + manipWindow.refreshContents(); |
---|
| 2482 | + } |
---|
| 2483 | + } |
---|
| 2484 | + |
---|
2337 | 2485 | //if (parent != null) |
---|
2338 | 2486 | //parent.refreshEditWindow(); |
---|
2339 | 2487 | } |
---|
.. | .. |
---|
2476 | 2624 | return retval; |
---|
2477 | 2625 | } |
---|
2478 | 2626 | |
---|
2479 | | - void doEditDrag(ClickInfo info) |
---|
| 2627 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2480 | 2628 | { |
---|
2481 | 2629 | switch (doSomething) |
---|
2482 | 2630 | { |
---|
2483 | 2631 | case 1: // '\001' |
---|
2484 | 2632 | //super. |
---|
2485 | | - doEditDrag0(info); |
---|
| 2633 | + doEditDrag0(info, opposite); |
---|
2486 | 2634 | break; |
---|
2487 | 2635 | |
---|
2488 | 2636 | case 2: // '\002' |
---|
.. | .. |
---|
2495 | 2643 | { |
---|
2496 | 2644 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2497 | 2645 | //childToDrag.doEditDrag(info); |
---|
2498 | | - sel.doEditDrag(info); |
---|
| 2646 | + sel.doEditDrag(info, opposite); |
---|
2499 | 2647 | } else |
---|
2500 | 2648 | { |
---|
2501 | 2649 | //super. |
---|
2502 | | - doEditDrag0(info); |
---|
| 2650 | + doEditDrag0(info, opposite); |
---|
2503 | 2651 | } |
---|
2504 | 2652 | } |
---|
2505 | 2653 | break; |
---|
.. | .. |
---|
2609 | 2757 | void GenNormalsS(boolean crease) |
---|
2610 | 2758 | { |
---|
2611 | 2759 | selection.GenNormals(crease); |
---|
| 2760 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2761 | +// { |
---|
| 2762 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2763 | +// selectee.GenNormals(crease); |
---|
| 2764 | +// } |
---|
| 2765 | + |
---|
| 2766 | + //Touch(); |
---|
| 2767 | + } |
---|
| 2768 | + |
---|
| 2769 | + void GenNormalsMeshS() |
---|
| 2770 | + { |
---|
| 2771 | + selection.GenNormalsMesh(); |
---|
2612 | 2772 | // for (int i=0; i<selection.size(); i++) |
---|
2613 | 2773 | // { |
---|
2614 | 2774 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2749 | 2909 | if (child == null) |
---|
2750 | 2910 | continue; |
---|
2751 | 2911 | child.GenNormals(crease); |
---|
| 2912 | +// Children().release(i); |
---|
| 2913 | + } |
---|
| 2914 | + blockloop = false; |
---|
| 2915 | + } |
---|
| 2916 | + |
---|
| 2917 | + void GenNormalsMesh() |
---|
| 2918 | + { |
---|
| 2919 | + if (blockloop) |
---|
| 2920 | + return; |
---|
| 2921 | + |
---|
| 2922 | + blockloop = true; |
---|
| 2923 | + GenNormalsMesh0(); |
---|
| 2924 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2925 | + { |
---|
| 2926 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2927 | + if (child == null) |
---|
| 2928 | + continue; |
---|
| 2929 | + child.GenNormalsMesh(); |
---|
2752 | 2930 | // Children().release(i); |
---|
2753 | 2931 | } |
---|
2754 | 2932 | blockloop = false; |
---|
.. | .. |
---|
2906 | 3084 | { |
---|
2907 | 3085 | if (bRep != null) |
---|
2908 | 3086 | { |
---|
2909 | | - bRep.GenUV(); |
---|
| 3087 | + bRep.GenUV(); //1); |
---|
| 3088 | + //bRep.UnfoldUV(); |
---|
2910 | 3089 | Touch(); |
---|
2911 | 3090 | } |
---|
2912 | 3091 | } |
---|
.. | .. |
---|
2916 | 3095 | if (bRep != null) |
---|
2917 | 3096 | { |
---|
2918 | 3097 | bRep.GenerateNormals(crease); |
---|
| 3098 | + Touch(); |
---|
| 3099 | + } |
---|
| 3100 | + } |
---|
| 3101 | + |
---|
| 3102 | + void GenNormalsMesh0() |
---|
| 3103 | + { |
---|
| 3104 | + if (bRep != null) |
---|
| 3105 | + { |
---|
| 3106 | + bRep.GenerateNormalsMesh(); |
---|
2919 | 3107 | Touch(); |
---|
2920 | 3108 | } |
---|
2921 | 3109 | } |
---|
.. | .. |
---|
2981 | 3169 | blockloop = false; |
---|
2982 | 3170 | } |
---|
2983 | 3171 | |
---|
| 3172 | + void TransformChildren() |
---|
| 3173 | + { |
---|
| 3174 | + if (toParent != null) |
---|
| 3175 | + { |
---|
| 3176 | + for (int i=Size(); --i>=0;) |
---|
| 3177 | + { |
---|
| 3178 | + Object3D v = get(i); |
---|
| 3179 | + |
---|
| 3180 | + if (v.toParent == null) |
---|
| 3181 | + { |
---|
| 3182 | + v.toParent = LA.newMatrix(); |
---|
| 3183 | + v.fromParent = LA.newMatrix(); |
---|
| 3184 | + } |
---|
| 3185 | + |
---|
| 3186 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3187 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3188 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3189 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3190 | + } |
---|
| 3191 | + |
---|
| 3192 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3193 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3194 | + |
---|
| 3195 | + Touch(); |
---|
| 3196 | + } |
---|
| 3197 | + } |
---|
| 3198 | + |
---|
2984 | 3199 | void TransformGeometry() |
---|
2985 | 3200 | { |
---|
2986 | 3201 | Object3D obj = this; |
---|
.. | .. |
---|
3202 | 3417 | |
---|
3203 | 3418 | BoundaryRep sup = bRep.support; |
---|
3204 | 3419 | bRep.support = null; |
---|
3205 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3420 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3206 | 3421 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3207 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3422 | + |
---|
| 3423 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3424 | + |
---|
3208 | 3425 | bRep = temprep; |
---|
3209 | 3426 | bRep.support = sup; |
---|
3210 | 3427 | Touch(); |
---|
.. | .. |
---|
3341 | 3558 | if (blockloop) |
---|
3342 | 3559 | return; |
---|
3343 | 3560 | |
---|
3344 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3561 | + if (//marked || // does not make sense |
---|
| 3562 | + (bRep != null || material != null)) // borderline... |
---|
3345 | 3563 | live = h; |
---|
3346 | 3564 | |
---|
3347 | 3565 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3362 | 3580 | return; |
---|
3363 | 3581 | |
---|
3364 | 3582 | //if (bRep != null) |
---|
3365 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3583 | + if (//marked || // does not make sense |
---|
| 3584 | + (bRep != null || material != null)) // borderline... |
---|
3366 | 3585 | link2master = h; |
---|
3367 | 3586 | |
---|
3368 | 3587 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3382 | 3601 | if (blockloop) |
---|
3383 | 3602 | return; |
---|
3384 | 3603 | |
---|
3385 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3604 | + if (//marked || // does not make sense |
---|
| 3605 | + (bRep != null || material != null)) // borderline... |
---|
3386 | 3606 | hide = h; |
---|
3387 | 3607 | |
---|
3388 | 3608 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3402 | 3622 | if (blockloop) |
---|
3403 | 3623 | return; |
---|
3404 | 3624 | |
---|
3405 | | - if (bRep != null && material != null) // borderline... |
---|
| 3625 | + if (bRep != null || material != null) // borderline... |
---|
3406 | 3626 | marked = h; |
---|
3407 | 3627 | |
---|
3408 | 3628 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3412 | 3632 | continue; |
---|
3413 | 3633 | blockloop = true; |
---|
3414 | 3634 | child.MarkLeaves(h); |
---|
| 3635 | + blockloop = false; |
---|
| 3636 | + // release(i); |
---|
| 3637 | + } |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + void RewindLeaves(boolean h) |
---|
| 3641 | + { |
---|
| 3642 | + if (blockloop) |
---|
| 3643 | + return; |
---|
| 3644 | + |
---|
| 3645 | + if (bRep != null || material != null) // borderline... |
---|
| 3646 | + rewind = h; |
---|
| 3647 | + |
---|
| 3648 | + for (int i = 0; i < Size(); i++) |
---|
| 3649 | + { |
---|
| 3650 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3651 | + if (child == null) |
---|
| 3652 | + continue; |
---|
| 3653 | + blockloop = true; |
---|
| 3654 | + child.RewindLeaves(h); |
---|
| 3655 | + blockloop = false; |
---|
| 3656 | + // release(i); |
---|
| 3657 | + } |
---|
| 3658 | + } |
---|
| 3659 | + |
---|
| 3660 | + void RandomLeaves(boolean h) |
---|
| 3661 | + { |
---|
| 3662 | + if (blockloop) |
---|
| 3663 | + return; |
---|
| 3664 | + |
---|
| 3665 | + if (bRep != null || material != null) // borderline... |
---|
| 3666 | + random = h; |
---|
| 3667 | + |
---|
| 3668 | + for (int i = 0; i < Size(); i++) |
---|
| 3669 | + { |
---|
| 3670 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3671 | + if (child == null) |
---|
| 3672 | + continue; |
---|
| 3673 | + blockloop = true; |
---|
| 3674 | + child.RandomLeaves(h); |
---|
3415 | 3675 | blockloop = false; |
---|
3416 | 3676 | // release(i); |
---|
3417 | 3677 | } |
---|
.. | .. |
---|
3726 | 3986 | if (child == null) |
---|
3727 | 3987 | continue; |
---|
3728 | 3988 | |
---|
3729 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3989 | + if (Grafreed.RENDERME > 0) |
---|
3730 | 3990 | { |
---|
3731 | 3991 | if (child instanceof Merge) |
---|
3732 | 3992 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3877 | 4137 | if (child == null) |
---|
3878 | 4138 | continue; |
---|
3879 | 4139 | |
---|
3880 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4140 | + if (Grafreed.RENDERME > 0) |
---|
3881 | 4141 | { |
---|
3882 | 4142 | if (child instanceof Merge) |
---|
3883 | 4143 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4072 | 4332 | if (child == null) |
---|
4073 | 4333 | continue; |
---|
4074 | 4334 | |
---|
4075 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4335 | + if (Grafreed.RENDERME > 0) |
---|
4076 | 4336 | { |
---|
4077 | 4337 | if (child instanceof Merge) |
---|
4078 | 4338 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4185 | 4445 | { |
---|
4186 | 4446 | blockloop = true; |
---|
4187 | 4447 | get(i).RepairShadow(); |
---|
| 4448 | + blockloop = false; |
---|
| 4449 | + } |
---|
| 4450 | + } |
---|
| 4451 | + |
---|
| 4452 | + void RepairSOV() |
---|
| 4453 | + { |
---|
| 4454 | + if (blockloop) |
---|
| 4455 | + return; |
---|
| 4456 | + |
---|
| 4457 | + String texname = this.GetPigmentTexture(); |
---|
| 4458 | + |
---|
| 4459 | + if (texname.startsWith("sov")) |
---|
| 4460 | + { |
---|
| 4461 | + String[] s = texname.split("/"); |
---|
| 4462 | + |
---|
| 4463 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4464 | + |
---|
| 4465 | + texname = sname[0]; |
---|
| 4466 | + |
---|
| 4467 | + if (sname.length > 1) |
---|
| 4468 | + { |
---|
| 4469 | + texname += "Color.jpg"; |
---|
| 4470 | + } |
---|
| 4471 | + |
---|
| 4472 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4473 | + } |
---|
| 4474 | + |
---|
| 4475 | + texname = this.GetBumpTexture(); |
---|
| 4476 | + |
---|
| 4477 | + if (texname.startsWith("sov")) |
---|
| 4478 | + { |
---|
| 4479 | + String[] s = texname.split("/"); |
---|
| 4480 | + |
---|
| 4481 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4482 | + |
---|
| 4483 | + texname = sname[0]; |
---|
| 4484 | + |
---|
| 4485 | + if (sname.length > 1) |
---|
| 4486 | + { |
---|
| 4487 | + texname += "Bump.jpg"; |
---|
| 4488 | + } |
---|
| 4489 | + |
---|
| 4490 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4491 | + } |
---|
| 4492 | + |
---|
| 4493 | + for (int i=0; i<Size(); i++) |
---|
| 4494 | + { |
---|
| 4495 | + blockloop = true; |
---|
| 4496 | + get(i).RepairSOV(); |
---|
4188 | 4497 | blockloop = false; |
---|
4189 | 4498 | } |
---|
4190 | 4499 | } |
---|
.. | .. |
---|
4679 | 4988 | |
---|
4680 | 4989 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4681 | 4990 | { |
---|
4682 | | - if (hide) |
---|
| 4991 | + if (hide || dontselect) |
---|
4683 | 4992 | return null; |
---|
4684 | 4993 | |
---|
4685 | 4994 | if (count <= 0) |
---|
.. | .. |
---|
4703 | 5012 | } |
---|
4704 | 5013 | } |
---|
4705 | 5014 | |
---|
| 5015 | + ObjEditor GetWindow() |
---|
| 5016 | + { |
---|
| 5017 | + if (editWindow != null) |
---|
| 5018 | + return editWindow; |
---|
| 5019 | + |
---|
| 5020 | + return manipWindow; |
---|
| 5021 | + } |
---|
| 5022 | + |
---|
4706 | 5023 | cTreePath Select(int indexcount, boolean deselect) |
---|
4707 | 5024 | { |
---|
4708 | | - if (hide) |
---|
| 5025 | + if (hide || dontselect) |
---|
4709 | 5026 | return null; |
---|
4710 | 5027 | |
---|
4711 | 5028 | if (count <= 0) |
---|
.. | .. |
---|
4739 | 5056 | if (leaf != null) |
---|
4740 | 5057 | { |
---|
4741 | 5058 | cTreePath tp = new cTreePath(this, leaf); |
---|
4742 | | - if (editWindow != null) |
---|
| 5059 | + ObjEditor window = GetWindow(); |
---|
| 5060 | + if (window != null) |
---|
4743 | 5061 | { |
---|
4744 | 5062 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4745 | | - editWindow.Select(tp, deselect, true); |
---|
| 5063 | + window.Select(tp, deselect, true); |
---|
4746 | 5064 | } |
---|
4747 | 5065 | |
---|
4748 | 5066 | return tp; |
---|
.. | .. |
---|
4759 | 5077 | |
---|
4760 | 5078 | if (child == null) |
---|
4761 | 5079 | continue; |
---|
| 5080 | + |
---|
4762 | 5081 | if (child.HasTransparency() && child.size() != 0) |
---|
4763 | 5082 | { |
---|
4764 | 5083 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4768 | 5087 | if (leaf != null) |
---|
4769 | 5088 | { |
---|
4770 | 5089 | cTreePath tp = new cTreePath(this, leaf); |
---|
4771 | | - if (editWindow != null) |
---|
| 5090 | + ObjEditor window = GetWindow(); |
---|
| 5091 | + if (window != null) |
---|
4772 | 5092 | { |
---|
4773 | | - editWindow.Select(tp, deselect, true); |
---|
| 5093 | + window.Select(tp, deselect, true); |
---|
4774 | 5094 | } |
---|
4775 | 5095 | |
---|
4776 | 5096 | return tp; |
---|
.. | .. |
---|
5157 | 5477 | |
---|
5158 | 5478 | // System.out.println("Fullname = " + fullname); |
---|
5159 | 5479 | |
---|
5160 | | - if (fullname.name.indexOf(":") == -1) |
---|
5161 | | - return fullname.name; |
---|
| 5480 | + // Does not work on Windows due to C: |
---|
| 5481 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5482 | +// return fullname.name; |
---|
| 5483 | +// |
---|
| 5484 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5162 | 5485 | |
---|
5163 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5486 | + String[] split = fullname.name.split(":"); |
---|
| 5487 | + |
---|
| 5488 | + if (split.length == 0) |
---|
| 5489 | + { |
---|
| 5490 | + return ""; |
---|
| 5491 | + } |
---|
| 5492 | + |
---|
| 5493 | + if (split.length <= 2) |
---|
| 5494 | + { |
---|
| 5495 | + if (fullname.name.endsWith(":")) |
---|
| 5496 | + { |
---|
| 5497 | + // Windows |
---|
| 5498 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5499 | + } |
---|
| 5500 | + |
---|
| 5501 | + return split[0]; |
---|
| 5502 | + } |
---|
| 5503 | + |
---|
| 5504 | + // Windows |
---|
| 5505 | + assert(split.length == 4); |
---|
| 5506 | + |
---|
| 5507 | + return split[0] + ":" + split[1]; |
---|
5164 | 5508 | } |
---|
5165 | 5509 | |
---|
5166 | 5510 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5169 | 5513 | return ""; |
---|
5170 | 5514 | |
---|
5171 | 5515 | // System.out.println("Fullname = " + fullname); |
---|
5172 | | - if (fullname.name.indexOf(":") == -1) |
---|
5173 | | - return ""; |
---|
5174 | | - |
---|
5175 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5516 | + // Does not work on Windows due to C: |
---|
| 5517 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5518 | +// return ""; |
---|
| 5519 | +// |
---|
| 5520 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5521 | + String[] split = fullname.name.split(":"); |
---|
| 5522 | + |
---|
| 5523 | + if (split.length == 0) |
---|
| 5524 | + { |
---|
| 5525 | + return ""; |
---|
| 5526 | + } |
---|
| 5527 | + |
---|
| 5528 | + if (split.length == 1) |
---|
| 5529 | + { |
---|
| 5530 | + return ""; |
---|
| 5531 | + } |
---|
| 5532 | + |
---|
| 5533 | + if (split.length == 2) |
---|
| 5534 | + { |
---|
| 5535 | + if (fullname.name.endsWith(":")) |
---|
| 5536 | + { |
---|
| 5537 | + // Windows |
---|
| 5538 | + return ""; |
---|
| 5539 | + } |
---|
| 5540 | + |
---|
| 5541 | + return split[1]; |
---|
| 5542 | + } |
---|
| 5543 | + |
---|
| 5544 | + // Windows |
---|
| 5545 | + assert(split.length == 4); |
---|
| 5546 | + |
---|
| 5547 | + return split[2] + ":" + split[3]; |
---|
5176 | 5548 | } |
---|
5177 | 5549 | |
---|
5178 | 5550 | String GetPigmentTexture() |
---|
.. | .. |
---|
5246 | 5618 | System.out.print("; textures = " + textures); |
---|
5247 | 5619 | System.out.println("; usedtextures = " + usedtextures); |
---|
5248 | 5620 | |
---|
5249 | | - if (GetTextures() == null) |
---|
| 5621 | + if (GetTextures() == null) // What is that?? |
---|
5250 | 5622 | GetTextures().name = ":"; |
---|
5251 | 5623 | |
---|
5252 | 5624 | String texname = tex; |
---|
.. | .. |
---|
5277 | 5649 | child.ResetPigmentTexture(); |
---|
5278 | 5650 | blockloop = false; |
---|
5279 | 5651 | } |
---|
| 5652 | + } |
---|
| 5653 | + |
---|
| 5654 | + UUID GetUUID() |
---|
| 5655 | + { |
---|
| 5656 | + if (uuid == null) |
---|
| 5657 | + { |
---|
| 5658 | + // Serial |
---|
| 5659 | + uuid = UUID.randomUUID(); |
---|
| 5660 | + } |
---|
| 5661 | + |
---|
| 5662 | + return uuid; |
---|
| 5663 | + } |
---|
| 5664 | + |
---|
| 5665 | + Object3D GetObject(UUID uid) |
---|
| 5666 | + { |
---|
| 5667 | + if (blockloop) |
---|
| 5668 | + return null; |
---|
| 5669 | + |
---|
| 5670 | + if (GetUUID().equals(uid)) |
---|
| 5671 | + return this; |
---|
| 5672 | + |
---|
| 5673 | + int nb = Size(); |
---|
| 5674 | + for (int i = 0; i < nb; i++) |
---|
| 5675 | + { |
---|
| 5676 | + Object3D child = (Object3D) get(i); |
---|
| 5677 | + |
---|
| 5678 | + if (child == null) |
---|
| 5679 | + continue; |
---|
| 5680 | + |
---|
| 5681 | + blockloop = true; |
---|
| 5682 | + Object3D obj = child.GetObject(uid); |
---|
| 5683 | + blockloop = false; |
---|
| 5684 | + if (obj != null) |
---|
| 5685 | + return obj; |
---|
| 5686 | + } |
---|
| 5687 | + |
---|
| 5688 | + return null; |
---|
5280 | 5689 | } |
---|
5281 | 5690 | |
---|
5282 | 5691 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5323 | 5732 | boolean NeedSupport() |
---|
5324 | 5733 | { |
---|
5325 | 5734 | return |
---|
5326 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5735 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5327 | 5736 | // PROBLEM with CROWD!! |
---|
5328 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5737 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5329 | 5738 | } |
---|
5330 | 5739 | |
---|
5331 | 5740 | static boolean DEBUG_SELECTION = false; |
---|
| 5741 | + |
---|
| 5742 | + boolean IsLive() |
---|
| 5743 | + { |
---|
| 5744 | + if (live) |
---|
| 5745 | + return true; |
---|
| 5746 | + |
---|
| 5747 | + if (parent == null) |
---|
| 5748 | + return false; |
---|
| 5749 | + |
---|
| 5750 | + return parent.IsLive(); |
---|
| 5751 | + } |
---|
5332 | 5752 | |
---|
5333 | 5753 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5334 | 5754 | { |
---|
.. | .. |
---|
5340 | 5760 | } |
---|
5341 | 5761 | |
---|
5342 | 5762 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5343 | | - hide) |
---|
| 5763 | + (hide || dontselect)) |
---|
5344 | 5764 | return; |
---|
5345 | 5765 | |
---|
5346 | 5766 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5391 | 5811 | support = support; |
---|
5392 | 5812 | |
---|
5393 | 5813 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5394 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5814 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5395 | 5815 | |
---|
5396 | 5816 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5397 | 5817 | { |
---|
.. | .. |
---|
5411 | 5831 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5412 | 5832 | |
---|
5413 | 5833 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5414 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5834 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5835 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5415 | 5836 | { |
---|
5416 | 5837 | Globals.lighttouched = true; |
---|
5417 | 5838 | } // all panes... |
---|
| 5839 | + |
---|
5418 | 5840 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5419 | 5841 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5420 | 5842 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5542 | 5964 | if (GetBRep() != null) |
---|
5543 | 5965 | { |
---|
5544 | 5966 | display.NextIndex(); |
---|
| 5967 | + |
---|
5545 | 5968 | // vertex color conflict : gl.glCallList(list); |
---|
5546 | 5969 | DrawNode(display, root, selected); |
---|
5547 | 5970 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5582 | 6005 | tex = GetTextures(); |
---|
5583 | 6006 | } |
---|
5584 | 6007 | |
---|
5585 | | - display.BindTextures(tex, texres); |
---|
| 6008 | + boolean failedPigment = false; |
---|
| 6009 | + boolean failedBump = false; |
---|
| 6010 | + |
---|
| 6011 | + try |
---|
| 6012 | + { |
---|
| 6013 | + display.BindPigmentTexture(tex, texres); |
---|
| 6014 | + } |
---|
| 6015 | + catch (Exception e) |
---|
| 6016 | + { |
---|
| 6017 | + System.err.println("FAILED: " + this); |
---|
| 6018 | + failedPigment = true; |
---|
| 6019 | + } |
---|
| 6020 | + |
---|
| 6021 | + try |
---|
| 6022 | + { |
---|
| 6023 | + display.BindBumpTexture(tex, texres); |
---|
| 6024 | + } |
---|
| 6025 | + catch (Exception e) |
---|
| 6026 | + { |
---|
| 6027 | + //System.err.println("FAILED: " + this); |
---|
| 6028 | + failedBump = true; |
---|
| 6029 | + } |
---|
5586 | 6030 | |
---|
5587 | 6031 | if (!compiled) |
---|
5588 | 6032 | { |
---|
.. | .. |
---|
5604 | 6048 | } |
---|
5605 | 6049 | } |
---|
5606 | 6050 | |
---|
5607 | | - display.ReleaseTextures(tex); |
---|
| 6051 | + if (!failedBump) |
---|
| 6052 | + display.ReleaseBumpTexture(tex); |
---|
| 6053 | + |
---|
| 6054 | + if (!failedPigment) |
---|
| 6055 | + display.ReleasePigmentTexture(tex); |
---|
5608 | 6056 | |
---|
5609 | 6057 | display.PopMaterial(this, selected); |
---|
5610 | 6058 | } |
---|
.. | .. |
---|
5733 | 6181 | |
---|
5734 | 6182 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5735 | 6183 | { |
---|
| 6184 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6185 | + return; |
---|
| 6186 | + |
---|
5736 | 6187 | if (hide) |
---|
5737 | 6188 | return; |
---|
5738 | 6189 | // shadow optimisation |
---|
.. | .. |
---|
5858 | 6309 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5859 | 6310 | return; // no shadow for transparent objects |
---|
5860 | 6311 | |
---|
| 6312 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6313 | + return; |
---|
| 6314 | + |
---|
5861 | 6315 | if (hide) |
---|
5862 | 6316 | return; |
---|
5863 | 6317 | |
---|
.. | .. |
---|
5898 | 6352 | return; |
---|
5899 | 6353 | } |
---|
5900 | 6354 | |
---|
| 6355 | + //bRep.GenUV(1/material.diffuseness); |
---|
5901 | 6356 | // bRep.lock = true; |
---|
5902 | 6357 | |
---|
5903 | 6358 | //javax.media.opengl.GL gl = display.GetGL(); |
---|
.. | .. |
---|
5970 | 6425 | // dec 2012 |
---|
5971 | 6426 | new Exception().printStackTrace(); |
---|
5972 | 6427 | return; |
---|
| 6428 | + } |
---|
| 6429 | + |
---|
| 6430 | + if (dontselect) |
---|
| 6431 | + { |
---|
| 6432 | + //bRep.GenerateNormalsMINE(); |
---|
5973 | 6433 | } |
---|
5974 | 6434 | |
---|
5975 | 6435 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6822 | 7282 | spot.translate(32, 32); |
---|
6823 | 7283 | spotw = spot.x + spot.width; |
---|
6824 | 7284 | spoth = spot.y + spot.height; |
---|
6825 | | - info.g.setColor(Color.blue); |
---|
| 7285 | + info.g.setColor(Color.cyan); |
---|
6826 | 7286 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6827 | 7287 | // if (CameraPane.Xmin > spot.x) |
---|
6828 | 7288 | // { |
---|
.. | .. |
---|
6840 | 7300 | // { |
---|
6841 | 7301 | // CameraPane.Ymax = spoth; |
---|
6842 | 7302 | // } |
---|
6843 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6844 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7303 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7304 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6845 | 7305 | spot.translate(0, -32); |
---|
6846 | | - info.g.setColor(Color.green); |
---|
| 7306 | + info.g.setColor(Color.yellow); |
---|
6847 | 7307 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7308 | + info.g.setColor(Color.green); |
---|
6848 | 7309 | // if (CameraPane.Xmin > spot.x) |
---|
6849 | 7310 | // { |
---|
6850 | 7311 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6861 | 7322 | // { |
---|
6862 | 7323 | // CameraPane.Ymax = spoth; |
---|
6863 | 7324 | // } |
---|
6864 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6865 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7325 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7326 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
6866 | 7327 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6867 | 7328 | // if (CameraPane.Xmin > boundary.x) |
---|
6868 | 7329 | // { |
---|
.. | .. |
---|
6896 | 7357 | startX = info.x; |
---|
6897 | 7358 | startY = info.y; |
---|
6898 | 7359 | |
---|
6899 | | - hitSomething = 0; |
---|
| 7360 | + hitSomething = -1; |
---|
6900 | 7361 | cVector origin = new cVector(); |
---|
6901 | 7362 | //LA.xformPos(origin, toParent, origin); |
---|
6902 | 7363 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6929 | 7390 | } |
---|
6930 | 7391 | |
---|
6931 | 7392 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6932 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7393 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6933 | 7394 | //System.out.println("modified = " + modified); |
---|
6934 | 7395 | //new Exception().printStackTrace(); |
---|
6935 | 7396 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6957 | 7418 | return true; |
---|
6958 | 7419 | } |
---|
6959 | 7420 | |
---|
6960 | | - void doEditDrag0(ClickInfo info) |
---|
| 7421 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6961 | 7422 | { |
---|
6962 | 7423 | if (hitSomething == 0) |
---|
6963 | 7424 | { |
---|
.. | .. |
---|
6972 | 7433 | //System.out.println("hitSomething = " + hitSomething); |
---|
6973 | 7434 | |
---|
6974 | 7435 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7436 | + |
---|
6975 | 7437 | cVector xlate = new cVector(); |
---|
6976 | 7438 | //cVector xlate2 = new cVector(); |
---|
6977 | 7439 | switch (hitSomething) |
---|
.. | .. |
---|
6984 | 7446 | |
---|
6985 | 7447 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6986 | 7448 | |
---|
6987 | | - if (modified) |
---|
| 7449 | + if (modified || opposite) |
---|
6988 | 7450 | { |
---|
6989 | 7451 | //assert(false); |
---|
6990 | 7452 | /* |
---|
.. | .. |
---|
7078 | 7540 | |
---|
7079 | 7541 | if (modified) |
---|
7080 | 7542 | { |
---|
| 7543 | + // Rotate 90 degrees |
---|
7081 | 7544 | angle /= (Math.PI / 4); |
---|
7082 | 7545 | angle = Math.floor(angle + 0.5); |
---|
7083 | 7546 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7119 | 7582 | |
---|
7120 | 7583 | case hitScale: // scale |
---|
7121 | 7584 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7585 | + double sign = 1; |
---|
| 7586 | + if (hScale < 0) |
---|
| 7587 | + { |
---|
| 7588 | + sign = -1; |
---|
| 7589 | + } |
---|
| 7590 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7122 | 7591 | if (hScale < 0.01) |
---|
7123 | 7592 | { |
---|
7124 | | - hScale = 0.01; |
---|
| 7593 | + //hScale = 0.01; |
---|
7125 | 7594 | } |
---|
7126 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7127 | | - if (hScale < 0.01) |
---|
7128 | | - { |
---|
7129 | | - hScale = 0.01; |
---|
7130 | | - } |
---|
| 7595 | + |
---|
7131 | 7596 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7132 | | - if (vScale < 0.01) |
---|
| 7597 | + sign = 1; |
---|
| 7598 | + if (vScale < 0) |
---|
7133 | 7599 | { |
---|
7134 | | - vScale = 0.01; |
---|
| 7600 | + sign = -1; |
---|
7135 | 7601 | } |
---|
7136 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7602 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7137 | 7603 | if (vScale < 0.01) |
---|
7138 | 7604 | { |
---|
7139 | | - vScale = 0.01; |
---|
| 7605 | + //vScale = 0.01; |
---|
7140 | 7606 | } |
---|
7141 | 7607 | LA.matCopy(startMat, toParent); |
---|
7142 | 7608 | /**/ |
---|
.. | .. |
---|
7147 | 7613 | } |
---|
7148 | 7614 | /**/ |
---|
7149 | 7615 | |
---|
| 7616 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7617 | + |
---|
| 7618 | + if (totalScale < 0.01) |
---|
| 7619 | + { |
---|
| 7620 | + totalScale = 0.01; |
---|
| 7621 | + } |
---|
| 7622 | + |
---|
7150 | 7623 | switch (info.pane.RenderCamera().viewCode) |
---|
7151 | 7624 | { |
---|
7152 | 7625 | case 3: // '\001' |
---|
7153 | | - if (modified) |
---|
| 7626 | + if (modified || opposite) |
---|
7154 | 7627 | { |
---|
7155 | 7628 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7156 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7629 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7157 | 7630 | } // vScale, 1); |
---|
7158 | 7631 | else |
---|
7159 | 7632 | { |
---|
7160 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7633 | + // EXCEPTION! |
---|
| 7634 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7161 | 7635 | } // vScale, 1); |
---|
7162 | 7636 | break; |
---|
7163 | 7637 | |
---|
7164 | 7638 | case 2: // '\002' |
---|
7165 | | - if (modified) |
---|
| 7639 | + if (modified || opposite) |
---|
7166 | 7640 | { |
---|
7167 | 7641 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7168 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7642 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7169 | 7643 | } else |
---|
7170 | 7644 | { |
---|
7171 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7645 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7172 | 7646 | } |
---|
7173 | 7647 | break; |
---|
7174 | 7648 | |
---|
7175 | 7649 | case 1: // '\003' |
---|
7176 | | - if (modified) |
---|
| 7650 | + if (modified || opposite) |
---|
7177 | 7651 | { |
---|
7178 | 7652 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7179 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7653 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7180 | 7654 | } else |
---|
7181 | 7655 | { |
---|
7182 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7656 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7183 | 7657 | } |
---|
7184 | 7658 | break; |
---|
7185 | 7659 | } |
---|
.. | .. |
---|
7312 | 7786 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7313 | 7787 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7314 | 7788 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7789 | + |
---|
| 7790 | + String objname; |
---|
| 7791 | + |
---|
7315 | 7792 | if (false) //parent != null) |
---|
7316 | 7793 | { |
---|
7317 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7794 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7318 | 7795 | } else |
---|
7319 | 7796 | { |
---|
7320 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7797 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7321 | 7798 | } // + super.toString(); |
---|
7322 | 7799 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7800 | + |
---|
| 7801 | + if (!Globals.ADVANCED) |
---|
| 7802 | + return objname; |
---|
| 7803 | + |
---|
| 7804 | + return objname + " " + System.identityHashCode(this); |
---|
7323 | 7805 | } |
---|
7324 | 7806 | |
---|
7325 | 7807 | public int hashCode() |
---|
.. | .. |
---|
7375 | 7857 | objectUI.closeUI(); |
---|
7376 | 7858 | if (editWindow != null) |
---|
7377 | 7859 | { |
---|
| 7860 | + editWindow.ctrlPanel.FlushUI(); |
---|
7378 | 7861 | editWindow.refreshContents(); |
---|
7379 | 7862 | } // ? new |
---|
7380 | 7863 | objectUI = null; |
---|
.. | .. |
---|
7383 | 7866 | { |
---|
7384 | 7867 | editWindow = null; |
---|
7385 | 7868 | } // ? |
---|
| 7869 | + } |
---|
| 7870 | + else |
---|
| 7871 | + { |
---|
| 7872 | + //editWindow.closeUI(); |
---|
7386 | 7873 | } |
---|
7387 | 7874 | } |
---|
7388 | 7875 | |
---|
.. | .. |
---|
7395 | 7882 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7396 | 7883 | |
---|
7397 | 7884 | Object3D /*Composite*/ parent; |
---|
7398 | | - Object3D /*Composite*/ fileparent; |
---|
| 7885 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7399 | 7886 | |
---|
7400 | 7887 | double[][] toParent; // dynamic matrix |
---|
7401 | 7888 | double[][] fromParent; |
---|
.. | .. |
---|
7510 | 7997 | { |
---|
7511 | 7998 | assert(bRep != null); |
---|
7512 | 7999 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7513 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8000 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7514 | 8001 | } |
---|
7515 | 8002 | else |
---|
7516 | 8003 | { |
---|
.. | .. |
---|
7541 | 8028 | } |
---|
7542 | 8029 | |
---|
7543 | 8030 | transient ObjEditor editWindow; |
---|
| 8031 | + transient ObjEditor manipWindow; |
---|
| 8032 | + |
---|
| 8033 | + transient boolean pinned; |
---|
| 8034 | + |
---|
7544 | 8035 | transient ObjectUI objectUI; |
---|
7545 | 8036 | public static int povDepth = 0; |
---|
7546 | 8037 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7559 | 8050 | private static cVector edge2 = new cVector(); |
---|
7560 | 8051 | //private static cVector norm = new cVector(); |
---|
7561 | 8052 | /*transient private*/ int hitSomething; |
---|
7562 | | - private static final int hitCenter = 1; |
---|
7563 | | - private static final int hitScale = 2; |
---|
7564 | | - private static final int hitRotate = 3; |
---|
| 8053 | + static final int hitCenter = 1; |
---|
| 8054 | + static final int hitScale = 2; |
---|
| 8055 | + static final int hitRotate = 3; |
---|
7565 | 8056 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7566 | 8057 | /*transient*/ private Point centerPt; |
---|
7567 | 8058 | /*transient*/ private int startX; |
---|