.. | .. |
---|
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 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
32 | 33 | String skyboxname; |
---|
33 | 34 | String skyboxext; |
---|
34 | 35 | |
---|
35 | | - byte[] versions[]; |
---|
| 36 | + Object3D versionlist[]; |
---|
36 | 37 | int versionindex = -1; |
---|
37 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
38 | 41 | ScriptNode scriptnode; |
---|
39 | 42 | |
---|
40 | 43 | void InitOthers() |
---|
.. | .. |
---|
222 | 225 | // o.bRep.support = null; |
---|
223 | 226 | // } |
---|
224 | 227 | o.selection = this.selection; |
---|
225 | | - o.versions = this.versions; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
226 | 229 | o.versionindex = this.versionindex; |
---|
227 | 230 | |
---|
228 | 231 | if (this.support != null) |
---|
.. | .. |
---|
244 | 247 | // this.bRep.support = null; |
---|
245 | 248 | // this.support = null; |
---|
246 | 249 | // this.fileparent = null; |
---|
| 250 | + } |
---|
| 251 | + |
---|
| 252 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 253 | +// { |
---|
| 254 | +// if (this.uuid.equals(uuid)) |
---|
| 255 | +// return this; |
---|
| 256 | +// |
---|
| 257 | +// if (blockloop) |
---|
| 258 | +// return null; |
---|
| 259 | +// |
---|
| 260 | +// blockloop = true; |
---|
| 261 | +// |
---|
| 262 | +// for (int i=0; i<Size(); i++) |
---|
| 263 | +// { |
---|
| 264 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 265 | +// |
---|
| 266 | +// if (o != null) |
---|
| 267 | +// return o; |
---|
| 268 | +// } |
---|
| 269 | +// |
---|
| 270 | +// blockloop = false; |
---|
| 271 | +// |
---|
| 272 | +// return null; |
---|
| 273 | +// } |
---|
| 274 | + |
---|
| 275 | + transient boolean tag; |
---|
| 276 | + |
---|
| 277 | + void TagObjects(Object3D o, boolean tag) |
---|
| 278 | + { |
---|
| 279 | + if (blockloop) |
---|
| 280 | + return; |
---|
| 281 | + |
---|
| 282 | + o.tag = tag; |
---|
| 283 | + |
---|
| 284 | + if (o == this) |
---|
| 285 | + return; |
---|
| 286 | + |
---|
| 287 | + blockloop = true; |
---|
| 288 | + |
---|
| 289 | + for (int i=0; i<Size(); i++) |
---|
| 290 | + { |
---|
| 291 | + get(i).TagObjects(o, tag); |
---|
| 292 | + } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
| 295 | + } |
---|
| 296 | + |
---|
| 297 | + boolean HasTags() |
---|
| 298 | + { |
---|
| 299 | + if (blockloop) |
---|
| 300 | + return false; |
---|
| 301 | + |
---|
| 302 | + blockloop = true; |
---|
| 303 | + |
---|
| 304 | + boolean hasTags = false; |
---|
| 305 | + |
---|
| 306 | + for (int i=0; i<Size(); i++) |
---|
| 307 | + { |
---|
| 308 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 309 | + |
---|
| 310 | + if (hasTags) |
---|
| 311 | + break; |
---|
| 312 | + } |
---|
| 313 | + |
---|
| 314 | + blockloop = false; |
---|
| 315 | + |
---|
| 316 | + return hasTags; |
---|
247 | 317 | } |
---|
248 | 318 | |
---|
249 | 319 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
.. | .. |
---|
280 | 350 | |
---|
281 | 351 | this.selection = o.selection; |
---|
282 | 352 | |
---|
283 | | - this.versions = o.versions; |
---|
| 353 | + this.versionlist = o.versionlist; |
---|
284 | 354 | this.versionindex = o.versionindex; |
---|
285 | 355 | // July 2019 if (this.bRep != null) |
---|
286 | 356 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
1014 | 1084 | |
---|
1015 | 1085 | if (material == null || material.multiply) |
---|
1016 | 1086 | return true; |
---|
| 1087 | + |
---|
| 1088 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1089 | + return false; |
---|
1017 | 1090 | |
---|
1018 | 1091 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1019 | 1092 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2441 | 2514 | else |
---|
2442 | 2515 | { |
---|
2443 | 2516 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2517 | + if (objectUI != null) |
---|
| 2518 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2519 | + else |
---|
| 2520 | + //new Exception().printStackTrace(); |
---|
| 2521 | + System.err.println("objectUI is null"); |
---|
2444 | 2522 | } |
---|
2445 | 2523 | } |
---|
2446 | 2524 | |
---|
.. | .. |
---|
5542 | 5620 | if (fullname == null) |
---|
5543 | 5621 | return ""; |
---|
5544 | 5622 | |
---|
| 5623 | + if (fullname.pigment != null) |
---|
| 5624 | + { |
---|
| 5625 | + return fullname.pigment; |
---|
| 5626 | + } |
---|
| 5627 | + |
---|
5545 | 5628 | // System.out.println("Fullname = " + fullname); |
---|
5546 | 5629 | |
---|
5547 | 5630 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5554 | 5637 | |
---|
5555 | 5638 | if (split.length == 0) |
---|
5556 | 5639 | { |
---|
5557 | | - return ""; |
---|
| 5640 | + return fullname.pigment = ""; |
---|
5558 | 5641 | } |
---|
5559 | 5642 | |
---|
5560 | 5643 | if (split.length <= 2) |
---|
.. | .. |
---|
5562 | 5645 | if (fullname.name.endsWith(":")) |
---|
5563 | 5646 | { |
---|
5564 | 5647 | // Windows |
---|
5565 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5648 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5566 | 5649 | } |
---|
5567 | 5650 | |
---|
5568 | | - return split[0]; |
---|
| 5651 | + return fullname.pigment = split[0]; |
---|
5569 | 5652 | } |
---|
5570 | 5653 | |
---|
5571 | 5654 | // Windows |
---|
5572 | 5655 | assert(split.length == 4); |
---|
5573 | 5656 | |
---|
5574 | | - return split[0] + ":" + split[1]; |
---|
| 5657 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5575 | 5658 | } |
---|
5576 | 5659 | |
---|
5577 | 5660 | static String GetBump(cTexture fullname) |
---|
5578 | 5661 | { |
---|
5579 | 5662 | if (fullname == null) |
---|
5580 | 5663 | return ""; |
---|
| 5664 | + |
---|
| 5665 | + if (fullname.bump != null) |
---|
| 5666 | + { |
---|
| 5667 | + return fullname.bump; |
---|
| 5668 | + } |
---|
5581 | 5669 | |
---|
5582 | 5670 | // System.out.println("Fullname = " + fullname); |
---|
5583 | 5671 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5589 | 5677 | |
---|
5590 | 5678 | if (split.length == 0) |
---|
5591 | 5679 | { |
---|
5592 | | - return ""; |
---|
| 5680 | + return fullname.bump = ""; |
---|
5593 | 5681 | } |
---|
5594 | 5682 | |
---|
5595 | 5683 | if (split.length == 1) |
---|
5596 | 5684 | { |
---|
5597 | | - return ""; |
---|
| 5685 | + return fullname.bump = ""; |
---|
5598 | 5686 | } |
---|
5599 | 5687 | |
---|
5600 | 5688 | if (split.length == 2) |
---|
.. | .. |
---|
5602 | 5690 | if (fullname.name.endsWith(":")) |
---|
5603 | 5691 | { |
---|
5604 | 5692 | // Windows |
---|
5605 | | - return ""; |
---|
| 5693 | + return fullname.bump = ""; |
---|
5606 | 5694 | } |
---|
5607 | 5695 | |
---|
5608 | | - return split[1]; |
---|
| 5696 | + return fullname.bump = split[1]; |
---|
5609 | 5697 | } |
---|
5610 | 5698 | |
---|
5611 | 5699 | // Windows |
---|
5612 | 5700 | assert(split.length == 4); |
---|
5613 | 5701 | |
---|
5614 | | - return split[2] + ":" + split[3]; |
---|
| 5702 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5615 | 5703 | } |
---|
5616 | 5704 | |
---|
5617 | 5705 | String GetPigmentTexture() |
---|
.. | .. |
---|
5694 | 5782 | texname = ""; |
---|
5695 | 5783 | |
---|
5696 | 5784 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5785 | + |
---|
| 5786 | + GetTextures().pigment = null; |
---|
| 5787 | + |
---|
5697 | 5788 | Touch(); |
---|
5698 | 5789 | } |
---|
5699 | 5790 | |
---|
.. | .. |
---|
5766 | 5857 | texname = ""; |
---|
5767 | 5858 | |
---|
5768 | 5859 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5860 | + |
---|
| 5861 | + GetTextures().bump = null; |
---|
5769 | 5862 | |
---|
5770 | 5863 | Touch(); |
---|
5771 | 5864 | } |
---|
.. | .. |
---|
5909 | 6002 | if (support != null) |
---|
5910 | 6003 | support = support; |
---|
5911 | 6004 | |
---|
5912 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5913 | | - boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6005 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6006 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6007 | + |
---|
| 6008 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5914 | 6009 | |
---|
5915 | 6010 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5916 | 6011 | { |
---|
.. | .. |
---|
5920 | 6015 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5921 | 6016 | // usecalllists = false; |
---|
5922 | 6017 | |
---|
5923 | | - if (GetBRep() != null) |
---|
5924 | | - usecalllists = usecalllists; |
---|
| 6018 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6019 | + //GetBRep() != null) |
---|
| 6020 | + usecalllists = !!usecalllists; |
---|
5925 | 6021 | //System.out.println("draw " + this); |
---|
5926 | 6022 | //new Exception().printStackTrace(); |
---|
5927 | 6023 | |
---|
.. | .. |
---|
5943 | 6039 | if (!(this instanceof Composite)) |
---|
5944 | 6040 | touched = false; |
---|
5945 | 6041 | //if (displaylist == -1 && usecalllists) |
---|
5946 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6042 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5947 | 6043 | { |
---|
5948 | 6044 | bRep.displaylist = display.GenList(); |
---|
5949 | 6045 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5954 | 6050 | |
---|
5955 | 6051 | //System.out.println("\tnew list " + list); |
---|
5956 | 6052 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5957 | | - if (usecalllists) |
---|
| 6053 | + if (usecalllists && bRep.displaylist > 0) |
---|
5958 | 6054 | { |
---|
5959 | 6055 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5960 | 6056 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5963 | 6059 | CallList(display, root, selected, blocked); |
---|
5964 | 6060 | |
---|
5965 | 6061 | // compiled = true; |
---|
5966 | | - if (usecalllists) |
---|
| 6062 | + if (usecalllists && bRep.displaylist > 0) |
---|
5967 | 6063 | { |
---|
5968 | 6064 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5969 | 6065 | display.EndList(); |
---|
.. | .. |
---|
7367 | 7463 | boundary.y = spot.y - 30; |
---|
7368 | 7464 | boundary.width = spot.width + 60; |
---|
7369 | 7465 | boundary.height = spot.height + 60; |
---|
7370 | | - clickInfo.g.setColor(Color.red); |
---|
| 7466 | + clickInfo.g.setColor(Color.white); |
---|
7371 | 7467 | int spotw = spot.x + spot.width; |
---|
7372 | 7468 | int spoth = spot.y + spot.height; |
---|
7373 | 7469 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7387 | 7483 | // { |
---|
7388 | 7484 | // CameraPane.Ymax = spoth; |
---|
7389 | 7485 | // } |
---|
7390 | | - spot.translate(32, 32); |
---|
| 7486 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7487 | +// { |
---|
| 7488 | +// CameraPane.Xmin = spot.x; |
---|
| 7489 | +// } |
---|
| 7490 | +// if (CameraPane.Xmax < spotw) |
---|
| 7491 | +// { |
---|
| 7492 | +// CameraPane.Xmax = spotw; |
---|
| 7493 | +// } |
---|
| 7494 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7495 | +// { |
---|
| 7496 | +// CameraPane.Ymin = spot.y; |
---|
| 7497 | +// } |
---|
| 7498 | +// if (CameraPane.Ymax < spoth) |
---|
| 7499 | +// { |
---|
| 7500 | +// CameraPane.Ymax = spoth; |
---|
| 7501 | +// } |
---|
| 7502 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7503 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7504 | + spot.translate(32, 0); |
---|
| 7505 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7506 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7507 | + |
---|
| 7508 | + spot.translate(32, 64); |
---|
7391 | 7509 | spotw = spot.x + spot.width; |
---|
7392 | 7510 | spoth = spot.y + spot.height; |
---|
7393 | 7511 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7408 | 7526 | // { |
---|
7409 | 7527 | // CameraPane.Ymax = spoth; |
---|
7410 | 7528 | // } |
---|
7411 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7412 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7413 | | - spot.translate(0, -32); |
---|
7414 | | - clickInfo.g.setColor(Color.yellow); |
---|
7415 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7416 | 7529 | clickInfo.g.setColor(Color.green); |
---|
7417 | | -// if (CameraPane.Xmin > spot.x) |
---|
7418 | | -// { |
---|
7419 | | -// CameraPane.Xmin = spot.x; |
---|
7420 | | -// } |
---|
7421 | | -// if (CameraPane.Xmax < spotw) |
---|
7422 | | -// { |
---|
7423 | | -// CameraPane.Xmax = spotw; |
---|
7424 | | -// } |
---|
7425 | | -// if (CameraPane.Ymin > spot.y) |
---|
7426 | | -// { |
---|
7427 | | -// CameraPane.Ymin = spot.y; |
---|
7428 | | -// } |
---|
7429 | | -// if (CameraPane.Ymax < spoth) |
---|
7430 | | -// { |
---|
7431 | | -// CameraPane.Ymax = spoth; |
---|
7432 | | -// } |
---|
7433 | 7530 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7434 | 7531 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7435 | 7532 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7488 | 7585 | retval = true; |
---|
7489 | 7586 | } |
---|
7490 | 7587 | spot.translate(0, 32); |
---|
| 7588 | + spot.translate(32, 0); |
---|
| 7589 | + spot.translate(0, 32); |
---|
7491 | 7590 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7492 | 7591 | { |
---|
7493 | 7592 | hitSomething = hitScale; |
---|
7494 | 7593 | |
---|
7495 | 7594 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7496 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7595 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7497 | 7596 | double sign = 1; |
---|
7498 | 7597 | if (hScale < 0) |
---|
7499 | 7598 | { |
---|
.. | .. |
---|
7505 | 7604 | //hScale = 0.01; |
---|
7506 | 7605 | } |
---|
7507 | 7606 | |
---|
7508 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7607 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7509 | 7608 | sign = 1; |
---|
7510 | 7609 | if (vScale < 0) |
---|
7511 | 7610 | { |
---|
.. | .. |
---|
7720 | 7819 | break; |
---|
7721 | 7820 | |
---|
7722 | 7821 | case hitScale: // scale |
---|
7723 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7822 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7724 | 7823 | double sign = 1; |
---|
7725 | 7824 | if (hScale < 0) |
---|
7726 | 7825 | { |
---|
.. | .. |
---|
7732 | 7831 | //hScale = 0.01; |
---|
7733 | 7832 | } |
---|
7734 | 7833 | |
---|
7735 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7834 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7736 | 7835 | sign = 1; |
---|
7737 | 7836 | if (vScale < 0) |
---|
7738 | 7837 | { |
---|
.. | .. |
---|
7765 | 7864 | case 3: // '\001' |
---|
7766 | 7865 | if (modified || opposite) |
---|
7767 | 7866 | { |
---|
| 7867 | + if (modified && opposite) |
---|
| 7868 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7869 | + else |
---|
7768 | 7870 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7769 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7871 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7770 | 7872 | } // vScale, 1); |
---|
7771 | 7873 | else |
---|
7772 | 7874 | { |
---|
7773 | 7875 | // EXCEPTION! |
---|
7774 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7876 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7775 | 7877 | } // vScale, 1); |
---|
7776 | 7878 | break; |
---|
7777 | 7879 | |
---|
7778 | 7880 | case 2: // '\002' |
---|
7779 | 7881 | if (modified || opposite) |
---|
7780 | 7882 | { |
---|
7781 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7782 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7883 | + if (modified && opposite) |
---|
| 7884 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7885 | + else |
---|
| 7886 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7887 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7783 | 7888 | } else |
---|
7784 | 7889 | { |
---|
7785 | 7890 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7789 | 7894 | case 1: // '\003' |
---|
7790 | 7895 | if (modified || opposite) |
---|
7791 | 7896 | { |
---|
7792 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7793 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7897 | + if (modified && opposite) |
---|
| 7898 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7899 | + else |
---|
| 7900 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7901 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7794 | 7902 | } else |
---|
7795 | 7903 | { |
---|
7796 | 7904 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|