Normand Briere
2019-06-11 4113164b3be1e50251ac40d6fd65660f0a6c2e63
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,67 @@
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
+ {
170
+ Object3D o = hashtable.get(GetUUID());
171
+
172
+ assert(this.bRep == o.bRep);
173
+ if (this.bRep != null)
174
+ assert(this.bRep.support == o.transientrep);
175
+
176
+ return;
177
+ }
178
+
179
+ Object3D o = new Object3D();
180
+ o.bRep = this.bRep;
181
+ if (this.bRep != null)
182
+ {
183
+ o.transientrep = this.bRep.support;
184
+ o.bRep.support = null;
185
+ }
186
+
187
+// o.support = this.support;
188
+// o.fileparent = this.fileparent;
189
+// if (this.bRep != null)
190
+// o.bRep = this.bRep.support;
191
+
192
+ hashtable.put(GetUUID(), o);
193
+
194
+ this.bRep = null;
195
+// if (this.bRep != null)
196
+// this.bRep.support = null;
197
+// this.support = null;
198
+// this.fileparent = null;
199
+
200
+ for (int i=0; i<Size(); i++)
201
+ {
202
+ get(i).ExtractBigData(hashtable);
203
+ }
204
+}
205
+
206
+void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
207
+{
208
+ if (!hashtable.containsKey(GetUUID()))
209
+ return;
210
+
211
+ Object3D o = hashtable.get(GetUUID());
212
+
213
+ this.bRep = o.bRep;
214
+ if (this.bRep != null)
215
+ this.bRep.support = o.transientrep;
216
+// this.support = o.support;
217
+// this.fileparent = o.fileparent;
218
+
219
+ hashtable.remove(GetUUID());
220
+
221
+ for (int i=0; i<Size(); i++)
222
+ {
223
+ get(i).RestoreBigData(hashtable);
145224 }
146225 }
147226
....@@ -286,6 +365,7 @@
286365 }
287366
288367 boolean live = false;
368
+ boolean dontselect = false;
289369 boolean hide = false;
290370 boolean link2master = false; // performs reset support/master at each frame
291371 boolean marked = false; // animation node
....@@ -295,6 +375,8 @@
295375 boolean random = false;
296376 boolean speedup = false;
297377 boolean rewind = false;
378
+
379
+ float NORMALPUSH = 0;
298380
299381 Object3D support;
300382
....@@ -415,16 +497,16 @@
415497 {
416498 Object3D copy = this;
417499
418
- Camera parentcam = CameraPane.theRenderer.manipCamera;
500
+ Camera parentcam = Globals.theRenderer.ManipCamera();
419501
420
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
502
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
421503 {
422
- parentcam = CameraPane.theRenderer.cameras[1];
504
+ parentcam = Globals.theRenderer.Cameras()[1];
423505 }
424506
425
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
507
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
426508 {
427
- parentcam = CameraPane.theRenderer.cameras[0];
509
+ parentcam = Globals.theRenderer.Cameras()[0];
428510 }
429511
430512 if (this == parentcam)
....@@ -432,7 +514,7 @@
432514 //assert(this instanceof Camera);
433515
434516 for (int count = parentcam.GetTransformCount(); --count>=0;)
435
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
517
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
436518 }
437519
438520 copy.marked ^= true;
....@@ -452,7 +534,7 @@
452534 //assert(this instanceof Camera);
453535
454536 for (int count = parentcam.GetTransformCount(); --count>=0;)
455
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
537
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
456538 }
457539
458540 copy.Touch(); // display list issue
....@@ -587,7 +669,7 @@
587669 return;
588670 }
589671
590
- if (CameraPane.fromscript)
672
+ if (Globals.fromscript)
591673 {
592674 transformcount = 0;
593675 return;
....@@ -745,7 +827,7 @@
745827
746828 int GetTransformCount()
747829 {
748
- // marde pour serialization de Texture
830
+ // patch pour serialization de Texture
749831 resetmaxcount();
750832 resettransformcount();
751833 resetstep();
....@@ -758,7 +840,7 @@
758840 if (step == 0)
759841 step = 1;
760842 if (maxcount == 0)
761
- maxcount = 2048; // 4;
843
+ maxcount = 128; // 2048; // 4;
762844 // if (acceleration == 0)
763845 // acceleration = 10;
764846 if (delay == 0) // serial
....@@ -779,9 +861,12 @@
779861 // factor = CameraPane.STEP;
780862 // }
781863
782
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
864
+ if (marked && Globals.isLIVE() && live &&
865
+ //TEMP21aug2018
866
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
867
+ currentframe != Globals.framecount)
783868 {
784
- currentframe = CameraPane.framecount;
869
+ currentframe = Globals.framecount;
785870
786871 // System.err.println("transformcount = " + transformcount);
787872 // System.err.println("factor = " + factor);
....@@ -893,6 +978,11 @@
893978 fromParent = null; // LA.newMatrix();
894979 bRep = null; // new BoundaryRep();
895980
981
+ if (oname != null && oname.equals("LeftHand"))
982
+ {
983
+ name = oname;
984
+ }
985
+
896986 /*
897987 float hue = (float)Math.random();
898988 Color col;
....@@ -935,7 +1025,7 @@
9351025
9361026 public Object clone()
9371027 {
938
- return GrafreeD.clone(this);
1028
+ return Grafreed.clone(this);
9391029 }
9401030
9411031 Object3D copyExpand()
....@@ -1451,7 +1541,7 @@
14511541 BoundaryRep.SEUIL = other.material.cameralight;
14521542
14531543 // Set default to 0.1
1454
- BoundaryRep.SEUIL /= 2;
1544
+ BoundaryRep.SEUIL /= 4; // 2;
14551545 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14561546 }
14571547
....@@ -1710,7 +1800,7 @@
17101800 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17111801 o.bRep = transientrep;
17121802 if (clone)
1713
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1803
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17141804 o.CreateMaterial();
17151805 o.SetAttributes(this, -1);
17161806 //parent
....@@ -1723,7 +1813,7 @@
17231813 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17241814 o.bRep = bRep;
17251815 if (clone)
1726
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1816
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17271817 o.CreateMaterial();
17281818 //o.overwriteThis(this, -1);
17291819 o.SetAttributes(this, -1);
....@@ -1810,12 +1900,15 @@
18101900 if (obj.name == null)
18111901 continue; // can't be a null one
18121902
1903
+ // Try perfect match first.
18131904 if (n.equals(obj.name))
18141905 {
18151906 theobj = obj;
18161907 count++;
18171908 }
18181909 }
1910
+
1911
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18191912
18201913 if (count != 1)
18211914 for (int i=Size(); --i>=0;)
....@@ -2130,15 +2223,8 @@
21302223 if (/*parent != null &&*/ material == null)
21312224 {
21322225 material = new cMaterial(GetMaterial());
2133
- if (projectedVertices == null || projectedVertices.length <= 2)
2134
- {
2135
- projectedVertices = new Object3D.cVector2[3];
2136
- }
2137
- for (int i = 0; i < 3; i++)
2138
- {
2139
- projectedVertices[i] = new cVector2(); // Others
2140
- }
2141
- projectedVertices[0].x = 100; // bump
2226
+
2227
+ InitOthers();
21422228
21432229 if (this instanceof Camera)
21442230 {
....@@ -2288,6 +2374,7 @@
22882374 {
22892375 if (newWindow)
22902376 {
2377
+ new Exception().printStackTrace();
22912378 System.exit(0);
22922379 if (parent != null)
22932380 {
....@@ -2464,13 +2551,13 @@
24642551 return retval;
24652552 }
24662553
2467
- void doEditDrag(ClickInfo info)
2554
+ void doEditDrag(ClickInfo info, boolean opposite)
24682555 {
24692556 switch (doSomething)
24702557 {
24712558 case 1: // '\001'
24722559 //super.
2473
- doEditDrag0(info);
2560
+ doEditDrag0(info, opposite);
24742561 break;
24752562
24762563 case 2: // '\002'
....@@ -2483,11 +2570,11 @@
24832570 {
24842571 //sel.hitSomething = childToDrag.hitSomething;
24852572 //childToDrag.doEditDrag(info);
2486
- sel.doEditDrag(info);
2573
+ sel.doEditDrag(info, opposite);
24872574 } else
24882575 {
24892576 //super.
2490
- doEditDrag0(info);
2577
+ doEditDrag0(info, opposite);
24912578 }
24922579 }
24932580 break;
....@@ -2894,7 +2981,8 @@
28942981 {
28952982 if (bRep != null)
28962983 {
2897
- bRep.GenUV();
2984
+ bRep.GenUV(); //1);
2985
+ //bRep.UnfoldUV();
28982986 Touch();
28992987 }
29002988 }
....@@ -2969,6 +3057,33 @@
29693057 blockloop = false;
29703058 }
29713059
3060
+ void TransformChildren()
3061
+ {
3062
+ if (toParent != null)
3063
+ {
3064
+ for (int i=Size(); --i>=0;)
3065
+ {
3066
+ Object3D v = get(i);
3067
+
3068
+ if (v.toParent == null)
3069
+ {
3070
+ v.toParent = LA.newMatrix();
3071
+ v.fromParent = LA.newMatrix();
3072
+ }
3073
+
3074
+// LA.matConcat(v.toParent, toParent, v.toParent);
3075
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3076
+ LA.matConcat(toParent, v.toParent, v.toParent);
3077
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3078
+ }
3079
+
3080
+ toParent = null; // LA.matIdentity(toParent);
3081
+ fromParent = null; // LA.matIdentity(fromParent);
3082
+
3083
+ Touch();
3084
+ }
3085
+ }
3086
+
29723087 void TransformGeometry()
29733088 {
29743089 Object3D obj = this;
....@@ -3190,9 +3305,11 @@
31903305
31913306 BoundaryRep sup = bRep.support;
31923307 bRep.support = null;
3193
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3308
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
31943309 // bRep.SplitInTwo(onlyone); // thread...
3195
- temprep.SplitInTwo(reduction34, onlyone);
3310
+
3311
+ while(temprep.SplitInTwo(reduction34, onlyone));
3312
+
31963313 bRep = temprep;
31973314 bRep.support = sup;
31983315 Touch();
....@@ -3714,7 +3831,7 @@
37143831 if (child == null)
37153832 continue;
37163833
3717
- if (GrafreeD.RENDERME > 0)
3834
+ if (Grafreed.RENDERME > 0)
37183835 {
37193836 if (child instanceof Merge)
37203837 ((Merge)child).renderme();
....@@ -3865,7 +3982,7 @@
38653982 if (child == null)
38663983 continue;
38673984
3868
- if (GrafreeD.RENDERME > 0)
3985
+ if (Grafreed.RENDERME > 0)
38693986 {
38703987 if (child instanceof Merge)
38713988 ((Merge)child).renderme();
....@@ -4060,7 +4177,7 @@
40604177 if (child == null)
40614178 continue;
40624179
4063
- if (GrafreeD.RENDERME > 0)
4180
+ if (Grafreed.RENDERME > 0)
40644181 {
40654182 if (child instanceof Merge)
40664183 ((Merge)child).renderme();
....@@ -4157,6 +4274,22 @@
41574274 }
41584275 blockloop = true;
41594276 get(i).RepairParent();
4277
+ blockloop = false;
4278
+ }
4279
+ }
4280
+
4281
+ void RepairShadow()
4282
+ {
4283
+ if (blockloop)
4284
+ return;
4285
+
4286
+ if (this.material != null)
4287
+ this.InitOthers();
4288
+
4289
+ for (int i=0; i<Size(); i++)
4290
+ {
4291
+ blockloop = true;
4292
+ get(i).RepairShadow();
41604293 blockloop = false;
41614294 }
41624295 }
....@@ -4651,7 +4784,7 @@
46514784
46524785 cTreePath SelectLeaf(int indexcount, boolean deselect)
46534786 {
4654
- if (hide)
4787
+ if (hide || dontselect)
46554788 return null;
46564789
46574790 if (count <= 0)
....@@ -4677,7 +4810,7 @@
46774810
46784811 cTreePath Select(int indexcount, boolean deselect)
46794812 {
4680
- if (hide)
4813
+ if (hide || dontselect)
46814814 return null;
46824815
46834816 if (count <= 0)
....@@ -4827,7 +4960,7 @@
48274960 return globalTransform;
48284961 }
48294962
4830
- void PreprocessOcclusion(CameraPane cp)
4963
+ void PreprocessOcclusion(iCameraPane cp)
48314964 {
48324965 /*
48334966 if (AOdone)
....@@ -4974,7 +5107,8 @@
49745107 } else //
49755108 if (editWindow != null)
49765109 {
4977
- editWindow.cameraView.lighttouched = true;
5110
+ //editWindow.cameraView.lighttouched = true;
5111
+ Globals.lighttouched = true;
49785112 }
49795113 }
49805114
....@@ -5128,10 +5262,34 @@
51285262
51295263 // System.out.println("Fullname = " + fullname);
51305264
5131
- if (fullname.name.indexOf(":") == -1)
5132
- return fullname.name;
5265
+ // Does not work on Windows due to C:
5266
+// if (fullname.name.indexOf(":") == -1)
5267
+// return fullname.name;
5268
+//
5269
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51335270
5134
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5271
+ String[] split = fullname.name.split(":");
5272
+
5273
+ if (split.length == 0)
5274
+ {
5275
+ return "";
5276
+ }
5277
+
5278
+ if (split.length <= 2)
5279
+ {
5280
+ if (fullname.name.endsWith(":"))
5281
+ {
5282
+ // Windows
5283
+ return fullname.name.substring(0, fullname.name.length()-1);
5284
+ }
5285
+
5286
+ return split[0];
5287
+ }
5288
+
5289
+ // Windows
5290
+ assert(split.length == 4);
5291
+
5292
+ return split[0] + ":" + split[1];
51355293 }
51365294
51375295 static String GetBump(cTexture fullname)
....@@ -5140,10 +5298,38 @@
51405298 return "";
51415299
51425300 // System.out.println("Fullname = " + fullname);
5143
- if (fullname.name.indexOf(":") == -1)
5144
- return "";
5145
-
5146
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5301
+ // Does not work on Windows due to C:
5302
+// if (fullname.name.indexOf(":") == -1)
5303
+// return "";
5304
+//
5305
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5306
+ String[] split = fullname.name.split(":");
5307
+
5308
+ if (split.length == 0)
5309
+ {
5310
+ return "";
5311
+ }
5312
+
5313
+ if (split.length == 1)
5314
+ {
5315
+ return "";
5316
+ }
5317
+
5318
+ if (split.length == 2)
5319
+ {
5320
+ if (fullname.name.endsWith(":"))
5321
+ {
5322
+ // Windows
5323
+ return "";
5324
+ }
5325
+
5326
+ return split[1];
5327
+ }
5328
+
5329
+ // Windows
5330
+ assert(split.length == 4);
5331
+
5332
+ return split[2] + ":" + split[3];
51475333 }
51485334
51495335 String GetPigmentTexture()
....@@ -5217,7 +5403,7 @@
52175403 System.out.print("; textures = " + textures);
52185404 System.out.println("; usedtextures = " + usedtextures);
52195405
5220
- if (GetTextures() == null)
5406
+ if (GetTextures() == null) // What is that??
52215407 GetTextures().name = ":";
52225408
52235409 String texname = tex;
....@@ -5248,6 +5434,43 @@
52485434 child.ResetPigmentTexture();
52495435 blockloop = false;
52505436 }
5437
+ }
5438
+
5439
+ UUID GetUUID()
5440
+ {
5441
+ if (uuid == null)
5442
+ {
5443
+ // Serial
5444
+ uuid = UUID.randomUUID();
5445
+ }
5446
+
5447
+ return uuid;
5448
+ }
5449
+
5450
+ Object3D GetObject(UUID uid)
5451
+ {
5452
+ if (blockloop)
5453
+ return null;
5454
+
5455
+ if (GetUUID().equals(uid))
5456
+ return this;
5457
+
5458
+ int nb = Size();
5459
+ for (int i = 0; i < nb; i++)
5460
+ {
5461
+ Object3D child = (Object3D) get(i);
5462
+
5463
+ if (child == null)
5464
+ continue;
5465
+
5466
+ blockloop = true;
5467
+ Object3D obj = child.GetObject(uid);
5468
+ blockloop = false;
5469
+ if (obj != null)
5470
+ return obj;
5471
+ }
5472
+
5473
+ return null;
52515474 }
52525475
52535476 void SetBumpTexture(String tex)
....@@ -5286,25 +5509,22 @@
52865509 }
52875510 }
52885511
5289
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5512
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52905513 {
52915514 Draw(display, root, selected, blocked);
52925515 }
52935516
5294
- static cMaterial[] materialstack = new cMaterial[65536];
5295
- static boolean[] selectedstack = new boolean[65536];
5296
- static int materialdepth = 0;
5297
-
52985517 boolean NeedSupport()
52995518 {
53005519 return
5301
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5520
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
53025521 // PROBLEM with CROWD!!
5303
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5522
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53045523 }
53055524
5525
+ static boolean DEBUG_SELECTION = false;
53065526
5307
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5527
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53085528 {
53095529 Invariants(); // june 2013
53105530
....@@ -5313,8 +5533,8 @@
53135533 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
53145534 }
53155535
5316
- if (display.drawMode == CameraPane.SELECTION &&
5317
- hide)
5536
+ if (display.DrawMode() == iCameraPane.SELECTION &&
5537
+ (hide || dontselect))
53185538 return;
53195539
53205540 if (name != null && name.contains("sclera"))
....@@ -5332,7 +5552,7 @@
53325552 if (this instanceof Checker)
53335553 return;
53345554
5335
- if (display.drawMode == display.SHADOW && PASSTEST)
5555
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
53365556 return;
53375557
53385558 if (count <= 0)
....@@ -5340,13 +5560,13 @@
53405560 return;
53415561 }
53425562
5343
- if ((//display.drawMode == CameraPane.SHADOW ||
5344
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5563
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5564
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53455565 {
53465566 return;
53475567 }
53485568
5349
- javax.media.opengl.GL gl = display.GetGL();
5569
+ //javax.media.opengl.GL gl = display.GetGL();
53505570
53515571 /*
53525572 if (touched)
....@@ -5382,15 +5602,15 @@
53825602
53835603 boolean compiled = false;
53845604
5385
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5605
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53865606
5387
- if (!selectmode && //display.drawMode != display.SELECTION &&
5607
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53885608 (touched || (bRep != null && bRep.displaylist <= 0)))
53895609 {
5390
- display.lighttouched = true;
5610
+ Globals.lighttouched = true;
53915611 } // all panes...
5392
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5393
- if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&
5612
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5613
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53945614 (touched || (bRep != null && bRep.displaylist <= 0)))
53955615 {
53965616 if (!(this instanceof Composite))
....@@ -5398,7 +5618,7 @@
53985618 //if (displaylist == -1 && usecalllists)
53995619 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54005620 {
5401
- bRep.displaylist = gl.glGenLists(1);
5621
+ bRep.displaylist = display.GenList();
54025622 assert(bRep.displaylist != 0);
54035623 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54045624 //System.out.println("\tgen list " + list);
....@@ -5410,18 +5630,20 @@
54105630 if (usecalllists)
54115631 {
54125632 // System.err.println("new list " + bRep.displaylist + " for " + this);
5413
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5633
+ display.NewList(bRep.displaylist);
54145634 }
5635
+
54155636 CallList(display, root, selected, blocked);
5637
+
54165638 // compiled = true;
54175639 if (usecalllists)
54185640 {
54195641 // System.err.println("end list " + bRep.displaylist + " for " + this);
5420
- gl.glEndList();
5642
+ display.EndList();
54215643 }
54225644 //gl.glDrawBuffer(gl.GL_BACK);
54235645 // XXX touched = false;
5424
- display.lighttouched = true; // all panes...
5646
+ Globals.lighttouched = true; // all panes...
54255647 }
54265648
54275649 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5460,12 +5682,12 @@
54605682
54615683 // frustum culling
54625684 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5463
- && display.drawMode != CameraPane.SELECTION)
5685
+ && display.DrawMode() != iCameraPane.SELECTION)
54645686 {
5465
- if (display.drawMode == CameraPane.SHADOW)
5687
+ if (display.DrawMode() == iCameraPane.SHADOW)
54665688 {
54675689 if (!link2master // tricky to cull in shadow mode.
5468
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5690
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54695691 {
54705692 //System.out.print("CULLED");
54715693 culled = true;
....@@ -5473,7 +5695,7 @@
54735695 }
54745696 else
54755697 //GetBRep().getBounds(v0, v1, this);
5476
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5698
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54775699 culled = true;
54785700
54795701 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5509,11 +5731,11 @@
55095731
55105732
55115733 if (!culled)
5512
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5734
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55135735 {
55145736 if (GetBRep() != null)
55155737 {
5516
- CameraPane.NextIndex(this, gl);
5738
+ display.NextIndex();
55175739 // vertex color conflict : gl.glCallList(list);
55185740 DrawNode(display, root, selected);
55195741 if (this instanceof BezierPatch)
....@@ -5535,55 +5757,7 @@
55355757 color[2] /= 2;
55365758 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55375759 */
5538
- if (material != null)
5539
- {
5540
- materialstack[materialdepth] = material;
5541
- selectedstack[materialdepth] = selected;
5542
- cStatic.objectstack[materialdepth++] = this;
5543
- //System.out.println("material " + material);
5544
- //Applet3D.tracein(this, selected);
5545
- display.vector2buffer = projectedVertices;
5546
- if (this instanceof Camera)
5547
- {
5548
- display.options1[0] = material.shift;
5549
- //System.out.println("shift " + material.shift);
5550
- display.options1[1] = material.lightarea;
5551
- display.options1[2] = material.shadowbias;
5552
- display.options1[3] = material.aniso;
5553
- display.options1[4] = material.anisoV;
5554
- display.options2[0] = material.opacity;
5555
- display.options2[1] = material.diffuse;
5556
- display.options2[2] = material.factor;
5557
-
5558
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5559
- display.options4[0] = material.cameralight/0.2f;
5560
- display.options4[1] = material.subsurface;
5561
- display.options4[2] = material.sheen;
5562
-
5563
- // if (display.CURRENTANTIALIAS > 0)
5564
- // display.options3[3] /= 4;
5565
-
5566
- /*
5567
- System.out.println("Focus = " + display.options1[0]);
5568
- System.out.println("Aperture = " + display.options1[1]);
5569
- System.out.println("ShadowBlur = " + display.options1[2]);
5570
- System.out.println("Antialiasing = " + display.options1[3]);
5571
- System.out.println("Fog = " + display.options2[0]);
5572
- System.out.println("Intensity = " + display.options2[1]);
5573
- System.out.println("Elevation = " + display.options2[2]);
5574
- /**/
5575
- } else
5576
- {
5577
- material.Draw(display, selected);
5578
- }
5579
- } else
5580
- {
5581
- if (selected && CameraPane.flash)
5582
- {
5583
- display.modelParams4[1] = 100;
5584
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5585
- }
5586
- }
5760
+ display.PushMaterial(this, selected);
55875761
55885762 //System.out.println("call list " + list);
55895763 //System.out.println();
....@@ -5602,7 +5776,17 @@
56025776 tex = GetTextures();
56035777 }
56045778
5605
- display.BindTextures(tex, texres);
5779
+ boolean failed = false;
5780
+
5781
+ try
5782
+ {
5783
+ display.BindTextures(tex, texres);
5784
+ }
5785
+ catch (Exception e)
5786
+ {
5787
+ System.err.println("FAILED: " + this);
5788
+ failed = true;
5789
+ }
56065790
56075791 if (!compiled)
56085792 {
....@@ -5618,30 +5802,16 @@
56185802
56195803 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
56205804 assert(bRep.displaylist != 0);
5621
- gl.glCallList(bRep.displaylist);
5805
+ display.CallList(bRep.displaylist);
56225806 // june 2013 drawSelf(display, root, selected);
56235807 }
56245808 }
56255809 }
56265810
5627
- display.ReleaseTextures(tex);
5628
-
5629
- //if (parent != null && parent.GetMaterial() != null)
5630
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5631
- if (material != null)
5632
- {
5633
- materialdepth -= 1;
5634
- if (materialdepth > 0)
5635
- {
5636
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5637
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5638
- }
5639
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5640
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5641
- {
5642
- display.modelParams4[1] = GetMaterial().cameralight;
5643
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5644
- }
5811
+ if (!failed)
5812
+ display.ReleaseTextures(tex);
5813
+
5814
+ display.PopMaterial(this, selected);
56455815 }
56465816
56475817 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5683,7 +5853,7 @@
56835853 // resetMasterNode();
56845854 }
56855855
5686
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5856
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56875857 {
56885858 if (GetBRep() == null)
56895859 {
....@@ -5766,8 +5936,11 @@
57665936 boolean flipV = false; // true;
57675937 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57685938
5769
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5939
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57705940 {
5941
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5942
+ return;
5943
+
57715944 if (hide)
57725945 return;
57735946 // shadow optimisation
....@@ -5825,16 +5998,7 @@
58255998 // // ??????????????????????????? Touch();
58265999 // }
58276000
5828
- if (material != null)
5829
- {
5830
- materialstack[materialdepth] = material;
5831
- selectedstack[materialdepth] = selected;
5832
- cStatic.objectstack[materialdepth++] = this;
5833
- //System.out.println("material " + material);
5834
- //Applet3D.tracein("selected ", selected);
5835
- display.vector2buffer = projectedVertices;
5836
- material.Draw(display, selected);
5837
- }
6001
+display.PushMaterial2(this, selected);
58386002
58396003 Object3D child;
58406004 boolean sel;
....@@ -5886,19 +6050,7 @@
58866050 */
58876051 //depth += 1;
58886052
5889
- if (material != null)
5890
- {
5891
- materialdepth -= 1;
5892
- if (materialdepth > 0)
5893
- {
5894
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5895
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5896
- }
5897
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5898
- //else
5899
- //material.Draw(display, false);
5900
- }
5901
-
6053
+display.PopMaterial2(this);
59026054 /*
59036055 display.ReleaseTextures(tex);
59046056 */
....@@ -5909,10 +6061,13 @@
59096061
59106062 //static cVector min,max;
59116063
5912
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
6064
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
59136065 {
5914
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
6066
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59156067 return; // no shadow for transparent objects
6068
+
6069
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6070
+ return;
59166071
59176072 if (hide)
59186073 return;
....@@ -5954,11 +6109,12 @@
59546109 return;
59556110 }
59566111
6112
+ //bRep.GenUV(1/material.diffuseness);
59576113 // bRep.lock = true;
59586114
5959
- javax.media.opengl.GL gl = display.GetGL();
6115
+ //javax.media.opengl.GL gl = display.GetGL();
59606116
5961
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
6117
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59626118 {
59636119 int fc = bRep.FaceCount();
59646120 int vc = bRep.VertexCount();
....@@ -5973,23 +6129,7 @@
59736129
59746130 bRep.getMinMax(min, max, 100);
59756131
5976
- gl.glBegin(gl.GL_LINES);
5977
-
5978
- gl.glVertex3d(min.x, min.y, min.z);
5979
- gl.glVertex3d(min.x, min.y, max.z);
5980
- gl.glVertex3d(min.x, min.y, min.z);
5981
- gl.glVertex3d(min.x, max.y, min.z);
5982
- gl.glVertex3d(min.x, min.y, min.z);
5983
- gl.glVertex3d(max.x, min.y, min.z);
5984
-
5985
- gl.glVertex3d(max.x, max.y, max.z);
5986
- gl.glVertex3d(min.x, max.y, max.z);
5987
- gl.glVertex3d(max.x, max.y, max.z);
5988
- gl.glVertex3d(max.x, min.y, max.z);
5989
- gl.glVertex3d(max.x, max.y, max.z);
5990
- gl.glVertex3d(max.x, max.y, min.z);
5991
-
5992
- gl.glEnd();
6132
+ display.DrawBox(min, max);
59936133
59946134 return;
59956135 }
....@@ -6033,7 +6173,7 @@
60336173 {
60346174 //throw new Error();
60356175
6036
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6176
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
60376177
60386178 int[] strips = bRep.getRawIndices();
60396179
....@@ -6043,178 +6183,14 @@
60436183 new Exception().printStackTrace();
60446184 return;
60456185 }
6046
-
6047
- // TRIANGLE STRIP ARRAY
6048
- if (bRep.trimmed)
6049
- {
6050
- float[] v = bRep.getRawVertices();
6051
- float[] n = bRep.getRawNormals();
6052
- float[] c = bRep.getRawColors();
6053
- float[] uv = bRep.getRawUVMap();
6054
-
6055
- int count2 = 0;
6056
- int count3 = 0;
6057
-
6058
- if (n.length > 0)
6059
- {
6060
- for (int i = 0; i < strips.length; i++)
6061
- {
6062
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6063
-
6064
- /*
6065
- boolean locked = false;
6066
- float eps = 0.1f;
6067
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6068
-
6069
- int dot = 0;
6070
-
6071
- if ((dot&1) == 0)
6072
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6073
-
6074
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6075
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6076
- else
6077
- {
6078
- locked = true;
6079
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6080
- }
6081
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6082
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6083
- if (hasnorm)
6084
- {
6085
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6086
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6087
- }
6088
-
6089
- if ((dot&4) == 0)
6090
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6091
-
6092
- if (wrap || !locked && (dot&8) != 0)
6093
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6094
- else
6095
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6096
-
6097
- f.dot = dot;
6098
- */
6099
-
6100
- if (!selectmode)
6101
- {
6102
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6103
- {
6104
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6105
- } else
6106
- {
6107
- gl.glNormal3f(0, 0, 1);
6108
- }
6109
-
6110
- if (c != null)
6111
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6112
- {
6113
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6114
- }
6115
- }
6116
- if (flipV)
6117
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6118
- else
6119
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6120
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6121
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6122
-
6123
- count2 += 2;
6124
- count3 += 3;
6125
- if (!selectmode)
6126
- {
6127
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6128
- {
6129
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6130
- } else
6131
- {
6132
- gl.glNormal3f(0, 0, 1);
6133
- }
6134
- if (c != null)
6135
- {
6136
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6137
- }
6138
- }
6139
- if (flipV)
6140
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6141
- else
6142
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6143
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6144
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6145
-
6146
- count2 += 2;
6147
- count3 += 3;
6148
- for (int j = 0; j < strips[i] - 2; j++)
6149
- {
6150
- //gl.glTexCoord2d(...);
6151
- if (!selectmode)
6152
- {
6153
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6154
- {
6155
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6156
- } else
6157
- {
6158
- gl.glNormal3f(0, 0, 1);
6159
- }
6160
- if (c != null)
6161
- {
6162
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6163
- }
6164
- }
6165
-
6166
- if (flipV)
6167
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6168
- else
6169
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6170
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6171
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6172
- count2 += 2;
6173
- count3 += 3;
6174
- }
6175
-
6176
- gl.glEnd();
6177
- }
6178
- }
6179
-
6180
- assert count3 == v.length;
6181
- }
6182
- else // !trimmed
6183
- {
6184
- int count = 0;
6185
- for (int i = 0; i < strips.length; i++)
6186
- {
6187
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6188
-
6189
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6190
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6191
-
6192
- drawVertex(gl, p, selectmode);
6193
- drawVertex(gl, q, selectmode);
6194
-
6195
- for (int j = 0; j < strips[i] - 2; j++)
6196
- {
6197
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6198
-
6199
-// if (j%2 == 0)
6200
-// drawFace(p, q, r, display, null);
6201
-// else
6202
-// drawFace(p, r, q, display, null);
6203
-
6204
-// p = q;
6205
-// q = r;
6206
- drawVertex(gl, r, selectmode);
6207
- }
6208
-
6209
- gl.glEnd();
6210
- }
6211
- }
6186
+
6187
+ display.DrawGeometry(bRep, flipV, selectmode);
62126188 } else // catch (Error e)
62136189 {
62146190 // TRIANGLE ARRAY
62156191 if (IsOpaque()) // Static())
62166192 {
6217
- gl.glBegin(gl.GL_TRIANGLES);
6193
+ display.StartTriangles();
62186194 int facecount = bRep.FaceCount();
62196195 for (int i = 0; i < facecount; i++)
62206196 {
....@@ -6277,9 +6253,9 @@
62776253 // // r.norm.dot(v3) > -0.5)
62786254 // // continue;
62796255
6280
- drawFace(p, q, r, display, face);
6256
+ display.DrawFace(this, p, q, r, face);
62816257 }
6282
- gl.glEnd();
6258
+ display.EndTriangles();
62836259 }
62846260 else
62856261 {
....@@ -6308,8 +6284,8 @@
63086284 //System.out.println("SORT");
63096285
63106286 java.util.Arrays.sort(facescompare);
6311
-
6312
- gl.glBegin(gl.GL_TRIANGLES);
6287
+
6288
+ display.StartTriangles();
63136289 for (int i = 0; i < facecount; i++)
63146290 {
63156291 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6321,13 +6297,14 @@
63216297 Vertex q = bRep.GetVertex(face.q);
63226298 Vertex r = bRep.GetVertex(face.r);
63236299
6324
- drawFace(p, q, r, display, face);
6300
+ display.DrawFace(this, p, q, r, face);
63256301 }
6326
- gl.glEnd();
6302
+ display.EndTriangles();
63276303 }
63286304
63296305 if (false) // live && support != null && support.bRep != null) // debug weights
63306306 {
6307
+ /*
63316308 gl.glDisable(gl.GL_LIGHTING);
63326309 float[] colorV = new float[3];
63336310
....@@ -6406,6 +6383,7 @@
64066383 // gl.glEnd();
64076384 }
64086385 }
6386
+ */
64096387 }
64106388 }
64116389
....@@ -6450,7 +6428,7 @@
64506428 center.add(r);
64516429 center.mul(1.0/3);
64526430
6453
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6431
+ center.sub(Globals.theRenderer.EyeCamera().location);
64546432
64556433 distance = center.dot(center);
64566434 }
....@@ -6461,347 +6439,11 @@
64616439
64626440 transient FaceCompare[] facescompare = null;
64636441
6464
- void SetColor(CameraPane display, Vertex p0)
6465
- {
6466
- if (display.RENDERPROGRAM == 0)
6467
- {
6468
- float r = 0;
6469
- if (bRep != null)
6470
- {
6471
- if (bRep.stripified)
6472
- {
6473
- r = 1;
6474
- }
6475
- }
6476
- float g = 0;
6477
- if (bRep != null)
6478
- {
6479
- if (bRep.trimmed)
6480
- {
6481
- g = 1;
6482
- }
6483
- }
6484
- float b = 0;
6485
- if (support != null && link2master)
6486
- {
6487
- b = 1;
6488
- }
6489
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6490
- return;
6491
- }
6492
-
6493
- if (display.drawMode != CameraPane.SHADOW)
6494
- return;
6495
-
6496
- javax.media.opengl.GL gl = display.GetGL();
6497
-// if (true) return;
6498
-// float ao = p.AO;
6499
-//
6500
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6501
-// // ao = 1;
6502
-//
6503
-// gl.glColor4f(ao, ao, ao, 1);
6504
-
6505
-// CameraPane.selectedpoint.
6506
-// getAverage(cStatic.point1, true);
6507
- if (CameraPane.pointflow == null) // !random) // live)
6508
- {
6509
- return;
6510
- }
6511
-
6512
- cStatic.point1.set(0,0,0);
6513
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6514
-
6515
- cStatic.point1.sub(p0);
6516
-
6517
-
6518
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6519
-// {
6520
-// return;
6521
-// }
6522
-
6523
- //if (true)
6524
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6525
- {
6526
- return;
6527
- }
6528
-
6529
- float[] colorV = new float[3];
6530
-
6531
- if (false) // marked)
6532
- {
6533
- // debug rigging weights
6534
- for (int object = 0; object < p0.vertexlinks.length; object++)
6535
- {
6536
- float weight = p0.weights[object] / p0.totalweight;
6537
-
6538
- // if (weight < 0.1)
6539
- // {
6540
- // assert(weight == 0);
6541
- // continue;
6542
- // }
6543
-
6544
- if (p0.vertexlinks[object] == -1)
6545
- continue;
6546
-
6547
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6548
-
6549
- int color = //1 << object; //
6550
- //p.vertexlinks.length;
6551
- support.bRep.supports[p0.closestsupport].links[object];
6552
- colorV[2] += (color & 1) * weight;
6553
- colorV[1] += ((color & 2) >> 1) * weight;
6554
- colorV[0] += ((color & 4) >> 2) * weight;
6555
- }
6556
- }
6557
- else
6558
- {
6559
- if (drawingstarted)
6560
- {
6561
- // find next point
6562
- if (bRep.GetVertex(0).faceindices == null)
6563
- {
6564
- bRep.InitFaceIndices();
6565
- }
6566
-
6567
- double ymin = p0.y;
6568
-
6569
- Vertex newp = p0;
6570
-
6571
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6572
- {
6573
- int fi = p0.faceindices[fii];
6574
-
6575
- if (fi == -1)
6576
- break;
6577
-
6578
- Face f = bRep.GetFace(fi);
6579
-
6580
- Vertex p = bRep.GetVertex(f.p);
6581
- Vertex q = bRep.GetVertex(f.q);
6582
- Vertex r = bRep.GetVertex(f.r);
6583
-
6584
- int swap = (int)(Math.random()*3);
6585
-
6586
-// for (int s=swap; --s>=0;)
6587
-// {
6588
-// Vertex t = p;
6589
-// p = q;
6590
-// q = r;
6591
-// r = t;
6592
-// }
6593
- if (ymin > p.y)
6594
- {
6595
- ymin = p.y;
6596
- newp = p;
6597
-// break;
6598
- }
6599
- if (ymin > q.y)
6600
- {
6601
- ymin = q.y;
6602
- newp = q;
6603
-// break;
6604
- }
6605
- if (ymin > r.y)
6606
- {
6607
- ymin = r.y;
6608
- newp = r;
6609
-// break;
6610
- }
6611
- }
6612
-
6613
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6614
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6615
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6616
-
6617
- drawingstarted = false;
6618
-
6619
- // return;
6620
- }
6621
-
6622
- if (false) // CameraPane.DRAW
6623
- {
6624
- p0.AO = colorV[0] = 2;
6625
- colorV[1] = 2;
6626
- colorV[2] = 2;
6627
- }
6628
-
6629
- CameraPane.pointflow.add(p0);
6630
- CameraPane.pointflow.Touch();
6631
- }
6632
-
6633
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6634
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6635
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6636
- }
6637
-
66386442 void Print(Vertex v)
66396443 {
66406444 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
66416445 }
66426446
6643
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6644
- {
6645
- if (!selectmode)
6646
- {
6647
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6648
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6649
-
6650
- if (flipV)
6651
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6652
- else
6653
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6654
- }
6655
-
6656
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6657
- }
6658
-
6659
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6660
- CameraPane display, Face face)
6661
- {
6662
- if (pv.y == -10000 ||
6663
- qv.y == -10000 ||
6664
- rv.y == -10000)
6665
- return;
6666
-
6667
-// float b = f.nbiterations & 1;
6668
-// float g = (f.nbiterations>>1) & 1;
6669
-// float r = (f.nbiterations>>2) & 1;
6670
-//
6671
-// //if (f.weight == 10000)
6672
-// //{
6673
-// // r = 1; g = b = 0;
6674
-// //}
6675
-// //else
6676
-// //{
6677
-// // assert(f.weight < 10000);
6678
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6679
-// if (r<0)
6680
-// assert(r>=0);
6681
-// //}
6682
-
6683
- javax.media.opengl.GL gl = display.GetGL();
6684
-
6685
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6686
-
6687
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6688
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6689
- {
6690
- //gl.glBegin(gl.GL_TRIANGLES);
6691
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6692
- if (!hasnorm)
6693
- {
6694
- // System.out.println("FUCK!!");
6695
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6696
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6697
- LA.vecCross(v0, v1, v2);
6698
- LA.vecNormalize(v2);
6699
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6700
- }
6701
-
6702
- if (hasnorm)
6703
- {
6704
-// if (!pv.norm.normalized())
6705
-// assert(pv.norm.normalized());
6706
-
6707
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6708
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6709
- }
6710
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6711
- SetColor(display, pv);
6712
- //gl.glColor4f(r, g, b, 1);
6713
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6714
- if (flipV)
6715
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6716
- else
6717
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6718
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6719
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6720
-// Print(pv);
6721
- if (hasnorm)
6722
- {
6723
-// assert(qv.norm.normalized());
6724
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6725
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6726
- }
6727
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6728
- // boolean locked = false;
6729
- // float eps = 0.1f;
6730
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6731
-
6732
- // int dot = 0; //*/ (int)f.dot;
6733
-
6734
- // if ((dot&1) == 0)
6735
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6736
-
6737
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6738
- if (flipV)
6739
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6740
- else
6741
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6742
- // else
6743
- // {
6744
- // locked = true;
6745
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6746
- // }
6747
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6748
- SetColor(display, qv);
6749
- //gl.glColor4f(r, g, b, 1);
6750
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6751
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6752
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6753
-// Print(qv);
6754
- if (hasnorm)
6755
- {
6756
-// assert(rv.norm.normalized());
6757
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6758
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6759
- }
6760
-
6761
- // if ((dot&4) == 0)
6762
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6763
-
6764
- // if (wrap || !locked && (dot&8) != 0)
6765
- if (flipV)
6766
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6767
- else
6768
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6769
- // else
6770
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6771
-
6772
- // f.dot = dot;
6773
-
6774
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6775
- SetColor(display, rv);
6776
- //gl.glColor4f(r, g, b, 1);
6777
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6778
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6779
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6780
-// Print(rv);
6781
- //gl.glEnd();
6782
- }
6783
- else
6784
- {
6785
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6786
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6787
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6788
-
6789
- }
6790
-
6791
- if (false) // (attributes & WIREFRAME) != 0)
6792
- {
6793
- gl.glDisable(gl.GL_LIGHTING);
6794
-
6795
- gl.glBegin(gl.GL_LINE_LOOP);
6796
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6797
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6798
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6799
- gl.glEnd();
6800
-
6801
- gl.glEnable(gl.GL_LIGHTING);
6802
- }
6803
- }
6804
-
68056447 void drawSelf(ClickInfo info, int level, boolean select)
68066448 {
68076449 if (bRep == null)
....@@ -7373,83 +7015,83 @@
73737015 int spotw = spot.x + spot.width;
73747016 int spoth = spot.y + spot.height;
73757017 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7376
- if (CameraPane.Xmin > spot.x)
7377
- {
7378
- CameraPane.Xmin = spot.x;
7379
- }
7380
- if (CameraPane.Xmax < spotw)
7381
- {
7382
- CameraPane.Xmax = spotw;
7383
- }
7384
- if (CameraPane.Ymin > spot.y)
7385
- {
7386
- CameraPane.Ymin = spot.y;
7387
- }
7388
- if (CameraPane.Ymax < spoth)
7389
- {
7390
- CameraPane.Ymax = spoth;
7391
- }
7018
+// if (CameraPane.Xmin > spot.x)
7019
+// {
7020
+// CameraPane.Xmin = spot.x;
7021
+// }
7022
+// if (CameraPane.Xmax < spotw)
7023
+// {
7024
+// CameraPane.Xmax = spotw;
7025
+// }
7026
+// if (CameraPane.Ymin > spot.y)
7027
+// {
7028
+// CameraPane.Ymin = spot.y;
7029
+// }
7030
+// if (CameraPane.Ymax < spoth)
7031
+// {
7032
+// CameraPane.Ymax = spoth;
7033
+// }
73927034 spot.translate(32, 32);
73937035 spotw = spot.x + spot.width;
73947036 spoth = spot.y + spot.height;
73957037 info.g.setColor(Color.blue);
73967038 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7397
- if (CameraPane.Xmin > spot.x)
7398
- {
7399
- CameraPane.Xmin = spot.x;
7400
- }
7401
- if (CameraPane.Xmax < spotw)
7402
- {
7403
- CameraPane.Xmax = spotw;
7404
- }
7405
- if (CameraPane.Ymin > spot.y)
7406
- {
7407
- CameraPane.Ymin = spot.y;
7408
- }
7409
- if (CameraPane.Ymax < spoth)
7410
- {
7411
- CameraPane.Ymax = spoth;
7412
- }
7413
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7414
- info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7039
+// if (CameraPane.Xmin > spot.x)
7040
+// {
7041
+// CameraPane.Xmin = spot.x;
7042
+// }
7043
+// if (CameraPane.Xmax < spotw)
7044
+// {
7045
+// CameraPane.Xmax = spotw;
7046
+// }
7047
+// if (CameraPane.Ymin > spot.y)
7048
+// {
7049
+// CameraPane.Ymin = spot.y;
7050
+// }
7051
+// if (CameraPane.Ymax < spoth)
7052
+// {
7053
+// CameraPane.Ymax = spoth;
7054
+// }
7055
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7056
+ //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
74157057 spot.translate(0, -32);
74167058 info.g.setColor(Color.green);
74177059 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7418
- if (CameraPane.Xmin > spot.x)
7419
- {
7420
- CameraPane.Xmin = spot.x;
7421
- }
7422
- if (CameraPane.Xmax < spotw)
7423
- {
7424
- CameraPane.Xmax = spotw;
7425
- }
7426
- if (CameraPane.Ymin > spot.y)
7427
- {
7428
- CameraPane.Ymin = spot.y;
7429
- }
7430
- if (CameraPane.Ymax < spoth)
7431
- {
7432
- CameraPane.Ymax = spoth;
7433
- }
7060
+// if (CameraPane.Xmin > spot.x)
7061
+// {
7062
+// CameraPane.Xmin = spot.x;
7063
+// }
7064
+// if (CameraPane.Xmax < spotw)
7065
+// {
7066
+// CameraPane.Xmax = spotw;
7067
+// }
7068
+// if (CameraPane.Ymin > spot.y)
7069
+// {
7070
+// CameraPane.Ymin = spot.y;
7071
+// }
7072
+// if (CameraPane.Ymax < spoth)
7073
+// {
7074
+// CameraPane.Ymax = spoth;
7075
+// }
74347076 info.g.drawArc(boundary.x, boundary.y,
74357077 boundary.width, boundary.height, 0, 360);
74367078 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7437
- if (CameraPane.Xmin > boundary.x)
7438
- {
7439
- CameraPane.Xmin = boundary.x;
7440
- }
7441
- if (CameraPane.Xmax < boundary.x + boundary.width)
7442
- {
7443
- CameraPane.Xmax = boundary.x + boundary.width;
7444
- }
7445
- if (CameraPane.Ymin > boundary.y)
7446
- {
7447
- CameraPane.Ymin = boundary.y;
7448
- }
7449
- if (CameraPane.Ymax < boundary.y + boundary.height)
7450
- {
7451
- CameraPane.Ymax = boundary.y + boundary.height;
7452
- }
7079
+// if (CameraPane.Xmin > boundary.x)
7080
+// {
7081
+// CameraPane.Xmin = boundary.x;
7082
+// }
7083
+// if (CameraPane.Xmax < boundary.x + boundary.width)
7084
+// {
7085
+// CameraPane.Xmax = boundary.x + boundary.width;
7086
+// }
7087
+// if (CameraPane.Ymin > boundary.y)
7088
+// {
7089
+// CameraPane.Ymin = boundary.y;
7090
+// }
7091
+// if (CameraPane.Ymax < boundary.y + boundary.height)
7092
+// {
7093
+// CameraPane.Ymax = boundary.y + boundary.height;
7094
+// }
74537095 return;
74547096 }
74557097 }
....@@ -7466,7 +7108,7 @@
74667108 startX = info.x;
74677109 startY = info.y;
74687110
7469
- hitSomething = 0;
7111
+ hitSomething = -1;
74707112 cVector origin = new cVector();
74717113 //LA.xformPos(origin, toParent, origin);
74727114 Rectangle spot = new Rectangle();
....@@ -7499,7 +7141,7 @@
74997141 }
75007142
75017143 //System.out.println("info.modifiers = " + info.modifiers);
7502
- modified = (info.modifiers & CameraPane.META) != 0;
7144
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
75037145 //System.out.println("modified = " + modified);
75047146 //new Exception().printStackTrace();
75057147 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7527,7 +7169,7 @@
75277169 return true;
75287170 }
75297171
7530
- void doEditDrag0(ClickInfo info)
7172
+ void doEditDrag0(ClickInfo info, boolean opposite)
75317173 {
75327174 if (hitSomething == 0)
75337175 {
....@@ -7542,6 +7184,7 @@
75427184 //System.out.println("hitSomething = " + hitSomething);
75437185
75447186 double scale = 0.005f * info.camera.Distance();
7187
+
75457188 cVector xlate = new cVector();
75467189 //cVector xlate2 = new cVector();
75477190 switch (hitSomething)
....@@ -7552,9 +7195,9 @@
75527195
75537196 case hitCenter: // Translate
75547197
7555
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7198
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75567199
7557
- if (modified)
7200
+ if (modified || opposite)
75587201 {
75597202 //assert(false);
75607203 /*
....@@ -7600,10 +7243,10 @@
76007243 }
76017244 LA.xformDir(up, ClickInfo.matbuffer, up);
76027245 // if (!CameraPane.LOCALTRANSFORM)
7603
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7246
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
76047247 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
76057248 // if (!CameraPane.LOCALTRANSFORM)
7606
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7249
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
76077250 //LA.vecCross(up, cVector.Z, right2);
76087251
76097252 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7648,6 +7291,7 @@
76487291
76497292 if (modified)
76507293 {
7294
+ // Rotate 90 degrees
76517295 angle /= (Math.PI / 4);
76527296 angle = Math.floor(angle + 0.5);
76537297 angle *= (Math.PI / 4);
....@@ -7661,7 +7305,7 @@
76617305 }
76627306 /**/
76637307
7664
- switch (info.pane.renderCamera.viewCode)
7308
+ switch (info.pane.RenderCamera().viewCode)
76657309 {
76667310 case 1: // '\001'
76677311 LA.matZRotate(toParent, angle);
....@@ -7689,24 +7333,27 @@
76897333
76907334 case hitScale: // scale
76917335 double hScale = (double) (info.x - centerPt.x) / 32;
7336
+ double sign = 1;
7337
+ if (hScale < 0)
7338
+ {
7339
+ sign = -1;
7340
+ }
7341
+ hScale = sign*Math.pow(sign*hScale, scale * 50);
76927342 if (hScale < 0.01)
76937343 {
7694
- hScale = 0.01;
7344
+ //hScale = 0.01;
76957345 }
7696
- hScale = Math.pow(hScale, scale * 50);
7697
- if (hScale < 0.01)
7698
- {
7699
- hScale = 0.01;
7700
- }
7346
+
77017347 double vScale = (double) (info.y - centerPt.y) / 32;
7702
- if (vScale < 0.01)
7348
+ sign = 1;
7349
+ if (vScale < 0)
77037350 {
7704
- vScale = 0.01;
7351
+ sign = -1;
77057352 }
7706
- vScale = Math.pow(vScale, scale * 50);
7353
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
77077354 if (vScale < 0.01)
77087355 {
7709
- vScale = 0.01;
7356
+ //vScale = 0.01;
77107357 }
77117358 LA.matCopy(startMat, toParent);
77127359 /**/
....@@ -7717,17 +7364,24 @@
77177364 }
77187365 /**/
77197366
7720
- switch (info.pane.renderCamera.viewCode)
7367
+ double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2);
7368
+
7369
+ if (totalScale < 0.01)
7370
+ {
7371
+ totalScale = 0.01;
7372
+ }
7373
+
7374
+ switch (info.pane.RenderCamera().viewCode)
77217375 {
77227376 case 3: // '\001'
77237377 if (modified)
77247378 {
77257379 //LA.matScale(toParent, 1, hScale, vScale);
7726
- LA.matScale(toParent, vScale, 1, 1);
7380
+ LA.matScale(toParent, totalScale, 1, 1);
77277381 } // vScale, 1);
77287382 else
77297383 {
7730
- LA.matScale(toParent, vScale, vScale, vScale);
7384
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
77317385 } // vScale, 1);
77327386 break;
77337387
....@@ -7735,10 +7389,10 @@
77357389 if (modified)
77367390 {
77377391 //LA.matScale(toParent, hScale, 1, vScale);
7738
- LA.matScale(toParent, 1, vScale, 1);
7392
+ LA.matScale(toParent, 1, totalScale, 1);
77397393 } else
77407394 {
7741
- LA.matScale(toParent, vScale, 1, vScale);
7395
+ LA.matScale(toParent, totalScale, 1, totalScale);
77427396 }
77437397 break;
77447398
....@@ -7746,10 +7400,10 @@
77467400 if (modified)
77477401 {
77487402 //LA.matScale(toParent, hScale, vScale, 1);
7749
- LA.matScale(toParent, 1, 1, vScale);
7403
+ LA.matScale(toParent, 1, 1, totalScale);
77507404 } else
77517405 {
7752
- LA.matScale(toParent, vScale, vScale, 1);
7406
+ LA.matScale(toParent, totalScale, totalScale, 1);
77537407 }
77547408 break;
77557409 }
....@@ -7882,14 +7536,22 @@
78827536 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
78837537 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
78847538 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7539
+
7540
+ String objname;
7541
+
78857542 if (false) //parent != null)
78867543 {
7887
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7544
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
78887545 } else
78897546 {
7890
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7547
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count - 1) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
78917548 } // + super.toString();
78927549 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7550
+
7551
+ if (!Globals.ADVANCED)
7552
+ return objname;
7553
+
7554
+ return objname + " " + System.identityHashCode(this);
78937555 }
78947556
78957557 public int hashCode()
....@@ -7945,6 +7607,7 @@
79457607 objectUI.closeUI();
79467608 if (editWindow != null)
79477609 {
7610
+ editWindow.ctrlPanel.FlushUI();
79487611 editWindow.refreshContents();
79497612 } // ? new
79507613 objectUI = null;
....@@ -7965,7 +7628,7 @@
79657628 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
79667629
79677630 Object3D /*Composite*/ parent;
7968
- Object3D /*Composite*/ fileparent;
7631
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
79697632
79707633 double[][] toParent; // dynamic matrix
79717634 double[][] fromParent;
....@@ -8080,7 +7743,7 @@
80807743 {
80817744 assert(bRep != null);
80827745 if (!(support instanceof GenericJoint)) // support.bRep != null)
8083
- GrafreeD.Assert(support.bRep == bRep.support);
7746
+ Grafreed.Assert(support.bRep == bRep.support);
80847747 }
80857748 else
80867749 {
....@@ -8129,9 +7792,9 @@
81297792 private static cVector edge2 = new cVector();
81307793 //private static cVector norm = new cVector();
81317794 /*transient private*/ int hitSomething;
8132
- private static final int hitCenter = 1;
8133
- private static final int hitScale = 2;
8134
- private static final int hitRotate = 3;
7795
+ static final int hitCenter = 1;
7796
+ static final int hitScale = 2;
7797
+ static final int hitRotate = 3;
81357798 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
81367799 /*transient*/ private Point centerPt;
81377800 /*transient*/ private int startX;
....@@ -8163,6 +7826,8 @@
81637826 {
81647827 Object3D targ = this;
81657828
7829
+ targ.NORMALPUSH = obj.NORMALPUSH;
7830
+
81667831 if (obj.material != null)
81677832 {
81687833 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))