.. | .. |
---|
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 | + o.versions = this.versions; |
---|
| 223 | + o.versionindex = this.versionindex; |
---|
| 224 | + |
---|
| 225 | + if (this.support != null) |
---|
| 226 | + { |
---|
| 227 | + if (o.transientrep != null) |
---|
| 228 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 229 | + |
---|
| 230 | + o.transientrep = this.support.bRep; |
---|
| 231 | + this.support.bRep = null; |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + // o.support = this.support; |
---|
| 235 | + // o.fileparent = this.fileparent; |
---|
| 236 | + // if (this.bRep != null) |
---|
| 237 | + // o.bRep = this.bRep.support; |
---|
| 238 | + |
---|
| 239 | + this.bRep = null; |
---|
| 240 | + // if (this.bRep != null) |
---|
| 241 | + // this.bRep.support = null; |
---|
| 242 | + // this.support = null; |
---|
| 243 | + // this.fileparent = null; |
---|
| 244 | + } |
---|
| 245 | + |
---|
| 246 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 247 | + { |
---|
| 248 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 249 | + return; |
---|
| 250 | + |
---|
| 251 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 252 | + |
---|
| 253 | + RestoreBigData(o); |
---|
| 254 | + |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
130 | 258 | blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
| 261 | + |
---|
| 262 | + for (int i=0; i<Size(); i++) |
---|
| 263 | + { |
---|
| 264 | + get(i).RestoreBigData(hashtable); |
---|
| 265 | + } |
---|
| 266 | + |
---|
132 | 267 | blockloop = false; |
---|
133 | 268 | } |
---|
134 | | -} |
---|
135 | 269 | |
---|
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) |
---|
| 270 | + void RestoreBigData(Object3D o) |
---|
147 | 271 | { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 272 | + this.bRep = o.bRep; |
---|
| 273 | + if (this.support != null && o.transientrep != null) |
---|
| 274 | + { |
---|
| 275 | + this.support.bRep = o.transientrep; |
---|
| 276 | + } |
---|
| 277 | + |
---|
| 278 | + this.selection = o.selection; |
---|
| 279 | + |
---|
| 280 | + this.versions = o.versions; |
---|
| 281 | + this.versionindex = o.versionindex; |
---|
| 282 | +// July 2019 if (this.bRep != null) |
---|
| 283 | +// this.bRep.support = o.transientrep; |
---|
| 284 | + // this.support = o.support; |
---|
| 285 | + // this.fileparent = o.fileparent; |
---|
149 | 286 | } |
---|
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 | 287 | |
---|
162 | 288 | // MOCAP SUPPORT |
---|
163 | 289 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
300 | 426 | } |
---|
301 | 427 | |
---|
302 | 428 | boolean live = false; |
---|
| 429 | + boolean dontselect = false; |
---|
303 | 430 | boolean hide = false; |
---|
304 | 431 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 432 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 608 | toParent = LA.newMatrix(); |
---|
482 | 609 | fromParent = LA.newMatrix(); |
---|
483 | 610 | } |
---|
| 611 | + |
---|
484 | 612 | if (toParentMarked == null) |
---|
485 | 613 | { |
---|
486 | 614 | if (maxcount != 1) |
---|
487 | 615 | { |
---|
488 | 616 | new Exception().printStackTrace(); |
---|
489 | 617 | } |
---|
| 618 | + |
---|
490 | 619 | toParentMarked = LA.newMatrix(); |
---|
491 | 620 | fromParentMarked = LA.newMatrix(); |
---|
492 | 621 | } |
---|
.. | .. |
---|
774 | 903 | if (step == 0) |
---|
775 | 904 | step = 1; |
---|
776 | 905 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 906 | + maxcount = 128; // 2048; // 4; |
---|
778 | 907 | // if (acceleration == 0) |
---|
779 | 908 | // acceleration = 10; |
---|
780 | 909 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 926 | |
---|
798 | 927 | if (marked && Globals.isLIVE() && live && |
---|
799 | 928 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 929 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 930 | currentframe != Globals.framecount) |
---|
802 | 931 | { |
---|
803 | 932 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 938 | |
---|
810 | 939 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 940 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 941 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 942 | + (step == 1 && changedir)) |
---|
813 | 943 | { |
---|
814 | 944 | countdown = 1; |
---|
815 | 945 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1011 | if (material == null || material.multiply) |
---|
882 | 1012 | return true; |
---|
883 | 1013 | |
---|
| 1014 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1015 | return material.opacity > 0.99; |
---|
885 | 1016 | } |
---|
886 | 1017 | |
---|
.. | .. |
---|
912 | 1043 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1044 | bRep = null; // new BoundaryRep(); |
---|
914 | 1045 | |
---|
| 1046 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1047 | + { |
---|
| 1048 | + name = oname; |
---|
| 1049 | + } |
---|
| 1050 | + |
---|
915 | 1051 | /* |
---|
916 | 1052 | float hue = (float)Math.random(); |
---|
917 | 1053 | Color col; |
---|
.. | .. |
---|
954 | 1090 | |
---|
955 | 1091 | public Object clone() |
---|
956 | 1092 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1093 | + return Grafreed.clone(this); |
---|
958 | 1094 | } |
---|
959 | 1095 | |
---|
960 | 1096 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1412 | toParent = LA.newMatrix(); |
---|
1277 | 1413 | fromParent = LA.newMatrix(); |
---|
1278 | 1414 | } |
---|
| 1415 | + |
---|
1279 | 1416 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1417 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1418 | |
---|
.. | .. |
---|
1470 | 1607 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1608 | |
---|
1472 | 1609 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1610 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1611 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1612 | } |
---|
1476 | 1613 | |
---|
.. | .. |
---|
1729 | 1866 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1867 | o.bRep = transientrep; |
---|
1731 | 1868 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1869 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1870 | o.CreateMaterial(); |
---|
1734 | 1871 | o.SetAttributes(this, -1); |
---|
1735 | 1872 | //parent |
---|
.. | .. |
---|
1742 | 1879 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1880 | o.bRep = bRep; |
---|
1744 | 1881 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1882 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1883 | o.CreateMaterial(); |
---|
1747 | 1884 | //o.overwriteThis(this, -1); |
---|
1748 | 1885 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1966 | if (obj.name == null) |
---|
1830 | 1967 | continue; // can't be a null one |
---|
1831 | 1968 | |
---|
| 1969 | + // Try perfect match first. |
---|
1832 | 1970 | if (n.equals(obj.name)) |
---|
1833 | 1971 | { |
---|
1834 | 1972 | theobj = obj; |
---|
1835 | 1973 | count++; |
---|
1836 | 1974 | } |
---|
1837 | 1975 | } |
---|
| 1976 | + |
---|
| 1977 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1978 | |
---|
1839 | 1979 | if (count != 1) |
---|
1840 | 1980 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2434 | } |
---|
2295 | 2435 | */ |
---|
2296 | 2436 | } |
---|
| 2437 | + else |
---|
| 2438 | + { |
---|
| 2439 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2440 | + } |
---|
2297 | 2441 | } |
---|
2298 | 2442 | |
---|
2299 | 2443 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2335 | 2479 | { |
---|
2336 | 2480 | editWindow.refreshContents(); |
---|
2337 | 2481 | } |
---|
| 2482 | + else |
---|
| 2483 | + { |
---|
| 2484 | + if (manipWindow != null) |
---|
| 2485 | + { |
---|
| 2486 | + manipWindow.refreshContents(); |
---|
| 2487 | + } |
---|
| 2488 | + } |
---|
| 2489 | + |
---|
2338 | 2490 | //if (parent != null) |
---|
2339 | 2491 | //parent.refreshEditWindow(); |
---|
2340 | 2492 | } |
---|
.. | .. |
---|
2477 | 2629 | return retval; |
---|
2478 | 2630 | } |
---|
2479 | 2631 | |
---|
2480 | | - void doEditDrag(ClickInfo info) |
---|
| 2632 | + void doEditDrag(ClickInfo info, boolean opposite) |
---|
2481 | 2633 | { |
---|
2482 | 2634 | switch (doSomething) |
---|
2483 | 2635 | { |
---|
2484 | 2636 | case 1: // '\001' |
---|
2485 | 2637 | //super. |
---|
2486 | | - doEditDrag0(info); |
---|
| 2638 | + doEditDrag0(info, opposite); |
---|
2487 | 2639 | break; |
---|
2488 | 2640 | |
---|
2489 | 2641 | case 2: // '\002' |
---|
.. | .. |
---|
2496 | 2648 | { |
---|
2497 | 2649 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2498 | 2650 | //childToDrag.doEditDrag(info); |
---|
2499 | | - sel.doEditDrag(info); |
---|
| 2651 | + sel.doEditDrag(info, opposite); |
---|
2500 | 2652 | } else |
---|
2501 | 2653 | { |
---|
2502 | 2654 | //super. |
---|
2503 | | - doEditDrag0(info); |
---|
| 2655 | + doEditDrag0(info, opposite); |
---|
2504 | 2656 | } |
---|
2505 | 2657 | } |
---|
2506 | 2658 | break; |
---|
.. | .. |
---|
2610 | 2762 | void GenNormalsS(boolean crease) |
---|
2611 | 2763 | { |
---|
2612 | 2764 | selection.GenNormals(crease); |
---|
| 2765 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2766 | +// { |
---|
| 2767 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2768 | +// selectee.GenNormals(crease); |
---|
| 2769 | +// } |
---|
| 2770 | + |
---|
| 2771 | + //Touch(); |
---|
| 2772 | + } |
---|
| 2773 | + |
---|
| 2774 | + void GenNormalsMeshS() |
---|
| 2775 | + { |
---|
| 2776 | + selection.GenNormalsMesh(); |
---|
2613 | 2777 | // for (int i=0; i<selection.size(); i++) |
---|
2614 | 2778 | // { |
---|
2615 | 2779 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2750 | 2914 | if (child == null) |
---|
2751 | 2915 | continue; |
---|
2752 | 2916 | child.GenNormals(crease); |
---|
| 2917 | +// Children().release(i); |
---|
| 2918 | + } |
---|
| 2919 | + blockloop = false; |
---|
| 2920 | + } |
---|
| 2921 | + |
---|
| 2922 | + void GenNormalsMesh() |
---|
| 2923 | + { |
---|
| 2924 | + if (blockloop) |
---|
| 2925 | + return; |
---|
| 2926 | + |
---|
| 2927 | + blockloop = true; |
---|
| 2928 | + GenNormalsMesh0(); |
---|
| 2929 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2930 | + { |
---|
| 2931 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2932 | + if (child == null) |
---|
| 2933 | + continue; |
---|
| 2934 | + child.GenNormalsMesh(); |
---|
2753 | 2935 | // Children().release(i); |
---|
2754 | 2936 | } |
---|
2755 | 2937 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3104 | } |
---|
2923 | 3105 | } |
---|
2924 | 3106 | |
---|
| 3107 | + void GenNormalsMesh0() |
---|
| 3108 | + { |
---|
| 3109 | + if (bRep != null) |
---|
| 3110 | + { |
---|
| 3111 | + bRep.GenerateNormalsMesh(); |
---|
| 3112 | + Touch(); |
---|
| 3113 | + } |
---|
| 3114 | + } |
---|
| 3115 | + |
---|
2925 | 3116 | void GenNormalsMINE0() |
---|
2926 | 3117 | { |
---|
2927 | 3118 | if (bRep != null) |
---|
2928 | 3119 | { |
---|
2929 | | - bRep.GenerateNormalsMINE(); |
---|
| 3120 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
2930 | 3121 | Touch(); |
---|
2931 | 3122 | } |
---|
2932 | 3123 | } |
---|
.. | .. |
---|
2983 | 3174 | blockloop = false; |
---|
2984 | 3175 | } |
---|
2985 | 3176 | |
---|
| 3177 | + void TransformChildren() |
---|
| 3178 | + { |
---|
| 3179 | + if (toParent != null) |
---|
| 3180 | + { |
---|
| 3181 | + for (int i=Size(); --i>=0;) |
---|
| 3182 | + { |
---|
| 3183 | + Object3D v = get(i); |
---|
| 3184 | + |
---|
| 3185 | + if (v.toParent == null) |
---|
| 3186 | + { |
---|
| 3187 | + v.toParent = LA.newMatrix(); |
---|
| 3188 | + v.fromParent = LA.newMatrix(); |
---|
| 3189 | + } |
---|
| 3190 | + |
---|
| 3191 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3192 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3193 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3194 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3195 | + } |
---|
| 3196 | + |
---|
| 3197 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3198 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3199 | + |
---|
| 3200 | + Touch(); |
---|
| 3201 | + } |
---|
| 3202 | + } |
---|
| 3203 | + |
---|
2986 | 3204 | void TransformGeometry() |
---|
2987 | 3205 | { |
---|
2988 | 3206 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3422 | |
---|
3205 | 3423 | BoundaryRep sup = bRep.support; |
---|
3206 | 3424 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3425 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3426 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3427 | + |
---|
| 3428 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3429 | + |
---|
3210 | 3430 | bRep = temprep; |
---|
3211 | 3431 | bRep.support = sup; |
---|
3212 | 3432 | Touch(); |
---|
.. | .. |
---|
3343 | 3563 | if (blockloop) |
---|
3344 | 3564 | return; |
---|
3345 | 3565 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3566 | + if (//marked || // does not make sense |
---|
| 3567 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3568 | live = h; |
---|
3348 | 3569 | |
---|
3349 | 3570 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3585 | return; |
---|
3365 | 3586 | |
---|
3366 | 3587 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3588 | + if (//marked || // does not make sense |
---|
| 3589 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3590 | link2master = h; |
---|
3369 | 3591 | |
---|
3370 | 3592 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3606 | if (blockloop) |
---|
3385 | 3607 | return; |
---|
3386 | 3608 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3609 | + if (//marked || // does not make sense |
---|
| 3610 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3611 | hide = h; |
---|
3389 | 3612 | |
---|
3390 | 3613 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3627 | if (blockloop) |
---|
3405 | 3628 | return; |
---|
3406 | 3629 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3630 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3631 | marked = h; |
---|
3409 | 3632 | |
---|
3410 | 3633 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3637 | continue; |
---|
3415 | 3638 | blockloop = true; |
---|
3416 | 3639 | child.MarkLeaves(h); |
---|
| 3640 | + blockloop = false; |
---|
| 3641 | + // release(i); |
---|
| 3642 | + } |
---|
| 3643 | + } |
---|
| 3644 | + |
---|
| 3645 | + void RewindLeaves(boolean h) |
---|
| 3646 | + { |
---|
| 3647 | + if (blockloop) |
---|
| 3648 | + return; |
---|
| 3649 | + |
---|
| 3650 | + if (bRep != null || material != null) // borderline... |
---|
| 3651 | + rewind = h; |
---|
| 3652 | + |
---|
| 3653 | + for (int i = 0; i < Size(); i++) |
---|
| 3654 | + { |
---|
| 3655 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3656 | + if (child == null) |
---|
| 3657 | + continue; |
---|
| 3658 | + blockloop = true; |
---|
| 3659 | + child.RewindLeaves(h); |
---|
| 3660 | + blockloop = false; |
---|
| 3661 | + // release(i); |
---|
| 3662 | + } |
---|
| 3663 | + } |
---|
| 3664 | + |
---|
| 3665 | + void RandomLeaves(boolean h) |
---|
| 3666 | + { |
---|
| 3667 | + if (blockloop) |
---|
| 3668 | + return; |
---|
| 3669 | + |
---|
| 3670 | + if (bRep != null || material != null) // borderline... |
---|
| 3671 | + random = h; |
---|
| 3672 | + |
---|
| 3673 | + for (int i = 0; i < Size(); i++) |
---|
| 3674 | + { |
---|
| 3675 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3676 | + if (child == null) |
---|
| 3677 | + continue; |
---|
| 3678 | + blockloop = true; |
---|
| 3679 | + child.RandomLeaves(h); |
---|
3417 | 3680 | blockloop = false; |
---|
3418 | 3681 | // release(i); |
---|
3419 | 3682 | } |
---|
.. | .. |
---|
3728 | 3991 | if (child == null) |
---|
3729 | 3992 | continue; |
---|
3730 | 3993 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3994 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3995 | { |
---|
3733 | 3996 | if (child instanceof Merge) |
---|
3734 | 3997 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4142 | if (child == null) |
---|
3880 | 4143 | continue; |
---|
3881 | 4144 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4145 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4146 | { |
---|
3884 | 4147 | if (child instanceof Merge) |
---|
3885 | 4148 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4337 | if (child == null) |
---|
4075 | 4338 | continue; |
---|
4076 | 4339 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4340 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4341 | { |
---|
4079 | 4342 | if (child instanceof Merge) |
---|
4080 | 4343 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4450 | { |
---|
4188 | 4451 | blockloop = true; |
---|
4189 | 4452 | get(i).RepairShadow(); |
---|
| 4453 | + blockloop = false; |
---|
| 4454 | + } |
---|
| 4455 | + } |
---|
| 4456 | + |
---|
| 4457 | + void RepairSOV() |
---|
| 4458 | + { |
---|
| 4459 | + if (blockloop) |
---|
| 4460 | + return; |
---|
| 4461 | + |
---|
| 4462 | + String texname = this.GetPigmentTexture(); |
---|
| 4463 | + |
---|
| 4464 | + if (texname.startsWith("sov")) |
---|
| 4465 | + { |
---|
| 4466 | + String[] s = texname.split("/"); |
---|
| 4467 | + |
---|
| 4468 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4469 | + |
---|
| 4470 | + texname = sname[0]; |
---|
| 4471 | + |
---|
| 4472 | + if (sname.length > 1) |
---|
| 4473 | + { |
---|
| 4474 | + texname += "Color.jpg"; |
---|
| 4475 | + } |
---|
| 4476 | + |
---|
| 4477 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4478 | + } |
---|
| 4479 | + |
---|
| 4480 | + texname = this.GetBumpTexture(); |
---|
| 4481 | + |
---|
| 4482 | + if (texname.startsWith("sov")) |
---|
| 4483 | + { |
---|
| 4484 | + String[] s = texname.split("/"); |
---|
| 4485 | + |
---|
| 4486 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4487 | + |
---|
| 4488 | + texname = sname[0]; |
---|
| 4489 | + |
---|
| 4490 | + if (sname.length > 1) |
---|
| 4491 | + { |
---|
| 4492 | + texname += "Bump.jpg"; |
---|
| 4493 | + } |
---|
| 4494 | + |
---|
| 4495 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4496 | + } |
---|
| 4497 | + |
---|
| 4498 | + for (int i=0; i<Size(); i++) |
---|
| 4499 | + { |
---|
| 4500 | + blockloop = true; |
---|
| 4501 | + get(i).RepairSOV(); |
---|
4190 | 4502 | blockloop = false; |
---|
4191 | 4503 | } |
---|
4192 | 4504 | } |
---|
.. | .. |
---|
4681 | 4993 | |
---|
4682 | 4994 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4995 | { |
---|
4684 | | - if (hide) |
---|
| 4996 | + if (hide || dontselect) |
---|
4685 | 4997 | return null; |
---|
4686 | 4998 | |
---|
4687 | 4999 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5017 | } |
---|
4706 | 5018 | } |
---|
4707 | 5019 | |
---|
| 5020 | + ObjEditor GetWindow() |
---|
| 5021 | + { |
---|
| 5022 | + if (editWindow != null) |
---|
| 5023 | + return editWindow; |
---|
| 5024 | + |
---|
| 5025 | + return manipWindow; |
---|
| 5026 | + } |
---|
| 5027 | + |
---|
4708 | 5028 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5029 | { |
---|
4710 | | - if (hide) |
---|
| 5030 | + if (hide || dontselect) |
---|
4711 | 5031 | return null; |
---|
4712 | 5032 | |
---|
4713 | 5033 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5061 | if (leaf != null) |
---|
4742 | 5062 | { |
---|
4743 | 5063 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5064 | + ObjEditor window = GetWindow(); |
---|
| 5065 | + if (window != null) |
---|
4745 | 5066 | { |
---|
4746 | 5067 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5068 | + window.Select(tp, deselect, true); |
---|
4748 | 5069 | } |
---|
4749 | 5070 | |
---|
4750 | 5071 | return tp; |
---|
.. | .. |
---|
4761 | 5082 | |
---|
4762 | 5083 | if (child == null) |
---|
4763 | 5084 | continue; |
---|
| 5085 | + |
---|
4764 | 5086 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5087 | { |
---|
4766 | 5088 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5092 | if (leaf != null) |
---|
4771 | 5093 | { |
---|
4772 | 5094 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5095 | + ObjEditor window = GetWindow(); |
---|
| 5096 | + if (window != null) |
---|
4774 | 5097 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5098 | + window.Select(tp, deselect, true); |
---|
4776 | 5099 | } |
---|
4777 | 5100 | |
---|
4778 | 5101 | return tp; |
---|
.. | .. |
---|
5159 | 5482 | |
---|
5160 | 5483 | // System.out.println("Fullname = " + fullname); |
---|
5161 | 5484 | |
---|
5162 | | - if (fullname.name.indexOf(":") == -1) |
---|
5163 | | - return fullname.name; |
---|
| 5485 | + // Does not work on Windows due to C: |
---|
| 5486 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5487 | +// return fullname.name; |
---|
| 5488 | +// |
---|
| 5489 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5164 | 5490 | |
---|
5165 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5491 | + String[] split = fullname.name.split(":"); |
---|
| 5492 | + |
---|
| 5493 | + if (split.length == 0) |
---|
| 5494 | + { |
---|
| 5495 | + return ""; |
---|
| 5496 | + } |
---|
| 5497 | + |
---|
| 5498 | + if (split.length <= 2) |
---|
| 5499 | + { |
---|
| 5500 | + if (fullname.name.endsWith(":")) |
---|
| 5501 | + { |
---|
| 5502 | + // Windows |
---|
| 5503 | + return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5504 | + } |
---|
| 5505 | + |
---|
| 5506 | + return split[0]; |
---|
| 5507 | + } |
---|
| 5508 | + |
---|
| 5509 | + // Windows |
---|
| 5510 | + assert(split.length == 4); |
---|
| 5511 | + |
---|
| 5512 | + return split[0] + ":" + split[1]; |
---|
5166 | 5513 | } |
---|
5167 | 5514 | |
---|
5168 | 5515 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5171 | 5518 | return ""; |
---|
5172 | 5519 | |
---|
5173 | 5520 | // System.out.println("Fullname = " + fullname); |
---|
5174 | | - if (fullname.name.indexOf(":") == -1) |
---|
5175 | | - return ""; |
---|
5176 | | - |
---|
5177 | | - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5521 | + // Does not work on Windows due to C: |
---|
| 5522 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5523 | +// return ""; |
---|
| 5524 | +// |
---|
| 5525 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5526 | + String[] split = fullname.name.split(":"); |
---|
| 5527 | + |
---|
| 5528 | + if (split.length == 0) |
---|
| 5529 | + { |
---|
| 5530 | + return ""; |
---|
| 5531 | + } |
---|
| 5532 | + |
---|
| 5533 | + if (split.length == 1) |
---|
| 5534 | + { |
---|
| 5535 | + return ""; |
---|
| 5536 | + } |
---|
| 5537 | + |
---|
| 5538 | + if (split.length == 2) |
---|
| 5539 | + { |
---|
| 5540 | + if (fullname.name.endsWith(":")) |
---|
| 5541 | + { |
---|
| 5542 | + // Windows |
---|
| 5543 | + return ""; |
---|
| 5544 | + } |
---|
| 5545 | + |
---|
| 5546 | + return split[1]; |
---|
| 5547 | + } |
---|
| 5548 | + |
---|
| 5549 | + // Windows |
---|
| 5550 | + assert(split.length == 4); |
---|
| 5551 | + |
---|
| 5552 | + return split[2] + ":" + split[3]; |
---|
5178 | 5553 | } |
---|
5179 | 5554 | |
---|
5180 | 5555 | String GetPigmentTexture() |
---|
.. | .. |
---|
5248 | 5623 | System.out.print("; textures = " + textures); |
---|
5249 | 5624 | System.out.println("; usedtextures = " + usedtextures); |
---|
5250 | 5625 | |
---|
5251 | | - if (GetTextures() == null) |
---|
| 5626 | + if (GetTextures() == null) // What is that?? |
---|
5252 | 5627 | GetTextures().name = ":"; |
---|
5253 | 5628 | |
---|
5254 | 5629 | String texname = tex; |
---|
.. | .. |
---|
5279 | 5654 | child.ResetPigmentTexture(); |
---|
5280 | 5655 | blockloop = false; |
---|
5281 | 5656 | } |
---|
| 5657 | + } |
---|
| 5658 | + |
---|
| 5659 | + UUID GetUUID() |
---|
| 5660 | + { |
---|
| 5661 | + if (uuid == null) |
---|
| 5662 | + { |
---|
| 5663 | + // Serial |
---|
| 5664 | + uuid = UUID.randomUUID(); |
---|
| 5665 | + } |
---|
| 5666 | + |
---|
| 5667 | + return uuid; |
---|
| 5668 | + } |
---|
| 5669 | + |
---|
| 5670 | + Object3D GetObject(UUID uid) |
---|
| 5671 | + { |
---|
| 5672 | + if (blockloop) |
---|
| 5673 | + return null; |
---|
| 5674 | + |
---|
| 5675 | + if (GetUUID().equals(uid)) |
---|
| 5676 | + return this; |
---|
| 5677 | + |
---|
| 5678 | + int nb = Size(); |
---|
| 5679 | + for (int i = 0; i < nb; i++) |
---|
| 5680 | + { |
---|
| 5681 | + Object3D child = (Object3D) get(i); |
---|
| 5682 | + |
---|
| 5683 | + if (child == null) |
---|
| 5684 | + continue; |
---|
| 5685 | + |
---|
| 5686 | + blockloop = true; |
---|
| 5687 | + Object3D obj = child.GetObject(uid); |
---|
| 5688 | + blockloop = false; |
---|
| 5689 | + if (obj != null) |
---|
| 5690 | + return obj; |
---|
| 5691 | + } |
---|
| 5692 | + |
---|
| 5693 | + return null; |
---|
5282 | 5694 | } |
---|
5283 | 5695 | |
---|
5284 | 5696 | void SetBumpTexture(String tex) |
---|
.. | .. |
---|
5325 | 5737 | boolean NeedSupport() |
---|
5326 | 5738 | { |
---|
5327 | 5739 | return |
---|
5328 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5740 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5329 | 5741 | // PROBLEM with CROWD!! |
---|
5330 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5742 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5331 | 5743 | } |
---|
5332 | 5744 | |
---|
5333 | 5745 | static boolean DEBUG_SELECTION = false; |
---|
| 5746 | + |
---|
| 5747 | + boolean IsLive() |
---|
| 5748 | + { |
---|
| 5749 | + if (live) |
---|
| 5750 | + return true; |
---|
| 5751 | + |
---|
| 5752 | + if (parent == null) |
---|
| 5753 | + return false; |
---|
| 5754 | + |
---|
| 5755 | + return parent.IsLive(); |
---|
| 5756 | + } |
---|
5334 | 5757 | |
---|
5335 | 5758 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5336 | 5759 | { |
---|
.. | .. |
---|
5342 | 5765 | } |
---|
5343 | 5766 | |
---|
5344 | 5767 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5345 | | - hide) |
---|
| 5768 | + (hide || dontselect)) |
---|
5346 | 5769 | return; |
---|
5347 | 5770 | |
---|
5348 | 5771 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5393 | 5816 | support = support; |
---|
5394 | 5817 | |
---|
5395 | 5818 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5396 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5819 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5397 | 5820 | |
---|
5398 | 5821 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5399 | 5822 | { |
---|
.. | .. |
---|
5413 | 5836 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5414 | 5837 | |
---|
5415 | 5838 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5416 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5839 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5840 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5417 | 5841 | { |
---|
5418 | 5842 | Globals.lighttouched = true; |
---|
5419 | 5843 | } // all panes... |
---|
| 5844 | + |
---|
5420 | 5845 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5421 | 5846 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5422 | 5847 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5544 | 5969 | if (GetBRep() != null) |
---|
5545 | 5970 | { |
---|
5546 | 5971 | display.NextIndex(); |
---|
| 5972 | + |
---|
5547 | 5973 | // vertex color conflict : gl.glCallList(list); |
---|
5548 | 5974 | DrawNode(display, root, selected); |
---|
5549 | 5975 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5584 | 6010 | tex = GetTextures(); |
---|
5585 | 6011 | } |
---|
5586 | 6012 | |
---|
5587 | | - display.BindTextures(tex, texres); |
---|
| 6013 | + boolean failedPigment = false; |
---|
| 6014 | + boolean failedBump = false; |
---|
| 6015 | + |
---|
| 6016 | + try |
---|
| 6017 | + { |
---|
| 6018 | + display.BindPigmentTexture(tex, texres); |
---|
| 6019 | + } |
---|
| 6020 | + catch (Exception e) |
---|
| 6021 | + { |
---|
| 6022 | + System.err.println("FAILED: " + this); |
---|
| 6023 | + failedPigment = true; |
---|
| 6024 | + } |
---|
| 6025 | + |
---|
| 6026 | + try |
---|
| 6027 | + { |
---|
| 6028 | + display.BindBumpTexture(tex, texres); |
---|
| 6029 | + } |
---|
| 6030 | + catch (Exception e) |
---|
| 6031 | + { |
---|
| 6032 | + //System.err.println("FAILED: " + this); |
---|
| 6033 | + failedBump = true; |
---|
| 6034 | + } |
---|
5588 | 6035 | |
---|
5589 | 6036 | if (!compiled) |
---|
5590 | 6037 | { |
---|
.. | .. |
---|
5606 | 6053 | } |
---|
5607 | 6054 | } |
---|
5608 | 6055 | |
---|
5609 | | - display.ReleaseTextures(tex); |
---|
| 6056 | + if (!failedBump) |
---|
| 6057 | + display.ReleaseBumpTexture(tex); |
---|
| 6058 | + |
---|
| 6059 | + if (!failedPigment) |
---|
| 6060 | + display.ReleasePigmentTexture(tex); |
---|
5610 | 6061 | |
---|
5611 | 6062 | display.PopMaterial(this, selected); |
---|
5612 | 6063 | } |
---|
.. | .. |
---|
5735 | 6186 | |
---|
5736 | 6187 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5737 | 6188 | { |
---|
| 6189 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6190 | + return; |
---|
| 6191 | + |
---|
5738 | 6192 | if (hide) |
---|
5739 | 6193 | return; |
---|
5740 | 6194 | // shadow optimisation |
---|
.. | .. |
---|
5860 | 6314 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5861 | 6315 | return; // no shadow for transparent objects |
---|
5862 | 6316 | |
---|
| 6317 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6318 | + return; |
---|
| 6319 | + |
---|
5863 | 6320 | if (hide) |
---|
5864 | 6321 | return; |
---|
5865 | 6322 | |
---|
.. | .. |
---|
5973 | 6430 | // dec 2012 |
---|
5974 | 6431 | new Exception().printStackTrace(); |
---|
5975 | 6432 | return; |
---|
| 6433 | + } |
---|
| 6434 | + |
---|
| 6435 | + if (dontselect) |
---|
| 6436 | + { |
---|
| 6437 | + //bRep.GenerateNormalsMINE(); |
---|
5976 | 6438 | } |
---|
5977 | 6439 | |
---|
5978 | 6440 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6825 | 7287 | spot.translate(32, 32); |
---|
6826 | 7288 | spotw = spot.x + spot.width; |
---|
6827 | 7289 | spoth = spot.y + spot.height; |
---|
6828 | | - info.g.setColor(Color.blue); |
---|
| 7290 | + info.g.setColor(Color.cyan); |
---|
6829 | 7291 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6830 | 7292 | // if (CameraPane.Xmin > spot.x) |
---|
6831 | 7293 | // { |
---|
.. | .. |
---|
6843 | 7305 | // { |
---|
6844 | 7306 | // CameraPane.Ymax = spoth; |
---|
6845 | 7307 | // } |
---|
6846 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6847 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7308 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7309 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6848 | 7310 | spot.translate(0, -32); |
---|
6849 | | - info.g.setColor(Color.green); |
---|
| 7311 | + info.g.setColor(Color.yellow); |
---|
6850 | 7312 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7313 | + info.g.setColor(Color.green); |
---|
6851 | 7314 | // if (CameraPane.Xmin > spot.x) |
---|
6852 | 7315 | // { |
---|
6853 | 7316 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6864 | 7327 | // { |
---|
6865 | 7328 | // CameraPane.Ymax = spoth; |
---|
6866 | 7329 | // } |
---|
6867 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6868 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7330 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7331 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
6869 | 7332 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6870 | 7333 | // if (CameraPane.Xmin > boundary.x) |
---|
6871 | 7334 | // { |
---|
.. | .. |
---|
6899 | 7362 | startX = info.x; |
---|
6900 | 7363 | startY = info.y; |
---|
6901 | 7364 | |
---|
6902 | | - hitSomething = 0; |
---|
| 7365 | + hitSomething = -1; |
---|
6903 | 7366 | cVector origin = new cVector(); |
---|
6904 | 7367 | //LA.xformPos(origin, toParent, origin); |
---|
6905 | 7368 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6932 | 7395 | } |
---|
6933 | 7396 | |
---|
6934 | 7397 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6935 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7398 | + modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6936 | 7399 | //System.out.println("modified = " + modified); |
---|
6937 | 7400 | //new Exception().printStackTrace(); |
---|
6938 | 7401 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6960 | 7423 | return true; |
---|
6961 | 7424 | } |
---|
6962 | 7425 | |
---|
6963 | | - void doEditDrag0(ClickInfo info) |
---|
| 7426 | + void doEditDrag0(ClickInfo info, boolean opposite) |
---|
6964 | 7427 | { |
---|
6965 | 7428 | if (hitSomething == 0) |
---|
6966 | 7429 | { |
---|
.. | .. |
---|
6975 | 7438 | //System.out.println("hitSomething = " + hitSomething); |
---|
6976 | 7439 | |
---|
6977 | 7440 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7441 | + |
---|
6978 | 7442 | cVector xlate = new cVector(); |
---|
6979 | 7443 | //cVector xlate2 = new cVector(); |
---|
6980 | 7444 | switch (hitSomething) |
---|
.. | .. |
---|
6987 | 7451 | |
---|
6988 | 7452 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6989 | 7453 | |
---|
6990 | | - if (modified) |
---|
| 7454 | + if (modified || opposite) |
---|
6991 | 7455 | { |
---|
6992 | 7456 | //assert(false); |
---|
6993 | 7457 | /* |
---|
.. | .. |
---|
7081 | 7545 | |
---|
7082 | 7546 | if (modified) |
---|
7083 | 7547 | { |
---|
| 7548 | + // Rotate 90 degrees |
---|
7084 | 7549 | angle /= (Math.PI / 4); |
---|
7085 | 7550 | angle = Math.floor(angle + 0.5); |
---|
7086 | 7551 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7122 | 7587 | |
---|
7123 | 7588 | case hitScale: // scale |
---|
7124 | 7589 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7590 | + double sign = 1; |
---|
| 7591 | + if (hScale < 0) |
---|
| 7592 | + { |
---|
| 7593 | + sign = -1; |
---|
| 7594 | + } |
---|
| 7595 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7125 | 7596 | if (hScale < 0.01) |
---|
7126 | 7597 | { |
---|
7127 | | - hScale = 0.01; |
---|
| 7598 | + //hScale = 0.01; |
---|
7128 | 7599 | } |
---|
7129 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7130 | | - if (hScale < 0.01) |
---|
7131 | | - { |
---|
7132 | | - hScale = 0.01; |
---|
7133 | | - } |
---|
| 7600 | + |
---|
7134 | 7601 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7135 | | - if (vScale < 0.01) |
---|
| 7602 | + sign = 1; |
---|
| 7603 | + if (vScale < 0) |
---|
7136 | 7604 | { |
---|
7137 | | - vScale = 0.01; |
---|
| 7605 | + sign = -1; |
---|
7138 | 7606 | } |
---|
7139 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7607 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7140 | 7608 | if (vScale < 0.01) |
---|
7141 | 7609 | { |
---|
7142 | | - vScale = 0.01; |
---|
| 7610 | + //vScale = 0.01; |
---|
7143 | 7611 | } |
---|
7144 | 7612 | LA.matCopy(startMat, toParent); |
---|
7145 | 7613 | /**/ |
---|
.. | .. |
---|
7150 | 7618 | } |
---|
7151 | 7619 | /**/ |
---|
7152 | 7620 | |
---|
| 7621 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7622 | + |
---|
| 7623 | + if (totalScale < 0.01) |
---|
| 7624 | + { |
---|
| 7625 | + totalScale = 0.01; |
---|
| 7626 | + } |
---|
| 7627 | + |
---|
7153 | 7628 | switch (info.pane.RenderCamera().viewCode) |
---|
7154 | 7629 | { |
---|
7155 | 7630 | case 3: // '\001' |
---|
7156 | | - if (modified) |
---|
| 7631 | + if (modified || opposite) |
---|
7157 | 7632 | { |
---|
7158 | 7633 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7159 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7634 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7160 | 7635 | } // vScale, 1); |
---|
7161 | 7636 | else |
---|
7162 | 7637 | { |
---|
7163 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7638 | + // EXCEPTION! |
---|
| 7639 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7164 | 7640 | } // vScale, 1); |
---|
7165 | 7641 | break; |
---|
7166 | 7642 | |
---|
7167 | 7643 | case 2: // '\002' |
---|
7168 | | - if (modified) |
---|
| 7644 | + if (modified || opposite) |
---|
7169 | 7645 | { |
---|
7170 | 7646 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7171 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7647 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7172 | 7648 | } else |
---|
7173 | 7649 | { |
---|
7174 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7650 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7175 | 7651 | } |
---|
7176 | 7652 | break; |
---|
7177 | 7653 | |
---|
7178 | 7654 | case 1: // '\003' |
---|
7179 | | - if (modified) |
---|
| 7655 | + if (modified || opposite) |
---|
7180 | 7656 | { |
---|
7181 | 7657 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7182 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7658 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7183 | 7659 | } else |
---|
7184 | 7660 | { |
---|
7185 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7661 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7186 | 7662 | } |
---|
7187 | 7663 | break; |
---|
7188 | 7664 | } |
---|
.. | .. |
---|
7315 | 7791 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7316 | 7792 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7317 | 7793 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7794 | + |
---|
| 7795 | + String objname; |
---|
| 7796 | + |
---|
7318 | 7797 | if (false) //parent != null) |
---|
7319 | 7798 | { |
---|
7320 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7799 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7321 | 7800 | } else |
---|
7322 | 7801 | { |
---|
7323 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7802 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7324 | 7803 | } // + super.toString(); |
---|
7325 | 7804 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7805 | + |
---|
| 7806 | + if (!Globals.ADVANCED) |
---|
| 7807 | + return objname; |
---|
| 7808 | + |
---|
| 7809 | + return objname + " " + System.identityHashCode(this); |
---|
7326 | 7810 | } |
---|
7327 | 7811 | |
---|
7328 | 7812 | public int hashCode() |
---|
.. | .. |
---|
7378 | 7862 | objectUI.closeUI(); |
---|
7379 | 7863 | if (editWindow != null) |
---|
7380 | 7864 | { |
---|
| 7865 | + editWindow.ctrlPanel.FlushUI(); |
---|
7381 | 7866 | editWindow.refreshContents(); |
---|
7382 | 7867 | } // ? new |
---|
7383 | 7868 | objectUI = null; |
---|
.. | .. |
---|
7386 | 7871 | { |
---|
7387 | 7872 | editWindow = null; |
---|
7388 | 7873 | } // ? |
---|
| 7874 | + } |
---|
| 7875 | + else |
---|
| 7876 | + { |
---|
| 7877 | + //editWindow.closeUI(); |
---|
7389 | 7878 | } |
---|
7390 | 7879 | } |
---|
7391 | 7880 | |
---|
.. | .. |
---|
7398 | 7887 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7399 | 7888 | |
---|
7400 | 7889 | Object3D /*Composite*/ parent; |
---|
7401 | | - Object3D /*Composite*/ fileparent; |
---|
| 7890 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7402 | 7891 | |
---|
7403 | 7892 | double[][] toParent; // dynamic matrix |
---|
7404 | 7893 | double[][] fromParent; |
---|
.. | .. |
---|
7513 | 8002 | { |
---|
7514 | 8003 | assert(bRep != null); |
---|
7515 | 8004 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7516 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8005 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7517 | 8006 | } |
---|
7518 | 8007 | else |
---|
7519 | 8008 | { |
---|
.. | .. |
---|
7544 | 8033 | } |
---|
7545 | 8034 | |
---|
7546 | 8035 | transient ObjEditor editWindow; |
---|
| 8036 | + transient ObjEditor manipWindow; |
---|
| 8037 | + |
---|
| 8038 | + transient boolean pinned; |
---|
| 8039 | + |
---|
7547 | 8040 | transient ObjectUI objectUI; |
---|
7548 | 8041 | public static int povDepth = 0; |
---|
7549 | 8042 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7562 | 8055 | private static cVector edge2 = new cVector(); |
---|
7563 | 8056 | //private static cVector norm = new cVector(); |
---|
7564 | 8057 | /*transient private*/ int hitSomething; |
---|
7565 | | - private static final int hitCenter = 1; |
---|
7566 | | - private static final int hitScale = 2; |
---|
7567 | | - private static final int hitRotate = 3; |
---|
| 8058 | + static final int hitCenter = 1; |
---|
| 8059 | + static final int hitScale = 2; |
---|
| 8060 | + static final int hitRotate = 3; |
---|
7568 | 8061 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7569 | 8062 | /*transient*/ private Point centerPt; |
---|
7570 | 8063 | /*transient*/ private int startX; |
---|