.. | .. |
---|
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 | + |
---|
| 275 | + transient boolean tag; |
---|
| 276 | + |
---|
| 277 | + void TagObjects(Object3D o, boolean tag) |
---|
| 278 | + { |
---|
| 279 | + if (blockloop) |
---|
| 280 | + return; |
---|
| 281 | + |
---|
| 282 | + o.tag = tag; |
---|
| 283 | + |
---|
| 284 | + if (o == this) |
---|
| 285 | + return; |
---|
| 286 | + |
---|
| 287 | + blockloop = true; |
---|
| 288 | + |
---|
| 289 | + for (int i=0; i<Size(); i++) |
---|
| 290 | + { |
---|
| 291 | + get(i).TagObjects(o, tag); |
---|
| 292 | + } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
| 295 | + } |
---|
| 296 | + |
---|
| 297 | + boolean HasTags() |
---|
| 298 | + { |
---|
| 299 | + if (blockloop) |
---|
| 300 | + return false; |
---|
| 301 | + |
---|
| 302 | + blockloop = true; |
---|
| 303 | + |
---|
| 304 | + boolean hasTags = false; |
---|
| 305 | + |
---|
| 306 | + for (int i=0; i<Size(); i++) |
---|
| 307 | + { |
---|
| 308 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 309 | + |
---|
| 310 | + if (hasTags) |
---|
| 311 | + break; |
---|
| 312 | + } |
---|
| 313 | + |
---|
| 314 | + blockloop = false; |
---|
| 315 | + |
---|
| 316 | + return hasTags; |
---|
| 317 | + } |
---|
| 318 | + |
---|
217 | 319 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
218 | 320 | { |
---|
219 | 321 | if (!hashtable.containsKey(GetUUID())) |
---|
.. | .. |
---|
223 | 325 | |
---|
224 | 326 | RestoreBigData(o); |
---|
225 | 327 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 328 | + if (blockloop) |
---|
| 329 | + return; |
---|
| 330 | + |
---|
| 331 | + blockloop = true; |
---|
| 332 | + |
---|
| 333 | + //hashtable.remove(GetUUID()); |
---|
227 | 334 | |
---|
228 | 335 | for (int i=0; i<Size(); i++) |
---|
229 | 336 | { |
---|
230 | 337 | get(i).RestoreBigData(hashtable); |
---|
231 | 338 | } |
---|
| 339 | + |
---|
| 340 | + blockloop = false; |
---|
232 | 341 | } |
---|
233 | 342 | |
---|
234 | 343 | void RestoreBigData(Object3D o) |
---|
235 | 344 | { |
---|
236 | 345 | this.bRep = o.bRep; |
---|
237 | | - if (this.bRep != null) |
---|
238 | | - this.bRep.support = o.transientrep; |
---|
| 346 | + if (this.support != null && o.transientrep != null) |
---|
| 347 | + { |
---|
| 348 | + this.support.bRep = o.transientrep; |
---|
| 349 | + } |
---|
| 350 | + |
---|
| 351 | + this.selection = o.selection; |
---|
| 352 | + |
---|
| 353 | + this.versionlist = o.versionlist; |
---|
| 354 | + this.versionindex = o.versionindex; |
---|
| 355 | +// July 2019 if (this.bRep != null) |
---|
| 356 | +// this.bRep.support = o.transientrep; |
---|
239 | 357 | // this.support = o.support; |
---|
240 | 358 | // this.fileparent = o.fileparent; |
---|
241 | 359 | } |
---|
.. | .. |
---|
381 | 499 | } |
---|
382 | 500 | |
---|
383 | 501 | boolean live = false; |
---|
| 502 | + transient boolean keepdontselect; |
---|
384 | 503 | boolean dontselect = false; |
---|
385 | 504 | boolean hide = false; |
---|
386 | 505 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
568 | 687 | { |
---|
569 | 688 | if (maxcount != 1) |
---|
570 | 689 | { |
---|
571 | | - new Exception().printStackTrace(); |
---|
| 690 | + //new Exception().printStackTrace(); |
---|
572 | 691 | } |
---|
573 | 692 | |
---|
574 | 693 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
881 | 1000 | |
---|
882 | 1001 | if (marked && Globals.isLIVE() && live && |
---|
883 | 1002 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 1003 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 1004 | currentframe != Globals.framecount) |
---|
886 | 1005 | { |
---|
887 | 1006 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
966 | 1085 | if (material == null || material.multiply) |
---|
967 | 1086 | return true; |
---|
968 | 1087 | |
---|
| 1088 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1089 | + return false; |
---|
| 1090 | + |
---|
| 1091 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
969 | 1092 | return material.opacity > 0.99; |
---|
970 | 1093 | } |
---|
971 | 1094 | |
---|
.. | .. |
---|
1366 | 1489 | toParent = LA.newMatrix(); |
---|
1367 | 1490 | fromParent = LA.newMatrix(); |
---|
1368 | 1491 | } |
---|
| 1492 | + |
---|
1369 | 1493 | LA.matCopy(other.toParent, toParent); |
---|
1370 | 1494 | LA.matCopy(other.fromParent, fromParent); |
---|
1371 | 1495 | |
---|
.. | .. |
---|
2245 | 2369 | |
---|
2246 | 2370 | InitOthers(); |
---|
2247 | 2371 | |
---|
2248 | | - if (this instanceof Camera) |
---|
2249 | | - { |
---|
2250 | | - material.shift = 90; |
---|
2251 | | - } |
---|
2252 | | - |
---|
2253 | 2372 | material.multiply = multiply; |
---|
2254 | 2373 | |
---|
2255 | 2374 | if (multiply) |
---|
.. | .. |
---|
2387 | 2506 | } |
---|
2388 | 2507 | */ |
---|
2389 | 2508 | } |
---|
| 2509 | + else |
---|
| 2510 | + { |
---|
| 2511 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2512 | + if (objectUI != null) |
---|
| 2513 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2514 | + else |
---|
| 2515 | + //new Exception().printStackTrace(); |
---|
| 2516 | + System.err.println("objectUI is null"); |
---|
| 2517 | + } |
---|
2390 | 2518 | } |
---|
2391 | 2519 | |
---|
2392 | 2520 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2428 | 2556 | { |
---|
2429 | 2557 | editWindow.refreshContents(); |
---|
2430 | 2558 | } |
---|
| 2559 | + else |
---|
| 2560 | + { |
---|
| 2561 | + if (manipWindow != null) |
---|
| 2562 | + { |
---|
| 2563 | + manipWindow.refreshContents(); |
---|
| 2564 | + } |
---|
| 2565 | + } |
---|
| 2566 | + |
---|
2431 | 2567 | //if (parent != null) |
---|
2432 | 2568 | //parent.refreshEditWindow(); |
---|
2433 | 2569 | } |
---|
.. | .. |
---|
2507 | 2643 | private static final int editSelf = 1; |
---|
2508 | 2644 | private static final int editChild = 2; |
---|
2509 | 2645 | |
---|
2510 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2646 | + void drawEditHandles(//ClickInfo info, |
---|
| 2647 | + int level) |
---|
2511 | 2648 | { |
---|
2512 | 2649 | if (level == 0) |
---|
2513 | 2650 | { |
---|
.. | .. |
---|
2515 | 2652 | return; |
---|
2516 | 2653 | |
---|
2517 | 2654 | Object3D selectee; |
---|
2518 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2655 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2656 | + level + 1)) |
---|
2519 | 2657 | { |
---|
2520 | 2658 | selectee = (Object3D) e.nextElement(); |
---|
2521 | 2659 | } |
---|
.. | .. |
---|
2523 | 2661 | } else |
---|
2524 | 2662 | { |
---|
2525 | 2663 | //super. |
---|
2526 | | - drawEditHandles0(info, level + 1); |
---|
| 2664 | + drawEditHandles0(//info, |
---|
| 2665 | + level + 1); |
---|
2527 | 2666 | } |
---|
2528 | 2667 | } |
---|
2529 | 2668 | |
---|
2530 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2669 | + boolean doEditClick(//ClickInfo info, |
---|
| 2670 | + int level) |
---|
2531 | 2671 | { |
---|
2532 | 2672 | doSomething = 0; |
---|
2533 | 2673 | if (level == 0) |
---|
2534 | 2674 | { |
---|
2535 | | - return doParentClick(info); |
---|
| 2675 | + return doParentClick(); //info); |
---|
2536 | 2676 | } |
---|
2537 | 2677 | if (//super. |
---|
2538 | | - doEditClick0(info, level)) |
---|
| 2678 | + doEditClick0(//info, |
---|
| 2679 | + level)) |
---|
2539 | 2680 | { |
---|
2540 | 2681 | doSomething = 1; |
---|
2541 | 2682 | return true; |
---|
.. | .. |
---|
2545 | 2686 | } |
---|
2546 | 2687 | } |
---|
2547 | 2688 | |
---|
2548 | | - boolean doParentClick(ClickInfo info) |
---|
| 2689 | + boolean doParentClick() //ClickInfo info) |
---|
2549 | 2690 | { |
---|
2550 | 2691 | if (selection == null) |
---|
2551 | 2692 | { |
---|
.. | .. |
---|
2558 | 2699 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2559 | 2700 | { |
---|
2560 | 2701 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2561 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2702 | + if (selectee.doEditClick(//info, |
---|
| 2703 | + 1)) |
---|
2562 | 2704 | { |
---|
2563 | 2705 | childToDrag = selectee; |
---|
2564 | 2706 | doSomething = 2; |
---|
.. | .. |
---|
2570 | 2712 | return retval; |
---|
2571 | 2713 | } |
---|
2572 | 2714 | |
---|
2573 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2715 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2716 | + boolean opposite) |
---|
2574 | 2717 | { |
---|
2575 | 2718 | switch (doSomething) |
---|
2576 | 2719 | { |
---|
2577 | 2720 | case 1: // '\001' |
---|
2578 | 2721 | //super. |
---|
2579 | | - doEditDrag0(info, opposite); |
---|
| 2722 | + doEditDrag0(//clickInfo, |
---|
| 2723 | + opposite); |
---|
2580 | 2724 | break; |
---|
2581 | 2725 | |
---|
2582 | 2726 | case 2: // '\002' |
---|
.. | .. |
---|
2589 | 2733 | { |
---|
2590 | 2734 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2591 | 2735 | //childToDrag.doEditDrag(info); |
---|
2592 | | - sel.doEditDrag(info, opposite); |
---|
| 2736 | + sel.doEditDrag(//clickInfo, |
---|
| 2737 | + opposite); |
---|
2593 | 2738 | } else |
---|
2594 | 2739 | { |
---|
2595 | 2740 | //super. |
---|
2596 | | - doEditDrag0(info, opposite); |
---|
| 2741 | + doEditDrag0(//clickInfo, |
---|
| 2742 | + opposite); |
---|
2597 | 2743 | } |
---|
2598 | 2744 | } |
---|
2599 | 2745 | break; |
---|
.. | .. |
---|
2611 | 2757 | { |
---|
2612 | 2758 | deselectAll(); |
---|
2613 | 2759 | } |
---|
| 2760 | + |
---|
| 2761 | + new Exception().printStackTrace(); |
---|
| 2762 | + |
---|
2614 | 2763 | ClickInfo newInfo = new ClickInfo(); |
---|
2615 | 2764 | newInfo.flags = info.flags; |
---|
2616 | 2765 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3058 | 3207 | { |
---|
3059 | 3208 | if (bRep != null) |
---|
3060 | 3209 | { |
---|
3061 | | - bRep.GenerateNormalsMINE(); |
---|
| 3210 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3062 | 3211 | Touch(); |
---|
3063 | 3212 | } |
---|
3064 | 3213 | } |
---|
.. | .. |
---|
3468 | 3617 | |
---|
3469 | 3618 | void ClearMaterials() |
---|
3470 | 3619 | { |
---|
| 3620 | + if (blockloop) |
---|
| 3621 | + return; |
---|
| 3622 | + |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + |
---|
3471 | 3625 | ClearMaterial(); |
---|
3472 | | - for (int i = 0; i < size(); i++) |
---|
| 3626 | + for (int i = 0; i < Size(); i++) |
---|
3473 | 3627 | { |
---|
3474 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3628 | + Object3D child = (Object3D) get(i); |
---|
3475 | 3629 | if (child == null) |
---|
3476 | 3630 | continue; |
---|
3477 | 3631 | child.ClearMaterials(); |
---|
3478 | | - release(i); |
---|
3479 | 3632 | } |
---|
| 3633 | + |
---|
| 3634 | + blockloop = false; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + void ClearVersionList() |
---|
| 3638 | + { |
---|
| 3639 | + this.versionlist = null; |
---|
| 3640 | + this.versionindex = -1; |
---|
| 3641 | + this.versiontable = null; |
---|
| 3642 | + } |
---|
| 3643 | + |
---|
| 3644 | + void ClearVersions() |
---|
| 3645 | + { |
---|
| 3646 | + if (blockloop) |
---|
| 3647 | + return; |
---|
| 3648 | + |
---|
| 3649 | + blockloop = true; |
---|
| 3650 | + |
---|
| 3651 | + ClearVersionList(); |
---|
| 3652 | + for (int i = 0; i < Size(); i++) |
---|
| 3653 | + { |
---|
| 3654 | + Object3D child = (Object3D) get(i); |
---|
| 3655 | + if (child == null) |
---|
| 3656 | + continue; |
---|
| 3657 | + child.ClearVersions(); |
---|
| 3658 | + } |
---|
| 3659 | + |
---|
| 3660 | + blockloop = false; |
---|
3480 | 3661 | } |
---|
3481 | 3662 | |
---|
3482 | 3663 | void FlipV(boolean flip) |
---|
.. | .. |
---|
4958 | 5139 | } |
---|
4959 | 5140 | } |
---|
4960 | 5141 | |
---|
| 5142 | + ObjEditor GetWindow() |
---|
| 5143 | + { |
---|
| 5144 | + if (editWindow != null) |
---|
| 5145 | + return editWindow; |
---|
| 5146 | + |
---|
| 5147 | + return manipWindow; |
---|
| 5148 | + } |
---|
| 5149 | + |
---|
4961 | 5150 | cTreePath Select(int indexcount, boolean deselect) |
---|
4962 | 5151 | { |
---|
4963 | 5152 | if (hide || dontselect) |
---|
.. | .. |
---|
4994 | 5183 | if (leaf != null) |
---|
4995 | 5184 | { |
---|
4996 | 5185 | cTreePath tp = new cTreePath(this, leaf); |
---|
4997 | | - if (editWindow != null) |
---|
| 5186 | + ObjEditor window = GetWindow(); |
---|
| 5187 | + if (window != null) |
---|
4998 | 5188 | { |
---|
4999 | 5189 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
5000 | | - editWindow.Select(tp, deselect, true); |
---|
| 5190 | + window.Select(tp, deselect, true); |
---|
5001 | 5191 | } |
---|
5002 | 5192 | |
---|
5003 | 5193 | return tp; |
---|
.. | .. |
---|
5014 | 5204 | |
---|
5015 | 5205 | if (child == null) |
---|
5016 | 5206 | continue; |
---|
| 5207 | + |
---|
5017 | 5208 | if (child.HasTransparency() && child.size() != 0) |
---|
5018 | 5209 | { |
---|
5019 | 5210 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
5023 | 5214 | if (leaf != null) |
---|
5024 | 5215 | { |
---|
5025 | 5216 | cTreePath tp = new cTreePath(this, leaf); |
---|
5026 | | - if (editWindow != null) |
---|
| 5217 | + ObjEditor window = GetWindow(); |
---|
| 5218 | + if (window != null) |
---|
5027 | 5219 | { |
---|
5028 | | - editWindow.Select(tp, deselect, true); |
---|
| 5220 | + window.Select(tp, deselect, true); |
---|
5029 | 5221 | } |
---|
5030 | 5222 | |
---|
5031 | 5223 | return tp; |
---|
.. | .. |
---|
5350 | 5542 | blockloop = false; |
---|
5351 | 5543 | } |
---|
5352 | 5544 | |
---|
| 5545 | + void ResetSelectable() |
---|
| 5546 | + { |
---|
| 5547 | + if (blockloop) |
---|
| 5548 | + return; |
---|
| 5549 | + |
---|
| 5550 | + blockloop = true; |
---|
| 5551 | + |
---|
| 5552 | + keepdontselect = dontselect; |
---|
| 5553 | + dontselect = true; |
---|
| 5554 | + |
---|
| 5555 | + Object3D child; |
---|
| 5556 | + int nb = Size(); |
---|
| 5557 | + for (int i = 0; i < nb; i++) |
---|
| 5558 | + { |
---|
| 5559 | + child = (Object3D) get(i); |
---|
| 5560 | + if (child == null) |
---|
| 5561 | + continue; |
---|
| 5562 | + child.ResetSelectable(); |
---|
| 5563 | + } |
---|
| 5564 | + |
---|
| 5565 | + blockloop = false; |
---|
| 5566 | + } |
---|
| 5567 | + |
---|
| 5568 | + void RestoreSelectable() |
---|
| 5569 | + { |
---|
| 5570 | + if (blockloop) |
---|
| 5571 | + return; |
---|
| 5572 | + |
---|
| 5573 | + blockloop = true; |
---|
| 5574 | + |
---|
| 5575 | + dontselect = keepdontselect; |
---|
| 5576 | + |
---|
| 5577 | + Object3D child; |
---|
| 5578 | + int nb = Size(); |
---|
| 5579 | + for (int i = 0; i < nb; i++) |
---|
| 5580 | + { |
---|
| 5581 | + child = (Object3D) get(i); |
---|
| 5582 | + if (child == null) |
---|
| 5583 | + continue; |
---|
| 5584 | + child.RestoreSelectable(); |
---|
| 5585 | + } |
---|
| 5586 | + |
---|
| 5587 | + blockloop = false; |
---|
| 5588 | + } |
---|
| 5589 | + |
---|
5353 | 5590 | boolean IsSelected() |
---|
5354 | 5591 | { |
---|
5355 | 5592 | if (parent == null) |
---|
.. | .. |
---|
5410 | 5647 | if (fullname == null) |
---|
5411 | 5648 | return ""; |
---|
5412 | 5649 | |
---|
| 5650 | + if (fullname.pigment != null) |
---|
| 5651 | + { |
---|
| 5652 | + return fullname.pigment; |
---|
| 5653 | + } |
---|
| 5654 | + |
---|
5413 | 5655 | // System.out.println("Fullname = " + fullname); |
---|
5414 | 5656 | |
---|
5415 | 5657 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5422 | 5664 | |
---|
5423 | 5665 | if (split.length == 0) |
---|
5424 | 5666 | { |
---|
5425 | | - return ""; |
---|
| 5667 | + return fullname.pigment = ""; |
---|
5426 | 5668 | } |
---|
5427 | 5669 | |
---|
5428 | 5670 | if (split.length <= 2) |
---|
.. | .. |
---|
5430 | 5672 | if (fullname.name.endsWith(":")) |
---|
5431 | 5673 | { |
---|
5432 | 5674 | // Windows |
---|
5433 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5675 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5434 | 5676 | } |
---|
5435 | 5677 | |
---|
5436 | | - return split[0]; |
---|
| 5678 | + return fullname.pigment = split[0]; |
---|
5437 | 5679 | } |
---|
5438 | 5680 | |
---|
5439 | 5681 | // Windows |
---|
5440 | 5682 | assert(split.length == 4); |
---|
5441 | 5683 | |
---|
5442 | | - return split[0] + ":" + split[1]; |
---|
| 5684 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5443 | 5685 | } |
---|
5444 | 5686 | |
---|
5445 | 5687 | static String GetBump(cTexture fullname) |
---|
5446 | 5688 | { |
---|
5447 | 5689 | if (fullname == null) |
---|
5448 | 5690 | return ""; |
---|
| 5691 | + |
---|
| 5692 | + if (fullname.bump != null) |
---|
| 5693 | + { |
---|
| 5694 | + return fullname.bump; |
---|
| 5695 | + } |
---|
5449 | 5696 | |
---|
5450 | 5697 | // System.out.println("Fullname = " + fullname); |
---|
5451 | 5698 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5457 | 5704 | |
---|
5458 | 5705 | if (split.length == 0) |
---|
5459 | 5706 | { |
---|
5460 | | - return ""; |
---|
| 5707 | + return fullname.bump = ""; |
---|
5461 | 5708 | } |
---|
5462 | 5709 | |
---|
5463 | 5710 | if (split.length == 1) |
---|
5464 | 5711 | { |
---|
5465 | | - return ""; |
---|
| 5712 | + return fullname.bump = ""; |
---|
5466 | 5713 | } |
---|
5467 | 5714 | |
---|
5468 | 5715 | if (split.length == 2) |
---|
.. | .. |
---|
5470 | 5717 | if (fullname.name.endsWith(":")) |
---|
5471 | 5718 | { |
---|
5472 | 5719 | // Windows |
---|
5473 | | - return ""; |
---|
| 5720 | + return fullname.bump = ""; |
---|
5474 | 5721 | } |
---|
5475 | 5722 | |
---|
5476 | | - return split[1]; |
---|
| 5723 | + return fullname.bump = split[1]; |
---|
5477 | 5724 | } |
---|
5478 | 5725 | |
---|
5479 | 5726 | // Windows |
---|
5480 | 5727 | assert(split.length == 4); |
---|
5481 | 5728 | |
---|
5482 | | - return split[2] + ":" + split[3]; |
---|
| 5729 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5483 | 5730 | } |
---|
5484 | 5731 | |
---|
5485 | 5732 | String GetPigmentTexture() |
---|
.. | .. |
---|
5562 | 5809 | texname = ""; |
---|
5563 | 5810 | |
---|
5564 | 5811 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5812 | + |
---|
| 5813 | + GetTextures().pigment = null; |
---|
| 5814 | + |
---|
5565 | 5815 | Touch(); |
---|
5566 | 5816 | } |
---|
5567 | 5817 | |
---|
.. | .. |
---|
5635 | 5885 | |
---|
5636 | 5886 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5637 | 5887 | |
---|
| 5888 | + GetTextures().bump = null; |
---|
| 5889 | + |
---|
5638 | 5890 | Touch(); |
---|
5639 | 5891 | } |
---|
5640 | 5892 | |
---|
.. | .. |
---|
5655 | 5907 | |
---|
5656 | 5908 | blockloop = true; |
---|
5657 | 5909 | child.ResetBumpTexture(); |
---|
| 5910 | + blockloop = false; |
---|
| 5911 | + } |
---|
| 5912 | + } |
---|
| 5913 | + |
---|
| 5914 | + void EmbedTextures(boolean embed) |
---|
| 5915 | + { |
---|
| 5916 | + if (blockloop) |
---|
| 5917 | + return; |
---|
| 5918 | + |
---|
| 5919 | + //if (GetTextures() != null) |
---|
| 5920 | + if (embed) |
---|
| 5921 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 5922 | + else |
---|
| 5923 | + { |
---|
| 5924 | + GetTextures().pigmentdata = null; |
---|
| 5925 | + GetTextures().bumpdata = null; |
---|
| 5926 | + GetTextures().pw = 0; |
---|
| 5927 | + GetTextures().ph = 0; |
---|
| 5928 | + GetTextures().bw = 0; |
---|
| 5929 | + GetTextures().bh = 0; |
---|
| 5930 | + } |
---|
| 5931 | + |
---|
| 5932 | + int nb = Size(); |
---|
| 5933 | + for (int i = 0; i < nb; i++) |
---|
| 5934 | + { |
---|
| 5935 | + Object3D child = (Object3D) get(i); |
---|
| 5936 | + |
---|
| 5937 | + if (child == null) |
---|
| 5938 | + continue; |
---|
| 5939 | + |
---|
| 5940 | + blockloop = true; |
---|
| 5941 | + child.EmbedTextures(embed); |
---|
5658 | 5942 | blockloop = false; |
---|
5659 | 5943 | } |
---|
5660 | 5944 | } |
---|
.. | .. |
---|
5745 | 6029 | if (support != null) |
---|
5746 | 6030 | support = support; |
---|
5747 | 6031 | |
---|
5748 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5749 | | - boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6032 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6033 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6034 | + |
---|
| 6035 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5750 | 6036 | |
---|
5751 | 6037 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5752 | 6038 | { |
---|
.. | .. |
---|
5756 | 6042 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5757 | 6043 | // usecalllists = false; |
---|
5758 | 6044 | |
---|
5759 | | - if (GetBRep() != null) |
---|
5760 | | - usecalllists = usecalllists; |
---|
| 6045 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6046 | + //GetBRep() != null) |
---|
| 6047 | + usecalllists = !!usecalllists; |
---|
5761 | 6048 | //System.out.println("draw " + this); |
---|
5762 | 6049 | //new Exception().printStackTrace(); |
---|
5763 | 6050 | |
---|
.. | .. |
---|
5767 | 6054 | |
---|
5768 | 6055 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5769 | 6056 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5770 | | - (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 6057 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5771 | 6058 | { |
---|
5772 | 6059 | Globals.lighttouched = true; |
---|
5773 | 6060 | } // all panes... |
---|
.. | .. |
---|
5779 | 6066 | if (!(this instanceof Composite)) |
---|
5780 | 6067 | touched = false; |
---|
5781 | 6068 | //if (displaylist == -1 && usecalllists) |
---|
5782 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6069 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5783 | 6070 | { |
---|
5784 | 6071 | bRep.displaylist = display.GenList(); |
---|
5785 | 6072 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5790 | 6077 | |
---|
5791 | 6078 | //System.out.println("\tnew list " + list); |
---|
5792 | 6079 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5793 | | - if (usecalllists) |
---|
| 6080 | + if (usecalllists && bRep.displaylist > 0) |
---|
5794 | 6081 | { |
---|
5795 | 6082 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5796 | 6083 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5799 | 6086 | CallList(display, root, selected, blocked); |
---|
5800 | 6087 | |
---|
5801 | 6088 | // compiled = true; |
---|
5802 | | - if (usecalllists) |
---|
| 6089 | + if (usecalllists && bRep.displaylist > 0) |
---|
5803 | 6090 | { |
---|
5804 | 6091 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5805 | 6092 | display.EndList(); |
---|
.. | .. |
---|
5899 | 6186 | if (GetBRep() != null) |
---|
5900 | 6187 | { |
---|
5901 | 6188 | display.NextIndex(); |
---|
| 6189 | + |
---|
5902 | 6190 | // vertex color conflict : gl.glCallList(list); |
---|
5903 | 6191 | DrawNode(display, root, selected); |
---|
5904 | 6192 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
6359 | 6647 | // dec 2012 |
---|
6360 | 6648 | new Exception().printStackTrace(); |
---|
6361 | 6649 | return; |
---|
| 6650 | + } |
---|
| 6651 | + |
---|
| 6652 | + if (dontselect) |
---|
| 6653 | + { |
---|
| 6654 | + //bRep.GenerateNormalsMINE(); |
---|
6362 | 6655 | } |
---|
6363 | 6656 | |
---|
6364 | 6657 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7144 | 7437 | } |
---|
7145 | 7438 | } |
---|
7146 | 7439 | |
---|
7147 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7440 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7441 | + |
---|
| 7442 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7443 | + Point outPt, Rectangle outRec) |
---|
7148 | 7444 | { |
---|
7149 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7150 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7151 | | - double[][] toscreen = info.toScreen; |
---|
| 7445 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7446 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7447 | + double[][] toscreen = clickInfo.toScreen; |
---|
7152 | 7448 | if (toscreen == null) |
---|
7153 | 7449 | { |
---|
7154 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7450 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7155 | 7451 | } |
---|
7156 | 7452 | cVector vec = in; |
---|
7157 | 7453 | LA.xformPos(in, toscreen, in); |
---|
7158 | 7454 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7159 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7160 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7455 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7456 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7161 | 7457 | outPt.x = hc + (int) vec.x; |
---|
7162 | 7458 | outPt.y = vc - (int) vec.y; |
---|
7163 | 7459 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7165 | 7461 | outRec.width = outRec.height = 6; |
---|
7166 | 7462 | } |
---|
7167 | 7463 | |
---|
7168 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7464 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7465 | + ) |
---|
7169 | 7466 | { |
---|
7170 | 7467 | Point pt = new Point(0, 0); |
---|
7171 | 7468 | Rectangle rec = new Rectangle(); |
---|
7172 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7469 | + calcHotSpot(in, //clickInfo, |
---|
| 7470 | + pt, rec); |
---|
7173 | 7471 | return rec; |
---|
7174 | 7472 | } |
---|
7175 | 7473 | |
---|
7176 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7474 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7475 | + int level) |
---|
7177 | 7476 | { |
---|
7178 | 7477 | if (level == 0) |
---|
7179 | 7478 | { |
---|
.. | .. |
---|
7182 | 7481 | { |
---|
7183 | 7482 | cVector origin = new cVector(); |
---|
7184 | 7483 | //LA.xformPos(origin, toParent, origin); |
---|
7185 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7484 | + if (this.clickInfo == null) |
---|
| 7485 | + this.clickInfo = new ClickInfo(); |
---|
| 7486 | + |
---|
| 7487 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7186 | 7488 | Rectangle boundary = new Rectangle(); |
---|
7187 | 7489 | boundary.x = spot.x - 30; |
---|
7188 | 7490 | boundary.y = spot.y - 30; |
---|
7189 | 7491 | boundary.width = spot.width + 60; |
---|
7190 | 7492 | boundary.height = spot.height + 60; |
---|
7191 | | - info.g.setColor(Color.red); |
---|
| 7493 | + clickInfo.g.setColor(Color.white); |
---|
7192 | 7494 | int spotw = spot.x + spot.width; |
---|
7193 | 7495 | int spoth = spot.y + spot.height; |
---|
7194 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7496 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7195 | 7497 | // if (CameraPane.Xmin > spot.x) |
---|
7196 | 7498 | // { |
---|
7197 | 7499 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7208 | 7510 | // { |
---|
7209 | 7511 | // CameraPane.Ymax = spoth; |
---|
7210 | 7512 | // } |
---|
7211 | | - spot.translate(32, 32); |
---|
7212 | | - spotw = spot.x + spot.width; |
---|
7213 | | - spoth = spot.y + spot.height; |
---|
7214 | | - info.g.setColor(Color.cyan); |
---|
7215 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7216 | 7513 | // if (CameraPane.Xmin > spot.x) |
---|
7217 | 7514 | // { |
---|
7218 | 7515 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7231 | 7528 | // } |
---|
7232 | 7529 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7233 | 7530 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7234 | | - spot.translate(0, -32); |
---|
7235 | | - info.g.setColor(Color.yellow); |
---|
7236 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7237 | | - info.g.setColor(Color.green); |
---|
| 7531 | + spot.translate(32, 0); |
---|
| 7532 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7533 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7534 | + |
---|
| 7535 | + spot.translate(32, 64); |
---|
| 7536 | + spotw = spot.x + spot.width; |
---|
| 7537 | + spoth = spot.y + spot.height; |
---|
| 7538 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7539 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7238 | 7540 | // if (CameraPane.Xmin > spot.x) |
---|
7239 | 7541 | // { |
---|
7240 | 7542 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7251 | 7553 | // { |
---|
7252 | 7554 | // CameraPane.Ymax = spoth; |
---|
7253 | 7555 | // } |
---|
7254 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7255 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7556 | + clickInfo.g.setColor(Color.green); |
---|
| 7557 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7558 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7256 | 7559 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7257 | 7560 | // if (CameraPane.Xmin > boundary.x) |
---|
7258 | 7561 | // { |
---|
.. | .. |
---|
7274 | 7577 | } |
---|
7275 | 7578 | } |
---|
7276 | 7579 | |
---|
7277 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7580 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7581 | + int level) |
---|
7278 | 7582 | { |
---|
7279 | 7583 | if (level == 0) |
---|
7280 | 7584 | { |
---|
.. | .. |
---|
7283 | 7587 | |
---|
7284 | 7588 | boolean retval = false; |
---|
7285 | 7589 | |
---|
7286 | | - startX = info.x; |
---|
7287 | | - startY = info.y; |
---|
| 7590 | + startX = clickInfo.x; |
---|
| 7591 | + startY = clickInfo.y; |
---|
7288 | 7592 | |
---|
7289 | 7593 | hitSomething = -1; |
---|
7290 | 7594 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7294 | 7598 | { |
---|
7295 | 7599 | centerPt = new Point(0, 0); |
---|
7296 | 7600 | } |
---|
7297 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7298 | | - if (spot.contains(info.x, info.y)) |
---|
| 7601 | + calcHotSpot(origin, //info, |
---|
| 7602 | + centerPt, spot); |
---|
| 7603 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7299 | 7604 | { |
---|
7300 | 7605 | hitSomething = hitCenter; |
---|
7301 | 7606 | retval = true; |
---|
7302 | 7607 | } |
---|
7303 | 7608 | spot.translate(32, 0); |
---|
7304 | | - if (spot.contains(info.x, info.y)) |
---|
| 7609 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7305 | 7610 | { |
---|
7306 | 7611 | hitSomething = hitRotate; |
---|
7307 | 7612 | retval = true; |
---|
7308 | 7613 | } |
---|
7309 | 7614 | spot.translate(0, 32); |
---|
7310 | | - if (spot.contains(info.x, info.y)) |
---|
| 7615 | + spot.translate(32, 0); |
---|
| 7616 | + spot.translate(0, 32); |
---|
| 7617 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7311 | 7618 | { |
---|
7312 | 7619 | hitSomething = hitScale; |
---|
| 7620 | + |
---|
| 7621 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7622 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7623 | + double sign = 1; |
---|
| 7624 | + if (hScale < 0) |
---|
| 7625 | + { |
---|
| 7626 | + sign = -1; |
---|
| 7627 | + } |
---|
| 7628 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7629 | + if (hScale < 0.01) |
---|
| 7630 | + { |
---|
| 7631 | + //hScale = 0.01; |
---|
| 7632 | + } |
---|
| 7633 | + |
---|
| 7634 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7635 | + sign = 1; |
---|
| 7636 | + if (vScale < 0) |
---|
| 7637 | + { |
---|
| 7638 | + sign = -1; |
---|
| 7639 | + } |
---|
| 7640 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7641 | + if (vScale < 0.01) |
---|
| 7642 | + { |
---|
| 7643 | + //vScale = 0.01; |
---|
| 7644 | + } |
---|
| 7645 | + |
---|
| 7646 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7647 | + |
---|
7313 | 7648 | retval = true; |
---|
7314 | 7649 | } |
---|
7315 | 7650 | |
---|
.. | .. |
---|
7319 | 7654 | } |
---|
7320 | 7655 | |
---|
7321 | 7656 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7322 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7657 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7323 | 7658 | //System.out.println("modified = " + modified); |
---|
7324 | 7659 | //new Exception().printStackTrace(); |
---|
7325 | 7660 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7347 | 7682 | return true; |
---|
7348 | 7683 | } |
---|
7349 | 7684 | |
---|
7350 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7685 | + void doEditDrag0(//ClickInfo info, |
---|
| 7686 | + boolean opposite) |
---|
7351 | 7687 | { |
---|
7352 | 7688 | if (hitSomething == 0) |
---|
7353 | 7689 | { |
---|
.. | .. |
---|
7361 | 7697 | |
---|
7362 | 7698 | //System.out.println("hitSomething = " + hitSomething); |
---|
7363 | 7699 | |
---|
7364 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7700 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7365 | 7701 | |
---|
7366 | 7702 | cVector xlate = new cVector(); |
---|
7367 | 7703 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7375 | 7711 | |
---|
7376 | 7712 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7377 | 7713 | |
---|
7378 | | - if (modified || opposite) |
---|
| 7714 | + // Modified could snap |
---|
| 7715 | + if (//modified || |
---|
| 7716 | + opposite) |
---|
7379 | 7717 | { |
---|
7380 | 7718 | //assert(false); |
---|
7381 | 7719 | /* |
---|
.. | .. |
---|
7395 | 7733 | toParent[3][i] = xlate.get(i); |
---|
7396 | 7734 | LA.matInvert(toParent, fromParent); |
---|
7397 | 7735 | */ |
---|
7398 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7399 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7736 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7737 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7400 | 7738 | |
---|
7401 | 7739 | LA.matCopy(startMat, toParent); |
---|
7402 | 7740 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7405 | 7743 | } else |
---|
7406 | 7744 | { |
---|
7407 | 7745 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7408 | | - cVector up = new cVector(info.camera.up); |
---|
| 7746 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7409 | 7747 | cVector away = new cVector(); |
---|
7410 | 7748 | //cVector right2 = new cVector(); |
---|
7411 | 7749 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7422 | 7760 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7423 | 7761 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7424 | 7762 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7425 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7763 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7426 | 7764 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7427 | 7765 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7428 | 7766 | //LA.vecCross(up, cVector.Z, right2); |
---|
7429 | 7767 | |
---|
7430 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7768 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7431 | 7769 | |
---|
7432 | 7770 | //System.out.println("DELTA0 = " + delta); |
---|
7433 | 7771 | //System.out.println("AWAY = " + info.camera.away); |
---|
7434 | 7772 | //System.out.println("UP = " + info.camera.up); |
---|
7435 | 7773 | if (away.z > 0) |
---|
7436 | 7774 | { |
---|
7437 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7775 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7438 | 7776 | { |
---|
7439 | 7777 | delta.x = -delta.x; |
---|
7440 | 7778 | } else |
---|
.. | .. |
---|
7449 | 7787 | //System.out.println("DELTA1 = " + delta); |
---|
7450 | 7788 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7451 | 7789 | //System.out.println("DELTA2 = " + delta); |
---|
7452 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7790 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7453 | 7791 | LA.matCopy(startMat, toParent); |
---|
7454 | 7792 | //System.out.println("DELTA3 = " + delta); |
---|
7455 | 7793 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7459 | 7797 | break; |
---|
7460 | 7798 | |
---|
7461 | 7799 | case hitRotate: // rotate |
---|
7462 | | - int dx = info.x - centerPt.x; |
---|
7463 | | - int dy = -(info.y - centerPt.y); |
---|
| 7800 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7801 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7464 | 7802 | double angle = (double) Math.atan2(dx, dy); |
---|
7465 | 7803 | angle = -(1.570796 - angle); |
---|
7466 | 7804 | |
---|
.. | .. |
---|
7469 | 7807 | |
---|
7470 | 7808 | if (modified) |
---|
7471 | 7809 | { |
---|
7472 | | - // Rotate 90 degrees |
---|
| 7810 | + // Rotate 45 degrees |
---|
7473 | 7811 | angle /= (Math.PI / 4); |
---|
7474 | 7812 | angle = Math.floor(angle + 0.5); |
---|
7475 | 7813 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7483 | 7821 | } |
---|
7484 | 7822 | /**/ |
---|
7485 | 7823 | |
---|
7486 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7824 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7487 | 7825 | { |
---|
7488 | 7826 | case 1: // '\001' |
---|
7489 | 7827 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7510 | 7848 | break; |
---|
7511 | 7849 | |
---|
7512 | 7850 | case hitScale: // scale |
---|
7513 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7851 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7514 | 7852 | double sign = 1; |
---|
7515 | 7853 | if (hScale < 0) |
---|
7516 | 7854 | { |
---|
.. | .. |
---|
7522 | 7860 | //hScale = 0.01; |
---|
7523 | 7861 | } |
---|
7524 | 7862 | |
---|
7525 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7863 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7526 | 7864 | sign = 1; |
---|
7527 | 7865 | if (vScale < 0) |
---|
7528 | 7866 | { |
---|
.. | .. |
---|
7533 | 7871 | { |
---|
7534 | 7872 | //vScale = 0.01; |
---|
7535 | 7873 | } |
---|
| 7874 | + |
---|
7536 | 7875 | LA.matCopy(startMat, toParent); |
---|
7537 | 7876 | /**/ |
---|
7538 | 7877 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7542 | 7881 | } |
---|
7543 | 7882 | /**/ |
---|
7544 | 7883 | |
---|
7545 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7884 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7546 | 7885 | |
---|
7547 | 7886 | if (totalScale < 0.01) |
---|
7548 | 7887 | { |
---|
7549 | 7888 | totalScale = 0.01; |
---|
7550 | 7889 | } |
---|
7551 | 7890 | |
---|
7552 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7891 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7553 | 7892 | { |
---|
7554 | 7893 | case 3: // '\001' |
---|
7555 | 7894 | if (modified || opposite) |
---|
7556 | 7895 | { |
---|
| 7896 | + if (modified) // && opposite) |
---|
| 7897 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7898 | + else |
---|
7557 | 7899 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7558 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7900 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7559 | 7901 | } // vScale, 1); |
---|
7560 | 7902 | else |
---|
7561 | 7903 | { |
---|
7562 | 7904 | // EXCEPTION! |
---|
7563 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7905 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7564 | 7906 | } // vScale, 1); |
---|
7565 | 7907 | break; |
---|
7566 | 7908 | |
---|
7567 | 7909 | case 2: // '\002' |
---|
7568 | 7910 | if (modified || opposite) |
---|
7569 | 7911 | { |
---|
7570 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7571 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7912 | + if (modified) // && opposite) |
---|
| 7913 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7914 | + else |
---|
| 7915 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7916 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7572 | 7917 | } else |
---|
7573 | 7918 | { |
---|
7574 | 7919 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7578 | 7923 | case 1: // '\003' |
---|
7579 | 7924 | if (modified || opposite) |
---|
7580 | 7925 | { |
---|
7581 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7582 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7926 | + if (modified) // && opposite) |
---|
| 7927 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7928 | + else |
---|
| 7929 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7930 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7583 | 7931 | } else |
---|
7584 | 7932 | { |
---|
7585 | 7933 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7616 | 7964 | } // NEW ... |
---|
7617 | 7965 | |
---|
7618 | 7966 | |
---|
7619 | | - info.pane.repaint(); |
---|
| 7967 | + clickInfo.pane.repaint(); |
---|
7620 | 7968 | } |
---|
7621 | 7969 | |
---|
7622 | 7970 | boolean overflow = false; |
---|
.. | .. |
---|
7796 | 8144 | editWindow = null; |
---|
7797 | 8145 | } // ? |
---|
7798 | 8146 | } |
---|
| 8147 | + else |
---|
| 8148 | + { |
---|
| 8149 | + //editWindow.closeUI(); |
---|
| 8150 | + } |
---|
7799 | 8151 | } |
---|
7800 | 8152 | |
---|
7801 | 8153 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7953 | 8305 | } |
---|
7954 | 8306 | |
---|
7955 | 8307 | transient ObjEditor editWindow; |
---|
| 8308 | + transient ObjEditor manipWindow; |
---|
| 8309 | + |
---|
| 8310 | + transient boolean pinned; |
---|
| 8311 | + |
---|
7956 | 8312 | transient ObjectUI objectUI; |
---|
7957 | 8313 | public static int povDepth = 0; |
---|
7958 | 8314 | private static cVector tbMin = new cVector(); |
---|