.. | .. |
---|
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 | + // Use GetUUID for backward compatibility with null. |
---|
| 26 | + private UUID uuid = UUID.randomUUID(); |
---|
| 27 | + |
---|
| 28 | + // TEMPORARY for mocap undo. No need to be transient. |
---|
| 29 | + mocap.reader.BVHReader.BVHResult savebvh; |
---|
| 30 | + Object3D saveskeleton; |
---|
| 31 | + // |
---|
| 32 | + |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
| 37 | + int versionindex = -1; |
---|
| 38 | + |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
23 | 41 | ScriptNode scriptnode; |
---|
24 | 42 | |
---|
| 43 | + int VersionCount() |
---|
| 44 | + { |
---|
| 45 | + int count = 0; |
---|
| 46 | + |
---|
| 47 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 48 | + { |
---|
| 49 | + if (versionlist[i] != null) |
---|
| 50 | + count++; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + return count; |
---|
| 54 | + } |
---|
| 55 | + |
---|
25 | 56 | void InitOthers() |
---|
26 | 57 | { |
---|
27 | 58 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
100 | 131 | |
---|
101 | 132 | // transient boolean reduced; // for morph reduction |
---|
102 | 133 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 134 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 135 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
105 | 136 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 137 | + transient Object3D transientsupport; // for cloning |
---|
| 138 | + transient boolean transientlink2master; |
---|
108 | 139 | |
---|
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) |
---|
| 140 | + void SaveSupports() |
---|
121 | 141 | { |
---|
122 | | - bRep.SaveSupports(); |
---|
| 142 | + if (blockloop) |
---|
| 143 | + return; |
---|
| 144 | + |
---|
| 145 | + transientsupport = support; |
---|
| 146 | + transientlink2master = link2master; |
---|
| 147 | + |
---|
| 148 | + support = null; |
---|
| 149 | + link2master = false; |
---|
| 150 | + |
---|
| 151 | + if (bRep != null) |
---|
| 152 | + { |
---|
| 153 | + bRep.SaveSupports(); |
---|
| 154 | + } |
---|
| 155 | + |
---|
| 156 | + for (int i = 0; i < Size(); i++) |
---|
| 157 | + { |
---|
| 158 | + Object3D child = (Object3D) get(i); |
---|
| 159 | + if (child == null) |
---|
| 160 | + continue; |
---|
| 161 | + blockloop = true; |
---|
| 162 | + child.SaveSupports(); |
---|
| 163 | + blockloop = false; |
---|
| 164 | + } |
---|
123 | 165 | } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
| 166 | + |
---|
| 167 | + void RestoreSupports() |
---|
126 | 168 | { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
| 169 | + if (blockloop) |
---|
| 170 | + return; |
---|
| 171 | + |
---|
| 172 | + support = transientsupport; |
---|
| 173 | + link2master = transientlink2master; |
---|
| 174 | + transientsupport = null; |
---|
| 175 | + transientlink2master = false; |
---|
| 176 | + |
---|
| 177 | + if (bRep != null) |
---|
| 178 | + { |
---|
| 179 | + bRep.RestoreSupports(); |
---|
| 180 | + } |
---|
| 181 | + |
---|
| 182 | + for (int i = 0; i < Size(); i++) |
---|
| 183 | + { |
---|
| 184 | + Object3D child = (Object3D) get(i); |
---|
| 185 | + if (child == null) |
---|
| 186 | + continue; |
---|
| 187 | + blockloop = true; |
---|
| 188 | + child.RestoreSupports(); |
---|
| 189 | + blockloop = false; |
---|
| 190 | + } |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 194 | + { |
---|
| 195 | + Object3D o; |
---|
| 196 | + |
---|
| 197 | + if (hashtable.containsKey(GetUUID())) |
---|
| 198 | + { |
---|
| 199 | + o = hashtable.get(GetUUID()); |
---|
| 200 | + |
---|
| 201 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 202 | + //if (this.bRep != null) |
---|
| 203 | + // assert(this.bRep.support == o.transientrep); |
---|
| 204 | + if (this.support != null) |
---|
| 205 | + assert(this.support.bRep == o.transientrep); |
---|
| 206 | + } |
---|
| 207 | + else |
---|
| 208 | + { |
---|
| 209 | + o = new Object3D("copy of " + this.name); |
---|
| 210 | + |
---|
| 211 | + hashtable.put(GetUUID(), o); |
---|
| 212 | + } |
---|
| 213 | + |
---|
| 214 | + if (!blockloop) |
---|
| 215 | + { |
---|
| 216 | + blockloop = true; |
---|
| 217 | + |
---|
| 218 | + for (int i=0; i<Size(); i++) |
---|
| 219 | + { |
---|
| 220 | + get(i).ExtractBigData(hashtable); |
---|
| 221 | + } |
---|
| 222 | + |
---|
| 223 | + blockloop = false; |
---|
| 224 | + } |
---|
| 225 | + |
---|
| 226 | + ExtractBigData(o); |
---|
| 227 | + } |
---|
| 228 | + |
---|
| 229 | + void ExtractBigData(Object3D o) |
---|
| 230 | + { |
---|
| 231 | + if (o.bRep != null) |
---|
| 232 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 233 | + |
---|
| 234 | + o.bRep = this.bRep; |
---|
| 235 | +// July 2019 if (this.bRep != null) |
---|
| 236 | +// { |
---|
| 237 | +// o.transientrep = this.bRep.support; |
---|
| 238 | +// o.bRep.support = null; |
---|
| 239 | +// } |
---|
| 240 | + o.selection = this.selection; |
---|
| 241 | + o.versionlist = this.versionlist; |
---|
| 242 | + o.versionindex = this.versionindex; |
---|
| 243 | + |
---|
| 244 | + if (this.support != null) |
---|
| 245 | + { |
---|
| 246 | + if (o.transientrep != null) |
---|
| 247 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 248 | + |
---|
| 249 | + o.transientrep = this.support.bRep; |
---|
| 250 | + this.support.bRep = null; |
---|
| 251 | + } |
---|
| 252 | + |
---|
| 253 | + // o.support = this.support; |
---|
| 254 | + // o.fileparent = this.fileparent; |
---|
| 255 | + // if (this.bRep != null) |
---|
| 256 | + // o.bRep = this.bRep.support; |
---|
| 257 | + |
---|
| 258 | + this.bRep = null; |
---|
| 259 | + // if (this.bRep != null) |
---|
| 260 | + // this.bRep.support = null; |
---|
| 261 | + // this.support = null; |
---|
| 262 | + // this.fileparent = null; |
---|
| 263 | + } |
---|
| 264 | + |
---|
| 265 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 266 | +// { |
---|
| 267 | +// if (this.uuid.equals(uuid)) |
---|
| 268 | +// return this; |
---|
| 269 | +// |
---|
| 270 | +// if (blockloop) |
---|
| 271 | +// return null; |
---|
| 272 | +// |
---|
| 273 | +// blockloop = true; |
---|
| 274 | +// |
---|
| 275 | +// for (int i=0; i<Size(); i++) |
---|
| 276 | +// { |
---|
| 277 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 278 | +// |
---|
| 279 | +// if (o != null) |
---|
| 280 | +// return o; |
---|
| 281 | +// } |
---|
| 282 | +// |
---|
| 283 | +// blockloop = false; |
---|
| 284 | +// |
---|
| 285 | +// return null; |
---|
| 286 | +// } |
---|
| 287 | + |
---|
| 288 | + transient boolean tag; |
---|
| 289 | + |
---|
| 290 | + void TagObjects(Object3D o, boolean tag) |
---|
| 291 | + { |
---|
| 292 | + if (blockloop) |
---|
| 293 | + return; |
---|
| 294 | + |
---|
| 295 | + o.tag = tag; |
---|
| 296 | + |
---|
| 297 | + if (o == this) |
---|
| 298 | + return; |
---|
| 299 | + |
---|
130 | 300 | blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
| 301 | + |
---|
| 302 | + for (int i=0; i<Size(); i++) |
---|
| 303 | + { |
---|
| 304 | + get(i).TagObjects(o, tag); |
---|
| 305 | + } |
---|
| 306 | + |
---|
132 | 307 | blockloop = false; |
---|
133 | 308 | } |
---|
134 | | -} |
---|
135 | 309 | |
---|
136 | | -void RestoreSupports() |
---|
137 | | -{ |
---|
138 | | - if (blockloop) |
---|
139 | | - return; |
---|
| 310 | + boolean HasTags() |
---|
| 311 | + { |
---|
| 312 | + if (blockloop) |
---|
| 313 | + return false; |
---|
140 | 314 | |
---|
141 | | - support = transientsupport; |
---|
142 | | - link2master = transientlink2master; |
---|
143 | | - transientsupport = null; |
---|
144 | | - transientlink2master = false; |
---|
145 | | - |
---|
146 | | - if (bRep != null) |
---|
147 | | - { |
---|
148 | | - bRep.RestoreSupports(); |
---|
149 | | - } |
---|
150 | | - |
---|
151 | | - for (int i = 0; i < Size(); i++) |
---|
152 | | - { |
---|
153 | | - Object3D child = (Object3D) get(i); |
---|
154 | | - if (child == null) |
---|
155 | | - continue; |
---|
156 | 315 | blockloop = true; |
---|
157 | | - child.RestoreSupports(); |
---|
| 316 | + |
---|
| 317 | + boolean hasTags = false; |
---|
| 318 | + |
---|
| 319 | + for (int i=0; i<Size(); i++) |
---|
| 320 | + { |
---|
| 321 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 322 | + |
---|
| 323 | + if (hasTags) |
---|
| 324 | + break; |
---|
| 325 | + } |
---|
| 326 | + |
---|
| 327 | + blockloop = false; |
---|
| 328 | + |
---|
| 329 | + return hasTags; |
---|
| 330 | + } |
---|
| 331 | + |
---|
| 332 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 333 | + { |
---|
| 334 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 335 | + return; |
---|
| 336 | + |
---|
| 337 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 338 | + |
---|
| 339 | + RestoreBigData(o); |
---|
| 340 | + |
---|
| 341 | + if (blockloop) |
---|
| 342 | + return; |
---|
| 343 | + |
---|
| 344 | + blockloop = true; |
---|
| 345 | + |
---|
| 346 | + //hashtable.remove(GetUUID()); |
---|
| 347 | + |
---|
| 348 | + for (int i=0; i<Size(); i++) |
---|
| 349 | + { |
---|
| 350 | + get(i).RestoreBigData(hashtable); |
---|
| 351 | + } |
---|
| 352 | + |
---|
158 | 353 | blockloop = false; |
---|
159 | 354 | } |
---|
160 | | -} |
---|
| 355 | + |
---|
| 356 | + void RestoreBigData(Object3D o) |
---|
| 357 | + { |
---|
| 358 | + this.bRep = o.bRep; |
---|
| 359 | + if (this.support != null && o.transientrep != null) |
---|
| 360 | + { |
---|
| 361 | + this.support.bRep = o.transientrep; |
---|
| 362 | + } |
---|
| 363 | + |
---|
| 364 | + this.selection = o.selection; |
---|
| 365 | + |
---|
| 366 | + this.versionlist = o.versionlist; |
---|
| 367 | + this.versionindex = o.versionindex; |
---|
| 368 | +// July 2019 if (this.bRep != null) |
---|
| 369 | +// this.bRep.support = o.transientrep; |
---|
| 370 | + // this.support = o.support; |
---|
| 371 | + // this.fileparent = o.fileparent; |
---|
| 372 | + } |
---|
161 | 373 | |
---|
162 | 374 | // MOCAP SUPPORT |
---|
163 | 375 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
300 | 512 | } |
---|
301 | 513 | |
---|
302 | 514 | boolean live = false; |
---|
| 515 | + transient boolean keepdontselect; |
---|
| 516 | + boolean dontselect = false; |
---|
303 | 517 | boolean hide = false; |
---|
304 | 518 | boolean link2master = false; // performs reset support/master at each frame |
---|
305 | 519 | boolean marked = false; // animation node |
---|
.. | .. |
---|
367 | 581 | } |
---|
368 | 582 | } |
---|
369 | 583 | |
---|
370 | | - int memorysize; |
---|
| 584 | + transient int memorysize; // needs to be transient, dunno why |
---|
371 | 585 | |
---|
372 | 586 | int MemorySize() |
---|
373 | 587 | { |
---|
374 | | - if (true) // memorysize == 0) |
---|
| 588 | + if (memorysize == 0) |
---|
375 | 589 | { |
---|
376 | 590 | try |
---|
377 | 591 | { |
---|
.. | .. |
---|
481 | 695 | toParent = LA.newMatrix(); |
---|
482 | 696 | fromParent = LA.newMatrix(); |
---|
483 | 697 | } |
---|
| 698 | + |
---|
484 | 699 | if (toParentMarked == null) |
---|
485 | 700 | { |
---|
486 | 701 | if (maxcount != 1) |
---|
487 | 702 | { |
---|
488 | | - new Exception().printStackTrace(); |
---|
| 703 | + //new Exception().printStackTrace(); |
---|
489 | 704 | } |
---|
| 705 | + |
---|
490 | 706 | toParentMarked = LA.newMatrix(); |
---|
491 | 707 | fromParentMarked = LA.newMatrix(); |
---|
492 | 708 | } |
---|
.. | .. |
---|
774 | 990 | if (step == 0) |
---|
775 | 991 | step = 1; |
---|
776 | 992 | if (maxcount == 0) |
---|
777 | | - maxcount = 2048; // 4; |
---|
| 993 | + maxcount = 128; // 2048; // 4; |
---|
778 | 994 | // if (acceleration == 0) |
---|
779 | 995 | // acceleration = 10; |
---|
780 | 996 | if (delay == 0) // serial |
---|
.. | .. |
---|
797 | 1013 | |
---|
798 | 1014 | if (marked && Globals.isLIVE() && live && |
---|
799 | 1015 | //TEMP21aug2018 |
---|
800 | | - Globals.DrawMode() == iCameraPane.SHADOW && |
---|
| 1016 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
801 | 1017 | currentframe != Globals.framecount) |
---|
802 | 1018 | { |
---|
803 | 1019 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
809 | 1025 | |
---|
810 | 1026 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
811 | 1027 | |
---|
812 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 1028 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 1029 | + (step == 1 && changedir)) |
---|
813 | 1030 | { |
---|
814 | 1031 | countdown = 1; |
---|
815 | 1032 | delay = speedup?8:1; |
---|
.. | .. |
---|
881 | 1098 | if (material == null || material.multiply) |
---|
882 | 1099 | return true; |
---|
883 | 1100 | |
---|
| 1101 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1102 | + return false; |
---|
| 1103 | + |
---|
| 1104 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
884 | 1105 | return material.opacity > 0.99; |
---|
885 | 1106 | } |
---|
886 | 1107 | |
---|
.. | .. |
---|
912 | 1133 | fromParent = null; // LA.newMatrix(); |
---|
913 | 1134 | bRep = null; // new BoundaryRep(); |
---|
914 | 1135 | |
---|
| 1136 | + if (oname != null && oname.equals("LeftHand")) |
---|
| 1137 | + { |
---|
| 1138 | + name = oname; |
---|
| 1139 | + } |
---|
| 1140 | + |
---|
915 | 1141 | /* |
---|
916 | 1142 | float hue = (float)Math.random(); |
---|
917 | 1143 | Color col; |
---|
.. | .. |
---|
954 | 1180 | |
---|
955 | 1181 | public Object clone() |
---|
956 | 1182 | { |
---|
957 | | - return GrafreeD.clone(this); |
---|
| 1183 | + return Grafreed.clone(this); |
---|
958 | 1184 | } |
---|
959 | 1185 | |
---|
960 | 1186 | Object3D copyExpand() |
---|
.. | .. |
---|
1276 | 1502 | toParent = LA.newMatrix(); |
---|
1277 | 1503 | fromParent = LA.newMatrix(); |
---|
1278 | 1504 | } |
---|
| 1505 | + |
---|
1279 | 1506 | LA.matCopy(other.toParent, toParent); |
---|
1280 | 1507 | LA.matCopy(other.fromParent, fromParent); |
---|
1281 | 1508 | |
---|
.. | .. |
---|
1470 | 1697 | BoundaryRep.SEUIL = other.material.cameralight; |
---|
1471 | 1698 | |
---|
1472 | 1699 | // Set default to 0.1 |
---|
1473 | | - BoundaryRep.SEUIL /= 2; |
---|
| 1700 | + BoundaryRep.SEUIL /= 4; // 2; |
---|
1474 | 1701 | System.out.println("SEUIL = " + BoundaryRep.SEUIL); |
---|
1475 | 1702 | } |
---|
1476 | 1703 | |
---|
.. | .. |
---|
1729 | 1956 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1730 | 1957 | o.bRep = transientrep; |
---|
1731 | 1958 | if (clone) |
---|
1732 | | - o.bRep = (BoundaryRep) GrafreeD.clone(transientrep); |
---|
| 1959 | + o.bRep = (BoundaryRep) Grafreed.clone(transientrep); |
---|
1733 | 1960 | o.CreateMaterial(); |
---|
1734 | 1961 | o.SetAttributes(this, -1); |
---|
1735 | 1962 | //parent |
---|
.. | .. |
---|
1742 | 1969 | Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name); |
---|
1743 | 1970 | o.bRep = bRep; |
---|
1744 | 1971 | if (clone) |
---|
1745 | | - o.bRep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 1972 | + o.bRep = (BoundaryRep) Grafreed.clone(bRep); |
---|
1746 | 1973 | o.CreateMaterial(); |
---|
1747 | 1974 | //o.overwriteThis(this, -1); |
---|
1748 | 1975 | o.SetAttributes(this, -1); |
---|
.. | .. |
---|
1829 | 2056 | if (obj.name == null) |
---|
1830 | 2057 | continue; // can't be a null one |
---|
1831 | 2058 | |
---|
| 2059 | + // Try perfect match first. |
---|
1832 | 2060 | if (n.equals(obj.name)) |
---|
1833 | 2061 | { |
---|
1834 | 2062 | theobj = obj; |
---|
1835 | 2063 | count++; |
---|
1836 | 2064 | } |
---|
1837 | 2065 | } |
---|
| 2066 | + |
---|
| 2067 | + // not needed: n = n.split(":")[0]; // Poser generates a count |
---|
1838 | 2068 | |
---|
1839 | 2069 | if (count != 1) |
---|
1840 | 2070 | for (int i=Size(); --i>=0;) |
---|
.. | .. |
---|
2152 | 2382 | |
---|
2153 | 2383 | InitOthers(); |
---|
2154 | 2384 | |
---|
2155 | | - if (this instanceof Camera) |
---|
2156 | | - { |
---|
2157 | | - material.shift = 90; |
---|
2158 | | - } |
---|
2159 | | - |
---|
2160 | 2385 | material.multiply = multiply; |
---|
2161 | 2386 | |
---|
2162 | 2387 | if (multiply) |
---|
.. | .. |
---|
2294 | 2519 | } |
---|
2295 | 2520 | */ |
---|
2296 | 2521 | } |
---|
| 2522 | + else |
---|
| 2523 | + { |
---|
| 2524 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2525 | + if (objectUI != null) |
---|
| 2526 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2527 | + else |
---|
| 2528 | + //new Exception().printStackTrace(); |
---|
| 2529 | + System.err.println("objectUI is null"); |
---|
| 2530 | + } |
---|
2297 | 2531 | } |
---|
2298 | 2532 | |
---|
2299 | 2533 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2335 | 2569 | { |
---|
2336 | 2570 | editWindow.refreshContents(); |
---|
2337 | 2571 | } |
---|
| 2572 | + else |
---|
| 2573 | + { |
---|
| 2574 | + if (manipWindow != null) |
---|
| 2575 | + { |
---|
| 2576 | + manipWindow.refreshContents(); |
---|
| 2577 | + } |
---|
| 2578 | + } |
---|
| 2579 | + |
---|
2338 | 2580 | //if (parent != null) |
---|
2339 | 2581 | //parent.refreshEditWindow(); |
---|
2340 | 2582 | } |
---|
.. | .. |
---|
2414 | 2656 | private static final int editSelf = 1; |
---|
2415 | 2657 | private static final int editChild = 2; |
---|
2416 | 2658 | |
---|
2417 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2659 | + void drawEditHandles(//ClickInfo info, |
---|
| 2660 | + int level) |
---|
2418 | 2661 | { |
---|
2419 | 2662 | if (level == 0) |
---|
2420 | 2663 | { |
---|
.. | .. |
---|
2422 | 2665 | return; |
---|
2423 | 2666 | |
---|
2424 | 2667 | Object3D selectee; |
---|
2425 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2668 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2669 | + level + 1)) |
---|
2426 | 2670 | { |
---|
2427 | 2671 | selectee = (Object3D) e.nextElement(); |
---|
2428 | 2672 | } |
---|
.. | .. |
---|
2430 | 2674 | } else |
---|
2431 | 2675 | { |
---|
2432 | 2676 | //super. |
---|
2433 | | - drawEditHandles0(info, level + 1); |
---|
| 2677 | + drawEditHandles0(//info, |
---|
| 2678 | + level + 1); |
---|
2434 | 2679 | } |
---|
2435 | 2680 | } |
---|
2436 | 2681 | |
---|
2437 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2682 | + boolean doEditClick(//ClickInfo info, |
---|
| 2683 | + int level) |
---|
2438 | 2684 | { |
---|
2439 | 2685 | doSomething = 0; |
---|
2440 | 2686 | if (level == 0) |
---|
2441 | 2687 | { |
---|
2442 | | - return doParentClick(info); |
---|
| 2688 | + return doParentClick(); //info); |
---|
2443 | 2689 | } |
---|
2444 | 2690 | if (//super. |
---|
2445 | | - doEditClick0(info, level)) |
---|
| 2691 | + doEditClick0(//info, |
---|
| 2692 | + level)) |
---|
2446 | 2693 | { |
---|
2447 | 2694 | doSomething = 1; |
---|
2448 | 2695 | return true; |
---|
.. | .. |
---|
2452 | 2699 | } |
---|
2453 | 2700 | } |
---|
2454 | 2701 | |
---|
2455 | | - boolean doParentClick(ClickInfo info) |
---|
| 2702 | + boolean doParentClick() //ClickInfo info) |
---|
2456 | 2703 | { |
---|
2457 | 2704 | if (selection == null) |
---|
2458 | 2705 | { |
---|
.. | .. |
---|
2465 | 2712 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2466 | 2713 | { |
---|
2467 | 2714 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2468 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2715 | + if (selectee.doEditClick(//info, |
---|
| 2716 | + 1)) |
---|
2469 | 2717 | { |
---|
2470 | 2718 | childToDrag = selectee; |
---|
2471 | 2719 | doSomething = 2; |
---|
.. | .. |
---|
2477 | 2725 | return retval; |
---|
2478 | 2726 | } |
---|
2479 | 2727 | |
---|
2480 | | - void doEditDrag(ClickInfo info) |
---|
| 2728 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2729 | + boolean opposite) |
---|
2481 | 2730 | { |
---|
2482 | 2731 | switch (doSomething) |
---|
2483 | 2732 | { |
---|
2484 | 2733 | case 1: // '\001' |
---|
2485 | 2734 | //super. |
---|
2486 | | - doEditDrag0(info); |
---|
| 2735 | + doEditDrag0(//clickInfo, |
---|
| 2736 | + opposite); |
---|
2487 | 2737 | break; |
---|
2488 | 2738 | |
---|
2489 | 2739 | case 2: // '\002' |
---|
.. | .. |
---|
2496 | 2746 | { |
---|
2497 | 2747 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2498 | 2748 | //childToDrag.doEditDrag(info); |
---|
2499 | | - sel.doEditDrag(info); |
---|
| 2749 | + sel.doEditDrag(//clickInfo, |
---|
| 2750 | + opposite); |
---|
2500 | 2751 | } else |
---|
2501 | 2752 | { |
---|
2502 | 2753 | //super. |
---|
2503 | | - doEditDrag0(info); |
---|
| 2754 | + doEditDrag0(//clickInfo, |
---|
| 2755 | + opposite); |
---|
2504 | 2756 | } |
---|
2505 | 2757 | } |
---|
2506 | 2758 | break; |
---|
.. | .. |
---|
2518 | 2770 | { |
---|
2519 | 2771 | deselectAll(); |
---|
2520 | 2772 | } |
---|
| 2773 | + |
---|
| 2774 | + new Exception().printStackTrace(); |
---|
| 2775 | + |
---|
2521 | 2776 | ClickInfo newInfo = new ClickInfo(); |
---|
2522 | 2777 | newInfo.flags = info.flags; |
---|
2523 | 2778 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
2610 | 2865 | void GenNormalsS(boolean crease) |
---|
2611 | 2866 | { |
---|
2612 | 2867 | selection.GenNormals(crease); |
---|
| 2868 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2869 | +// { |
---|
| 2870 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2871 | +// selectee.GenNormals(crease); |
---|
| 2872 | +// } |
---|
| 2873 | + |
---|
| 2874 | + //Touch(); |
---|
| 2875 | + } |
---|
| 2876 | + |
---|
| 2877 | + void GenNormalsMeshS() |
---|
| 2878 | + { |
---|
| 2879 | + selection.GenNormalsMesh(); |
---|
2613 | 2880 | // for (int i=0; i<selection.size(); i++) |
---|
2614 | 2881 | // { |
---|
2615 | 2882 | // Object3D selectee = (Object3D) selection.elementAt(i); |
---|
.. | .. |
---|
2750 | 3017 | if (child == null) |
---|
2751 | 3018 | continue; |
---|
2752 | 3019 | child.GenNormals(crease); |
---|
| 3020 | +// Children().release(i); |
---|
| 3021 | + } |
---|
| 3022 | + blockloop = false; |
---|
| 3023 | + } |
---|
| 3024 | + |
---|
| 3025 | + void GenNormalsMesh() |
---|
| 3026 | + { |
---|
| 3027 | + if (blockloop) |
---|
| 3028 | + return; |
---|
| 3029 | + |
---|
| 3030 | + blockloop = true; |
---|
| 3031 | + GenNormalsMesh0(); |
---|
| 3032 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 3033 | + { |
---|
| 3034 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 3035 | + if (child == null) |
---|
| 3036 | + continue; |
---|
| 3037 | + child.GenNormalsMesh(); |
---|
2753 | 3038 | // Children().release(i); |
---|
2754 | 3039 | } |
---|
2755 | 3040 | blockloop = false; |
---|
.. | .. |
---|
2922 | 3207 | } |
---|
2923 | 3208 | } |
---|
2924 | 3209 | |
---|
| 3210 | + void GenNormalsMesh0() |
---|
| 3211 | + { |
---|
| 3212 | + if (bRep != null) |
---|
| 3213 | + { |
---|
| 3214 | + bRep.GenerateNormalsMesh(); |
---|
| 3215 | + Touch(); |
---|
| 3216 | + } |
---|
| 3217 | + } |
---|
| 3218 | + |
---|
2925 | 3219 | void GenNormalsMINE0() |
---|
2926 | 3220 | { |
---|
2927 | 3221 | if (bRep != null) |
---|
2928 | 3222 | { |
---|
2929 | | - bRep.GenerateNormalsMINE(); |
---|
| 3223 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
2930 | 3224 | Touch(); |
---|
2931 | 3225 | } |
---|
2932 | 3226 | } |
---|
.. | .. |
---|
2983 | 3277 | blockloop = false; |
---|
2984 | 3278 | } |
---|
2985 | 3279 | |
---|
| 3280 | + public void ResetTransform(int mask) |
---|
| 3281 | + { |
---|
| 3282 | + Object3D obj = this; |
---|
| 3283 | + |
---|
| 3284 | + if (mask == -1) |
---|
| 3285 | + { |
---|
| 3286 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3287 | + { |
---|
| 3288 | + LA.matIdentity(obj.toParent); |
---|
| 3289 | + LA.matIdentity(obj.fromParent); |
---|
| 3290 | + } |
---|
| 3291 | + else |
---|
| 3292 | + { |
---|
| 3293 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3294 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3295 | + } |
---|
| 3296 | + return; |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3300 | + { |
---|
| 3301 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3302 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3303 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3304 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3305 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3306 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3307 | + } |
---|
| 3308 | + if ((mask&1) != 0) // Translation |
---|
| 3309 | + { |
---|
| 3310 | + if (obj.toParent != null) |
---|
| 3311 | + { |
---|
| 3312 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3313 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3314 | + } |
---|
| 3315 | + } |
---|
| 3316 | + } |
---|
| 3317 | + |
---|
| 3318 | + public void TextureRatioTransform(int axis) |
---|
| 3319 | + { |
---|
| 3320 | + cTexture tex = GetTextures(); |
---|
| 3321 | + |
---|
| 3322 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3323 | + |
---|
| 3324 | + try |
---|
| 3325 | + { |
---|
| 3326 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3327 | + } |
---|
| 3328 | + catch (Exception e) |
---|
| 3329 | + { |
---|
| 3330 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3331 | + } |
---|
| 3332 | + |
---|
| 3333 | + LA.matIdentity(Object3D.mat); |
---|
| 3334 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3335 | + |
---|
| 3336 | + if (toParent == null) |
---|
| 3337 | + { |
---|
| 3338 | + toParent = LA.newMatrix(); |
---|
| 3339 | + fromParent = LA.newMatrix(); |
---|
| 3340 | + } |
---|
| 3341 | + |
---|
| 3342 | + ResetTransform(2); |
---|
| 3343 | + |
---|
| 3344 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3345 | + LA.matInvert(fromParent, toParent); |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void TextureRatio(int axis) |
---|
| 3349 | + { |
---|
| 3350 | + if (blockloop) |
---|
| 3351 | + return; |
---|
| 3352 | + |
---|
| 3353 | + blockloop = true; |
---|
| 3354 | + |
---|
| 3355 | + TextureRatioTransform(axis); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=Size(); --i>=0;) |
---|
| 3358 | + { |
---|
| 3359 | + Object3D v = get(i); |
---|
| 3360 | + |
---|
| 3361 | + v.TextureRatio(axis); |
---|
| 3362 | + } |
---|
| 3363 | + |
---|
| 3364 | + blockloop = false; |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
| 3367 | + void TransformChildren() |
---|
| 3368 | + { |
---|
| 3369 | + if (toParent != null) |
---|
| 3370 | + { |
---|
| 3371 | + for (int i=Size(); --i>=0;) |
---|
| 3372 | + { |
---|
| 3373 | + Object3D v = get(i); |
---|
| 3374 | + |
---|
| 3375 | + if (v.toParent == null) |
---|
| 3376 | + { |
---|
| 3377 | + v.toParent = LA.newMatrix(); |
---|
| 3378 | + v.fromParent = LA.newMatrix(); |
---|
| 3379 | + } |
---|
| 3380 | + |
---|
| 3381 | +// LA.matConcat(v.toParent, toParent, v.toParent); |
---|
| 3382 | +// LA.matConcat(fromParent, v.fromParent, v.fromParent); |
---|
| 3383 | + LA.matConcat(toParent, v.toParent, v.toParent); |
---|
| 3384 | + LA.matConcat(v.fromParent, fromParent, v.fromParent); |
---|
| 3385 | + } |
---|
| 3386 | + |
---|
| 3387 | + toParent = null; // LA.matIdentity(toParent); |
---|
| 3388 | + fromParent = null; // LA.matIdentity(fromParent); |
---|
| 3389 | + |
---|
| 3390 | + Touch(); |
---|
| 3391 | + } |
---|
| 3392 | + } |
---|
| 3393 | + |
---|
2986 | 3394 | void TransformGeometry() |
---|
2987 | 3395 | { |
---|
2988 | 3396 | Object3D obj = this; |
---|
.. | .. |
---|
3204 | 3612 | |
---|
3205 | 3613 | BoundaryRep sup = bRep.support; |
---|
3206 | 3614 | bRep.support = null; |
---|
3207 | | - BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep); |
---|
| 3615 | + BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep); |
---|
3208 | 3616 | // bRep.SplitInTwo(onlyone); // thread... |
---|
3209 | | - temprep.SplitInTwo(reduction34, onlyone); |
---|
| 3617 | + |
---|
| 3618 | + while(temprep.SplitInTwo(reduction34, onlyone)); |
---|
| 3619 | + |
---|
3210 | 3620 | bRep = temprep; |
---|
3211 | 3621 | bRep.support = sup; |
---|
3212 | 3622 | Touch(); |
---|
.. | .. |
---|
3307 | 3717 | |
---|
3308 | 3718 | void ClearMaterials() |
---|
3309 | 3719 | { |
---|
| 3720 | + if (blockloop) |
---|
| 3721 | + return; |
---|
| 3722 | + |
---|
| 3723 | + blockloop = true; |
---|
| 3724 | + |
---|
3310 | 3725 | ClearMaterial(); |
---|
3311 | | - for (int i = 0; i < size(); i++) |
---|
| 3726 | + for (int i = 0; i < Size(); i++) |
---|
3312 | 3727 | { |
---|
3313 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3728 | + Object3D child = (Object3D) get(i); |
---|
3314 | 3729 | if (child == null) |
---|
3315 | 3730 | continue; |
---|
3316 | 3731 | child.ClearMaterials(); |
---|
3317 | | - release(i); |
---|
3318 | 3732 | } |
---|
| 3733 | + |
---|
| 3734 | + blockloop = false; |
---|
| 3735 | + } |
---|
| 3736 | + |
---|
| 3737 | + void ClearVersionList() |
---|
| 3738 | + { |
---|
| 3739 | + this.versionlist = null; |
---|
| 3740 | + this.versionindex = -1; |
---|
| 3741 | + this.versiontable = null; |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + void ClearVersions() |
---|
| 3745 | + { |
---|
| 3746 | + if (blockloop) |
---|
| 3747 | + return; |
---|
| 3748 | + |
---|
| 3749 | + blockloop = true; |
---|
| 3750 | + |
---|
| 3751 | + ClearVersionList(); |
---|
| 3752 | + for (int i = 0; i < Size(); i++) |
---|
| 3753 | + { |
---|
| 3754 | + Object3D child = (Object3D) get(i); |
---|
| 3755 | + if (child == null) |
---|
| 3756 | + continue; |
---|
| 3757 | + child.ClearVersions(); |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + blockloop = false; |
---|
3319 | 3761 | } |
---|
3320 | 3762 | |
---|
3321 | 3763 | void FlipV(boolean flip) |
---|
.. | .. |
---|
3343 | 3785 | if (blockloop) |
---|
3344 | 3786 | return; |
---|
3345 | 3787 | |
---|
3346 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3788 | + if (//marked || // does not make sense |
---|
| 3789 | + (bRep != null || material != null)) // borderline... |
---|
3347 | 3790 | live = h; |
---|
3348 | 3791 | |
---|
3349 | 3792 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3364 | 3807 | return; |
---|
3365 | 3808 | |
---|
3366 | 3809 | //if (bRep != null) |
---|
3367 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3810 | + if (//marked || // does not make sense |
---|
| 3811 | + (bRep != null || material != null)) // borderline... |
---|
3368 | 3812 | link2master = h; |
---|
3369 | 3813 | |
---|
3370 | 3814 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3384 | 3828 | if (blockloop) |
---|
3385 | 3829 | return; |
---|
3386 | 3830 | |
---|
3387 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3831 | + if (//marked || // does not make sense |
---|
| 3832 | + (bRep != null || material != null)) // borderline... |
---|
3388 | 3833 | hide = h; |
---|
3389 | 3834 | |
---|
3390 | 3835 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3404 | 3849 | if (blockloop) |
---|
3405 | 3850 | return; |
---|
3406 | 3851 | |
---|
3407 | | - if (bRep != null && material != null) // borderline... |
---|
| 3852 | + if (bRep != null || material != null) // borderline... |
---|
3408 | 3853 | marked = h; |
---|
3409 | 3854 | |
---|
3410 | 3855 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3414 | 3859 | continue; |
---|
3415 | 3860 | blockloop = true; |
---|
3416 | 3861 | child.MarkLeaves(h); |
---|
| 3862 | + blockloop = false; |
---|
| 3863 | + // release(i); |
---|
| 3864 | + } |
---|
| 3865 | + } |
---|
| 3866 | + |
---|
| 3867 | + void RewindLeaves(boolean h) |
---|
| 3868 | + { |
---|
| 3869 | + if (blockloop) |
---|
| 3870 | + return; |
---|
| 3871 | + |
---|
| 3872 | + if (bRep != null || material != null) // borderline... |
---|
| 3873 | + rewind = h; |
---|
| 3874 | + |
---|
| 3875 | + for (int i = 0; i < Size(); i++) |
---|
| 3876 | + { |
---|
| 3877 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3878 | + if (child == null) |
---|
| 3879 | + continue; |
---|
| 3880 | + blockloop = true; |
---|
| 3881 | + child.RewindLeaves(h); |
---|
| 3882 | + blockloop = false; |
---|
| 3883 | + // release(i); |
---|
| 3884 | + } |
---|
| 3885 | + } |
---|
| 3886 | + |
---|
| 3887 | + void RandomLeaves(boolean h) |
---|
| 3888 | + { |
---|
| 3889 | + if (blockloop) |
---|
| 3890 | + return; |
---|
| 3891 | + |
---|
| 3892 | + if (bRep != null || material != null) // borderline... |
---|
| 3893 | + random = h; |
---|
| 3894 | + |
---|
| 3895 | + for (int i = 0; i < Size(); i++) |
---|
| 3896 | + { |
---|
| 3897 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3898 | + if (child == null) |
---|
| 3899 | + continue; |
---|
| 3900 | + blockloop = true; |
---|
| 3901 | + child.RandomLeaves(h); |
---|
3417 | 3902 | blockloop = false; |
---|
3418 | 3903 | // release(i); |
---|
3419 | 3904 | } |
---|
.. | .. |
---|
3728 | 4213 | if (child == null) |
---|
3729 | 4214 | continue; |
---|
3730 | 4215 | |
---|
3731 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4216 | + if (Grafreed.RENDERME > 0) |
---|
3732 | 4217 | { |
---|
3733 | 4218 | if (child instanceof Merge) |
---|
3734 | 4219 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
3879 | 4364 | if (child == null) |
---|
3880 | 4365 | continue; |
---|
3881 | 4366 | |
---|
3882 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4367 | + if (Grafreed.RENDERME > 0) |
---|
3883 | 4368 | { |
---|
3884 | 4369 | if (child instanceof Merge) |
---|
3885 | 4370 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4074 | 4559 | if (child == null) |
---|
4075 | 4560 | continue; |
---|
4076 | 4561 | |
---|
4077 | | - if (GrafreeD.RENDERME > 0) |
---|
| 4562 | + if (Grafreed.RENDERME > 0) |
---|
4078 | 4563 | { |
---|
4079 | 4564 | if (child instanceof Merge) |
---|
4080 | 4565 | ((Merge)child).renderme(); |
---|
.. | .. |
---|
4187 | 4672 | { |
---|
4188 | 4673 | blockloop = true; |
---|
4189 | 4674 | get(i).RepairShadow(); |
---|
| 4675 | + blockloop = false; |
---|
| 4676 | + } |
---|
| 4677 | + } |
---|
| 4678 | + |
---|
| 4679 | + void RepairSOV() |
---|
| 4680 | + { |
---|
| 4681 | + if (blockloop) |
---|
| 4682 | + return; |
---|
| 4683 | + |
---|
| 4684 | + String texname = this.GetPigmentTexture(); |
---|
| 4685 | + |
---|
| 4686 | + if (texname.startsWith("sov")) |
---|
| 4687 | + { |
---|
| 4688 | + String[] s = texname.split("/"); |
---|
| 4689 | + |
---|
| 4690 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4691 | + |
---|
| 4692 | + texname = sname[0]; |
---|
| 4693 | + |
---|
| 4694 | + if (sname.length > 1) |
---|
| 4695 | + { |
---|
| 4696 | + texname += "Color.jpg"; |
---|
| 4697 | + } |
---|
| 4698 | + |
---|
| 4699 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4700 | + } |
---|
| 4701 | + |
---|
| 4702 | + texname = this.GetBumpTexture(); |
---|
| 4703 | + |
---|
| 4704 | + if (texname.startsWith("sov")) |
---|
| 4705 | + { |
---|
| 4706 | + String[] s = texname.split("/"); |
---|
| 4707 | + |
---|
| 4708 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4709 | + |
---|
| 4710 | + texname = sname[0]; |
---|
| 4711 | + |
---|
| 4712 | + if (sname.length > 1) |
---|
| 4713 | + { |
---|
| 4714 | + texname += "Bump.jpg"; |
---|
| 4715 | + } |
---|
| 4716 | + |
---|
| 4717 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4718 | + } |
---|
| 4719 | + |
---|
| 4720 | + for (int i=0; i<Size(); i++) |
---|
| 4721 | + { |
---|
| 4722 | + blockloop = true; |
---|
| 4723 | + get(i).RepairSOV(); |
---|
4190 | 4724 | blockloop = false; |
---|
4191 | 4725 | } |
---|
4192 | 4726 | } |
---|
.. | .. |
---|
4681 | 5215 | |
---|
4682 | 5216 | cTreePath SelectLeaf(int indexcount, boolean deselect) |
---|
4683 | 5217 | { |
---|
4684 | | - if (hide) |
---|
| 5218 | + if (hide || dontselect) |
---|
4685 | 5219 | return null; |
---|
4686 | 5220 | |
---|
4687 | 5221 | if (count <= 0) |
---|
.. | .. |
---|
4705 | 5239 | } |
---|
4706 | 5240 | } |
---|
4707 | 5241 | |
---|
| 5242 | + ObjEditor GetWindow() |
---|
| 5243 | + { |
---|
| 5244 | + if (editWindow != null) |
---|
| 5245 | + return editWindow; |
---|
| 5246 | + |
---|
| 5247 | + return manipWindow; |
---|
| 5248 | + } |
---|
| 5249 | + |
---|
4708 | 5250 | cTreePath Select(int indexcount, boolean deselect) |
---|
4709 | 5251 | { |
---|
4710 | | - if (hide) |
---|
| 5252 | + if (hide || dontselect) |
---|
4711 | 5253 | return null; |
---|
4712 | 5254 | |
---|
4713 | 5255 | if (count <= 0) |
---|
.. | .. |
---|
4741 | 5283 | if (leaf != null) |
---|
4742 | 5284 | { |
---|
4743 | 5285 | cTreePath tp = new cTreePath(this, leaf); |
---|
4744 | | - if (editWindow != null) |
---|
| 5286 | + ObjEditor window = GetWindow(); |
---|
| 5287 | + if (window != null) |
---|
4745 | 5288 | { |
---|
4746 | 5289 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4747 | | - editWindow.Select(tp, deselect, true); |
---|
| 5290 | + window.Select(tp, deselect, true); |
---|
4748 | 5291 | } |
---|
4749 | 5292 | |
---|
4750 | 5293 | return tp; |
---|
.. | .. |
---|
4761 | 5304 | |
---|
4762 | 5305 | if (child == null) |
---|
4763 | 5306 | continue; |
---|
| 5307 | + |
---|
4764 | 5308 | if (child.HasTransparency() && child.size() != 0) |
---|
4765 | 5309 | { |
---|
4766 | 5310 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4770 | 5314 | if (leaf != null) |
---|
4771 | 5315 | { |
---|
4772 | 5316 | cTreePath tp = new cTreePath(this, leaf); |
---|
4773 | | - if (editWindow != null) |
---|
| 5317 | + ObjEditor window = GetWindow(); |
---|
| 5318 | + if (window != null) |
---|
4774 | 5319 | { |
---|
4775 | | - editWindow.Select(tp, deselect, true); |
---|
| 5320 | + window.Select(tp, deselect, true); |
---|
4776 | 5321 | } |
---|
4777 | 5322 | |
---|
4778 | 5323 | return tp; |
---|
.. | .. |
---|
5097 | 5642 | blockloop = false; |
---|
5098 | 5643 | } |
---|
5099 | 5644 | |
---|
| 5645 | + void ResetSelectable() |
---|
| 5646 | + { |
---|
| 5647 | + if (blockloop) |
---|
| 5648 | + return; |
---|
| 5649 | + |
---|
| 5650 | + blockloop = true; |
---|
| 5651 | + |
---|
| 5652 | + keepdontselect = dontselect; |
---|
| 5653 | + dontselect = true; |
---|
| 5654 | + |
---|
| 5655 | + Object3D child; |
---|
| 5656 | + int nb = Size(); |
---|
| 5657 | + for (int i = 0; i < nb; i++) |
---|
| 5658 | + { |
---|
| 5659 | + child = (Object3D) get(i); |
---|
| 5660 | + if (child == null) |
---|
| 5661 | + continue; |
---|
| 5662 | + child.ResetSelectable(); |
---|
| 5663 | + } |
---|
| 5664 | + |
---|
| 5665 | + blockloop = false; |
---|
| 5666 | + } |
---|
| 5667 | + |
---|
| 5668 | + void RestoreSelectable() |
---|
| 5669 | + { |
---|
| 5670 | + if (blockloop) |
---|
| 5671 | + return; |
---|
| 5672 | + |
---|
| 5673 | + blockloop = true; |
---|
| 5674 | + |
---|
| 5675 | + dontselect = keepdontselect; |
---|
| 5676 | + |
---|
| 5677 | + Object3D child; |
---|
| 5678 | + int nb = Size(); |
---|
| 5679 | + for (int i = 0; i < nb; i++) |
---|
| 5680 | + { |
---|
| 5681 | + child = (Object3D) get(i); |
---|
| 5682 | + if (child == null) |
---|
| 5683 | + continue; |
---|
| 5684 | + child.RestoreSelectable(); |
---|
| 5685 | + } |
---|
| 5686 | + |
---|
| 5687 | + blockloop = false; |
---|
| 5688 | + } |
---|
| 5689 | + |
---|
5100 | 5690 | boolean IsSelected() |
---|
5101 | 5691 | { |
---|
5102 | 5692 | if (parent == null) |
---|
.. | .. |
---|
5157 | 5747 | if (fullname == null) |
---|
5158 | 5748 | return ""; |
---|
5159 | 5749 | |
---|
| 5750 | + if (fullname.pigment != null) |
---|
| 5751 | + { |
---|
| 5752 | + return fullname.pigment; |
---|
| 5753 | + } |
---|
| 5754 | + |
---|
5160 | 5755 | // System.out.println("Fullname = " + fullname); |
---|
5161 | 5756 | |
---|
5162 | | - if (fullname.name.indexOf(":") == -1) |
---|
5163 | | - return fullname.name; |
---|
| 5757 | + // Does not work on Windows due to C: |
---|
| 5758 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5759 | +// return fullname.name; |
---|
| 5760 | +// |
---|
| 5761 | +// return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
5164 | 5762 | |
---|
5165 | | - return fullname.name.substring(0,fullname.name.indexOf(":")); |
---|
| 5763 | + String[] split = fullname.name.split(":"); |
---|
| 5764 | + |
---|
| 5765 | + if (split.length == 0) |
---|
| 5766 | + { |
---|
| 5767 | + return fullname.pigment = ""; |
---|
| 5768 | + } |
---|
| 5769 | + |
---|
| 5770 | + if (split.length <= 2) |
---|
| 5771 | + { |
---|
| 5772 | + if (fullname.name.endsWith(":")) |
---|
| 5773 | + { |
---|
| 5774 | + // Windows |
---|
| 5775 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5776 | + } |
---|
| 5777 | + |
---|
| 5778 | + return fullname.pigment = split[0]; |
---|
| 5779 | + } |
---|
| 5780 | + |
---|
| 5781 | + // Windows |
---|
| 5782 | + assert(split.length == 4); |
---|
| 5783 | + |
---|
| 5784 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5166 | 5785 | } |
---|
5167 | 5786 | |
---|
5168 | 5787 | static String GetBump(cTexture fullname) |
---|
.. | .. |
---|
5170 | 5789 | if (fullname == null) |
---|
5171 | 5790 | return ""; |
---|
5172 | 5791 | |
---|
| 5792 | + if (fullname.bump != null) |
---|
| 5793 | + { |
---|
| 5794 | + return fullname.bump; |
---|
| 5795 | + } |
---|
| 5796 | + |
---|
5173 | 5797 | // 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()); |
---|
| 5798 | + // Does not work on Windows due to C: |
---|
| 5799 | +// if (fullname.name.indexOf(":") == -1) |
---|
| 5800 | +// return ""; |
---|
| 5801 | +// |
---|
| 5802 | +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); |
---|
| 5803 | + String[] split = fullname.name.split(":"); |
---|
| 5804 | + |
---|
| 5805 | + if (split.length == 0) |
---|
| 5806 | + { |
---|
| 5807 | + return fullname.bump = ""; |
---|
| 5808 | + } |
---|
| 5809 | + |
---|
| 5810 | + if (split.length == 1) |
---|
| 5811 | + { |
---|
| 5812 | + return fullname.bump = ""; |
---|
| 5813 | + } |
---|
| 5814 | + |
---|
| 5815 | + if (split.length == 2) |
---|
| 5816 | + { |
---|
| 5817 | + if (fullname.name.endsWith(":")) |
---|
| 5818 | + { |
---|
| 5819 | + // Windows |
---|
| 5820 | + return fullname.bump = ""; |
---|
| 5821 | + } |
---|
| 5822 | + |
---|
| 5823 | + return fullname.bump = split[1]; |
---|
| 5824 | + } |
---|
| 5825 | + |
---|
| 5826 | + // Windows |
---|
| 5827 | + assert(split.length == 4); |
---|
| 5828 | + |
---|
| 5829 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5178 | 5830 | } |
---|
5179 | 5831 | |
---|
5180 | 5832 | String GetPigmentTexture() |
---|
.. | .. |
---|
5248 | 5900 | System.out.print("; textures = " + textures); |
---|
5249 | 5901 | System.out.println("; usedtextures = " + usedtextures); |
---|
5250 | 5902 | |
---|
5251 | | - if (GetTextures() == null) |
---|
| 5903 | + if (GetTextures() == null) // What is that?? |
---|
5252 | 5904 | GetTextures().name = ":"; |
---|
5253 | 5905 | |
---|
5254 | 5906 | String texname = tex; |
---|
.. | .. |
---|
5257 | 5909 | texname = ""; |
---|
5258 | 5910 | |
---|
5259 | 5911 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5912 | + |
---|
| 5913 | + GetTextures().pigment = null; |
---|
| 5914 | + |
---|
5260 | 5915 | Touch(); |
---|
5261 | 5916 | } |
---|
5262 | 5917 | |
---|
.. | .. |
---|
5281 | 5936 | } |
---|
5282 | 5937 | } |
---|
5283 | 5938 | |
---|
| 5939 | + UUID GetUUID() |
---|
| 5940 | + { |
---|
| 5941 | + if (uuid == null) |
---|
| 5942 | + { |
---|
| 5943 | + // Serial |
---|
| 5944 | + uuid = UUID.randomUUID(); |
---|
| 5945 | + } |
---|
| 5946 | + |
---|
| 5947 | + return uuid; |
---|
| 5948 | + } |
---|
| 5949 | + |
---|
| 5950 | + Object3D GetObject(UUID uid) |
---|
| 5951 | + { |
---|
| 5952 | + if (blockloop) |
---|
| 5953 | + return null; |
---|
| 5954 | + |
---|
| 5955 | + if (GetUUID().equals(uid)) |
---|
| 5956 | + return this; |
---|
| 5957 | + |
---|
| 5958 | + int nb = Size(); |
---|
| 5959 | + for (int i = 0; i < nb; i++) |
---|
| 5960 | + { |
---|
| 5961 | + Object3D child = (Object3D) get(i); |
---|
| 5962 | + |
---|
| 5963 | + if (child == null) |
---|
| 5964 | + continue; |
---|
| 5965 | + |
---|
| 5966 | + blockloop = true; |
---|
| 5967 | + Object3D obj = child.GetObject(uid); |
---|
| 5968 | + blockloop = false; |
---|
| 5969 | + if (obj != null) |
---|
| 5970 | + return obj; |
---|
| 5971 | + } |
---|
| 5972 | + |
---|
| 5973 | + return null; |
---|
| 5974 | + } |
---|
| 5975 | + |
---|
5284 | 5976 | void SetBumpTexture(String tex) |
---|
5285 | 5977 | { |
---|
5286 | 5978 | if (GetTextures() == null) |
---|
.. | .. |
---|
5292 | 5984 | texname = ""; |
---|
5293 | 5985 | |
---|
5294 | 5986 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5987 | + |
---|
| 5988 | + GetTextures().bump = null; |
---|
5295 | 5989 | |
---|
5296 | 5990 | Touch(); |
---|
5297 | 5991 | } |
---|
.. | .. |
---|
5317 | 6011 | } |
---|
5318 | 6012 | } |
---|
5319 | 6013 | |
---|
| 6014 | + void EmbedTextures(boolean embed) |
---|
| 6015 | + { |
---|
| 6016 | + if (blockloop) |
---|
| 6017 | + return; |
---|
| 6018 | + |
---|
| 6019 | + //if (GetTextures() != null) |
---|
| 6020 | + if (embed) |
---|
| 6021 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 6022 | + else |
---|
| 6023 | + { |
---|
| 6024 | + GetTextures().pigmentdata = null; |
---|
| 6025 | + GetTextures().bumpdata = null; |
---|
| 6026 | + GetTextures().pw = 0; |
---|
| 6027 | + GetTextures().ph = 0; |
---|
| 6028 | + GetTextures().bw = 0; |
---|
| 6029 | + GetTextures().bh = 0; |
---|
| 6030 | + } |
---|
| 6031 | + |
---|
| 6032 | + int nb = Size(); |
---|
| 6033 | + for (int i = 0; i < nb; i++) |
---|
| 6034 | + { |
---|
| 6035 | + Object3D child = (Object3D) get(i); |
---|
| 6036 | + |
---|
| 6037 | + if (child == null) |
---|
| 6038 | + continue; |
---|
| 6039 | + |
---|
| 6040 | + blockloop = true; |
---|
| 6041 | + child.EmbedTextures(embed); |
---|
| 6042 | + blockloop = false; |
---|
| 6043 | + } |
---|
| 6044 | + } |
---|
| 6045 | + |
---|
5320 | 6046 | void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5321 | 6047 | { |
---|
5322 | 6048 | Draw(display, root, selected, blocked); |
---|
.. | .. |
---|
5325 | 6051 | boolean NeedSupport() |
---|
5326 | 6052 | { |
---|
5327 | 6053 | return |
---|
5328 | | - CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null |
---|
| 6054 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5329 | 6055 | // PROBLEM with CROWD!! |
---|
5330 | | - && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD); |
---|
| 6056 | + && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5331 | 6057 | } |
---|
5332 | 6058 | |
---|
5333 | 6059 | static boolean DEBUG_SELECTION = false; |
---|
| 6060 | + |
---|
| 6061 | + boolean IsLive() |
---|
| 6062 | + { |
---|
| 6063 | + if (live) |
---|
| 6064 | + return true; |
---|
| 6065 | + |
---|
| 6066 | + if (parent == null) |
---|
| 6067 | + return false; |
---|
| 6068 | + |
---|
| 6069 | + return parent.IsLive(); |
---|
| 6070 | + } |
---|
| 6071 | + |
---|
| 6072 | + boolean IsDynamic() |
---|
| 6073 | + { |
---|
| 6074 | + return live && bRep != null; |
---|
| 6075 | + } |
---|
5334 | 6076 | |
---|
5335 | 6077 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5336 | 6078 | { |
---|
.. | .. |
---|
5342 | 6084 | } |
---|
5343 | 6085 | |
---|
5344 | 6086 | if (display.DrawMode() == iCameraPane.SELECTION && |
---|
5345 | | - hide) |
---|
| 6087 | + (hide || dontselect)) |
---|
5346 | 6088 | return; |
---|
5347 | 6089 | |
---|
5348 | 6090 | if (name != null && name.contains("sclera")) |
---|
.. | .. |
---|
5392 | 6134 | if (support != null) |
---|
5393 | 6135 | support = support; |
---|
5394 | 6136 | |
---|
5395 | | - //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); |
---|
| 6137 | + boolean usecalllists = !IsDynamic() && |
---|
| 6138 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6139 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6140 | + |
---|
| 6141 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5397 | 6142 | |
---|
5398 | 6143 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5399 | 6144 | { |
---|
.. | .. |
---|
5403 | 6148 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5404 | 6149 | // usecalllists = false; |
---|
5405 | 6150 | |
---|
5406 | | - if (GetBRep() != null) |
---|
5407 | | - usecalllists = usecalllists; |
---|
| 6151 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6152 | + //GetBRep() != null) |
---|
| 6153 | + usecalllists = !!usecalllists; |
---|
5408 | 6154 | //System.out.println("draw " + this); |
---|
5409 | 6155 | //new Exception().printStackTrace(); |
---|
5410 | 6156 | |
---|
.. | .. |
---|
5413 | 6159 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5414 | 6160 | |
---|
5415 | 6161 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5416 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 6162 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 6163 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5417 | 6164 | { |
---|
5418 | 6165 | Globals.lighttouched = true; |
---|
5419 | 6166 | } // all panes... |
---|
| 6167 | + |
---|
5420 | 6168 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5421 | 6169 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5422 | 6170 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5424 | 6172 | if (!(this instanceof Composite)) |
---|
5425 | 6173 | touched = false; |
---|
5426 | 6174 | //if (displaylist == -1 && usecalllists) |
---|
5427 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6175 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5428 | 6176 | { |
---|
5429 | 6177 | bRep.displaylist = display.GenList(); |
---|
5430 | 6178 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5435 | 6183 | |
---|
5436 | 6184 | //System.out.println("\tnew list " + list); |
---|
5437 | 6185 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5438 | | - if (usecalllists) |
---|
| 6186 | + if (usecalllists && bRep.displaylist > 0) |
---|
5439 | 6187 | { |
---|
5440 | 6188 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5441 | 6189 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5444 | 6192 | CallList(display, root, selected, blocked); |
---|
5445 | 6193 | |
---|
5446 | 6194 | // compiled = true; |
---|
5447 | | - if (usecalllists) |
---|
| 6195 | + if (usecalllists && bRep.displaylist > 0) |
---|
5448 | 6196 | { |
---|
5449 | 6197 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5450 | 6198 | display.EndList(); |
---|
.. | .. |
---|
5544 | 6292 | if (GetBRep() != null) |
---|
5545 | 6293 | { |
---|
5546 | 6294 | display.NextIndex(); |
---|
| 6295 | + |
---|
5547 | 6296 | // vertex color conflict : gl.glCallList(list); |
---|
5548 | 6297 | DrawNode(display, root, selected); |
---|
5549 | 6298 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5584 | 6333 | tex = GetTextures(); |
---|
5585 | 6334 | } |
---|
5586 | 6335 | |
---|
5587 | | - display.BindTextures(tex, texres); |
---|
| 6336 | + boolean failedPigment = false; |
---|
| 6337 | + boolean failedBump = false; |
---|
| 6338 | + |
---|
| 6339 | + try |
---|
| 6340 | + { |
---|
| 6341 | + display.BindPigmentTexture(tex, texres); |
---|
| 6342 | + } |
---|
| 6343 | + catch (Exception e) |
---|
| 6344 | + { |
---|
| 6345 | + System.err.println("FAILED: " + this); |
---|
| 6346 | + failedPigment = true; |
---|
| 6347 | + } |
---|
| 6348 | + |
---|
| 6349 | + try |
---|
| 6350 | + { |
---|
| 6351 | + display.BindBumpTexture(tex, texres); |
---|
| 6352 | + } |
---|
| 6353 | + catch (Exception e) |
---|
| 6354 | + { |
---|
| 6355 | + //System.err.println("FAILED: " + this); |
---|
| 6356 | + failedBump = true; |
---|
| 6357 | + } |
---|
5588 | 6358 | |
---|
5589 | 6359 | if (!compiled) |
---|
5590 | 6360 | { |
---|
.. | .. |
---|
5606 | 6376 | } |
---|
5607 | 6377 | } |
---|
5608 | 6378 | |
---|
5609 | | - display.ReleaseTextures(tex); |
---|
| 6379 | + if (!failedBump) |
---|
| 6380 | + display.ReleaseBumpTexture(tex); |
---|
| 6381 | + |
---|
| 6382 | + if (!failedPigment) |
---|
| 6383 | + display.ReleasePigmentTexture(tex); |
---|
5610 | 6384 | |
---|
5611 | 6385 | display.PopMaterial(this, selected); |
---|
5612 | 6386 | } |
---|
.. | .. |
---|
5735 | 6509 | |
---|
5736 | 6510 | void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5737 | 6511 | { |
---|
| 6512 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6513 | + return; |
---|
| 6514 | + |
---|
5738 | 6515 | if (hide) |
---|
5739 | 6516 | return; |
---|
5740 | 6517 | // shadow optimisation |
---|
.. | .. |
---|
5860 | 6637 | if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
5861 | 6638 | return; // no shadow for transparent objects |
---|
5862 | 6639 | |
---|
| 6640 | + if (display.DrawMode() == iCameraPane.SELECTION && dontselect) |
---|
| 6641 | + return; |
---|
| 6642 | + |
---|
5863 | 6643 | if (hide) |
---|
5864 | 6644 | return; |
---|
5865 | 6645 | |
---|
.. | .. |
---|
5973 | 6753 | // dec 2012 |
---|
5974 | 6754 | new Exception().printStackTrace(); |
---|
5975 | 6755 | return; |
---|
| 6756 | + } |
---|
| 6757 | + |
---|
| 6758 | + if (dontselect) |
---|
| 6759 | + { |
---|
| 6760 | + //bRep.GenerateNormalsMINE(); |
---|
5976 | 6761 | } |
---|
5977 | 6762 | |
---|
5978 | 6763 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6758 | 7543 | } |
---|
6759 | 7544 | } |
---|
6760 | 7545 | |
---|
6761 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7546 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7547 | + |
---|
| 7548 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7549 | + Point outPt, Rectangle outRec) |
---|
6762 | 7550 | { |
---|
6763 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
6764 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
6765 | | - double[][] toscreen = info.toScreen; |
---|
| 7551 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7552 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7553 | + double[][] toscreen = clickInfo.toScreen; |
---|
6766 | 7554 | if (toscreen == null) |
---|
6767 | 7555 | { |
---|
6768 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7556 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
6769 | 7557 | } |
---|
6770 | 7558 | cVector vec = in; |
---|
6771 | 7559 | LA.xformPos(in, toscreen, in); |
---|
6772 | 7560 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
6773 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
6774 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7561 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7562 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
6775 | 7563 | outPt.x = hc + (int) vec.x; |
---|
6776 | 7564 | outPt.y = vc - (int) vec.y; |
---|
6777 | 7565 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
6779 | 7567 | outRec.width = outRec.height = 6; |
---|
6780 | 7568 | } |
---|
6781 | 7569 | |
---|
6782 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7570 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7571 | + ) |
---|
6783 | 7572 | { |
---|
6784 | 7573 | Point pt = new Point(0, 0); |
---|
6785 | 7574 | Rectangle rec = new Rectangle(); |
---|
6786 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7575 | + calcHotSpot(in, //clickInfo, |
---|
| 7576 | + pt, rec); |
---|
6787 | 7577 | return rec; |
---|
6788 | 7578 | } |
---|
6789 | 7579 | |
---|
6790 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7580 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7581 | + int level) |
---|
6791 | 7582 | { |
---|
6792 | 7583 | if (level == 0) |
---|
6793 | 7584 | { |
---|
.. | .. |
---|
6796 | 7587 | { |
---|
6797 | 7588 | cVector origin = new cVector(); |
---|
6798 | 7589 | //LA.xformPos(origin, toParent, origin); |
---|
6799 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7590 | + if (this.clickInfo == null) |
---|
| 7591 | + this.clickInfo = new ClickInfo(); |
---|
| 7592 | + |
---|
| 7593 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
6800 | 7594 | Rectangle boundary = new Rectangle(); |
---|
6801 | 7595 | boundary.x = spot.x - 30; |
---|
6802 | 7596 | boundary.y = spot.y - 30; |
---|
6803 | 7597 | boundary.width = spot.width + 60; |
---|
6804 | 7598 | boundary.height = spot.height + 60; |
---|
6805 | | - info.g.setColor(Color.red); |
---|
| 7599 | + clickInfo.g.setColor(Color.white); |
---|
6806 | 7600 | int spotw = spot.x + spot.width; |
---|
6807 | 7601 | int spoth = spot.y + spot.height; |
---|
6808 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7602 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6809 | 7603 | // if (CameraPane.Xmin > spot.x) |
---|
6810 | 7604 | // { |
---|
6811 | 7605 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6822 | 7616 | // { |
---|
6823 | 7617 | // CameraPane.Ymax = spoth; |
---|
6824 | 7618 | // } |
---|
6825 | | - spot.translate(32, 32); |
---|
| 7619 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7620 | +// { |
---|
| 7621 | +// CameraPane.Xmin = spot.x; |
---|
| 7622 | +// } |
---|
| 7623 | +// if (CameraPane.Xmax < spotw) |
---|
| 7624 | +// { |
---|
| 7625 | +// CameraPane.Xmax = spotw; |
---|
| 7626 | +// } |
---|
| 7627 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7628 | +// { |
---|
| 7629 | +// CameraPane.Ymin = spot.y; |
---|
| 7630 | +// } |
---|
| 7631 | +// if (CameraPane.Ymax < spoth) |
---|
| 7632 | +// { |
---|
| 7633 | +// CameraPane.Ymax = spoth; |
---|
| 7634 | +// } |
---|
| 7635 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7636 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7637 | + spot.translate(32, 0); |
---|
| 7638 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7639 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7640 | + |
---|
| 7641 | + spot.translate(32, 64); |
---|
6826 | 7642 | spotw = spot.x + spot.width; |
---|
6827 | 7643 | spoth = spot.y + spot.height; |
---|
6828 | | - info.g.setColor(Color.blue); |
---|
6829 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7644 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7645 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6830 | 7646 | // if (CameraPane.Xmin > spot.x) |
---|
6831 | 7647 | // { |
---|
6832 | 7648 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
6843 | 7659 | // { |
---|
6844 | 7660 | // CameraPane.Ymax = spoth; |
---|
6845 | 7661 | // } |
---|
6846 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6847 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
6848 | | - spot.translate(0, -32); |
---|
6849 | | - info.g.setColor(Color.green); |
---|
6850 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6851 | | -// if (CameraPane.Xmin > spot.x) |
---|
6852 | | -// { |
---|
6853 | | -// CameraPane.Xmin = spot.x; |
---|
6854 | | -// } |
---|
6855 | | -// if (CameraPane.Xmax < spotw) |
---|
6856 | | -// { |
---|
6857 | | -// CameraPane.Xmax = spotw; |
---|
6858 | | -// } |
---|
6859 | | -// if (CameraPane.Ymin > spot.y) |
---|
6860 | | -// { |
---|
6861 | | -// CameraPane.Ymin = spot.y; |
---|
6862 | | -// } |
---|
6863 | | -// if (CameraPane.Ymax < spoth) |
---|
6864 | | -// { |
---|
6865 | | -// CameraPane.Ymax = spoth; |
---|
6866 | | -// } |
---|
6867 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
6868 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7662 | + clickInfo.g.setColor(Color.green); |
---|
| 7663 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7664 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
6869 | 7665 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
6870 | 7666 | // if (CameraPane.Xmin > boundary.x) |
---|
6871 | 7667 | // { |
---|
.. | .. |
---|
6887 | 7683 | } |
---|
6888 | 7684 | } |
---|
6889 | 7685 | |
---|
6890 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7686 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7687 | + int level) |
---|
6891 | 7688 | { |
---|
6892 | 7689 | if (level == 0) |
---|
6893 | 7690 | { |
---|
.. | .. |
---|
6896 | 7693 | |
---|
6897 | 7694 | boolean retval = false; |
---|
6898 | 7695 | |
---|
6899 | | - startX = info.x; |
---|
6900 | | - startY = info.y; |
---|
| 7696 | + startX = clickInfo.x; |
---|
| 7697 | + startY = clickInfo.y; |
---|
6901 | 7698 | |
---|
6902 | | - hitSomething = 0; |
---|
| 7699 | + hitSomething = -1; |
---|
6903 | 7700 | cVector origin = new cVector(); |
---|
6904 | 7701 | //LA.xformPos(origin, toParent, origin); |
---|
6905 | 7702 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
6907 | 7704 | { |
---|
6908 | 7705 | centerPt = new Point(0, 0); |
---|
6909 | 7706 | } |
---|
6910 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
6911 | | - if (spot.contains(info.x, info.y)) |
---|
| 7707 | + calcHotSpot(origin, //info, |
---|
| 7708 | + centerPt, spot); |
---|
| 7709 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
6912 | 7710 | { |
---|
6913 | 7711 | hitSomething = hitCenter; |
---|
6914 | 7712 | retval = true; |
---|
6915 | 7713 | } |
---|
6916 | 7714 | spot.translate(32, 0); |
---|
6917 | | - if (spot.contains(info.x, info.y)) |
---|
| 7715 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
6918 | 7716 | { |
---|
6919 | 7717 | hitSomething = hitRotate; |
---|
6920 | 7718 | retval = true; |
---|
6921 | 7719 | } |
---|
6922 | 7720 | spot.translate(0, 32); |
---|
6923 | | - if (spot.contains(info.x, info.y)) |
---|
| 7721 | + spot.translate(32, 0); |
---|
| 7722 | + spot.translate(0, 32); |
---|
| 7723 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
6924 | 7724 | { |
---|
6925 | 7725 | hitSomething = hitScale; |
---|
| 7726 | + |
---|
| 7727 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7728 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7729 | + double sign = 1; |
---|
| 7730 | + if (hScale < 0) |
---|
| 7731 | + { |
---|
| 7732 | + sign = -1; |
---|
| 7733 | + } |
---|
| 7734 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7735 | + if (hScale < 0.01) |
---|
| 7736 | + { |
---|
| 7737 | + //hScale = 0.01; |
---|
| 7738 | + } |
---|
| 7739 | + |
---|
| 7740 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7741 | + sign = 1; |
---|
| 7742 | + if (vScale < 0) |
---|
| 7743 | + { |
---|
| 7744 | + sign = -1; |
---|
| 7745 | + } |
---|
| 7746 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7747 | + if (vScale < 0.01) |
---|
| 7748 | + { |
---|
| 7749 | + //vScale = 0.01; |
---|
| 7750 | + } |
---|
| 7751 | + |
---|
| 7752 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7753 | + |
---|
6926 | 7754 | retval = true; |
---|
6927 | 7755 | } |
---|
6928 | 7756 | |
---|
.. | .. |
---|
6932 | 7760 | } |
---|
6933 | 7761 | |
---|
6934 | 7762 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
6935 | | - modified = (info.modifiers & CameraPane.META) != 0; |
---|
| 7763 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
6936 | 7764 | //System.out.println("modified = " + modified); |
---|
6937 | 7765 | //new Exception().printStackTrace(); |
---|
6938 | 7766 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
6960 | 7788 | return true; |
---|
6961 | 7789 | } |
---|
6962 | 7790 | |
---|
6963 | | - void doEditDrag0(ClickInfo info) |
---|
| 7791 | + void doEditDrag0(//ClickInfo info, |
---|
| 7792 | + boolean opposite) |
---|
6964 | 7793 | { |
---|
6965 | 7794 | if (hitSomething == 0) |
---|
6966 | 7795 | { |
---|
.. | .. |
---|
6974 | 7803 | |
---|
6975 | 7804 | //System.out.println("hitSomething = " + hitSomething); |
---|
6976 | 7805 | |
---|
6977 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7806 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7807 | + |
---|
6978 | 7808 | cVector xlate = new cVector(); |
---|
6979 | 7809 | //cVector xlate2 = new cVector(); |
---|
6980 | 7810 | switch (hitSomething) |
---|
.. | .. |
---|
6987 | 7817 | |
---|
6988 | 7818 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
6989 | 7819 | |
---|
6990 | | - if (modified) |
---|
| 7820 | + // Modified could snap |
---|
| 7821 | + if (//modified || |
---|
| 7822 | + opposite) |
---|
6991 | 7823 | { |
---|
6992 | 7824 | //assert(false); |
---|
6993 | 7825 | /* |
---|
.. | .. |
---|
7007 | 7839 | toParent[3][i] = xlate.get(i); |
---|
7008 | 7840 | LA.matInvert(toParent, fromParent); |
---|
7009 | 7841 | */ |
---|
7010 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7011 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7842 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7843 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7012 | 7844 | |
---|
7013 | 7845 | LA.matCopy(startMat, toParent); |
---|
7014 | 7846 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7017 | 7849 | } else |
---|
7018 | 7850 | { |
---|
7019 | 7851 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7020 | | - cVector up = new cVector(info.camera.up); |
---|
| 7852 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7021 | 7853 | cVector away = new cVector(); |
---|
7022 | 7854 | //cVector right2 = new cVector(); |
---|
7023 | 7855 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7034 | 7866 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7035 | 7867 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7036 | 7868 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7037 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7869 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7038 | 7870 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7039 | 7871 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7040 | 7872 | //LA.vecCross(up, cVector.Z, right2); |
---|
7041 | 7873 | |
---|
7042 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7874 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7043 | 7875 | |
---|
7044 | 7876 | //System.out.println("DELTA0 = " + delta); |
---|
7045 | 7877 | //System.out.println("AWAY = " + info.camera.away); |
---|
7046 | 7878 | //System.out.println("UP = " + info.camera.up); |
---|
7047 | 7879 | if (away.z > 0) |
---|
7048 | 7880 | { |
---|
7049 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7881 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7050 | 7882 | { |
---|
7051 | 7883 | delta.x = -delta.x; |
---|
7052 | 7884 | } else |
---|
.. | .. |
---|
7061 | 7893 | //System.out.println("DELTA1 = " + delta); |
---|
7062 | 7894 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7063 | 7895 | //System.out.println("DELTA2 = " + delta); |
---|
7064 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7896 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7065 | 7897 | LA.matCopy(startMat, toParent); |
---|
7066 | 7898 | //System.out.println("DELTA3 = " + delta); |
---|
7067 | 7899 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7071 | 7903 | break; |
---|
7072 | 7904 | |
---|
7073 | 7905 | case hitRotate: // rotate |
---|
7074 | | - int dx = info.x - centerPt.x; |
---|
7075 | | - int dy = -(info.y - centerPt.y); |
---|
| 7906 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7907 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7076 | 7908 | double angle = (double) Math.atan2(dx, dy); |
---|
7077 | 7909 | angle = -(1.570796 - angle); |
---|
7078 | 7910 | |
---|
.. | .. |
---|
7081 | 7913 | |
---|
7082 | 7914 | if (modified) |
---|
7083 | 7915 | { |
---|
| 7916 | + // Rotate 45 degrees |
---|
7084 | 7917 | angle /= (Math.PI / 4); |
---|
7085 | 7918 | angle = Math.floor(angle + 0.5); |
---|
7086 | 7919 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7094 | 7927 | } |
---|
7095 | 7928 | /**/ |
---|
7096 | 7929 | |
---|
7097 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7930 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7098 | 7931 | { |
---|
7099 | 7932 | case 1: // '\001' |
---|
7100 | 7933 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7121 | 7954 | break; |
---|
7122 | 7955 | |
---|
7123 | 7956 | case hitScale: // scale |
---|
7124 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7957 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7958 | + double sign = 1; |
---|
| 7959 | + if (hScale < 0) |
---|
| 7960 | + { |
---|
| 7961 | + sign = -1; |
---|
| 7962 | + } |
---|
| 7963 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7125 | 7964 | if (hScale < 0.01) |
---|
7126 | 7965 | { |
---|
7127 | | - hScale = 0.01; |
---|
| 7966 | + //hScale = 0.01; |
---|
7128 | 7967 | } |
---|
7129 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7130 | | - if (hScale < 0.01) |
---|
| 7968 | + |
---|
| 7969 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7970 | + sign = 1; |
---|
| 7971 | + if (vScale < 0) |
---|
7131 | 7972 | { |
---|
7132 | | - hScale = 0.01; |
---|
| 7973 | + sign = -1; |
---|
7133 | 7974 | } |
---|
7134 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7975 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7135 | 7976 | if (vScale < 0.01) |
---|
7136 | 7977 | { |
---|
7137 | | - vScale = 0.01; |
---|
| 7978 | + //vScale = 0.01; |
---|
7138 | 7979 | } |
---|
7139 | | - vScale = Math.pow(vScale, scale * 50); |
---|
7140 | | - if (vScale < 0.01) |
---|
7141 | | - { |
---|
7142 | | - vScale = 0.01; |
---|
7143 | | - } |
---|
| 7980 | + |
---|
7144 | 7981 | LA.matCopy(startMat, toParent); |
---|
7145 | 7982 | /**/ |
---|
7146 | 7983 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7150 | 7987 | } |
---|
7151 | 7988 | /**/ |
---|
7152 | 7989 | |
---|
7153 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7990 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
| 7991 | + |
---|
| 7992 | + if (totalScale < 0.01) |
---|
| 7993 | + { |
---|
| 7994 | + totalScale = 0.01; |
---|
| 7995 | + } |
---|
| 7996 | + |
---|
| 7997 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7154 | 7998 | { |
---|
7155 | 7999 | case 3: // '\001' |
---|
7156 | | - if (modified) |
---|
| 8000 | + if (modified || opposite) |
---|
7157 | 8001 | { |
---|
| 8002 | + if (modified) // && opposite) |
---|
| 8003 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8004 | + else |
---|
7158 | 8005 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7159 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 8006 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7160 | 8007 | } // vScale, 1); |
---|
7161 | 8008 | else |
---|
7162 | 8009 | { |
---|
7163 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 8010 | + // EXCEPTION! |
---|
| 8011 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7164 | 8012 | } // vScale, 1); |
---|
7165 | 8013 | break; |
---|
7166 | 8014 | |
---|
7167 | 8015 | case 2: // '\002' |
---|
7168 | | - if (modified) |
---|
| 8016 | + if (modified || opposite) |
---|
7169 | 8017 | { |
---|
7170 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7171 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 8018 | + if (modified) // && opposite) |
---|
| 8019 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8020 | + else |
---|
| 8021 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 8022 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7172 | 8023 | } else |
---|
7173 | 8024 | { |
---|
7174 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 8025 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7175 | 8026 | } |
---|
7176 | 8027 | break; |
---|
7177 | 8028 | |
---|
7178 | 8029 | case 1: // '\003' |
---|
7179 | | - if (modified) |
---|
| 8030 | + if (modified || opposite) |
---|
7180 | 8031 | { |
---|
7181 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7182 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 8032 | + if (modified) // && opposite) |
---|
| 8033 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8034 | + else |
---|
| 8035 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 8036 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7183 | 8037 | } else |
---|
7184 | 8038 | { |
---|
7185 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 8039 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7186 | 8040 | } |
---|
7187 | 8041 | break; |
---|
7188 | 8042 | } |
---|
.. | .. |
---|
7216 | 8070 | } // NEW ... |
---|
7217 | 8071 | |
---|
7218 | 8072 | |
---|
7219 | | - info.pane.repaint(); |
---|
| 8073 | + clickInfo.pane.repaint(); |
---|
7220 | 8074 | } |
---|
7221 | 8075 | |
---|
7222 | 8076 | boolean overflow = false; |
---|
.. | .. |
---|
7315 | 8169 | //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")"; |
---|
7316 | 8170 | //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString(); |
---|
7317 | 8171 | //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString(); |
---|
| 8172 | + |
---|
| 8173 | + String objname; |
---|
| 8174 | + |
---|
7318 | 8175 | if (false) //parent != null) |
---|
7319 | 8176 | { |
---|
7320 | | - return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
| 8177 | + objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7321 | 8178 | } else |
---|
7322 | 8179 | { |
---|
7323 | | - return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this); |
---|
| 8180 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7324 | 8181 | } // + super.toString(); |
---|
7325 | 8182 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
| 8183 | + |
---|
| 8184 | +// if (!Globals.ADVANCED) |
---|
| 8185 | +// return objname; |
---|
| 8186 | + |
---|
| 8187 | + return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
7326 | 8188 | } |
---|
7327 | 8189 | |
---|
7328 | 8190 | public int hashCode() |
---|
.. | .. |
---|
7388 | 8250 | editWindow = null; |
---|
7389 | 8251 | } // ? |
---|
7390 | 8252 | } |
---|
| 8253 | + else |
---|
| 8254 | + { |
---|
| 8255 | + //editWindow.closeUI(); |
---|
| 8256 | + } |
---|
7391 | 8257 | } |
---|
7392 | 8258 | |
---|
7393 | 8259 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7399 | 8265 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7400 | 8266 | |
---|
7401 | 8267 | Object3D /*Composite*/ parent; |
---|
7402 | | - Object3D /*Composite*/ fileparent; |
---|
| 8268 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7403 | 8269 | |
---|
7404 | 8270 | double[][] toParent; // dynamic matrix |
---|
7405 | 8271 | double[][] fromParent; |
---|
.. | .. |
---|
7514 | 8380 | { |
---|
7515 | 8381 | assert(bRep != null); |
---|
7516 | 8382 | if (!(support instanceof GenericJoint)) // support.bRep != null) |
---|
7517 | | - GrafreeD.Assert(support.bRep == bRep.support); |
---|
| 8383 | + Grafreed.Assert(support.bRep == bRep.support); |
---|
7518 | 8384 | } |
---|
7519 | 8385 | else |
---|
7520 | 8386 | { |
---|
.. | .. |
---|
7545 | 8411 | } |
---|
7546 | 8412 | |
---|
7547 | 8413 | transient ObjEditor editWindow; |
---|
| 8414 | + transient ObjEditor manipWindow; |
---|
| 8415 | + |
---|
| 8416 | + transient boolean pinned; |
---|
| 8417 | + |
---|
7548 | 8418 | transient ObjectUI objectUI; |
---|
7549 | 8419 | public static int povDepth = 0; |
---|
7550 | 8420 | private static cVector tbMin = new cVector(); |
---|
.. | .. |
---|
7563 | 8433 | private static cVector edge2 = new cVector(); |
---|
7564 | 8434 | //private static cVector norm = new cVector(); |
---|
7565 | 8435 | /*transient private*/ int hitSomething; |
---|
7566 | | - private static final int hitCenter = 1; |
---|
7567 | | - private static final int hitScale = 2; |
---|
7568 | | - private static final int hitRotate = 3; |
---|
| 8436 | + static final int hitCenter = 1; |
---|
| 8437 | + static final int hitScale = 2; |
---|
| 8438 | + static final int hitRotate = 3; |
---|
7569 | 8439 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7570 | 8440 | /*transient*/ private Point centerPt; |
---|
7571 | 8441 | /*transient*/ private int startX; |
---|