.. | .. |
---|
33 | 33 | String skyboxname; |
---|
34 | 34 | String skyboxext; |
---|
35 | 35 | |
---|
36 | | - Object3D versionlist[]; |
---|
| 36 | + Object3D[] versionlist; |
---|
37 | 37 | int versionindex = -1; |
---|
38 | 38 | |
---|
39 | 39 | java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
40 | 40 | |
---|
41 | 41 | ScriptNode scriptnode; |
---|
| 42 | + |
---|
| 43 | + void deepCopyNode(Object3D other) |
---|
| 44 | + { |
---|
| 45 | + other.skyboxname = skyboxname; |
---|
| 46 | + other.skyboxext = skyboxext; |
---|
| 47 | + |
---|
| 48 | + if (toParent != null) |
---|
| 49 | + { |
---|
| 50 | + other.toParent = LA.newMatrix(); |
---|
| 51 | + other.fromParent = LA.newMatrix(); |
---|
| 52 | + LA.matCopy(toParent, other.toParent); |
---|
| 53 | + LA.matCopy(fromParent, other.fromParent); |
---|
| 54 | + if (toParentMarked != null) |
---|
| 55 | + { |
---|
| 56 | + other.toParentMarked = LA.newMatrix(); |
---|
| 57 | + other.fromParentMarked = LA.newMatrix(); |
---|
| 58 | + LA.matCopy(toParentMarked, other.toParentMarked); |
---|
| 59 | + LA.matCopy(fromParentMarked, other.fromParentMarked); |
---|
| 60 | + } |
---|
| 61 | + } |
---|
| 62 | + else |
---|
| 63 | + { |
---|
| 64 | + if (other.toParent == null) |
---|
| 65 | +// assert(other.toParent == null); |
---|
| 66 | +// new Exception().printStackTrace(); |
---|
| 67 | + System.err.println("null parent: " + other); |
---|
| 68 | + } |
---|
| 69 | + |
---|
| 70 | + /* |
---|
| 71 | + double ident[][] = LA.newMatrix(); |
---|
| 72 | + if (bRep == null) |
---|
| 73 | + other.bRep = null; |
---|
| 74 | + else |
---|
| 75 | + other.bRep = new BoundaryRep(bRep, ident); |
---|
| 76 | + */ |
---|
| 77 | + // Really new... |
---|
| 78 | + //other.editWindow = null; |
---|
| 79 | + if (name == null) |
---|
| 80 | + other.name = null; |
---|
| 81 | + else |
---|
| 82 | + other.name = new String(name); |
---|
| 83 | + |
---|
| 84 | + if (material != null) |
---|
| 85 | + { |
---|
| 86 | + other.material = new cMaterial(material); |
---|
| 87 | + } else |
---|
| 88 | + { |
---|
| 89 | + other.material = null; |
---|
| 90 | + } |
---|
| 91 | + |
---|
| 92 | + other.GetTextures().name = GetTextures().name; |
---|
| 93 | + |
---|
| 94 | + CopyExtraMaterial(other); |
---|
| 95 | + |
---|
| 96 | + other.touched = touched; |
---|
| 97 | + other.softtouched = softtouched; |
---|
| 98 | + |
---|
| 99 | + other.random = random; |
---|
| 100 | + other.link2master = link2master; |
---|
| 101 | + other.transformcount = transformcount; |
---|
| 102 | + other.marked = marked; |
---|
| 103 | + other.skip = skip; |
---|
| 104 | + other.count = count; |
---|
| 105 | + other.flipV = flipV; |
---|
| 106 | + other.live = live; |
---|
| 107 | + other.rewind = rewind; |
---|
| 108 | + other.hide = hide; |
---|
| 109 | + other.texres = texres; |
---|
| 110 | + other.speedup = speedup; |
---|
| 111 | + other.height = height; |
---|
| 112 | + other.depth = depth; |
---|
| 113 | + } |
---|
42 | 114 | |
---|
43 | 115 | int VersionCount() |
---|
44 | 116 | { |
---|
.. | .. |
---|
190 | 262 | } |
---|
191 | 263 | } |
---|
192 | 264 | |
---|
| 265 | + boolean HasBigData() |
---|
| 266 | + { |
---|
| 267 | + if (blockloop) |
---|
| 268 | + return false; |
---|
| 269 | + |
---|
| 270 | + if (bRep != null) |
---|
| 271 | + { |
---|
| 272 | + return true; |
---|
| 273 | + } |
---|
| 274 | + |
---|
| 275 | + blockloop = true; |
---|
| 276 | + |
---|
| 277 | + for (int i = 0; i < Size(); i++) |
---|
| 278 | + { |
---|
| 279 | + Object3D child = (Object3D) get(i); |
---|
| 280 | + if (child == null) |
---|
| 281 | + continue; |
---|
| 282 | + if (child.HasBigData()) |
---|
| 283 | + { |
---|
| 284 | + blockloop = false; |
---|
| 285 | + return true; |
---|
| 286 | + } |
---|
| 287 | + } |
---|
| 288 | + |
---|
| 289 | + blockloop = false; |
---|
| 290 | + return false; |
---|
| 291 | + } |
---|
| 292 | + |
---|
193 | 293 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
194 | 294 | { |
---|
| 295 | + if (blockloop) |
---|
| 296 | + return; |
---|
| 297 | + |
---|
195 | 298 | Object3D o; |
---|
196 | 299 | |
---|
197 | 300 | boolean isnew = false; |
---|
.. | .. |
---|
215 | 318 | hashtable.put(GetUUID(), o); |
---|
216 | 319 | } |
---|
217 | 320 | |
---|
218 | | - if (!blockloop) |
---|
| 321 | + //if (!blockloop) |
---|
219 | 322 | { |
---|
220 | 323 | blockloop = true; |
---|
221 | 324 | |
---|
.. | .. |
---|
227 | 330 | blockloop = false; |
---|
228 | 331 | } |
---|
229 | 332 | |
---|
230 | | - if (isnew) |
---|
| 333 | + //if (isnew) |
---|
231 | 334 | ExtractBigData(o); |
---|
232 | 335 | } |
---|
233 | 336 | |
---|
.. | .. |
---|
338 | 441 | |
---|
339 | 442 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
340 | 443 | { |
---|
| 444 | + if (blockloop) |
---|
| 445 | + return; |
---|
| 446 | + |
---|
341 | 447 | if (!hashtable.containsKey(GetUUID())) |
---|
342 | 448 | return; |
---|
343 | 449 | |
---|
344 | 450 | Object3D o = hashtable.get(GetUUID()); |
---|
345 | 451 | |
---|
346 | 452 | RestoreBigData(o); |
---|
347 | | - |
---|
348 | | - if (blockloop) |
---|
349 | | - return; |
---|
350 | 453 | |
---|
351 | 454 | blockloop = true; |
---|
352 | 455 | |
---|
.. | .. |
---|
363 | 466 | void RestoreBigData(Object3D o) |
---|
364 | 467 | { |
---|
365 | 468 | //System.err.println("RestoreBigData : " + this + " <-- " + o); |
---|
| 469 | + Grafreed.Assert(this.bRep == null); |
---|
366 | 470 | |
---|
367 | 471 | this.bRep = o.bRep; |
---|
368 | 472 | if (this.support != null && o.transientrep != null) |
---|
.. | .. |
---|
1199 | 1303 | |
---|
1200 | 1304 | // will share the geometry |
---|
1201 | 1305 | assert (!(this instanceof Composite)); |
---|
1202 | | - return deepCopy(); // Never called for Composite |
---|
1203 | | - |
---|
| 1306 | + |
---|
| 1307 | + Object3D obj = deepCopy(); // Never called for Composite |
---|
| 1308 | + obj.count = 2; |
---|
| 1309 | + return obj; |
---|
1204 | 1310 | } |
---|
1205 | 1311 | |
---|
1206 | 1312 | boolean HasLoops() |
---|
.. | .. |
---|
1278 | 1384 | return; |
---|
1279 | 1385 | |
---|
1280 | 1386 | blockloop = true; |
---|
| 1387 | + |
---|
| 1388 | + other.parent = parent; |
---|
| 1389 | + |
---|
1281 | 1390 | //System.out.println("COPY " + this + " to " + other); |
---|
1282 | 1391 | //new Exception().printStackTrace(); |
---|
| 1392 | + deepCopyNode(other); |
---|
1283 | 1393 | |
---|
1284 | | - other.parent = parent; |
---|
1285 | | - if (toParent != null) |
---|
1286 | | - { |
---|
1287 | | - other.toParent = LA.newMatrix(); |
---|
1288 | | - other.fromParent = LA.newMatrix(); |
---|
1289 | | - LA.matCopy(toParent, other.toParent); |
---|
1290 | | - LA.matCopy(fromParent, other.fromParent); |
---|
1291 | | - if (toParentMarked != null) |
---|
1292 | | - { |
---|
1293 | | - other.toParentMarked = LA.newMatrix(); |
---|
1294 | | - other.fromParentMarked = LA.newMatrix(); |
---|
1295 | | - LA.matCopy(toParentMarked, other.toParentMarked); |
---|
1296 | | - LA.matCopy(fromParentMarked, other.fromParentMarked); |
---|
1297 | | - } |
---|
1298 | | - } |
---|
1299 | | - else |
---|
1300 | | - { |
---|
1301 | | - if (other.toParent == null) |
---|
1302 | | -// assert(other.toParent == null); |
---|
1303 | | -// new Exception().printStackTrace(); |
---|
1304 | | - System.err.println("null parent: " + other); |
---|
1305 | | - } |
---|
1306 | | - /* |
---|
1307 | | - double ident[][] = LA.newMatrix(); |
---|
1308 | | - if (bRep == null) |
---|
1309 | | - other.bRep = null; |
---|
1310 | | - else |
---|
1311 | | - other.bRep = new BoundaryRep(bRep, ident); |
---|
1312 | | - */ |
---|
1313 | | - // Really new... |
---|
1314 | 1394 | other.bRep = bRep; // Share the geometry |
---|
1315 | 1395 | |
---|
1316 | 1396 | other.support = support; // Share the support |
---|
1317 | | - |
---|
1318 | | - //other.editWindow = null; |
---|
1319 | | - if (name == null) |
---|
1320 | | - other.name = null; |
---|
1321 | | - else |
---|
1322 | | - other.name = new String(name); |
---|
1323 | | - |
---|
1324 | | - if (material != null) |
---|
1325 | | - { |
---|
1326 | | - other.material = new cMaterial(material); |
---|
1327 | | - } else |
---|
1328 | | - { |
---|
1329 | | - other.material = null; |
---|
1330 | | - } |
---|
1331 | | - |
---|
1332 | | - other.GetTextures().name = GetTextures().name; |
---|
1333 | | - |
---|
1334 | | - CopyExtraMaterial(other); |
---|
1335 | | - |
---|
1336 | | - other.touched = touched; |
---|
1337 | | - other.softtouched = softtouched; |
---|
1338 | | - |
---|
1339 | | - other.random = random; |
---|
1340 | | - other.link2master = link2master; |
---|
1341 | | - other.transformcount = transformcount; |
---|
1342 | | - other.marked = marked; |
---|
1343 | | - other.skip = skip; |
---|
1344 | | - other.count = count; |
---|
1345 | | - other.flipV = flipV; |
---|
1346 | | - other.live = live; |
---|
1347 | | - other.rewind = rewind; |
---|
1348 | | - other.hide = hide; |
---|
1349 | | - other.texres = texres; |
---|
1350 | | - other.speedup = speedup; |
---|
1351 | | - other.height = height; |
---|
1352 | | - other.depth = depth; |
---|
1353 | 1397 | |
---|
1354 | 1398 | // aout 2013 if (/*displaylist != -1 &&*/other.displaylist != displaylist) |
---|
1355 | 1399 | // { |
---|
.. | .. |
---|
1405 | 1449 | if ((mask & GEOMETRY) != 0) |
---|
1406 | 1450 | { |
---|
1407 | 1451 | if (bRep != null) |
---|
1408 | | - bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep); |
---|
1409 | | - else |
---|
1410 | | - assert(other.bRep == null); |
---|
1411 | | - |
---|
1412 | | - if (bRep != null) |
---|
1413 | 1452 | { |
---|
| 1453 | + bRep.overwriteThis(other.bRep==null?other.transientrep:other.bRep); |
---|
1414 | 1454 | CameraPane.RemoveList(bRep.displaylist); |
---|
1415 | 1455 | bRep.displaylist = 0; // june 2013 -1; |
---|
1416 | 1456 | } |
---|
1417 | 1457 | else |
---|
1418 | | - bRep = bRep; |
---|
| 1458 | + { |
---|
| 1459 | + //assert(other.bRep == null); |
---|
| 1460 | + bRep = other.bRep; |
---|
| 1461 | + } |
---|
| 1462 | + |
---|
| 1463 | +// if (bRep != null) |
---|
| 1464 | +// { |
---|
| 1465 | +// CameraPane.RemoveList(bRep.displaylist); |
---|
| 1466 | +// bRep.displaylist = 0; // june 2013 -1; |
---|
| 1467 | +// } |
---|
| 1468 | +// else |
---|
| 1469 | +// bRep = bRep; |
---|
1419 | 1470 | } |
---|
1420 | 1471 | |
---|
1421 | 1472 | /* Use a MASK = GEO/MAT |
---|
.. | .. |
---|
3324 | 3375 | } |
---|
3325 | 3376 | } |
---|
3326 | 3377 | |
---|
| 3378 | + public void Scale(int scale) |
---|
| 3379 | + { |
---|
| 3380 | + Object3D obj = this; |
---|
| 3381 | + |
---|
| 3382 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = scale; |
---|
| 3383 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3384 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3385 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1/scale; |
---|
| 3386 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3387 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3388 | + } |
---|
| 3389 | + |
---|
3327 | 3390 | public void TextureRatioTransform(int axis) |
---|
3328 | 3391 | { |
---|
3329 | 3392 | cTexture tex = GetTextures(); |
---|
.. | .. |
---|
4216 | 4279 | max = new cVector(); |
---|
4217 | 4280 | } |
---|
4218 | 4281 | |
---|
4219 | | - for (int i = 0; i<size(); i++) |
---|
| 4282 | + for (int i = 0; i<Size(); i++) |
---|
4220 | 4283 | { |
---|
4221 | | - Object3D child = (Object3D) reserve(i); |
---|
| 4284 | + Object3D child = (Object3D) get(i); //reserve(i); |
---|
4222 | 4285 | if (child == null) |
---|
4223 | 4286 | continue; |
---|
4224 | 4287 | |
---|
.. | .. |
---|
4237 | 4300 | if (child.hide && !(child instanceof Merge) || child.skip) |
---|
4238 | 4301 | //if (child.hide) |
---|
4239 | 4302 | { |
---|
4240 | | - release(i); |
---|
| 4303 | + //release(i); |
---|
4241 | 4304 | continue; |
---|
4242 | 4305 | } |
---|
4243 | 4306 | |
---|
4244 | 4307 | blockloop = true; |
---|
4245 | 4308 | child.getBounds(min, max, true); // xform); |
---|
4246 | 4309 | blockloop = false; |
---|
4247 | | - release(i); |
---|
| 4310 | + //release(i); |
---|
4248 | 4311 | |
---|
4249 | 4312 | MinMax(minima, maxima); |
---|
4250 | 4313 | } |
---|
.. | .. |
---|
6313 | 6376 | { |
---|
6314 | 6377 | drawSelf(display, root, selected, blocked); |
---|
6315 | 6378 | } |
---|
| 6379 | + |
---|
| 6380 | +// if (!(this instanceof Composite)) |
---|
| 6381 | +// { |
---|
| 6382 | +// for (int i = 0; i < size(); i++) |
---|
| 6383 | +// { |
---|
| 6384 | +// Object3D child = (Object3D) reserve(i); |
---|
| 6385 | +// if (child == null) |
---|
| 6386 | +// continue; |
---|
| 6387 | +// |
---|
| 6388 | +// child.draw(display, root, selected, blocked); |
---|
| 6389 | +// |
---|
| 6390 | +// release(i); |
---|
| 6391 | +// } |
---|
| 6392 | +// } |
---|
6316 | 6393 | } else |
---|
6317 | 6394 | { |
---|
6318 | 6395 | /* |
---|
.. | .. |
---|
6351 | 6428 | } |
---|
6352 | 6429 | catch (Exception e) |
---|
6353 | 6430 | { |
---|
6354 | | - System.err.println("FAILED: " + this); |
---|
| 6431 | + // System.err.println("FAILED: " + this); |
---|
6355 | 6432 | failedPigment = true; |
---|
6356 | 6433 | } |
---|
6357 | 6434 | |
---|
.. | .. |
---|
6381 | 6458 | assert(bRep.displaylist != 0); |
---|
6382 | 6459 | display.CallList(bRep.displaylist); |
---|
6383 | 6460 | // june 2013 drawSelf(display, root, selected); |
---|
| 6461 | + } |
---|
| 6462 | + } |
---|
| 6463 | + |
---|
| 6464 | + assert (!(this instanceof Composite)); |
---|
| 6465 | + { |
---|
| 6466 | + for (int i = 0; i < size(); i++) |
---|
| 6467 | + { |
---|
| 6468 | + Object3D child = (Object3D) reserve(i); |
---|
| 6469 | + if (child == null) |
---|
| 6470 | + continue; |
---|
| 6471 | + |
---|
| 6472 | + child.draw(display, root, selected, blocked); |
---|
| 6473 | + |
---|
| 6474 | + release(i); |
---|
6384 | 6475 | } |
---|
6385 | 6476 | } |
---|
6386 | 6477 | } |
---|
.. | .. |
---|
6435 | 6526 | |
---|
6436 | 6527 | void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
6437 | 6528 | { |
---|
6438 | | - if (GetBRep() == null) |
---|
6439 | | - { |
---|
6440 | | - drawSelf(display, root, selected, blocked); |
---|
6441 | | - } else |
---|
| 6529 | + if (GetBRep() != null) |
---|
6442 | 6530 | { |
---|
6443 | 6531 | DrawNode(display, root, selected); |
---|
6444 | 6532 | if (this instanceof BezierPatch) |
---|
6445 | 6533 | { |
---|
6446 | 6534 | //drawSelf(display, root, selected); |
---|
6447 | 6535 | } |
---|
| 6536 | + } |
---|
| 6537 | + else |
---|
| 6538 | + { |
---|
| 6539 | + drawSelf(display, root, selected, blocked); |
---|
6448 | 6540 | } |
---|
6449 | 6541 | } |
---|
6450 | 6542 | |
---|
.. | .. |
---|
8193 | 8285 | // if (!Globals.ADVANCED) |
---|
8194 | 8286 | // return objname; |
---|
8195 | 8287 | |
---|
8196 | | - return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
| 8288 | + return objname; // + " " + System.identityHashCode(this); // + GetUUID() |
---|
8197 | 8289 | } |
---|
8198 | 8290 | |
---|
8199 | 8291 | public int hashCode() |
---|