.. | .. |
---|
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; |
---|
| 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 | + // |
---|
22 | 31 | |
---|
23 | 32 | ScriptNode scriptnode; |
---|
24 | 33 | |
---|
.. | .. |
---|
100 | 109 | |
---|
101 | 110 | // transient boolean reduced; // for morph reduction |
---|
102 | 111 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
105 | 114 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
108 | 117 | |
---|
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) |
---|
| 118 | + void SaveSupports() |
---|
121 | 119 | { |
---|
122 | | - bRep.SaveSupports(); |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
| 122 | + |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
| 125 | + |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
123 | 143 | } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
126 | 146 | { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
| 169 | + } |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + Object3D o; |
---|
| 174 | + |
---|
| 175 | + if (hashtable.containsKey(GetUUID())) |
---|
| 176 | + { |
---|
| 177 | + o = hashtable.get(GetUUID()); |
---|
| 178 | + |
---|
| 179 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 180 | + //if (this.bRep != null) |
---|
| 181 | + // assert(this.bRep.support == o.transientrep); |
---|
| 182 | + if (this.support != null) |
---|
| 183 | + assert(this.support.bRep == o.transientrep); |
---|
| 184 | + } |
---|
| 185 | + else |
---|
| 186 | + { |
---|
| 187 | + o = new Object3D("copy of " + this.name); |
---|
| 188 | + |
---|
| 189 | + hashtable.put(GetUUID(), o); |
---|
| 190 | + } |
---|
| 191 | + |
---|
| 192 | + if (!blockloop) |
---|
| 193 | + { |
---|
| 194 | + blockloop = true; |
---|
| 195 | + |
---|
| 196 | + for (int i=0; i<Size(); i++) |
---|
| 197 | + { |
---|
| 198 | + get(i).ExtractBigData(hashtable); |
---|
| 199 | + } |
---|
| 200 | + |
---|
| 201 | + blockloop = false; |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | + ExtractBigData(o); |
---|
| 205 | + } |
---|
| 206 | + |
---|
| 207 | + void ExtractBigData(Object3D o) |
---|
| 208 | + { |
---|
| 209 | + if (o.bRep != null) |
---|
| 210 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 211 | + |
---|
| 212 | + o.bRep = this.bRep; |
---|
| 213 | +// July 2019 if (this.bRep != null) |
---|
| 214 | +// { |
---|
| 215 | +// o.transientrep = this.bRep.support; |
---|
| 216 | +// o.bRep.support = null; |
---|
| 217 | +// } |
---|
| 218 | + |
---|
| 219 | + if (this.support != null) |
---|
| 220 | + { |
---|
| 221 | + if (o.transientrep != null) |
---|
| 222 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 223 | + |
---|
| 224 | + o.transientrep = this.support.bRep; |
---|
| 225 | + this.support.bRep = null; |
---|
| 226 | + } |
---|
| 227 | + |
---|
| 228 | + // o.support = this.support; |
---|
| 229 | + // o.fileparent = this.fileparent; |
---|
| 230 | + // if (this.bRep != null) |
---|
| 231 | + // o.bRep = this.bRep.support; |
---|
| 232 | + |
---|
| 233 | + this.bRep = null; |
---|
| 234 | + // if (this.bRep != null) |
---|
| 235 | + // this.bRep.support = null; |
---|
| 236 | + // this.support = null; |
---|
| 237 | + // this.fileparent = null; |
---|
| 238 | + } |
---|
| 239 | + |
---|
| 240 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 241 | + { |
---|
| 242 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 243 | + return; |
---|
| 244 | + |
---|
| 245 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 246 | + |
---|
| 247 | + RestoreBigData(o); |
---|
| 248 | + |
---|
| 249 | + if (blockloop) |
---|
| 250 | + return; |
---|
| 251 | + |
---|
130 | 252 | blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
| 253 | + |
---|
| 254 | + //hashtable.remove(GetUUID()); |
---|
| 255 | + |
---|
| 256 | + for (int i=0; i<Size(); i++) |
---|
| 257 | + { |
---|
| 258 | + get(i).RestoreBigData(hashtable); |
---|
| 259 | + } |
---|
| 260 | + |
---|
132 | 261 | blockloop = false; |
---|
133 | 262 | } |
---|
134 | | -} |
---|
135 | 263 | |
---|
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) |
---|
| 264 | + void RestoreBigData(Object3D o) |
---|
147 | 265 | { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 266 | + this.bRep = o.bRep; |
---|
| 267 | + if (this.support != null && o.transientrep != null) |
---|
| 268 | + { |
---|
| 269 | + this.support.bRep = o.transientrep; |
---|
| 270 | + } |
---|
| 271 | +// July 2019 if (this.bRep != null) |
---|
| 272 | +// this.bRep.support = o.transientrep; |
---|
| 273 | + // this.support = o.support; |
---|
| 274 | + // this.fileparent = o.fileparent; |
---|
149 | 275 | } |
---|
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 | 276 | |
---|
162 | 277 | // MOCAP SUPPORT |
---|
163 | 278 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
300 | 415 | } |
---|
301 | 416 | |
---|
302 | 417 | boolean live = false; |
---|
| 418 | + boolean dontselect = false; |
---|
303 | 419 | boolean hide = false; |
---|
304 | 420 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 421 | boolean marked = false; // animation node |
---|
.. | .. |
---|
481 | 597 | toParent = LA.newMatrix(); |
---|
482 | 598 | fromParent = LA.newMatrix(); |
---|
483 | 599 | } |
---|
| 600 | + |
---|
484 | 601 | if (toParentMarked == null) |
---|
485 | 602 | { |
---|
486 | 603 | if (maxcount != 1) |
---|
487 | 604 | { |
---|
488 | 605 | new Exception().printStackTrace(); |
---|
489 | 606 | } |
---|
| 607 | + |
---|
490 | 608 | toParentMarked = LA.newMatrix(); |
---|
491 | 609 | fromParentMarked = LA.newMatrix(); |
---|
492 | 610 | } |
---|
.. | .. |
---|
774 | 892 | if (step == 0) |
---|
775 | 893 | step = 1; |
---|
776 | 894 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 895 | + maxcount = 128; // 2048; // 4; |
---|
778 | 896 | // if (acceleration == 0) |
---|
779 | 897 | // acceleration = 10; |
---|
780 | 898 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 915 | |
---|
798 | 916 | if (marked && Globals.isLIVE() && live && |
---|
799 | 917 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 918 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 919 | currentframe != Globals.framecount) |
---|
802 | 920 | { |
---|
803 | 921 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 927 | |
---|
810 | 928 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 929 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 930 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 931 | + (step == 1 && changedir)) |
---|
813 | 932 | { |
---|
814 | 933 | countdown = 1; |
---|
815 | 934 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1000 | if (material == null || material.multiply) |
---|
882 | 1001 | return true; |
---|
883 | 1002 | |
---|
| 1003 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1004 | return material.opacity > 0.99; |
---|
885 | 1005 | } |
---|
886 | 1006 | |
---|
.. | .. |
---|
912 | 1032 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1033 | bRep = null; // new BoundaryRep(); |
---|
914 | 1034 | |
---|
| 1035 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1036 | + { |
---|
| 1037 | + name = oname; |
---|
| 1038 | + } |
---|
| 1039 | + |
---|
915 | 1040 | /* |
---|
916 | 1041 | float hue = (float)Math.random(); |
---|
917 | 1042 | Color col; |
---|
.. | .. |
---|
954 | 1079 | |
---|
955 | 1080 | public Object clone() |
---|
956 | 1081 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1082 | + return Grafreed.clone(this); |
---|
958 | 1083 | } |
---|
959 | 1084 | |
---|
960 | 1085 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1401 | toParent = LA.newMatrix(); |
---|
1277 | 1402 | fromParent = LA.newMatrix(); |
---|
1278 | 1403 | } |
---|
| 1404 | + |
---|
1279 | 1405 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1406 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1407 | |
---|
.. | .. |
---|
1470 | 1596 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1597 | |
---|
1472 | 1598 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1599 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1600 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1601 | } |
---|
1476 | 1602 | |
---|
.. | .. |
---|
1729 | 1855 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1856 | o.bRep = transientrep; |
---|
1731 | 1857 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1858 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1859 | o.CreateMaterial(); |
---|
1734 | 1860 | o.SetAttributes(this, -1); |
---|
1735 | 1861 | //parent |
---|
.. | .. |
---|
1742 | 1868 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1869 | o.bRep = bRep; |
---|
1744 | 1870 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1871 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1872 | o.CreateMaterial(); |
---|
1747 | 1873 | //o.overwriteThis(this, -1); |
---|
1748 | 1874 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 1955 | if (obj.name == null) |
---|
1830 | 1956 | continue; // can't be a null one |
---|
1831 | 1957 | |
---|
| 1958 | + // Try perfect match first. |
---|
1832 | 1959 | if (n.equals(obj.name)) |
---|
1833 | 1960 | { |
---|
1834 | 1961 | theobj = obj; |
---|
1835 | 1962 | count++; |
---|
1836 | 1963 | } |
---|
1837 | 1964 | } |
---|
| 1965 | + |
---|
| 1966 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 1967 | |
---|
1839 | 1968 | if (count != 1) |
---|
1840 | 1969 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2294 | 2423 | } |
---|
2295 | 2424 | */ |
---|
2296 | 2425 | } |
---|
| 2426 | + else |
---|
| 2427 | + { |
---|
| 2428 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2429 | + } |
---|
2297 | 2430 | } |
---|
2298 | 2431 | |
---|
2299 | 2432 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2335 | 2468 | { |
---|
2336 | 2469 | editWindow.refreshContents(); |
---|
2337 | 2470 | } |
---|
| 2471 | + else |
---|
| 2472 | + { |
---|
| 2473 | + if (manipWindow != null) |
---|
| 2474 | + { |
---|
| 2475 | + manipWindow.refreshContents(); |
---|
| 2476 | + } |
---|
| 2477 | + } |
---|
| 2478 | + |
---|
2338 | 2479 | //if (parent != null) |
---|
2339 | 2480 | //parent.refreshEditWindow(); |
---|
2340 | 2481 | } |
---|
.. | .. |
---|
2619 | 2760 | //Touch(); |
---|
2620 | 2761 | } |
---|
2621 | 2762 | |
---|
| 2763 | + void GenNormalsMeshS() |
---|
| 2764 | + { |
---|
| 2765 | + selection.GenNormalsMesh(); |
---|
| 2766 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2767 | +// { |
---|
| 2768 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2769 | +// selectee.GenNormals(crease); |
---|
| 2770 | +// } |
---|
| 2771 | + |
---|
| 2772 | + //Touch(); |
---|
| 2773 | + } |
---|
| 2774 | + |
---|
2622 | 2775 | void ClearColorsS() |
---|
2623 | 2776 | { |
---|
2624 | 2777 | selection.ClearColors(); |
---|
.. | .. |
---|
2750 | 2903 | if (child == null) |
---|
2751 | 2904 | continue; |
---|
2752 | 2905 | child.GenNormals(crease); |
---|
| 2906 | +// Children().release(i); |
---|
| 2907 | + } |
---|
| 2908 | + blockloop = false; |
---|
| 2909 | + } |
---|
| 2910 | + |
---|
| 2911 | + void GenNormalsMesh() |
---|
| 2912 | + { |
---|
| 2913 | + if (blockloop) |
---|
| 2914 | + return; |
---|
| 2915 | + |
---|
| 2916 | + blockloop = true; |
---|
| 2917 | + GenNormalsMesh0(); |
---|
| 2918 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2919 | + { |
---|
| 2920 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2921 | + if (child == null) |
---|
| 2922 | + continue; |
---|
| 2923 | + child.GenNormalsMesh(); |
---|
2753 | 2924 | // Children().release(i); |
---|
2754 | 2925 | } |
---|
2755 | 2926 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3093 | } |
---|
2923 | 3094 | } |
---|
2924 | 3095 | |
---|
| 3096 | + void GenNormalsMesh0() |
---|
| 3097 | + { |
---|
| 3098 | + if (bRep != null) |
---|
| 3099 | + { |
---|
| 3100 | + bRep.GenerateNormalsMesh(); |
---|
| 3101 | + Touch(); |
---|
| 3102 | + } |
---|
| 3103 | + } |
---|
| 3104 | + |
---|
2925 | 3105 | void GenNormalsMINE0() |
---|
2926 | 3106 | { |
---|
2927 | 3107 | if (bRep != null) |
---|
.. | .. |
---|
2983 | 3163 | blockloop = false; |
---|
2984 | 3164 | } |
---|
2985 | 3165 | |
---|
| 3166 | + void TransformChildren() |
---|
| 3167 | + { |
---|
| 3168 | + if (toParent != null) |
---|
| 3169 | + { |
---|
| 3170 | + for (int i=Size(); --i>=0;) |
---|
| 3171 | + { |
---|
| 3172 | + Object3D v = get(i); |
---|
| 3173 | + |
---|
| 3174 | + if (v.toParent == null) |
---|
| 3175 | + { |
---|
| 3176 | + v.toParent = LA.newMatrix(); |
---|
| 3177 | + v.fromParent = LA.newMatrix(); |
---|
| 3178 | + } |
---|
| 3179 | + |
---|
| 3180 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3181 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3182 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3183 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3184 | + } |
---|
| 3185 | + |
---|
| 3186 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3187 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3188 | + |
---|
| 3189 | + Touch(); |
---|
| 3190 | + } |
---|
| 3191 | + } |
---|
| 3192 | + |
---|
2986 | 3193 | void TransformGeometry() |
---|
2987 | 3194 | { |
---|
2988 | 3195 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3411 | |
---|
3205 | 3412 | BoundaryRep sup = bRep.support; |
---|
3206 | 3413 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3414 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3415 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3416 | + |
---|
| 3417 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3418 | + |
---|
3210 | 3419 | bRep = temprep; |
---|
3211 | 3420 | bRep.support = sup; |
---|
3212 | 3421 | Touch(); |
---|
.. | .. |
---|
3343 | 3552 | if (blockloop) |
---|
3344 | 3553 | return; |
---|
3345 | 3554 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3557 | live = h; |
---|
3348 | 3558 | |
---|
3349 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3574 | return; |
---|
3365 | 3575 | |
---|
3366 | 3576 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3577 | + if (//marked || // does not make sense |
---|
| 3578 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3579 | link2master = h; |
---|
3369 | 3580 | |
---|
3370 | 3581 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3595 | if (blockloop) |
---|
3385 | 3596 | return; |
---|
3386 | 3597 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3598 | + if (//marked || // does not make sense |
---|
| 3599 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3600 | hide = h; |
---|
3389 | 3601 | |
---|
3390 | 3602 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3616 | if (blockloop) |
---|
3405 | 3617 | return; |
---|
3406 | 3618 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3619 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3620 | marked = h; |
---|
3409 | 3621 | |
---|
3410 | 3622 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3626 | continue; |
---|
3415 | 3627 | blockloop = true; |
---|
3416 | 3628 | child.MarkLeaves(h); |
---|
| 3629 | + blockloop = false; |
---|
| 3630 | + // release(i); |
---|
| 3631 | + } |
---|
| 3632 | + } |
---|
| 3633 | + |
---|
| 3634 | + void RewindLeaves(boolean h) |
---|
| 3635 | + { |
---|
| 3636 | + if (blockloop) |
---|
| 3637 | + return; |
---|
| 3638 | + |
---|
| 3639 | + if (bRep != null || material != null) // borderline... |
---|
| 3640 | + rewind = h; |
---|
| 3641 | + |
---|
| 3642 | + for (int i = 0; i < Size(); i++) |
---|
| 3643 | + { |
---|
| 3644 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3645 | + if (child == null) |
---|
| 3646 | + continue; |
---|
| 3647 | + blockloop = true; |
---|
| 3648 | + child.RewindLeaves(h); |
---|
| 3649 | + blockloop = false; |
---|
| 3650 | + // release(i); |
---|
| 3651 | + } |
---|
| 3652 | + } |
---|
| 3653 | + |
---|
| 3654 | + void RandomLeaves(boolean h) |
---|
| 3655 | + { |
---|
| 3656 | + if (blockloop) |
---|
| 3657 | + return; |
---|
| 3658 | + |
---|
| 3659 | + if (bRep != null || material != null) // borderline... |
---|
| 3660 | + random = h; |
---|
| 3661 | + |
---|
| 3662 | + for (int i = 0; i < Size(); i++) |
---|
| 3663 | + { |
---|
| 3664 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3665 | + if (child == null) |
---|
| 3666 | + continue; |
---|
| 3667 | + blockloop = true; |
---|
| 3668 | + child.RandomLeaves(h); |
---|
3417 | 3669 | blockloop = false; |
---|
3418 | 3670 | // release(i); |
---|
3419 | 3671 | } |
---|
.. | .. |
---|
3728 | 3980 | if (child == null) |
---|
3729 | 3981 | continue; |
---|
3730 | 3982 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 3983 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 3984 | { |
---|
3733 | 3985 | if (child instanceof Merge) |
---|
3734 | 3986 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4131 | if (child == null) |
---|
3880 | 4132 | continue; |
---|
3881 | 4133 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4134 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4135 | { |
---|
3884 | 4136 | if (child instanceof Merge) |
---|
3885 | 4137 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4326 | if (child == null) |
---|
4075 | 4327 | continue; |
---|
4076 | 4328 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4329 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4330 | { |
---|
4079 | 4331 | if (child instanceof Merge) |
---|
4080 | 4332 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4439 | { |
---|
4188 | 4440 | blockloop = true; |
---|
4189 | 4441 | get(i).RepairShadow(); |
---|
| 4442 | + blockloop = false; |
---|
| 4443 | + } |
---|
| 4444 | + } |
---|
| 4445 | + |
---|
| 4446 | + void RepairSOV() |
---|
| 4447 | + { |
---|
| 4448 | + if (blockloop) |
---|
| 4449 | + return; |
---|
| 4450 | + |
---|
| 4451 | + String texname = this.GetPigmentTexture(); |
---|
| 4452 | + |
---|
| 4453 | + if (texname.startsWith("sov")) |
---|
| 4454 | + { |
---|
| 4455 | + String[] s = texname.split("/"); |
---|
| 4456 | + |
---|
| 4457 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4458 | + |
---|
| 4459 | + texname = sname[0]; |
---|
| 4460 | + |
---|
| 4461 | + if (sname.length > 1) |
---|
| 4462 | + { |
---|
| 4463 | + texname += "Color.jpg"; |
---|
| 4464 | + } |
---|
| 4465 | + |
---|
| 4466 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4467 | + } |
---|
| 4468 | + |
---|
| 4469 | + texname = this.GetBumpTexture(); |
---|
| 4470 | + |
---|
| 4471 | + if (texname.startsWith("sov")) |
---|
| 4472 | + { |
---|
| 4473 | + String[] s = texname.split("/"); |
---|
| 4474 | + |
---|
| 4475 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4476 | + |
---|
| 4477 | + texname = sname[0]; |
---|
| 4478 | + |
---|
| 4479 | + if (sname.length > 1) |
---|
| 4480 | + { |
---|
| 4481 | + texname += "Bump.jpg"; |
---|
| 4482 | + } |
---|
| 4483 | + |
---|
| 4484 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4485 | + } |
---|
| 4486 | + |
---|
| 4487 | + for (int i=0; i<Size(); i++) |
---|
| 4488 | + { |
---|
| 4489 | + blockloop = true; |
---|
| 4490 | + get(i).RepairSOV(); |
---|
4190 | 4491 | blockloop = false; |
---|
4191 | 4492 | } |
---|
4192 | 4493 | } |
---|
.. | .. |
---|
4681 | 4982 | |
---|
4682 | 4983 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 4984 | { |
---|
4684 | | - if (hide) |
---|
| 4985 | + if (hide || dontselect) |
---|
4685 | 4986 | return null; |
---|
4686 | 4987 | |
---|
4687 | 4988 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5006 | } |
---|
4706 | 5007 | } |
---|
4707 | 5008 | |
---|
| 5009 | + ObjEditor GetWindow() |
---|
| 5010 | + { |
---|
| 5011 | + if (editWindow != null) |
---|
| 5012 | + return editWindow; |
---|
| 5013 | + |
---|
| 5014 | + return manipWindow; |
---|
| 5015 | + } |
---|
| 5016 | + |
---|
4708 | 5017 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5018 | { |
---|
4710 | | - if (hide) |
---|
| 5019 | + if (hide || dontselect) |
---|
4711 | 5020 | return null; |
---|
4712 | 5021 | |
---|
4713 | 5022 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5050 | if (leaf != null) |
---|
4742 | 5051 | { |
---|
4743 | 5052 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5053 | + ObjEditor window = GetWindow(); |
---|
| 5054 | + if (window != null) |
---|
4745 | 5055 | { |
---|
4746 | 5056 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5057 | + window.Select(tp, deselect, true); |
---|
4748 | 5058 | } |
---|
4749 | 5059 | |
---|
4750 | 5060 | return tp; |
---|
.. | .. |
---|
4761 | 5071 | |
---|
4762 | 5072 | if (child == null) |
---|
4763 | 5073 | continue; |
---|
| 5074 | + |
---|
4764 | 5075 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5076 | { |
---|
4766 | 5077 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5081 | if (leaf != null) |
---|
4771 | 5082 | { |
---|
4772 | 5083 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5084 | + ObjEditor window = GetWindow(); |
---|
| 5085 | + if (window != null) |
---|
4774 | 5086 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5087 | + window.Select(tp, deselect, true); |
---|
4776 | 5088 | } |
---|
4777 | 5089 | |
---|
4778 | 5090 | return tp; |
---|
.. | .. |
---|
5333 | 5645 | } |
---|
5334 | 5646 | } |
---|
5335 | 5647 | |
---|
| 5648 | + UUID GetUUID() |
---|
| 5649 | + { |
---|
| 5650 | + if (uuid == null) |
---|
| 5651 | + { |
---|
| 5652 | + // Serial |
---|
| 5653 | + uuid = UUID.randomUUID(); |
---|
| 5654 | + } |
---|
| 5655 | + |
---|
| 5656 | + return uuid; |
---|
| 5657 | + } |
---|
| 5658 | + |
---|
| 5659 | + Object3D GetObject(UUID uid) |
---|
| 5660 | + { |
---|
| 5661 | + if (blockloop) |
---|
| 5662 | + return null; |
---|
| 5663 | + |
---|
| 5664 | + if (GetUUID().equals(uid)) |
---|
| 5665 | + return this; |
---|
| 5666 | + |
---|
| 5667 | + int nb = Size(); |
---|
| 5668 | + for (int i = 0; i < nb; i++) |
---|
| 5669 | + { |
---|
| 5670 | + Object3D child = (Object3D) get(i); |
---|
| 5671 | + |
---|
| 5672 | + if (child == null) |
---|
| 5673 | + continue; |
---|
| 5674 | + |
---|
| 5675 | + blockloop = true; |
---|
| 5676 | + Object3D obj = child.GetObject(uid); |
---|
| 5677 | + blockloop = false; |
---|
| 5678 | + if (obj != null) |
---|
| 5679 | + return obj; |
---|
| 5680 | + } |
---|
| 5681 | + |
---|
| 5682 | + return null; |
---|
| 5683 | + } |
---|
| 5684 | + |
---|
5336 | 5685 | void SetBumpTexture(String tex) |
---|
5337 | 5686 | { |
---|
5338 | 5687 | if (GetTextures() == null) |
---|
.. | .. |
---|
5377 | 5726 | boolean NeedSupport() |
---|
5378 | 5727 | { |
---|
5379 | 5728 | return |
---|
5380 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 5729 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5381 | 5730 | // PROBLEM with CROWD!! |
---|
5382 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 5731 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5383 | 5732 | } |
---|
5384 | 5733 | |
---|
5385 | 5734 | static boolean DEBUG_SELECTION = false; |
---|
| 5735 | + |
---|
| 5736 | + boolean IsLive() |
---|
| 5737 | + { |
---|
| 5738 | + if (live) |
---|
| 5739 | + return true; |
---|
| 5740 | + |
---|
| 5741 | + if (parent == null) |
---|
| 5742 | + return false; |
---|
| 5743 | + |
---|
| 5744 | + return parent.IsLive(); |
---|
| 5745 | + } |
---|
5386 | 5746 | |
---|
5387 | 5747 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5388 | 5748 | { |
---|
.. | .. |
---|
5394 | 5754 | } |
---|
5395 | 5755 | |
---|
5396 | 5756 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5397 | | - hide) |
---|
| 5757 | + (hide || dontselect)) |
---|
5398 | 5758 | return; |
---|
5399 | 5759 | |
---|
5400 | 5760 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5445 | 5805 | support = support; |
---|
5446 | 5806 | |
---|
5447 | 5807 | //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); |
---|
| 5808 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5449 | 5809 | |
---|
5450 | 5810 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5451 | 5811 | { |
---|
.. | .. |
---|
5465 | 5825 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5466 | 5826 | |
---|
5467 | 5827 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5468 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5828 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5829 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5469 | 5830 | { |
---|
5470 | 5831 | Globals.lighttouched = true; |
---|
5471 | 5832 | } // all panes... |
---|
| 5833 | + |
---|
5472 | 5834 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5473 | 5835 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5474 | 5836 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5596 | 5958 | if (GetBRep() != null) |
---|
5597 | 5959 | { |
---|
5598 | 5960 | display.NextIndex(); |
---|
| 5961 | + |
---|
5599 | 5962 | // vertex color conflict : gl.glCallList(list); |
---|
5600 | 5963 | DrawNode(display, root, selected); |
---|
5601 | 5964 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5636 | 5999 | tex = GetTextures(); |
---|
5637 | 6000 | } |
---|
5638 | 6001 | |
---|
5639 | | - display.BindTextures(tex, texres); |
---|
| 6002 | + boolean failedPigment = false; |
---|
| 6003 | + boolean failedBump = false; |
---|
| 6004 | + |
---|
| 6005 | + try |
---|
| 6006 | + { |
---|
| 6007 | + display.BindPigmentTexture(tex, texres); |
---|
| 6008 | + } |
---|
| 6009 | + catch (Exception e) |
---|
| 6010 | + { |
---|
| 6011 | + System.err.println("FAILED: " + this); |
---|
| 6012 | + failedPigment = true; |
---|
| 6013 | + } |
---|
| 6014 | + |
---|
| 6015 | + try |
---|
| 6016 | + { |
---|
| 6017 | + display.BindBumpTexture(tex, texres); |
---|
| 6018 | + } |
---|
| 6019 | + catch (Exception e) |
---|
| 6020 | + { |
---|
| 6021 | + //System.err.println("FAILED: " + this); |
---|
| 6022 | + failedBump = true; |
---|
| 6023 | + } |
---|
5640 | 6024 | |
---|
5641 | 6025 | if (!compiled) |
---|
5642 | 6026 | { |
---|
.. | .. |
---|
5658 | 6042 | } |
---|
5659 | 6043 | } |
---|
5660 | 6044 | |
---|
5661 | | - display.ReleaseTextures(tex); |
---|
| 6045 | + if (!failedBump) |
---|
| 6046 | + display.ReleaseBumpTexture(tex); |
---|
| 6047 | + |
---|
| 6048 | + if (!failedPigment) |
---|
| 6049 | + display.ReleasePigmentTexture(tex); |
---|
5662 | 6050 | |
---|
5663 | 6051 | display.PopMaterial(this, selected); |
---|
5664 | 6052 | } |
---|
.. | .. |
---|
5787 | 6175 | |
---|
5788 | 6176 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5789 | 6177 | { |
---|
| 6178 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6179 | + return; |
---|
| 6180 | + |
---|
5790 | 6181 | if (hide) |
---|
5791 | 6182 | return; |
---|
5792 | 6183 | // shadow optimisation |
---|
.. | .. |
---|
5912 | 6303 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5913 | 6304 | return; // no shadow for transparent objects |
---|
5914 | 6305 | |
---|
| 6306 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6307 | + return; |
---|
| 6308 | + |
---|
5915 | 6309 | if (hide) |
---|
5916 | 6310 | return; |
---|
5917 | 6311 | |
---|
.. | .. |
---|
6025 | 6419 | // dec 2012 |
---|
6026 | 6420 | new Exception().printStackTrace(); |
---|
6027 | 6421 | return; |
---|
| 6422 | + } |
---|
| 6423 | + |
---|
| 6424 | + if (dontselect) |
---|
| 6425 | + { |
---|
| 6426 | + //bRep.GenerateNormalsMINE(); |
---|
6028 | 6427 | } |
---|
6029 | 6428 | |
---|
6030 | 6429 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6877 | 7276 | spot.translate(32, 32); |
---|
6878 | 7277 | spotw = spot.x + spot.width; |
---|
6879 | 7278 | spoth = spot.y + spot.height; |
---|
6880 | | - info.g.setColor(Color.blue); |
---|
| 7279 | + info.g.setColor(Color.cyan); |
---|
6881 | 7280 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6882 | 7281 | // if (CameraPane.Xmin > spot.x) |
---|
6883 | 7282 | // { |
---|
.. | .. |
---|
6895 | 7294 | // { |
---|
6896 | 7295 | // CameraPane.Ymax = spoth; |
---|
6897 | 7296 | // } |
---|
6898 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6899 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7297 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7298 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6900 | 7299 | spot.translate(0, -32); |
---|
6901 | | - info.g.setColor(Color.green); |
---|
| 7300 | + info.g.setColor(Color.yellow); |
---|
6902 | 7301 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7302 | + info.g.setColor(Color.green); |
---|
6903 | 7303 | // if (CameraPane.Xmin > spot.x) |
---|
6904 | 7304 | // { |
---|
6905 | 7305 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6916 | 7316 | // { |
---|
6917 | 7317 | // CameraPane.Ymax = spoth; |
---|
6918 | 7318 | // } |
---|
6919 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6920 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7319 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7320 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
6921 | 7321 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6922 | 7322 | // if (CameraPane.Xmin > boundary.x) |
---|
6923 | 7323 | // { |
---|
.. | .. |
---|
6951 | 7351 | startX = info.x; |
---|
6952 | 7352 | startY = info.y; |
---|
6953 | 7353 | |
---|
6954 | | - hitSomething = 0; |
---|
| 7354 | + hitSomething = -1; |
---|
6955 | 7355 | cVector origin = new cVector(); |
---|
6956 | 7356 | //LA.xformPos(origin, toParent, origin); |
---|
6957 | 7357 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7027 | 7427 | //System.out.println("hitSomething = " + hitSomething); |
---|
7028 | 7428 | |
---|
7029 | 7429 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7430 | + |
---|
7030 | 7431 | cVector xlate = new cVector(); |
---|
7031 | 7432 | //cVector xlate2 = new cVector(); |
---|
7032 | 7433 | switch (hitSomething) |
---|
.. | .. |
---|
7175 | 7576 | |
---|
7176 | 7577 | case hitScale: // scale |
---|
7177 | 7578 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7579 | + double sign = 1; |
---|
| 7580 | + if (hScale < 0) |
---|
| 7581 | + { |
---|
| 7582 | + sign = -1; |
---|
| 7583 | + } |
---|
| 7584 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7178 | 7585 | if (hScale < 0.01) |
---|
7179 | 7586 | { |
---|
7180 | | - hScale = 0.01; |
---|
| 7587 | + //hScale = 0.01; |
---|
7181 | 7588 | } |
---|
7182 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7183 | | - if (hScale < 0.01) |
---|
7184 | | - { |
---|
7185 | | - hScale = 0.01; |
---|
7186 | | - } |
---|
| 7589 | + |
---|
7187 | 7590 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7188 | | - if (vScale < 0.01) |
---|
| 7591 | + sign = 1; |
---|
| 7592 | + if (vScale < 0) |
---|
7189 | 7593 | { |
---|
7190 | | - vScale = 0.01; |
---|
| 7594 | + sign = -1; |
---|
7191 | 7595 | } |
---|
7192 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7596 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7193 | 7597 | if (vScale < 0.01) |
---|
7194 | 7598 | { |
---|
7195 | | - vScale = 0.01; |
---|
| 7599 | + //vScale = 0.01; |
---|
7196 | 7600 | } |
---|
7197 | 7601 | LA.matCopy(startMat, toParent); |
---|
7198 | 7602 | /**/ |
---|
.. | .. |
---|
7203 | 7607 | } |
---|
7204 | 7608 | /**/ |
---|
7205 | 7609 | |
---|
| 7610 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7611 | + |
---|
| 7612 | + if (totalScale < 0.01) |
---|
| 7613 | + { |
---|
| 7614 | + totalScale = 0.01; |
---|
| 7615 | + } |
---|
| 7616 | + |
---|
7206 | 7617 | switch (info.pane.RenderCamera().viewCode) |
---|
7207 | 7618 | { |
---|
7208 | 7619 | case 3: // '\001' |
---|
7209 | | - if (modified) |
---|
| 7620 | + if (modified || opposite) |
---|
7210 | 7621 | { |
---|
7211 | 7622 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7212 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7623 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7213 | 7624 | } // vScale, 1); |
---|
7214 | 7625 | else |
---|
7215 | 7626 | { |
---|
7216 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7627 | + // EXCEPTION! |
---|
| 7628 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7217 | 7629 | } // vScale, 1); |
---|
7218 | 7630 | break; |
---|
7219 | 7631 | |
---|
7220 | 7632 | case 2: // '\002' |
---|
7221 | | - if (modified) |
---|
| 7633 | + if (modified || opposite) |
---|
7222 | 7634 | { |
---|
7223 | 7635 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7224 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7636 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7225 | 7637 | } else |
---|
7226 | 7638 | { |
---|
7227 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7639 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7228 | 7640 | } |
---|
7229 | 7641 | break; |
---|
7230 | 7642 | |
---|
7231 | 7643 | case 1: // '\003' |
---|
7232 | | - if (modified) |
---|
| 7644 | + if (modified || opposite) |
---|
7233 | 7645 | { |
---|
7234 | 7646 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7235 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7647 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7236 | 7648 | } else |
---|
7237 | 7649 | { |
---|
7238 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7650 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7239 | 7651 | } |
---|
7240 | 7652 | break; |
---|
7241 | 7653 | } |
---|
.. | .. |
---|
7368 | 7780 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7369 | 7781 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7370 | 7782 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 7783 | + |
---|
| 7784 | + String objname; |
---|
| 7785 | + |
---|
7371 | 7786 | if (false) //parent != null) |
---|
7372 | 7787 | { |
---|
7373 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 7788 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7374 | 7789 | } else |
---|
7375 | 7790 | { |
---|
7376 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 7791 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7377 | 7792 | } // + super.toString(); |
---|
7378 | 7793 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 7794 | + |
---|
| 7795 | + if (!Globals.ADVANCED) |
---|
| 7796 | + return objname; |
---|
| 7797 | + |
---|
| 7798 | + return objname + " " + System.identityHashCode(this); |
---|
7379 | 7799 | } |
---|
7380 | 7800 | |
---|
7381 | 7801 | public int hashCode() |
---|
.. | .. |
---|
7441 | 7861 | editWindow = null; |
---|
7442 | 7862 | } // ? |
---|
7443 | 7863 | } |
---|
| 7864 | + else |
---|
| 7865 | + { |
---|
| 7866 | + //editWindow.closeUI(); |
---|
| 7867 | + } |
---|
7444 | 7868 | } |
---|
7445 | 7869 | |
---|
7446 | 7870 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7452 | 7876 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7453 | 7877 | |
---|
7454 | 7878 | Object3D /*Composite*/ parent; |
---|
7455 | | - Object3D /*Composite*/ fileparent; |
---|
| 7879 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7456 | 7880 | |
---|
7457 | 7881 | double[][] toParent; // dynamic matrix |
---|
7458 | 7882 | double[][] fromParent; |
---|
.. | .. |
---|
7567 | 7991 | { |
---|
7568 | 7992 | assert(bRep != null); |
---|
7569 | 7993 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7570 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 7994 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7571 | 7995 | } |
---|
7572 | 7996 | else |
---|
7573 | 7997 | { |
---|
.. | .. |
---|
7598 | 8022 | } |
---|
7599 | 8023 | |
---|
7600 | 8024 | transient ObjEditor editWindow; |
---|
| 8025 | + transient ObjEditor manipWindow; |
---|
| 8026 | + |
---|
| 8027 | + transient boolean pinned; |
---|
| 8028 | + |
---|
7601 | 8029 | transient ObjectUI objectUI; |
---|
7602 | 8030 | public static int povDepth = 0; |
---|
7603 | 8031 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7616 | 8044 | private static cVector edge2 = new cVector(); |
---|
7617 | 8045 | //private static cVector norm = new cVector(); |
---|
7618 | 8046 | /*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; |
---|
| 8047 | + static final int hitCenter = 1; |
---|
| 8048 | + static final int hitScale = 2; |
---|
| 8049 | + static final int hitRotate = 3; |
---|
7622 | 8050 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7623 | 8051 | /*transient*/ private Point centerPt; |
---|
7624 | 8052 | /*transient*/ private int startX; |
---|