Normand Briere
2019-06-17 e36047725ce3217618d4e5807ac7c8769b9e3598
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
....@@ -430,16 +513,16 @@
430513 {
431514 Object3D copy = this;
432515
433
- Camera parentcam = CameraPane.theRenderer.ManipCamera();
516
+ Camera parentcam = Globals.theRenderer.ManipCamera();
434517
435
- if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[0])
518
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
436519 {
437
- parentcam = CameraPane.theRenderer.Cameras()[1];
520
+ parentcam = Globals.theRenderer.Cameras()[1];
438521 }
439522
440
- if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[1])
523
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
441524 {
442
- parentcam = CameraPane.theRenderer.Cameras()[0];
525
+ parentcam = Globals.theRenderer.Cameras()[0];
443526 }
444527
445528 if (this == parentcam)
....@@ -447,7 +530,7 @@
447530 //assert(this instanceof Camera);
448531
449532 for (int count = parentcam.GetTransformCount(); --count>=0;)
450
- LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.toParent, CameraPane.theRenderer.TargetLookAt());
533
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
451534 }
452535
453536 copy.marked ^= true;
....@@ -467,7 +550,7 @@
467550 //assert(this instanceof Camera);
468551
469552 for (int count = parentcam.GetTransformCount(); --count>=0;)
470
- LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.fromParent, CameraPane.theRenderer.TargetLookAt());
553
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
471554 }
472555
473556 copy.Touch(); // display list issue
....@@ -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;
....@@ -911,6 +996,11 @@
911996 fromParent = null; // LA.newMatrix();
912997 bRep = null; // new BoundaryRep();
913998
999
+ if (oname != null && oname.equals("LeftHand"))
1000
+ {
1001
+ name = oname;
1002
+ }
1003
+
9141004 /*
9151005 float hue = (float)Math.random();
9161006 Color col;
....@@ -953,7 +1043,7 @@
9531043
9541044 public Object clone()
9551045 {
956
- return GrafreeD.clone(this);
1046
+ return Grafreed.clone(this);
9571047 }
9581048
9591049 Object3D copyExpand()
....@@ -1469,7 +1559,7 @@
14691559 BoundaryRep.SEUIL = other.material.cameralight;
14701560
14711561 // Set default to 0.1
1472
- BoundaryRep.SEUIL /= 2;
1562
+ BoundaryRep.SEUIL /= 4; // 2;
14731563 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14741564 }
14751565
....@@ -1728,7 +1818,7 @@
17281818 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17291819 o.bRep = transientrep;
17301820 if (clone)
1731
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1821
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17321822 o.CreateMaterial();
17331823 o.SetAttributes(this, -1);
17341824 //parent
....@@ -1741,7 +1831,7 @@
17411831 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17421832 o.bRep = bRep;
17431833 if (clone)
1744
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1834
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17451835 o.CreateMaterial();
17461836 //o.overwriteThis(this, -1);
17471837 o.SetAttributes(this, -1);
....@@ -1828,12 +1918,15 @@
18281918 if (obj.name == null)
18291919 continue; // can't be a null one
18301920
1921
+ // Try perfect match first.
18311922 if (n.equals(obj.name))
18321923 {
18331924 theobj = obj;
18341925 count++;
18351926 }
18361927 }
1928
+
1929
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18371930
18381931 if (count != 1)
18391932 for (int i=Size(); --i>=0;)
....@@ -2299,6 +2392,7 @@
22992392 {
23002393 if (newWindow)
23012394 {
2395
+ new Exception().printStackTrace();
23022396 System.exit(0);
23032397 if (parent != null)
23042398 {
....@@ -2475,13 +2569,13 @@
24752569 return retval;
24762570 }
24772571
2478
- void doEditDrag(ClickInfo info)
2572
+ void doEditDrag(ClickInfo info, boolean opposite)
24792573 {
24802574 switch (doSomething)
24812575 {
24822576 case 1: // '\001'
24832577 //super.
2484
- doEditDrag0(info);
2578
+ doEditDrag0(info, opposite);
24852579 break;
24862580
24872581 case 2: // '\002'
....@@ -2494,11 +2588,11 @@
24942588 {
24952589 //sel.hitSomething = childToDrag.hitSomething;
24962590 //childToDrag.doEditDrag(info);
2497
- sel.doEditDrag(info);
2591
+ sel.doEditDrag(info, opposite);
24982592 } else
24992593 {
25002594 //super.
2501
- doEditDrag0(info);
2595
+ doEditDrag0(info, opposite);
25022596 }
25032597 }
25042598 break;
....@@ -2608,6 +2702,18 @@
26082702 void GenNormalsS(boolean crease)
26092703 {
26102704 selection.GenNormals(crease);
2705
+// for (int i=0; i<selection.size(); i++)
2706
+// {
2707
+// Object3D selectee = (Object3D) selection.elementAt(i);
2708
+// selectee.GenNormals(crease);
2709
+// }
2710
+
2711
+ //Touch();
2712
+ }
2713
+
2714
+ void GenNormalsMeshS()
2715
+ {
2716
+ selection.GenNormalsMesh();
26112717 // for (int i=0; i<selection.size(); i++)
26122718 // {
26132719 // Object3D selectee = (Object3D) selection.elementAt(i);
....@@ -2748,6 +2854,24 @@
27482854 if (child == null)
27492855 continue;
27502856 child.GenNormals(crease);
2857
+// Children().release(i);
2858
+ }
2859
+ blockloop = false;
2860
+ }
2861
+
2862
+ void GenNormalsMesh()
2863
+ {
2864
+ if (blockloop)
2865
+ return;
2866
+
2867
+ blockloop = true;
2868
+ GenNormalsMesh0();
2869
+ for (int i = 0; i < Children().Size(); i++)
2870
+ {
2871
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2872
+ if (child == null)
2873
+ continue;
2874
+ child.GenNormalsMesh();
27512875 // Children().release(i);
27522876 }
27532877 blockloop = false;
....@@ -2905,7 +3029,8 @@
29053029 {
29063030 if (bRep != null)
29073031 {
2908
- bRep.GenUV();
3032
+ bRep.GenUV(); //1);
3033
+ //bRep.UnfoldUV();
29093034 Touch();
29103035 }
29113036 }
....@@ -2915,6 +3040,15 @@
29153040 if (bRep != null)
29163041 {
29173042 bRep.GenerateNormals(crease);
3043
+ Touch();
3044
+ }
3045
+ }
3046
+
3047
+ void GenNormalsMesh0()
3048
+ {
3049
+ if (bRep != null)
3050
+ {
3051
+ bRep.GenerateNormalsMesh();
29183052 Touch();
29193053 }
29203054 }
....@@ -2980,6 +3114,33 @@
29803114 blockloop = false;
29813115 }
29823116
3117
+ void TransformChildren()
3118
+ {
3119
+ if (toParent != null)
3120
+ {
3121
+ for (int i=Size(); --i>=0;)
3122
+ {
3123
+ Object3D v = get(i);
3124
+
3125
+ if (v.toParent == null)
3126
+ {
3127
+ v.toParent = LA.newMatrix();
3128
+ v.fromParent = LA.newMatrix();
3129
+ }
3130
+
3131
+// LA.matConcat(v.toParent, toParent, v.toParent);
3132
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3133
+ LA.matConcat(toParent, v.toParent, v.toParent);
3134
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3135
+ }
3136
+
3137
+ toParent = null; // LA.matIdentity(toParent);
3138
+ fromParent = null; // LA.matIdentity(fromParent);
3139
+
3140
+ Touch();
3141
+ }
3142
+ }
3143
+
29833144 void TransformGeometry()
29843145 {
29853146 Object3D obj = this;
....@@ -3201,9 +3362,11 @@
32013362
32023363 BoundaryRep sup = bRep.support;
32033364 bRep.support = null;
3204
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3365
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32053366 // bRep.SplitInTwo(onlyone); // thread...
3206
- temprep.SplitInTwo(reduction34, onlyone);
3367
+
3368
+ while(temprep.SplitInTwo(reduction34, onlyone));
3369
+
32073370 bRep = temprep;
32083371 bRep.support = sup;
32093372 Touch();
....@@ -3725,7 +3888,7 @@
37253888 if (child == null)
37263889 continue;
37273890
3728
- if (GrafreeD.RENDERME > 0)
3891
+ if (Grafreed.RENDERME > 0)
37293892 {
37303893 if (child instanceof Merge)
37313894 ((Merge)child).renderme();
....@@ -3876,7 +4039,7 @@
38764039 if (child == null)
38774040 continue;
38784041
3879
- if (GrafreeD.RENDERME > 0)
4042
+ if (Grafreed.RENDERME > 0)
38804043 {
38814044 if (child instanceof Merge)
38824045 ((Merge)child).renderme();
....@@ -4071,7 +4234,7 @@
40714234 if (child == null)
40724235 continue;
40734236
4074
- if (GrafreeD.RENDERME > 0)
4237
+ if (Grafreed.RENDERME > 0)
40754238 {
40764239 if (child instanceof Merge)
40774240 ((Merge)child).renderme();
....@@ -4184,6 +4347,55 @@
41844347 {
41854348 blockloop = true;
41864349 get(i).RepairShadow();
4350
+ blockloop = false;
4351
+ }
4352
+ }
4353
+
4354
+ void RepairSOV()
4355
+ {
4356
+ if (blockloop)
4357
+ return;
4358
+
4359
+ String texname = this.GetPigmentTexture();
4360
+
4361
+ if (texname.startsWith("sov"))
4362
+ {
4363
+ String[] s = texname.split("/");
4364
+
4365
+ String[] sname = s[1].split("Color.pn");
4366
+
4367
+ texname = sname[0];
4368
+
4369
+ if (sname.length > 1)
4370
+ {
4371
+ texname += "Color.jpg";
4372
+ }
4373
+
4374
+ this.SetPigmentTexture("sov/" + texname);
4375
+ }
4376
+
4377
+ texname = this.GetBumpTexture();
4378
+
4379
+ if (texname.startsWith("sov"))
4380
+ {
4381
+ String[] s = texname.split("/");
4382
+
4383
+ String[] sname = s[1].split("Bump.pn");
4384
+
4385
+ texname = sname[0];
4386
+
4387
+ if (sname.length > 1)
4388
+ {
4389
+ texname += "Bump.jpg";
4390
+ }
4391
+
4392
+ this.SetBumpTexture("sov/" + texname);
4393
+ }
4394
+
4395
+ for (int i=0; i<Size(); i++)
4396
+ {
4397
+ blockloop = true;
4398
+ get(i).RepairSOV();
41874399 blockloop = false;
41884400 }
41894401 }
....@@ -4678,7 +4890,7 @@
46784890
46794891 cTreePath SelectLeaf(int indexcount, boolean deselect)
46804892 {
4681
- if (hide)
4893
+ if (hide || dontselect)
46824894 return null;
46834895
46844896 if (count <= 0)
....@@ -4704,7 +4916,7 @@
47044916
47054917 cTreePath Select(int indexcount, boolean deselect)
47064918 {
4707
- if (hide)
4919
+ if (hide || dontselect)
47084920 return null;
47094921
47104922 if (count <= 0)
....@@ -5156,10 +5368,34 @@
51565368
51575369 // System.out.println("Fullname = " + fullname);
51585370
5159
- if (fullname.name.indexOf(":") == -1)
5160
- return fullname.name;
5371
+ // Does not work on Windows due to C:
5372
+// if (fullname.name.indexOf(":") == -1)
5373
+// return fullname.name;
5374
+//
5375
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51615376
5162
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5377
+ String[] split = fullname.name.split(":");
5378
+
5379
+ if (split.length == 0)
5380
+ {
5381
+ return "";
5382
+ }
5383
+
5384
+ if (split.length <= 2)
5385
+ {
5386
+ if (fullname.name.endsWith(":"))
5387
+ {
5388
+ // Windows
5389
+ return fullname.name.substring(0, fullname.name.length()-1);
5390
+ }
5391
+
5392
+ return split[0];
5393
+ }
5394
+
5395
+ // Windows
5396
+ assert(split.length == 4);
5397
+
5398
+ return split[0] + ":" + split[1];
51635399 }
51645400
51655401 static String GetBump(cTexture fullname)
....@@ -5168,10 +5404,38 @@
51685404 return "";
51695405
51705406 // 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());
5407
+ // Does not work on Windows due to C:
5408
+// if (fullname.name.indexOf(":") == -1)
5409
+// return "";
5410
+//
5411
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5412
+ String[] split = fullname.name.split(":");
5413
+
5414
+ if (split.length == 0)
5415
+ {
5416
+ return "";
5417
+ }
5418
+
5419
+ if (split.length == 1)
5420
+ {
5421
+ return "";
5422
+ }
5423
+
5424
+ if (split.length == 2)
5425
+ {
5426
+ if (fullname.name.endsWith(":"))
5427
+ {
5428
+ // Windows
5429
+ return "";
5430
+ }
5431
+
5432
+ return split[1];
5433
+ }
5434
+
5435
+ // Windows
5436
+ assert(split.length == 4);
5437
+
5438
+ return split[2] + ":" + split[3];
51755439 }
51765440
51775441 String GetPigmentTexture()
....@@ -5245,7 +5509,7 @@
52455509 System.out.print("; textures = " + textures);
52465510 System.out.println("; usedtextures = " + usedtextures);
52475511
5248
- if (GetTextures() == null)
5512
+ if (GetTextures() == null) // What is that??
52495513 GetTextures().name = ":";
52505514
52515515 String texname = tex;
....@@ -5276,6 +5540,43 @@
52765540 child.ResetPigmentTexture();
52775541 blockloop = false;
52785542 }
5543
+ }
5544
+
5545
+ UUID GetUUID()
5546
+ {
5547
+ if (uuid == null)
5548
+ {
5549
+ // Serial
5550
+ uuid = UUID.randomUUID();
5551
+ }
5552
+
5553
+ return uuid;
5554
+ }
5555
+
5556
+ Object3D GetObject(UUID uid)
5557
+ {
5558
+ if (blockloop)
5559
+ return null;
5560
+
5561
+ if (GetUUID().equals(uid))
5562
+ return this;
5563
+
5564
+ int nb = Size();
5565
+ for (int i = 0; i < nb; i++)
5566
+ {
5567
+ Object3D child = (Object3D) get(i);
5568
+
5569
+ if (child == null)
5570
+ continue;
5571
+
5572
+ blockloop = true;
5573
+ Object3D obj = child.GetObject(uid);
5574
+ blockloop = false;
5575
+ if (obj != null)
5576
+ return obj;
5577
+ }
5578
+
5579
+ return null;
52795580 }
52805581
52815582 void SetBumpTexture(String tex)
....@@ -5322,12 +5623,23 @@
53225623 boolean NeedSupport()
53235624 {
53245625 return
5325
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5626
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
53265627 // PROBLEM with CROWD!!
5327
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5628
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53285629 }
53295630
53305631 static boolean DEBUG_SELECTION = false;
5632
+
5633
+ boolean IsLive()
5634
+ {
5635
+ if (live)
5636
+ return true;
5637
+
5638
+ if (parent == null)
5639
+ return false;
5640
+
5641
+ return parent.IsLive();
5642
+ }
53315643
53325644 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53335645 {
....@@ -5339,7 +5651,7 @@
53395651 }
53405652
53415653 if (display.DrawMode() == iCameraPane.SELECTION &&
5342
- hide)
5654
+ (hide || dontselect))
53435655 return;
53445656
53455657 if (name != null && name.contains("sclera"))
....@@ -5371,7 +5683,7 @@
53715683 return;
53725684 }
53735685
5374
- javax.media.opengl.GL gl = display.GetGL();
5686
+ //javax.media.opengl.GL gl = display.GetGL();
53755687
53765688 /*
53775689 if (touched)
....@@ -5390,7 +5702,7 @@
53905702 support = support;
53915703
53925704 //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);
5705
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
53945706
53955707 if (!usecalllists && bRep != null && bRep.displaylist > 0)
53965708 {
....@@ -5410,10 +5722,12 @@
54105722 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54115723
54125724 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5413
- (touched || (bRep != null && bRep.displaylist <= 0)))
5725
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5726
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
54145727 {
54155728 Globals.lighttouched = true;
54165729 } // all panes...
5730
+
54175731 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
54185732 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
54195733 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5423,7 +5737,7 @@
54235737 //if (displaylist == -1 && usecalllists)
54245738 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54255739 {
5426
- bRep.displaylist = gl.glGenLists(1);
5740
+ bRep.displaylist = display.GenList();
54275741 assert(bRep.displaylist != 0);
54285742 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54295743 //System.out.println("\tgen list " + list);
....@@ -5435,14 +5749,16 @@
54355749 if (usecalllists)
54365750 {
54375751 // System.err.println("new list " + bRep.displaylist + " for " + this);
5438
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5752
+ display.NewList(bRep.displaylist);
54395753 }
5754
+
54405755 CallList(display, root, selected, blocked);
5756
+
54415757 // compiled = true;
54425758 if (usecalllists)
54435759 {
54445760 // System.err.println("end list " + bRep.displaylist + " for " + this);
5445
- gl.glEndList();
5761
+ display.EndList();
54465762 }
54475763 //gl.glDrawBuffer(gl.GL_BACK);
54485764 // XXX touched = false;
....@@ -5490,7 +5806,7 @@
54905806 if (display.DrawMode() == iCameraPane.SHADOW)
54915807 {
54925808 if (!link2master // tricky to cull in shadow mode.
5493
- && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
5809
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54945810 {
54955811 //System.out.print("CULLED");
54965812 culled = true;
....@@ -5498,7 +5814,7 @@
54985814 }
54995815 else
55005816 //GetBRep().getBounds(v0, v1, this);
5501
- if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
5817
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
55025818 culled = true;
55035819
55045820 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5538,7 +5854,7 @@
55385854 {
55395855 if (GetBRep() != null)
55405856 {
5541
- CameraPane.NextIndex(this, gl);
5857
+ display.NextIndex();
55425858 // vertex color conflict : gl.glCallList(list);
55435859 DrawNode(display, root, selected);
55445860 if (this instanceof BezierPatch)
....@@ -5579,7 +5895,28 @@
55795895 tex = GetTextures();
55805896 }
55815897
5582
- display.BindTextures(tex, texres);
5898
+ boolean failedPigment = false;
5899
+ boolean failedBump = false;
5900
+
5901
+ try
5902
+ {
5903
+ display.BindPigmentTexture(tex, texres);
5904
+ }
5905
+ catch (Exception e)
5906
+ {
5907
+ System.err.println("FAILED: " + this);
5908
+ failedPigment = true;
5909
+ }
5910
+
5911
+ try
5912
+ {
5913
+ display.BindBumpTexture(tex, texres);
5914
+ }
5915
+ catch (Exception e)
5916
+ {
5917
+ //System.err.println("FAILED: " + this);
5918
+ failedBump = true;
5919
+ }
55835920
55845921 if (!compiled)
55855922 {
....@@ -5595,13 +5932,17 @@
55955932
55965933 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55975934 assert(bRep.displaylist != 0);
5598
- gl.glCallList(bRep.displaylist);
5935
+ display.CallList(bRep.displaylist);
55995936 // june 2013 drawSelf(display, root, selected);
56005937 }
56015938 }
56025939 }
56035940
5604
- display.ReleaseTextures(tex);
5941
+ if (!failedBump)
5942
+ display.ReleaseBumpTexture(tex);
5943
+
5944
+ if (!failedPigment)
5945
+ display.ReleasePigmentTexture(tex);
56055946
56065947 display.PopMaterial(this, selected);
56075948 }
....@@ -5730,6 +6071,9 @@
57306071
57316072 void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57326073 {
6074
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6075
+ return;
6076
+
57336077 if (hide)
57346078 return;
57356079 // shadow optimisation
....@@ -5855,6 +6199,9 @@
58556199 if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58566200 return; // no shadow for transparent objects
58576201
6202
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6203
+ return;
6204
+
58586205 if (hide)
58596206 return;
58606207
....@@ -5895,9 +6242,10 @@
58956242 return;
58966243 }
58976244
6245
+ //bRep.GenUV(1/material.diffuseness);
58986246 // bRep.lock = true;
58996247
5900
- javax.media.opengl.GL gl = display.GetGL();
6248
+ //javax.media.opengl.GL gl = display.GetGL();
59016249
59026250 if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59036251 {
....@@ -5914,23 +6262,7 @@
59146262
59156263 bRep.getMinMax(min, max, 100);
59166264
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();
6265
+ display.DrawBox(min, max);
59346266
59356267 return;
59366268 }
....@@ -5984,178 +6316,14 @@
59846316 new Exception().printStackTrace();
59856317 return;
59866318 }
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
- }
6319
+
6320
+ display.DrawGeometry(bRep, flipV, selectmode);
61536321 } else // catch (Error e)
61546322 {
61556323 // TRIANGLE ARRAY
61566324 if (IsOpaque()) // Static())
61576325 {
6158
- gl.glBegin(gl.GL_TRIANGLES);
6326
+ display.StartTriangles();
61596327 int facecount = bRep.FaceCount();
61606328 for (int i = 0; i < facecount; i++)
61616329 {
....@@ -6220,7 +6388,7 @@
62206388
62216389 display.DrawFace(this, p, q, r, face);
62226390 }
6223
- gl.glEnd();
6391
+ display.EndTriangles();
62246392 }
62256393 else
62266394 {
....@@ -6249,8 +6417,8 @@
62496417 //System.out.println("SORT");
62506418
62516419 java.util.Arrays.sort(facescompare);
6252
-
6253
- gl.glBegin(gl.GL_TRIANGLES);
6420
+
6421
+ display.StartTriangles();
62546422 for (int i = 0; i < facecount; i++)
62556423 {
62566424 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6264,11 +6432,12 @@
62646432
62656433 display.DrawFace(this, p, q, r, face);
62666434 }
6267
- gl.glEnd();
6435
+ display.EndTriangles();
62686436 }
62696437
62706438 if (false) // live && support != null && support.bRep != null) // debug weights
62716439 {
6440
+ /*
62726441 gl.glDisable(gl.GL_LIGHTING);
62736442 float[] colorV = new float[3];
62746443
....@@ -6347,6 +6516,7 @@
63476516 // gl.glEnd();
63486517 }
63496518 }
6519
+ */
63506520 }
63516521 }
63526522
....@@ -6391,7 +6561,7 @@
63916561 center.add(r);
63926562 center.mul(1.0/3);
63936563
6394
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6564
+ center.sub(Globals.theRenderer.EyeCamera().location);
63956565
63966566 distance = center.dot(center);
63976567 }
....@@ -6405,22 +6575,6 @@
64056575 void Print(Vertex v)
64066576 {
64076577 //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);
64246578 }
64256579
64266580 void drawSelf(ClickInfo info, int level, boolean select)
....@@ -7013,7 +7167,7 @@
70137167 spot.translate(32, 32);
70147168 spotw = spot.x + spot.width;
70157169 spoth = spot.y + spot.height;
7016
- info.g.setColor(Color.blue);
7170
+ info.g.setColor(Color.cyan);
70177171 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70187172 // if (CameraPane.Xmin > spot.x)
70197173 // {
....@@ -7031,11 +7185,12 @@
70317185 // {
70327186 // CameraPane.Ymax = spoth;
70337187 // }
7034
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7035
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7188
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7189
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
70367190 spot.translate(0, -32);
7037
- info.g.setColor(Color.green);
7191
+ info.g.setColor(Color.yellow);
70387192 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7193
+ info.g.setColor(Color.green);
70397194 // if (CameraPane.Xmin > spot.x)
70407195 // {
70417196 // CameraPane.Xmin = spot.x;
....@@ -7087,7 +7242,7 @@
70877242 startX = info.x;
70887243 startY = info.y;
70897244
7090
- hitSomething = 0;
7245
+ hitSomething = -1;
70917246 cVector origin = new cVector();
70927247 //LA.xformPos(origin, toParent, origin);
70937248 Rectangle spot = new Rectangle();
....@@ -7120,7 +7275,7 @@
71207275 }
71217276
71227277 //System.out.println("info.modifiers = " + info.modifiers);
7123
- modified = (info.modifiers & CameraPane.META) != 0;
7278
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
71247279 //System.out.println("modified = " + modified);
71257280 //new Exception().printStackTrace();
71267281 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7148,7 +7303,7 @@
71487303 return true;
71497304 }
71507305
7151
- void doEditDrag0(ClickInfo info)
7306
+ void doEditDrag0(ClickInfo info, boolean opposite)
71527307 {
71537308 if (hitSomething == 0)
71547309 {
....@@ -7163,6 +7318,7 @@
71637318 //System.out.println("hitSomething = " + hitSomething);
71647319
71657320 double scale = 0.005f * info.camera.Distance();
7321
+
71667322 cVector xlate = new cVector();
71677323 //cVector xlate2 = new cVector();
71687324 switch (hitSomething)
....@@ -7173,9 +7329,9 @@
71737329
71747330 case hitCenter: // Translate
71757331
7176
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7332
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
71777333
7178
- if (modified)
7334
+ if (modified || opposite)
71797335 {
71807336 //assert(false);
71817337 /*
....@@ -7221,10 +7377,10 @@
72217377 }
72227378 LA.xformDir(up, ClickInfo.matbuffer, up);
72237379 // if (!CameraPane.LOCALTRANSFORM)
7224
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7380
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
72257381 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
72267382 // if (!CameraPane.LOCALTRANSFORM)
7227
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7383
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
72287384 //LA.vecCross(up, cVector.Z, right2);
72297385
72307386 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7269,6 +7425,7 @@
72697425
72707426 if (modified)
72717427 {
7428
+ // Rotate 90 degrees
72727429 angle /= (Math.PI / 4);
72737430 angle = Math.floor(angle + 0.5);
72747431 angle *= (Math.PI / 4);
....@@ -7282,7 +7439,7 @@
72827439 }
72837440 /**/
72847441
7285
- switch (info.pane.renderCamera.viewCode)
7442
+ switch (info.pane.RenderCamera().viewCode)
72867443 {
72877444 case 1: // '\001'
72887445 LA.matZRotate(toParent, angle);
....@@ -7310,24 +7467,27 @@
73107467
73117468 case hitScale: // scale
73127469 double hScale = (double) (info.x - centerPt.x) / 32;
7470
+ double sign = 1;
7471
+ if (hScale < 0)
7472
+ {
7473
+ sign = -1;
7474
+ }
7475
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
73137476 if (hScale < 0.01)
73147477 {
7315
- hScale = 0.01;
7478
+ //hScale = 0.01;
73167479 }
7317
- hScale = Math.pow(hScale, scale * 50);
7318
- if (hScale < 0.01)
7319
- {
7320
- hScale = 0.01;
7321
- }
7480
+
73227481 double vScale = (double) (info.y - centerPt.y) / 32;
7323
- if (vScale < 0.01)
7482
+ sign = 1;
7483
+ if (vScale < 0)
73247484 {
7325
- vScale = 0.01;
7485
+ sign = -1;
73267486 }
7327
- vScale = Math.pow(vScale, scale * 50);
7487
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
73287488 if (vScale < 0.01)
73297489 {
7330
- vScale = 0.01;
7490
+ //vScale = 0.01;
73317491 }
73327492 LA.matCopy(startMat, toParent);
73337493 /**/
....@@ -7338,39 +7498,47 @@
73387498 }
73397499 /**/
73407500
7341
- switch (info.pane.renderCamera.viewCode)
7501
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7502
+
7503
+ if (totalScale < 0.01)
7504
+ {
7505
+ totalScale = 0.01;
7506
+ }
7507
+
7508
+ switch (info.pane.RenderCamera().viewCode)
73427509 {
73437510 case 3: // '\001'
7344
- if (modified)
7511
+ if (modified || opposite)
73457512 {
73467513 //LA.matScale(toParent, 1, hScale, vScale);
7347
- LA.matScale(toParent, vScale, 1, 1);
7514
+ LA.matScale(toParent, totalScale, 1, 1);
73487515 } // vScale, 1);
73497516 else
73507517 {
7351
- LA.matScale(toParent, vScale, vScale, vScale);
7518
+ // EXCEPTION!
7519
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
73527520 } // vScale, 1);
73537521 break;
73547522
73557523 case 2: // '\002'
7356
- if (modified)
7524
+ if (modified || opposite)
73577525 {
73587526 //LA.matScale(toParent, hScale, 1, vScale);
7359
- LA.matScale(toParent, 1, vScale, 1);
7527
+ LA.matScale(toParent, 1, totalScale, 1);
73607528 } else
73617529 {
7362
- LA.matScale(toParent, vScale, 1, vScale);
7530
+ LA.matScale(toParent, totalScale, 1, totalScale);
73637531 }
73647532 break;
73657533
73667534 case 1: // '\003'
7367
- if (modified)
7535
+ if (modified || opposite)
73687536 {
73697537 //LA.matScale(toParent, hScale, vScale, 1);
7370
- LA.matScale(toParent, 1, 1, vScale);
7538
+ LA.matScale(toParent, 1, 1, totalScale);
73717539 } else
73727540 {
7373
- LA.matScale(toParent, vScale, vScale, 1);
7541
+ LA.matScale(toParent, totalScale, totalScale, 1);
73747542 }
73757543 break;
73767544 }
....@@ -7503,14 +7671,22 @@
75037671 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
75047672 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
75057673 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7674
+
7675
+ String objname;
7676
+
75067677 if (false) //parent != null)
75077678 {
7508
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7679
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
75097680 } else
75107681 {
7511
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7682
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
75127683 } // + super.toString();
75137684 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7685
+
7686
+ if (!Globals.ADVANCED)
7687
+ return objname;
7688
+
7689
+ return objname + " " + System.identityHashCode(this);
75147690 }
75157691
75167692 public int hashCode()
....@@ -7566,6 +7742,7 @@
75667742 objectUI.closeUI();
75677743 if (editWindow != null)
75687744 {
7745
+ editWindow.ctrlPanel.FlushUI();
75697746 editWindow.refreshContents();
75707747 } // ? new
75717748 objectUI = null;
....@@ -7586,7 +7763,7 @@
75867763 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
75877764
75887765 Object3D /*Composite*/ parent;
7589
- Object3D /*Composite*/ fileparent;
7766
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
75907767
75917768 double[][] toParent; // dynamic matrix
75927769 double[][] fromParent;
....@@ -7701,7 +7878,7 @@
77017878 {
77027879 assert(bRep != null);
77037880 if (!(support instanceof GenericJoint)) // support.bRep != null)
7704
- GrafreeD.Assert(support.bRep == bRep.support);
7881
+ Grafreed.Assert(support.bRep == bRep.support);
77057882 }
77067883 else
77077884 {
....@@ -7750,9 +7927,9 @@
77507927 private static cVector edge2 = new cVector();
77517928 //private static cVector norm = new cVector();
77527929 /*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;
7930
+ static final int hitCenter = 1;
7931
+ static final int hitScale = 2;
7932
+ static final int hitRotate = 3;
77567933 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
77577934 /*transient*/ private Point centerPt;
77587935 /*transient*/ private int startX;