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