Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
Object3D.java
....@@ -5,6 +5,7 @@
55 import java.util.Vector;
66
77 import javax.media.j3d.Transform3D;
8
+import javax.media.opengl.GL;
89 import javax.vecmath.Vector3d;
910
1011 import javax.imageio.ImageIO;
....@@ -13,11 +14,20 @@
1314 import //weka.core.
1415 matrix.Matrix;
1516
17
+import java.util.UUID;
18
+
1619 //import net.sourceforge.sizeof.SizeOf;
1720 public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D>
1821 {
1922 //static final long serialVersionUID = -607422624994562685L;
2023 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
+ //
2131
2232 ScriptNode scriptnode;
2333
....@@ -99,64 +109,136 @@
99109
100110 // transient boolean reduced; // for morph reduction
101111
102
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
103
-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
104114
105
-transient Object3D transientsupport; // for cloning
106
-transient boolean transientlink2master;
115
+ transient Object3D transientsupport; // for cloning
116
+ transient boolean transientlink2master;
107117
108
-void SaveSupports()
109
-{
110
- if (blockloop)
111
- return;
112
-
113
- transientsupport = support;
114
- transientlink2master = link2master;
115
-
116
- support = null;
117
- link2master = false;
118
-
119
- if (bRep != null)
118
+ void SaveSupports()
120119 {
121
- bRep.SaveSupports();
122
- }
123
-
124
- for (int i = 0; i < Size(); i++)
125
- {
126
- Object3D child = (Object3D) get(i);
127
- if (child == null)
128
- continue;
129
- blockloop = true;
130
- child.SaveSupports();
131
- blockloop = false;
132
- }
133
-}
120
+ if (blockloop)
121
+ return;
134122
135
-void RestoreSupports()
136
-{
137
- if (blockloop)
138
- return;
123
+ transientsupport = support;
124
+ transientlink2master = link2master;
139125
140
- support = transientsupport;
141
- link2master = transientlink2master;
142
- transientsupport = null;
143
- transientlink2master = false;
144
-
145
- if (bRep != null)
146
- {
147
- 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
+ }
148143 }
149
-
150
- for (int i = 0; i < Size(); i++)
144
+
145
+ void RestoreSupports()
151146 {
152
- Object3D child = (Object3D) get(i);
153
- if (child == null)
154
- continue;
155
- blockloop = true;
156
- child.RestoreSupports();
157
- 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
+ }
158169 }
159
-}
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
+ }
160242
161243 // MOCAP SUPPORT
162244 double tx,ty,tz,rx,ry,rz;
....@@ -299,6 +381,7 @@
299381 }
300382
301383 boolean live = false;
384
+ boolean dontselect = false;
302385 boolean hide = false;
303386 boolean link2master = false; // performs reset support/master at each frame
304387 boolean marked = false; // animation node
....@@ -480,12 +563,14 @@
480563 toParent = LA.newMatrix();
481564 fromParent = LA.newMatrix();
482565 }
566
+
483567 if (toParentMarked == null)
484568 {
485569 if (maxcount != 1)
486570 {
487571 new Exception().printStackTrace();
488572 }
573
+
489574 toParentMarked = LA.newMatrix();
490575 fromParentMarked = LA.newMatrix();
491576 }
....@@ -773,7 +858,7 @@
773858 if (step == 0)
774859 step = 1;
775860 if (maxcount == 0)
776
- maxcount = 2048; // 4;
861
+ maxcount = 128; // 2048; // 4;
777862 // if (acceleration == 0)
778863 // acceleration = 10;
779864 if (delay == 0) // serial
....@@ -796,7 +881,7 @@
796881
797882 if (marked && Globals.isLIVE() && live &&
798883 //TEMP21aug2018
799
- Globals.DrawMode() == iCameraPane.SHADOW &&
884
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
800885 currentframe != Globals.framecount)
801886 {
802887 currentframe = Globals.framecount;
....@@ -808,7 +893,8 @@
808893
809894 boolean changedir = random && Math.random() < 0.01; // && !link2master;
810895
811
- if (transformcount*factor > maxcount || (step == 1 && changedir))
896
+ if (transformcount*factor >= maxcount && (rewind || random) ||
897
+ (step == 1 && changedir))
812898 {
813899 countdown = 1;
814900 delay = speedup?8:1;
....@@ -911,6 +997,11 @@
911997 fromParent = null; // LA.newMatrix();
912998 bRep = null; // new BoundaryRep();
913999
1000
+ if (oname != null && oname.equals("LeftHand"))
1001
+ {
1002
+ name = oname;
1003
+ }
1004
+
9141005 /*
9151006 float hue = (float)Math.random();
9161007 Color col;
....@@ -953,7 +1044,7 @@
9531044
9541045 public Object clone()
9551046 {
956
- return GrafreeD.clone(this);
1047
+ return Grafreed.clone(this);
9571048 }
9581049
9591050 Object3D copyExpand()
....@@ -1469,7 +1560,7 @@
14691560 BoundaryRep.SEUIL = other.material.cameralight;
14701561
14711562 // Set default to 0.1
1472
- BoundaryRep.SEUIL /= 2;
1563
+ BoundaryRep.SEUIL /= 4; // 2;
14731564 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14741565 }
14751566
....@@ -1728,7 +1819,7 @@
17281819 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17291820 o.bRep = transientrep;
17301821 if (clone)
1731
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1822
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17321823 o.CreateMaterial();
17331824 o.SetAttributes(this, -1);
17341825 //parent
....@@ -1741,7 +1832,7 @@
17411832 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17421833 o.bRep = bRep;
17431834 if (clone)
1744
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1835
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17451836 o.CreateMaterial();
17461837 //o.overwriteThis(this, -1);
17471838 o.SetAttributes(this, -1);
....@@ -1828,12 +1919,15 @@
18281919 if (obj.name == null)
18291920 continue; // can't be a null one
18301921
1922
+ // Try perfect match first.
18311923 if (n.equals(obj.name))
18321924 {
18331925 theobj = obj;
18341926 count++;
18351927 }
18361928 }
1929
+
1930
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18371931
18381932 if (count != 1)
18391933 for (int i=Size(); --i>=0;)
....@@ -2299,6 +2393,7 @@
22992393 {
23002394 if (newWindow)
23012395 {
2396
+ new Exception().printStackTrace();
23022397 System.exit(0);
23032398 if (parent != null)
23042399 {
....@@ -2475,13 +2570,13 @@
24752570 return retval;
24762571 }
24772572
2478
- void doEditDrag(ClickInfo info)
2573
+ void doEditDrag(ClickInfo info, boolean opposite)
24792574 {
24802575 switch (doSomething)
24812576 {
24822577 case 1: // '\001'
24832578 //super.
2484
- doEditDrag0(info);
2579
+ doEditDrag0(info, opposite);
24852580 break;
24862581
24872582 case 2: // '\002'
....@@ -2494,11 +2589,11 @@
24942589 {
24952590 //sel.hitSomething = childToDrag.hitSomething;
24962591 //childToDrag.doEditDrag(info);
2497
- sel.doEditDrag(info);
2592
+ sel.doEditDrag(info, opposite);
24982593 } else
24992594 {
25002595 //super.
2501
- doEditDrag0(info);
2596
+ doEditDrag0(info, opposite);
25022597 }
25032598 }
25042599 break;
....@@ -2608,6 +2703,18 @@
26082703 void GenNormalsS(boolean crease)
26092704 {
26102705 selection.GenNormals(crease);
2706
+// for (int i=0; i<selection.size(); i++)
2707
+// {
2708
+// Object3D selectee = (Object3D) selection.elementAt(i);
2709
+// selectee.GenNormals(crease);
2710
+// }
2711
+
2712
+ //Touch();
2713
+ }
2714
+
2715
+ void GenNormalsMeshS()
2716
+ {
2717
+ selection.GenNormalsMesh();
26112718 // for (int i=0; i<selection.size(); i++)
26122719 // {
26132720 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2748,6 +2855,24 @@
27482855 if (child == null)
27492856 continue;
27502857 child.GenNormals(crease);
2858
+// Children().release(i);
2859
+ }
2860
+ blockloop = false;
2861
+ }
2862
+
2863
+ void GenNormalsMesh()
2864
+ {
2865
+ if (blockloop)
2866
+ return;
2867
+
2868
+ blockloop = true;
2869
+ GenNormalsMesh0();
2870
+ for (int i = 0; i < Children().Size(); i++)
2871
+ {
2872
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2873
+ if (child == null)
2874
+ continue;
2875
+ child.GenNormalsMesh();
27512876 // Children().release(i);
27522877 }
27532878 blockloop = false;
....@@ -2905,7 +3030,8 @@
29053030 {
29063031 if (bRep != null)
29073032 {
2908
- bRep.GenUV();
3033
+ bRep.GenUV(); //1);
3034
+ //bRep.UnfoldUV();
29093035 Touch();
29103036 }
29113037 }
....@@ -2915,6 +3041,15 @@
29153041 if (bRep != null)
29163042 {
29173043 bRep.GenerateNormals(crease);
3044
+ Touch();
3045
+ }
3046
+ }
3047
+
3048
+ void GenNormalsMesh0()
3049
+ {
3050
+ if (bRep != null)
3051
+ {
3052
+ bRep.GenerateNormalsMesh();
29183053 Touch();
29193054 }
29203055 }
....@@ -2980,6 +3115,33 @@
29803115 blockloop = false;
29813116 }
29823117
3118
+ void TransformChildren()
3119
+ {
3120
+ if (toParent != null)
3121
+ {
3122
+ for (int i=Size(); --i>=0;)
3123
+ {
3124
+ Object3D v = get(i);
3125
+
3126
+ if (v.toParent == null)
3127
+ {
3128
+ v.toParent = LA.newMatrix();
3129
+ v.fromParent = LA.newMatrix();
3130
+ }
3131
+
3132
+// LA.matConcat(v.toParent, toParent, v.toParent);
3133
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3134
+ LA.matConcat(toParent, v.toParent, v.toParent);
3135
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3136
+ }
3137
+
3138
+ toParent = null; // LA.matIdentity(toParent);
3139
+ fromParent = null; // LA.matIdentity(fromParent);
3140
+
3141
+ Touch();
3142
+ }
3143
+ }
3144
+
29833145 void TransformGeometry()
29843146 {
29853147 Object3D obj = this;
....@@ -3201,9 +3363,11 @@
32013363
32023364 BoundaryRep sup = bRep.support;
32033365 bRep.support = null;
3204
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3366
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32053367 // bRep.SplitInTwo(onlyone); // thread...
3206
- temprep.SplitInTwo(reduction34, onlyone);
3368
+
3369
+ while(temprep.SplitInTwo(reduction34, onlyone));
3370
+
32073371 bRep = temprep;
32083372 bRep.support = sup;
32093373 Touch();
....@@ -3340,7 +3504,8 @@
33403504 if (blockloop)
33413505 return;
33423506
3343
- if (marked || (bRep != null && material != null)) // borderline...
3507
+ if (//marked || // does not make sense
3508
+ (bRep != null || material != null)) // borderline...
33443509 live = h;
33453510
33463511 for (int i = 0; i < Size(); i++)
....@@ -3361,7 +3526,8 @@
33613526 return;
33623527
33633528 //if (bRep != null)
3364
- if (marked || (bRep != null && material != null)) // borderline...
3529
+ if (//marked || // does not make sense
3530
+ (bRep != null || material != null)) // borderline...
33653531 link2master = h;
33663532
33673533 for (int i = 0; i < Size(); i++)
....@@ -3381,7 +3547,8 @@
33813547 if (blockloop)
33823548 return;
33833549
3384
- if (marked || (bRep != null && material != null)) // borderline...
3550
+ if (//marked || // does not make sense
3551
+ (bRep != null || material != null)) // borderline...
33853552 hide = h;
33863553
33873554 for (int i = 0; i < Size(); i++)
....@@ -3401,7 +3568,7 @@
34013568 if (blockloop)
34023569 return;
34033570
3404
- if (bRep != null && material != null) // borderline...
3571
+ if (bRep != null || material != null) // borderline...
34053572 marked = h;
34063573
34073574 for (int i = 0; i < Size(); i++)
....@@ -3411,6 +3578,46 @@
34113578 continue;
34123579 blockloop = true;
34133580 child.MarkLeaves(h);
3581
+ blockloop = false;
3582
+ // release(i);
3583
+ }
3584
+ }
3585
+
3586
+ void RewindLeaves(boolean h)
3587
+ {
3588
+ if (blockloop)
3589
+ return;
3590
+
3591
+ if (bRep != null || material != null) // borderline...
3592
+ rewind = h;
3593
+
3594
+ for (int i = 0; i < Size(); i++)
3595
+ {
3596
+ Object3D child = (Object3D) get(i); // reserve(i);
3597
+ if (child == null)
3598
+ continue;
3599
+ blockloop = true;
3600
+ child.RewindLeaves(h);
3601
+ blockloop = false;
3602
+ // release(i);
3603
+ }
3604
+ }
3605
+
3606
+ void RandomLeaves(boolean h)
3607
+ {
3608
+ if (blockloop)
3609
+ return;
3610
+
3611
+ if (bRep != null || material != null) // borderline...
3612
+ random = h;
3613
+
3614
+ for (int i = 0; i < Size(); i++)
3615
+ {
3616
+ Object3D child = (Object3D) get(i); // reserve(i);
3617
+ if (child == null)
3618
+ continue;
3619
+ blockloop = true;
3620
+ child.RandomLeaves(h);
34143621 blockloop = false;
34153622 // release(i);
34163623 }
....@@ -3725,7 +3932,7 @@
37253932 if (child == null)
37263933 continue;
37273934
3728
- if (GrafreeD.RENDERME > 0)
3935
+ if (Grafreed.RENDERME > 0)
37293936 {
37303937 if (child instanceof Merge)
37313938 ((Merge)child).renderme();
....@@ -3876,7 +4083,7 @@
38764083 if (child == null)
38774084 continue;
38784085
3879
- if (GrafreeD.RENDERME > 0)
4086
+ if (Grafreed.RENDERME > 0)
38804087 {
38814088 if (child instanceof Merge)
38824089 ((Merge)child).renderme();
....@@ -4071,7 +4278,7 @@
40714278 if (child == null)
40724279 continue;
40734280
4074
- if (GrafreeD.RENDERME > 0)
4281
+ if (Grafreed.RENDERME > 0)
40754282 {
40764283 if (child instanceof Merge)
40774284 ((Merge)child).renderme();
....@@ -4184,6 +4391,55 @@
41844391 {
41854392 blockloop = true;
41864393 get(i).RepairShadow();
4394
+ blockloop = false;
4395
+ }
4396
+ }
4397
+
4398
+ void RepairSOV()
4399
+ {
4400
+ if (blockloop)
4401
+ return;
4402
+
4403
+ String texname = this.GetPigmentTexture();
4404
+
4405
+ if (texname.startsWith("sov"))
4406
+ {
4407
+ String[] s = texname.split("/");
4408
+
4409
+ String[] sname = s[1].split("Color.pn");
4410
+
4411
+ texname = sname[0];
4412
+
4413
+ if (sname.length > 1)
4414
+ {
4415
+ texname += "Color.jpg";
4416
+ }
4417
+
4418
+ this.SetPigmentTexture("sov/" + texname);
4419
+ }
4420
+
4421
+ texname = this.GetBumpTexture();
4422
+
4423
+ if (texname.startsWith("sov"))
4424
+ {
4425
+ String[] s = texname.split("/");
4426
+
4427
+ String[] sname = s[1].split("Bump.pn");
4428
+
4429
+ texname = sname[0];
4430
+
4431
+ if (sname.length > 1)
4432
+ {
4433
+ texname += "Bump.jpg";
4434
+ }
4435
+
4436
+ this.SetBumpTexture("sov/" + texname);
4437
+ }
4438
+
4439
+ for (int i=0; i<Size(); i++)
4440
+ {
4441
+ blockloop = true;
4442
+ get(i).RepairSOV();
41874443 blockloop = false;
41884444 }
41894445 }
....@@ -4678,7 +4934,7 @@
46784934
46794935 cTreePath SelectLeaf(int indexcount, boolean deselect)
46804936 {
4681
- if (hide)
4937
+ if (hide || dontselect)
46824938 return null;
46834939
46844940 if (count <= 0)
....@@ -4704,7 +4960,7 @@
47044960
47054961 cTreePath Select(int indexcount, boolean deselect)
47064962 {
4707
- if (hide)
4963
+ if (hide || dontselect)
47084964 return null;
47094965
47104966 if (count <= 0)
....@@ -5156,10 +5412,34 @@
51565412
51575413 // System.out.println("Fullname = " + fullname);
51585414
5159
- if (fullname.name.indexOf(":") == -1)
5160
- return fullname.name;
5415
+ // Does not work on Windows due to C:
5416
+// if (fullname.name.indexOf(":") == -1)
5417
+// return fullname.name;
5418
+//
5419
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51615420
5162
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5421
+ String[] split = fullname.name.split(":");
5422
+
5423
+ if (split.length == 0)
5424
+ {
5425
+ return "";
5426
+ }
5427
+
5428
+ if (split.length <= 2)
5429
+ {
5430
+ if (fullname.name.endsWith(":"))
5431
+ {
5432
+ // Windows
5433
+ return fullname.name.substring(0, fullname.name.length()-1);
5434
+ }
5435
+
5436
+ return split[0];
5437
+ }
5438
+
5439
+ // Windows
5440
+ assert(split.length == 4);
5441
+
5442
+ return split[0] + ":" + split[1];
51635443 }
51645444
51655445 static String GetBump(cTexture fullname)
....@@ -5168,10 +5448,38 @@
51685448 return "";
51695449
51705450 // System.out.println("Fullname = " + fullname);
5171
- if (fullname.name.indexOf(":") == -1)
5172
- return "";
5173
-
5174
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5451
+ // Does not work on Windows due to C:
5452
+// if (fullname.name.indexOf(":") == -1)
5453
+// return "";
5454
+//
5455
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5456
+ String[] split = fullname.name.split(":");
5457
+
5458
+ if (split.length == 0)
5459
+ {
5460
+ return "";
5461
+ }
5462
+
5463
+ if (split.length == 1)
5464
+ {
5465
+ return "";
5466
+ }
5467
+
5468
+ if (split.length == 2)
5469
+ {
5470
+ if (fullname.name.endsWith(":"))
5471
+ {
5472
+ // Windows
5473
+ return "";
5474
+ }
5475
+
5476
+ return split[1];
5477
+ }
5478
+
5479
+ // Windows
5480
+ assert(split.length == 4);
5481
+
5482
+ return split[2] + ":" + split[3];
51755483 }
51765484
51775485 String GetPigmentTexture()
....@@ -5245,7 +5553,7 @@
52455553 System.out.print("; textures = " + textures);
52465554 System.out.println("; usedtextures = " + usedtextures);
52475555
5248
- if (GetTextures() == null)
5556
+ if (GetTextures() == null) // What is that??
52495557 GetTextures().name = ":";
52505558
52515559 String texname = tex;
....@@ -5276,6 +5584,43 @@
52765584 child.ResetPigmentTexture();
52775585 blockloop = false;
52785586 }
5587
+ }
5588
+
5589
+ UUID GetUUID()
5590
+ {
5591
+ if (uuid == null)
5592
+ {
5593
+ // Serial
5594
+ uuid = UUID.randomUUID();
5595
+ }
5596
+
5597
+ return uuid;
5598
+ }
5599
+
5600
+ Object3D GetObject(UUID uid)
5601
+ {
5602
+ if (blockloop)
5603
+ return null;
5604
+
5605
+ if (GetUUID().equals(uid))
5606
+ return this;
5607
+
5608
+ int nb = Size();
5609
+ for (int i = 0; i < nb; i++)
5610
+ {
5611
+ Object3D child = (Object3D) get(i);
5612
+
5613
+ if (child == null)
5614
+ continue;
5615
+
5616
+ blockloop = true;
5617
+ Object3D obj = child.GetObject(uid);
5618
+ blockloop = false;
5619
+ if (obj != null)
5620
+ return obj;
5621
+ }
5622
+
5623
+ return null;
52795624 }
52805625
52815626 void SetBumpTexture(String tex)
....@@ -5322,12 +5667,23 @@
53225667 boolean NeedSupport()
53235668 {
53245669 return
5325
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5670
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
53265671 // PROBLEM with CROWD!!
5327
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5672
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53285673 }
53295674
53305675 static boolean DEBUG_SELECTION = false;
5676
+
5677
+ boolean IsLive()
5678
+ {
5679
+ if (live)
5680
+ return true;
5681
+
5682
+ if (parent == null)
5683
+ return false;
5684
+
5685
+ return parent.IsLive();
5686
+ }
53315687
53325688 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53335689 {
....@@ -5339,7 +5695,7 @@
53395695 }
53405696
53415697 if (display.DrawMode() == iCameraPane.SELECTION &&
5342
- hide)
5698
+ (hide || dontselect))
53435699 return;
53445700
53455701 if (name != null && name.contains("sclera"))
....@@ -5371,7 +5727,7 @@
53715727 return;
53725728 }
53735729
5374
- javax.media.opengl.GL gl = display.GetGL();
5730
+ //javax.media.opengl.GL gl = display.GetGL();
53755731
53765732 /*
53775733 if (touched)
....@@ -5390,7 +5746,7 @@
53905746 support = support;
53915747
53925748 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5393
- boolean usecalllists = false; // 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);
53945750
53955751 if (!usecalllists && bRep != null && bRep.displaylist > 0)
53965752 {
....@@ -5410,10 +5766,12 @@
54105766 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54115767
54125768 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5413
- (touched || (bRep != null && bRep.displaylist <= 0)))
5769
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5770
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
54145771 {
54155772 Globals.lighttouched = true;
54165773 } // all panes...
5774
+
54175775 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
54185776 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
54195777 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5423,7 +5781,7 @@
54235781 //if (displaylist == -1 && usecalllists)
54245782 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54255783 {
5426
- bRep.displaylist = gl.glGenLists(1);
5784
+ bRep.displaylist = display.GenList();
54275785 assert(bRep.displaylist != 0);
54285786 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54295787 //System.out.println("\tgen list " + list);
....@@ -5435,14 +5793,16 @@
54355793 if (usecalllists)
54365794 {
54375795 // System.err.println("new list " + bRep.displaylist + " for " + this);
5438
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5796
+ display.NewList(bRep.displaylist);
54395797 }
5798
+
54405799 CallList(display, root, selected, blocked);
5800
+
54415801 // compiled = true;
54425802 if (usecalllists)
54435803 {
54445804 // System.err.println("end list " + bRep.displaylist + " for " + this);
5445
- gl.glEndList();
5805
+ display.EndList();
54465806 }
54475807 //gl.glDrawBuffer(gl.GL_BACK);
54485808 // XXX touched = false;
....@@ -5490,7 +5850,7 @@
54905850 if (display.DrawMode() == iCameraPane.SHADOW)
54915851 {
54925852 if (!link2master // tricky to cull in shadow mode.
5493
- && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
5853
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54945854 {
54955855 //System.out.print("CULLED");
54965856 culled = true;
....@@ -5498,7 +5858,7 @@
54985858 }
54995859 else
55005860 //GetBRep().getBounds(v0, v1, this);
5501
- if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
5861
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
55025862 culled = true;
55035863
55045864 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5538,7 +5898,7 @@
55385898 {
55395899 if (GetBRep() != null)
55405900 {
5541
- CameraPane.NextIndex(this, gl);
5901
+ display.NextIndex();
55425902 // vertex color conflict : gl.glCallList(list);
55435903 DrawNode(display, root, selected);
55445904 if (this instanceof BezierPatch)
....@@ -5579,7 +5939,28 @@
55795939 tex = GetTextures();
55805940 }
55815941
5582
- display.BindTextures(tex, texres);
5942
+ boolean failedPigment = false;
5943
+ boolean failedBump = false;
5944
+
5945
+ try
5946
+ {
5947
+ display.BindPigmentTexture(tex, texres);
5948
+ }
5949
+ catch (Exception e)
5950
+ {
5951
+ System.err.println("FAILED: " + this);
5952
+ failedPigment = true;
5953
+ }
5954
+
5955
+ try
5956
+ {
5957
+ display.BindBumpTexture(tex, texres);
5958
+ }
5959
+ catch (Exception e)
5960
+ {
5961
+ //System.err.println("FAILED: " + this);
5962
+ failedBump = true;
5963
+ }
55835964
55845965 if (!compiled)
55855966 {
....@@ -5595,13 +5976,17 @@
55955976
55965977 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55975978 assert(bRep.displaylist != 0);
5598
- gl.glCallList(bRep.displaylist);
5979
+ display.CallList(bRep.displaylist);
55995980 // june 2013 drawSelf(display, root, selected);
56005981 }
56015982 }
56025983 }
56035984
5604
- display.ReleaseTextures(tex);
5985
+ if (!failedBump)
5986
+ display.ReleaseBumpTexture(tex);
5987
+
5988
+ if (!failedPigment)
5989
+ display.ReleasePigmentTexture(tex);
56055990
56065991 display.PopMaterial(this, selected);
56075992 }
....@@ -5730,6 +6115,9 @@
57306115
57316116 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57326117 {
6118
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6119
+ return;
6120
+
57336121 if (hide)
57346122 return;
57356123 // shadow optimisation
....@@ -5855,6 +6243,9 @@
58556243 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58566244 return; // no shadow for transparent objects
58576245
6246
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6247
+ return;
6248
+
58586249 if (hide)
58596250 return;
58606251
....@@ -5895,9 +6286,10 @@
58956286 return;
58966287 }
58976288
6289
+ //bRep.GenUV(1/material.diffuseness);
58986290 // bRep.lock = true;
58996291
5900
- javax.media.opengl.GL gl = display.GetGL();
6292
+ //javax.media.opengl.GL gl = display.GetGL();
59016293
59026294 if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59036295 {
....@@ -5914,23 +6306,7 @@
59146306
59156307 bRep.getMinMax(min, max, 100);
59166308
5917
- gl.glBegin(gl.GL_LINES);
5918
-
5919
- gl.glVertex3d(min.x, min.y, min.z);
5920
- gl.glVertex3d(min.x, min.y, max.z);
5921
- gl.glVertex3d(min.x, min.y, min.z);
5922
- gl.glVertex3d(min.x, max.y, min.z);
5923
- gl.glVertex3d(min.x, min.y, min.z);
5924
- gl.glVertex3d(max.x, min.y, min.z);
5925
-
5926
- gl.glVertex3d(max.x, max.y, max.z);
5927
- gl.glVertex3d(min.x, max.y, max.z);
5928
- gl.glVertex3d(max.x, max.y, max.z);
5929
- gl.glVertex3d(max.x, min.y, max.z);
5930
- gl.glVertex3d(max.x, max.y, max.z);
5931
- gl.glVertex3d(max.x, max.y, min.z);
5932
-
5933
- gl.glEnd();
6309
+ display.DrawBox(min, max);
59346310
59356311 return;
59366312 }
....@@ -5984,178 +6360,14 @@
59846360 new Exception().printStackTrace();
59856361 return;
59866362 }
5987
-
5988
- // TRIANGLE STRIP ARRAY
5989
- if (bRep.trimmed)
5990
- {
5991
- float[] v = bRep.getRawVertices();
5992
- float[] n = bRep.getRawNormals();
5993
- float[] c = bRep.getRawColors();
5994
- float[] uv = bRep.getRawUVMap();
5995
-
5996
- int count2 = 0;
5997
- int count3 = 0;
5998
-
5999
- if (n.length > 0)
6000
- {
6001
- for (int i = 0; i < strips.length; i++)
6002
- {
6003
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6004
-
6005
- /*
6006
- boolean locked = false;
6007
- float eps = 0.1f;
6008
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6009
-
6010
- int dot = 0;
6011
-
6012
- if ((dot&1) == 0)
6013
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6014
-
6015
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6016
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6017
- else
6018
- {
6019
- locked = true;
6020
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6021
- }
6022
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6023
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6024
- if (hasnorm)
6025
- {
6026
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6027
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6028
- }
6029
-
6030
- if ((dot&4) == 0)
6031
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6032
-
6033
- if (wrap || !locked && (dot&8) != 0)
6034
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6035
- else
6036
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6037
-
6038
- f.dot = dot;
6039
- */
6040
-
6041
- if (!selectmode)
6042
- {
6043
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6044
- {
6045
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6046
- } else
6047
- {
6048
- gl.glNormal3f(0, 0, 1);
6049
- }
6050
-
6051
- if (c != null)
6052
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6053
- {
6054
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6055
- }
6056
- }
6057
- if (flipV)
6058
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6059
- else
6060
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6061
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6062
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6063
-
6064
- count2 += 2;
6065
- count3 += 3;
6066
- if (!selectmode)
6067
- {
6068
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6069
- {
6070
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6071
- } else
6072
- {
6073
- gl.glNormal3f(0, 0, 1);
6074
- }
6075
- if (c != null)
6076
- {
6077
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6078
- }
6079
- }
6080
- if (flipV)
6081
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6082
- else
6083
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6084
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6085
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6086
-
6087
- count2 += 2;
6088
- count3 += 3;
6089
- for (int j = 0; j < strips[i] - 2; j++)
6090
- {
6091
- //gl.glTexCoord2d(...);
6092
- if (!selectmode)
6093
- {
6094
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6095
- {
6096
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6097
- } else
6098
- {
6099
- gl.glNormal3f(0, 0, 1);
6100
- }
6101
- if (c != null)
6102
- {
6103
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6104
- }
6105
- }
6106
-
6107
- if (flipV)
6108
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6109
- else
6110
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6111
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6112
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6113
- count2 += 2;
6114
- count3 += 3;
6115
- }
6116
-
6117
- gl.glEnd();
6118
- }
6119
- }
6120
-
6121
- assert count3 == v.length;
6122
- }
6123
- else // !trimmed
6124
- {
6125
- int count = 0;
6126
- for (int i = 0; i < strips.length; i++)
6127
- {
6128
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6129
-
6130
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6131
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6132
-
6133
- drawVertex(gl, p, selectmode);
6134
- drawVertex(gl, q, selectmode);
6135
-
6136
- for (int j = 0; j < strips[i] - 2; j++)
6137
- {
6138
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6139
-
6140
-// if (j%2 == 0)
6141
-// drawFace(p, q, r, display, null);
6142
-// else
6143
-// drawFace(p, r, q, display, null);
6144
-
6145
-// p = q;
6146
-// q = r;
6147
- drawVertex(gl, r, selectmode);
6148
- }
6149
-
6150
- gl.glEnd();
6151
- }
6152
- }
6363
+
6364
+ display.DrawGeometry(bRep, flipV, selectmode);
61536365 } else // catch (Error e)
61546366 {
61556367 // TRIANGLE ARRAY
61566368 if (IsOpaque()) // Static())
61576369 {
6158
- gl.glBegin(gl.GL_TRIANGLES);
6370
+ display.StartTriangles();
61596371 int facecount = bRep.FaceCount();
61606372 for (int i = 0; i < facecount; i++)
61616373 {
....@@ -6220,7 +6432,7 @@
62206432
62216433 display.DrawFace(this, p, q, r, face);
62226434 }
6223
- gl.glEnd();
6435
+ display.EndTriangles();
62246436 }
62256437 else
62266438 {
....@@ -6249,8 +6461,8 @@
62496461 //System.out.println("SORT");
62506462
62516463 java.util.Arrays.sort(facescompare);
6252
-
6253
- gl.glBegin(gl.GL_TRIANGLES);
6464
+
6465
+ display.StartTriangles();
62546466 for (int i = 0; i < facecount; i++)
62556467 {
62566468 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6264,11 +6476,12 @@
62646476
62656477 display.DrawFace(this, p, q, r, face);
62666478 }
6267
- gl.glEnd();
6479
+ display.EndTriangles();
62686480 }
62696481
62706482 if (false) // live && support != null && support.bRep != null) // debug weights
62716483 {
6484
+ /*
62726485 gl.glDisable(gl.GL_LIGHTING);
62736486 float[] colorV = new float[3];
62746487
....@@ -6347,6 +6560,7 @@
63476560 // gl.glEnd();
63486561 }
63496562 }
6563
+ */
63506564 }
63516565 }
63526566
....@@ -6405,22 +6619,6 @@
64056619 void Print(Vertex v)
64066620 {
64076621 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
6408
- }
6409
-
6410
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6411
- {
6412
- if (!selectmode)
6413
- {
6414
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6415
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6416
-
6417
- if (flipV)
6418
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6419
- else
6420
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6421
- }
6422
-
6423
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
64246622 }
64256623
64266624 void drawSelf(ClickInfo info, int level, boolean select)
....@@ -7013,7 +7211,7 @@
70137211 spot.translate(32, 32);
70147212 spotw = spot.x + spot.width;
70157213 spoth = spot.y + spot.height;
7016
- info.g.setColor(Color.blue);
7214
+ info.g.setColor(Color.cyan);
70177215 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70187216 // if (CameraPane.Xmin > spot.x)
70197217 // {
....@@ -7031,11 +7229,12 @@
70317229 // {
70327230 // CameraPane.Ymax = spoth;
70337231 // }
7034
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7035
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7232
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7233
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
70367234 spot.translate(0, -32);
7037
- info.g.setColor(Color.green);
7235
+ info.g.setColor(Color.yellow);
70387236 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7237
+ info.g.setColor(Color.green);
70397238 // if (CameraPane.Xmin > spot.x)
70407239 // {
70417240 // CameraPane.Xmin = spot.x;
....@@ -7087,7 +7286,7 @@
70877286 startX = info.x;
70887287 startY = info.y;
70897288
7090
- hitSomething = 0;
7289
+ hitSomething = -1;
70917290 cVector origin = new cVector();
70927291 //LA.xformPos(origin, toParent, origin);
70937292 Rectangle spot = new Rectangle();
....@@ -7120,7 +7319,7 @@
71207319 }
71217320
71227321 //System.out.println("info.modifiers = " + info.modifiers);
7123
- modified = (info.modifiers & CameraPane.META) != 0;
7322
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
71247323 //System.out.println("modified = " + modified);
71257324 //new Exception().printStackTrace();
71267325 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7148,7 +7347,7 @@
71487347 return true;
71497348 }
71507349
7151
- void doEditDrag0(ClickInfo info)
7350
+ void doEditDrag0(ClickInfo info, boolean opposite)
71527351 {
71537352 if (hitSomething == 0)
71547353 {
....@@ -7163,6 +7362,7 @@
71637362 //System.out.println("hitSomething = " + hitSomething);
71647363
71657364 double scale = 0.005f * info.camera.Distance();
7365
+
71667366 cVector xlate = new cVector();
71677367 //cVector xlate2 = new cVector();
71687368 switch (hitSomething)
....@@ -7175,7 +7375,7 @@
71757375
71767376 scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
71777377
7178
- if (modified)
7378
+ if (modified || opposite)
71797379 {
71807380 //assert(false);
71817381 /*
....@@ -7269,6 +7469,7 @@
72697469
72707470 if (modified)
72717471 {
7472
+ // Rotate 90 degrees
72727473 angle /= (Math.PI / 4);
72737474 angle = Math.floor(angle + 0.5);
72747475 angle *= (Math.PI / 4);
....@@ -7310,24 +7511,27 @@
73107511
73117512 case hitScale: // scale
73127513 double hScale = (double) (info.x - centerPt.x) / 32;
7514
+ double sign = 1;
7515
+ if (hScale < 0)
7516
+ {
7517
+ sign = -1;
7518
+ }
7519
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
73137520 if (hScale < 0.01)
73147521 {
7315
- hScale = 0.01;
7522
+ //hScale = 0.01;
73167523 }
7317
- hScale = Math.pow(hScale, scale * 50);
7318
- if (hScale < 0.01)
7319
- {
7320
- hScale = 0.01;
7321
- }
7524
+
73227525 double vScale = (double) (info.y - centerPt.y) / 32;
7323
- if (vScale < 0.01)
7526
+ sign = 1;
7527
+ if (vScale < 0)
73247528 {
7325
- vScale = 0.01;
7529
+ sign = -1;
73267530 }
7327
- vScale = Math.pow(vScale, scale * 50);
7531
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
73287532 if (vScale < 0.01)
73297533 {
7330
- vScale = 0.01;
7534
+ //vScale = 0.01;
73317535 }
73327536 LA.matCopy(startMat, toParent);
73337537 /**/
....@@ -7338,39 +7542,47 @@
73387542 }
73397543 /**/
73407544
7545
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7546
+
7547
+ if (totalScale < 0.01)
7548
+ {
7549
+ totalScale = 0.01;
7550
+ }
7551
+
73417552 switch (info.pane.RenderCamera().viewCode)
73427553 {
73437554 case 3: // '\001'
7344
- if (modified)
7555
+ if (modified || opposite)
73457556 {
73467557 //LA.matScale(toParent, 1, hScale, vScale);
7347
- LA.matScale(toParent, vScale, 1, 1);
7558
+ LA.matScale(toParent, totalScale, 1, 1);
73487559 } // vScale, 1);
73497560 else
73507561 {
7351
- LA.matScale(toParent, vScale, vScale, vScale);
7562
+ // EXCEPTION!
7563
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
73527564 } // vScale, 1);
73537565 break;
73547566
73557567 case 2: // '\002'
7356
- if (modified)
7568
+ if (modified || opposite)
73577569 {
73587570 //LA.matScale(toParent, hScale, 1, vScale);
7359
- LA.matScale(toParent, 1, vScale, 1);
7571
+ LA.matScale(toParent, 1, totalScale, 1);
73607572 } else
73617573 {
7362
- LA.matScale(toParent, vScale, 1, vScale);
7574
+ LA.matScale(toParent, totalScale, 1, totalScale);
73637575 }
73647576 break;
73657577
73667578 case 1: // '\003'
7367
- if (modified)
7579
+ if (modified || opposite)
73687580 {
73697581 //LA.matScale(toParent, hScale, vScale, 1);
7370
- LA.matScale(toParent, 1, 1, vScale);
7582
+ LA.matScale(toParent, 1, 1, totalScale);
73717583 } else
73727584 {
7373
- LA.matScale(toParent, vScale, vScale, 1);
7585
+ LA.matScale(toParent, totalScale, totalScale, 1);
73747586 }
73757587 break;
73767588 }
....@@ -7503,14 +7715,22 @@
75037715 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
75047716 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
75057717 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7718
+
7719
+ String objname;
7720
+
75067721 if (false) //parent != null)
75077722 {
7508
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7723
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
75097724 } else
75107725 {
7511
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7726
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
75127727 } // + super.toString();
75137728 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7729
+
7730
+ if (!Globals.ADVANCED)
7731
+ return objname;
7732
+
7733
+ return objname + " " + System.identityHashCode(this);
75147734 }
75157735
75167736 public int hashCode()
....@@ -7566,6 +7786,7 @@
75667786 objectUI.closeUI();
75677787 if (editWindow != null)
75687788 {
7789
+ editWindow.ctrlPanel.FlushUI();
75697790 editWindow.refreshContents();
75707791 } // ? new
75717792 objectUI = null;
....@@ -7586,7 +7807,7 @@
75867807 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75877808
75887809 Object3D /*Composite*/ parent;
7589
- Object3D /*Composite*/ fileparent;
7810
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75907811
75917812 double[][] toParent; // dynamic matrix
75927813 double[][] fromParent;
....@@ -7701,7 +7922,7 @@
77017922 {
77027923 assert(bRep != null);
77037924 if (!(support instanceof GenericJoint)) // support.bRep != null)
7704
- GrafreeD.Assert(support.bRep == bRep.support);
7925
+ Grafreed.Assert(support.bRep == bRep.support);
77057926 }
77067927 else
77077928 {
....@@ -7750,9 +7971,9 @@
77507971 private static cVector edge2 = new cVector();
77517972 //private static cVector norm = new cVector();
77527973 /*transient private*/ int hitSomething;
7753
- private static final int hitCenter = 1;
7754
- private static final int hitScale = 2;
7755
- private static final int hitRotate = 3;
7974
+ static final int hitCenter = 1;
7975
+ static final int hitScale = 2;
7976
+ static final int hitRotate = 3;
77567977 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
77577978 /*transient*/ private Point centerPt;
77587979 /*transient*/ private int startX;