Normand Briere
2019-06-11 d0dc7ff35d71919d503ae35592478b173cf3cfd3
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,13 +14,30 @@
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;
2124
25
+ private UUID uuid = UUID.randomUUID();
26
+
2227 ScriptNode scriptnode;
28
+
29
+ void InitOthers()
30
+ {
31
+ if (projectedVertices == null || projectedVertices.length <= 2)
32
+ {
33
+ projectedVertices = new Object3D.cVector2[3];
34
+ }
35
+ for (int i = 0; i < 3; i++)
36
+ {
37
+ projectedVertices[i] = new cVector2(); // Others
38
+ }
39
+ projectedVertices[0].x = 100; // bump
40
+ }
2341
2442 void MinMax(cVector minima, cVector maxima)
2543 {
....@@ -142,6 +160,59 @@
142160 blockloop = true;
143161 child.RestoreSupports();
144162 blockloop = false;
163
+ }
164
+}
165
+
166
+void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
167
+{
168
+ if (hashtable.containsKey(GetUUID()))
169
+ return;
170
+
171
+ Object3D o = new Object3D();
172
+ o.bRep = this.bRep;
173
+ if (this.bRep != null)
174
+ {
175
+ o.transientrep = this.bRep.support;
176
+ o.bRep.support = null;
177
+ }
178
+
179
+// o.support = this.support;
180
+// o.fileparent = this.fileparent;
181
+// if (this.bRep != null)
182
+// o.bRep = this.bRep.support;
183
+
184
+ hashtable.put(GetUUID(), o);
185
+
186
+ this.bRep = null;
187
+// if (this.bRep != null)
188
+// this.bRep.support = null;
189
+// this.support = null;
190
+// this.fileparent = null;
191
+
192
+ for (int i=0; i<Size(); i++)
193
+ {
194
+ get(i).ExtractBigData(hashtable);
195
+ }
196
+}
197
+
198
+void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
199
+{
200
+ if (!hashtable.containsKey(GetUUID()))
201
+ return;
202
+
203
+ Object3D o = hashtable.get(GetUUID());
204
+
205
+ this.bRep = o.bRep;
206
+ if (this.bRep != null)
207
+ this.bRep.support = o.transientrep;
208
+// this.support = o.support;
209
+// this.fileparent = o.fileparent;
210
+
211
+ hashtable.remove(GetUUID());
212
+
213
+ for (int i=0; i<Size(); i++)
214
+ {
215
+ get(i).RestoreBigData(hashtable);
145216 }
146217 }
147218
....@@ -285,8 +356,8 @@
285356 return parent.GetName() + "#";
286357 }
287358
288
- boolean timeline = false;
289359 boolean live = false;
360
+ boolean dontselect = false;
290361 boolean hide = false;
291362 boolean link2master = false; // performs reset support/master at each frame
292363 boolean marked = false; // animation node
....@@ -296,6 +367,8 @@
296367 boolean random = false;
297368 boolean speedup = false;
298369 boolean rewind = false;
370
+
371
+ float NORMALPUSH = 0;
299372
300373 Object3D support;
301374
....@@ -416,16 +489,16 @@
416489 {
417490 Object3D copy = this;
418491
419
- Camera parentcam = CameraPane.theRenderer.manipCamera;
492
+ Camera parentcam = Globals.theRenderer.ManipCamera();
420493
421
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
494
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
422495 {
423
- parentcam = CameraPane.theRenderer.cameras[1];
496
+ parentcam = Globals.theRenderer.Cameras()[1];
424497 }
425498
426
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
499
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
427500 {
428
- parentcam = CameraPane.theRenderer.cameras[0];
501
+ parentcam = Globals.theRenderer.Cameras()[0];
429502 }
430503
431504 if (this == parentcam)
....@@ -433,7 +506,7 @@
433506 //assert(this instanceof Camera);
434507
435508 for (int count = parentcam.GetTransformCount(); --count>=0;)
436
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
509
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
437510 }
438511
439512 copy.marked ^= true;
....@@ -453,7 +526,7 @@
453526 //assert(this instanceof Camera);
454527
455528 for (int count = parentcam.GetTransformCount(); --count>=0;)
456
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
529
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
457530 }
458531
459532 copy.Touch(); // display list issue
....@@ -588,7 +661,7 @@
588661 return;
589662 }
590663
591
- if (CameraPane.fromscript)
664
+ if (Globals.fromscript)
592665 {
593666 transformcount = 0;
594667 return;
....@@ -746,7 +819,7 @@
746819
747820 int GetTransformCount()
748821 {
749
- // marde pour serialization de Texture
822
+ // patch pour serialization de Texture
750823 resetmaxcount();
751824 resettransformcount();
752825 resetstep();
....@@ -759,7 +832,7 @@
759832 if (step == 0)
760833 step = 1;
761834 if (maxcount == 0)
762
- maxcount = 2048; // 4;
835
+ maxcount = 128; // 2048; // 4;
763836 // if (acceleration == 0)
764837 // acceleration = 10;
765838 if (delay == 0) // serial
....@@ -780,9 +853,12 @@
780853 // factor = CameraPane.STEP;
781854 // }
782855
783
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
856
+ if (marked && Globals.isLIVE() && live &&
857
+ //TEMP21aug2018
858
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
859
+ currentframe != Globals.framecount)
784860 {
785
- currentframe = CameraPane.framecount;
861
+ currentframe = Globals.framecount;
786862
787863 // System.err.println("transformcount = " + transformcount);
788864 // System.err.println("factor = " + factor);
....@@ -894,6 +970,11 @@
894970 fromParent = null; // LA.newMatrix();
895971 bRep = null; // new BoundaryRep();
896972
973
+ if (oname != null && oname.equals("LeftHand"))
974
+ {
975
+ name = oname;
976
+ }
977
+
897978 /*
898979 float hue = (float)Math.random();
899980 Color col;
....@@ -936,7 +1017,7 @@
9361017
9371018 public Object clone()
9381019 {
939
- return GrafreeD.clone(this);
1020
+ return Grafreed.clone(this);
9401021 }
9411022
9421023 Object3D copyExpand()
....@@ -1452,7 +1533,7 @@
14521533 BoundaryRep.SEUIL = other.material.cameralight;
14531534
14541535 // Set default to 0.1
1455
- BoundaryRep.SEUIL /= 2;
1536
+ BoundaryRep.SEUIL /= 4; // 2;
14561537 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14571538 }
14581539
....@@ -1711,7 +1792,7 @@
17111792 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17121793 o.bRep = transientrep;
17131794 if (clone)
1714
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1795
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17151796 o.CreateMaterial();
17161797 o.SetAttributes(this, -1);
17171798 //parent
....@@ -1724,7 +1805,7 @@
17241805 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17251806 o.bRep = bRep;
17261807 if (clone)
1727
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1808
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17281809 o.CreateMaterial();
17291810 //o.overwriteThis(this, -1);
17301811 o.SetAttributes(this, -1);
....@@ -1811,12 +1892,15 @@
18111892 if (obj.name == null)
18121893 continue; // can't be a null one
18131894
1895
+ // Try perfect match first.
18141896 if (n.equals(obj.name))
18151897 {
18161898 theobj = obj;
18171899 count++;
18181900 }
18191901 }
1902
+
1903
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18201904
18211905 if (count != 1)
18221906 for (int i=Size(); --i>=0;)
....@@ -2131,15 +2215,8 @@
21312215 if (/*parent != null &&*/ material == null)
21322216 {
21332217 material = new cMaterial(GetMaterial());
2134
- if (projectedVertices == null || projectedVertices.length <= 2)
2135
- {
2136
- projectedVertices = new Object3D.cVector2[3];
2137
- }
2138
- for (int i = 0; i < 3; i++)
2139
- {
2140
- projectedVertices[i] = new cVector2(); // Others
2141
- }
2142
- projectedVertices[0].x = 100; // bump
2218
+
2219
+ InitOthers();
21432220
21442221 if (this instanceof Camera)
21452222 {
....@@ -2289,6 +2366,7 @@
22892366 {
22902367 if (newWindow)
22912368 {
2369
+ new Exception().printStackTrace();
22922370 System.exit(0);
22932371 if (parent != null)
22942372 {
....@@ -2465,13 +2543,13 @@
24652543 return retval;
24662544 }
24672545
2468
- void doEditDrag(ClickInfo info)
2546
+ void doEditDrag(ClickInfo info, boolean opposite)
24692547 {
24702548 switch (doSomething)
24712549 {
24722550 case 1: // '\001'
24732551 //super.
2474
- doEditDrag0(info);
2552
+ doEditDrag0(info, opposite);
24752553 break;
24762554
24772555 case 2: // '\002'
....@@ -2484,11 +2562,11 @@
24842562 {
24852563 //sel.hitSomething = childToDrag.hitSomething;
24862564 //childToDrag.doEditDrag(info);
2487
- sel.doEditDrag(info);
2565
+ sel.doEditDrag(info, opposite);
24882566 } else
24892567 {
24902568 //super.
2491
- doEditDrag0(info);
2569
+ doEditDrag0(info, opposite);
24922570 }
24932571 }
24942572 break;
....@@ -2895,7 +2973,8 @@
28952973 {
28962974 if (bRep != null)
28972975 {
2898
- bRep.GenUV();
2976
+ bRep.GenUV(); //1);
2977
+ //bRep.UnfoldUV();
28992978 Touch();
29002979 }
29012980 }
....@@ -2970,6 +3049,33 @@
29703049 blockloop = false;
29713050 }
29723051
3052
+ void TransformChildren()
3053
+ {
3054
+ if (toParent != null)
3055
+ {
3056
+ for (int i=Size(); --i>=0;)
3057
+ {
3058
+ Object3D v = get(i);
3059
+
3060
+ if (v.toParent == null)
3061
+ {
3062
+ v.toParent = LA.newMatrix();
3063
+ v.fromParent = LA.newMatrix();
3064
+ }
3065
+
3066
+// LA.matConcat(v.toParent, toParent, v.toParent);
3067
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3068
+ LA.matConcat(toParent, v.toParent, v.toParent);
3069
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3070
+ }
3071
+
3072
+ toParent = null; // LA.matIdentity(toParent);
3073
+ fromParent = null; // LA.matIdentity(fromParent);
3074
+
3075
+ Touch();
3076
+ }
3077
+ }
3078
+
29733079 void TransformGeometry()
29743080 {
29753081 Object3D obj = this;
....@@ -3191,9 +3297,11 @@
31913297
31923298 BoundaryRep sup = bRep.support;
31933299 bRep.support = null;
3194
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3300
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
31953301 // bRep.SplitInTwo(onlyone); // thread...
3196
- temprep.SplitInTwo(reduction34, onlyone);
3302
+
3303
+ while(temprep.SplitInTwo(reduction34, onlyone));
3304
+
31973305 bRep = temprep;
31983306 bRep.support = sup;
31993307 Touch();
....@@ -3715,7 +3823,7 @@
37153823 if (child == null)
37163824 continue;
37173825
3718
- if (GrafreeD.RENDERME > 0)
3826
+ if (Grafreed.RENDERME > 0)
37193827 {
37203828 if (child instanceof Merge)
37213829 ((Merge)child).renderme();
....@@ -3866,7 +3974,7 @@
38663974 if (child == null)
38673975 continue;
38683976
3869
- if (GrafreeD.RENDERME > 0)
3977
+ if (Grafreed.RENDERME > 0)
38703978 {
38713979 if (child instanceof Merge)
38723980 ((Merge)child).renderme();
....@@ -4061,7 +4169,7 @@
40614169 if (child == null)
40624170 continue;
40634171
4064
- if (GrafreeD.RENDERME > 0)
4172
+ if (Grafreed.RENDERME > 0)
40654173 {
40664174 if (child instanceof Merge)
40674175 ((Merge)child).renderme();
....@@ -4158,6 +4266,22 @@
41584266 }
41594267 blockloop = true;
41604268 get(i).RepairParent();
4269
+ blockloop = false;
4270
+ }
4271
+ }
4272
+
4273
+ void RepairShadow()
4274
+ {
4275
+ if (blockloop)
4276
+ return;
4277
+
4278
+ if (this.material != null)
4279
+ this.InitOthers();
4280
+
4281
+ for (int i=0; i<Size(); i++)
4282
+ {
4283
+ blockloop = true;
4284
+ get(i).RepairShadow();
41614285 blockloop = false;
41624286 }
41634287 }
....@@ -4652,7 +4776,7 @@
46524776
46534777 cTreePath SelectLeaf(int indexcount, boolean deselect)
46544778 {
4655
- if (hide)
4779
+ if (hide || dontselect)
46564780 return null;
46574781
46584782 if (count <= 0)
....@@ -4678,7 +4802,7 @@
46784802
46794803 cTreePath Select(int indexcount, boolean deselect)
46804804 {
4681
- if (hide)
4805
+ if (hide || dontselect)
46824806 return null;
46834807
46844808 if (count <= 0)
....@@ -4828,7 +4952,7 @@
48284952 return globalTransform;
48294953 }
48304954
4831
- void PreprocessOcclusion(CameraPane cp)
4955
+ void PreprocessOcclusion(iCameraPane cp)
48324956 {
48334957 /*
48344958 if (AOdone)
....@@ -4975,7 +5099,8 @@
49755099 } else //
49765100 if (editWindow != null)
49775101 {
4978
- editWindow.cameraView.lighttouched = true;
5102
+ //editWindow.cameraView.lighttouched = true;
5103
+ Globals.lighttouched = true;
49795104 }
49805105 }
49815106
....@@ -5129,10 +5254,34 @@
51295254
51305255 // System.out.println("Fullname = " + fullname);
51315256
5132
- if (fullname.name.indexOf(":") == -1)
5133
- return fullname.name;
5257
+ // Does not work on Windows due to C:
5258
+// if (fullname.name.indexOf(":") == -1)
5259
+// return fullname.name;
5260
+//
5261
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51345262
5135
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5263
+ String[] split = fullname.name.split(":");
5264
+
5265
+ if (split.length == 0)
5266
+ {
5267
+ return "";
5268
+ }
5269
+
5270
+ if (split.length <= 2)
5271
+ {
5272
+ if (fullname.name.endsWith(":"))
5273
+ {
5274
+ // Windows
5275
+ return fullname.name.substring(0, fullname.name.length()-1);
5276
+ }
5277
+
5278
+ return split[0];
5279
+ }
5280
+
5281
+ // Windows
5282
+ assert(split.length == 4);
5283
+
5284
+ return split[0] + ":" + split[1];
51365285 }
51375286
51385287 static String GetBump(cTexture fullname)
....@@ -5141,10 +5290,38 @@
51415290 return "";
51425291
51435292 // System.out.println("Fullname = " + fullname);
5144
- if (fullname.name.indexOf(":") == -1)
5145
- return "";
5146
-
5147
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5293
+ // Does not work on Windows due to C:
5294
+// if (fullname.name.indexOf(":") == -1)
5295
+// return "";
5296
+//
5297
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5298
+ String[] split = fullname.name.split(":");
5299
+
5300
+ if (split.length == 0)
5301
+ {
5302
+ return "";
5303
+ }
5304
+
5305
+ if (split.length == 1)
5306
+ {
5307
+ return "";
5308
+ }
5309
+
5310
+ if (split.length == 2)
5311
+ {
5312
+ if (fullname.name.endsWith(":"))
5313
+ {
5314
+ // Windows
5315
+ return "";
5316
+ }
5317
+
5318
+ return split[1];
5319
+ }
5320
+
5321
+ // Windows
5322
+ assert(split.length == 4);
5323
+
5324
+ return split[2] + ":" + split[3];
51485325 }
51495326
51505327 String GetPigmentTexture()
....@@ -5218,7 +5395,7 @@
52185395 System.out.print("; textures = " + textures);
52195396 System.out.println("; usedtextures = " + usedtextures);
52205397
5221
- if (GetTextures() == null)
5398
+ if (GetTextures() == null) // What is that??
52225399 GetTextures().name = ":";
52235400
52245401 String texname = tex;
....@@ -5249,6 +5426,43 @@
52495426 child.ResetPigmentTexture();
52505427 blockloop = false;
52515428 }
5429
+ }
5430
+
5431
+ UUID GetUUID()
5432
+ {
5433
+ if (uuid == null)
5434
+ {
5435
+ // Serial
5436
+ uuid = UUID.randomUUID();
5437
+ }
5438
+
5439
+ return uuid;
5440
+ }
5441
+
5442
+ Object3D GetObject(UUID uid)
5443
+ {
5444
+ if (blockloop)
5445
+ return null;
5446
+
5447
+ if (GetUUID().equals(uid))
5448
+ return this;
5449
+
5450
+ int nb = Size();
5451
+ for (int i = 0; i < nb; i++)
5452
+ {
5453
+ Object3D child = (Object3D) get(i);
5454
+
5455
+ if (child == null)
5456
+ continue;
5457
+
5458
+ blockloop = true;
5459
+ Object3D obj = child.GetObject(uid);
5460
+ blockloop = false;
5461
+ if (obj != null)
5462
+ return obj;
5463
+ }
5464
+
5465
+ return null;
52525466 }
52535467
52545468 void SetBumpTexture(String tex)
....@@ -5287,25 +5501,22 @@
52875501 }
52885502 }
52895503
5290
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5504
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52915505 {
52925506 Draw(display, root, selected, blocked);
52935507 }
52945508
5295
- static cMaterial[] materialstack = new cMaterial[65536];
5296
- static boolean[] selectedstack = new boolean[65536];
5297
- static int materialdepth = 0;
5298
-
52995509 boolean NeedSupport()
53005510 {
53015511 return
5302
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5512
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
53035513 // PROBLEM with CROWD!!
5304
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5514
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53055515 }
53065516
5517
+ static boolean DEBUG_SELECTION = false;
53075518
5308
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5519
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53095520 {
53105521 Invariants(); // june 2013
53115522
....@@ -5314,8 +5525,8 @@
53145525 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
53155526 }
53165527
5317
- if (display.drawMode == CameraPane.SELECTION &&
5318
- hide)
5528
+ if (display.DrawMode() == iCameraPane.SELECTION &&
5529
+ (hide || dontselect))
53195530 return;
53205531
53215532 if (name != null && name.contains("sclera"))
....@@ -5333,7 +5544,7 @@
53335544 if (this instanceof Checker)
53345545 return;
53355546
5336
- if (display.drawMode == display.SHADOW && PASSTEST)
5547
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
53375548 return;
53385549
53395550 if (count <= 0)
....@@ -5341,13 +5552,13 @@
53415552 return;
53425553 }
53435554
5344
- if ((//display.drawMode == CameraPane.SHADOW ||
5345
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5555
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5556
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53465557 {
53475558 return;
53485559 }
53495560
5350
- javax.media.opengl.GL gl = display.GetGL();
5561
+ //javax.media.opengl.GL gl = display.GetGL();
53515562
53525563 /*
53535564 if (touched)
....@@ -5383,15 +5594,15 @@
53835594
53845595 boolean compiled = false;
53855596
5386
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5597
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53875598
5388
- if (!selectmode && //display.drawMode != display.SELECTION &&
5599
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53895600 (touched || (bRep != null && bRep.displaylist <= 0)))
53905601 {
5391
- display.lighttouched = true;
5602
+ Globals.lighttouched = true;
53925603 } // all panes...
5393
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5394
- if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&
5604
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5605
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53955606 (touched || (bRep != null && bRep.displaylist <= 0)))
53965607 {
53975608 if (!(this instanceof Composite))
....@@ -5399,7 +5610,7 @@
53995610 //if (displaylist == -1 && usecalllists)
54005611 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54015612 {
5402
- bRep.displaylist = gl.glGenLists(1);
5613
+ bRep.displaylist = display.GenList();
54035614 assert(bRep.displaylist != 0);
54045615 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54055616 //System.out.println("\tgen list " + list);
....@@ -5411,18 +5622,20 @@
54115622 if (usecalllists)
54125623 {
54135624 // System.err.println("new list " + bRep.displaylist + " for " + this);
5414
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5625
+ display.NewList(bRep.displaylist);
54155626 }
5627
+
54165628 CallList(display, root, selected, blocked);
5629
+
54175630 // compiled = true;
54185631 if (usecalllists)
54195632 {
54205633 // System.err.println("end list " + bRep.displaylist + " for " + this);
5421
- gl.glEndList();
5634
+ display.EndList();
54225635 }
54235636 //gl.glDrawBuffer(gl.GL_BACK);
54245637 // XXX touched = false;
5425
- display.lighttouched = true; // all panes...
5638
+ Globals.lighttouched = true; // all panes...
54265639 }
54275640
54285641 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5461,12 +5674,12 @@
54615674
54625675 // frustum culling
54635676 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5464
- && display.drawMode != CameraPane.SELECTION)
5677
+ && display.DrawMode() != iCameraPane.SELECTION)
54655678 {
5466
- if (display.drawMode == CameraPane.SHADOW)
5679
+ if (display.DrawMode() == iCameraPane.SHADOW)
54675680 {
54685681 if (!link2master // tricky to cull in shadow mode.
5469
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5682
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54705683 {
54715684 //System.out.print("CULLED");
54725685 culled = true;
....@@ -5474,7 +5687,7 @@
54745687 }
54755688 else
54765689 //GetBRep().getBounds(v0, v1, this);
5477
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5690
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54785691 culled = true;
54795692
54805693 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5510,11 +5723,11 @@
55105723
55115724
55125725 if (!culled)
5513
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5726
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55145727 {
55155728 if (GetBRep() != null)
55165729 {
5517
- CameraPane.NextIndex(this, gl);
5730
+ display.NextIndex();
55185731 // vertex color conflict : gl.glCallList(list);
55195732 DrawNode(display, root, selected);
55205733 if (this instanceof BezierPatch)
....@@ -5536,55 +5749,7 @@
55365749 color[2] /= 2;
55375750 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55385751 */
5539
- if (material != null)
5540
- {
5541
- materialstack[materialdepth] = material;
5542
- selectedstack[materialdepth] = selected;
5543
- cStatic.objectstack[materialdepth++] = this;
5544
- //System.out.println("material " + material);
5545
- //Applet3D.tracein(this, selected);
5546
- display.vector2buffer = projectedVertices;
5547
- if (this instanceof Camera)
5548
- {
5549
- display.options1[0] = material.shift;
5550
- //System.out.println("shift " + material.shift);
5551
- display.options1[1] = material.lightarea;
5552
- display.options1[2] = material.shadowbias;
5553
- display.options1[3] = material.aniso;
5554
- display.options1[4] = material.anisoV;
5555
- display.options2[0] = material.opacity;
5556
- display.options2[1] = material.diffuse;
5557
- display.options2[2] = material.factor;
5558
-
5559
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5560
- display.options4[0] = material.cameralight/0.2f;
5561
- display.options4[1] = material.subsurface;
5562
- display.options4[2] = material.sheen;
5563
-
5564
- // if (display.CURRENTANTIALIAS > 0)
5565
- // display.options3[3] /= 4;
5566
-
5567
- /*
5568
- System.out.println("Focus = " + display.options1[0]);
5569
- System.out.println("Aperture = " + display.options1[1]);
5570
- System.out.println("ShadowBlur = " + display.options1[2]);
5571
- System.out.println("Antialiasing = " + display.options1[3]);
5572
- System.out.println("Fog = " + display.options2[0]);
5573
- System.out.println("Intensity = " + display.options2[1]);
5574
- System.out.println("Elevation = " + display.options2[2]);
5575
- /**/
5576
- } else
5577
- {
5578
- material.Draw(display, selected);
5579
- }
5580
- } else
5581
- {
5582
- if (selected && CameraPane.flash)
5583
- {
5584
- display.modelParams4[1] = 100;
5585
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5586
- }
5587
- }
5752
+ display.PushMaterial(this, selected);
55885753
55895754 //System.out.println("call list " + list);
55905755 //System.out.println();
....@@ -5603,7 +5768,17 @@
56035768 tex = GetTextures();
56045769 }
56055770
5606
- display.BindTextures(tex, texres);
5771
+ boolean failed = false;
5772
+
5773
+ try
5774
+ {
5775
+ display.BindTextures(tex, texres);
5776
+ }
5777
+ catch (Exception e)
5778
+ {
5779
+ System.err.println("FAILED: " + this);
5780
+ failed = true;
5781
+ }
56075782
56085783 if (!compiled)
56095784 {
....@@ -5619,30 +5794,16 @@
56195794
56205795 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
56215796 assert(bRep.displaylist != 0);
5622
- gl.glCallList(bRep.displaylist);
5797
+ display.CallList(bRep.displaylist);
56235798 // june 2013 drawSelf(display, root, selected);
56245799 }
56255800 }
56265801 }
56275802
5628
- display.ReleaseTextures(tex);
5629
-
5630
- //if (parent != null && parent.GetMaterial() != null)
5631
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5632
- if (material != null)
5633
- {
5634
- materialdepth -= 1;
5635
- if (materialdepth > 0)
5636
- {
5637
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5638
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5639
- }
5640
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5641
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5642
- {
5643
- display.modelParams4[1] = GetMaterial().cameralight;
5644
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5645
- }
5803
+ if (!failed)
5804
+ display.ReleaseTextures(tex);
5805
+
5806
+ display.PopMaterial(this, selected);
56465807 }
56475808
56485809 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5684,7 +5845,7 @@
56845845 // resetMasterNode();
56855846 }
56865847
5687
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5848
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56885849 {
56895850 if (GetBRep() == null)
56905851 {
....@@ -5767,8 +5928,11 @@
57675928 boolean flipV = false; // true;
57685929 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57695930
5770
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5931
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57715932 {
5933
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5934
+ return;
5935
+
57725936 if (hide)
57735937 return;
57745938 // shadow optimisation
....@@ -5826,16 +5990,7 @@
58265990 // // ??????????????????????????? Touch();
58275991 // }
58285992
5829
- if (material != null)
5830
- {
5831
- materialstack[materialdepth] = material;
5832
- selectedstack[materialdepth] = selected;
5833
- cStatic.objectstack[materialdepth++] = this;
5834
- //System.out.println("material " + material);
5835
- //Applet3D.tracein("selected ", selected);
5836
- display.vector2buffer = projectedVertices;
5837
- material.Draw(display, selected);
5838
- }
5993
+display.PushMaterial2(this, selected);
58395994
58405995 Object3D child;
58415996 boolean sel;
....@@ -5887,19 +6042,7 @@
58876042 */
58886043 //depth += 1;
58896044
5890
- if (material != null)
5891
- {
5892
- materialdepth -= 1;
5893
- if (materialdepth > 0)
5894
- {
5895
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5896
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5897
- }
5898
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5899
- //else
5900
- //material.Draw(display, false);
5901
- }
5902
-
6045
+display.PopMaterial2(this);
59036046 /*
59046047 display.ReleaseTextures(tex);
59056048 */
....@@ -5910,10 +6053,13 @@
59106053
59116054 //static cVector min,max;
59126055
5913
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
6056
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
59146057 {
5915
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
6058
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59166059 return; // no shadow for transparent objects
6060
+
6061
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6062
+ return;
59176063
59186064 if (hide)
59196065 return;
....@@ -5955,11 +6101,12 @@
59556101 return;
59566102 }
59576103
6104
+ //bRep.GenUV(1/material.diffuseness);
59586105 // bRep.lock = true;
59596106
5960
- javax.media.opengl.GL gl = display.GetGL();
6107
+ //javax.media.opengl.GL gl = display.GetGL();
59616108
5962
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
6109
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59636110 {
59646111 int fc = bRep.FaceCount();
59656112 int vc = bRep.VertexCount();
....@@ -5974,23 +6121,7 @@
59746121
59756122 bRep.getMinMax(min, max, 100);
59766123
5977
- gl.glBegin(gl.GL_LINES);
5978
-
5979
- gl.glVertex3d(min.x, min.y, min.z);
5980
- gl.glVertex3d(min.x, min.y, max.z);
5981
- gl.glVertex3d(min.x, min.y, min.z);
5982
- gl.glVertex3d(min.x, max.y, min.z);
5983
- gl.glVertex3d(min.x, min.y, min.z);
5984
- gl.glVertex3d(max.x, min.y, min.z);
5985
-
5986
- gl.glVertex3d(max.x, max.y, max.z);
5987
- gl.glVertex3d(min.x, max.y, max.z);
5988
- gl.glVertex3d(max.x, max.y, max.z);
5989
- gl.glVertex3d(max.x, min.y, max.z);
5990
- gl.glVertex3d(max.x, max.y, max.z);
5991
- gl.glVertex3d(max.x, max.y, min.z);
5992
-
5993
- gl.glEnd();
6124
+ display.DrawBox(min, max);
59946125
59956126 return;
59966127 }
....@@ -6034,7 +6165,7 @@
60346165 {
60356166 //throw new Error();
60366167
6037
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6168
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
60386169
60396170 int[] strips = bRep.getRawIndices();
60406171
....@@ -6044,178 +6175,14 @@
60446175 new Exception().printStackTrace();
60456176 return;
60466177 }
6047
-
6048
- // TRIANGLE STRIP ARRAY
6049
- if (bRep.trimmed)
6050
- {
6051
- float[] v = bRep.getRawVertices();
6052
- float[] n = bRep.getRawNormals();
6053
- float[] c = bRep.getRawColors();
6054
- float[] uv = bRep.getRawUVMap();
6055
-
6056
- int count2 = 0;
6057
- int count3 = 0;
6058
-
6059
- if (n.length > 0)
6060
- {
6061
- for (int i = 0; i < strips.length; i++)
6062
- {
6063
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6064
-
6065
- /*
6066
- boolean locked = false;
6067
- float eps = 0.1f;
6068
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6069
-
6070
- int dot = 0;
6071
-
6072
- if ((dot&1) == 0)
6073
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6074
-
6075
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6076
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6077
- else
6078
- {
6079
- locked = true;
6080
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6081
- }
6082
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6083
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6084
- if (hasnorm)
6085
- {
6086
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6087
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6088
- }
6089
-
6090
- if ((dot&4) == 0)
6091
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6092
-
6093
- if (wrap || !locked && (dot&8) != 0)
6094
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6095
- else
6096
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6097
-
6098
- f.dot = dot;
6099
- */
6100
-
6101
- if (!selectmode)
6102
- {
6103
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6104
- {
6105
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6106
- } else
6107
- {
6108
- gl.glNormal3f(0, 0, 1);
6109
- }
6110
-
6111
- if (c != null)
6112
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6113
- {
6114
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6115
- }
6116
- }
6117
- if (flipV)
6118
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6119
- else
6120
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6121
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6122
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6123
-
6124
- count2 += 2;
6125
- count3 += 3;
6126
- if (!selectmode)
6127
- {
6128
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6129
- {
6130
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6131
- } else
6132
- {
6133
- gl.glNormal3f(0, 0, 1);
6134
- }
6135
- if (c != null)
6136
- {
6137
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6138
- }
6139
- }
6140
- if (flipV)
6141
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6142
- else
6143
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6144
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6145
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6146
-
6147
- count2 += 2;
6148
- count3 += 3;
6149
- for (int j = 0; j < strips[i] - 2; j++)
6150
- {
6151
- //gl.glTexCoord2d(...);
6152
- if (!selectmode)
6153
- {
6154
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6155
- {
6156
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6157
- } else
6158
- {
6159
- gl.glNormal3f(0, 0, 1);
6160
- }
6161
- if (c != null)
6162
- {
6163
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6164
- }
6165
- }
6166
-
6167
- if (flipV)
6168
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6169
- else
6170
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6171
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6172
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6173
- count2 += 2;
6174
- count3 += 3;
6175
- }
6176
-
6177
- gl.glEnd();
6178
- }
6179
- }
6180
-
6181
- assert count3 == v.length;
6182
- }
6183
- else // !trimmed
6184
- {
6185
- int count = 0;
6186
- for (int i = 0; i < strips.length; i++)
6187
- {
6188
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6189
-
6190
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6191
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6192
-
6193
- drawVertex(gl, p, selectmode);
6194
- drawVertex(gl, q, selectmode);
6195
-
6196
- for (int j = 0; j < strips[i] - 2; j++)
6197
- {
6198
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6199
-
6200
-// if (j%2 == 0)
6201
-// drawFace(p, q, r, display, null);
6202
-// else
6203
-// drawFace(p, r, q, display, null);
6204
-
6205
-// p = q;
6206
-// q = r;
6207
- drawVertex(gl, r, selectmode);
6208
- }
6209
-
6210
- gl.glEnd();
6211
- }
6212
- }
6178
+
6179
+ display.DrawGeometry(bRep, flipV, selectmode);
62136180 } else // catch (Error e)
62146181 {
62156182 // TRIANGLE ARRAY
62166183 if (IsOpaque()) // Static())
62176184 {
6218
- gl.glBegin(gl.GL_TRIANGLES);
6185
+ display.StartTriangles();
62196186 int facecount = bRep.FaceCount();
62206187 for (int i = 0; i < facecount; i++)
62216188 {
....@@ -6278,9 +6245,9 @@
62786245 // // r.norm.dot(v3) > -0.5)
62796246 // // continue;
62806247
6281
- drawFace(p, q, r, display, face);
6248
+ display.DrawFace(this, p, q, r, face);
62826249 }
6283
- gl.glEnd();
6250
+ display.EndTriangles();
62846251 }
62856252 else
62866253 {
....@@ -6309,8 +6276,8 @@
63096276 //System.out.println("SORT");
63106277
63116278 java.util.Arrays.sort(facescompare);
6312
-
6313
- gl.glBegin(gl.GL_TRIANGLES);
6279
+
6280
+ display.StartTriangles();
63146281 for (int i = 0; i < facecount; i++)
63156282 {
63166283 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6322,13 +6289,14 @@
63226289 Vertex q = bRep.GetVertex(face.q);
63236290 Vertex r = bRep.GetVertex(face.r);
63246291
6325
- drawFace(p, q, r, display, face);
6292
+ display.DrawFace(this, p, q, r, face);
63266293 }
6327
- gl.glEnd();
6294
+ display.EndTriangles();
63286295 }
63296296
63306297 if (false) // live && support != null && support.bRep != null) // debug weights
63316298 {
6299
+ /*
63326300 gl.glDisable(gl.GL_LIGHTING);
63336301 float[] colorV = new float[3];
63346302
....@@ -6407,6 +6375,7 @@
64076375 // gl.glEnd();
64086376 }
64096377 }
6378
+ */
64106379 }
64116380 }
64126381
....@@ -6451,7 +6420,7 @@
64516420 center.add(r);
64526421 center.mul(1.0/3);
64536422
6454
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6423
+ center.sub(Globals.theRenderer.EyeCamera().location);
64556424
64566425 distance = center.dot(center);
64576426 }
....@@ -6462,347 +6431,11 @@
64626431
64636432 transient FaceCompare[] facescompare = null;
64646433
6465
- void SetColor(CameraPane display, Vertex p0)
6466
- {
6467
- if (display.RENDERPROGRAM == 0)
6468
- {
6469
- float r = 0;
6470
- if (bRep != null)
6471
- {
6472
- if (bRep.stripified)
6473
- {
6474
- r = 1;
6475
- }
6476
- }
6477
- float g = 0;
6478
- if (bRep != null)
6479
- {
6480
- if (bRep.trimmed)
6481
- {
6482
- g = 1;
6483
- }
6484
- }
6485
- float b = 0;
6486
- if (support != null && link2master)
6487
- {
6488
- b = 1;
6489
- }
6490
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6491
- return;
6492
- }
6493
-
6494
- if (display.drawMode != CameraPane.SHADOW)
6495
- return;
6496
-
6497
- javax.media.opengl.GL gl = display.GetGL();
6498
-// if (true) return;
6499
-// float ao = p.AO;
6500
-//
6501
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6502
-// // ao = 1;
6503
-//
6504
-// gl.glColor4f(ao, ao, ao, 1);
6505
-
6506
-// CameraPane.selectedpoint.
6507
-// getAverage(cStatic.point1, true);
6508
- if (CameraPane.pointflow == null) // !random) // live)
6509
- {
6510
- return;
6511
- }
6512
-
6513
- cStatic.point1.set(0,0,0);
6514
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6515
-
6516
- cStatic.point1.sub(p0);
6517
-
6518
-
6519
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6520
-// {
6521
-// return;
6522
-// }
6523
-
6524
- //if (true)
6525
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6526
- {
6527
- return;
6528
- }
6529
-
6530
- float[] colorV = new float[3];
6531
-
6532
- if (false) // marked)
6533
- {
6534
- // debug rigging weights
6535
- for (int object = 0; object < p0.vertexlinks.length; object++)
6536
- {
6537
- float weight = p0.weights[object] / p0.totalweight;
6538
-
6539
- // if (weight < 0.1)
6540
- // {
6541
- // assert(weight == 0);
6542
- // continue;
6543
- // }
6544
-
6545
- if (p0.vertexlinks[object] == -1)
6546
- continue;
6547
-
6548
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6549
-
6550
- int color = //1 << object; //
6551
- //p.vertexlinks.length;
6552
- support.bRep.supports[p0.closestsupport].links[object];
6553
- colorV[2] += (color & 1) * weight;
6554
- colorV[1] += ((color & 2) >> 1) * weight;
6555
- colorV[0] += ((color & 4) >> 2) * weight;
6556
- }
6557
- }
6558
- else
6559
- {
6560
- if (drawingstarted)
6561
- {
6562
- // find next point
6563
- if (bRep.GetVertex(0).faceindices == null)
6564
- {
6565
- bRep.InitFaceIndices();
6566
- }
6567
-
6568
- double ymin = p0.y;
6569
-
6570
- Vertex newp = p0;
6571
-
6572
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6573
- {
6574
- int fi = p0.faceindices[fii];
6575
-
6576
- if (fi == -1)
6577
- break;
6578
-
6579
- Face f = bRep.GetFace(fi);
6580
-
6581
- Vertex p = bRep.GetVertex(f.p);
6582
- Vertex q = bRep.GetVertex(f.q);
6583
- Vertex r = bRep.GetVertex(f.r);
6584
-
6585
- int swap = (int)(Math.random()*3);
6586
-
6587
-// for (int s=swap; --s>=0;)
6588
-// {
6589
-// Vertex t = p;
6590
-// p = q;
6591
-// q = r;
6592
-// r = t;
6593
-// }
6594
- if (ymin > p.y)
6595
- {
6596
- ymin = p.y;
6597
- newp = p;
6598
-// break;
6599
- }
6600
- if (ymin > q.y)
6601
- {
6602
- ymin = q.y;
6603
- newp = q;
6604
-// break;
6605
- }
6606
- if (ymin > r.y)
6607
- {
6608
- ymin = r.y;
6609
- newp = r;
6610
-// break;
6611
- }
6612
- }
6613
-
6614
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6615
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6616
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6617
-
6618
- drawingstarted = false;
6619
-
6620
- // return;
6621
- }
6622
-
6623
- if (false) // CameraPane.DRAW
6624
- {
6625
- p0.AO = colorV[0] = 2;
6626
- colorV[1] = 2;
6627
- colorV[2] = 2;
6628
- }
6629
-
6630
- CameraPane.pointflow.add(p0);
6631
- CameraPane.pointflow.Touch();
6632
- }
6633
-
6634
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6635
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6636
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6637
- }
6638
-
66396434 void Print(Vertex v)
66406435 {
66416436 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
66426437 }
66436438
6644
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6645
- {
6646
- if (!selectmode)
6647
- {
6648
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6649
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6650
-
6651
- if (flipV)
6652
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6653
- else
6654
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6655
- }
6656
-
6657
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6658
- }
6659
-
6660
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6661
- CameraPane display, Face face)
6662
- {
6663
- if (pv.y == -10000 ||
6664
- qv.y == -10000 ||
6665
- rv.y == -10000)
6666
- return;
6667
-
6668
-// float b = f.nbiterations & 1;
6669
-// float g = (f.nbiterations>>1) & 1;
6670
-// float r = (f.nbiterations>>2) & 1;
6671
-//
6672
-// //if (f.weight == 10000)
6673
-// //{
6674
-// // r = 1; g = b = 0;
6675
-// //}
6676
-// //else
6677
-// //{
6678
-// // assert(f.weight < 10000);
6679
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6680
-// if (r<0)
6681
-// assert(r>=0);
6682
-// //}
6683
-
6684
- javax.media.opengl.GL gl = display.GetGL();
6685
-
6686
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6687
-
6688
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6689
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6690
- {
6691
- //gl.glBegin(gl.GL_TRIANGLES);
6692
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6693
- if (!hasnorm)
6694
- {
6695
- // System.out.println("FUCK!!");
6696
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6697
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6698
- LA.vecCross(v0, v1, v2);
6699
- LA.vecNormalize(v2);
6700
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6701
- }
6702
-
6703
- if (hasnorm)
6704
- {
6705
-// if (!pv.norm.normalized())
6706
-// assert(pv.norm.normalized());
6707
-
6708
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6709
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6710
- }
6711
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6712
- SetColor(display, pv);
6713
- //gl.glColor4f(r, g, b, 1);
6714
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6715
- if (flipV)
6716
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6717
- else
6718
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6719
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6720
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6721
-// Print(pv);
6722
- if (hasnorm)
6723
- {
6724
-// assert(qv.norm.normalized());
6725
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6726
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6727
- }
6728
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6729
- // boolean locked = false;
6730
- // float eps = 0.1f;
6731
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6732
-
6733
- // int dot = 0; //*/ (int)f.dot;
6734
-
6735
- // if ((dot&1) == 0)
6736
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6737
-
6738
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6739
- if (flipV)
6740
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6741
- else
6742
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6743
- // else
6744
- // {
6745
- // locked = true;
6746
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6747
- // }
6748
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6749
- SetColor(display, qv);
6750
- //gl.glColor4f(r, g, b, 1);
6751
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6752
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6753
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6754
-// Print(qv);
6755
- if (hasnorm)
6756
- {
6757
-// assert(rv.norm.normalized());
6758
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6759
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6760
- }
6761
-
6762
- // if ((dot&4) == 0)
6763
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6764
-
6765
- // if (wrap || !locked && (dot&8) != 0)
6766
- if (flipV)
6767
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6768
- else
6769
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6770
- // else
6771
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6772
-
6773
- // f.dot = dot;
6774
-
6775
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6776
- SetColor(display, rv);
6777
- //gl.glColor4f(r, g, b, 1);
6778
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6779
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6780
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6781
-// Print(rv);
6782
- //gl.glEnd();
6783
- }
6784
- else
6785
- {
6786
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6787
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6788
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6789
-
6790
- }
6791
-
6792
- if (false) // (attributes & WIREFRAME) != 0)
6793
- {
6794
- gl.glDisable(gl.GL_LIGHTING);
6795
-
6796
- gl.glBegin(gl.GL_LINE_LOOP);
6797
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6798
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6799
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6800
- gl.glEnd();
6801
-
6802
- gl.glEnable(gl.GL_LIGHTING);
6803
- }
6804
- }
6805
-
68066439 void drawSelf(ClickInfo info, int level, boolean select)
68076440 {
68086441 if (bRep == null)
....@@ -7374,83 +7007,83 @@
73747007 int spotw = spot.x + spot.width;
73757008 int spoth = spot.y + spot.height;
73767009 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7377
- if (CameraPane.Xmin > spot.x)
7378
- {
7379
- CameraPane.Xmin = spot.x;
7380
- }
7381
- if (CameraPane.Xmax < spotw)
7382
- {
7383
- CameraPane.Xmax = spotw;
7384
- }
7385
- if (CameraPane.Ymin > spot.y)
7386
- {
7387
- CameraPane.Ymin = spot.y;
7388
- }
7389
- if (CameraPane.Ymax < spoth)
7390
- {
7391
- CameraPane.Ymax = spoth;
7392
- }
7010
+// if (CameraPane.Xmin > spot.x)
7011
+// {
7012
+// CameraPane.Xmin = spot.x;
7013
+// }
7014
+// if (CameraPane.Xmax < spotw)
7015
+// {
7016
+// CameraPane.Xmax = spotw;
7017
+// }
7018
+// if (CameraPane.Ymin > spot.y)
7019
+// {
7020
+// CameraPane.Ymin = spot.y;
7021
+// }
7022
+// if (CameraPane.Ymax < spoth)
7023
+// {
7024
+// CameraPane.Ymax = spoth;
7025
+// }
73937026 spot.translate(32, 32);
73947027 spotw = spot.x + spot.width;
73957028 spoth = spot.y + spot.height;
73967029 info.g.setColor(Color.blue);
73977030 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7398
- if (CameraPane.Xmin > spot.x)
7399
- {
7400
- CameraPane.Xmin = spot.x;
7401
- }
7402
- if (CameraPane.Xmax < spotw)
7403
- {
7404
- CameraPane.Xmax = spotw;
7405
- }
7406
- if (CameraPane.Ymin > spot.y)
7407
- {
7408
- CameraPane.Ymin = spot.y;
7409
- }
7410
- if (CameraPane.Ymax < spoth)
7411
- {
7412
- CameraPane.Ymax = spoth;
7413
- }
7414
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7415
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7031
+// if (CameraPane.Xmin > spot.x)
7032
+// {
7033
+// CameraPane.Xmin = spot.x;
7034
+// }
7035
+// if (CameraPane.Xmax < spotw)
7036
+// {
7037
+// CameraPane.Xmax = spotw;
7038
+// }
7039
+// if (CameraPane.Ymin > spot.y)
7040
+// {
7041
+// CameraPane.Ymin = spot.y;
7042
+// }
7043
+// if (CameraPane.Ymax < spoth)
7044
+// {
7045
+// CameraPane.Ymax = spoth;
7046
+// }
7047
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7048
+ //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
74167049 spot.translate(0, -32);
74177050 info.g.setColor(Color.green);
74187051 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7419
- if (CameraPane.Xmin > spot.x)
7420
- {
7421
- CameraPane.Xmin = spot.x;
7422
- }
7423
- if (CameraPane.Xmax < spotw)
7424
- {
7425
- CameraPane.Xmax = spotw;
7426
- }
7427
- if (CameraPane.Ymin > spot.y)
7428
- {
7429
- CameraPane.Ymin = spot.y;
7430
- }
7431
- if (CameraPane.Ymax < spoth)
7432
- {
7433
- CameraPane.Ymax = spoth;
7434
- }
7052
+// if (CameraPane.Xmin > spot.x)
7053
+// {
7054
+// CameraPane.Xmin = spot.x;
7055
+// }
7056
+// if (CameraPane.Xmax < spotw)
7057
+// {
7058
+// CameraPane.Xmax = spotw;
7059
+// }
7060
+// if (CameraPane.Ymin > spot.y)
7061
+// {
7062
+// CameraPane.Ymin = spot.y;
7063
+// }
7064
+// if (CameraPane.Ymax < spoth)
7065
+// {
7066
+// CameraPane.Ymax = spoth;
7067
+// }
74357068 info.g.drawArc(boundary.x, boundary.y,
74367069 boundary.width, boundary.height, 0, 360);
74377070 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7438
- if (CameraPane.Xmin > boundary.x)
7439
- {
7440
- CameraPane.Xmin = boundary.x;
7441
- }
7442
- if (CameraPane.Xmax < boundary.x + boundary.width)
7443
- {
7444
- CameraPane.Xmax = boundary.x + boundary.width;
7445
- }
7446
- if (CameraPane.Ymin > boundary.y)
7447
- {
7448
- CameraPane.Ymin = boundary.y;
7449
- }
7450
- if (CameraPane.Ymax < boundary.y + boundary.height)
7451
- {
7452
- CameraPane.Ymax = boundary.y + boundary.height;
7453
- }
7071
+// if (CameraPane.Xmin > boundary.x)
7072
+// {
7073
+// CameraPane.Xmin = boundary.x;
7074
+// }
7075
+// if (CameraPane.Xmax < boundary.x + boundary.width)
7076
+// {
7077
+// CameraPane.Xmax = boundary.x + boundary.width;
7078
+// }
7079
+// if (CameraPane.Ymin > boundary.y)
7080
+// {
7081
+// CameraPane.Ymin = boundary.y;
7082
+// }
7083
+// if (CameraPane.Ymax < boundary.y + boundary.height)
7084
+// {
7085
+// CameraPane.Ymax = boundary.y + boundary.height;
7086
+// }
74547087 return;
74557088 }
74567089 }
....@@ -7467,7 +7100,7 @@
74677100 startX = info.x;
74687101 startY = info.y;
74697102
7470
- hitSomething = 0;
7103
+ hitSomething = -1;
74717104 cVector origin = new cVector();
74727105 //LA.xformPos(origin, toParent, origin);
74737106 Rectangle spot = new Rectangle();
....@@ -7500,7 +7133,7 @@
75007133 }
75017134
75027135 //System.out.println("info.modifiers = " + info.modifiers);
7503
- modified = (info.modifiers & CameraPane.META) != 0;
7136
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
75047137 //System.out.println("modified = " + modified);
75057138 //new Exception().printStackTrace();
75067139 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7528,7 +7161,7 @@
75287161 return true;
75297162 }
75307163
7531
- void doEditDrag0(ClickInfo info)
7164
+ void doEditDrag0(ClickInfo info, boolean opposite)
75327165 {
75337166 if (hitSomething == 0)
75347167 {
....@@ -7543,6 +7176,7 @@
75437176 //System.out.println("hitSomething = " + hitSomething);
75447177
75457178 double scale = 0.005f * info.camera.Distance();
7179
+
75467180 cVector xlate = new cVector();
75477181 //cVector xlate2 = new cVector();
75487182 switch (hitSomething)
....@@ -7553,9 +7187,9 @@
75537187
75547188 case hitCenter: // Translate
75557189
7556
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7190
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75577191
7558
- if (modified)
7192
+ if (modified || opposite)
75597193 {
75607194 //assert(false);
75617195 /*
....@@ -7601,10 +7235,10 @@
76017235 }
76027236 LA.xformDir(up, ClickInfo.matbuffer, up);
76037237 // if (!CameraPane.LOCALTRANSFORM)
7604
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7238
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
76057239 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
76067240 // if (!CameraPane.LOCALTRANSFORM)
7607
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7241
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
76087242 //LA.vecCross(up, cVector.Z, right2);
76097243
76107244 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7649,6 +7283,7 @@
76497283
76507284 if (modified)
76517285 {
7286
+ // Rotate 90 degrees
76527287 angle /= (Math.PI / 4);
76537288 angle = Math.floor(angle + 0.5);
76547289 angle *= (Math.PI / 4);
....@@ -7662,7 +7297,7 @@
76627297 }
76637298 /**/
76647299
7665
- switch (info.pane.renderCamera.viewCode)
7300
+ switch (info.pane.RenderCamera().viewCode)
76667301 {
76677302 case 1: // '\001'
76687303 LA.matZRotate(toParent, angle);
....@@ -7690,24 +7325,27 @@
76907325
76917326 case hitScale: // scale
76927327 double hScale = (double) (info.x - centerPt.x) / 32;
7328
+ double sign = 1;
7329
+ if (hScale < 0)
7330
+ {
7331
+ sign = -1;
7332
+ }
7333
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
76937334 if (hScale < 0.01)
76947335 {
7695
- hScale = 0.01;
7336
+ //hScale = 0.01;
76967337 }
7697
- hScale = Math.pow(hScale, scale * 50);
7698
- if (hScale < 0.01)
7699
- {
7700
- hScale = 0.01;
7701
- }
7338
+
77027339 double vScale = (double) (info.y - centerPt.y) / 32;
7703
- if (vScale < 0.01)
7340
+ sign = 1;
7341
+ if (vScale < 0)
77047342 {
7705
- vScale = 0.01;
7343
+ sign = -1;
77067344 }
7707
- vScale = Math.pow(vScale, scale * 50);
7345
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
77087346 if (vScale < 0.01)
77097347 {
7710
- vScale = 0.01;
7348
+ //vScale = 0.01;
77117349 }
77127350 LA.matCopy(startMat, toParent);
77137351 /**/
....@@ -7718,17 +7356,24 @@
77187356 }
77197357 /**/
77207358
7721
- switch (info.pane.renderCamera.viewCode)
7359
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7360
+
7361
+ if (totalScale < 0.01)
7362
+ {
7363
+ totalScale = 0.01;
7364
+ }
7365
+
7366
+ switch (info.pane.RenderCamera().viewCode)
77227367 {
77237368 case 3: // '\001'
77247369 if (modified)
77257370 {
77267371 //LA.matScale(toParent, 1, hScale, vScale);
7727
- LA.matScale(toParent, vScale, 1, 1);
7372
+ LA.matScale(toParent, totalScale, 1, 1);
77287373 } // vScale, 1);
77297374 else
77307375 {
7731
- LA.matScale(toParent, vScale, vScale, vScale);
7376
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
77327377 } // vScale, 1);
77337378 break;
77347379
....@@ -7736,10 +7381,10 @@
77367381 if (modified)
77377382 {
77387383 //LA.matScale(toParent, hScale, 1, vScale);
7739
- LA.matScale(toParent, 1, vScale, 1);
7384
+ LA.matScale(toParent, 1, totalScale, 1);
77407385 } else
77417386 {
7742
- LA.matScale(toParent, vScale, 1, vScale);
7387
+ LA.matScale(toParent, totalScale, 1, totalScale);
77437388 }
77447389 break;
77457390
....@@ -7747,10 +7392,10 @@
77477392 if (modified)
77487393 {
77497394 //LA.matScale(toParent, hScale, vScale, 1);
7750
- LA.matScale(toParent, 1, 1, vScale);
7395
+ LA.matScale(toParent, 1, 1, totalScale);
77517396 } else
77527397 {
7753
- LA.matScale(toParent, vScale, vScale, 1);
7398
+ LA.matScale(toParent, totalScale, totalScale, 1);
77547399 }
77557400 break;
77567401 }
....@@ -7883,14 +7528,22 @@
78837528 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
78847529 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
78857530 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7531
+
7532
+ String objname;
7533
+
78867534 if (false) //parent != null)
78877535 {
7888
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7536
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
78897537 } else
78907538 {
7891
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7539
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
78927540 } // + super.toString();
78937541 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7542
+
7543
+ if (!Globals.ADVANCED)
7544
+ return objname;
7545
+
7546
+ return objname + " " + System.identityHashCode(this);
78947547 }
78957548
78967549 public int hashCode()
....@@ -7946,6 +7599,7 @@
79467599 objectUI.closeUI();
79477600 if (editWindow != null)
79487601 {
7602
+ editWindow.ctrlPanel.FlushUI();
79497603 editWindow.refreshContents();
79507604 } // ? new
79517605 objectUI = null;
....@@ -7966,7 +7620,7 @@
79667620 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
79677621
79687622 Object3D /*Composite*/ parent;
7969
- Object3D /*Composite*/ fileparent;
7623
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
79707624
79717625 double[][] toParent; // dynamic matrix
79727626 double[][] fromParent;
....@@ -8081,7 +7735,7 @@
80817735 {
80827736 assert(bRep != null);
80837737 if (!(support instanceof GenericJoint)) // support.bRep != null)
8084
- GrafreeD.Assert(support.bRep == bRep.support);
7738
+ Grafreed.Assert(support.bRep == bRep.support);
80857739 }
80867740 else
80877741 {
....@@ -8130,9 +7784,9 @@
81307784 private static cVector edge2 = new cVector();
81317785 //private static cVector norm = new cVector();
81327786 /*transient private*/ int hitSomething;
8133
- private static final int hitCenter = 1;
8134
- private static final int hitScale = 2;
8135
- private static final int hitRotate = 3;
7787
+ static final int hitCenter = 1;
7788
+ static final int hitScale = 2;
7789
+ static final int hitRotate = 3;
81367790 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
81377791 /*transient*/ private Point centerPt;
81387792 /*transient*/ private int startX;
....@@ -8164,6 +7818,8 @@
81647818 {
81657819 Object3D targ = this;
81667820
7821
+ targ.NORMALPUSH = obj.NORMALPUSH;
7822
+
81677823 if (obj.material != null)
81687824 {
81697825 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))