.. | .. |
---|
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 | |
---|
38 | 39 | ScriptNode scriptnode; |
---|
.. | .. |
---|
222 | 223 | // o.bRep.support = null; |
---|
223 | 224 | // } |
---|
224 | 225 | o.selection = this.selection; |
---|
225 | | - o.versions = this.versions; |
---|
| 226 | + o.versionlist = this.versionlist; |
---|
226 | 227 | o.versionindex = this.versionindex; |
---|
227 | 228 | |
---|
228 | 229 | if (this.support != null) |
---|
.. | .. |
---|
245 | 246 | // this.support = null; |
---|
246 | 247 | // this.fileparent = null; |
---|
247 | 248 | } |
---|
| 249 | + |
---|
| 250 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 251 | +// { |
---|
| 252 | +// if (this.uuid.equals(uuid)) |
---|
| 253 | +// return this; |
---|
| 254 | +// |
---|
| 255 | +// if (blockloop) |
---|
| 256 | +// return null; |
---|
| 257 | +// |
---|
| 258 | +// blockloop = true; |
---|
| 259 | +// |
---|
| 260 | +// for (int i=0; i<Size(); i++) |
---|
| 261 | +// { |
---|
| 262 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 263 | +// |
---|
| 264 | +// if (o != null) |
---|
| 265 | +// return o; |
---|
| 266 | +// } |
---|
| 267 | +// |
---|
| 268 | +// blockloop = false; |
---|
| 269 | +// |
---|
| 270 | +// return null; |
---|
| 271 | +// } |
---|
248 | 272 | |
---|
249 | 273 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
250 | 274 | { |
---|
.. | .. |
---|
280 | 304 | |
---|
281 | 305 | this.selection = o.selection; |
---|
282 | 306 | |
---|
283 | | - this.versions = o.versions; |
---|
| 307 | + this.versionlist = o.versionlist; |
---|
284 | 308 | this.versionindex = o.versionindex; |
---|
285 | 309 | // July 2019 if (this.bRep != null) |
---|
286 | 310 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
1014 | 1038 | |
---|
1015 | 1039 | if (material == null || material.multiply) |
---|
1016 | 1040 | return true; |
---|
| 1041 | + |
---|
| 1042 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1043 | + return false; |
---|
1017 | 1044 | |
---|
1018 | 1045 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1019 | 1046 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2441 | 2468 | else |
---|
2442 | 2469 | { |
---|
2443 | 2470 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2471 | + if (objectUI != null) |
---|
| 2472 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2473 | + else |
---|
| 2474 | + //new Exception().printStackTrace(); |
---|
| 2475 | + System.err.println("objectUI is null"); |
---|
2444 | 2476 | } |
---|
2445 | 2477 | } |
---|
2446 | 2478 | |
---|
.. | .. |
---|
5542 | 5574 | if (fullname == null) |
---|
5543 | 5575 | return ""; |
---|
5544 | 5576 | |
---|
| 5577 | + if (fullname.pigment != null) |
---|
| 5578 | + { |
---|
| 5579 | + return fullname.pigment; |
---|
| 5580 | + } |
---|
| 5581 | + |
---|
5545 | 5582 | // System.out.println("Fullname = " + fullname); |
---|
5546 | 5583 | |
---|
5547 | 5584 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5554 | 5591 | |
---|
5555 | 5592 | if (split.length == 0) |
---|
5556 | 5593 | { |
---|
5557 | | - return ""; |
---|
| 5594 | + return fullname.pigment = ""; |
---|
5558 | 5595 | } |
---|
5559 | 5596 | |
---|
5560 | 5597 | if (split.length <= 2) |
---|
.. | .. |
---|
5562 | 5599 | if (fullname.name.endsWith(":")) |
---|
5563 | 5600 | { |
---|
5564 | 5601 | // Windows |
---|
5565 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5602 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5566 | 5603 | } |
---|
5567 | 5604 | |
---|
5568 | | - return split[0]; |
---|
| 5605 | + return fullname.pigment = split[0]; |
---|
5569 | 5606 | } |
---|
5570 | 5607 | |
---|
5571 | 5608 | // Windows |
---|
5572 | 5609 | assert(split.length == 4); |
---|
5573 | 5610 | |
---|
5574 | | - return split[0] + ":" + split[1]; |
---|
| 5611 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5575 | 5612 | } |
---|
5576 | 5613 | |
---|
5577 | 5614 | static String GetBump(cTexture fullname) |
---|
5578 | 5615 | { |
---|
5579 | 5616 | if (fullname == null) |
---|
5580 | 5617 | return ""; |
---|
| 5618 | + |
---|
| 5619 | + if (fullname.bump != null) |
---|
| 5620 | + { |
---|
| 5621 | + return fullname.bump; |
---|
| 5622 | + } |
---|
5581 | 5623 | |
---|
5582 | 5624 | // System.out.println("Fullname = " + fullname); |
---|
5583 | 5625 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5589 | 5631 | |
---|
5590 | 5632 | if (split.length == 0) |
---|
5591 | 5633 | { |
---|
5592 | | - return ""; |
---|
| 5634 | + return fullname.bump = ""; |
---|
5593 | 5635 | } |
---|
5594 | 5636 | |
---|
5595 | 5637 | if (split.length == 1) |
---|
5596 | 5638 | { |
---|
5597 | | - return ""; |
---|
| 5639 | + return fullname.bump = ""; |
---|
5598 | 5640 | } |
---|
5599 | 5641 | |
---|
5600 | 5642 | if (split.length == 2) |
---|
.. | .. |
---|
5602 | 5644 | if (fullname.name.endsWith(":")) |
---|
5603 | 5645 | { |
---|
5604 | 5646 | // Windows |
---|
5605 | | - return ""; |
---|
| 5647 | + return fullname.bump = ""; |
---|
5606 | 5648 | } |
---|
5607 | 5649 | |
---|
5608 | | - return split[1]; |
---|
| 5650 | + return fullname.bump = split[1]; |
---|
5609 | 5651 | } |
---|
5610 | 5652 | |
---|
5611 | 5653 | // Windows |
---|
5612 | 5654 | assert(split.length == 4); |
---|
5613 | 5655 | |
---|
5614 | | - return split[2] + ":" + split[3]; |
---|
| 5656 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5615 | 5657 | } |
---|
5616 | 5658 | |
---|
5617 | 5659 | String GetPigmentTexture() |
---|
.. | .. |
---|
5694 | 5736 | texname = ""; |
---|
5695 | 5737 | |
---|
5696 | 5738 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5739 | + |
---|
| 5740 | + GetTextures().pigment = null; |
---|
| 5741 | + |
---|
5697 | 5742 | Touch(); |
---|
5698 | 5743 | } |
---|
5699 | 5744 | |
---|
.. | .. |
---|
5766 | 5811 | texname = ""; |
---|
5767 | 5812 | |
---|
5768 | 5813 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5814 | + |
---|
| 5815 | + GetTextures().bump = null; |
---|
5769 | 5816 | |
---|
5770 | 5817 | Touch(); |
---|
5771 | 5818 | } |
---|
.. | .. |
---|
5909 | 5956 | if (support != null) |
---|
5910 | 5957 | support = support; |
---|
5911 | 5958 | |
---|
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); |
---|
| 5959 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5960 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5961 | + |
---|
| 5962 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5914 | 5963 | |
---|
5915 | 5964 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5916 | 5965 | { |
---|
.. | .. |
---|
5920 | 5969 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5921 | 5970 | // usecalllists = false; |
---|
5922 | 5971 | |
---|
5923 | | - if (GetBRep() != null) |
---|
5924 | | - usecalllists = usecalllists; |
---|
| 5972 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5973 | + //GetBRep() != null) |
---|
| 5974 | + usecalllists = !!usecalllists; |
---|
5925 | 5975 | //System.out.println("draw " + this); |
---|
5926 | 5976 | //new Exception().printStackTrace(); |
---|
5927 | 5977 | |
---|
.. | .. |
---|
5943 | 5993 | if (!(this instanceof Composite)) |
---|
5944 | 5994 | touched = false; |
---|
5945 | 5995 | //if (displaylist == -1 && usecalllists) |
---|
5946 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5996 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5947 | 5997 | { |
---|
5948 | 5998 | bRep.displaylist = display.GenList(); |
---|
5949 | 5999 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5954 | 6004 | |
---|
5955 | 6005 | //System.out.println("\tnew list " + list); |
---|
5956 | 6006 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5957 | | - if (usecalllists) |
---|
| 6007 | + if (usecalllists && bRep.displaylist > 0) |
---|
5958 | 6008 | { |
---|
5959 | 6009 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5960 | 6010 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5963 | 6013 | CallList(display, root, selected, blocked); |
---|
5964 | 6014 | |
---|
5965 | 6015 | // compiled = true; |
---|
5966 | | - if (usecalllists) |
---|
| 6016 | + if (usecalllists && bRep.displaylist > 0) |
---|
5967 | 6017 | { |
---|
5968 | 6018 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5969 | 6019 | display.EndList(); |
---|
.. | .. |
---|
7367 | 7417 | boundary.y = spot.y - 30; |
---|
7368 | 7418 | boundary.width = spot.width + 60; |
---|
7369 | 7419 | boundary.height = spot.height + 60; |
---|
7370 | | - clickInfo.g.setColor(Color.red); |
---|
| 7420 | + clickInfo.g.setColor(Color.white); |
---|
7371 | 7421 | int spotw = spot.x + spot.width; |
---|
7372 | 7422 | int spoth = spot.y + spot.height; |
---|
7373 | 7423 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7387 | 7437 | // { |
---|
7388 | 7438 | // CameraPane.Ymax = spoth; |
---|
7389 | 7439 | // } |
---|
7390 | | - spot.translate(32, 32); |
---|
| 7440 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7441 | +// { |
---|
| 7442 | +// CameraPane.Xmin = spot.x; |
---|
| 7443 | +// } |
---|
| 7444 | +// if (CameraPane.Xmax < spotw) |
---|
| 7445 | +// { |
---|
| 7446 | +// CameraPane.Xmax = spotw; |
---|
| 7447 | +// } |
---|
| 7448 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7449 | +// { |
---|
| 7450 | +// CameraPane.Ymin = spot.y; |
---|
| 7451 | +// } |
---|
| 7452 | +// if (CameraPane.Ymax < spoth) |
---|
| 7453 | +// { |
---|
| 7454 | +// CameraPane.Ymax = spoth; |
---|
| 7455 | +// } |
---|
| 7456 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7457 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7458 | + spot.translate(32, 0); |
---|
| 7459 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7460 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7461 | + |
---|
| 7462 | + spot.translate(32, 64); |
---|
7391 | 7463 | spotw = spot.x + spot.width; |
---|
7392 | 7464 | spoth = spot.y + spot.height; |
---|
7393 | 7465 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7408 | 7480 | // { |
---|
7409 | 7481 | // CameraPane.Ymax = spoth; |
---|
7410 | 7482 | // } |
---|
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 | 7483 | 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 | 7484 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7434 | 7485 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7435 | 7486 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7488 | 7539 | retval = true; |
---|
7489 | 7540 | } |
---|
7490 | 7541 | spot.translate(0, 32); |
---|
| 7542 | + spot.translate(32, 0); |
---|
| 7543 | + spot.translate(0, 32); |
---|
7491 | 7544 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7492 | 7545 | { |
---|
7493 | 7546 | hitSomething = hitScale; |
---|
7494 | 7547 | |
---|
7495 | 7548 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7496 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7549 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7497 | 7550 | double sign = 1; |
---|
7498 | 7551 | if (hScale < 0) |
---|
7499 | 7552 | { |
---|
.. | .. |
---|
7505 | 7558 | //hScale = 0.01; |
---|
7506 | 7559 | } |
---|
7507 | 7560 | |
---|
7508 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7561 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7509 | 7562 | sign = 1; |
---|
7510 | 7563 | if (vScale < 0) |
---|
7511 | 7564 | { |
---|
.. | .. |
---|
7720 | 7773 | break; |
---|
7721 | 7774 | |
---|
7722 | 7775 | case hitScale: // scale |
---|
7723 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7776 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7724 | 7777 | double sign = 1; |
---|
7725 | 7778 | if (hScale < 0) |
---|
7726 | 7779 | { |
---|
.. | .. |
---|
7732 | 7785 | //hScale = 0.01; |
---|
7733 | 7786 | } |
---|
7734 | 7787 | |
---|
7735 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7788 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7736 | 7789 | sign = 1; |
---|
7737 | 7790 | if (vScale < 0) |
---|
7738 | 7791 | { |
---|
.. | .. |
---|
7765 | 7818 | case 3: // '\001' |
---|
7766 | 7819 | if (modified || opposite) |
---|
7767 | 7820 | { |
---|
| 7821 | + if (modified && opposite) |
---|
| 7822 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7823 | + else |
---|
7768 | 7824 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7769 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7825 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7770 | 7826 | } // vScale, 1); |
---|
7771 | 7827 | else |
---|
7772 | 7828 | { |
---|
7773 | 7829 | // EXCEPTION! |
---|
7774 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7830 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7775 | 7831 | } // vScale, 1); |
---|
7776 | 7832 | break; |
---|
7777 | 7833 | |
---|
7778 | 7834 | case 2: // '\002' |
---|
7779 | 7835 | if (modified || opposite) |
---|
7780 | 7836 | { |
---|
7781 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7782 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7837 | + if (modified && opposite) |
---|
| 7838 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7839 | + else |
---|
| 7840 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7841 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7783 | 7842 | } else |
---|
7784 | 7843 | { |
---|
7785 | 7844 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7789 | 7848 | case 1: // '\003' |
---|
7790 | 7849 | if (modified || opposite) |
---|
7791 | 7850 | { |
---|
7792 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7793 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7851 | + if (modified && opposite) |
---|
| 7852 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7853 | + else |
---|
| 7854 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7855 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7794 | 7856 | } else |
---|
7795 | 7857 | { |
---|
7796 | 7858 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|