.. | .. |
---|
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. |
---|
.. | .. |
---|
29 | 30 | Object3D saveskeleton; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
32 | | - byte[] versions[]; |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
33 | 37 | int versionindex = -1; |
---|
34 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
35 | 41 | ScriptNode scriptnode; |
---|
36 | 42 | |
---|
37 | 43 | void InitOthers() |
---|
.. | .. |
---|
219 | 225 | // o.bRep.support = null; |
---|
220 | 226 | // } |
---|
221 | 227 | o.selection = this.selection; |
---|
222 | | - o.versions = this.versions; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
223 | 229 | o.versionindex = this.versionindex; |
---|
224 | 230 | |
---|
225 | 231 | if (this.support != null) |
---|
.. | .. |
---|
242 | 248 | // this.support = null; |
---|
243 | 249 | // this.fileparent = null; |
---|
244 | 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 | +// } |
---|
245 | 274 | |
---|
246 | 275 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
247 | 276 | { |
---|
.. | .. |
---|
277 | 306 | |
---|
278 | 307 | this.selection = o.selection; |
---|
279 | 308 | |
---|
280 | | - this.versions = o.versions; |
---|
| 309 | + this.versionlist = o.versionlist; |
---|
281 | 310 | this.versionindex = o.versionindex; |
---|
282 | 311 | // July 2019 if (this.bRep != null) |
---|
283 | 312 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
1011 | 1040 | |
---|
1012 | 1041 | if (material == null || material.multiply) |
---|
1013 | 1042 | return true; |
---|
| 1043 | + |
---|
| 1044 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1045 | + return false; |
---|
1014 | 1046 | |
---|
1015 | 1047 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1016 | 1048 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2438 | 2470 | else |
---|
2439 | 2471 | { |
---|
2440 | 2472 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2473 | + if (objectUI != null) |
---|
| 2474 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2475 | + else |
---|
| 2476 | + //new Exception().printStackTrace(); |
---|
| 2477 | + System.err.println("objectUI is null"); |
---|
2441 | 2478 | } |
---|
2442 | 2479 | } |
---|
2443 | 2480 | |
---|
.. | .. |
---|
2567 | 2604 | private static final int editSelf = 1; |
---|
2568 | 2605 | private static final int editChild = 2; |
---|
2569 | 2606 | |
---|
2570 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2607 | + void drawEditHandles(//ClickInfo info, |
---|
| 2608 | + int level) |
---|
2571 | 2609 | { |
---|
2572 | 2610 | if (level == 0) |
---|
2573 | 2611 | { |
---|
.. | .. |
---|
2575 | 2613 | return; |
---|
2576 | 2614 | |
---|
2577 | 2615 | Object3D selectee; |
---|
2578 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2616 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2617 | + level + 1)) |
---|
2579 | 2618 | { |
---|
2580 | 2619 | selectee = (Object3D) e.nextElement(); |
---|
2581 | 2620 | } |
---|
.. | .. |
---|
2583 | 2622 | } else |
---|
2584 | 2623 | { |
---|
2585 | 2624 | //super. |
---|
2586 | | - drawEditHandles0(info, level + 1); |
---|
| 2625 | + drawEditHandles0(//info, |
---|
| 2626 | + level + 1); |
---|
2587 | 2627 | } |
---|
2588 | 2628 | } |
---|
2589 | 2629 | |
---|
2590 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2630 | + boolean doEditClick(//ClickInfo info, |
---|
| 2631 | + int level) |
---|
2591 | 2632 | { |
---|
2592 | 2633 | doSomething = 0; |
---|
2593 | 2634 | if (level == 0) |
---|
2594 | 2635 | { |
---|
2595 | | - return doParentClick(info); |
---|
| 2636 | + return doParentClick(); //info); |
---|
2596 | 2637 | } |
---|
2597 | 2638 | if (//super. |
---|
2598 | | - doEditClick0(info, level)) |
---|
| 2639 | + doEditClick0(//info, |
---|
| 2640 | + level)) |
---|
2599 | 2641 | { |
---|
2600 | 2642 | doSomething = 1; |
---|
2601 | 2643 | return true; |
---|
.. | .. |
---|
2605 | 2647 | } |
---|
2606 | 2648 | } |
---|
2607 | 2649 | |
---|
2608 | | - boolean doParentClick(ClickInfo info) |
---|
| 2650 | + boolean doParentClick() //ClickInfo info) |
---|
2609 | 2651 | { |
---|
2610 | 2652 | if (selection == null) |
---|
2611 | 2653 | { |
---|
.. | .. |
---|
2618 | 2660 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2619 | 2661 | { |
---|
2620 | 2662 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2621 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2663 | + if (selectee.doEditClick(//info, |
---|
| 2664 | + 1)) |
---|
2622 | 2665 | { |
---|
2623 | 2666 | childToDrag = selectee; |
---|
2624 | 2667 | doSomething = 2; |
---|
.. | .. |
---|
2630 | 2673 | return retval; |
---|
2631 | 2674 | } |
---|
2632 | 2675 | |
---|
2633 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2676 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2677 | + boolean opposite) |
---|
2634 | 2678 | { |
---|
2635 | 2679 | switch (doSomething) |
---|
2636 | 2680 | { |
---|
2637 | 2681 | case 1: // '\001' |
---|
2638 | 2682 | //super. |
---|
2639 | | - doEditDrag0(info, opposite); |
---|
| 2683 | + doEditDrag0(//clickInfo, |
---|
| 2684 | + opposite); |
---|
2640 | 2685 | break; |
---|
2641 | 2686 | |
---|
2642 | 2687 | case 2: // '\002' |
---|
.. | .. |
---|
2649 | 2694 | { |
---|
2650 | 2695 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2651 | 2696 | //childToDrag.doEditDrag(info); |
---|
2652 | | - sel.doEditDrag(info, opposite); |
---|
| 2697 | + sel.doEditDrag(//clickInfo, |
---|
| 2698 | + opposite); |
---|
2653 | 2699 | } else |
---|
2654 | 2700 | { |
---|
2655 | 2701 | //super. |
---|
2656 | | - doEditDrag0(info, opposite); |
---|
| 2702 | + doEditDrag0(//clickInfo, |
---|
| 2703 | + opposite); |
---|
2657 | 2704 | } |
---|
2658 | 2705 | } |
---|
2659 | 2706 | break; |
---|
.. | .. |
---|
2671 | 2718 | { |
---|
2672 | 2719 | deselectAll(); |
---|
2673 | 2720 | } |
---|
| 2721 | + |
---|
| 2722 | + new Exception().printStackTrace(); |
---|
| 2723 | + |
---|
2674 | 2724 | ClickInfo newInfo = new ClickInfo(); |
---|
2675 | 2725 | newInfo.flags = info.flags; |
---|
2676 | 2726 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
5526 | 5576 | if (fullname == null) |
---|
5527 | 5577 | return ""; |
---|
5528 | 5578 | |
---|
| 5579 | + if (fullname.pigment != null) |
---|
| 5580 | + { |
---|
| 5581 | + return fullname.pigment; |
---|
| 5582 | + } |
---|
| 5583 | + |
---|
5529 | 5584 | // System.out.println("Fullname = " + fullname); |
---|
5530 | 5585 | |
---|
5531 | 5586 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5538 | 5593 | |
---|
5539 | 5594 | if (split.length == 0) |
---|
5540 | 5595 | { |
---|
5541 | | - return ""; |
---|
| 5596 | + return fullname.pigment = ""; |
---|
5542 | 5597 | } |
---|
5543 | 5598 | |
---|
5544 | 5599 | if (split.length <= 2) |
---|
.. | .. |
---|
5546 | 5601 | if (fullname.name.endsWith(":")) |
---|
5547 | 5602 | { |
---|
5548 | 5603 | // Windows |
---|
5549 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5604 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5550 | 5605 | } |
---|
5551 | 5606 | |
---|
5552 | | - return split[0]; |
---|
| 5607 | + return fullname.pigment = split[0]; |
---|
5553 | 5608 | } |
---|
5554 | 5609 | |
---|
5555 | 5610 | // Windows |
---|
5556 | 5611 | assert(split.length == 4); |
---|
5557 | 5612 | |
---|
5558 | | - return split[0] + ":" + split[1]; |
---|
| 5613 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5559 | 5614 | } |
---|
5560 | 5615 | |
---|
5561 | 5616 | static String GetBump(cTexture fullname) |
---|
5562 | 5617 | { |
---|
5563 | 5618 | if (fullname == null) |
---|
5564 | 5619 | return ""; |
---|
| 5620 | + |
---|
| 5621 | + if (fullname.bump != null) |
---|
| 5622 | + { |
---|
| 5623 | + return fullname.bump; |
---|
| 5624 | + } |
---|
5565 | 5625 | |
---|
5566 | 5626 | // System.out.println("Fullname = " + fullname); |
---|
5567 | 5627 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5573 | 5633 | |
---|
5574 | 5634 | if (split.length == 0) |
---|
5575 | 5635 | { |
---|
5576 | | - return ""; |
---|
| 5636 | + return fullname.bump = ""; |
---|
5577 | 5637 | } |
---|
5578 | 5638 | |
---|
5579 | 5639 | if (split.length == 1) |
---|
5580 | 5640 | { |
---|
5581 | | - return ""; |
---|
| 5641 | + return fullname.bump = ""; |
---|
5582 | 5642 | } |
---|
5583 | 5643 | |
---|
5584 | 5644 | if (split.length == 2) |
---|
.. | .. |
---|
5586 | 5646 | if (fullname.name.endsWith(":")) |
---|
5587 | 5647 | { |
---|
5588 | 5648 | // Windows |
---|
5589 | | - return ""; |
---|
| 5649 | + return fullname.bump = ""; |
---|
5590 | 5650 | } |
---|
5591 | 5651 | |
---|
5592 | | - return split[1]; |
---|
| 5652 | + return fullname.bump = split[1]; |
---|
5593 | 5653 | } |
---|
5594 | 5654 | |
---|
5595 | 5655 | // Windows |
---|
5596 | 5656 | assert(split.length == 4); |
---|
5597 | 5657 | |
---|
5598 | | - return split[2] + ":" + split[3]; |
---|
| 5658 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5599 | 5659 | } |
---|
5600 | 5660 | |
---|
5601 | 5661 | String GetPigmentTexture() |
---|
.. | .. |
---|
5678 | 5738 | texname = ""; |
---|
5679 | 5739 | |
---|
5680 | 5740 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5741 | + |
---|
| 5742 | + GetTextures().pigment = null; |
---|
| 5743 | + |
---|
5681 | 5744 | Touch(); |
---|
5682 | 5745 | } |
---|
5683 | 5746 | |
---|
.. | .. |
---|
5751 | 5814 | |
---|
5752 | 5815 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5753 | 5816 | |
---|
| 5817 | + GetTextures().bump = null; |
---|
| 5818 | + |
---|
5754 | 5819 | Touch(); |
---|
5755 | 5820 | } |
---|
5756 | 5821 | |
---|
.. | .. |
---|
5775 | 5840 | } |
---|
5776 | 5841 | } |
---|
5777 | 5842 | |
---|
5778 | | - void EmbedTextures() |
---|
| 5843 | + void EmbedTextures(boolean embed) |
---|
5779 | 5844 | { |
---|
5780 | 5845 | if (blockloop) |
---|
5781 | 5846 | return; |
---|
5782 | 5847 | |
---|
5783 | | - CameraPane.EmbedTextures(texture); |
---|
| 5848 | + //if (GetTextures() != null) |
---|
| 5849 | + if (embed) |
---|
| 5850 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5851 | + else |
---|
| 5852 | + { |
---|
| 5853 | + GetTextures().pigmentdata = null; |
---|
| 5854 | + GetTextures().bumpdata = null; |
---|
| 5855 | + GetTextures().pw = 0; |
---|
| 5856 | + GetTextures().ph = 0; |
---|
| 5857 | + GetTextures().bw = 0; |
---|
| 5858 | + GetTextures().bh = 0; |
---|
| 5859 | + } |
---|
5784 | 5860 | |
---|
5785 | 5861 | int nb = Size(); |
---|
5786 | 5862 | for (int i = 0; i < nb; i++) |
---|
.. | .. |
---|
5791 | 5867 | continue; |
---|
5792 | 5868 | |
---|
5793 | 5869 | blockloop = true; |
---|
5794 | | - child.EmbedTextures(); |
---|
| 5870 | + child.EmbedTextures(embed); |
---|
5795 | 5871 | blockloop = false; |
---|
5796 | 5872 | } |
---|
5797 | 5873 | } |
---|
.. | .. |
---|
5882 | 5958 | if (support != null) |
---|
5883 | 5959 | support = support; |
---|
5884 | 5960 | |
---|
5885 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5886 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5961 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5962 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5963 | + |
---|
| 5964 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5887 | 5965 | |
---|
5888 | 5966 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5889 | 5967 | { |
---|
.. | .. |
---|
5893 | 5971 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5894 | 5972 | // usecalllists = false; |
---|
5895 | 5973 | |
---|
5896 | | - if (GetBRep() != null) |
---|
5897 | | - usecalllists = usecalllists; |
---|
| 5974 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5975 | + //GetBRep() != null) |
---|
| 5976 | + usecalllists = !!usecalllists; |
---|
5898 | 5977 | //System.out.println("draw " + this); |
---|
5899 | 5978 | //new Exception().printStackTrace(); |
---|
5900 | 5979 | |
---|
.. | .. |
---|
5916 | 5995 | if (!(this instanceof Composite)) |
---|
5917 | 5996 | touched = false; |
---|
5918 | 5997 | //if (displaylist == -1 && usecalllists) |
---|
5919 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5998 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5920 | 5999 | { |
---|
5921 | 6000 | bRep.displaylist = display.GenList(); |
---|
5922 | 6001 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5927 | 6006 | |
---|
5928 | 6007 | //System.out.println("\tnew list " + list); |
---|
5929 | 6008 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5930 | | - if (usecalllists) |
---|
| 6009 | + if (usecalllists && bRep.displaylist > 0) |
---|
5931 | 6010 | { |
---|
5932 | 6011 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5933 | 6012 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5936 | 6015 | CallList(display, root, selected, blocked); |
---|
5937 | 6016 | |
---|
5938 | 6017 | // compiled = true; |
---|
5939 | | - if (usecalllists) |
---|
| 6018 | + if (usecalllists && bRep.displaylist > 0) |
---|
5940 | 6019 | { |
---|
5941 | 6020 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5942 | 6021 | display.EndList(); |
---|
.. | .. |
---|
7287 | 7366 | } |
---|
7288 | 7367 | } |
---|
7289 | 7368 | |
---|
7290 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7369 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7370 | + |
---|
| 7371 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7372 | + Point outPt, Rectangle outRec) |
---|
7291 | 7373 | { |
---|
7292 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7293 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7294 | | - double[][] toscreen = info.toScreen; |
---|
| 7374 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7375 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7376 | + double[][] toscreen = clickInfo.toScreen; |
---|
7295 | 7377 | if (toscreen == null) |
---|
7296 | 7378 | { |
---|
7297 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7379 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7298 | 7380 | } |
---|
7299 | 7381 | cVector vec = in; |
---|
7300 | 7382 | LA.xformPos(in, toscreen, in); |
---|
7301 | 7383 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7302 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7303 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7384 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7385 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7304 | 7386 | outPt.x = hc + (int) vec.x; |
---|
7305 | 7387 | outPt.y = vc - (int) vec.y; |
---|
7306 | 7388 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7308 | 7390 | outRec.width = outRec.height = 6; |
---|
7309 | 7391 | } |
---|
7310 | 7392 | |
---|
7311 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7393 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7394 | + ) |
---|
7312 | 7395 | { |
---|
7313 | 7396 | Point pt = new Point(0, 0); |
---|
7314 | 7397 | Rectangle rec = new Rectangle(); |
---|
7315 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7398 | + calcHotSpot(in, //clickInfo, |
---|
| 7399 | + pt, rec); |
---|
7316 | 7400 | return rec; |
---|
7317 | 7401 | } |
---|
7318 | 7402 | |
---|
7319 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7403 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7404 | + int level) |
---|
7320 | 7405 | { |
---|
7321 | 7406 | if (level == 0) |
---|
7322 | 7407 | { |
---|
.. | .. |
---|
7325 | 7410 | { |
---|
7326 | 7411 | cVector origin = new cVector(); |
---|
7327 | 7412 | //LA.xformPos(origin, toParent, origin); |
---|
7328 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7413 | + if (this.clickInfo == null) |
---|
| 7414 | + this.clickInfo = new ClickInfo(); |
---|
| 7415 | + |
---|
| 7416 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7329 | 7417 | Rectangle boundary = new Rectangle(); |
---|
7330 | 7418 | boundary.x = spot.x - 30; |
---|
7331 | 7419 | boundary.y = spot.y - 30; |
---|
7332 | 7420 | boundary.width = spot.width + 60; |
---|
7333 | 7421 | boundary.height = spot.height + 60; |
---|
7334 | | - info.g.setColor(Color.red); |
---|
| 7422 | + clickInfo.g.setColor(Color.white); |
---|
7335 | 7423 | int spotw = spot.x + spot.width; |
---|
7336 | 7424 | int spoth = spot.y + spot.height; |
---|
7337 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7425 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7338 | 7426 | // if (CameraPane.Xmin > spot.x) |
---|
7339 | 7427 | // { |
---|
7340 | 7428 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7351 | 7439 | // { |
---|
7352 | 7440 | // CameraPane.Ymax = spoth; |
---|
7353 | 7441 | // } |
---|
7354 | | - spot.translate(32, 32); |
---|
7355 | | - spotw = spot.x + spot.width; |
---|
7356 | | - spoth = spot.y + spot.height; |
---|
7357 | | - info.g.setColor(Color.cyan); |
---|
7358 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7359 | 7442 | // if (CameraPane.Xmin > spot.x) |
---|
7360 | 7443 | // { |
---|
7361 | 7444 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7374 | 7457 | // } |
---|
7375 | 7458 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7376 | 7459 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7377 | | - spot.translate(0, -32); |
---|
7378 | | - info.g.setColor(Color.yellow); |
---|
7379 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7380 | | - info.g.setColor(Color.green); |
---|
| 7460 | + spot.translate(32, 0); |
---|
| 7461 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7462 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7463 | + |
---|
| 7464 | + spot.translate(32, 64); |
---|
| 7465 | + spotw = spot.x + spot.width; |
---|
| 7466 | + spoth = spot.y + spot.height; |
---|
| 7467 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7468 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7381 | 7469 | // if (CameraPane.Xmin > spot.x) |
---|
7382 | 7470 | // { |
---|
7383 | 7471 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7394 | 7482 | // { |
---|
7395 | 7483 | // CameraPane.Ymax = spoth; |
---|
7396 | 7484 | // } |
---|
7397 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7398 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
| 7485 | + clickInfo.g.setColor(Color.green); |
---|
| 7486 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7487 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7399 | 7488 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7400 | 7489 | // if (CameraPane.Xmin > boundary.x) |
---|
7401 | 7490 | // { |
---|
.. | .. |
---|
7417 | 7506 | } |
---|
7418 | 7507 | } |
---|
7419 | 7508 | |
---|
7420 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7509 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7510 | + int level) |
---|
7421 | 7511 | { |
---|
7422 | 7512 | if (level == 0) |
---|
7423 | 7513 | { |
---|
.. | .. |
---|
7426 | 7516 | |
---|
7427 | 7517 | boolean retval = false; |
---|
7428 | 7518 | |
---|
7429 | | - startX = info.x; |
---|
7430 | | - startY = info.y; |
---|
| 7519 | + startX = clickInfo.x; |
---|
| 7520 | + startY = clickInfo.y; |
---|
7431 | 7521 | |
---|
7432 | 7522 | hitSomething = -1; |
---|
7433 | 7523 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7437 | 7527 | { |
---|
7438 | 7528 | centerPt = new Point(0, 0); |
---|
7439 | 7529 | } |
---|
7440 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7441 | | - if (spot.contains(info.x, info.y)) |
---|
| 7530 | + calcHotSpot(origin, //info, |
---|
| 7531 | + centerPt, spot); |
---|
| 7532 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7442 | 7533 | { |
---|
7443 | 7534 | hitSomething = hitCenter; |
---|
7444 | 7535 | retval = true; |
---|
7445 | 7536 | } |
---|
7446 | 7537 | spot.translate(32, 0); |
---|
7447 | | - if (spot.contains(info.x, info.y)) |
---|
| 7538 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7448 | 7539 | { |
---|
7449 | 7540 | hitSomething = hitRotate; |
---|
7450 | 7541 | retval = true; |
---|
7451 | 7542 | } |
---|
7452 | 7543 | spot.translate(0, 32); |
---|
7453 | | - if (spot.contains(info.x, info.y)) |
---|
| 7544 | + spot.translate(32, 0); |
---|
| 7545 | + spot.translate(0, 32); |
---|
| 7546 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7454 | 7547 | { |
---|
7455 | 7548 | hitSomething = hitScale; |
---|
| 7549 | + |
---|
| 7550 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7551 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7552 | + double sign = 1; |
---|
| 7553 | + if (hScale < 0) |
---|
| 7554 | + { |
---|
| 7555 | + sign = -1; |
---|
| 7556 | + } |
---|
| 7557 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7558 | + if (hScale < 0.01) |
---|
| 7559 | + { |
---|
| 7560 | + //hScale = 0.01; |
---|
| 7561 | + } |
---|
| 7562 | + |
---|
| 7563 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7564 | + sign = 1; |
---|
| 7565 | + if (vScale < 0) |
---|
| 7566 | + { |
---|
| 7567 | + sign = -1; |
---|
| 7568 | + } |
---|
| 7569 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7570 | + if (vScale < 0.01) |
---|
| 7571 | + { |
---|
| 7572 | + //vScale = 0.01; |
---|
| 7573 | + } |
---|
| 7574 | + |
---|
| 7575 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7576 | + |
---|
7456 | 7577 | retval = true; |
---|
7457 | 7578 | } |
---|
7458 | 7579 | |
---|
.. | .. |
---|
7462 | 7583 | } |
---|
7463 | 7584 | |
---|
7464 | 7585 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7465 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7586 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7466 | 7587 | //System.out.println("modified = " + modified); |
---|
7467 | 7588 | //new Exception().printStackTrace(); |
---|
7468 | 7589 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7490 | 7611 | return true; |
---|
7491 | 7612 | } |
---|
7492 | 7613 | |
---|
7493 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7614 | + void doEditDrag0(//ClickInfo info, |
---|
| 7615 | + boolean opposite) |
---|
7494 | 7616 | { |
---|
7495 | 7617 | if (hitSomething == 0) |
---|
7496 | 7618 | { |
---|
.. | .. |
---|
7504 | 7626 | |
---|
7505 | 7627 | //System.out.println("hitSomething = " + hitSomething); |
---|
7506 | 7628 | |
---|
7507 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7629 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7508 | 7630 | |
---|
7509 | 7631 | cVector xlate = new cVector(); |
---|
7510 | 7632 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7538 | 7660 | toParent[3][i] = xlate.get(i); |
---|
7539 | 7661 | LA.matInvert(toParent, fromParent); |
---|
7540 | 7662 | */ |
---|
7541 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7542 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7663 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7664 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7543 | 7665 | |
---|
7544 | 7666 | LA.matCopy(startMat, toParent); |
---|
7545 | 7667 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7548 | 7670 | } else |
---|
7549 | 7671 | { |
---|
7550 | 7672 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7551 | | - cVector up = new cVector(info.camera.up); |
---|
| 7673 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7552 | 7674 | cVector away = new cVector(); |
---|
7553 | 7675 | //cVector right2 = new cVector(); |
---|
7554 | 7676 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7565 | 7687 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7566 | 7688 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7567 | 7689 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7568 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7690 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7569 | 7691 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7570 | 7692 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7571 | 7693 | //LA.vecCross(up, cVector.Z, right2); |
---|
7572 | 7694 | |
---|
7573 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7695 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7574 | 7696 | |
---|
7575 | 7697 | //System.out.println("DELTA0 = " + delta); |
---|
7576 | 7698 | //System.out.println("AWAY = " + info.camera.away); |
---|
7577 | 7699 | //System.out.println("UP = " + info.camera.up); |
---|
7578 | 7700 | if (away.z > 0) |
---|
7579 | 7701 | { |
---|
7580 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7702 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7581 | 7703 | { |
---|
7582 | 7704 | delta.x = -delta.x; |
---|
7583 | 7705 | } else |
---|
.. | .. |
---|
7592 | 7714 | //System.out.println("DELTA1 = " + delta); |
---|
7593 | 7715 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7594 | 7716 | //System.out.println("DELTA2 = " + delta); |
---|
7595 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7717 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7596 | 7718 | LA.matCopy(startMat, toParent); |
---|
7597 | 7719 | //System.out.println("DELTA3 = " + delta); |
---|
7598 | 7720 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7602 | 7724 | break; |
---|
7603 | 7725 | |
---|
7604 | 7726 | case hitRotate: // rotate |
---|
7605 | | - int dx = info.x - centerPt.x; |
---|
7606 | | - int dy = -(info.y - centerPt.y); |
---|
| 7727 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7728 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7607 | 7729 | double angle = (double) Math.atan2(dx, dy); |
---|
7608 | 7730 | angle = -(1.570796 - angle); |
---|
7609 | 7731 | |
---|
.. | .. |
---|
7626 | 7748 | } |
---|
7627 | 7749 | /**/ |
---|
7628 | 7750 | |
---|
7629 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7751 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7630 | 7752 | { |
---|
7631 | 7753 | case 1: // '\001' |
---|
7632 | 7754 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7653 | 7775 | break; |
---|
7654 | 7776 | |
---|
7655 | 7777 | case hitScale: // scale |
---|
7656 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7778 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7657 | 7779 | double sign = 1; |
---|
7658 | 7780 | if (hScale < 0) |
---|
7659 | 7781 | { |
---|
.. | .. |
---|
7665 | 7787 | //hScale = 0.01; |
---|
7666 | 7788 | } |
---|
7667 | 7789 | |
---|
7668 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7790 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7669 | 7791 | sign = 1; |
---|
7670 | 7792 | if (vScale < 0) |
---|
7671 | 7793 | { |
---|
.. | .. |
---|
7676 | 7798 | { |
---|
7677 | 7799 | //vScale = 0.01; |
---|
7678 | 7800 | } |
---|
| 7801 | + |
---|
7679 | 7802 | LA.matCopy(startMat, toParent); |
---|
7680 | 7803 | /**/ |
---|
7681 | 7804 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7685 | 7808 | } |
---|
7686 | 7809 | /**/ |
---|
7687 | 7810 | |
---|
7688 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7811 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7689 | 7812 | |
---|
7690 | 7813 | if (totalScale < 0.01) |
---|
7691 | 7814 | { |
---|
7692 | 7815 | totalScale = 0.01; |
---|
7693 | 7816 | } |
---|
7694 | 7817 | |
---|
7695 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7818 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7696 | 7819 | { |
---|
7697 | 7820 | case 3: // '\001' |
---|
7698 | 7821 | if (modified || opposite) |
---|
7699 | 7822 | { |
---|
| 7823 | + if (modified && opposite) |
---|
| 7824 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7825 | + else |
---|
7700 | 7826 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7701 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7827 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7702 | 7828 | } // vScale, 1); |
---|
7703 | 7829 | else |
---|
7704 | 7830 | { |
---|
7705 | 7831 | // EXCEPTION! |
---|
7706 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7832 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7707 | 7833 | } // vScale, 1); |
---|
7708 | 7834 | break; |
---|
7709 | 7835 | |
---|
7710 | 7836 | case 2: // '\002' |
---|
7711 | 7837 | if (modified || opposite) |
---|
7712 | 7838 | { |
---|
7713 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7714 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7839 | + if (modified && opposite) |
---|
| 7840 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7841 | + else |
---|
| 7842 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7843 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7715 | 7844 | } else |
---|
7716 | 7845 | { |
---|
7717 | 7846 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7721 | 7850 | case 1: // '\003' |
---|
7722 | 7851 | if (modified || opposite) |
---|
7723 | 7852 | { |
---|
7724 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7725 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7853 | + if (modified && opposite) |
---|
| 7854 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7855 | + else |
---|
| 7856 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7857 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7726 | 7858 | } else |
---|
7727 | 7859 | { |
---|
7728 | 7860 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7759 | 7891 | } // NEW ... |
---|
7760 | 7892 | |
---|
7761 | 7893 | |
---|
7762 | | - info.pane.repaint(); |
---|
| 7894 | + clickInfo.pane.repaint(); |
---|
7763 | 7895 | } |
---|
7764 | 7896 | |
---|
7765 | 7897 | boolean overflow = false; |
---|