.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
27 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
29 | 30 | Object3D saveskeleton; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
| 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>(); |
---|
| 40 | + |
---|
32 | 41 | ScriptNode scriptnode; |
---|
33 | 42 | |
---|
| 43 | + int VersionCount() |
---|
| 44 | + { |
---|
| 45 | + int count = 0; |
---|
| 46 | + |
---|
| 47 | + for (int i = versionlist.length; --i >= 0;) |
---|
| 48 | + { |
---|
| 49 | + if (versionlist[i] != null) |
---|
| 50 | + count++; |
---|
| 51 | + } |
---|
| 52 | + |
---|
| 53 | + return count; |
---|
| 54 | + } |
---|
| 55 | + |
---|
34 | 56 | void InitOthers() |
---|
35 | 57 | { |
---|
36 | 58 | if (projectedVertices == null || projectedVertices.length <= 2) |
---|
.. | .. |
---|
215 | 237 | // o.transientrep = this.bRep.support; |
---|
216 | 238 | // o.bRep.support = null; |
---|
217 | 239 | // } |
---|
| 240 | + o.selection = this.selection; |
---|
| 241 | + o.versionlist = this.versionlist; |
---|
| 242 | + o.versionindex = this.versionindex; |
---|
218 | 243 | |
---|
219 | 244 | if (this.support != null) |
---|
220 | 245 | { |
---|
.. | .. |
---|
235 | 260 | // this.bRep.support = null; |
---|
236 | 261 | // this.support = null; |
---|
237 | 262 | // this.fileparent = null; |
---|
| 263 | + } |
---|
| 264 | + |
---|
| 265 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 266 | +// { |
---|
| 267 | +// if (this.uuid.equals(uuid)) |
---|
| 268 | +// return this; |
---|
| 269 | +// |
---|
| 270 | +// if (blockloop) |
---|
| 271 | +// return null; |
---|
| 272 | +// |
---|
| 273 | +// blockloop = true; |
---|
| 274 | +// |
---|
| 275 | +// for (int i=0; i<Size(); i++) |
---|
| 276 | +// { |
---|
| 277 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 278 | +// |
---|
| 279 | +// if (o != null) |
---|
| 280 | +// return o; |
---|
| 281 | +// } |
---|
| 282 | +// |
---|
| 283 | +// blockloop = false; |
---|
| 284 | +// |
---|
| 285 | +// return null; |
---|
| 286 | +// } |
---|
| 287 | + |
---|
| 288 | + transient boolean tag; |
---|
| 289 | + |
---|
| 290 | + void TagObjects(Object3D o, boolean tag) |
---|
| 291 | + { |
---|
| 292 | + if (blockloop) |
---|
| 293 | + return; |
---|
| 294 | + |
---|
| 295 | + o.tag = tag; |
---|
| 296 | + |
---|
| 297 | + if (o == this) |
---|
| 298 | + return; |
---|
| 299 | + |
---|
| 300 | + blockloop = true; |
---|
| 301 | + |
---|
| 302 | + for (int i=0; i<Size(); i++) |
---|
| 303 | + { |
---|
| 304 | + get(i).TagObjects(o, tag); |
---|
| 305 | + } |
---|
| 306 | + |
---|
| 307 | + blockloop = false; |
---|
| 308 | + } |
---|
| 309 | + |
---|
| 310 | + boolean HasTags() |
---|
| 311 | + { |
---|
| 312 | + if (blockloop) |
---|
| 313 | + return false; |
---|
| 314 | + |
---|
| 315 | + blockloop = true; |
---|
| 316 | + |
---|
| 317 | + boolean hasTags = false; |
---|
| 318 | + |
---|
| 319 | + for (int i=0; i<Size(); i++) |
---|
| 320 | + { |
---|
| 321 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 322 | + |
---|
| 323 | + if (hasTags) |
---|
| 324 | + break; |
---|
| 325 | + } |
---|
| 326 | + |
---|
| 327 | + blockloop = false; |
---|
| 328 | + |
---|
| 329 | + return hasTags; |
---|
238 | 330 | } |
---|
239 | 331 | |
---|
240 | 332 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
.. | .. |
---|
268 | 360 | { |
---|
269 | 361 | this.support.bRep = o.transientrep; |
---|
270 | 362 | } |
---|
| 363 | + |
---|
| 364 | + this.selection = o.selection; |
---|
| 365 | + |
---|
| 366 | + this.versionlist = o.versionlist; |
---|
| 367 | + this.versionindex = o.versionindex; |
---|
271 | 368 | // July 2019 if (this.bRep != null) |
---|
272 | 369 | // this.bRep.support = o.transientrep; |
---|
273 | 370 | // this.support = o.support; |
---|
.. | .. |
---|
415 | 512 | } |
---|
416 | 513 | |
---|
417 | 514 | boolean live = false; |
---|
| 515 | + transient boolean keepdontselect; |
---|
418 | 516 | boolean dontselect = false; |
---|
419 | 517 | boolean hide = false; |
---|
420 | 518 | boolean link2master = false; // performs reset support/master at each frame |
---|
.. | .. |
---|
483 | 581 | } |
---|
484 | 582 | } |
---|
485 | 583 | |
---|
486 | | - int memorysize; |
---|
| 584 | + transient int memorysize; // needs to be transient, dunno why |
---|
487 | 585 | |
---|
488 | 586 | int MemorySize() |
---|
489 | 587 | { |
---|
490 | | - if (true) // memorysize == 0) |
---|
| 588 | + if (memorysize == 0) |
---|
491 | 589 | { |
---|
492 | 590 | try |
---|
493 | 591 | { |
---|
.. | .. |
---|
602 | 700 | { |
---|
603 | 701 | if (maxcount != 1) |
---|
604 | 702 | { |
---|
605 | | - new Exception().printStackTrace(); |
---|
| 703 | + //new Exception().printStackTrace(); |
---|
606 | 704 | } |
---|
607 | 705 | |
---|
608 | 706 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
999 | 1097 | |
---|
1000 | 1098 | if (material == null || material.multiply) |
---|
1001 | 1099 | return true; |
---|
| 1100 | + |
---|
| 1101 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1102 | + return false; |
---|
1002 | 1103 | |
---|
1003 | 1104 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1004 | 1105 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2281 | 2382 | |
---|
2282 | 2383 | InitOthers(); |
---|
2283 | 2384 | |
---|
2284 | | - if (this instanceof Camera) |
---|
2285 | | - { |
---|
2286 | | - material.shift = 90; |
---|
2287 | | - } |
---|
2288 | | - |
---|
2289 | 2385 | material.multiply = multiply; |
---|
2290 | 2386 | |
---|
2291 | 2387 | if (multiply) |
---|
.. | .. |
---|
2426 | 2522 | else |
---|
2427 | 2523 | { |
---|
2428 | 2524 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2525 | + if (objectUI != null) |
---|
| 2526 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2527 | + else |
---|
| 2528 | + //new Exception().printStackTrace(); |
---|
| 2529 | + System.err.println("objectUI is null"); |
---|
2429 | 2530 | } |
---|
2430 | 2531 | } |
---|
2431 | 2532 | |
---|
.. | .. |
---|
2555 | 2656 | private static final int editSelf = 1; |
---|
2556 | 2657 | private static final int editChild = 2; |
---|
2557 | 2658 | |
---|
2558 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 2659 | + void drawEditHandles(//ClickInfo info, |
---|
| 2660 | + int level) |
---|
2559 | 2661 | { |
---|
2560 | 2662 | if (level == 0) |
---|
2561 | 2663 | { |
---|
.. | .. |
---|
2563 | 2665 | return; |
---|
2564 | 2666 | |
---|
2565 | 2667 | Object3D selectee; |
---|
2566 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
---|
| 2668 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
---|
| 2669 | + level + 1)) |
---|
2567 | 2670 | { |
---|
2568 | 2671 | selectee = (Object3D) e.nextElement(); |
---|
2569 | 2672 | } |
---|
.. | .. |
---|
2571 | 2674 | } else |
---|
2572 | 2675 | { |
---|
2573 | 2676 | //super. |
---|
2574 | | - drawEditHandles0(info, level + 1); |
---|
| 2677 | + drawEditHandles0(//info, |
---|
| 2678 | + level + 1); |
---|
2575 | 2679 | } |
---|
2576 | 2680 | } |
---|
2577 | 2681 | |
---|
2578 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 2682 | + boolean doEditClick(//ClickInfo info, |
---|
| 2683 | + int level) |
---|
2579 | 2684 | { |
---|
2580 | 2685 | doSomething = 0; |
---|
2581 | 2686 | if (level == 0) |
---|
2582 | 2687 | { |
---|
2583 | | - return doParentClick(info); |
---|
| 2688 | + return doParentClick(); //info); |
---|
2584 | 2689 | } |
---|
2585 | 2690 | if (//super. |
---|
2586 | | - doEditClick0(info, level)) |
---|
| 2691 | + doEditClick0(//info, |
---|
| 2692 | + level)) |
---|
2587 | 2693 | { |
---|
2588 | 2694 | doSomething = 1; |
---|
2589 | 2695 | return true; |
---|
.. | .. |
---|
2593 | 2699 | } |
---|
2594 | 2700 | } |
---|
2595 | 2701 | |
---|
2596 | | - boolean doParentClick(ClickInfo info) |
---|
| 2702 | + boolean doParentClick() //ClickInfo info) |
---|
2597 | 2703 | { |
---|
2598 | 2704 | if (selection == null) |
---|
2599 | 2705 | { |
---|
.. | .. |
---|
2606 | 2712 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
---|
2607 | 2713 | { |
---|
2608 | 2714 | Object3D selectee = (Object3D) e.nextElement(); |
---|
2609 | | - if (selectee.doEditClick(info, 1)) |
---|
| 2715 | + if (selectee.doEditClick(//info, |
---|
| 2716 | + 1)) |
---|
2610 | 2717 | { |
---|
2611 | 2718 | childToDrag = selectee; |
---|
2612 | 2719 | doSomething = 2; |
---|
.. | .. |
---|
2618 | 2725 | return retval; |
---|
2619 | 2726 | } |
---|
2620 | 2727 | |
---|
2621 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 2728 | + void doEditDrag(//ClickInfo clickInfo, |
---|
| 2729 | + boolean opposite) |
---|
2622 | 2730 | { |
---|
2623 | 2731 | switch (doSomething) |
---|
2624 | 2732 | { |
---|
2625 | 2733 | case 1: // '\001' |
---|
2626 | 2734 | //super. |
---|
2627 | | - doEditDrag0(info, opposite); |
---|
| 2735 | + doEditDrag0(//clickInfo, |
---|
| 2736 | + opposite); |
---|
2628 | 2737 | break; |
---|
2629 | 2738 | |
---|
2630 | 2739 | case 2: // '\002' |
---|
.. | .. |
---|
2637 | 2746 | { |
---|
2638 | 2747 | //sel.hitSomething = childToDrag.hitSomething; |
---|
2639 | 2748 | //childToDrag.doEditDrag(info); |
---|
2640 | | - sel.doEditDrag(info, opposite); |
---|
| 2749 | + sel.doEditDrag(//clickInfo, |
---|
| 2750 | + opposite); |
---|
2641 | 2751 | } else |
---|
2642 | 2752 | { |
---|
2643 | 2753 | //super. |
---|
2644 | | - doEditDrag0(info, opposite); |
---|
| 2754 | + doEditDrag0(//clickInfo, |
---|
| 2755 | + opposite); |
---|
2645 | 2756 | } |
---|
2646 | 2757 | } |
---|
2647 | 2758 | break; |
---|
.. | .. |
---|
2659 | 2770 | { |
---|
2660 | 2771 | deselectAll(); |
---|
2661 | 2772 | } |
---|
| 2773 | + |
---|
| 2774 | + new Exception().printStackTrace(); |
---|
| 2775 | + |
---|
2662 | 2776 | ClickInfo newInfo = new ClickInfo(); |
---|
2663 | 2777 | newInfo.flags = info.flags; |
---|
2664 | 2778 | newInfo.bounds = info.bounds; |
---|
.. | .. |
---|
3106 | 3220 | { |
---|
3107 | 3221 | if (bRep != null) |
---|
3108 | 3222 | { |
---|
3109 | | - bRep.GenerateNormalsMINE(); |
---|
| 3223 | + bRep.MergeNormals(); //.GenerateNormalsMINE(); |
---|
3110 | 3224 | Touch(); |
---|
3111 | 3225 | } |
---|
3112 | 3226 | } |
---|
.. | .. |
---|
3163 | 3277 | blockloop = false; |
---|
3164 | 3278 | } |
---|
3165 | 3279 | |
---|
| 3280 | + public void ResetTransform(int mask) |
---|
| 3281 | + { |
---|
| 3282 | + Object3D obj = this; |
---|
| 3283 | + |
---|
| 3284 | + if (mask == -1) |
---|
| 3285 | + { |
---|
| 3286 | + if (obj instanceof Camera) // jan 2014 |
---|
| 3287 | + { |
---|
| 3288 | + LA.matIdentity(obj.toParent); |
---|
| 3289 | + LA.matIdentity(obj.fromParent); |
---|
| 3290 | + } |
---|
| 3291 | + else |
---|
| 3292 | + { |
---|
| 3293 | + obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
| 3294 | + obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
| 3295 | + } |
---|
| 3296 | + return; |
---|
| 3297 | + } |
---|
| 3298 | + |
---|
| 3299 | + if ((mask&2) != 0) // Scale/rotation |
---|
| 3300 | + { |
---|
| 3301 | + obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
| 3302 | + obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
| 3303 | + obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
| 3304 | + obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
| 3305 | + obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
| 3306 | + obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
| 3307 | + } |
---|
| 3308 | + if ((mask&1) != 0) // Translation |
---|
| 3309 | + { |
---|
| 3310 | + if (obj.toParent != null) |
---|
| 3311 | + { |
---|
| 3312 | + obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
| 3313 | + obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
| 3314 | + } |
---|
| 3315 | + } |
---|
| 3316 | + } |
---|
| 3317 | + |
---|
| 3318 | + public void TextureRatioTransform(int axis) |
---|
| 3319 | + { |
---|
| 3320 | + cTexture tex = GetTextures(); |
---|
| 3321 | + |
---|
| 3322 | + com.sun.opengl.util.texture.TextureData texturedata = null; |
---|
| 3323 | + |
---|
| 3324 | + try |
---|
| 3325 | + { |
---|
| 3326 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, texres); |
---|
| 3327 | + } |
---|
| 3328 | + catch (Exception e) |
---|
| 3329 | + { |
---|
| 3330 | + System.err.println("FAIL TextureRatio: " + this); |
---|
| 3331 | + } |
---|
| 3332 | + |
---|
| 3333 | + LA.matIdentity(Object3D.mat); |
---|
| 3334 | + Object3D.mat[axis][axis] = (double)texturedata.getWidth() / texturedata.getHeight(); |
---|
| 3335 | + |
---|
| 3336 | + if (toParent == null) |
---|
| 3337 | + { |
---|
| 3338 | + toParent = LA.newMatrix(); |
---|
| 3339 | + fromParent = LA.newMatrix(); |
---|
| 3340 | + } |
---|
| 3341 | + |
---|
| 3342 | + ResetTransform(2); |
---|
| 3343 | + |
---|
| 3344 | + LA.matConcat(Object3D.mat, fromParent, fromParent); |
---|
| 3345 | + LA.matInvert(fromParent, toParent); |
---|
| 3346 | + } |
---|
| 3347 | + |
---|
| 3348 | + void TextureRatio(int axis) |
---|
| 3349 | + { |
---|
| 3350 | + if (blockloop) |
---|
| 3351 | + return; |
---|
| 3352 | + |
---|
| 3353 | + blockloop = true; |
---|
| 3354 | + |
---|
| 3355 | + TextureRatioTransform(axis); |
---|
| 3356 | + |
---|
| 3357 | + for (int i=Size(); --i>=0;) |
---|
| 3358 | + { |
---|
| 3359 | + Object3D v = get(i); |
---|
| 3360 | + |
---|
| 3361 | + v.TextureRatio(axis); |
---|
| 3362 | + } |
---|
| 3363 | + |
---|
| 3364 | + blockloop = false; |
---|
| 3365 | + } |
---|
| 3366 | + |
---|
3166 | 3367 | void TransformChildren() |
---|
3167 | 3368 | { |
---|
3168 | 3369 | if (toParent != null) |
---|
.. | .. |
---|
3516 | 3717 | |
---|
3517 | 3718 | void ClearMaterials() |
---|
3518 | 3719 | { |
---|
| 3720 | + if (blockloop) |
---|
| 3721 | + return; |
---|
| 3722 | + |
---|
| 3723 | + blockloop = true; |
---|
| 3724 | + |
---|
3519 | 3725 | ClearMaterial(); |
---|
3520 | | - for (int i = 0; i < size(); i++) |
---|
| 3726 | + for (int i = 0; i < Size(); i++) |
---|
3521 | 3727 | { |
---|
3522 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3728 | + Object3D child = (Object3D) get(i); |
---|
3523 | 3729 | if (child == null) |
---|
3524 | 3730 | continue; |
---|
3525 | 3731 | child.ClearMaterials(); |
---|
3526 | | - release(i); |
---|
3527 | 3732 | } |
---|
| 3733 | + |
---|
| 3734 | + blockloop = false; |
---|
| 3735 | + } |
---|
| 3736 | + |
---|
| 3737 | + void ClearVersionList() |
---|
| 3738 | + { |
---|
| 3739 | + this.versionlist = null; |
---|
| 3740 | + this.versionindex = -1; |
---|
| 3741 | + this.versiontable = null; |
---|
| 3742 | + } |
---|
| 3743 | + |
---|
| 3744 | + void ClearVersions() |
---|
| 3745 | + { |
---|
| 3746 | + if (blockloop) |
---|
| 3747 | + return; |
---|
| 3748 | + |
---|
| 3749 | + blockloop = true; |
---|
| 3750 | + |
---|
| 3751 | + ClearVersionList(); |
---|
| 3752 | + for (int i = 0; i < Size(); i++) |
---|
| 3753 | + { |
---|
| 3754 | + Object3D child = (Object3D) get(i); |
---|
| 3755 | + if (child == null) |
---|
| 3756 | + continue; |
---|
| 3757 | + child.ClearVersions(); |
---|
| 3758 | + } |
---|
| 3759 | + |
---|
| 3760 | + blockloop = false; |
---|
3528 | 3761 | } |
---|
3529 | 3762 | |
---|
3530 | 3763 | void FlipV(boolean flip) |
---|
.. | .. |
---|
5409 | 5642 | blockloop = false; |
---|
5410 | 5643 | } |
---|
5411 | 5644 | |
---|
| 5645 | + void ResetSelectable() |
---|
| 5646 | + { |
---|
| 5647 | + if (blockloop) |
---|
| 5648 | + return; |
---|
| 5649 | + |
---|
| 5650 | + blockloop = true; |
---|
| 5651 | + |
---|
| 5652 | + keepdontselect = dontselect; |
---|
| 5653 | + dontselect = true; |
---|
| 5654 | + |
---|
| 5655 | + Object3D child; |
---|
| 5656 | + int nb = Size(); |
---|
| 5657 | + for (int i = 0; i < nb; i++) |
---|
| 5658 | + { |
---|
| 5659 | + child = (Object3D) get(i); |
---|
| 5660 | + if (child == null) |
---|
| 5661 | + continue; |
---|
| 5662 | + child.ResetSelectable(); |
---|
| 5663 | + } |
---|
| 5664 | + |
---|
| 5665 | + blockloop = false; |
---|
| 5666 | + } |
---|
| 5667 | + |
---|
| 5668 | + void RestoreSelectable() |
---|
| 5669 | + { |
---|
| 5670 | + if (blockloop) |
---|
| 5671 | + return; |
---|
| 5672 | + |
---|
| 5673 | + blockloop = true; |
---|
| 5674 | + |
---|
| 5675 | + dontselect = keepdontselect; |
---|
| 5676 | + |
---|
| 5677 | + Object3D child; |
---|
| 5678 | + int nb = Size(); |
---|
| 5679 | + for (int i = 0; i < nb; i++) |
---|
| 5680 | + { |
---|
| 5681 | + child = (Object3D) get(i); |
---|
| 5682 | + if (child == null) |
---|
| 5683 | + continue; |
---|
| 5684 | + child.RestoreSelectable(); |
---|
| 5685 | + } |
---|
| 5686 | + |
---|
| 5687 | + blockloop = false; |
---|
| 5688 | + } |
---|
| 5689 | + |
---|
5412 | 5690 | boolean IsSelected() |
---|
5413 | 5691 | { |
---|
5414 | 5692 | if (parent == null) |
---|
.. | .. |
---|
5469 | 5747 | if (fullname == null) |
---|
5470 | 5748 | return ""; |
---|
5471 | 5749 | |
---|
| 5750 | + if (fullname.pigment != null) |
---|
| 5751 | + { |
---|
| 5752 | + return fullname.pigment; |
---|
| 5753 | + } |
---|
| 5754 | + |
---|
5472 | 5755 | // System.out.println("Fullname = " + fullname); |
---|
5473 | 5756 | |
---|
5474 | 5757 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5481 | 5764 | |
---|
5482 | 5765 | if (split.length == 0) |
---|
5483 | 5766 | { |
---|
5484 | | - return ""; |
---|
| 5767 | + return fullname.pigment = ""; |
---|
5485 | 5768 | } |
---|
5486 | 5769 | |
---|
5487 | 5770 | if (split.length <= 2) |
---|
.. | .. |
---|
5489 | 5772 | if (fullname.name.endsWith(":")) |
---|
5490 | 5773 | { |
---|
5491 | 5774 | // Windows |
---|
5492 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5775 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5493 | 5776 | } |
---|
5494 | 5777 | |
---|
5495 | | - return split[0]; |
---|
| 5778 | + return fullname.pigment = split[0]; |
---|
5496 | 5779 | } |
---|
5497 | 5780 | |
---|
5498 | 5781 | // Windows |
---|
5499 | 5782 | assert(split.length == 4); |
---|
5500 | 5783 | |
---|
5501 | | - return split[0] + ":" + split[1]; |
---|
| 5784 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5502 | 5785 | } |
---|
5503 | 5786 | |
---|
5504 | 5787 | static String GetBump(cTexture fullname) |
---|
5505 | 5788 | { |
---|
5506 | 5789 | if (fullname == null) |
---|
5507 | 5790 | return ""; |
---|
| 5791 | + |
---|
| 5792 | + if (fullname.bump != null) |
---|
| 5793 | + { |
---|
| 5794 | + return fullname.bump; |
---|
| 5795 | + } |
---|
5508 | 5796 | |
---|
5509 | 5797 | // System.out.println("Fullname = " + fullname); |
---|
5510 | 5798 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5516 | 5804 | |
---|
5517 | 5805 | if (split.length == 0) |
---|
5518 | 5806 | { |
---|
5519 | | - return ""; |
---|
| 5807 | + return fullname.bump = ""; |
---|
5520 | 5808 | } |
---|
5521 | 5809 | |
---|
5522 | 5810 | if (split.length == 1) |
---|
5523 | 5811 | { |
---|
5524 | | - return ""; |
---|
| 5812 | + return fullname.bump = ""; |
---|
5525 | 5813 | } |
---|
5526 | 5814 | |
---|
5527 | 5815 | if (split.length == 2) |
---|
.. | .. |
---|
5529 | 5817 | if (fullname.name.endsWith(":")) |
---|
5530 | 5818 | { |
---|
5531 | 5819 | // Windows |
---|
5532 | | - return ""; |
---|
| 5820 | + return fullname.bump = ""; |
---|
5533 | 5821 | } |
---|
5534 | 5822 | |
---|
5535 | | - return split[1]; |
---|
| 5823 | + return fullname.bump = split[1]; |
---|
5536 | 5824 | } |
---|
5537 | 5825 | |
---|
5538 | 5826 | // Windows |
---|
5539 | 5827 | assert(split.length == 4); |
---|
5540 | 5828 | |
---|
5541 | | - return split[2] + ":" + split[3]; |
---|
| 5829 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5542 | 5830 | } |
---|
5543 | 5831 | |
---|
5544 | 5832 | String GetPigmentTexture() |
---|
.. | .. |
---|
5621 | 5909 | texname = ""; |
---|
5622 | 5910 | |
---|
5623 | 5911 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5912 | + |
---|
| 5913 | + GetTextures().pigment = null; |
---|
| 5914 | + |
---|
5624 | 5915 | Touch(); |
---|
5625 | 5916 | } |
---|
5626 | 5917 | |
---|
.. | .. |
---|
5694 | 5985 | |
---|
5695 | 5986 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
5696 | 5987 | |
---|
| 5988 | + GetTextures().bump = null; |
---|
| 5989 | + |
---|
5697 | 5990 | Touch(); |
---|
5698 | 5991 | } |
---|
5699 | 5992 | |
---|
.. | .. |
---|
5714 | 6007 | |
---|
5715 | 6008 | blockloop = true; |
---|
5716 | 6009 | child.ResetBumpTexture(); |
---|
| 6010 | + blockloop = false; |
---|
| 6011 | + } |
---|
| 6012 | + } |
---|
| 6013 | + |
---|
| 6014 | + void EmbedTextures(boolean embed) |
---|
| 6015 | + { |
---|
| 6016 | + if (blockloop) |
---|
| 6017 | + return; |
---|
| 6018 | + |
---|
| 6019 | + //if (GetTextures() != null) |
---|
| 6020 | + if (embed) |
---|
| 6021 | + CameraPane.EmbedTextures(GetTextures()); |
---|
| 6022 | + else |
---|
| 6023 | + { |
---|
| 6024 | + GetTextures().pigmentdata = null; |
---|
| 6025 | + GetTextures().bumpdata = null; |
---|
| 6026 | + GetTextures().pw = 0; |
---|
| 6027 | + GetTextures().ph = 0; |
---|
| 6028 | + GetTextures().bw = 0; |
---|
| 6029 | + GetTextures().bh = 0; |
---|
| 6030 | + } |
---|
| 6031 | + |
---|
| 6032 | + int nb = Size(); |
---|
| 6033 | + for (int i = 0; i < nb; i++) |
---|
| 6034 | + { |
---|
| 6035 | + Object3D child = (Object3D) get(i); |
---|
| 6036 | + |
---|
| 6037 | + if (child == null) |
---|
| 6038 | + continue; |
---|
| 6039 | + |
---|
| 6040 | + blockloop = true; |
---|
| 6041 | + child.EmbedTextures(embed); |
---|
5717 | 6042 | blockloop = false; |
---|
5718 | 6043 | } |
---|
5719 | 6044 | } |
---|
.. | .. |
---|
5742 | 6067 | return false; |
---|
5743 | 6068 | |
---|
5744 | 6069 | return parent.IsLive(); |
---|
| 6070 | + } |
---|
| 6071 | + |
---|
| 6072 | + boolean IsDynamic() |
---|
| 6073 | + { |
---|
| 6074 | + return live && bRep != null; |
---|
5745 | 6075 | } |
---|
5746 | 6076 | |
---|
5747 | 6077 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
.. | .. |
---|
5804 | 6134 | if (support != null) |
---|
5805 | 6135 | support = support; |
---|
5806 | 6136 | |
---|
5807 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5808 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6137 | + boolean usecalllists = !IsDynamic() && |
---|
| 6138 | + IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6139 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 6140 | + |
---|
| 6141 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5809 | 6142 | |
---|
5810 | 6143 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5811 | 6144 | { |
---|
.. | .. |
---|
5815 | 6148 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5816 | 6149 | // usecalllists = false; |
---|
5817 | 6150 | |
---|
5818 | | - if (GetBRep() != null) |
---|
5819 | | - usecalllists = usecalllists; |
---|
| 6151 | + if (display.DrawMode() == display.SHADOW) |
---|
| 6152 | + //GetBRep() != null) |
---|
| 6153 | + usecalllists = !!usecalllists; |
---|
5820 | 6154 | //System.out.println("draw " + this); |
---|
5821 | 6155 | //new Exception().printStackTrace(); |
---|
5822 | 6156 | |
---|
.. | .. |
---|
5838 | 6172 | if (!(this instanceof Composite)) |
---|
5839 | 6173 | touched = false; |
---|
5840 | 6174 | //if (displaylist == -1 && usecalllists) |
---|
5841 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 6175 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5842 | 6176 | { |
---|
5843 | 6177 | bRep.displaylist = display.GenList(); |
---|
5844 | 6178 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5849 | 6183 | |
---|
5850 | 6184 | //System.out.println("\tnew list " + list); |
---|
5851 | 6185 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5852 | | - if (usecalllists) |
---|
| 6186 | + if (usecalllists && bRep.displaylist > 0) |
---|
5853 | 6187 | { |
---|
5854 | 6188 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5855 | 6189 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5858 | 6192 | CallList(display, root, selected, blocked); |
---|
5859 | 6193 | |
---|
5860 | 6194 | // compiled = true; |
---|
5861 | | - if (usecalllists) |
---|
| 6195 | + if (usecalllists && bRep.displaylist > 0) |
---|
5862 | 6196 | { |
---|
5863 | 6197 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5864 | 6198 | display.EndList(); |
---|
.. | .. |
---|
7209 | 7543 | } |
---|
7210 | 7544 | } |
---|
7211 | 7545 | |
---|
7212 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
---|
| 7546 | + static ClickInfo clickInfo = new ClickInfo(); |
---|
| 7547 | + |
---|
| 7548 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
---|
| 7549 | + Point outPt, Rectangle outRec) |
---|
7213 | 7550 | { |
---|
7214 | | - int hc = info.bounds.x + info.bounds.width / 2; |
---|
7215 | | - int vc = info.bounds.y + info.bounds.height / 2; |
---|
7216 | | - double[][] toscreen = info.toScreen; |
---|
| 7551 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
---|
| 7552 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
---|
| 7553 | + double[][] toscreen = clickInfo.toScreen; |
---|
7217 | 7554 | if (toscreen == null) |
---|
7218 | 7555 | { |
---|
7219 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
---|
| 7556 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
---|
7220 | 7557 | } |
---|
7221 | 7558 | cVector vec = in; |
---|
7222 | 7559 | LA.xformPos(in, toscreen, in); |
---|
7223 | 7560 | //System.out.println("Distance = " + info.camera.Distance()); |
---|
7224 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
7225 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 7561 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
| 7562 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
7226 | 7563 | outPt.x = hc + (int) vec.x; |
---|
7227 | 7564 | outPt.y = vc - (int) vec.y; |
---|
7228 | 7565 | outRec.x = outPt.x - 3; |
---|
.. | .. |
---|
7230 | 7567 | outRec.width = outRec.height = 6; |
---|
7231 | 7568 | } |
---|
7232 | 7569 | |
---|
7233 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
---|
| 7570 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
---|
| 7571 | + ) |
---|
7234 | 7572 | { |
---|
7235 | 7573 | Point pt = new Point(0, 0); |
---|
7236 | 7574 | Rectangle rec = new Rectangle(); |
---|
7237 | | - calcHotSpot(in, info, pt, rec); |
---|
| 7575 | + calcHotSpot(in, //clickInfo, |
---|
| 7576 | + pt, rec); |
---|
7238 | 7577 | return rec; |
---|
7239 | 7578 | } |
---|
7240 | 7579 | |
---|
7241 | | - void drawEditHandles0(ClickInfo info, int level) |
---|
| 7580 | + void drawEditHandles0(//ClickInfo clickInfo, |
---|
| 7581 | + int level) |
---|
7242 | 7582 | { |
---|
7243 | 7583 | if (level == 0) |
---|
7244 | 7584 | { |
---|
.. | .. |
---|
7247 | 7587 | { |
---|
7248 | 7588 | cVector origin = new cVector(); |
---|
7249 | 7589 | //LA.xformPos(origin, toParent, origin); |
---|
7250 | | - Rectangle spot = calcHotSpot(origin, info); |
---|
| 7590 | + if (this.clickInfo == null) |
---|
| 7591 | + this.clickInfo = new ClickInfo(); |
---|
| 7592 | + |
---|
| 7593 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
---|
7251 | 7594 | Rectangle boundary = new Rectangle(); |
---|
7252 | 7595 | boundary.x = spot.x - 30; |
---|
7253 | 7596 | boundary.y = spot.y - 30; |
---|
7254 | 7597 | boundary.width = spot.width + 60; |
---|
7255 | 7598 | boundary.height = spot.height + 60; |
---|
7256 | | - info.g.setColor(Color.red); |
---|
| 7599 | + clickInfo.g.setColor(Color.white); |
---|
7257 | 7600 | int spotw = spot.x + spot.width; |
---|
7258 | 7601 | int spoth = spot.y + spot.height; |
---|
7259 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7602 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7260 | 7603 | // if (CameraPane.Xmin > spot.x) |
---|
7261 | 7604 | // { |
---|
7262 | 7605 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7273 | 7616 | // { |
---|
7274 | 7617 | // CameraPane.Ymax = spoth; |
---|
7275 | 7618 | // } |
---|
7276 | | - spot.translate(32, 32); |
---|
7277 | | - spotw = spot.x + spot.width; |
---|
7278 | | - spoth = spot.y + spot.height; |
---|
7279 | | - info.g.setColor(Color.cyan); |
---|
7280 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7281 | 7619 | // if (CameraPane.Xmin > spot.x) |
---|
7282 | 7620 | // { |
---|
7283 | 7621 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7296 | 7634 | // } |
---|
7297 | 7635 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7298 | 7636 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7299 | | - spot.translate(0, -32); |
---|
7300 | | - info.g.setColor(Color.yellow); |
---|
7301 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7302 | | - info.g.setColor(Color.green); |
---|
| 7637 | + spot.translate(32, 0); |
---|
| 7638 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7639 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7640 | + |
---|
| 7641 | + spot.translate(32, 64); |
---|
| 7642 | + spotw = spot.x + spot.width; |
---|
| 7643 | + spoth = spot.y + spot.height; |
---|
| 7644 | + clickInfo.g.setColor(Color.cyan); |
---|
| 7645 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7303 | 7646 | // if (CameraPane.Xmin > spot.x) |
---|
7304 | 7647 | // { |
---|
7305 | 7648 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7316 | 7659 | // { |
---|
7317 | 7660 | // CameraPane.Ymax = spoth; |
---|
7318 | 7661 | // } |
---|
7319 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
7320 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
| 7662 | + clickInfo.g.setColor(Color.green); |
---|
| 7663 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
| 7664 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7321 | 7665 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7322 | 7666 | // if (CameraPane.Xmin > boundary.x) |
---|
7323 | 7667 | // { |
---|
.. | .. |
---|
7339 | 7683 | } |
---|
7340 | 7684 | } |
---|
7341 | 7685 | |
---|
7342 | | - boolean doEditClick0(ClickInfo info, int level) |
---|
| 7686 | + boolean doEditClick0(//ClickInfo clickInfo, |
---|
| 7687 | + int level) |
---|
7343 | 7688 | { |
---|
7344 | 7689 | if (level == 0) |
---|
7345 | 7690 | { |
---|
.. | .. |
---|
7348 | 7693 | |
---|
7349 | 7694 | boolean retval = false; |
---|
7350 | 7695 | |
---|
7351 | | - startX = info.x; |
---|
7352 | | - startY = info.y; |
---|
| 7696 | + startX = clickInfo.x; |
---|
| 7697 | + startY = clickInfo.y; |
---|
7353 | 7698 | |
---|
7354 | 7699 | hitSomething = -1; |
---|
7355 | 7700 | cVector origin = new cVector(); |
---|
.. | .. |
---|
7359 | 7704 | { |
---|
7360 | 7705 | centerPt = new Point(0, 0); |
---|
7361 | 7706 | } |
---|
7362 | | - calcHotSpot(origin, info, centerPt, spot); |
---|
7363 | | - if (spot.contains(info.x, info.y)) |
---|
| 7707 | + calcHotSpot(origin, //info, |
---|
| 7708 | + centerPt, spot); |
---|
| 7709 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7364 | 7710 | { |
---|
7365 | 7711 | hitSomething = hitCenter; |
---|
7366 | 7712 | retval = true; |
---|
7367 | 7713 | } |
---|
7368 | 7714 | spot.translate(32, 0); |
---|
7369 | | - if (spot.contains(info.x, info.y)) |
---|
| 7715 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7370 | 7716 | { |
---|
7371 | 7717 | hitSomething = hitRotate; |
---|
7372 | 7718 | retval = true; |
---|
7373 | 7719 | } |
---|
7374 | 7720 | spot.translate(0, 32); |
---|
7375 | | - if (spot.contains(info.x, info.y)) |
---|
| 7721 | + spot.translate(32, 0); |
---|
| 7722 | + spot.translate(0, 32); |
---|
| 7723 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7376 | 7724 | { |
---|
7377 | 7725 | hitSomething = hitScale; |
---|
| 7726 | + |
---|
| 7727 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
| 7728 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
| 7729 | + double sign = 1; |
---|
| 7730 | + if (hScale < 0) |
---|
| 7731 | + { |
---|
| 7732 | + sign = -1; |
---|
| 7733 | + } |
---|
| 7734 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
| 7735 | + if (hScale < 0.01) |
---|
| 7736 | + { |
---|
| 7737 | + //hScale = 0.01; |
---|
| 7738 | + } |
---|
| 7739 | + |
---|
| 7740 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
| 7741 | + sign = 1; |
---|
| 7742 | + if (vScale < 0) |
---|
| 7743 | + { |
---|
| 7744 | + sign = -1; |
---|
| 7745 | + } |
---|
| 7746 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
| 7747 | + if (vScale < 0.01) |
---|
| 7748 | + { |
---|
| 7749 | + //vScale = 0.01; |
---|
| 7750 | + } |
---|
| 7751 | + |
---|
| 7752 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
---|
| 7753 | + |
---|
7378 | 7754 | retval = true; |
---|
7379 | 7755 | } |
---|
7380 | 7756 | |
---|
.. | .. |
---|
7384 | 7760 | } |
---|
7385 | 7761 | |
---|
7386 | 7762 | //System.out.println("info.modifiers = " + info.modifiers); |
---|
7387 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
| 7763 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
---|
7388 | 7764 | //System.out.println("modified = " + modified); |
---|
7389 | 7765 | //new Exception().printStackTrace(); |
---|
7390 | 7766 | //viewCode = info.pane.renderCamera.viewCode; |
---|
.. | .. |
---|
7412 | 7788 | return true; |
---|
7413 | 7789 | } |
---|
7414 | 7790 | |
---|
7415 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
---|
| 7791 | + void doEditDrag0(//ClickInfo info, |
---|
| 7792 | + boolean opposite) |
---|
7416 | 7793 | { |
---|
7417 | 7794 | if (hitSomething == 0) |
---|
7418 | 7795 | { |
---|
.. | .. |
---|
7426 | 7803 | |
---|
7427 | 7804 | //System.out.println("hitSomething = " + hitSomething); |
---|
7428 | 7805 | |
---|
7429 | | - double scale = 0.005f * info.camera.Distance(); |
---|
| 7806 | + double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7430 | 7807 | |
---|
7431 | 7808 | cVector xlate = new cVector(); |
---|
7432 | 7809 | //cVector xlate2 = new cVector(); |
---|
.. | .. |
---|
7440 | 7817 | |
---|
7441 | 7818 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7442 | 7819 | |
---|
7443 | | - if (modified || opposite) |
---|
| 7820 | + // Modified could snap |
---|
| 7821 | + if (//modified || |
---|
| 7822 | + opposite) |
---|
7444 | 7823 | { |
---|
7445 | 7824 | //assert(false); |
---|
7446 | 7825 | /* |
---|
.. | .. |
---|
7460 | 7839 | toParent[3][i] = xlate.get(i); |
---|
7461 | 7840 | LA.matInvert(toParent, fromParent); |
---|
7462 | 7841 | */ |
---|
7463 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
---|
7464 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7842 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
---|
| 7843 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7465 | 7844 | |
---|
7466 | 7845 | LA.matCopy(startMat, toParent); |
---|
7467 | 7846 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7470 | 7849 | } else |
---|
7471 | 7850 | { |
---|
7472 | 7851 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
7473 | | - cVector up = new cVector(info.camera.up); |
---|
| 7852 | + cVector up = new cVector(clickInfo.camera.up); |
---|
7474 | 7853 | cVector away = new cVector(); |
---|
7475 | 7854 | //cVector right2 = new cVector(); |
---|
7476 | 7855 | //LA.vecCross(up, cVector.Z, right); |
---|
.. | .. |
---|
7487 | 7866 | LA.xformDir(up, ClickInfo.matbuffer, up); |
---|
7488 | 7867 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7489 | 7868 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
---|
7490 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
---|
| 7869 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
---|
7491 | 7870 | // if (!CameraPane.LOCALTRANSFORM) |
---|
7492 | 7871 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
---|
7493 | 7872 | //LA.vecCross(up, cVector.Z, right2); |
---|
7494 | 7873 | |
---|
7495 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
---|
| 7874 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
---|
7496 | 7875 | |
---|
7497 | 7876 | //System.out.println("DELTA0 = " + delta); |
---|
7498 | 7877 | //System.out.println("AWAY = " + info.camera.away); |
---|
7499 | 7878 | //System.out.println("UP = " + info.camera.up); |
---|
7500 | 7879 | if (away.z > 0) |
---|
7501 | 7880 | { |
---|
7502 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
| 7881 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
---|
7503 | 7882 | { |
---|
7504 | 7883 | delta.x = -delta.x; |
---|
7505 | 7884 | } else |
---|
.. | .. |
---|
7514 | 7893 | //System.out.println("DELTA1 = " + delta); |
---|
7515 | 7894 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
---|
7516 | 7895 | //System.out.println("DELTA2 = " + delta); |
---|
7517 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
---|
| 7896 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
---|
7518 | 7897 | LA.matCopy(startMat, toParent); |
---|
7519 | 7898 | //System.out.println("DELTA3 = " + delta); |
---|
7520 | 7899 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
---|
.. | .. |
---|
7524 | 7903 | break; |
---|
7525 | 7904 | |
---|
7526 | 7905 | case hitRotate: // rotate |
---|
7527 | | - int dx = info.x - centerPt.x; |
---|
7528 | | - int dy = -(info.y - centerPt.y); |
---|
| 7906 | + int dx = clickInfo.x - centerPt.x; |
---|
| 7907 | + int dy = -(clickInfo.y - centerPt.y); |
---|
7529 | 7908 | double angle = (double) Math.atan2(dx, dy); |
---|
7530 | 7909 | angle = -(1.570796 - angle); |
---|
7531 | 7910 | |
---|
.. | .. |
---|
7534 | 7913 | |
---|
7535 | 7914 | if (modified) |
---|
7536 | 7915 | { |
---|
7537 | | - // Rotate 90 degrees |
---|
| 7916 | + // Rotate 45 degrees |
---|
7538 | 7917 | angle /= (Math.PI / 4); |
---|
7539 | 7918 | angle = Math.floor(angle + 0.5); |
---|
7540 | 7919 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7548 | 7927 | } |
---|
7549 | 7928 | /**/ |
---|
7550 | 7929 | |
---|
7551 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7930 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7552 | 7931 | { |
---|
7553 | 7932 | case 1: // '\001' |
---|
7554 | 7933 | LA.matZRotate(toParent, angle); |
---|
.. | .. |
---|
7575 | 7954 | break; |
---|
7576 | 7955 | |
---|
7577 | 7956 | case hitScale: // scale |
---|
7578 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7957 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7579 | 7958 | double sign = 1; |
---|
7580 | 7959 | if (hScale < 0) |
---|
7581 | 7960 | { |
---|
.. | .. |
---|
7587 | 7966 | //hScale = 0.01; |
---|
7588 | 7967 | } |
---|
7589 | 7968 | |
---|
7590 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
---|
| 7969 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7591 | 7970 | sign = 1; |
---|
7592 | 7971 | if (vScale < 0) |
---|
7593 | 7972 | { |
---|
.. | .. |
---|
7598 | 7977 | { |
---|
7599 | 7978 | //vScale = 0.01; |
---|
7600 | 7979 | } |
---|
| 7980 | + |
---|
7601 | 7981 | LA.matCopy(startMat, toParent); |
---|
7602 | 7982 | /**/ |
---|
7603 | 7983 | for (int i = 0; i < 3; i++) |
---|
.. | .. |
---|
7607 | 7987 | } |
---|
7608 | 7988 | /**/ |
---|
7609 | 7989 | |
---|
7610 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7990 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
---|
7611 | 7991 | |
---|
7612 | 7992 | if (totalScale < 0.01) |
---|
7613 | 7993 | { |
---|
7614 | 7994 | totalScale = 0.01; |
---|
7615 | 7995 | } |
---|
7616 | 7996 | |
---|
7617 | | - switch (info.pane.RenderCamera().viewCode) |
---|
| 7997 | + switch (clickInfo.pane.RenderCamera().viewCode) |
---|
7618 | 7998 | { |
---|
7619 | 7999 | case 3: // '\001' |
---|
7620 | 8000 | if (modified || opposite) |
---|
7621 | 8001 | { |
---|
| 8002 | + if (modified) // && opposite) |
---|
| 8003 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8004 | + else |
---|
7622 | 8005 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7623 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 8006 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7624 | 8007 | } // vScale, 1); |
---|
7625 | 8008 | else |
---|
7626 | 8009 | { |
---|
7627 | 8010 | // EXCEPTION! |
---|
7628 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8011 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7629 | 8012 | } // vScale, 1); |
---|
7630 | 8013 | break; |
---|
7631 | 8014 | |
---|
7632 | 8015 | case 2: // '\002' |
---|
7633 | 8016 | if (modified || opposite) |
---|
7634 | 8017 | { |
---|
7635 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7636 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 8018 | + if (modified) // && opposite) |
---|
| 8019 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8020 | + else |
---|
| 8021 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 8022 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7637 | 8023 | } else |
---|
7638 | 8024 | { |
---|
7639 | 8025 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7643 | 8029 | case 1: // '\003' |
---|
7644 | 8030 | if (modified || opposite) |
---|
7645 | 8031 | { |
---|
7646 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7647 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 8032 | + if (modified) // && opposite) |
---|
| 8033 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 8034 | + else |
---|
| 8035 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 8036 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7648 | 8037 | } else |
---|
7649 | 8038 | { |
---|
7650 | 8039 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|
.. | .. |
---|
7681 | 8070 | } // NEW ... |
---|
7682 | 8071 | |
---|
7683 | 8072 | |
---|
7684 | | - info.pane.repaint(); |
---|
| 8073 | + clickInfo.pane.repaint(); |
---|
7685 | 8074 | } |
---|
7686 | 8075 | |
---|
7687 | 8076 | boolean overflow = false; |
---|
.. | .. |
---|
7792 | 8181 | } // + super.toString(); |
---|
7793 | 8182 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
7794 | 8183 | |
---|
7795 | | - if (!Globals.ADVANCED) |
---|
7796 | | - return objname; |
---|
| 8184 | +// if (!Globals.ADVANCED) |
---|
| 8185 | +// return objname; |
---|
7797 | 8186 | |
---|
7798 | | - return objname + " " + System.identityHashCode(this); |
---|
| 8187 | + return objname + " " + System.identityHashCode(this); // + GetUUID() |
---|
7799 | 8188 | } |
---|
7800 | 8189 | |
---|
7801 | 8190 | public int hashCode() |
---|