.. | .. |
---|
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) |
---|
.. | .. |
---|
2335 | 2474 | { |
---|
2336 | 2475 | editWindow.refreshContents(); |
---|
2337 | 2476 | } |
---|
| 2477 | + else |
---|
| 2478 | + { |
---|
| 2479 | + if (manipWindow != null) |
---|
| 2480 | + { |
---|
| 2481 | + manipWindow.refreshContents(); |
---|
| 2482 | + } |
---|
| 2483 | + } |
---|
| 2484 | + |
---|
2338 | 2485 | //if (parent != null) |
---|
2339 | 2486 | //parent.refreshEditWindow(); |
---|
2340 | 2487 | } |
---|
.. | .. |
---|
2619 | 2766 | //Touch(); |
---|
2620 | 2767 | } |
---|
2621 | 2768 | |
---|
| 2769 | + void GenNormalsMeshS() |
---|
| 2770 | + { |
---|
| 2771 | + selection.GenNormalsMesh(); |
---|
| 2772 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2773 | +// { |
---|
| 2774 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2775 | +// selectee.GenNormals(crease); |
---|
| 2776 | +// } |
---|
| 2777 | + |
---|
| 2778 | + //Touch(); |
---|
| 2779 | + } |
---|
| 2780 | + |
---|
2622 | 2781 | void ClearColorsS() |
---|
2623 | 2782 | { |
---|
2624 | 2783 | selection.ClearColors(); |
---|
.. | .. |
---|
2750 | 2909 | if (child == null) |
---|
2751 | 2910 | continue; |
---|
2752 | 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(); |
---|
2753 | 2930 | // Children().release(i); |
---|
2754 | 2931 | } |
---|
2755 | 2932 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3099 | } |
---|
2923 | 3100 | } |
---|
2924 | 3101 | |
---|
| 3102 | + void GenNormalsMesh0() |
---|
| 3103 | + { |
---|
| 3104 | + if (bRep != null) |
---|
| 3105 | + { |
---|
| 3106 | + bRep.GenerateNormalsMesh(); |
---|
| 3107 | + Touch(); |
---|
| 3108 | + } |
---|
| 3109 | + } |
---|
| 3110 | + |
---|
2925 | 3111 | void GenNormalsMINE0() |
---|
2926 | 3112 | { |
---|
2927 | 3113 | if (bRep != null) |
---|
.. | .. |
---|
2983 | 3169 | blockloop = false; |
---|
2984 | 3170 | } |
---|
2985 | 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 | + |
---|
2986 | 3199 | void TransformGeometry() |
---|
2987 | 3200 | { |
---|
2988 | 3201 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3417 | |
---|
3205 | 3418 | BoundaryRep sup = bRep.support; |
---|
3206 | 3419 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3420 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3421 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3422 | + |
---|
| 3423 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3424 | + |
---|
3210 | 3425 | bRep = temprep; |
---|
3211 | 3426 | bRep.support = sup; |
---|
3212 | 3427 | Touch(); |
---|
.. | .. |
---|
3343 | 3558 | if (blockloop) |
---|
3344 | 3559 | return; |
---|
3345 | 3560 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3561 | + if (//marked || // does not make sense |
---|
| 3562 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3563 | live = h; |
---|
3348 | 3564 | |
---|
3349 | 3565 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3580 | return; |
---|
3365 | 3581 | |
---|
3366 | 3582 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3583 | + if (//marked || // does not make sense |
---|
| 3584 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3585 | link2master = h; |
---|
3369 | 3586 | |
---|
3370 | 3587 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3601 | if (blockloop) |
---|
3385 | 3602 | return; |
---|
3386 | 3603 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3604 | + if (//marked || // does not make sense |
---|
| 3605 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3606 | hide = h; |
---|
3389 | 3607 | |
---|
3390 | 3608 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3622 | if (blockloop) |
---|
3405 | 3623 | return; |
---|
3406 | 3624 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3625 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3626 | marked = h; |
---|
3409 | 3627 | |
---|
3410 | 3628 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3632 | continue; |
---|
3415 | 3633 | blockloop = true; |
---|
3416 | 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); |
---|
3417 | 3675 | blockloop = false; |
---|
3418 | 3676 | // release(i); |
---|
3419 | 3677 | } |
---|
.. | .. |
---|
3728 | 3986 | if (child == null) |
---|
3729 | 3987 | continue; |
---|
3730 | 3988 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3989 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3990 | { |
---|
3733 | 3991 | if (child instanceof Merge) |
---|
3734 | 3992 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4137 | if (child == null) |
---|
3880 | 4138 | continue; |
---|
3881 | 4139 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4140 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4141 | { |
---|
3884 | 4142 | if (child instanceof Merge) |
---|
3885 | 4143 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4332 | if (child == null) |
---|
4075 | 4333 | continue; |
---|
4076 | 4334 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4335 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4336 | { |
---|
4079 | 4337 | if (child instanceof Merge) |
---|
4080 | 4338 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4445 | { |
---|
4188 | 4446 | blockloop = true; |
---|
4189 | 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(); |
---|
4190 | 4497 | blockloop = false; |
---|
4191 | 4498 | } |
---|
4192 | 4499 | } |
---|
.. | .. |
---|
4681 | 4988 | |
---|
4682 | 4989 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4990 | { |
---|
4684 | | - if (hide) |
---|
| 4991 | + if (hide || dontselect) |
---|
4685 | 4992 | return null; |
---|
4686 | 4993 | |
---|
4687 | 4994 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5012 | } |
---|
4706 | 5013 | } |
---|
4707 | 5014 | |
---|
| 5015 | + ObjEditor GetWindow() |
---|
| 5016 | + { |
---|
| 5017 | + if (editWindow != null) |
---|
| 5018 | + return editWindow; |
---|
| 5019 | + |
---|
| 5020 | + return manipWindow; |
---|
| 5021 | + } |
---|
| 5022 | + |
---|
4708 | 5023 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5024 | { |
---|
4710 | | - if (hide) |
---|
| 5025 | + if (hide || dontselect) |
---|
4711 | 5026 | return null; |
---|
4712 | 5027 | |
---|
4713 | 5028 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5056 | if (leaf != null) |
---|
4742 | 5057 | { |
---|
4743 | 5058 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5059 | + ObjEditor window = GetWindow(); |
---|
| 5060 | + if (window != null) |
---|
4745 | 5061 | { |
---|
4746 | 5062 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5063 | + window.Select(tp, deselect, true); |
---|
4748 | 5064 | } |
---|
4749 | 5065 | |
---|
4750 | 5066 | return tp; |
---|
.. | .. |
---|
4761 | 5077 | |
---|
4762 | 5078 | if (child == null) |
---|
4763 | 5079 | continue; |
---|
| 5080 | + |
---|
4764 | 5081 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5082 | { |
---|
4766 | 5083 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5087 | if (leaf != null) |
---|
4771 | 5088 | { |
---|
4772 | 5089 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5090 | + ObjEditor window = GetWindow(); |
---|
| 5091 | + if (window != null) |
---|
4774 | 5092 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5093 | + window.Select(tp, deselect, true); |
---|
4776 | 5094 | } |
---|
4777 | 5095 | |
---|
4778 | 5096 | return tp; |
---|
.. | .. |
---|
5333 | 5651 | } |
---|
5334 | 5652 | } |
---|
5335 | 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; |
---|
| 5689 | + } |
---|
| 5690 | + |
---|
5336 | 5691 | void SetBumpTexture(String tex) |
---|
5337 | 5692 | { |
---|
5338 | 5693 | if (GetTextures() == null) |
---|
.. | .. |
---|
5377 | 5732 | boolean NeedSupport() |
---|
5378 | 5733 | { |
---|
5379 | 5734 | return |
---|
5380 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5735 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5381 | 5736 | // PROBLEM with CROWD!! |
---|
5382 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5737 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5383 | 5738 | } |
---|
5384 | 5739 | |
---|
5385 | 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 | + } |
---|
5386 | 5752 | |
---|
5387 | 5753 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5388 | 5754 | { |
---|
.. | .. |
---|
5394 | 5760 | } |
---|
5395 | 5761 | |
---|
5396 | 5762 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5397 | | - hide) |
---|
| 5763 | + (hide || dontselect)) |
---|
5398 | 5764 | return; |
---|
5399 | 5765 | |
---|
5400 | 5766 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5445 | 5811 | support = support; |
---|
5446 | 5812 | |
---|
5447 | 5813 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5448 | | - 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); |
---|
5449 | 5815 | |
---|
5450 | 5816 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5451 | 5817 | { |
---|
.. | .. |
---|
5465 | 5831 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5466 | 5832 | |
---|
5467 | 5833 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5468 | | - (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))) |
---|
5469 | 5836 | { |
---|
5470 | 5837 | Globals.lighttouched = true; |
---|
5471 | 5838 | } // all panes... |
---|
| 5839 | + |
---|
5472 | 5840 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5473 | 5841 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5474 | 5842 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5596 | 5964 | if (GetBRep() != null) |
---|
5597 | 5965 | { |
---|
5598 | 5966 | display.NextIndex(); |
---|
| 5967 | + |
---|
5599 | 5968 | // vertex color conflict : gl.glCallList(list); |
---|
5600 | 5969 | DrawNode(display, root, selected); |
---|
5601 | 5970 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5636 | 6005 | tex = GetTextures(); |
---|
5637 | 6006 | } |
---|
5638 | 6007 | |
---|
5639 | | - 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 | + } |
---|
5640 | 6030 | |
---|
5641 | 6031 | if (!compiled) |
---|
5642 | 6032 | { |
---|
.. | .. |
---|
5658 | 6048 | } |
---|
5659 | 6049 | } |
---|
5660 | 6050 | |
---|
5661 | | - display.ReleaseTextures(tex); |
---|
| 6051 | + if (!failedBump) |
---|
| 6052 | + display.ReleaseBumpTexture(tex); |
---|
| 6053 | + |
---|
| 6054 | + if (!failedPigment) |
---|
| 6055 | + display.ReleasePigmentTexture(tex); |
---|
5662 | 6056 | |
---|
5663 | 6057 | display.PopMaterial(this, selected); |
---|
5664 | 6058 | } |
---|
.. | .. |
---|
5787 | 6181 | |
---|
5788 | 6182 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5789 | 6183 | { |
---|
| 6184 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6185 | + return; |
---|
| 6186 | + |
---|
5790 | 6187 | if (hide) |
---|
5791 | 6188 | return; |
---|
5792 | 6189 | // shadow optimisation |
---|
.. | .. |
---|
5912 | 6309 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5913 | 6310 | return; // no shadow for transparent objects |
---|
5914 | 6311 | |
---|
| 6312 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6313 | + return; |
---|
| 6314 | + |
---|
5915 | 6315 | if (hide) |
---|
5916 | 6316 | return; |
---|
5917 | 6317 | |
---|
.. | .. |
---|
6025 | 6425 | // dec 2012 |
---|
6026 | 6426 | new Exception().printStackTrace(); |
---|
6027 | 6427 | return; |
---|
| 6428 | + } |
---|
| 6429 | + |
---|
| 6430 | + if (dontselect) |
---|
| 6431 | + { |
---|
| 6432 | + //bRep.GenerateNormalsMINE(); |
---|
6028 | 6433 | } |
---|
6029 | 6434 | |
---|
6030 | 6435 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6877 | 7282 | spot.translate(32, 32); |
---|
6878 | 7283 | spotw = spot.x + spot.width; |
---|
6879 | 7284 | spoth = spot.y + spot.height; |
---|
6880 | | - info.g.setColor(Color.blue); |
---|
| 7285 | + info.g.setColor(Color.cyan); |
---|
6881 | 7286 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6882 | 7287 | // if (CameraPane.Xmin > spot.x) |
---|
6883 | 7288 | // { |
---|
.. | .. |
---|
6895 | 7300 | // { |
---|
6896 | 7301 | // CameraPane.Ymax = spoth; |
---|
6897 | 7302 | // } |
---|
6898 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6899 | | - 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 |
---|
6900 | 7305 | spot.translate(0, -32); |
---|
6901 | | - info.g.setColor(Color.green); |
---|
| 7306 | + info.g.setColor(Color.yellow); |
---|
6902 | 7307 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7308 | + info.g.setColor(Color.green); |
---|
6903 | 7309 | // if (CameraPane.Xmin > spot.x) |
---|
6904 | 7310 | // { |
---|
6905 | 7311 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6916 | 7322 | // { |
---|
6917 | 7323 | // CameraPane.Ymax = spoth; |
---|
6918 | 7324 | // } |
---|
6919 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6920 | | - 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); |
---|
6921 | 7327 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6922 | 7328 | // if (CameraPane.Xmin > boundary.x) |
---|
6923 | 7329 | // { |
---|
.. | .. |
---|
6951 | 7357 | startX = info.x; |
---|
6952 | 7358 | startY = info.y; |
---|
6953 | 7359 | |
---|
6954 | | - hitSomething = 0; |
---|
| 7360 | + hitSomething = -1; |
---|
6955 | 7361 | cVector origin = new cVector(); |
---|
6956 | 7362 | //LA.xformPos(origin, toParent, origin); |
---|
6957 | 7363 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7027 | 7433 | //System.out.println("hitSomething = " + hitSomething); |
---|
7028 | 7434 | |
---|
7029 | 7435 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7436 | + |
---|
7030 | 7437 | cVector xlate = new cVector(); |
---|
7031 | 7438 | //cVector xlate2 = new cVector(); |
---|
7032 | 7439 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7582 | |
---|
7176 | 7583 | case hitScale: // scale |
---|
7177 | 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); |
---|
7178 | 7591 | if (hScale < 0.01) |
---|
7179 | 7592 | { |
---|
7180 | | - hScale = 0.01; |
---|
| 7593 | + //hScale = 0.01; |
---|
7181 | 7594 | } |
---|
7182 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7183 | | - if (hScale < 0.01) |
---|
7184 | | - { |
---|
7185 | | - hScale = 0.01; |
---|
7186 | | - } |
---|
| 7595 | + |
---|
7187 | 7596 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7188 | | - if (vScale < 0.01) |
---|
| 7597 | + sign = 1; |
---|
| 7598 | + if (vScale < 0) |
---|
7189 | 7599 | { |
---|
7190 | | - vScale = 0.01; |
---|
| 7600 | + sign = -1; |
---|
7191 | 7601 | } |
---|
7192 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7602 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7193 | 7603 | if (vScale < 0.01) |
---|
7194 | 7604 | { |
---|
7195 | | - vScale = 0.01; |
---|
| 7605 | + //vScale = 0.01; |
---|
7196 | 7606 | } |
---|
7197 | 7607 | LA.matCopy(startMat, toParent); |
---|
7198 | 7608 | /**/ |
---|
.. | .. |
---|
7203 | 7613 | } |
---|
7204 | 7614 | /**/ |
---|
7205 | 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 | + |
---|
7206 | 7623 | switch (info.pane.RenderCamera().viewCode) |
---|
7207 | 7624 | { |
---|
7208 | 7625 | case 3: // '\001' |
---|
7209 | | - if (modified) |
---|
| 7626 | + if (modified || opposite) |
---|
7210 | 7627 | { |
---|
7211 | 7628 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7212 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7629 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7213 | 7630 | } // vScale, 1); |
---|
7214 | 7631 | else |
---|
7215 | 7632 | { |
---|
7216 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7633 | + // EXCEPTION! |
---|
| 7634 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7217 | 7635 | } // vScale, 1); |
---|
7218 | 7636 | break; |
---|
7219 | 7637 | |
---|
7220 | 7638 | case 2: // '\002' |
---|
7221 | | - if (modified) |
---|
| 7639 | + if (modified || opposite) |
---|
7222 | 7640 | { |
---|
7223 | 7641 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7224 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7642 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7225 | 7643 | } else |
---|
7226 | 7644 | { |
---|
7227 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7645 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7228 | 7646 | } |
---|
7229 | 7647 | break; |
---|
7230 | 7648 | |
---|
7231 | 7649 | case 1: // '\003' |
---|
7232 | | - if (modified) |
---|
| 7650 | + if (modified || opposite) |
---|
7233 | 7651 | { |
---|
7234 | 7652 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7235 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7653 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7236 | 7654 | } else |
---|
7237 | 7655 | { |
---|
7238 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7656 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7239 | 7657 | } |
---|
7240 | 7658 | break; |
---|
7241 | 7659 | } |
---|
.. | .. |
---|
7368 | 7786 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7369 | 7787 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7370 | 7788 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7789 | + |
---|
| 7790 | + String objname; |
---|
| 7791 | + |
---|
7371 | 7792 | if (false) //parent != null) |
---|
7372 | 7793 | { |
---|
7373 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7794 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7374 | 7795 | } else |
---|
7375 | 7796 | { |
---|
7376 | | - 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) ":"") */ ""; |
---|
7377 | 7798 | } // + super.toString(); |
---|
7378 | 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); |
---|
7379 | 7805 | } |
---|
7380 | 7806 | |
---|
7381 | 7807 | public int hashCode() |
---|
.. | .. |
---|
7441 | 7867 | editWindow = null; |
---|
7442 | 7868 | } // ? |
---|
7443 | 7869 | } |
---|
| 7870 | + else |
---|
| 7871 | + { |
---|
| 7872 | + //editWindow.closeUI(); |
---|
| 7873 | + } |
---|
7444 | 7874 | } |
---|
7445 | 7875 | |
---|
7446 | 7876 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7452 | 7882 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7453 | 7883 | |
---|
7454 | 7884 | Object3D /*Composite*/ parent; |
---|
7455 | | - Object3D /*Composite*/ fileparent; |
---|
| 7885 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7456 | 7886 | |
---|
7457 | 7887 | double[][] toParent; // dynamic matrix |
---|
7458 | 7888 | double[][] fromParent; |
---|
.. | .. |
---|
7567 | 7997 | { |
---|
7568 | 7998 | assert(bRep != null); |
---|
7569 | 7999 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7570 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8000 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7571 | 8001 | } |
---|
7572 | 8002 | else |
---|
7573 | 8003 | { |
---|
.. | .. |
---|
7598 | 8028 | } |
---|
7599 | 8029 | |
---|
7600 | 8030 | transient ObjEditor editWindow; |
---|
| 8031 | + transient ObjEditor manipWindow; |
---|
| 8032 | + |
---|
| 8033 | + transient boolean pinned; |
---|
| 8034 | + |
---|
7601 | 8035 | transient ObjectUI objectUI; |
---|
7602 | 8036 | public static int povDepth = 0; |
---|
7603 | 8037 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7616 | 8050 | private static cVector edge2 = new cVector(); |
---|
7617 | 8051 | //private static cVector norm = new cVector(); |
---|
7618 | 8052 | /*transient private*/ int hitSomething; |
---|
7619 | | - private static final int hitCenter = 1; |
---|
7620 | | - private static final int hitScale = 2; |
---|
7621 | | - private static final int hitRotate = 3; |
---|
| 8053 | + static final int hitCenter = 1; |
---|
| 8054 | + static final int hitScale = 2; |
---|
| 8055 | + static final int hitRotate = 3; |
---|
7622 | 8056 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7623 | 8057 | /*transient*/ private Point centerPt; |
---|
7624 | 8058 | /*transient*/ private int startX; |
---|