.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
27 | | - // TEMPORARY for mocap undo. No need to be transient. |
---|
| 28 | + // TEMPORARY for versions. No need to be transient. |
---|
28 | 29 | mocap.reader.BVHReader.BVHResult savebvh; |
---|
29 | 30 | Object3D saveskeleton; |
---|
| 31 | + |
---|
| 32 | + // FileObject |
---|
| 33 | + Object3D savefilecontent; |
---|
30 | 34 | // |
---|
31 | 35 | |
---|
32 | | - byte[] versions[] = new byte[100][]; |
---|
| 36 | + String skyboxname; |
---|
| 37 | + String skyboxext; |
---|
| 38 | + |
---|
| 39 | + Object3D[] versionlist; |
---|
33 | 40 | int versionindex = -1; |
---|
34 | 41 | |
---|
| 42 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 43 | + |
---|
35 | 44 | ScriptNode scriptnode; |
---|
36 | 45 | |
---|
| 46 | + void deepCopyNode(Object3D other) |
---|
| 47 | + { |
---|
| 48 | + other.skyboxname = skyboxname; |
---|
| 49 | + other.skyboxext = skyboxext; |
---|
| 50 | + |
---|
| 51 | + if (toParent != null) |
---|
| 52 | + { |
---|
| 53 | + other.toParent = LA.newMatrix(); |
---|
| 54 | + other.fromParent = LA.newMatrix(); |
---|
| 55 | + LA.matCopy(toParent, other.toParent); |
---|
| 56 | + LA.matCopy(fromParent, other.fromParent); |
---|
| 57 | + if (toParentMarked != null) |
---|
| 58 | + { |
---|
| 59 | + other.toParentMarked = LA.newMatrix(); |
---|
| 60 | + other.fromParentMarked = LA.newMatrix(); |
---|
| 61 | + LA.matCopy(toParentMarked, other.toParentMarked); |
---|
| 62 | + LA.matCopy(fromParentMarked, other.fromParentMarked); |
---|
| 63 | + } |
---|
| 64 | + } |
---|
| 65 | + else |
---|
| 66 | + { |
---|
| 67 | + if (other.toParent == null) |
---|
| 68 | +// assert(other.toParent == null); |
---|
| 69 | +// new Exception().printStackTrace(); |
---|
| 70 | + System.err.println("null parent: " + other); |
---|
| 71 | + } |
---|
| 72 | + |
---|
| 73 | + /* |
---|
| 74 | + double ident[][] = LA.newMatrix(); |
---|
| 75 | + if (bRep == null) |
---|
| 76 | + other.bRep = null; |
---|
| 77 | + else |
---|
| 78 | + other.bRep = new BoundaryRep(bRep, ident); |
---|
| 79 | + */ |
---|
| 80 | + // Really new... |
---|
| 81 | + //other.editWindow = null; |
---|
| 82 | + if (name == null) |
---|
| 83 | + other.name = null; |
---|
| 84 | + else |
---|
| 85 | + other.name = new String(name); |
---|
| 86 | + |
---|
| 87 | + if (material != null) |
---|
| 88 | + { |
---|
| 89 | + other.material = new cMaterial(material); |
---|
| 90 | + } else |
---|
| 91 | + { |
---|
| 92 | + other.material = null; |
---|
| 93 | + } |
---|
| 94 | + |
---|
| 95 | + other.GetTextures().name = GetTextures().name; |
---|
| 96 | + |
---|
| 97 | + CopyExtraMaterial(other); |
---|
| 98 | + |
---|
| 99 | + other.touched = touched; |
---|
| 100 | + other.softtouched = softtouched; |
---|
| 101 | + |
---|
| 102 | + other.random = random; |
---|
| 103 | + other.link2master = link2master; |
---|
| 104 | + other.transformcount = transformcount; |
---|
| 105 | + other.marked = marked; |
---|
| 106 | + other.skip = skip; |
---|
| 107 | + other.count = count; |
---|
| 108 | + other.flipV = flipV; |
---|
| 109 | + other.live = live; |
---|
| 110 | + other.rewind = rewind; |
---|
| 111 | + other.hide = hide; |
---|
| 112 | + other.texres = texres; |
---|
| 113 | + other.speedup = speedup; |
---|
| 114 | + other.height = height; |
---|
| 115 | + other.depth = depth; |
---|
| 116 | + } |
---|
| 117 | + |
---|
| 118 | + int VersionCount() |
---|
| 119 | + { |
---|
| 120 | + int count = 0; |
---|
| 121 | + |
---|
| 122 | + if (versionlist != null) |
---|
| 123 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 124 | + { |
---|
| 125 | + if (versionlist[i] != null) |
---|
| 126 | + count++; |
---|
| 127 | + } |
---|
| 128 | + |
---|
| 129 | + return count; |
---|
| 130 | + } |
---|
| 131 | + |
---|
37 | 132 | void InitOthers() |
---|
38 | 133 | { |
---|
39 | 134 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
45 | 140 | projectedVertices[i] = new cVector2(); // Others |
---|
46 | 141 | } |
---|
47 | 142 | projectedVertices[0].x = 100; // bump |
---|
| 143 | + projectedVertices[1].y = 1000; // punchthrough. only for png |
---|
48 | 144 | } |
---|
49 | 145 | |
---|
50 | 146 | void MinMax(cVector minima, cVector maxima) |
---|
.. | .. |
---|
171 | 267 | } |
---|
172 | 268 | } |
---|
173 | 269 | |
---|
| 270 | + boolean HasBigData() |
---|
| 271 | + { |
---|
| 272 | + if (blockloop) |
---|
| 273 | + return false; |
---|
| 274 | + |
---|
| 275 | + if (bRep != null) |
---|
| 276 | + { |
---|
| 277 | + return true; |
---|
| 278 | + } |
---|
| 279 | + |
---|
| 280 | + blockloop = true; |
---|
| 281 | + |
---|
| 282 | + for (int i = 0; i < Size(); i++) |
---|
| 283 | + { |
---|
| 284 | + Object3D child = (Object3D) get(i); |
---|
| 285 | + if (child == null) |
---|
| 286 | + continue; |
---|
| 287 | + if (child.HasBigData()) |
---|
| 288 | + { |
---|
| 289 | + blockloop = false; |
---|
| 290 | + return true; |
---|
| 291 | + } |
---|
| 292 | + } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
| 295 | + return false; |
---|
| 296 | + } |
---|
| 297 | + |
---|
174 | 298 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
175 | 299 | { |
---|
| 300 | + if (blockloop) |
---|
| 301 | + return; |
---|
| 302 | + |
---|
176 | 303 | Object3D o; |
---|
| 304 | + |
---|
| 305 | + boolean isnew = false; |
---|
177 | 306 | |
---|
178 | 307 | if (hashtable.containsKey(GetUUID())) |
---|
179 | 308 | { |
---|
.. | .. |
---|
187 | 316 | } |
---|
188 | 317 | else |
---|
189 | 318 | { |
---|
| 319 | + isnew = true; |
---|
| 320 | + |
---|
190 | 321 | o = new Object3D("copy of " + this.name); |
---|
191 | 322 | |
---|
192 | 323 | hashtable.put(GetUUID(), o); |
---|
193 | 324 | } |
---|
194 | 325 | |
---|
195 | | - if (!blockloop) |
---|
| 326 | + //if (!blockloop) |
---|
196 | 327 | { |
---|
197 | 328 | blockloop = true; |
---|
198 | 329 | |
---|
.. | .. |
---|
203 | 334 | |
---|
204 | 335 | blockloop = false; |
---|
205 | 336 | } |
---|
206 | | - |
---|
207 | | - ExtractBigData(o); |
---|
| 337 | + |
---|
| 338 | + //if (isnew) |
---|
| 339 | + ExtractBigData(o); |
---|
208 | 340 | } |
---|
209 | 341 | |
---|
210 | 342 | void ExtractBigData(Object3D o) |
---|
211 | 343 | { |
---|
| 344 | + //System.err.println("ExtractBigData : " + this + " --> " + o); |
---|
| 345 | + |
---|
212 | 346 | if (o.bRep != null) |
---|
213 | 347 | Grafreed.Assert(o.bRep == this.bRep); |
---|
214 | 348 | |
---|
.. | .. |
---|
219 | 353 | // o.bRep.support = null; |
---|
220 | 354 | // } |
---|
221 | 355 | o.selection = this.selection; |
---|
222 | | - o.versions = this.versions; |
---|
223 | | - o.versionindex = this.versionindex; |
---|
| 356 | + //o.versionlist = this.versionlist; |
---|
| 357 | + //o.versionindex = this.versionindex; |
---|
224 | 358 | |
---|
225 | 359 | if (this.support != null) |
---|
226 | 360 | { |
---|
.. | .. |
---|
243 | 377 | // this.fileparent = null; |
---|
244 | 378 | } |
---|
245 | 379 | |
---|
| 380 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 381 | +// { |
---|
| 382 | +// if (this.uuid.equals(uuid)) |
---|
| 383 | +// return this; |
---|
| 384 | +// |
---|
| 385 | +// if (blockloop) |
---|
| 386 | +// return null; |
---|
| 387 | +// |
---|
| 388 | +// blockloop = true; |
---|
| 389 | +// |
---|
| 390 | +// for (int i=0; i<Size(); i++) |
---|
| 391 | +// { |
---|
| 392 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 393 | +// |
---|
| 394 | +// if (o != null) |
---|
| 395 | +// return o; |
---|
| 396 | +// } |
---|
| 397 | +// |
---|
| 398 | +// blockloop = false; |
---|
| 399 | +// |
---|
| 400 | +// return null; |
---|
| 401 | +// } |
---|
| 402 | + |
---|
| 403 | + transient boolean tag; |
---|
| 404 | + |
---|
| 405 | + void TagObjects(Object3D o, boolean tag) |
---|
| 406 | + { |
---|
| 407 | + if (blockloop) |
---|
| 408 | + return; |
---|
| 409 | + |
---|
| 410 | + o.tag = tag; |
---|
| 411 | + |
---|
| 412 | + if (o == this) |
---|
| 413 | + return; |
---|
| 414 | + |
---|
| 415 | + blockloop = true; |
---|
| 416 | + |
---|
| 417 | + for (int i=0; i<Size(); i++) |
---|
| 418 | + { |
---|
| 419 | + get(i).TagObjects(o, tag); |
---|
| 420 | + } |
---|
| 421 | + |
---|
| 422 | + blockloop = false; |
---|
| 423 | + } |
---|
| 424 | + |
---|
| 425 | + boolean HasTags() |
---|
| 426 | + { |
---|
| 427 | + if (blockloop) |
---|
| 428 | + return false; |
---|
| 429 | + |
---|
| 430 | + blockloop = true; |
---|
| 431 | + |
---|
| 432 | + boolean hasTags = false; |
---|
| 433 | + |
---|
| 434 | + for (int i=0; i<Size(); i++) |
---|
| 435 | + { |
---|
| 436 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 437 | + |
---|
| 438 | + if (hasTags) |
---|
| 439 | + break; |
---|
| 440 | + } |
---|
| 441 | + |
---|
| 442 | + blockloop = false; |
---|
| 443 | + |
---|
| 444 | + return hasTags; |
---|
| 445 | + } |
---|
| 446 | + |
---|
246 | 447 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
247 | 448 | { |
---|
| 449 | + if (blockloop) |
---|
| 450 | + return; |
---|
| 451 | + |
---|
248 | 452 | if (!hashtable.containsKey(GetUUID())) |
---|
249 | 453 | return; |
---|
250 | 454 | |
---|
251 | 455 | Object3D o = hashtable.get(GetUUID()); |
---|
252 | 456 | |
---|
253 | 457 | RestoreBigData(o); |
---|
254 | | - |
---|
255 | | - if (blockloop) |
---|
256 | | - return; |
---|
257 | 458 | |
---|
258 | 459 | blockloop = true; |
---|
259 | 460 | |
---|
.. | .. |
---|
269 | 470 | |
---|
270 | 471 | void RestoreBigData(Object3D o) |
---|
271 | 472 | { |
---|
| 473 | + //System.err.println("RestoreBigData : " + this + " <-- " + o); |
---|
| 474 | + Grafreed.Assert(this.bRep == null); |
---|
| 475 | + |
---|
272 | 476 | this.bRep = o.bRep; |
---|
273 | 477 | if (this.support != null && o.transientrep != null) |
---|
274 | 478 | { |
---|
.. | .. |
---|
277 | 481 | |
---|
278 | 482 | this.selection = o.selection; |
---|
279 | 483 | |
---|
280 | | - this.versions = o.versions; |
---|
281 | | - this.versionindex = o.versionindex; |
---|
| 484 | + //this.versionlist = o.versionlist; |
---|
| 485 | + //this.versionindex = o.versionindex; |
---|
282 | 486 | // July 2019 if (this.bRep != null) |
---|
283 | 487 | // this.bRep.support = o.transientrep; |
---|
284 | 488 | // this.support = o.support; |
---|
.. | .. |
---|
426 | 630 | } |
---|
427 | 631 | |
---|
428 | 632 | boolean live = false; |
---|
| 633 | + transient boolean keepdontselect; |
---|
429 | 634 | boolean dontselect = false; |
---|
430 | 635 | boolean hide = false; |
---|
431 | 636 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
436 | 641 | boolean random = false; |
---|
437 | 642 | boolean speedup = false; |
---|
438 | 643 | boolean rewind = false; |
---|
| 644 | + |
---|
| 645 | + // Option to sort triangles, e.g. for transparency. |
---|
| 646 | + boolean sort = false; |
---|
439 | 647 | |
---|
440 | 648 | float NORMALPUSH = 0; |
---|
441 | 649 | |
---|
.. | .. |
---|
494 | 702 | } |
---|
495 | 703 | } |
---|
496 | 704 | |
---|
497 | | - int memorysize; |
---|
| 705 | + transient int memorysize; // needs to be transient, dunno why |
---|
498 | 706 | |
---|
499 | 707 | int MemorySize() |
---|
500 | 708 | { |
---|
501 | | - if (true) // memorysize == 0) |
---|
| 709 | + if (memorysize == 0) |
---|
502 | 710 | { |
---|
503 | 711 | try |
---|
504 | 712 | { |
---|
.. | .. |
---|
613 | 821 | { |
---|
614 | 822 | if (maxcount != 1) |
---|
615 | 823 | { |
---|
616 | | - new Exception().printStackTrace(); |
---|
| 824 | + //new Exception().printStackTrace(); |
---|
617 | 825 | } |
---|
618 | 826 | |
---|
619 | 827 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
1008 | 1216 | { |
---|
1009 | 1217 | // return true; |
---|
1010 | 1218 | |
---|
1011 | | - if (material == null || material.multiply) |
---|
1012 | | - return true; |
---|
| 1219 | +// if (material == null || material.multiply) |
---|
| 1220 | +// return true; |
---|
| 1221 | +// |
---|
| 1222 | +// if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1223 | +// return false; |
---|
| 1224 | +// |
---|
| 1225 | +// // Transparent objects are dynamic because we have to sort the triangles. |
---|
| 1226 | +// return material.opacity > 0.99; |
---|
1013 | 1227 | |
---|
1014 | | - // Transparent objects are dynamic because we have to sort the triangles. |
---|
1015 | | - return material.opacity > 0.99; |
---|
| 1228 | + return !sort; |
---|
1016 | 1229 | } |
---|
1017 | 1230 | |
---|
1018 | 1231 | boolean IsOpaque() |
---|
1019 | 1232 | { |
---|
1020 | 1233 | // return true; |
---|
1021 | 1234 | |
---|
1022 | | - if (material == null || material.multiply) |
---|
1023 | | - return true; |
---|
| 1235 | +// if (material == null || material.multiply) |
---|
| 1236 | +// return true; |
---|
| 1237 | +// |
---|
| 1238 | +// return material.opacity > 0.99; |
---|
1024 | 1239 | |
---|
1025 | | - return material.opacity > 0.99; |
---|
| 1240 | + return !sort; |
---|
1026 | 1241 | } |
---|
1027 | 1242 | |
---|
1028 | 1243 | Object3D() |
---|
.. | .. |
---|
1100 | 1315 | |
---|
1101 | 1316 | // will share the geometry |
---|
1102 | 1317 | assert (!(this instanceof Composite)); |
---|
1103 | | - return deepCopy(); // Never called for Composite |
---|
1104 | | - |
---|
| 1318 | + |
---|
| 1319 | + Object3D obj = deepCopy(); // Never called for Composite |
---|
| 1320 | + obj.count = 2; |
---|
| 1321 | + return obj; |
---|
1105 | 1322 | } |
---|
1106 | 1323 | |
---|
1107 | 1324 | boolean HasLoops() |
---|
.. | .. |
---|
1109 | 1326 | return false; |
---|
1110 | 1327 | } |
---|
1111 | 1328 | |
---|
| 1329 | + void ResetUUIDs() |
---|
| 1330 | + { |
---|
| 1331 | + if (blockloop) |
---|
| 1332 | + { |
---|
| 1333 | + return; |
---|
| 1334 | + } |
---|
| 1335 | + |
---|
| 1336 | + this.uuid = null; |
---|
| 1337 | + |
---|
| 1338 | + blockloop = true; |
---|
| 1339 | + |
---|
| 1340 | + for (int i = 0; i < Size(); i++) |
---|
| 1341 | + { |
---|
| 1342 | + Object3D obj = (Object3D) Children().get(i); |
---|
| 1343 | + |
---|
| 1344 | + if (obj != null) |
---|
| 1345 | + { |
---|
| 1346 | + obj.ResetUUIDs(); |
---|
| 1347 | + } |
---|
| 1348 | + } |
---|
| 1349 | + |
---|
| 1350 | + blockloop = false; |
---|
| 1351 | + } |
---|
| 1352 | + |
---|
1112 | 1353 | boolean IsInfinite() |
---|
1113 | 1354 | { |
---|
1114 | 1355 | if (blockloop) |
---|
.. | .. |
---|
1179 | 1420 | return; |
---|
1180 | 1421 | |
---|
1181 | 1422 | blockloop = true; |
---|
| 1423 | + |
---|
| 1424 | + other.parent = parent; |
---|
| 1425 | + |
---|
1182 | 1426 | //System.out.println("COPY " + this + " to " + other); |
---|
1183 | 1427 | //new Exception().printStackTrace(); |
---|
| 1428 | + deepCopyNode(other); |
---|
1184 | 1429 | |
---|
1185 | | - other.parent = parent; |
---|
1186 | | - if (toParent != null) |
---|
1187 | | - { |
---|
1188 | | - other.toParent = LA.newMatrix(); |
---|
1189 | | - other.fromParent = LA.newMatrix(); |
---|
1190 | | - LA.matCopy(toParent, other.toParent); |
---|
1191 | | - LA.matCopy(fromParent, other.fromParent); |
---|
1192 | | - if (toParentMarked != null) |
---|
1193 | | - { |
---|
1194 | | - other.toParentMarked = LA.newMatrix(); |
---|
1195 | | - other.fromParentMarked = LA.newMatrix(); |
---|
1196 | | - LA.matCopy(toParentMarked, other.toParentMarked); |
---|
1197 | | - LA.matCopy(fromParentMarked, other.fromParentMarked); |
---|
1198 | | - } |
---|
1199 | | - } |
---|
1200 | | - else |
---|
1201 | | - { |
---|
1202 | | - if (other.toParent == null) |
---|
1203 | | -// assert(other.toParent == null); |
---|
1204 | | -// new Exception().printStackTrace(); |
---|
1205 | | - System.err.println("null parent: " + other); |
---|
1206 | | - } |
---|
1207 | | - /* |
---|
1208 | | - double ident[][] = LA.newMatrix(); |
---|
1209 | | - if (bRep == null) |
---|
1210 | | - other.bRep = null; |
---|
1211 | | - else |
---|
1212 | | - other.bRep = new BoundaryRep(bRep, ident); |
---|
1213 | | - */ |
---|
1214 | | - // Really new... |
---|
1215 | 1430 | other.bRep = bRep; // Share the geometry |
---|
1216 | 1431 | |
---|
1217 | 1432 | other.support = support; // Share the support |
---|
1218 | | - |
---|
1219 | | - //other.editWindow = null; |
---|
1220 | | - if (name == null) |
---|
1221 | | - other.name = null; |
---|
1222 | | - else |
---|
1223 | | - other.name = new String(name); |
---|
1224 | | - |
---|
1225 | | - if (material != null) |
---|
1226 | | - { |
---|
1227 | | - other.material = new cMaterial(material); |
---|
1228 | | - } else |
---|
1229 | | - { |
---|
1230 | | - other.material = null; |
---|
1231 | | - } |
---|
1232 | | - |
---|
1233 | | - other.GetTextures().name = GetTextures().name; |
---|
1234 | | - |
---|
1235 | | - CopyExtraMaterial(other); |
---|
1236 | | - |
---|
1237 | | - other.touched = touched; |
---|
1238 | | - other.softtouched = softtouched; |
---|
1239 | | - |
---|
1240 | | - other.random = random; |
---|
1241 | | - other.link2master = link2master; |
---|
1242 | | - other.transformcount = transformcount; |
---|
1243 | | - other.marked = marked; |
---|
1244 | | - other.skip = skip; |
---|
1245 | | - other.count = count; |
---|
1246 | | - other.flipV = flipV; |
---|
1247 | | - other.live = live; |
---|
1248 | | - other.rewind = rewind; |
---|
1249 | | - other.hide = hide; |
---|
1250 | | - other.texres = texres; |
---|
1251 | | - other.speedup = speedup; |
---|
1252 | | - other.height = height; |
---|
1253 | | - other.depth = depth; |
---|
1254 | 1433 | |
---|
1255 | 1434 | // aout 2013 if (/*displaylist != -1 &&*/other.displaylist != displaylist) |
---|
1256 | 1435 | // { |
---|
.. | .. |
---|
1306 | 1485 | if ((mask & GEOMETRY) != 0) |
---|
1307 | 1486 | { |
---|
1308 | 1487 | if (bRep != null) |
---|
1309 | | - bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep); |
---|
1310 | | - else |
---|
1311 | | - assert(other.bRep == null); |
---|
1312 | | - |
---|
1313 | | - if (bRep != null) |
---|
1314 | 1488 | { |
---|
| 1489 | + bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep); |
---|
1315 | 1490 | CameraPane.RemoveList(bRep.displaylist); |
---|
1316 | 1491 | bRep.displaylist = 0; // june 2013 -1; |
---|
1317 | 1492 | } |
---|
1318 | 1493 | else |
---|
1319 | | - bRep = bRep; |
---|
| 1494 | + { |
---|
| 1495 | + //assert(other.bRep == null); |
---|
| 1496 | + bRep = other.bRep; |
---|
| 1497 | + } |
---|
| 1498 | + |
---|
| 1499 | +// if (bRep != null) |
---|
| 1500 | +// { |
---|
| 1501 | +// CameraPane.RemoveList(bRep.displaylist); |
---|
| 1502 | +// bRep.displaylist = 0; // june 2013 -1; |
---|
| 1503 | +// } |
---|
| 1504 | +// else |
---|
| 1505 | +// bRep = bRep; |
---|
1320 | 1506 | } |
---|
1321 | 1507 | |
---|
1322 | 1508 | /* Use a MASK = GEO/MAT |
---|
.. | .. |
---|
2292 | 2478 | |
---|
2293 | 2479 | InitOthers(); |
---|
2294 | 2480 | |
---|
2295 | | - if (this instanceof Camera) |
---|
2296 | | - { |
---|
2297 | | - material.shift = 90; |
---|
2298 | | - } |
---|
2299 | | - |
---|
2300 | 2481 | material.multiply = multiply; |
---|
2301 | 2482 | |
---|
2302 | 2483 | if (multiply) |
---|
.. | .. |
---|
2437 | 2618 | else |
---|
2438 | 2619 | { |
---|
2439 | 2620 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2621 | + if (objectUI != null) |
---|
| 2622 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2623 | + else |
---|
| 2624 | + //new Exception().printStackTrace(); |
---|
| 2625 | + System.err.println("objectUI is null"); |
---|
2440 | 2626 | } |
---|
2441 | 2627 | } |
---|
2442 | 2628 | |
---|
.. | .. |
---|
2566 | 2752 | private static final int editSelf = 1; |
---|
2567 | 2753 | private static final int editChild = 2; |
---|
2568 | 2754 | |
---|
2569 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2755 | + void drawEditHandles(//ClickInfo info, |
---|
| 2756 | + int level) |
---|
2570 | 2757 | { |
---|
2571 | 2758 | if (level == 0) |
---|
2572 | 2759 | { |
---|
.. | .. |
---|
2574 | 2761 | return; |
---|
2575 | 2762 | |
---|
2576 | 2763 | Object3D selectee; |
---|
2577 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2764 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2765 | + level + 1)) |
---|
2578 | 2766 | { |
---|
2579 | 2767 | selectee = (Object3D) e.nextElement(); |
---|
2580 | 2768 | } |
---|
.. | .. |
---|
2582 | 2770 | } else |
---|
2583 | 2771 | { |
---|
2584 | 2772 | //super. |
---|
2585 | | - drawEditHandles0(info, level + 1); |
---|
| 2773 | + drawEditHandles0(//info, |
---|
| 2774 | + level + 1); |
---|
2586 | 2775 | } |
---|
2587 | 2776 | } |
---|
2588 | 2777 | |
---|
2589 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2778 | + boolean doEditClick(//ClickInfo info, |
---|
| 2779 | + int level) |
---|
2590 | 2780 | { |
---|
2591 | 2781 | doSomething = 0; |
---|
2592 | 2782 | if (level == 0) |
---|
2593 | 2783 | { |
---|
2594 | | - return doParentClick(info); |
---|
| 2784 | + return doParentClick(); //info); |
---|
2595 | 2785 | } |
---|
2596 | 2786 | if (//super. |
---|
2597 | | - doEditClick0(info, level)) |
---|
| 2787 | + doEditClick0(//info, |
---|
| 2788 | + level)) |
---|
2598 | 2789 | { |
---|
2599 | 2790 | doSomething = 1; |
---|
2600 | 2791 | return true; |
---|
.. | .. |
---|
2604 | 2795 | } |
---|
2605 | 2796 | } |
---|
2606 | 2797 | |
---|
2607 | | - boolean doParentClick(ClickInfo info) |
---|
| 2798 | + boolean doParentClick() //ClickInfo info) |
---|
2608 | 2799 | { |
---|
2609 | 2800 | if (selection == null) |
---|
2610 | 2801 | { |
---|
.. | .. |
---|
2617 | 2808 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2618 | 2809 | { |
---|
2619 | 2810 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2620 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2811 | + if (selectee.doEditClick(//info, |
---|
| 2812 | + 1)) |
---|
2621 | 2813 | { |
---|
2622 | 2814 | childToDrag = selectee; |
---|
2623 | 2815 | doSomething = 2; |
---|
.. | .. |
---|
2629 | 2821 | return retval; |
---|
2630 | 2822 | } |
---|
2631 | 2823 | |
---|
2632 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2824 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2825 | + boolean opposite) |
---|
2633 | 2826 | { |
---|
2634 | 2827 | switch (doSomething) |
---|
2635 | 2828 | { |
---|
2636 | 2829 | case 1: // '\001' |
---|
2637 | 2830 | //super. |
---|
2638 | | - doEditDrag0(info, opposite); |
---|
| 2831 | + doEditDrag0(//clickInfo, |
---|
| 2832 | + opposite); |
---|
2639 | 2833 | break; |
---|
2640 | 2834 | |
---|
2641 | 2835 | case 2: // '\002' |
---|
.. | .. |
---|
2648 | 2842 | { |
---|
2649 | 2843 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2650 | 2844 | //childToDrag.doEditDrag(info); |
---|
2651 | | - sel.doEditDrag(info, opposite); |
---|
| 2845 | + sel.doEditDrag(//clickInfo, |
---|
| 2846 | + opposite); |
---|
2652 | 2847 | } else |
---|
2653 | 2848 | { |
---|
2654 | 2849 | //super. |
---|
2655 | | - doEditDrag0(info, opposite); |
---|
| 2850 | + doEditDrag0(//clickInfo, |
---|
| 2851 | + opposite); |
---|
2656 | 2852 | } |
---|
2657 | 2853 | } |
---|
2658 | 2854 | break; |
---|
.. | .. |
---|
2670 | 2866 | { |
---|
2671 | 2867 | deselectAll(); |
---|
2672 | 2868 | } |
---|
| 2869 | + |
---|
| 2870 | + new Exception().printStackTrace(); |
---|
| 2871 | + |
---|
2673 | 2872 | ClickInfo newInfo = new ClickInfo(); |
---|
2674 | 2873 | newInfo.flags = info.flags; |
---|
2675 | 2874 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3099 | 3298 | { |
---|
3100 | 3299 | if (bRep != null) |
---|
3101 | 3300 | { |
---|
| 3301 | + //bRep.GenerateNormals2(crease); // in-place doesn't work. it gives wrong normals (diamond artifact). |
---|
3102 | 3302 | bRep.GenerateNormals(crease); |
---|
| 3303 | + if (!bRep.trimmed) |
---|
| 3304 | + bRep.MergeNormals(); |
---|
3103 | 3305 | Touch(); |
---|
3104 | 3306 | } |
---|
3105 | 3307 | } |
---|
.. | .. |
---|
3117 | 3319 | { |
---|
3118 | 3320 | if (bRep != null) |
---|
3119 | 3321 | { |
---|
3120 | | - bRep.GenerateNormalsMINE(); |
---|
| 3322 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3121 | 3323 | Touch(); |
---|
3122 | 3324 | } |
---|
3123 | 3325 | } |
---|
.. | .. |
---|
3174 | 3376 | blockloop = false; |
---|
3175 | 3377 | } |
---|
3176 | 3378 | |
---|
| 3379 | + public void ResetTransform(int mask) |
---|
| 3380 | + { |
---|
| 3381 | + Object3D obj = this; |
---|
| 3382 | + |
---|
| 3383 | + if (mask == -1) |
---|
| 3384 | + { |
---|
| 3385 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3386 | + { |
---|
| 3387 | + LA.matIdentity(obj.toParent); |
---|
| 3388 | + LA.matIdentity(obj.fromParent); |
---|
| 3389 | + } |
---|
| 3390 | + else |
---|
| 3391 | + { |
---|
| 3392 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3393 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3394 | + } |
---|
| 3395 | + return; |
---|
| 3396 | + } |
---|
| 3397 | + |
---|
| 3398 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3399 | + { |
---|
| 3400 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3401 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3402 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3403 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3404 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3405 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3406 | + } |
---|
| 3407 | + if ((mask&1) != 0) // Translation |
---|
| 3408 | + { |
---|
| 3409 | + if (obj.toParent != null) |
---|
| 3410 | + { |
---|
| 3411 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3412 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3413 | + } |
---|
| 3414 | + } |
---|
| 3415 | + } |
---|
| 3416 | + |
---|
| 3417 | + public void Scale(int scale) |
---|
| 3418 | + { |
---|
| 3419 | + Object3D obj = this; |
---|
| 3420 | + |
---|
| 3421 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = scale; |
---|
| 3422 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3423 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3424 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1/scale; |
---|
| 3425 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3426 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3427 | + } |
---|
| 3428 | + |
---|
| 3429 | + public void TextureRatioTransform(int axis) |
---|
| 3430 | + { |
---|
| 3431 | + cTexture tex = GetTextures(); |
---|
| 3432 | + |
---|
| 3433 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3434 | + |
---|
| 3435 | + try |
---|
| 3436 | + { |
---|
| 3437 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3438 | + } |
---|
| 3439 | + catch (Exception e) |
---|
| 3440 | + { |
---|
| 3441 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3442 | + } |
---|
| 3443 | + |
---|
| 3444 | + LA.matIdentity(Object3D.mat); |
---|
| 3445 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3446 | + |
---|
| 3447 | + if (toParent == null) |
---|
| 3448 | + { |
---|
| 3449 | + toParent = LA.newMatrix(); |
---|
| 3450 | + fromParent = LA.newMatrix(); |
---|
| 3451 | + } |
---|
| 3452 | + |
---|
| 3453 | + ResetTransform(2); |
---|
| 3454 | + |
---|
| 3455 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3456 | + LA.matInvert(fromParent, toParent); |
---|
| 3457 | + } |
---|
| 3458 | + |
---|
| 3459 | + void TextureRatio(int axis) |
---|
| 3460 | + { |
---|
| 3461 | + if (blockloop) |
---|
| 3462 | + return; |
---|
| 3463 | + |
---|
| 3464 | + blockloop = true; |
---|
| 3465 | + |
---|
| 3466 | + TextureRatioTransform(axis); |
---|
| 3467 | + |
---|
| 3468 | + for (int i=Size(); --i>=0;) |
---|
| 3469 | + { |
---|
| 3470 | + Object3D v = get(i); |
---|
| 3471 | + |
---|
| 3472 | + v.TextureRatio(axis); |
---|
| 3473 | + } |
---|
| 3474 | + |
---|
| 3475 | + blockloop = false; |
---|
| 3476 | + } |
---|
| 3477 | + |
---|
3177 | 3478 | void TransformChildren() |
---|
3178 | 3479 | { |
---|
3179 | 3480 | if (toParent != null) |
---|
.. | .. |
---|
3416 | 3717 | if (bRep != null) |
---|
3417 | 3718 | { |
---|
3418 | 3719 | //bRep.RemoveOneTriangle(); |
---|
| 3720 | + System.out.println(); |
---|
3419 | 3721 | System.out.println("Reducing " + this); |
---|
3420 | 3722 | if (name != null && name.contains("lockpickstraps")) |
---|
3421 | 3723 | name = name; |
---|
.. | .. |
---|
3527 | 3829 | |
---|
3528 | 3830 | void ClearMaterials() |
---|
3529 | 3831 | { |
---|
| 3832 | + if (blockloop) |
---|
| 3833 | + return; |
---|
| 3834 | + |
---|
| 3835 | + blockloop = true; |
---|
| 3836 | + |
---|
3530 | 3837 | ClearMaterial(); |
---|
3531 | | - for (int i = 0; i < size(); i++) |
---|
| 3838 | + for (int i = 0; i < Size(); i++) |
---|
3532 | 3839 | { |
---|
3533 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3840 | + Object3D child = (Object3D) get(i); |
---|
3534 | 3841 | if (child == null) |
---|
3535 | 3842 | continue; |
---|
3536 | 3843 | child.ClearMaterials(); |
---|
3537 | | - release(i); |
---|
3538 | 3844 | } |
---|
| 3845 | + |
---|
| 3846 | + blockloop = false; |
---|
| 3847 | + } |
---|
| 3848 | + |
---|
| 3849 | + void ClearVersionList() |
---|
| 3850 | + { |
---|
| 3851 | + this.versionlist = null; |
---|
| 3852 | + this.versionindex = -1; |
---|
| 3853 | + this.versiontable = null; |
---|
| 3854 | + } |
---|
| 3855 | + |
---|
| 3856 | + void ClearVersions() |
---|
| 3857 | + { |
---|
| 3858 | + if (blockloop) |
---|
| 3859 | + return; |
---|
| 3860 | + |
---|
| 3861 | + blockloop = true; |
---|
| 3862 | + |
---|
| 3863 | + ClearVersionList(); |
---|
| 3864 | + for (int i = 0; i < Size(); i++) |
---|
| 3865 | + { |
---|
| 3866 | + Object3D child = (Object3D) get(i); |
---|
| 3867 | + if (child == null) |
---|
| 3868 | + continue; |
---|
| 3869 | + child.ClearVersions(); |
---|
| 3870 | + } |
---|
| 3871 | + |
---|
| 3872 | + blockloop = false; |
---|
3539 | 3873 | } |
---|
3540 | 3874 | |
---|
3541 | 3875 | void FlipV(boolean flip) |
---|
.. | .. |
---|
3985 | 4319 | max = new cVector(); |
---|
3986 | 4320 | } |
---|
3987 | 4321 | |
---|
3988 | | - for (int i = 0; i<size(); i++) |
---|
| 4322 | + for (int i = 0; i<Size(); i++) |
---|
3989 | 4323 | { |
---|
3990 | | - Object3D child = (Object3D) reserve(i); |
---|
| 4324 | + Object3D child = (Object3D) get(i); //reserve(i); |
---|
3991 | 4325 | if (child == null) |
---|
3992 | 4326 | continue; |
---|
3993 | 4327 | |
---|
.. | .. |
---|
4006 | 4340 | if (child.hide && !(child instanceof Merge) || child.skip) |
---|
4007 | 4341 | //if (child.hide) |
---|
4008 | 4342 | { |
---|
4009 | | - release(i); |
---|
| 4343 | + //release(i); |
---|
4010 | 4344 | continue; |
---|
4011 | 4345 | } |
---|
4012 | 4346 | |
---|
4013 | 4347 | blockloop = true; |
---|
4014 | 4348 | child.getBounds(min, max, true); // xform); |
---|
4015 | 4349 | blockloop = false; |
---|
4016 | | - release(i); |
---|
| 4350 | + //release(i); |
---|
4017 | 4351 | |
---|
4018 | 4352 | MinMax(minima, maxima); |
---|
4019 | 4353 | } |
---|
.. | .. |
---|
5420 | 5754 | blockloop = false; |
---|
5421 | 5755 | } |
---|
5422 | 5756 | |
---|
| 5757 | + void ResetSelectable() |
---|
| 5758 | + { |
---|
| 5759 | + if (blockloop) |
---|
| 5760 | + return; |
---|
| 5761 | + |
---|
| 5762 | + blockloop = true; |
---|
| 5763 | + |
---|
| 5764 | + keepdontselect = dontselect; |
---|
| 5765 | + dontselect = true; |
---|
| 5766 | + |
---|
| 5767 | + Object3D child; |
---|
| 5768 | + int nb = Size(); |
---|
| 5769 | + for (int i = 0; i < nb; i++) |
---|
| 5770 | + { |
---|
| 5771 | + child = (Object3D) get(i); |
---|
| 5772 | + if (child == null) |
---|
| 5773 | + continue; |
---|
| 5774 | + child.ResetSelectable(); |
---|
| 5775 | + } |
---|
| 5776 | + |
---|
| 5777 | + blockloop = false; |
---|
| 5778 | + } |
---|
| 5779 | + |
---|
| 5780 | + void RestoreSelectable() |
---|
| 5781 | + { |
---|
| 5782 | + if (blockloop) |
---|
| 5783 | + return; |
---|
| 5784 | + |
---|
| 5785 | + blockloop = true; |
---|
| 5786 | + |
---|
| 5787 | + dontselect = keepdontselect; |
---|
| 5788 | + |
---|
| 5789 | + Object3D child; |
---|
| 5790 | + int nb = Size(); |
---|
| 5791 | + for (int i = 0; i < nb; i++) |
---|
| 5792 | + { |
---|
| 5793 | + child = (Object3D) get(i); |
---|
| 5794 | + if (child == null) |
---|
| 5795 | + continue; |
---|
| 5796 | + child.RestoreSelectable(); |
---|
| 5797 | + } |
---|
| 5798 | + |
---|
| 5799 | + blockloop = false; |
---|
| 5800 | + } |
---|
| 5801 | + |
---|
5423 | 5802 | boolean IsSelected() |
---|
5424 | 5803 | { |
---|
5425 | 5804 | if (parent == null) |
---|
.. | .. |
---|
5480 | 5859 | if (fullname == null) |
---|
5481 | 5860 | return ""; |
---|
5482 | 5861 | |
---|
| 5862 | + if (fullname.pigment != null) |
---|
| 5863 | + { |
---|
| 5864 | + return fullname.pigment; |
---|
| 5865 | + } |
---|
| 5866 | + |
---|
5483 | 5867 | // System.out.println("Fullname = " + fullname); |
---|
5484 | 5868 | |
---|
5485 | 5869 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5492 | 5876 | |
---|
5493 | 5877 | if (split.length == 0) |
---|
5494 | 5878 | { |
---|
5495 | | - return ""; |
---|
| 5879 | + return fullname.pigment = ""; |
---|
5496 | 5880 | } |
---|
5497 | 5881 | |
---|
5498 | 5882 | if (split.length <= 2) |
---|
.. | .. |
---|
5500 | 5884 | if (fullname.name.endsWith(":")) |
---|
5501 | 5885 | { |
---|
5502 | 5886 | // Windows |
---|
5503 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5887 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5504 | 5888 | } |
---|
5505 | 5889 | |
---|
5506 | | - return split[0]; |
---|
| 5890 | + return fullname.pigment = split[0]; |
---|
5507 | 5891 | } |
---|
5508 | 5892 | |
---|
5509 | 5893 | // Windows |
---|
5510 | 5894 | assert(split.length == 4); |
---|
5511 | 5895 | |
---|
5512 | | - return split[0] + ":" + split[1]; |
---|
| 5896 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5513 | 5897 | } |
---|
5514 | 5898 | |
---|
5515 | 5899 | static String GetBump(cTexture fullname) |
---|
5516 | 5900 | { |
---|
5517 | 5901 | if (fullname == null) |
---|
5518 | 5902 | return ""; |
---|
| 5903 | + |
---|
| 5904 | + if (fullname.bump != null) |
---|
| 5905 | + { |
---|
| 5906 | + return fullname.bump; |
---|
| 5907 | + } |
---|
5519 | 5908 | |
---|
5520 | 5909 | // System.out.println("Fullname = " + fullname); |
---|
5521 | 5910 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5527 | 5916 | |
---|
5528 | 5917 | if (split.length == 0) |
---|
5529 | 5918 | { |
---|
5530 | | - return ""; |
---|
| 5919 | + return fullname.bump = ""; |
---|
5531 | 5920 | } |
---|
5532 | 5921 | |
---|
5533 | 5922 | if (split.length == 1) |
---|
5534 | 5923 | { |
---|
5535 | | - return ""; |
---|
| 5924 | + return fullname.bump = ""; |
---|
5536 | 5925 | } |
---|
5537 | 5926 | |
---|
5538 | 5927 | if (split.length == 2) |
---|
.. | .. |
---|
5540 | 5929 | if (fullname.name.endsWith(":")) |
---|
5541 | 5930 | { |
---|
5542 | 5931 | // Windows |
---|
5543 | | - return ""; |
---|
| 5932 | + return fullname.bump = ""; |
---|
5544 | 5933 | } |
---|
5545 | 5934 | |
---|
5546 | | - return split[1]; |
---|
| 5935 | + return fullname.bump = split[1]; |
---|
5547 | 5936 | } |
---|
5548 | 5937 | |
---|
5549 | 5938 | // Windows |
---|
5550 | 5939 | assert(split.length == 4); |
---|
5551 | 5940 | |
---|
5552 | | - return split[2] + ":" + split[3]; |
---|
| 5941 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5553 | 5942 | } |
---|
5554 | 5943 | |
---|
5555 | 5944 | String GetPigmentTexture() |
---|
.. | .. |
---|
5632 | 6021 | texname = ""; |
---|
5633 | 6022 | |
---|
5634 | 6023 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 6024 | + |
---|
| 6025 | + GetTextures().pigment = null; |
---|
| 6026 | + |
---|
5635 | 6027 | Touch(); |
---|
5636 | 6028 | } |
---|
5637 | 6029 | |
---|
.. | .. |
---|
5705 | 6097 | |
---|
5706 | 6098 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5707 | 6099 | |
---|
| 6100 | + GetTextures().bump = null; |
---|
| 6101 | + |
---|
5708 | 6102 | Touch(); |
---|
5709 | 6103 | } |
---|
5710 | 6104 | |
---|
.. | .. |
---|
5725 | 6119 | |
---|
5726 | 6120 | blockloop = true; |
---|
5727 | 6121 | child.ResetBumpTexture(); |
---|
| 6122 | + blockloop = false; |
---|
| 6123 | + } |
---|
| 6124 | + } |
---|
| 6125 | + |
---|
| 6126 | + void EmbedTextures(boolean embed) |
---|
| 6127 | + { |
---|
| 6128 | + if (blockloop) |
---|
| 6129 | + return; |
---|
| 6130 | + |
---|
| 6131 | + //if (GetTextures() != null) |
---|
| 6132 | + if (embed) |
---|
| 6133 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 6134 | + else |
---|
| 6135 | + { |
---|
| 6136 | + GetTextures().pigmentdata = null; |
---|
| 6137 | + GetTextures().bumpdata = null; |
---|
| 6138 | + GetTextures().pw = 0; |
---|
| 6139 | + GetTextures().ph = 0; |
---|
| 6140 | + GetTextures().bw = 0; |
---|
| 6141 | + GetTextures().bh = 0; |
---|
| 6142 | + } |
---|
| 6143 | + |
---|
| 6144 | + int nb = Size(); |
---|
| 6145 | + for (int i = 0; i < nb; i++) |
---|
| 6146 | + { |
---|
| 6147 | + Object3D child = (Object3D) get(i); |
---|
| 6148 | + |
---|
| 6149 | + if (child == null) |
---|
| 6150 | + continue; |
---|
| 6151 | + |
---|
| 6152 | + blockloop = true; |
---|
| 6153 | + child.EmbedTextures(embed); |
---|
5728 | 6154 | blockloop = false; |
---|
5729 | 6155 | } |
---|
5730 | 6156 | } |
---|
.. | .. |
---|
5753 | 6179 | return false; |
---|
5754 | 6180 | |
---|
5755 | 6181 | return parent.IsLive(); |
---|
| 6182 | + } |
---|
| 6183 | + |
---|
| 6184 | + boolean IsDynamic() |
---|
| 6185 | + { |
---|
| 6186 | + return live && bRep != null; |
---|
5756 | 6187 | } |
---|
5757 | 6188 | |
---|
5758 | 6189 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
.. | .. |
---|
5815 | 6246 | if (support != null) |
---|
5816 | 6247 | support = support; |
---|
5817 | 6248 | |
---|
5818 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5819 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6249 | + boolean usecalllists = !IsDynamic() && |
---|
| 6250 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6251 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6252 | + |
---|
| 6253 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5820 | 6254 | |
---|
5821 | 6255 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5822 | 6256 | { |
---|
.. | .. |
---|
5826 | 6260 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5827 | 6261 | // usecalllists = false; |
---|
5828 | 6262 | |
---|
5829 | | - if (GetBRep() != null) |
---|
5830 | | - usecalllists = usecalllists; |
---|
| 6263 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6264 | + //GetBRep() != null) |
---|
| 6265 | + usecalllists = !!usecalllists; |
---|
5831 | 6266 | //System.out.println("draw " + this); |
---|
5832 | 6267 | //new Exception().printStackTrace(); |
---|
5833 | 6268 | |
---|
.. | .. |
---|
5849 | 6284 | if (!(this instanceof Composite)) |
---|
5850 | 6285 | touched = false; |
---|
5851 | 6286 | //if (displaylist == -1 && usecalllists) |
---|
5852 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6287 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5853 | 6288 | { |
---|
5854 | 6289 | bRep.displaylist = display.GenList(); |
---|
5855 | 6290 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5860 | 6295 | |
---|
5861 | 6296 | //System.out.println("\tnew list " + list); |
---|
5862 | 6297 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5863 | | - if (usecalllists) |
---|
| 6298 | + if (usecalllists && bRep.displaylist > 0) |
---|
5864 | 6299 | { |
---|
5865 | 6300 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5866 | 6301 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5869 | 6304 | CallList(display, root, selected, blocked); |
---|
5870 | 6305 | |
---|
5871 | 6306 | // compiled = true; |
---|
5872 | | - if (usecalllists) |
---|
| 6307 | + if (usecalllists && bRep.displaylist > 0) |
---|
5873 | 6308 | { |
---|
5874 | 6309 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5875 | 6310 | display.EndList(); |
---|
.. | .. |
---|
5879 | 6314 | Globals.lighttouched = true; // all panes... |
---|
5880 | 6315 | } |
---|
5881 | 6316 | |
---|
5882 | | - touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
5883 | | - //touched = false; |
---|
| 6317 | + //touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false; |
---|
| 6318 | + touched = false; |
---|
5884 | 6319 | |
---|
5885 | 6320 | if (this instanceof Texture || this instanceof TextureNode) |
---|
5886 | 6321 | { |
---|
.. | .. |
---|
5981 | 6416 | { |
---|
5982 | 6417 | drawSelf(display, root, selected, blocked); |
---|
5983 | 6418 | } |
---|
| 6419 | + |
---|
| 6420 | +// if (!(this instanceof Composite)) |
---|
| 6421 | +// { |
---|
| 6422 | +// for (int i = 0; i < size(); i++) |
---|
| 6423 | +// { |
---|
| 6424 | +// Object3D child = (Object3D) reserve(i); |
---|
| 6425 | +// if (child == null) |
---|
| 6426 | +// continue; |
---|
| 6427 | +// |
---|
| 6428 | +// child.draw(display, root, selected, blocked); |
---|
| 6429 | +// |
---|
| 6430 | +// release(i); |
---|
| 6431 | +// } |
---|
| 6432 | +// } |
---|
5984 | 6433 | } else |
---|
5985 | 6434 | { |
---|
5986 | 6435 | /* |
---|
.. | .. |
---|
6013 | 6462 | boolean failedPigment = false; |
---|
6014 | 6463 | boolean failedBump = false; |
---|
6015 | 6464 | |
---|
| 6465 | + CameraPane.lastObject = this; |
---|
6016 | 6466 | try |
---|
6017 | 6467 | { |
---|
6018 | 6468 | display.BindPigmentTexture(tex, texres); |
---|
6019 | 6469 | } |
---|
6020 | 6470 | catch (Exception e) |
---|
6021 | 6471 | { |
---|
6022 | | - System.err.println("FAILED: " + this); |
---|
| 6472 | + // System.err.println("FAILED: " + this); |
---|
6023 | 6473 | failedPigment = true; |
---|
6024 | 6474 | } |
---|
6025 | 6475 | |
---|
.. | .. |
---|
6050 | 6500 | display.CallList(bRep.displaylist); |
---|
6051 | 6501 | // june 2013 drawSelf(display, root, selected); |
---|
6052 | 6502 | } |
---|
| 6503 | + } |
---|
| 6504 | + |
---|
| 6505 | + assert (!(this instanceof Composite)); |
---|
| 6506 | + { |
---|
| 6507 | +// CRASH MOCAP!! for (int i = 0; i < size(); i++) |
---|
| 6508 | +// { |
---|
| 6509 | +// Object3D child = (Object3D) reserve(i); |
---|
| 6510 | +// if (child == null) |
---|
| 6511 | +// continue; |
---|
| 6512 | +// |
---|
| 6513 | +// child.draw(display, root, selected, blocked); |
---|
| 6514 | +// |
---|
| 6515 | +// release(i); |
---|
| 6516 | +// } |
---|
6053 | 6517 | } |
---|
6054 | 6518 | } |
---|
6055 | 6519 | |
---|
.. | .. |
---|
6103 | 6567 | |
---|
6104 | 6568 | void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
6105 | 6569 | { |
---|
6106 | | - if (GetBRep() == null) |
---|
6107 | | - { |
---|
6108 | | - drawSelf(display, root, selected, blocked); |
---|
6109 | | - } else |
---|
| 6570 | + if (GetBRep() != null) |
---|
6110 | 6571 | { |
---|
6111 | 6572 | DrawNode(display, root, selected); |
---|
6112 | 6573 | if (this instanceof BezierPatch) |
---|
6113 | 6574 | { |
---|
6114 | 6575 | //drawSelf(display, root, selected); |
---|
6115 | 6576 | } |
---|
| 6577 | + } |
---|
| 6578 | + else |
---|
| 6579 | + { |
---|
| 6580 | + drawSelf(display, root, selected, blocked); |
---|
6116 | 6581 | } |
---|
6117 | 6582 | } |
---|
6118 | 6583 | |
---|
.. | .. |
---|
7220 | 7685 | } |
---|
7221 | 7686 | } |
---|
7222 | 7687 | |
---|
7223 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7688 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7689 | + |
---|
| 7690 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7691 | + Point outPt, Rectangle outRec) |
---|
7224 | 7692 | { |
---|
7225 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7226 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7227 | | - double[][] toscreen = info.toScreen; |
---|
| 7693 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7694 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7695 | + double[][] toscreen = clickInfo.toScreen; |
---|
7228 | 7696 | if (toscreen == null) |
---|
7229 | 7697 | { |
---|
7230 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7698 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7231 | 7699 | } |
---|
7232 | 7700 | cVector vec = in; |
---|
7233 | 7701 | LA.xformPos(in, toscreen, in); |
---|
7234 | 7702 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7235 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7236 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7703 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7704 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7237 | 7705 | outPt.x = hc + (int) vec.x; |
---|
7238 | 7706 | outPt.y = vc - (int) vec.y; |
---|
7239 | 7707 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7241 | 7709 | outRec.width = outRec.height = 6; |
---|
7242 | 7710 | } |
---|
7243 | 7711 | |
---|
7244 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7712 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7713 | + ) |
---|
7245 | 7714 | { |
---|
7246 | 7715 | Point pt = new Point(0, 0); |
---|
7247 | 7716 | Rectangle rec = new Rectangle(); |
---|
7248 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7717 | + calcHotSpot(in, //clickInfo, |
---|
| 7718 | + pt, rec); |
---|
7249 | 7719 | return rec; |
---|
7250 | 7720 | } |
---|
7251 | 7721 | |
---|
7252 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7722 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7723 | + int level) |
---|
7253 | 7724 | { |
---|
7254 | 7725 | if (level == 0) |
---|
7255 | 7726 | { |
---|
.. | .. |
---|
7258 | 7729 | { |
---|
7259 | 7730 | cVector origin = new cVector(); |
---|
7260 | 7731 | //LA.xformPos(origin, toParent, origin); |
---|
7261 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7732 | + if (this.clickInfo == null) |
---|
| 7733 | + this.clickInfo = new ClickInfo(); |
---|
| 7734 | + |
---|
| 7735 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7262 | 7736 | Rectangle boundary = new Rectangle(); |
---|
7263 | 7737 | boundary.x = spot.x - 30; |
---|
7264 | 7738 | boundary.y = spot.y - 30; |
---|
7265 | 7739 | boundary.width = spot.width + 60; |
---|
7266 | 7740 | boundary.height = spot.height + 60; |
---|
7267 | | - info.g.setColor(Color.red); |
---|
| 7741 | + clickInfo.g.setColor(Color.white); |
---|
7268 | 7742 | int spotw = spot.x + spot.width; |
---|
7269 | 7743 | int spoth = spot.y + spot.height; |
---|
7270 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7744 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7271 | 7745 | // if (CameraPane.Xmin > spot.x) |
---|
7272 | 7746 | // { |
---|
7273 | 7747 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7284 | 7758 | // { |
---|
7285 | 7759 | // CameraPane.Ymax = spoth; |
---|
7286 | 7760 | // } |
---|
7287 | | - spot.translate(32, 32); |
---|
7288 | | - spotw = spot.x + spot.width; |
---|
7289 | | - spoth = spot.y + spot.height; |
---|
7290 | | - info.g.setColor(Color.cyan); |
---|
7291 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7292 | 7761 | // if (CameraPane.Xmin > spot.x) |
---|
7293 | 7762 | // { |
---|
7294 | 7763 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7307 | 7776 | // } |
---|
7308 | 7777 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7309 | 7778 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7310 | | - spot.translate(0, -32); |
---|
7311 | | - info.g.setColor(Color.yellow); |
---|
7312 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7313 | | - info.g.setColor(Color.green); |
---|
| 7779 | + spot.translate(32, 0); |
---|
| 7780 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7781 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7782 | + |
---|
| 7783 | + spot.translate(32, 64); |
---|
| 7784 | + spotw = spot.x + spot.width; |
---|
| 7785 | + spoth = spot.y + spot.height; |
---|
| 7786 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7787 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7314 | 7788 | // if (CameraPane.Xmin > spot.x) |
---|
7315 | 7789 | // { |
---|
7316 | 7790 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7327 | 7801 | // { |
---|
7328 | 7802 | // CameraPane.Ymax = spoth; |
---|
7329 | 7803 | // } |
---|
7330 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7331 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
| 7804 | + clickInfo.g.setColor(Color.green); |
---|
| 7805 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7806 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7332 | 7807 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7333 | 7808 | // if (CameraPane.Xmin > boundary.x) |
---|
7334 | 7809 | // { |
---|
.. | .. |
---|
7350 | 7825 | } |
---|
7351 | 7826 | } |
---|
7352 | 7827 | |
---|
7353 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7828 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7829 | + int level) |
---|
7354 | 7830 | { |
---|
7355 | 7831 | if (level == 0) |
---|
7356 | 7832 | { |
---|
.. | .. |
---|
7359 | 7835 | |
---|
7360 | 7836 | boolean retval = false; |
---|
7361 | 7837 | |
---|
7362 | | - startX = info.x; |
---|
7363 | | - startY = info.y; |
---|
| 7838 | + startX = clickInfo.x; |
---|
| 7839 | + startY = clickInfo.y; |
---|
7364 | 7840 | |
---|
7365 | 7841 | hitSomething = -1; |
---|
7366 | 7842 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7370 | 7846 | { |
---|
7371 | 7847 | centerPt = new Point(0, 0); |
---|
7372 | 7848 | } |
---|
7373 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7374 | | - if (spot.contains(info.x, info.y)) |
---|
| 7849 | + calcHotSpot(origin, //info, |
---|
| 7850 | + centerPt, spot); |
---|
| 7851 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7375 | 7852 | { |
---|
7376 | 7853 | hitSomething = hitCenter; |
---|
7377 | 7854 | retval = true; |
---|
7378 | 7855 | } |
---|
7379 | 7856 | spot.translate(32, 0); |
---|
7380 | | - if (spot.contains(info.x, info.y)) |
---|
| 7857 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7381 | 7858 | { |
---|
7382 | 7859 | hitSomething = hitRotate; |
---|
7383 | 7860 | retval = true; |
---|
7384 | 7861 | } |
---|
7385 | 7862 | spot.translate(0, 32); |
---|
7386 | | - if (spot.contains(info.x, info.y)) |
---|
| 7863 | + spot.translate(32, 0); |
---|
| 7864 | + spot.translate(0, 32); |
---|
| 7865 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7387 | 7866 | { |
---|
7388 | 7867 | hitSomething = hitScale; |
---|
| 7868 | + |
---|
| 7869 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7870 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7871 | + double sign = 1; |
---|
| 7872 | + if (hScale < 0) |
---|
| 7873 | + { |
---|
| 7874 | + sign = -1; |
---|
| 7875 | + } |
---|
| 7876 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7877 | + if (hScale < 0.01) |
---|
| 7878 | + { |
---|
| 7879 | + //hScale = 0.01; |
---|
| 7880 | + } |
---|
| 7881 | + |
---|
| 7882 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7883 | + sign = 1; |
---|
| 7884 | + if (vScale < 0) |
---|
| 7885 | + { |
---|
| 7886 | + sign = -1; |
---|
| 7887 | + } |
---|
| 7888 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7889 | + if (vScale < 0.01) |
---|
| 7890 | + { |
---|
| 7891 | + //vScale = 0.01; |
---|
| 7892 | + } |
---|
| 7893 | + |
---|
| 7894 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7895 | + |
---|
7389 | 7896 | retval = true; |
---|
7390 | 7897 | } |
---|
7391 | 7898 | |
---|
.. | .. |
---|
7395 | 7902 | } |
---|
7396 | 7903 | |
---|
7397 | 7904 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7398 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7905 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7399 | 7906 | //System.out.println("modified = " + modified); |
---|
7400 | 7907 | //new Exception().printStackTrace(); |
---|
7401 | 7908 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7423 | 7930 | return true; |
---|
7424 | 7931 | } |
---|
7425 | 7932 | |
---|
7426 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7933 | + void doEditDrag0(//ClickInfo info, |
---|
| 7934 | + boolean opposite) |
---|
7427 | 7935 | { |
---|
7428 | 7936 | if (hitSomething == 0) |
---|
7429 | 7937 | { |
---|
.. | .. |
---|
7437 | 7945 | |
---|
7438 | 7946 | //System.out.println("hitSomething = " + hitSomething); |
---|
7439 | 7947 | |
---|
7440 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7948 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7441 | 7949 | |
---|
7442 | 7950 | cVector xlate = new cVector(); |
---|
7443 | 7951 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7451 | 7959 | |
---|
7452 | 7960 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7453 | 7961 | |
---|
7454 | | - if (modified || opposite) |
---|
| 7962 | + // Modified could snap |
---|
| 7963 | + if (//modified || |
---|
| 7964 | + opposite) |
---|
7455 | 7965 | { |
---|
7456 | 7966 | //assert(false); |
---|
7457 | 7967 | /* |
---|
.. | .. |
---|
7471 | 7981 | toParent[3][i] = xlate.get(i); |
---|
7472 | 7982 | LA.matInvert(toParent, fromParent); |
---|
7473 | 7983 | */ |
---|
7474 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7475 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7984 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7985 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7476 | 7986 | |
---|
7477 | 7987 | LA.matCopy(startMat, toParent); |
---|
7478 | 7988 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7481 | 7991 | } else |
---|
7482 | 7992 | { |
---|
7483 | 7993 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7484 | | - cVector up = new cVector(info.camera.up); |
---|
| 7994 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7485 | 7995 | cVector away = new cVector(); |
---|
7486 | 7996 | //cVector right2 = new cVector(); |
---|
7487 | 7997 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7498 | 8008 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7499 | 8009 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7500 | 8010 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7501 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 8011 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7502 | 8012 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7503 | 8013 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7504 | 8014 | //LA.vecCross(up, cVector.Z, right2); |
---|
7505 | 8015 | |
---|
7506 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 8016 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7507 | 8017 | |
---|
7508 | 8018 | //System.out.println("DELTA0 = " + delta); |
---|
7509 | 8019 | //System.out.println("AWAY = " + info.camera.away); |
---|
7510 | 8020 | //System.out.println("UP = " + info.camera.up); |
---|
7511 | 8021 | if (away.z > 0) |
---|
7512 | 8022 | { |
---|
7513 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 8023 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7514 | 8024 | { |
---|
7515 | 8025 | delta.x = -delta.x; |
---|
7516 | 8026 | } else |
---|
.. | .. |
---|
7525 | 8035 | //System.out.println("DELTA1 = " + delta); |
---|
7526 | 8036 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7527 | 8037 | //System.out.println("DELTA2 = " + delta); |
---|
7528 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 8038 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7529 | 8039 | LA.matCopy(startMat, toParent); |
---|
7530 | 8040 | //System.out.println("DELTA3 = " + delta); |
---|
7531 | 8041 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7535 | 8045 | break; |
---|
7536 | 8046 | |
---|
7537 | 8047 | case hitRotate: // rotate |
---|
7538 | | - int dx = info.x - centerPt.x; |
---|
7539 | | - int dy = -(info.y - centerPt.y); |
---|
| 8048 | + int dx = clickInfo.x - centerPt.x; |
---|
| 8049 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7540 | 8050 | double angle = (double) Math.atan2(dx, dy); |
---|
7541 | 8051 | angle = -(1.570796 - angle); |
---|
7542 | 8052 | |
---|
.. | .. |
---|
7545 | 8055 | |
---|
7546 | 8056 | if (modified) |
---|
7547 | 8057 | { |
---|
7548 | | - // Rotate 90 degrees |
---|
| 8058 | + // Rotate 45 degrees |
---|
7549 | 8059 | angle /= (Math.PI / 4); |
---|
7550 | 8060 | angle = Math.floor(angle + 0.5); |
---|
7551 | 8061 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7559 | 8069 | } |
---|
7560 | 8070 | /**/ |
---|
7561 | 8071 | |
---|
7562 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 8072 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7563 | 8073 | { |
---|
7564 | 8074 | case 1: // '\001' |
---|
7565 | 8075 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7586 | 8096 | break; |
---|
7587 | 8097 | |
---|
7588 | 8098 | case hitScale: // scale |
---|
7589 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 8099 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7590 | 8100 | double sign = 1; |
---|
7591 | 8101 | if (hScale < 0) |
---|
7592 | 8102 | { |
---|
.. | .. |
---|
7598 | 8108 | //hScale = 0.01; |
---|
7599 | 8109 | } |
---|
7600 | 8110 | |
---|
7601 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 8111 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7602 | 8112 | sign = 1; |
---|
7603 | 8113 | if (vScale < 0) |
---|
7604 | 8114 | { |
---|
.. | .. |
---|
7609 | 8119 | { |
---|
7610 | 8120 | //vScale = 0.01; |
---|
7611 | 8121 | } |
---|
| 8122 | + |
---|
7612 | 8123 | LA.matCopy(startMat, toParent); |
---|
7613 | 8124 | /**/ |
---|
7614 | 8125 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7618 | 8129 | } |
---|
7619 | 8130 | /**/ |
---|
7620 | 8131 | |
---|
7621 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 8132 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7622 | 8133 | |
---|
7623 | 8134 | if (totalScale < 0.01) |
---|
7624 | 8135 | { |
---|
7625 | 8136 | totalScale = 0.01; |
---|
7626 | 8137 | } |
---|
7627 | 8138 | |
---|
7628 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 8139 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7629 | 8140 | { |
---|
7630 | 8141 | case 3: // '\001' |
---|
7631 | 8142 | if (modified || opposite) |
---|
7632 | 8143 | { |
---|
| 8144 | + if (modified) // && opposite) |
---|
| 8145 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8146 | + else |
---|
7633 | 8147 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7634 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 8148 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7635 | 8149 | } // vScale, 1); |
---|
7636 | 8150 | else |
---|
7637 | 8151 | { |
---|
7638 | 8152 | // EXCEPTION! |
---|
7639 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8153 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7640 | 8154 | } // vScale, 1); |
---|
7641 | 8155 | break; |
---|
7642 | 8156 | |
---|
7643 | 8157 | case 2: // '\002' |
---|
7644 | 8158 | if (modified || opposite) |
---|
7645 | 8159 | { |
---|
7646 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7647 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 8160 | + if (modified) // && opposite) |
---|
| 8161 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8162 | + else |
---|
| 8163 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 8164 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7648 | 8165 | } else |
---|
7649 | 8166 | { |
---|
7650 | 8167 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7654 | 8171 | case 1: // '\003' |
---|
7655 | 8172 | if (modified || opposite) |
---|
7656 | 8173 | { |
---|
7657 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7658 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 8174 | + if (modified) // && opposite) |
---|
| 8175 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8176 | + else |
---|
| 8177 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 8178 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7659 | 8179 | } else |
---|
7660 | 8180 | { |
---|
7661 | 8181 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7692 | 8212 | } // NEW ... |
---|
7693 | 8213 | |
---|
7694 | 8214 | |
---|
7695 | | - info.pane.repaint(); |
---|
| 8215 | + clickInfo.pane.repaint(); |
---|
7696 | 8216 | } |
---|
7697 | 8217 | |
---|
7698 | 8218 | boolean overflow = false; |
---|
.. | .. |
---|
7806 | 8326 | if (!Globals.ADVANCED) |
---|
7807 | 8327 | return objname; |
---|
7808 | 8328 | |
---|
7809 | | - return objname + " " + System.identityHashCode(this); |
---|
| 8329 | + return objname + " " + System.identityHashCode(this) + " " + GetUUID(); |
---|
7810 | 8330 | } |
---|
7811 | 8331 | |
---|
7812 | 8332 | public int hashCode() |
---|