.. | .. |
---|
14 | 14 | import //weka.core. |
---|
15 | 15 | matrix.Matrix; |
---|
16 | 16 | |
---|
| 17 | +import java.util.UUID; |
---|
| 18 | + |
---|
17 | 19 | //import net.sourceforge.sizeof.SizeOf; |
---|
18 | 20 | public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D> |
---|
19 | 21 | { |
---|
20 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
21 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
| 24 | + |
---|
| 25 | + private UUID uuid = UUID.randomUUID(); |
---|
| 26 | + |
---|
| 27 | + // TEMPORARY for mocap undo |
---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
---|
| 29 | + Object3D skeleton; |
---|
| 30 | + // |
---|
22 | 31 | |
---|
23 | 32 | ScriptNode scriptnode; |
---|
24 | 33 | |
---|
.. | .. |
---|
100 | 109 | |
---|
101 | 110 | // transient boolean reduced; // for morph reduction |
---|
102 | 111 | |
---|
103 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
104 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
---|
105 | 114 | |
---|
106 | | -transient Object3D transientsupport; // for cloning |
---|
107 | | -transient boolean transientlink2master; |
---|
| 115 | + transient Object3D transientsupport; // for cloning |
---|
| 116 | + transient boolean transientlink2master; |
---|
108 | 117 | |
---|
109 | | -void SaveSupports() |
---|
110 | | -{ |
---|
111 | | - if (blockloop) |
---|
112 | | - return; |
---|
113 | | - |
---|
114 | | - transientsupport = support; |
---|
115 | | - transientlink2master = link2master; |
---|
116 | | - |
---|
117 | | - support = null; |
---|
118 | | - link2master = false; |
---|
119 | | - |
---|
120 | | - if (bRep != null) |
---|
| 118 | + void SaveSupports() |
---|
121 | 119 | { |
---|
122 | | - bRep.SaveSupports(); |
---|
123 | | - } |
---|
124 | | - |
---|
125 | | - for (int i = 0; i < Size(); i++) |
---|
126 | | - { |
---|
127 | | - Object3D child = (Object3D) get(i); |
---|
128 | | - if (child == null) |
---|
129 | | - continue; |
---|
130 | | - blockloop = true; |
---|
131 | | - child.SaveSupports(); |
---|
132 | | - blockloop = false; |
---|
133 | | - } |
---|
134 | | -} |
---|
| 120 | + if (blockloop) |
---|
| 121 | + return; |
---|
135 | 122 | |
---|
136 | | -void RestoreSupports() |
---|
137 | | -{ |
---|
138 | | - if (blockloop) |
---|
139 | | - return; |
---|
| 123 | + transientsupport = support; |
---|
| 124 | + transientlink2master = link2master; |
---|
140 | 125 | |
---|
141 | | - support = transientsupport; |
---|
142 | | - link2master = transientlink2master; |
---|
143 | | - transientsupport = null; |
---|
144 | | - transientlink2master = false; |
---|
145 | | - |
---|
146 | | - if (bRep != null) |
---|
147 | | - { |
---|
148 | | - bRep.RestoreSupports(); |
---|
| 126 | + support = null; |
---|
| 127 | + link2master = false; |
---|
| 128 | + |
---|
| 129 | + if (bRep != null) |
---|
| 130 | + { |
---|
| 131 | + bRep.SaveSupports(); |
---|
| 132 | + } |
---|
| 133 | + |
---|
| 134 | + for (int i = 0; i < Size(); i++) |
---|
| 135 | + { |
---|
| 136 | + Object3D child = (Object3D) get(i); |
---|
| 137 | + if (child == null) |
---|
| 138 | + continue; |
---|
| 139 | + blockloop = true; |
---|
| 140 | + child.SaveSupports(); |
---|
| 141 | + blockloop = false; |
---|
| 142 | + } |
---|
149 | 143 | } |
---|
150 | | - |
---|
151 | | - for (int i = 0; i < Size(); i++) |
---|
| 144 | + |
---|
| 145 | + void RestoreSupports() |
---|
152 | 146 | { |
---|
153 | | - Object3D child = (Object3D) get(i); |
---|
154 | | - if (child == null) |
---|
155 | | - continue; |
---|
156 | | - blockloop = true; |
---|
157 | | - child.RestoreSupports(); |
---|
158 | | - blockloop = false; |
---|
| 147 | + if (blockloop) |
---|
| 148 | + return; |
---|
| 149 | + |
---|
| 150 | + support = transientsupport; |
---|
| 151 | + link2master = transientlink2master; |
---|
| 152 | + transientsupport = null; |
---|
| 153 | + transientlink2master = false; |
---|
| 154 | + |
---|
| 155 | + if (bRep != null) |
---|
| 156 | + { |
---|
| 157 | + bRep.RestoreSupports(); |
---|
| 158 | + } |
---|
| 159 | + |
---|
| 160 | + for (int i = 0; i < Size(); i++) |
---|
| 161 | + { |
---|
| 162 | + Object3D child = (Object3D) get(i); |
---|
| 163 | + if (child == null) |
---|
| 164 | + continue; |
---|
| 165 | + blockloop = true; |
---|
| 166 | + child.RestoreSupports(); |
---|
| 167 | + blockloop = false; |
---|
| 168 | + } |
---|
159 | 169 | } |
---|
160 | | -} |
---|
| 170 | + |
---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 172 | + { |
---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
---|
| 174 | + { |
---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 176 | + |
---|
| 177 | + Grafreed.Assert(this.bRep == o.bRep); |
---|
| 178 | + if (this.bRep != null) |
---|
| 179 | + assert(this.bRep.support == o.transientrep); |
---|
| 180 | + |
---|
| 181 | + return; |
---|
| 182 | + } |
---|
| 183 | + |
---|
| 184 | + Object3D o = new Object3D(); |
---|
| 185 | + |
---|
| 186 | + hashtable.put(GetUUID(), o); |
---|
| 187 | + |
---|
| 188 | + for (int i=0; i<Size(); i++) |
---|
| 189 | + { |
---|
| 190 | + get(i).ExtractBigData(hashtable); |
---|
| 191 | + } |
---|
| 192 | + |
---|
| 193 | + ExtractBigData(o); |
---|
| 194 | + } |
---|
| 195 | + |
---|
| 196 | + void ExtractBigData(Object3D o) |
---|
| 197 | + { |
---|
| 198 | + o.bRep = this.bRep; |
---|
| 199 | + if (this.bRep != null) |
---|
| 200 | + { |
---|
| 201 | + o.transientrep = this.bRep.support; |
---|
| 202 | + o.bRep.support = null; |
---|
| 203 | + } |
---|
| 204 | + |
---|
| 205 | + // o.support = this.support; |
---|
| 206 | + // o.fileparent = this.fileparent; |
---|
| 207 | + // if (this.bRep != null) |
---|
| 208 | + // o.bRep = this.bRep.support; |
---|
| 209 | + |
---|
| 210 | + this.bRep = null; |
---|
| 211 | + // if (this.bRep != null) |
---|
| 212 | + // this.bRep.support = null; |
---|
| 213 | + // this.support = null; |
---|
| 214 | + // this.fileparent = null; |
---|
| 215 | + } |
---|
| 216 | + |
---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
| 218 | + { |
---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
---|
| 220 | + return; |
---|
| 221 | + |
---|
| 222 | + Object3D o = hashtable.get(GetUUID()); |
---|
| 223 | + |
---|
| 224 | + RestoreBigData(o); |
---|
| 225 | + |
---|
| 226 | + hashtable.remove(GetUUID()); |
---|
| 227 | + |
---|
| 228 | + for (int i=0; i<Size(); i++) |
---|
| 229 | + { |
---|
| 230 | + get(i).RestoreBigData(hashtable); |
---|
| 231 | + } |
---|
| 232 | + } |
---|
| 233 | + |
---|
| 234 | + void RestoreBigData(Object3D o) |
---|
| 235 | + { |
---|
| 236 | + this.bRep = o.bRep; |
---|
| 237 | + if (this.bRep != null) |
---|
| 238 | + this.bRep.support = o.transientrep; |
---|
| 239 | + // this.support = o.support; |
---|
| 240 | + // this.fileparent = o.fileparent; |
---|
| 241 | + } |
---|
161 | 242 | |
---|
162 | 243 | // MOCAP SUPPORT |
---|
163 | 244 | double tx,ty,tz,rx,ry,rz; |
---|
.. | .. |
---|
482 | 563 | toParent = LA.newMatrix(); |
---|
483 | 564 | fromParent = LA.newMatrix(); |
---|
484 | 565 | } |
---|
| 566 | + |
---|
485 | 567 | if (toParentMarked == null) |
---|
486 | 568 | { |
---|
487 | 569 | if (maxcount != 1) |
---|
488 | 570 | { |
---|
489 | 571 | new Exception().printStackTrace(); |
---|
490 | 572 | } |
---|
| 573 | + |
---|
491 | 574 | toParentMarked = LA.newMatrix(); |
---|
492 | 575 | fromParentMarked = LA.newMatrix(); |
---|
493 | 576 | } |
---|
.. | .. |
---|
775 | 858 | if (step == 0) |
---|
776 | 859 | step = 1; |
---|
777 | 860 | if (maxcount == 0) |
---|
778 | | - maxcount = 2048; // 4; |
---|
| 861 | + maxcount = 128; // 2048; // 4; |
---|
779 | 862 | // if (acceleration == 0) |
---|
780 | 863 | // acceleration = 10; |
---|
781 | 864 | if (delay == 0) // serial |
---|
.. | .. |
---|
810 | 893 | |
---|
811 | 894 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
812 | 895 | |
---|
813 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 896 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 897 | + (step == 1 && changedir)) |
---|
814 | 898 | { |
---|
815 | 899 | countdown = 1; |
---|
816 | 900 | delay = speedup?8:1; |
---|
.. | .. |
---|
2303 | 2387 | } |
---|
2304 | 2388 | */ |
---|
2305 | 2389 | } |
---|
| 2390 | + else |
---|
| 2391 | + { |
---|
| 2392 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2393 | + } |
---|
2306 | 2394 | } |
---|
2307 | 2395 | |
---|
2308 | 2396 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2628 | 2716 | //Touch(); |
---|
2629 | 2717 | } |
---|
2630 | 2718 | |
---|
| 2719 | + void GenNormalsMeshS() |
---|
| 2720 | + { |
---|
| 2721 | + selection.GenNormalsMesh(); |
---|
| 2722 | +// for (int i=0; i<selection.size(); i++) |
---|
| 2723 | +// { |
---|
| 2724 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
---|
| 2725 | +// selectee.GenNormals(crease); |
---|
| 2726 | +// } |
---|
| 2727 | + |
---|
| 2728 | + //Touch(); |
---|
| 2729 | + } |
---|
| 2730 | + |
---|
2631 | 2731 | void ClearColorsS() |
---|
2632 | 2732 | { |
---|
2633 | 2733 | selection.ClearColors(); |
---|
.. | .. |
---|
2759 | 2859 | if (child == null) |
---|
2760 | 2860 | continue; |
---|
2761 | 2861 | child.GenNormals(crease); |
---|
| 2862 | +// Children().release(i); |
---|
| 2863 | + } |
---|
| 2864 | + blockloop = false; |
---|
| 2865 | + } |
---|
| 2866 | + |
---|
| 2867 | + void GenNormalsMesh() |
---|
| 2868 | + { |
---|
| 2869 | + if (blockloop) |
---|
| 2870 | + return; |
---|
| 2871 | + |
---|
| 2872 | + blockloop = true; |
---|
| 2873 | + GenNormalsMesh0(); |
---|
| 2874 | + for (int i = 0; i < Children().Size(); i++) |
---|
| 2875 | + { |
---|
| 2876 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
---|
| 2877 | + if (child == null) |
---|
| 2878 | + continue; |
---|
| 2879 | + child.GenNormalsMesh(); |
---|
2762 | 2880 | // Children().release(i); |
---|
2763 | 2881 | } |
---|
2764 | 2882 | blockloop = false; |
---|
.. | .. |
---|
2927 | 3045 | if (bRep != null) |
---|
2928 | 3046 | { |
---|
2929 | 3047 | bRep.GenerateNormals(crease); |
---|
| 3048 | + Touch(); |
---|
| 3049 | + } |
---|
| 3050 | + } |
---|
| 3051 | + |
---|
| 3052 | + void GenNormalsMesh0() |
---|
| 3053 | + { |
---|
| 3054 | + if (bRep != null) |
---|
| 3055 | + { |
---|
| 3056 | + bRep.GenerateNormalsMesh(); |
---|
2930 | 3057 | Touch(); |
---|
2931 | 3058 | } |
---|
2932 | 3059 | } |
---|
.. | .. |
---|
3381 | 3508 | if (blockloop) |
---|
3382 | 3509 | return; |
---|
3383 | 3510 | |
---|
3384 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3511 | + if (//marked || // does not make sense |
---|
| 3512 | + (bRep != null || material != null)) // borderline... |
---|
3385 | 3513 | live = h; |
---|
3386 | 3514 | |
---|
3387 | 3515 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3402 | 3530 | return; |
---|
3403 | 3531 | |
---|
3404 | 3532 | //if (bRep != null) |
---|
3405 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3533 | + if (//marked || // does not make sense |
---|
| 3534 | + (bRep != null || material != null)) // borderline... |
---|
3406 | 3535 | link2master = h; |
---|
3407 | 3536 | |
---|
3408 | 3537 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3422 | 3551 | if (blockloop) |
---|
3423 | 3552 | return; |
---|
3424 | 3553 | |
---|
3425 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3554 | + if (//marked || // does not make sense |
---|
| 3555 | + (bRep != null || material != null)) // borderline... |
---|
3426 | 3556 | hide = h; |
---|
3427 | 3557 | |
---|
3428 | 3558 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3442 | 3572 | if (blockloop) |
---|
3443 | 3573 | return; |
---|
3444 | 3574 | |
---|
3445 | | - if (bRep != null && material != null) // borderline... |
---|
| 3575 | + if (bRep != null || material != null) // borderline... |
---|
3446 | 3576 | marked = h; |
---|
3447 | 3577 | |
---|
3448 | 3578 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3452 | 3582 | continue; |
---|
3453 | 3583 | blockloop = true; |
---|
3454 | 3584 | child.MarkLeaves(h); |
---|
| 3585 | + blockloop = false; |
---|
| 3586 | + // release(i); |
---|
| 3587 | + } |
---|
| 3588 | + } |
---|
| 3589 | + |
---|
| 3590 | + void RewindLeaves(boolean h) |
---|
| 3591 | + { |
---|
| 3592 | + if (blockloop) |
---|
| 3593 | + return; |
---|
| 3594 | + |
---|
| 3595 | + if (bRep != null || material != null) // borderline... |
---|
| 3596 | + rewind = h; |
---|
| 3597 | + |
---|
| 3598 | + for (int i = 0; i < Size(); i++) |
---|
| 3599 | + { |
---|
| 3600 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3601 | + if (child == null) |
---|
| 3602 | + continue; |
---|
| 3603 | + blockloop = true; |
---|
| 3604 | + child.RewindLeaves(h); |
---|
| 3605 | + blockloop = false; |
---|
| 3606 | + // release(i); |
---|
| 3607 | + } |
---|
| 3608 | + } |
---|
| 3609 | + |
---|
| 3610 | + void RandomLeaves(boolean h) |
---|
| 3611 | + { |
---|
| 3612 | + if (blockloop) |
---|
| 3613 | + return; |
---|
| 3614 | + |
---|
| 3615 | + if (bRep != null || material != null) // borderline... |
---|
| 3616 | + random = h; |
---|
| 3617 | + |
---|
| 3618 | + for (int i = 0; i < Size(); i++) |
---|
| 3619 | + { |
---|
| 3620 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3621 | + if (child == null) |
---|
| 3622 | + continue; |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + child.RandomLeaves(h); |
---|
3455 | 3625 | blockloop = false; |
---|
3456 | 3626 | // release(i); |
---|
3457 | 3627 | } |
---|
.. | .. |
---|
4225 | 4395 | { |
---|
4226 | 4396 | blockloop = true; |
---|
4227 | 4397 | get(i).RepairShadow(); |
---|
| 4398 | + blockloop = false; |
---|
| 4399 | + } |
---|
| 4400 | + } |
---|
| 4401 | + |
---|
| 4402 | + void RepairSOV() |
---|
| 4403 | + { |
---|
| 4404 | + if (blockloop) |
---|
| 4405 | + return; |
---|
| 4406 | + |
---|
| 4407 | + String texname = this.GetPigmentTexture(); |
---|
| 4408 | + |
---|
| 4409 | + if (texname.startsWith("sov")) |
---|
| 4410 | + { |
---|
| 4411 | + String[] s = texname.split("/"); |
---|
| 4412 | + |
---|
| 4413 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4414 | + |
---|
| 4415 | + texname = sname[0]; |
---|
| 4416 | + |
---|
| 4417 | + if (sname.length > 1) |
---|
| 4418 | + { |
---|
| 4419 | + texname += "Color.jpg"; |
---|
| 4420 | + } |
---|
| 4421 | + |
---|
| 4422 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4423 | + } |
---|
| 4424 | + |
---|
| 4425 | + texname = this.GetBumpTexture(); |
---|
| 4426 | + |
---|
| 4427 | + if (texname.startsWith("sov")) |
---|
| 4428 | + { |
---|
| 4429 | + String[] s = texname.split("/"); |
---|
| 4430 | + |
---|
| 4431 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4432 | + |
---|
| 4433 | + texname = sname[0]; |
---|
| 4434 | + |
---|
| 4435 | + if (sname.length > 1) |
---|
| 4436 | + { |
---|
| 4437 | + texname += "Bump.jpg"; |
---|
| 4438 | + } |
---|
| 4439 | + |
---|
| 4440 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4441 | + } |
---|
| 4442 | + |
---|
| 4443 | + for (int i=0; i<Size(); i++) |
---|
| 4444 | + { |
---|
| 4445 | + blockloop = true; |
---|
| 4446 | + get(i).RepairSOV(); |
---|
4228 | 4447 | blockloop = false; |
---|
4229 | 4448 | } |
---|
4230 | 4449 | } |
---|
.. | .. |
---|
5371 | 5590 | } |
---|
5372 | 5591 | } |
---|
5373 | 5592 | |
---|
| 5593 | + UUID GetUUID() |
---|
| 5594 | + { |
---|
| 5595 | + if (uuid == null) |
---|
| 5596 | + { |
---|
| 5597 | + // Serial |
---|
| 5598 | + uuid = UUID.randomUUID(); |
---|
| 5599 | + } |
---|
| 5600 | + |
---|
| 5601 | + return uuid; |
---|
| 5602 | + } |
---|
| 5603 | + |
---|
| 5604 | + Object3D GetObject(UUID uid) |
---|
| 5605 | + { |
---|
| 5606 | + if (blockloop) |
---|
| 5607 | + return null; |
---|
| 5608 | + |
---|
| 5609 | + if (GetUUID().equals(uid)) |
---|
| 5610 | + return this; |
---|
| 5611 | + |
---|
| 5612 | + int nb = Size(); |
---|
| 5613 | + for (int i = 0; i < nb; i++) |
---|
| 5614 | + { |
---|
| 5615 | + Object3D child = (Object3D) get(i); |
---|
| 5616 | + |
---|
| 5617 | + if (child == null) |
---|
| 5618 | + continue; |
---|
| 5619 | + |
---|
| 5620 | + blockloop = true; |
---|
| 5621 | + Object3D obj = child.GetObject(uid); |
---|
| 5622 | + blockloop = false; |
---|
| 5623 | + if (obj != null) |
---|
| 5624 | + return obj; |
---|
| 5625 | + } |
---|
| 5626 | + |
---|
| 5627 | + return null; |
---|
| 5628 | + } |
---|
| 5629 | + |
---|
5374 | 5630 | void SetBumpTexture(String tex) |
---|
5375 | 5631 | { |
---|
5376 | 5632 | if (GetTextures() == null) |
---|
.. | .. |
---|
5415 | 5671 | boolean NeedSupport() |
---|
5416 | 5672 | { |
---|
5417 | 5673 | return |
---|
5418 | | - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null |
---|
| 5674 | + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null |
---|
5419 | 5675 | // PROBLEM with CROWD!! |
---|
5420 | 5676 | && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); |
---|
5421 | 5677 | } |
---|
5422 | 5678 | |
---|
5423 | 5679 | static boolean DEBUG_SELECTION = false; |
---|
| 5680 | + |
---|
| 5681 | + boolean IsLive() |
---|
| 5682 | + { |
---|
| 5683 | + if (live) |
---|
| 5684 | + return true; |
---|
| 5685 | + |
---|
| 5686 | + if (parent == null) |
---|
| 5687 | + return false; |
---|
| 5688 | + |
---|
| 5689 | + return parent.IsLive(); |
---|
| 5690 | + } |
---|
5424 | 5691 | |
---|
5425 | 5692 | void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) |
---|
5426 | 5693 | { |
---|
.. | .. |
---|
5483 | 5750 | support = support; |
---|
5484 | 5751 | |
---|
5485 | 5752 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5486 | | - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5753 | + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5487 | 5754 | |
---|
5488 | 5755 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5489 | 5756 | { |
---|
.. | .. |
---|
5503 | 5770 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5504 | 5771 | |
---|
5505 | 5772 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5506 | | - (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5773 | + //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
| 5774 | + (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
5507 | 5775 | { |
---|
5508 | 5776 | Globals.lighttouched = true; |
---|
5509 | 5777 | } // all panes... |
---|
| 5778 | + |
---|
5510 | 5779 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5511 | 5780 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5512 | 5781 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5674 | 5943 | tex = GetTextures(); |
---|
5675 | 5944 | } |
---|
5676 | 5945 | |
---|
5677 | | - boolean failed = false; |
---|
| 5946 | + boolean failedPigment = false; |
---|
| 5947 | + boolean failedBump = false; |
---|
5678 | 5948 | |
---|
5679 | 5949 | try |
---|
5680 | 5950 | { |
---|
5681 | | - display.BindTextures(tex, texres); |
---|
| 5951 | + display.BindPigmentTexture(tex, texres); |
---|
5682 | 5952 | } |
---|
5683 | 5953 | catch (Exception e) |
---|
5684 | 5954 | { |
---|
5685 | 5955 | System.err.println("FAILED: " + this); |
---|
5686 | | - failed = true; |
---|
| 5956 | + failedPigment = true; |
---|
| 5957 | + } |
---|
| 5958 | + |
---|
| 5959 | + try |
---|
| 5960 | + { |
---|
| 5961 | + display.BindBumpTexture(tex, texres); |
---|
| 5962 | + } |
---|
| 5963 | + catch (Exception e) |
---|
| 5964 | + { |
---|
| 5965 | + //System.err.println("FAILED: " + this); |
---|
| 5966 | + failedBump = true; |
---|
5687 | 5967 | } |
---|
5688 | 5968 | |
---|
5689 | 5969 | if (!compiled) |
---|
.. | .. |
---|
5706 | 5986 | } |
---|
5707 | 5987 | } |
---|
5708 | 5988 | |
---|
5709 | | - if (!failed) |
---|
5710 | | - display.ReleaseTextures(tex); |
---|
| 5989 | + if (!failedBump) |
---|
| 5990 | + display.ReleaseBumpTexture(tex); |
---|
| 5991 | + |
---|
| 5992 | + if (!failedPigment) |
---|
| 5993 | + display.ReleasePigmentTexture(tex); |
---|
5711 | 5994 | |
---|
5712 | 5995 | display.PopMaterial(this, selected); |
---|
5713 | 5996 | } |
---|
.. | .. |
---|
6080 | 6363 | // dec 2012 |
---|
6081 | 6364 | new Exception().printStackTrace(); |
---|
6082 | 6365 | return; |
---|
| 6366 | + } |
---|
| 6367 | + |
---|
| 6368 | + if (dontselect) |
---|
| 6369 | + { |
---|
| 6370 | + //bRep.GenerateNormalsMINE(); |
---|
6083 | 6371 | } |
---|
6084 | 6372 | |
---|
6085 | 6373 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
6932 | 7220 | spot.translate(32, 32); |
---|
6933 | 7221 | spotw = spot.x + spot.width; |
---|
6934 | 7222 | spoth = spot.y + spot.height; |
---|
6935 | | - info.g.setColor(Color.blue); |
---|
| 7223 | + info.g.setColor(Color.cyan); |
---|
6936 | 7224 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
6937 | 7225 | // if (CameraPane.Xmin > spot.x) |
---|
6938 | 7226 | // { |
---|
.. | .. |
---|
6950 | 7238 | // { |
---|
6951 | 7239 | // CameraPane.Ymax = spoth; |
---|
6952 | 7240 | // } |
---|
6953 | | - info.g.drawLine(spotw, spoth, spotw, spoth - 15); |
---|
6954 | | - info.g.drawLine(spotw, spoth, spotw - 15, spoth); |
---|
| 7241 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7242 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
6955 | 7243 | spot.translate(0, -32); |
---|
6956 | | - info.g.setColor(Color.green); |
---|
| 7244 | + info.g.setColor(Color.yellow); |
---|
6957 | 7245 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7246 | + info.g.setColor(Color.green); |
---|
6958 | 7247 | // if (CameraPane.Xmin > spot.x) |
---|
6959 | 7248 | // { |
---|
6960 | 7249 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7006 | 7295 | startX = info.x; |
---|
7007 | 7296 | startY = info.y; |
---|
7008 | 7297 | |
---|
7009 | | - hitSomething = 0; |
---|
| 7298 | + hitSomething = -1; |
---|
7010 | 7299 | cVector origin = new cVector(); |
---|
7011 | 7300 | //LA.xformPos(origin, toParent, origin); |
---|
7012 | 7301 | Rectangle spot = new Rectangle(); |
---|
.. | .. |
---|
7082 | 7371 | //System.out.println("hitSomething = " + hitSomething); |
---|
7083 | 7372 | |
---|
7084 | 7373 | double scale = 0.005f * info.camera.Distance(); |
---|
| 7374 | + |
---|
7085 | 7375 | cVector xlate = new cVector(); |
---|
7086 | 7376 | //cVector xlate2 = new cVector(); |
---|
7087 | 7377 | switch (hitSomething) |
---|
.. | .. |
---|
7230 | 7520 | |
---|
7231 | 7521 | case hitScale: // scale |
---|
7232 | 7522 | double hScale = (double) (info.x - centerPt.x) / 32; |
---|
| 7523 | + double sign = 1; |
---|
| 7524 | + if (hScale < 0) |
---|
| 7525 | + { |
---|
| 7526 | + sign = -1; |
---|
| 7527 | + } |
---|
| 7528 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
---|
7233 | 7529 | if (hScale < 0.01) |
---|
7234 | 7530 | { |
---|
7235 | | - hScale = 0.01; |
---|
| 7531 | + //hScale = 0.01; |
---|
7236 | 7532 | } |
---|
7237 | | - hScale = Math.pow(hScale, scale * 50); |
---|
7238 | | - if (hScale < 0.01) |
---|
7239 | | - { |
---|
7240 | | - hScale = 0.01; |
---|
7241 | | - } |
---|
| 7533 | + |
---|
7242 | 7534 | double vScale = (double) (info.y - centerPt.y) / 32; |
---|
7243 | | - if (vScale < 0.01) |
---|
| 7535 | + sign = 1; |
---|
| 7536 | + if (vScale < 0) |
---|
7244 | 7537 | { |
---|
7245 | | - vScale = 0.01; |
---|
| 7538 | + sign = -1; |
---|
7246 | 7539 | } |
---|
7247 | | - vScale = Math.pow(vScale, scale * 50); |
---|
| 7540 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
---|
7248 | 7541 | if (vScale < 0.01) |
---|
7249 | 7542 | { |
---|
7250 | | - vScale = 0.01; |
---|
| 7543 | + //vScale = 0.01; |
---|
7251 | 7544 | } |
---|
7252 | 7545 | LA.matCopy(startMat, toParent); |
---|
7253 | 7546 | /**/ |
---|
.. | .. |
---|
7258 | 7551 | } |
---|
7259 | 7552 | /**/ |
---|
7260 | 7553 | |
---|
| 7554 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
---|
| 7555 | + |
---|
| 7556 | + if (totalScale < 0.01) |
---|
| 7557 | + { |
---|
| 7558 | + totalScale = 0.01; |
---|
| 7559 | + } |
---|
| 7560 | + |
---|
7261 | 7561 | switch (info.pane.RenderCamera().viewCode) |
---|
7262 | 7562 | { |
---|
7263 | 7563 | case 3: // '\001' |
---|
7264 | | - if (modified) |
---|
| 7564 | + if (modified || opposite) |
---|
7265 | 7565 | { |
---|
7266 | 7566 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7267 | | - LA.matScale(toParent, vScale, 1, 1); |
---|
| 7567 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7268 | 7568 | } // vScale, 1); |
---|
7269 | 7569 | else |
---|
7270 | 7570 | { |
---|
7271 | | - LA.matScale(toParent, vScale, vScale, vScale); |
---|
| 7571 | + // EXCEPTION! |
---|
| 7572 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7272 | 7573 | } // vScale, 1); |
---|
7273 | 7574 | break; |
---|
7274 | 7575 | |
---|
7275 | 7576 | case 2: // '\002' |
---|
7276 | | - if (modified) |
---|
| 7577 | + if (modified || opposite) |
---|
7277 | 7578 | { |
---|
7278 | 7579 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7279 | | - LA.matScale(toParent, 1, vScale, 1); |
---|
| 7580 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7280 | 7581 | } else |
---|
7281 | 7582 | { |
---|
7282 | | - LA.matScale(toParent, vScale, 1, vScale); |
---|
| 7583 | + LA.matScale(toParent, totalScale, 1, totalScale); |
---|
7283 | 7584 | } |
---|
7284 | 7585 | break; |
---|
7285 | 7586 | |
---|
7286 | 7587 | case 1: // '\003' |
---|
7287 | | - if (modified) |
---|
| 7588 | + if (modified || opposite) |
---|
7288 | 7589 | { |
---|
7289 | 7590 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7290 | | - LA.matScale(toParent, 1, 1, vScale); |
---|
| 7591 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7291 | 7592 | } else |
---|
7292 | 7593 | { |
---|
7293 | | - LA.matScale(toParent, vScale, vScale, 1); |
---|
| 7594 | + LA.matScale(toParent, totalScale, totalScale, 1); |
---|
7294 | 7595 | } |
---|
7295 | 7596 | break; |
---|
7296 | 7597 | } |
---|
.. | .. |
---|
7431 | 7732 | objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")"; |
---|
7432 | 7733 | } else |
---|
7433 | 7734 | { |
---|
7434 | | - objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
| 7735 | + objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ ""; |
---|
7435 | 7736 | } // + super.toString(); |
---|
7436 | 7737 | //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); |
---|
7437 | 7738 | |
---|
.. | .. |
---|
7504 | 7805 | editWindow = null; |
---|
7505 | 7806 | } // ? |
---|
7506 | 7807 | } |
---|
| 7808 | + else |
---|
| 7809 | + { |
---|
| 7810 | + //editWindow.closeUI(); |
---|
| 7811 | + } |
---|
7507 | 7812 | } |
---|
7508 | 7813 | |
---|
7509 | 7814 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7515 | 7820 | /*transient*/ cVector2[] projectedVertices = new cVector2[0]; |
---|
7516 | 7821 | |
---|
7517 | 7822 | Object3D /*Composite*/ parent; |
---|
7518 | | - Object3D /*Composite*/ fileparent; |
---|
| 7823 | + Object3D /*Composite*/ fileparent; // In the case of FileObject |
---|
7519 | 7824 | |
---|
7520 | 7825 | double[][] toParent; // dynamic matrix |
---|
7521 | 7826 | double[][] fromParent; |
---|
.. | .. |
---|
7679 | 7984 | private static cVector edge2 = new cVector(); |
---|
7680 | 7985 | //private static cVector norm = new cVector(); |
---|
7681 | 7986 | /*transient private*/ int hitSomething; |
---|
7682 | | - private static final int hitCenter = 1; |
---|
7683 | | - private static final int hitScale = 2; |
---|
7684 | | - private static final int hitRotate = 3; |
---|
| 7987 | + static final int hitCenter = 1; |
---|
| 7988 | + static final int hitScale = 2; |
---|
| 7989 | + static final int hitRotate = 3; |
---|
7685 | 7990 | /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag |
---|
7686 | 7991 | /*transient*/ private Point centerPt; |
---|
7687 | 7992 | /*transient*/ private int startX; |
---|