.. | .. |
---|
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 |
---|
28 | | - mocap.reader.BVHReader.BVHResult bvh; |
---|
29 | | - Object3D skeleton; |
---|
| 28 | + // TEMPORARY for mocap undo. No need to be transient. |
---|
| 29 | + mocap.reader.BVHReader.BVHResult savebvh; |
---|
| 30 | + Object3D saveskeleton; |
---|
30 | 31 | // |
---|
| 32 | + |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
| 37 | + int versionindex = -1; |
---|
| 38 | + |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
31 | 40 | |
---|
32 | 41 | ScriptNode scriptnode; |
---|
33 | 42 | |
---|
.. | .. |
---|
170 | 179 | |
---|
171 | 180 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 181 | { |
---|
| 182 | + Object3D o; |
---|
| 183 | + |
---|
173 | 184 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 185 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 186 | + o = hashtable.get(GetUUID()); |
---|
176 | 187 | |
---|
177 | 188 | Grafreed.Assert(this.bRep == o.bRep); |
---|
178 | | - if (this.bRep != null) |
---|
179 | | - assert(this.bRep.support == o.transientrep); |
---|
| 189 | + //if (this.bRep != null) |
---|
| 190 | + // assert(this.bRep.support == o.transientrep); |
---|
| 191 | + if (this.support != null) |
---|
| 192 | + assert(this.support.bRep == o.transientrep); |
---|
| 193 | + } |
---|
| 194 | + else |
---|
| 195 | + { |
---|
| 196 | + o = new Object3D("copy of " + this.name); |
---|
180 | 197 | |
---|
181 | | - return; |
---|
| 198 | + hashtable.put(GetUUID(), o); |
---|
182 | 199 | } |
---|
183 | 200 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 201 | + if (!blockloop) |
---|
189 | 202 | { |
---|
190 | | - get(i).ExtractBigData(hashtable); |
---|
| 203 | + blockloop = true; |
---|
| 204 | + |
---|
| 205 | + for (int i=0; i<Size(); i++) |
---|
| 206 | + { |
---|
| 207 | + get(i).ExtractBigData(hashtable); |
---|
| 208 | + } |
---|
| 209 | + |
---|
| 210 | + blockloop = false; |
---|
191 | 211 | } |
---|
192 | 212 | |
---|
193 | 213 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 215 | |
---|
196 | 216 | void ExtractBigData(Object3D o) |
---|
197 | 217 | { |
---|
| 218 | + if (o.bRep != null) |
---|
| 219 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 220 | + |
---|
198 | 221 | o.bRep = this.bRep; |
---|
199 | | - if (this.bRep != null) |
---|
| 222 | +// July 2019 if (this.bRep != null) |
---|
| 223 | +// { |
---|
| 224 | +// o.transientrep = this.bRep.support; |
---|
| 225 | +// o.bRep.support = null; |
---|
| 226 | +// } |
---|
| 227 | + o.selection = this.selection; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
| 229 | + o.versionindex = this.versionindex; |
---|
| 230 | + |
---|
| 231 | + if (this.support != null) |
---|
200 | 232 | { |
---|
201 | | - o.transientrep = this.bRep.support; |
---|
202 | | - o.bRep.support = null; |
---|
| 233 | + if (o.transientrep != null) |
---|
| 234 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 235 | + |
---|
| 236 | + o.transientrep = this.support.bRep; |
---|
| 237 | + this.support.bRep = null; |
---|
203 | 238 | } |
---|
204 | 239 | |
---|
205 | 240 | // o.support = this.support; |
---|
.. | .. |
---|
214 | 249 | // this.fileparent = null; |
---|
215 | 250 | } |
---|
216 | 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 | + |
---|
217 | 275 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
218 | 276 | { |
---|
219 | 277 | if (!hashtable.containsKey(GetUUID())) |
---|
.. | .. |
---|
223 | 281 | |
---|
224 | 282 | RestoreBigData(o); |
---|
225 | 283 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 284 | + if (blockloop) |
---|
| 285 | + return; |
---|
| 286 | + |
---|
| 287 | + blockloop = true; |
---|
| 288 | + |
---|
| 289 | + //hashtable.remove(GetUUID()); |
---|
227 | 290 | |
---|
228 | 291 | for (int i=0; i<Size(); i++) |
---|
229 | 292 | { |
---|
230 | 293 | get(i).RestoreBigData(hashtable); |
---|
231 | 294 | } |
---|
| 295 | + |
---|
| 296 | + blockloop = false; |
---|
232 | 297 | } |
---|
233 | 298 | |
---|
234 | 299 | void RestoreBigData(Object3D o) |
---|
235 | 300 | { |
---|
236 | 301 | this.bRep = o.bRep; |
---|
237 | | - if (this.bRep != null) |
---|
238 | | - this.bRep.support = o.transientrep; |
---|
| 302 | + if (this.support != null && o.transientrep != null) |
---|
| 303 | + { |
---|
| 304 | + this.support.bRep = o.transientrep; |
---|
| 305 | + } |
---|
| 306 | + |
---|
| 307 | + this.selection = o.selection; |
---|
| 308 | + |
---|
| 309 | + this.versionlist = o.versionlist; |
---|
| 310 | + this.versionindex = o.versionindex; |
---|
| 311 | +// July 2019 if (this.bRep != null) |
---|
| 312 | +// this.bRep.support = o.transientrep; |
---|
239 | 313 | // this.support = o.support; |
---|
240 | 314 | // this.fileparent = o.fileparent; |
---|
241 | 315 | } |
---|
.. | .. |
---|
381 | 455 | } |
---|
382 | 456 | |
---|
383 | 457 | boolean live = false; |
---|
| 458 | + transient boolean keepdontselect; |
---|
384 | 459 | boolean dontselect = false; |
---|
385 | 460 | boolean hide = false; |
---|
386 | 461 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
881 | 956 | |
---|
882 | 957 | if (marked && Globals.isLIVE() && live && |
---|
883 | 958 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 959 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 960 | currentframe != Globals.framecount) |
---|
886 | 961 | { |
---|
887 | 962 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 968 | |
---|
894 | 969 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 970 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 971 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 972 | + (step == 1 && changedir)) |
---|
897 | 973 | { |
---|
898 | 974 | countdown = 1; |
---|
899 | 975 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1041 | if (material == null || material.multiply) |
---|
966 | 1042 | return true; |
---|
967 | 1043 | |
---|
| 1044 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1045 | + return false; |
---|
| 1046 | + |
---|
| 1047 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1048 | return material.opacity > 0.99; |
---|
969 | 1049 | } |
---|
970 | 1050 | |
---|
.. | .. |
---|
1365 | 1445 | toParent = LA.newMatrix(); |
---|
1366 | 1446 | fromParent = LA.newMatrix(); |
---|
1367 | 1447 | } |
---|
| 1448 | + |
---|
1368 | 1449 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1450 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1451 | |
---|
.. | .. |
---|
2386 | 2467 | } |
---|
2387 | 2468 | */ |
---|
2388 | 2469 | } |
---|
| 2470 | + else |
---|
| 2471 | + { |
---|
| 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"); |
---|
| 2478 | + } |
---|
2389 | 2479 | } |
---|
2390 | 2480 | |
---|
2391 | 2481 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2517 | { |
---|
2428 | 2518 | editWindow.refreshContents(); |
---|
2429 | 2519 | } |
---|
| 2520 | + else |
---|
| 2521 | + { |
---|
| 2522 | + if (manipWindow != null) |
---|
| 2523 | + { |
---|
| 2524 | + manipWindow.refreshContents(); |
---|
| 2525 | + } |
---|
| 2526 | + } |
---|
| 2527 | + |
---|
2430 | 2528 | //if (parent != null) |
---|
2431 | 2529 | //parent.refreshEditWindow(); |
---|
2432 | 2530 | } |
---|
.. | .. |
---|
2506 | 2604 | private static final int editSelf = 1; |
---|
2507 | 2605 | private static final int editChild = 2; |
---|
2508 | 2606 | |
---|
2509 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2607 | + void drawEditHandles(//ClickInfo info, |
---|
| 2608 | + int level) |
---|
2510 | 2609 | { |
---|
2511 | 2610 | if (level == 0) |
---|
2512 | 2611 | { |
---|
.. | .. |
---|
2514 | 2613 | return; |
---|
2515 | 2614 | |
---|
2516 | 2615 | Object3D selectee; |
---|
2517 | | - 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)) |
---|
2518 | 2618 | { |
---|
2519 | 2619 | selectee = (Object3D) e.nextElement(); |
---|
2520 | 2620 | } |
---|
.. | .. |
---|
2522 | 2622 | } else |
---|
2523 | 2623 | { |
---|
2524 | 2624 | //super. |
---|
2525 | | - drawEditHandles0(info, level + 1); |
---|
| 2625 | + drawEditHandles0(//info, |
---|
| 2626 | + level + 1); |
---|
2526 | 2627 | } |
---|
2527 | 2628 | } |
---|
2528 | 2629 | |
---|
2529 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2630 | + boolean doEditClick(//ClickInfo info, |
---|
| 2631 | + int level) |
---|
2530 | 2632 | { |
---|
2531 | 2633 | doSomething = 0; |
---|
2532 | 2634 | if (level == 0) |
---|
2533 | 2635 | { |
---|
2534 | | - return doParentClick(info); |
---|
| 2636 | + return doParentClick(); //info); |
---|
2535 | 2637 | } |
---|
2536 | 2638 | if (//super. |
---|
2537 | | - doEditClick0(info, level)) |
---|
| 2639 | + doEditClick0(//info, |
---|
| 2640 | + level)) |
---|
2538 | 2641 | { |
---|
2539 | 2642 | doSomething = 1; |
---|
2540 | 2643 | return true; |
---|
.. | .. |
---|
2544 | 2647 | } |
---|
2545 | 2648 | } |
---|
2546 | 2649 | |
---|
2547 | | - boolean doParentClick(ClickInfo info) |
---|
| 2650 | + boolean doParentClick() //ClickInfo info) |
---|
2548 | 2651 | { |
---|
2549 | 2652 | if (selection == null) |
---|
2550 | 2653 | { |
---|
.. | .. |
---|
2557 | 2660 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2558 | 2661 | { |
---|
2559 | 2662 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2560 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2663 | + if (selectee.doEditClick(//info, |
---|
| 2664 | + 1)) |
---|
2561 | 2665 | { |
---|
2562 | 2666 | childToDrag = selectee; |
---|
2563 | 2667 | doSomething = 2; |
---|
.. | .. |
---|
2569 | 2673 | return retval; |
---|
2570 | 2674 | } |
---|
2571 | 2675 | |
---|
2572 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2676 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2677 | + boolean opposite) |
---|
2573 | 2678 | { |
---|
2574 | 2679 | switch (doSomething) |
---|
2575 | 2680 | { |
---|
2576 | 2681 | case 1: // '\001' |
---|
2577 | 2682 | //super. |
---|
2578 | | - doEditDrag0(info, opposite); |
---|
| 2683 | + doEditDrag0(//clickInfo, |
---|
| 2684 | + opposite); |
---|
2579 | 2685 | break; |
---|
2580 | 2686 | |
---|
2581 | 2687 | case 2: // '\002' |
---|
.. | .. |
---|
2588 | 2694 | { |
---|
2589 | 2695 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2590 | 2696 | //childToDrag.doEditDrag(info); |
---|
2591 | | - sel.doEditDrag(info, opposite); |
---|
| 2697 | + sel.doEditDrag(//clickInfo, |
---|
| 2698 | + opposite); |
---|
2592 | 2699 | } else |
---|
2593 | 2700 | { |
---|
2594 | 2701 | //super. |
---|
2595 | | - doEditDrag0(info, opposite); |
---|
| 2702 | + doEditDrag0(//clickInfo, |
---|
| 2703 | + opposite); |
---|
2596 | 2704 | } |
---|
2597 | 2705 | } |
---|
2598 | 2706 | break; |
---|
.. | .. |
---|
2610 | 2718 | { |
---|
2611 | 2719 | deselectAll(); |
---|
2612 | 2720 | } |
---|
| 2721 | + |
---|
| 2722 | + new Exception().printStackTrace(); |
---|
| 2723 | + |
---|
2613 | 2724 | ClickInfo newInfo = new ClickInfo(); |
---|
2614 | 2725 | newInfo.flags = info.flags; |
---|
2615 | 2726 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3057 | 3168 | { |
---|
3058 | 3169 | if (bRep != null) |
---|
3059 | 3170 | { |
---|
3060 | | - bRep.GenerateNormalsMINE(); |
---|
| 3171 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3061 | 3172 | Touch(); |
---|
3062 | 3173 | } |
---|
3063 | 3174 | } |
---|
.. | .. |
---|
3503 | 3614 | if (blockloop) |
---|
3504 | 3615 | return; |
---|
3505 | 3616 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3617 | + if (//marked || // does not make sense |
---|
| 3618 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3619 | live = h; |
---|
3508 | 3620 | |
---|
3509 | 3621 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3636 | return; |
---|
3525 | 3637 | |
---|
3526 | 3638 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3639 | + if (//marked || // does not make sense |
---|
| 3640 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3641 | link2master = h; |
---|
3529 | 3642 | |
---|
3530 | 3643 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3657 | if (blockloop) |
---|
3545 | 3658 | return; |
---|
3546 | 3659 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3660 | + if (//marked || // does not make sense |
---|
| 3661 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3662 | hide = h; |
---|
3549 | 3663 | |
---|
3550 | 3664 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3678 | if (blockloop) |
---|
3565 | 3679 | return; |
---|
3566 | 3680 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3681 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3682 | marked = h; |
---|
3569 | 3683 | |
---|
3570 | 3684 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3688 | continue; |
---|
3575 | 3689 | blockloop = true; |
---|
3576 | 3690 | child.MarkLeaves(h); |
---|
| 3691 | + blockloop = false; |
---|
| 3692 | + // release(i); |
---|
| 3693 | + } |
---|
| 3694 | + } |
---|
| 3695 | + |
---|
| 3696 | + void RewindLeaves(boolean h) |
---|
| 3697 | + { |
---|
| 3698 | + if (blockloop) |
---|
| 3699 | + return; |
---|
| 3700 | + |
---|
| 3701 | + if (bRep != null || material != null) // borderline... |
---|
| 3702 | + rewind = h; |
---|
| 3703 | + |
---|
| 3704 | + for (int i = 0; i < Size(); i++) |
---|
| 3705 | + { |
---|
| 3706 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3707 | + if (child == null) |
---|
| 3708 | + continue; |
---|
| 3709 | + blockloop = true; |
---|
| 3710 | + child.RewindLeaves(h); |
---|
| 3711 | + blockloop = false; |
---|
| 3712 | + // release(i); |
---|
| 3713 | + } |
---|
| 3714 | + } |
---|
| 3715 | + |
---|
| 3716 | + void RandomLeaves(boolean h) |
---|
| 3717 | + { |
---|
| 3718 | + if (blockloop) |
---|
| 3719 | + return; |
---|
| 3720 | + |
---|
| 3721 | + if (bRep != null || material != null) // borderline... |
---|
| 3722 | + random = h; |
---|
| 3723 | + |
---|
| 3724 | + for (int i = 0; i < Size(); i++) |
---|
| 3725 | + { |
---|
| 3726 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3727 | + if (child == null) |
---|
| 3728 | + continue; |
---|
| 3729 | + blockloop = true; |
---|
| 3730 | + child.RandomLeaves(h); |
---|
3577 | 3731 | blockloop = false; |
---|
3578 | 3732 | // release(i); |
---|
3579 | 3733 | } |
---|
.. | .. |
---|
4914 | 5068 | } |
---|
4915 | 5069 | } |
---|
4916 | 5070 | |
---|
| 5071 | + ObjEditor GetWindow() |
---|
| 5072 | + { |
---|
| 5073 | + if (editWindow != null) |
---|
| 5074 | + return editWindow; |
---|
| 5075 | + |
---|
| 5076 | + return manipWindow; |
---|
| 5077 | + } |
---|
| 5078 | + |
---|
4917 | 5079 | cTreePath Select(int indexcount, boolean deselect) |
---|
4918 | 5080 | { |
---|
4919 | 5081 | if (hide || dontselect) |
---|
.. | .. |
---|
4950 | 5112 | if (leaf != null) |
---|
4951 | 5113 | { |
---|
4952 | 5114 | cTreePath tp = new cTreePath(this, leaf); |
---|
4953 | | - if (editWindow != null) |
---|
| 5115 | + ObjEditor window = GetWindow(); |
---|
| 5116 | + if (window != null) |
---|
4954 | 5117 | { |
---|
4955 | 5118 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4956 | | - editWindow.Select(tp, deselect, true); |
---|
| 5119 | + window.Select(tp, deselect, true); |
---|
4957 | 5120 | } |
---|
4958 | 5121 | |
---|
4959 | 5122 | return tp; |
---|
.. | .. |
---|
4970 | 5133 | |
---|
4971 | 5134 | if (child == null) |
---|
4972 | 5135 | continue; |
---|
| 5136 | + |
---|
4973 | 5137 | if (child.HasTransparency() && child.size() != 0) |
---|
4974 | 5138 | { |
---|
4975 | 5139 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4979 | 5143 | if (leaf != null) |
---|
4980 | 5144 | { |
---|
4981 | 5145 | cTreePath tp = new cTreePath(this, leaf); |
---|
4982 | | - if (editWindow != null) |
---|
| 5146 | + ObjEditor window = GetWindow(); |
---|
| 5147 | + if (window != null) |
---|
4983 | 5148 | { |
---|
4984 | | - editWindow.Select(tp, deselect, true); |
---|
| 5149 | + window.Select(tp, deselect, true); |
---|
4985 | 5150 | } |
---|
4986 | 5151 | |
---|
4987 | 5152 | return tp; |
---|
.. | .. |
---|
5306 | 5471 | blockloop = false; |
---|
5307 | 5472 | } |
---|
5308 | 5473 | |
---|
| 5474 | + void ResetSelectable() |
---|
| 5475 | + { |
---|
| 5476 | + if (blockloop) |
---|
| 5477 | + return; |
---|
| 5478 | + |
---|
| 5479 | + blockloop = true; |
---|
| 5480 | + |
---|
| 5481 | + keepdontselect = dontselect; |
---|
| 5482 | + dontselect = true; |
---|
| 5483 | + |
---|
| 5484 | + Object3D child; |
---|
| 5485 | + int nb = Size(); |
---|
| 5486 | + for (int i = 0; i < nb; i++) |
---|
| 5487 | + { |
---|
| 5488 | + child = (Object3D) get(i); |
---|
| 5489 | + if (child == null) |
---|
| 5490 | + continue; |
---|
| 5491 | + child.ResetSelectable(); |
---|
| 5492 | + } |
---|
| 5493 | + |
---|
| 5494 | + blockloop = false; |
---|
| 5495 | + } |
---|
| 5496 | + |
---|
| 5497 | + void RestoreSelectable() |
---|
| 5498 | + { |
---|
| 5499 | + if (blockloop) |
---|
| 5500 | + return; |
---|
| 5501 | + |
---|
| 5502 | + blockloop = true; |
---|
| 5503 | + |
---|
| 5504 | + dontselect = keepdontselect; |
---|
| 5505 | + |
---|
| 5506 | + Object3D child; |
---|
| 5507 | + int nb = Size(); |
---|
| 5508 | + for (int i = 0; i < nb; i++) |
---|
| 5509 | + { |
---|
| 5510 | + child = (Object3D) get(i); |
---|
| 5511 | + if (child == null) |
---|
| 5512 | + continue; |
---|
| 5513 | + child.RestoreSelectable(); |
---|
| 5514 | + } |
---|
| 5515 | + |
---|
| 5516 | + blockloop = false; |
---|
| 5517 | + } |
---|
| 5518 | + |
---|
5309 | 5519 | boolean IsSelected() |
---|
5310 | 5520 | { |
---|
5311 | 5521 | if (parent == null) |
---|
.. | .. |
---|
5366 | 5576 | if (fullname == null) |
---|
5367 | 5577 | return ""; |
---|
5368 | 5578 | |
---|
| 5579 | + if (fullname.pigment != null) |
---|
| 5580 | + { |
---|
| 5581 | + return fullname.pigment; |
---|
| 5582 | + } |
---|
| 5583 | + |
---|
5369 | 5584 | // System.out.println("Fullname = " + fullname); |
---|
5370 | 5585 | |
---|
5371 | 5586 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5378 | 5593 | |
---|
5379 | 5594 | if (split.length == 0) |
---|
5380 | 5595 | { |
---|
5381 | | - return ""; |
---|
| 5596 | + return fullname.pigment = ""; |
---|
5382 | 5597 | } |
---|
5383 | 5598 | |
---|
5384 | 5599 | if (split.length <= 2) |
---|
.. | .. |
---|
5386 | 5601 | if (fullname.name.endsWith(":")) |
---|
5387 | 5602 | { |
---|
5388 | 5603 | // Windows |
---|
5389 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5604 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5390 | 5605 | } |
---|
5391 | 5606 | |
---|
5392 | | - return split[0]; |
---|
| 5607 | + return fullname.pigment = split[0]; |
---|
5393 | 5608 | } |
---|
5394 | 5609 | |
---|
5395 | 5610 | // Windows |
---|
5396 | 5611 | assert(split.length == 4); |
---|
5397 | 5612 | |
---|
5398 | | - return split[0] + ":" + split[1]; |
---|
| 5613 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5399 | 5614 | } |
---|
5400 | 5615 | |
---|
5401 | 5616 | static String GetBump(cTexture fullname) |
---|
5402 | 5617 | { |
---|
5403 | 5618 | if (fullname == null) |
---|
5404 | 5619 | return ""; |
---|
| 5620 | + |
---|
| 5621 | + if (fullname.bump != null) |
---|
| 5622 | + { |
---|
| 5623 | + return fullname.bump; |
---|
| 5624 | + } |
---|
5405 | 5625 | |
---|
5406 | 5626 | // System.out.println("Fullname = " + fullname); |
---|
5407 | 5627 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5413 | 5633 | |
---|
5414 | 5634 | if (split.length == 0) |
---|
5415 | 5635 | { |
---|
5416 | | - return ""; |
---|
| 5636 | + return fullname.bump = ""; |
---|
5417 | 5637 | } |
---|
5418 | 5638 | |
---|
5419 | 5639 | if (split.length == 1) |
---|
5420 | 5640 | { |
---|
5421 | | - return ""; |
---|
| 5641 | + return fullname.bump = ""; |
---|
5422 | 5642 | } |
---|
5423 | 5643 | |
---|
5424 | 5644 | if (split.length == 2) |
---|
.. | .. |
---|
5426 | 5646 | if (fullname.name.endsWith(":")) |
---|
5427 | 5647 | { |
---|
5428 | 5648 | // Windows |
---|
5429 | | - return ""; |
---|
| 5649 | + return fullname.bump = ""; |
---|
5430 | 5650 | } |
---|
5431 | 5651 | |
---|
5432 | | - return split[1]; |
---|
| 5652 | + return fullname.bump = split[1]; |
---|
5433 | 5653 | } |
---|
5434 | 5654 | |
---|
5435 | 5655 | // Windows |
---|
5436 | 5656 | assert(split.length == 4); |
---|
5437 | 5657 | |
---|
5438 | | - return split[2] + ":" + split[3]; |
---|
| 5658 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5439 | 5659 | } |
---|
5440 | 5660 | |
---|
5441 | 5661 | String GetPigmentTexture() |
---|
.. | .. |
---|
5518 | 5738 | texname = ""; |
---|
5519 | 5739 | |
---|
5520 | 5740 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5741 | + |
---|
| 5742 | + GetTextures().pigment = null; |
---|
| 5743 | + |
---|
5521 | 5744 | Touch(); |
---|
5522 | 5745 | } |
---|
5523 | 5746 | |
---|
.. | .. |
---|
5591 | 5814 | |
---|
5592 | 5815 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5593 | 5816 | |
---|
| 5817 | + GetTextures().bump = null; |
---|
| 5818 | + |
---|
5594 | 5819 | Touch(); |
---|
5595 | 5820 | } |
---|
5596 | 5821 | |
---|
.. | .. |
---|
5611 | 5836 | |
---|
5612 | 5837 | blockloop = true; |
---|
5613 | 5838 | child.ResetBumpTexture(); |
---|
| 5839 | + blockloop = false; |
---|
| 5840 | + } |
---|
| 5841 | + } |
---|
| 5842 | + |
---|
| 5843 | + void EmbedTextures(boolean embed) |
---|
| 5844 | + { |
---|
| 5845 | + if (blockloop) |
---|
| 5846 | + return; |
---|
| 5847 | + |
---|
| 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 | + } |
---|
| 5860 | + |
---|
| 5861 | + int nb = Size(); |
---|
| 5862 | + for (int i = 0; i < nb; i++) |
---|
| 5863 | + { |
---|
| 5864 | + Object3D child = (Object3D) get(i); |
---|
| 5865 | + |
---|
| 5866 | + if (child == null) |
---|
| 5867 | + continue; |
---|
| 5868 | + |
---|
| 5869 | + blockloop = true; |
---|
| 5870 | + child.EmbedTextures(embed); |
---|
5614 | 5871 | blockloop = false; |
---|
5615 | 5872 | } |
---|
5616 | 5873 | } |
---|
.. | .. |
---|
5701 | 5958 | if (support != null) |
---|
5702 | 5959 | support = support; |
---|
5703 | 5960 | |
---|
5704 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5705 | | - 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. |
---|
5706 | 5965 | |
---|
5707 | 5966 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5708 | 5967 | { |
---|
.. | .. |
---|
5712 | 5971 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5713 | 5972 | // usecalllists = false; |
---|
5714 | 5973 | |
---|
5715 | | - if (GetBRep() != null) |
---|
5716 | | - usecalllists = usecalllists; |
---|
| 5974 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5975 | + //GetBRep() != null) |
---|
| 5976 | + usecalllists = !!usecalllists; |
---|
5717 | 5977 | //System.out.println("draw " + this); |
---|
5718 | 5978 | //new Exception().printStackTrace(); |
---|
5719 | 5979 | |
---|
.. | .. |
---|
5723 | 5983 | |
---|
5724 | 5984 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5725 | 5985 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5726 | | - (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5986 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5727 | 5987 | { |
---|
5728 | 5988 | Globals.lighttouched = true; |
---|
5729 | 5989 | } // all panes... |
---|
.. | .. |
---|
5735 | 5995 | if (!(this instanceof Composite)) |
---|
5736 | 5996 | touched = false; |
---|
5737 | 5997 | //if (displaylist == -1 && usecalllists) |
---|
5738 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5998 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5739 | 5999 | { |
---|
5740 | 6000 | bRep.displaylist = display.GenList(); |
---|
5741 | 6001 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5746 | 6006 | |
---|
5747 | 6007 | //System.out.println("\tnew list " + list); |
---|
5748 | 6008 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5749 | | - if (usecalllists) |
---|
| 6009 | + if (usecalllists && bRep.displaylist > 0) |
---|
5750 | 6010 | { |
---|
5751 | 6011 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5752 | 6012 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5755 | 6015 | CallList(display, root, selected, blocked); |
---|
5756 | 6016 | |
---|
5757 | 6017 | // compiled = true; |
---|
5758 | | - if (usecalllists) |
---|
| 6018 | + if (usecalllists && bRep.displaylist > 0) |
---|
5759 | 6019 | { |
---|
5760 | 6020 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5761 | 6021 | display.EndList(); |
---|
.. | .. |
---|
5855 | 6115 | if (GetBRep() != null) |
---|
5856 | 6116 | { |
---|
5857 | 6117 | display.NextIndex(); |
---|
| 6118 | + |
---|
5858 | 6119 | // vertex color conflict : gl.glCallList(list); |
---|
5859 | 6120 | DrawNode(display, root, selected); |
---|
5860 | 6121 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
6315 | 6576 | // dec 2012 |
---|
6316 | 6577 | new Exception().printStackTrace(); |
---|
6317 | 6578 | return; |
---|
| 6579 | + } |
---|
| 6580 | + |
---|
| 6581 | + if (dontselect) |
---|
| 6582 | + { |
---|
| 6583 | + //bRep.GenerateNormalsMINE(); |
---|
6318 | 6584 | } |
---|
6319 | 6585 | |
---|
6320 | 6586 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7100 | 7366 | } |
---|
7101 | 7367 | } |
---|
7102 | 7368 | |
---|
7103 | | - 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) |
---|
7104 | 7373 | { |
---|
7105 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7106 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7107 | | - 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; |
---|
7108 | 7377 | if (toscreen == null) |
---|
7109 | 7378 | { |
---|
7110 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7379 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7111 | 7380 | } |
---|
7112 | 7381 | cVector vec = in; |
---|
7113 | 7382 | LA.xformPos(in, toscreen, in); |
---|
7114 | 7383 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7115 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7116 | | - 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(); |
---|
7117 | 7386 | outPt.x = hc + (int) vec.x; |
---|
7118 | 7387 | outPt.y = vc - (int) vec.y; |
---|
7119 | 7388 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7121 | 7390 | outRec.width = outRec.height = 6; |
---|
7122 | 7391 | } |
---|
7123 | 7392 | |
---|
7124 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7393 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7394 | + ) |
---|
7125 | 7395 | { |
---|
7126 | 7396 | Point pt = new Point(0, 0); |
---|
7127 | 7397 | Rectangle rec = new Rectangle(); |
---|
7128 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7398 | + calcHotSpot(in, //clickInfo, |
---|
| 7399 | + pt, rec); |
---|
7129 | 7400 | return rec; |
---|
7130 | 7401 | } |
---|
7131 | 7402 | |
---|
7132 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7403 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7404 | + int level) |
---|
7133 | 7405 | { |
---|
7134 | 7406 | if (level == 0) |
---|
7135 | 7407 | { |
---|
.. | .. |
---|
7138 | 7410 | { |
---|
7139 | 7411 | cVector origin = new cVector(); |
---|
7140 | 7412 | //LA.xformPos(origin, toParent, origin); |
---|
7141 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7413 | + if (this.clickInfo == null) |
---|
| 7414 | + this.clickInfo = new ClickInfo(); |
---|
| 7415 | + |
---|
| 7416 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7142 | 7417 | Rectangle boundary = new Rectangle(); |
---|
7143 | 7418 | boundary.x = spot.x - 30; |
---|
7144 | 7419 | boundary.y = spot.y - 30; |
---|
7145 | 7420 | boundary.width = spot.width + 60; |
---|
7146 | 7421 | boundary.height = spot.height + 60; |
---|
7147 | | - info.g.setColor(Color.red); |
---|
| 7422 | + clickInfo.g.setColor(Color.white); |
---|
7148 | 7423 | int spotw = spot.x + spot.width; |
---|
7149 | 7424 | int spoth = spot.y + spot.height; |
---|
7150 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7425 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7151 | 7426 | // if (CameraPane.Xmin > spot.x) |
---|
7152 | 7427 | // { |
---|
7153 | 7428 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7164 | 7439 | // { |
---|
7165 | 7440 | // CameraPane.Ymax = spoth; |
---|
7166 | 7441 | // } |
---|
7167 | | - spot.translate(32, 32); |
---|
7168 | | - spotw = spot.x + spot.width; |
---|
7169 | | - spoth = spot.y + spot.height; |
---|
7170 | | - info.g.setColor(Color.cyan); |
---|
7171 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7172 | 7442 | // if (CameraPane.Xmin > spot.x) |
---|
7173 | 7443 | // { |
---|
7174 | 7444 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7187 | 7457 | // } |
---|
7188 | 7458 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7189 | 7459 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7190 | | - spot.translate(0, -32); |
---|
7191 | | - info.g.setColor(Color.yellow); |
---|
7192 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7193 | | - 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); |
---|
7194 | 7469 | // if (CameraPane.Xmin > spot.x) |
---|
7195 | 7470 | // { |
---|
7196 | 7471 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7207 | 7482 | // { |
---|
7208 | 7483 | // CameraPane.Ymax = spoth; |
---|
7209 | 7484 | // } |
---|
7210 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7211 | | - boundary.width, boundary.height, 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); |
---|
7212 | 7488 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7213 | 7489 | // if (CameraPane.Xmin > boundary.x) |
---|
7214 | 7490 | // { |
---|
.. | .. |
---|
7230 | 7506 | } |
---|
7231 | 7507 | } |
---|
7232 | 7508 | |
---|
7233 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7509 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7510 | + int level) |
---|
7234 | 7511 | { |
---|
7235 | 7512 | if (level == 0) |
---|
7236 | 7513 | { |
---|
.. | .. |
---|
7239 | 7516 | |
---|
7240 | 7517 | boolean retval = false; |
---|
7241 | 7518 | |
---|
7242 | | - startX = info.x; |
---|
7243 | | - startY = info.y; |
---|
| 7519 | + startX = clickInfo.x; |
---|
| 7520 | + startY = clickInfo.y; |
---|
7244 | 7521 | |
---|
7245 | 7522 | hitSomething = -1; |
---|
7246 | 7523 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7250 | 7527 | { |
---|
7251 | 7528 | centerPt = new Point(0, 0); |
---|
7252 | 7529 | } |
---|
7253 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7254 | | - if (spot.contains(info.x, info.y)) |
---|
| 7530 | + calcHotSpot(origin, //info, |
---|
| 7531 | + centerPt, spot); |
---|
| 7532 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7255 | 7533 | { |
---|
7256 | 7534 | hitSomething = hitCenter; |
---|
7257 | 7535 | retval = true; |
---|
7258 | 7536 | } |
---|
7259 | 7537 | spot.translate(32, 0); |
---|
7260 | | - if (spot.contains(info.x, info.y)) |
---|
| 7538 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7261 | 7539 | { |
---|
7262 | 7540 | hitSomething = hitRotate; |
---|
7263 | 7541 | retval = true; |
---|
7264 | 7542 | } |
---|
7265 | 7543 | spot.translate(0, 32); |
---|
7266 | | - 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)) |
---|
7267 | 7547 | { |
---|
7268 | 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 | + |
---|
7269 | 7577 | retval = true; |
---|
7270 | 7578 | } |
---|
7271 | 7579 | |
---|
.. | .. |
---|
7275 | 7583 | } |
---|
7276 | 7584 | |
---|
7277 | 7585 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7278 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7586 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7279 | 7587 | //System.out.println("modified = " + modified); |
---|
7280 | 7588 | //new Exception().printStackTrace(); |
---|
7281 | 7589 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7303 | 7611 | return true; |
---|
7304 | 7612 | } |
---|
7305 | 7613 | |
---|
7306 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7614 | + void doEditDrag0(//ClickInfo info, |
---|
| 7615 | + boolean opposite) |
---|
7307 | 7616 | { |
---|
7308 | 7617 | if (hitSomething == 0) |
---|
7309 | 7618 | { |
---|
.. | .. |
---|
7317 | 7626 | |
---|
7318 | 7627 | //System.out.println("hitSomething = " + hitSomething); |
---|
7319 | 7628 | |
---|
7320 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7629 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7321 | 7630 | |
---|
7322 | 7631 | cVector xlate = new cVector(); |
---|
7323 | 7632 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7351 | 7660 | toParent[3][i] = xlate.get(i); |
---|
7352 | 7661 | LA.matInvert(toParent, fromParent); |
---|
7353 | 7662 | */ |
---|
7354 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7355 | | - 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); |
---|
7356 | 7665 | |
---|
7357 | 7666 | LA.matCopy(startMat, toParent); |
---|
7358 | 7667 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7361 | 7670 | } else |
---|
7362 | 7671 | { |
---|
7363 | 7672 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7364 | | - cVector up = new cVector(info.camera.up); |
---|
| 7673 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7365 | 7674 | cVector away = new cVector(); |
---|
7366 | 7675 | //cVector right2 = new cVector(); |
---|
7367 | 7676 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7378 | 7687 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7379 | 7688 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7380 | 7689 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7381 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7690 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7382 | 7691 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7383 | 7692 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7384 | 7693 | //LA.vecCross(up, cVector.Z, right2); |
---|
7385 | 7694 | |
---|
7386 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7695 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7387 | 7696 | |
---|
7388 | 7697 | //System.out.println("DELTA0 = " + delta); |
---|
7389 | 7698 | //System.out.println("AWAY = " + info.camera.away); |
---|
7390 | 7699 | //System.out.println("UP = " + info.camera.up); |
---|
7391 | 7700 | if (away.z > 0) |
---|
7392 | 7701 | { |
---|
7393 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7702 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7394 | 7703 | { |
---|
7395 | 7704 | delta.x = -delta.x; |
---|
7396 | 7705 | } else |
---|
.. | .. |
---|
7405 | 7714 | //System.out.println("DELTA1 = " + delta); |
---|
7406 | 7715 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7407 | 7716 | //System.out.println("DELTA2 = " + delta); |
---|
7408 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7717 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7409 | 7718 | LA.matCopy(startMat, toParent); |
---|
7410 | 7719 | //System.out.println("DELTA3 = " + delta); |
---|
7411 | 7720 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7415 | 7724 | break; |
---|
7416 | 7725 | |
---|
7417 | 7726 | case hitRotate: // rotate |
---|
7418 | | - int dx = info.x - centerPt.x; |
---|
7419 | | - int dy = -(info.y - centerPt.y); |
---|
| 7727 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7728 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7420 | 7729 | double angle = (double) Math.atan2(dx, dy); |
---|
7421 | 7730 | angle = -(1.570796 - angle); |
---|
7422 | 7731 | |
---|
.. | .. |
---|
7439 | 7748 | } |
---|
7440 | 7749 | /**/ |
---|
7441 | 7750 | |
---|
7442 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7751 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7443 | 7752 | { |
---|
7444 | 7753 | case 1: // '\001' |
---|
7445 | 7754 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7466 | 7775 | break; |
---|
7467 | 7776 | |
---|
7468 | 7777 | case hitScale: // scale |
---|
7469 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7778 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7470 | 7779 | double sign = 1; |
---|
7471 | 7780 | if (hScale < 0) |
---|
7472 | 7781 | { |
---|
.. | .. |
---|
7478 | 7787 | //hScale = 0.01; |
---|
7479 | 7788 | } |
---|
7480 | 7789 | |
---|
7481 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7790 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7482 | 7791 | sign = 1; |
---|
7483 | 7792 | if (vScale < 0) |
---|
7484 | 7793 | { |
---|
.. | .. |
---|
7489 | 7798 | { |
---|
7490 | 7799 | //vScale = 0.01; |
---|
7491 | 7800 | } |
---|
| 7801 | + |
---|
7492 | 7802 | LA.matCopy(startMat, toParent); |
---|
7493 | 7803 | /**/ |
---|
7494 | 7804 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7498 | 7808 | } |
---|
7499 | 7809 | /**/ |
---|
7500 | 7810 | |
---|
7501 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7811 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7502 | 7812 | |
---|
7503 | 7813 | if (totalScale < 0.01) |
---|
7504 | 7814 | { |
---|
7505 | 7815 | totalScale = 0.01; |
---|
7506 | 7816 | } |
---|
7507 | 7817 | |
---|
7508 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7818 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7509 | 7819 | { |
---|
7510 | 7820 | case 3: // '\001' |
---|
7511 | 7821 | if (modified || opposite) |
---|
7512 | 7822 | { |
---|
| 7823 | + if (modified && opposite) |
---|
| 7824 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7825 | + else |
---|
7513 | 7826 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7514 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7827 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7515 | 7828 | } // vScale, 1); |
---|
7516 | 7829 | else |
---|
7517 | 7830 | { |
---|
7518 | 7831 | // EXCEPTION! |
---|
7519 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7832 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7520 | 7833 | } // vScale, 1); |
---|
7521 | 7834 | break; |
---|
7522 | 7835 | |
---|
7523 | 7836 | case 2: // '\002' |
---|
7524 | 7837 | if (modified || opposite) |
---|
7525 | 7838 | { |
---|
7526 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7527 | | - 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); |
---|
7528 | 7844 | } else |
---|
7529 | 7845 | { |
---|
7530 | 7846 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7534 | 7850 | case 1: // '\003' |
---|
7535 | 7851 | if (modified || opposite) |
---|
7536 | 7852 | { |
---|
7537 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7538 | | - 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); |
---|
7539 | 7858 | } else |
---|
7540 | 7859 | { |
---|
7541 | 7860 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7572 | 7891 | } // NEW ... |
---|
7573 | 7892 | |
---|
7574 | 7893 | |
---|
7575 | | - info.pane.repaint(); |
---|
| 7894 | + clickInfo.pane.repaint(); |
---|
7576 | 7895 | } |
---|
7577 | 7896 | |
---|
7578 | 7897 | boolean overflow = false; |
---|
.. | .. |
---|
7752 | 8071 | editWindow = null; |
---|
7753 | 8072 | } // ? |
---|
7754 | 8073 | } |
---|
| 8074 | + else |
---|
| 8075 | + { |
---|
| 8076 | + //editWindow.closeUI(); |
---|
| 8077 | + } |
---|
7755 | 8078 | } |
---|
7756 | 8079 | |
---|
7757 | 8080 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7909 | 8232 | } |
---|
7910 | 8233 | |
---|
7911 | 8234 | transient ObjEditor editWindow; |
---|
| 8235 | + transient ObjEditor manipWindow; |
---|
| 8236 | + |
---|
| 8237 | + transient boolean pinned; |
---|
| 8238 | + |
---|
7912 | 8239 | transient ObjectUI objectUI; |
---|
7913 | 8240 | public static int povDepth = 0; |
---|
7914 | 8241 | private static cVector tbMin = new cVector(); |
---|