Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
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;
....@@ -20,6 +21,19 @@
2021 static final long serialVersionUID = 5022536242724664900L;
2122
2223 ScriptNode scriptnode;
24
+
25
+ void InitOthers()
26
+ {
27
+ if (projectedVertices == null || projectedVertices.length <= 2)
28
+ {
29
+ projectedVertices = new Object3D.cVector2[3];
30
+ }
31
+ for (int i = 0; i < 3; i++)
32
+ {
33
+ projectedVertices[i] = new cVector2(); // Others
34
+ }
35
+ projectedVertices[0].x = 100; // bump
36
+ }
2337
2438 void MinMax(cVector minima, cVector maxima)
2539 {
....@@ -286,6 +300,7 @@
286300 }
287301
288302 boolean live = false;
303
+ boolean dontselect = false;
289304 boolean hide = false;
290305 boolean link2master = false; // performs reset support/master at each frame
291306 boolean marked = false; // animation node
....@@ -295,6 +310,8 @@
295310 boolean random = false;
296311 boolean speedup = false;
297312 boolean rewind = false;
313
+
314
+ float NORMALPUSH = 0;
298315
299316 Object3D support;
300317
....@@ -355,7 +372,7 @@
355372
356373 int MemorySize()
357374 {
358
- if (memorysize == 0)
375
+ if (true) // memorysize == 0)
359376 {
360377 try
361378 {
....@@ -415,16 +432,16 @@
415432 {
416433 Object3D copy = this;
417434
418
- Camera parentcam = CameraPane.theRenderer.manipCamera;
435
+ Camera parentcam = Globals.theRenderer.ManipCamera();
419436
420
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
437
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
421438 {
422
- parentcam = CameraPane.theRenderer.cameras[1];
439
+ parentcam = Globals.theRenderer.Cameras()[1];
423440 }
424441
425
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
442
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
426443 {
427
- parentcam = CameraPane.theRenderer.cameras[0];
444
+ parentcam = Globals.theRenderer.Cameras()[0];
428445 }
429446
430447 if (this == parentcam)
....@@ -432,7 +449,7 @@
432449 //assert(this instanceof Camera);
433450
434451 for (int count = parentcam.GetTransformCount(); --count>=0;)
435
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
452
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
436453 }
437454
438455 copy.marked ^= true;
....@@ -452,7 +469,7 @@
452469 //assert(this instanceof Camera);
453470
454471 for (int count = parentcam.GetTransformCount(); --count>=0;)
455
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
472
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
456473 }
457474
458475 copy.Touch(); // display list issue
....@@ -587,7 +604,7 @@
587604 return;
588605 }
589606
590
- if (CameraPane.fromscript)
607
+ if (Globals.fromscript)
591608 {
592609 transformcount = 0;
593610 return;
....@@ -745,7 +762,7 @@
745762
746763 int GetTransformCount()
747764 {
748
- // marde pour serialization de Texture
765
+ // patch pour serialization de Texture
749766 resetmaxcount();
750767 resettransformcount();
751768 resetstep();
....@@ -779,9 +796,12 @@
779796 // factor = CameraPane.STEP;
780797 // }
781798
782
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
799
+ if (marked && Globals.isLIVE() && live &&
800
+ //TEMP21aug2018
801
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
802
+ currentframe != Globals.framecount)
783803 {
784
- currentframe = CameraPane.framecount;
804
+ currentframe = Globals.framecount;
785805
786806 // System.err.println("transformcount = " + transformcount);
787807 // System.err.println("factor = " + factor);
....@@ -893,6 +913,11 @@
893913 fromParent = null; // LA.newMatrix();
894914 bRep = null; // new BoundaryRep();
895915
916
+ if (oname != null && oname.equals("LeftHand"))
917
+ {
918
+ name = oname;
919
+ }
920
+
896921 /*
897922 float hue = (float)Math.random();
898923 Color col;
....@@ -935,7 +960,7 @@
935960
936961 public Object clone()
937962 {
938
- return GraphreeD.clone(this);
963
+ return Grafreed.clone(this);
939964 }
940965
941966 Object3D copyExpand()
....@@ -1446,7 +1471,16 @@
14461471 // if (other == null)
14471472 // return;
14481473
1449
- System.out.println("Link support this = " + this + "; other = " + other);
1474
+ if (other != null)
1475
+ {
1476
+ BoundaryRep.SEUIL = other.material.cameralight;
1477
+
1478
+ // Set default to 0.1
1479
+ BoundaryRep.SEUIL /= 4; // 2;
1480
+ System.out.println("SEUIL = " + BoundaryRep.SEUIL);
1481
+ }
1482
+
1483
+ System.out.println("Link this = " + this + "; support = " + other);
14501484
14511485 //if (bRep != null)
14521486 // bRep.linkVerticesThis(other.bRep);
....@@ -1701,7 +1735,7 @@
17011735 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17021736 o.bRep = transientrep;
17031737 if (clone)
1704
- o.bRep = (BoundaryRep) GraphreeD.clone(transientrep);
1738
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17051739 o.CreateMaterial();
17061740 o.SetAttributes(this, -1);
17071741 //parent
....@@ -1714,7 +1748,7 @@
17141748 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17151749 o.bRep = bRep;
17161750 if (clone)
1717
- o.bRep = (BoundaryRep) GraphreeD.clone(bRep);
1751
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17181752 o.CreateMaterial();
17191753 //o.overwriteThis(this, -1);
17201754 o.SetAttributes(this, -1);
....@@ -1756,7 +1790,7 @@
17561790 // {
17571791 // assert(bRep == null);
17581792 // Object3D o = new Object3D("Geometry:" + this.name);
1759
-// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep);
1793
+// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
17601794 // o.CreateMaterial();
17611795 // parent.addChild(o);
17621796 // }
....@@ -1765,7 +1799,7 @@
17651799 // {
17661800 // assert(transientrep == null);
17671801 // Object3D o = new Object3D("Geometry:" + this.name);
1768
-// o.bRep = (BoundaryRep) GraphreeD.clone(bRep);
1802
+// o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
17691803 // o.CreateMaterial();
17701804 // parent.addChild(o);
17711805 // }
....@@ -1801,12 +1835,15 @@
18011835 if (obj.name == null)
18021836 continue; // can't be a null one
18031837
1838
+ // Try perfect match first.
18041839 if (n.equals(obj.name))
18051840 {
18061841 theobj = obj;
18071842 count++;
18081843 }
18091844 }
1845
+
1846
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18101847
18111848 if (count != 1)
18121849 for (int i=Size(); --i>=0;)
....@@ -1816,8 +1853,9 @@
18161853 if (obj.name == null)
18171854 continue; // can't be a null one
18181855
1819
- //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count
1820
- if (n.startsWith(obj.name))
1856
+ String name = obj.name.split(":")[0]; // Poser generates a count
1857
+ //if (n.startsWith(obj.name))
1858
+ if (n.contains(name))
18211859 {
18221860 theobj = obj;
18231861 count++;
....@@ -2120,15 +2158,8 @@
21202158 if (/*parent != null &&*/ material == null)
21212159 {
21222160 material = new cMaterial(GetMaterial());
2123
- if (projectedVertices == null || projectedVertices.length <= 2)
2124
- {
2125
- projectedVertices = new Object3D.cVector2[3];
2126
- }
2127
- for (int i = 0; i < 3; i++)
2128
- {
2129
- projectedVertices[i] = new cVector2(); // Others
2130
- }
2131
- projectedVertices[0].x = 100; // bump
2161
+
2162
+ InitOthers();
21322163
21332164 if (this instanceof Camera)
21342165 {
....@@ -2278,6 +2309,7 @@
22782309 {
22792310 if (newWindow)
22802311 {
2312
+ new Exception().printStackTrace();
22812313 System.exit(0);
22822314 if (parent != null)
22832315 {
....@@ -2454,13 +2486,13 @@
24542486 return retval;
24552487 }
24562488
2457
- void doEditDrag(ClickInfo info)
2489
+ void doEditDrag(ClickInfo info, boolean opposite)
24582490 {
24592491 switch (doSomething)
24602492 {
24612493 case 1: // '\001'
24622494 //super.
2463
- doEditDrag0(info);
2495
+ doEditDrag0(info, opposite);
24642496 break;
24652497
24662498 case 2: // '\002'
....@@ -2473,11 +2505,11 @@
24732505 {
24742506 //sel.hitSomething = childToDrag.hitSomething;
24752507 //childToDrag.doEditDrag(info);
2476
- sel.doEditDrag(info);
2508
+ sel.doEditDrag(info, opposite);
24772509 } else
24782510 {
24792511 //super.
2480
- doEditDrag0(info);
2512
+ doEditDrag0(info, opposite);
24812513 }
24822514 }
24832515 break;
....@@ -2732,6 +2764,24 @@
27322764 blockloop = false;
27332765 }
27342766
2767
+ void GenNormalsMINE()
2768
+ {
2769
+ if (blockloop)
2770
+ return;
2771
+
2772
+ blockloop = true;
2773
+ GenNormalsMINE0();
2774
+ for (int i = 0; i < Children().Size(); i++)
2775
+ {
2776
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2777
+ if (child == null)
2778
+ continue;
2779
+ child.GenNormalsMINE();
2780
+// Children().release(i);
2781
+ }
2782
+ blockloop = false;
2783
+ }
2784
+
27352785 void ClearColors()
27362786 {
27372787 if (blockloop)
....@@ -2866,7 +2916,8 @@
28662916 {
28672917 if (bRep != null)
28682918 {
2869
- bRep.GenUV();
2919
+ bRep.GenUV(); //1);
2920
+ //bRep.UnfoldUV();
28702921 Touch();
28712922 }
28722923 }
....@@ -2876,6 +2927,15 @@
28762927 if (bRep != null)
28772928 {
28782929 bRep.GenerateNormals(crease);
2930
+ Touch();
2931
+ }
2932
+ }
2933
+
2934
+ void GenNormalsMINE0()
2935
+ {
2936
+ if (bRep != null)
2937
+ {
2938
+ bRep.GenerateNormalsMINE();
28792939 Touch();
28802940 }
28812941 }
....@@ -2932,6 +2992,33 @@
29322992 blockloop = false;
29332993 }
29342994
2995
+ void TransformChildren()
2996
+ {
2997
+ if (toParent != null)
2998
+ {
2999
+ for (int i=Size(); --i>=0;)
3000
+ {
3001
+ Object3D v = get(i);
3002
+
3003
+ if (v.toParent == null)
3004
+ {
3005
+ v.toParent = LA.newMatrix();
3006
+ v.fromParent = LA.newMatrix();
3007
+ }
3008
+
3009
+// LA.matConcat(v.toParent, toParent, v.toParent);
3010
+// LA.matConcat(fromParent, v.fromParent, v.fromParent);
3011
+ LA.matConcat(toParent, v.toParent, v.toParent);
3012
+ LA.matConcat(v.fromParent, fromParent, v.fromParent);
3013
+ }
3014
+
3015
+ toParent = null; // LA.matIdentity(toParent);
3016
+ fromParent = null; // LA.matIdentity(fromParent);
3017
+
3018
+ Touch();
3019
+ }
3020
+ }
3021
+
29353022 void TransformGeometry()
29363023 {
29373024 Object3D obj = this;
....@@ -3153,9 +3240,11 @@
31533240
31543241 BoundaryRep sup = bRep.support;
31553242 bRep.support = null;
3156
- BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep);
3243
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
31573244 // bRep.SplitInTwo(onlyone); // thread...
3158
- temprep.SplitInTwo(reduction34, onlyone);
3245
+
3246
+ while(temprep.SplitInTwo(reduction34, onlyone));
3247
+
31593248 bRep = temprep;
31603249 bRep.support = sup;
31613250 Touch();
....@@ -3677,7 +3766,7 @@
36773766 if (child == null)
36783767 continue;
36793768
3680
- if (GraphreeD.RENDERME > 0)
3769
+ if (Grafreed.RENDERME > 0)
36813770 {
36823771 if (child instanceof Merge)
36833772 ((Merge)child).renderme();
....@@ -3717,7 +3806,7 @@
37173806
37183807 boolean getCentroid(cVector centroid, boolean xform)
37193808 {
3720
- assert(false);
3809
+// for speaker assert(false);
37213810 if (blockloop)
37223811 return false;
37233812
....@@ -3828,7 +3917,7 @@
38283917 if (child == null)
38293918 continue;
38303919
3831
- if (GraphreeD.RENDERME > 0)
3920
+ if (Grafreed.RENDERME > 0)
38323921 {
38333922 if (child instanceof Merge)
38343923 ((Merge)child).renderme();
....@@ -4023,7 +4112,7 @@
40234112 if (child == null)
40244113 continue;
40254114
4026
- if (GraphreeD.RENDERME > 0)
4115
+ if (Grafreed.RENDERME > 0)
40274116 {
40284117 if (child instanceof Merge)
40294118 ((Merge)child).renderme();
....@@ -4111,7 +4200,7 @@
41114200 if (blockloop)
41124201 return;
41134202
4114
- for (int i=0; i<size(); i++)
4203
+ for (int i=0; i<Size(); i++)
41154204 {
41164205 if (get(i).parent != this)
41174206 {
....@@ -4120,6 +4209,22 @@
41204209 }
41214210 blockloop = true;
41224211 get(i).RepairParent();
4212
+ blockloop = false;
4213
+ }
4214
+ }
4215
+
4216
+ void RepairShadow()
4217
+ {
4218
+ if (blockloop)
4219
+ return;
4220
+
4221
+ if (this.material != null)
4222
+ this.InitOthers();
4223
+
4224
+ for (int i=0; i<Size(); i++)
4225
+ {
4226
+ blockloop = true;
4227
+ get(i).RepairShadow();
41234228 blockloop = false;
41244229 }
41254230 }
....@@ -4515,16 +4620,28 @@
45154620
45164621 Object3D GetFileRoot()
45174622 {
4623
+ if (overflow)
4624
+ return null;
4625
+
4626
+ overflow = true;
4627
+
4628
+ Object3D pfr = null;
4629
+
45184630 if (parent == null && fileparent == null)
4519
- return this;
4631
+ pfr = this;
45204632
45214633 if (parent == null && fileparent != null) // V4.gfd???
4522
- return fileparent;
4634
+ pfr = fileparent;
45234635
4524
- if (parent == null)
4525
- return this;
4636
+ if (pfr == null && parent == null)
4637
+ pfr = this;
45264638
4527
- return parent.GetFileRoot();
4639
+ if (pfr == null)
4640
+ pfr = parent.GetFileRoot();
4641
+
4642
+ overflow = false;
4643
+
4644
+ return pfr;
45284645 }
45294646
45304647 cTreePath GetPath()
....@@ -4602,7 +4719,7 @@
46024719
46034720 cTreePath SelectLeaf(int indexcount, boolean deselect)
46044721 {
4605
- if (hide)
4722
+ if (hide || dontselect)
46064723 return null;
46074724
46084725 if (count <= 0)
....@@ -4628,7 +4745,7 @@
46284745
46294746 cTreePath Select(int indexcount, boolean deselect)
46304747 {
4631
- if (hide)
4748
+ if (hide || dontselect)
46324749 return null;
46334750
46344751 if (count <= 0)
....@@ -4778,7 +4895,7 @@
47784895 return globalTransform;
47794896 }
47804897
4781
- void PreprocessOcclusion(CameraPane cp)
4898
+ void PreprocessOcclusion(iCameraPane cp)
47824899 {
47834900 /*
47844901 if (AOdone)
....@@ -4925,7 +5042,8 @@
49255042 } else //
49265043 if (editWindow != null)
49275044 {
4928
- editWindow.cameraView.lighttouched = true;
5045
+ //editWindow.cameraView.lighttouched = true;
5046
+ Globals.lighttouched = true;
49295047 }
49305048 }
49315049
....@@ -5079,10 +5197,34 @@
50795197
50805198 // System.out.println("Fullname = " + fullname);
50815199
5082
- if (fullname.name.indexOf(":") == -1)
5083
- return fullname.name;
5200
+ // Does not work on Windows due to C:
5201
+// if (fullname.name.indexOf(":") == -1)
5202
+// return fullname.name;
5203
+//
5204
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
50845205
5085
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5206
+ String[] split = fullname.name.split(":");
5207
+
5208
+ if (split.length == 0)
5209
+ {
5210
+ return "";
5211
+ }
5212
+
5213
+ if (split.length <= 2)
5214
+ {
5215
+ if (fullname.name.endsWith(":"))
5216
+ {
5217
+ // Windows
5218
+ return fullname.name.substring(0, fullname.name.length()-1);
5219
+ }
5220
+
5221
+ return split[0];
5222
+ }
5223
+
5224
+ // Windows
5225
+ assert(split.length == 4);
5226
+
5227
+ return split[0] + ":" + split[1];
50865228 }
50875229
50885230 static String GetBump(cTexture fullname)
....@@ -5091,10 +5233,38 @@
50915233 return "";
50925234
50935235 // System.out.println("Fullname = " + fullname);
5094
- if (fullname.name.indexOf(":") == -1)
5095
- return "";
5096
-
5097
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5236
+ // Does not work on Windows due to C:
5237
+// if (fullname.name.indexOf(":") == -1)
5238
+// return "";
5239
+//
5240
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5241
+ String[] split = fullname.name.split(":");
5242
+
5243
+ if (split.length == 0)
5244
+ {
5245
+ return "";
5246
+ }
5247
+
5248
+ if (split.length == 1)
5249
+ {
5250
+ return "";
5251
+ }
5252
+
5253
+ if (split.length == 2)
5254
+ {
5255
+ if (fullname.name.endsWith(":"))
5256
+ {
5257
+ // Windows
5258
+ return "";
5259
+ }
5260
+
5261
+ return split[1];
5262
+ }
5263
+
5264
+ // Windows
5265
+ assert(split.length == 4);
5266
+
5267
+ return split[2] + ":" + split[3];
50985268 }
50995269
51005270 String GetPigmentTexture()
....@@ -5168,7 +5338,7 @@
51685338 System.out.print("; textures = " + textures);
51695339 System.out.println("; usedtextures = " + usedtextures);
51705340
5171
- if (GetTextures() == null)
5341
+ if (GetTextures() == null) // What is that??
51725342 GetTextures().name = ":";
51735343
51745344 String texname = tex;
....@@ -5237,25 +5407,22 @@
52375407 }
52385408 }
52395409
5240
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5410
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52415411 {
52425412 Draw(display, root, selected, blocked);
52435413 }
52445414
5245
- static cMaterial[] materialstack = new cMaterial[65536];
5246
- static boolean[] selectedstack = new boolean[65536];
5247
- static int materialdepth = 0;
5248
-
52495415 boolean NeedSupport()
52505416 {
52515417 return
5252
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5418
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
52535419 // PROBLEM with CROWD!!
5254
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5420
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
52555421 }
52565422
5423
+ static boolean DEBUG_SELECTION = false;
52575424
5258
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5425
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52595426 {
52605427 Invariants(); // june 2013
52615428
....@@ -5264,8 +5431,8 @@
52645431 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
52655432 }
52665433
5267
- if (display.drawMode == CameraPane.SELECTION &&
5268
- hide)
5434
+ if (display.DrawMode() == iCameraPane.SELECTION &&
5435
+ (hide || dontselect))
52695436 return;
52705437
52715438 if (name != null && name.contains("sclera"))
....@@ -5280,10 +5447,10 @@
52805447 if (name != null && name.contains("sclera"))
52815448 name = name;
52825449
5283
- if (this instanceof CheckerIG)
5450
+ if (this instanceof Checker)
52845451 return;
52855452
5286
- if (display.drawMode == display.SHADOW && PASSTEST)
5453
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
52875454 return;
52885455
52895456 if (count <= 0)
....@@ -5291,13 +5458,13 @@
52915458 return;
52925459 }
52935460
5294
- if ((//display.drawMode == CameraPane.SHADOW ||
5295
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5461
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5462
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
52965463 {
52975464 return;
52985465 }
52995466
5300
- javax.media.opengl.GL gl = display.GetGL();
5467
+ //javax.media.opengl.GL gl = display.GetGL();
53015468
53025469 /*
53035470 if (touched)
....@@ -5333,15 +5500,15 @@
53335500
53345501 boolean compiled = false;
53355502
5336
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5503
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53375504
5338
- if (!selectmode && //display.drawMode != display.SELECTION &&
5505
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53395506 (touched || (bRep != null && bRep.displaylist <= 0)))
53405507 {
5341
- display.lighttouched = true;
5508
+ Globals.lighttouched = true;
53425509 } // all panes...
5343
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5344
- if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&
5510
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5511
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53455512 (touched || (bRep != null && bRep.displaylist <= 0)))
53465513 {
53475514 if (!(this instanceof Composite))
....@@ -5349,7 +5516,7 @@
53495516 //if (displaylist == -1 && usecalllists)
53505517 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
53515518 {
5352
- bRep.displaylist = gl.glGenLists(1);
5519
+ bRep.displaylist = display.GenList();
53535520 assert(bRep.displaylist != 0);
53545521 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
53555522 //System.out.println("\tgen list " + list);
....@@ -5361,18 +5528,20 @@
53615528 if (usecalllists)
53625529 {
53635530 // System.err.println("new list " + bRep.displaylist + " for " + this);
5364
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5531
+ display.NewList(bRep.displaylist);
53655532 }
5533
+
53665534 CallList(display, root, selected, blocked);
5535
+
53675536 // compiled = true;
53685537 if (usecalllists)
53695538 {
53705539 // System.err.println("end list " + bRep.displaylist + " for " + this);
5371
- gl.glEndList();
5540
+ display.EndList();
53725541 }
53735542 //gl.glDrawBuffer(gl.GL_BACK);
53745543 // XXX touched = false;
5375
- display.lighttouched = true; // all panes...
5544
+ Globals.lighttouched = true; // all panes...
53765545 }
53775546
53785547 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5411,12 +5580,12 @@
54115580
54125581 // frustum culling
54135582 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5414
- && display.drawMode != CameraPane.SELECTION)
5583
+ && display.DrawMode() != iCameraPane.SELECTION)
54155584 {
5416
- if (display.drawMode == CameraPane.SHADOW)
5585
+ if (display.DrawMode() == iCameraPane.SHADOW)
54175586 {
54185587 if (!link2master // tricky to cull in shadow mode.
5419
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5588
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54205589 {
54215590 //System.out.print("CULLED");
54225591 culled = true;
....@@ -5424,7 +5593,7 @@
54245593 }
54255594 else
54265595 //GetBRep().getBounds(v0, v1, this);
5427
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5596
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54285597 culled = true;
54295598
54305599 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5460,11 +5629,11 @@
54605629
54615630
54625631 if (!culled)
5463
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5632
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
54645633 {
54655634 if (GetBRep() != null)
54665635 {
5467
- CameraPane.NextIndex(this, gl);
5636
+ display.NextIndex();
54685637 // vertex color conflict : gl.glCallList(list);
54695638 DrawNode(display, root, selected);
54705639 if (this instanceof BezierPatch)
....@@ -5486,53 +5655,7 @@
54865655 color[2] /= 2;
54875656 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
54885657 */
5489
- if (material != null)
5490
- {
5491
- materialstack[materialdepth] = material;
5492
- selectedstack[materialdepth] = selected;
5493
- cStatic.objectstack[materialdepth++] = this;
5494
- //System.out.println("material " + material);
5495
- //Applet3D.tracein(this, selected);
5496
- display.vector2buffer = projectedVertices;
5497
- if (this instanceof Camera)
5498
- {
5499
- display.options1[0] = material.shift;
5500
- //System.out.println("shift " + material.shift);
5501
- display.options1[1] = material.lightarea;
5502
- display.options1[2] = material.shadowbias;
5503
- display.options1[3] = material.aniso;
5504
- display.options1[4] = material.anisoV;
5505
- display.options2[0] = material.opacity;
5506
- display.options2[1] = material.diffuse;
5507
- display.options2[2] = material.factor;
5508
-
5509
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5510
- display.options3[3] = material.cameralight/0.2f;
5511
-
5512
- // if (display.CURRENTANTIALIAS > 0)
5513
- // display.options3[3] /= 4;
5514
-
5515
- /*
5516
- System.out.println("Focus = " + display.options1[0]);
5517
- System.out.println("Aperture = " + display.options1[1]);
5518
- System.out.println("ShadowBlur = " + display.options1[2]);
5519
- System.out.println("Antialiasing = " + display.options1[3]);
5520
- System.out.println("Fog = " + display.options2[0]);
5521
- System.out.println("Intensity = " + display.options2[1]);
5522
- System.out.println("Elevation = " + display.options2[2]);
5523
- /**/
5524
- } else
5525
- {
5526
- material.Draw(display, selected);
5527
- }
5528
- } else
5529
- {
5530
- if (selected && CameraPane.flash)
5531
- {
5532
- display.modelParams4[1] = 100;
5533
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5534
- }
5535
- }
5658
+ display.PushMaterial(this, selected);
55365659
55375660 //System.out.println("call list " + list);
55385661 //System.out.println();
....@@ -5551,7 +5674,17 @@
55515674 tex = GetTextures();
55525675 }
55535676
5554
- display.BindTextures(tex, texres);
5677
+ boolean failed = false;
5678
+
5679
+ try
5680
+ {
5681
+ display.BindTextures(tex, texres);
5682
+ }
5683
+ catch (Exception e)
5684
+ {
5685
+ System.err.println("FAILED: " + this);
5686
+ failed = true;
5687
+ }
55555688
55565689 if (!compiled)
55575690 {
....@@ -5567,30 +5700,16 @@
55675700
55685701 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55695702 assert(bRep.displaylist != 0);
5570
- gl.glCallList(bRep.displaylist);
5703
+ display.CallList(bRep.displaylist);
55715704 // june 2013 drawSelf(display, root, selected);
55725705 }
55735706 }
55745707 }
55755708
5576
- display.ReleaseTextures(tex);
5577
-
5578
- //if (parent != null && parent.GetMaterial() != null)
5579
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5580
- if (material != null)
5581
- {
5582
- materialdepth -= 1;
5583
- if (materialdepth > 0)
5584
- {
5585
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5586
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5587
- }
5588
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5589
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5590
- {
5591
- display.modelParams4[1] = GetMaterial().cameralight;
5592
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5593
- }
5709
+ if (!failed)
5710
+ display.ReleaseTextures(tex);
5711
+
5712
+ display.PopMaterial(this, selected);
55945713 }
55955714
55965715 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5632,7 +5751,7 @@
56325751 // resetMasterNode();
56335752 }
56345753
5635
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5754
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56365755 {
56375756 if (GetBRep() == null)
56385757 {
....@@ -5715,8 +5834,11 @@
57155834 boolean flipV = false; // true;
57165835 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57175836
5718
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5837
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57195838 {
5839
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5840
+ return;
5841
+
57205842 if (hide)
57215843 return;
57225844 // shadow optimisation
....@@ -5774,16 +5896,7 @@
57745896 // // ??????????????????????????? Touch();
57755897 // }
57765898
5777
- if (material != null)
5778
- {
5779
- materialstack[materialdepth] = material;
5780
- selectedstack[materialdepth] = selected;
5781
- cStatic.objectstack[materialdepth++] = this;
5782
- //System.out.println("material " + material);
5783
- //Applet3D.tracein("selected ", selected);
5784
- display.vector2buffer = projectedVertices;
5785
- material.Draw(display, selected);
5786
- }
5899
+display.PushMaterial2(this, selected);
57875900
57885901 Object3D child;
57895902 boolean sel;
....@@ -5807,12 +5920,12 @@
58075920 if (!child.HasTransparency())
58085921 {
58095922 sel = root != null && root.selection != null && root.selection.indexOf(child) != -1;
5810
- // GraphreeD.tracein("draw ", child);
5923
+ // GrafreeD.tracein("draw ", child);
58115924 boolean wasblocked = blockdraw;
58125925 blockdraw = true;
58135926 child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected());
58145927 blockdraw = false;
5815
- // GraphreeD.traceout("draw ", child);
5928
+ // GrafreeD.traceout("draw ", child);
58165929 }
58175930
58185931 release(i);
....@@ -5835,19 +5948,7 @@
58355948 */
58365949 //depth += 1;
58375950
5838
- if (material != null)
5839
- {
5840
- materialdepth -= 1;
5841
- if (materialdepth > 0)
5842
- {
5843
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5844
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5845
- }
5846
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5847
- //else
5848
- //material.Draw(display, false);
5849
- }
5850
-
5951
+display.PopMaterial2(this);
58515952 /*
58525953 display.ReleaseTextures(tex);
58535954 */
....@@ -5858,10 +5959,13 @@
58585959
58595960 //static cVector min,max;
58605961
5861
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5962
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
58625963 {
5863
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
5964
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58645965 return; // no shadow for transparent objects
5966
+
5967
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5968
+ return;
58655969
58665970 if (hide)
58675971 return;
....@@ -5903,11 +6007,12 @@
59036007 return;
59046008 }
59056009
6010
+ //bRep.GenUV(1/material.diffuseness);
59066011 // bRep.lock = true;
59076012
5908
- javax.media.opengl.GL gl = display.GetGL();
6013
+ //javax.media.opengl.GL gl = display.GetGL();
59096014
5910
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
6015
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59116016 {
59126017 int fc = bRep.FaceCount();
59136018 int vc = bRep.VertexCount();
....@@ -5922,23 +6027,7 @@
59226027
59236028 bRep.getMinMax(min, max, 100);
59246029
5925
- gl.glBegin(gl.GL_LINES);
5926
-
5927
- gl.glVertex3d(min.x, min.y, min.z);
5928
- gl.glVertex3d(min.x, min.y, max.z);
5929
- gl.glVertex3d(min.x, min.y, min.z);
5930
- gl.glVertex3d(min.x, max.y, min.z);
5931
- gl.glVertex3d(min.x, min.y, min.z);
5932
- gl.glVertex3d(max.x, min.y, min.z);
5933
-
5934
- gl.glVertex3d(max.x, max.y, max.z);
5935
- gl.glVertex3d(min.x, max.y, max.z);
5936
- gl.glVertex3d(max.x, max.y, max.z);
5937
- gl.glVertex3d(max.x, min.y, max.z);
5938
- gl.glVertex3d(max.x, max.y, max.z);
5939
- gl.glVertex3d(max.x, max.y, min.z);
5940
-
5941
- gl.glEnd();
6030
+ display.DrawBox(min, max);
59426031
59436032 return;
59446033 }
....@@ -5982,7 +6071,7 @@
59826071 {
59836072 //throw new Error();
59846073
5985
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6074
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
59866075
59876076 int[] strips = bRep.getRawIndices();
59886077
....@@ -5992,178 +6081,14 @@
59926081 new Exception().printStackTrace();
59936082 return;
59946083 }
5995
-
5996
- // TRIANGLE STRIP ARRAY
5997
- if (bRep.trimmed)
5998
- {
5999
- float[] v = bRep.getRawVertices();
6000
- float[] n = bRep.getRawNormals();
6001
- float[] c = bRep.getRawColors();
6002
- float[] uv = bRep.getRawUVMap();
6003
-
6004
- int count2 = 0;
6005
- int count3 = 0;
6006
-
6007
- if (n.length > 0)
6008
- {
6009
- for (int i = 0; i < strips.length; i++)
6010
- {
6011
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6012
-
6013
- /*
6014
- boolean locked = false;
6015
- float eps = 0.1f;
6016
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6017
-
6018
- int dot = 0;
6019
-
6020
- if ((dot&1) == 0)
6021
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6022
-
6023
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6024
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6025
- else
6026
- {
6027
- locked = true;
6028
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6029
- }
6030
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6031
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6032
- if (hasnorm)
6033
- {
6034
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6035
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6036
- }
6037
-
6038
- if ((dot&4) == 0)
6039
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6040
-
6041
- if (wrap || !locked && (dot&8) != 0)
6042
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6043
- else
6044
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6045
-
6046
- f.dot = dot;
6047
- */
6048
-
6049
- if (!selectmode)
6050
- {
6051
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6052
- {
6053
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6054
- } else
6055
- {
6056
- gl.glNormal3f(0, 0, 1);
6057
- }
6058
-
6059
- if (c != null)
6060
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6061
- {
6062
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6063
- }
6064
- }
6065
- if (flipV)
6066
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6067
- else
6068
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6069
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6070
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6071
-
6072
- count2 += 2;
6073
- count3 += 3;
6074
- if (!selectmode)
6075
- {
6076
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6077
- {
6078
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6079
- } else
6080
- {
6081
- gl.glNormal3f(0, 0, 1);
6082
- }
6083
- if (c != null)
6084
- {
6085
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6086
- }
6087
- }
6088
- if (flipV)
6089
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6090
- else
6091
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6092
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6093
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6094
-
6095
- count2 += 2;
6096
- count3 += 3;
6097
- for (int j = 0; j < strips[i] - 2; j++)
6098
- {
6099
- //gl.glTexCoord2d(...);
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
- if (c != null)
6110
- {
6111
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6112
- }
6113
- }
6114
-
6115
- if (flipV)
6116
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6117
- else
6118
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6119
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6120
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6121
- count2 += 2;
6122
- count3 += 3;
6123
- }
6124
-
6125
- gl.glEnd();
6126
- }
6127
- }
6128
-
6129
- assert count3 == v.length;
6130
- }
6131
- else // !trimmed
6132
- {
6133
- int count = 0;
6134
- for (int i = 0; i < strips.length; i++)
6135
- {
6136
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6137
-
6138
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6139
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6140
-
6141
- drawVertex(gl, p, selectmode);
6142
- drawVertex(gl, q, selectmode);
6143
-
6144
- for (int j = 0; j < strips[i] - 2; j++)
6145
- {
6146
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6147
-
6148
-// if (j%2 == 0)
6149
-// drawFace(p, q, r, display, null);
6150
-// else
6151
-// drawFace(p, r, q, display, null);
6152
-
6153
-// p = q;
6154
-// q = r;
6155
- drawVertex(gl, r, selectmode);
6156
- }
6157
-
6158
- gl.glEnd();
6159
- }
6160
- }
6084
+
6085
+ display.DrawGeometry(bRep, flipV, selectmode);
61616086 } else // catch (Error e)
61626087 {
61636088 // TRIANGLE ARRAY
61646089 if (IsOpaque()) // Static())
61656090 {
6166
- gl.glBegin(gl.GL_TRIANGLES);
6091
+ display.StartTriangles();
61676092 int facecount = bRep.FaceCount();
61686093 for (int i = 0; i < facecount; i++)
61696094 {
....@@ -6226,9 +6151,9 @@
62266151 // // r.norm.dot(v3) > -0.5)
62276152 // // continue;
62286153
6229
- drawFace(p, q, r, display, face);
6154
+ display.DrawFace(this, p, q, r, face);
62306155 }
6231
- gl.glEnd();
6156
+ display.EndTriangles();
62326157 }
62336158 else
62346159 {
....@@ -6257,8 +6182,8 @@
62576182 //System.out.println("SORT");
62586183
62596184 java.util.Arrays.sort(facescompare);
6260
-
6261
- gl.glBegin(gl.GL_TRIANGLES);
6185
+
6186
+ display.StartTriangles();
62626187 for (int i = 0; i < facecount; i++)
62636188 {
62646189 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6270,13 +6195,14 @@
62706195 Vertex q = bRep.GetVertex(face.q);
62716196 Vertex r = bRep.GetVertex(face.r);
62726197
6273
- drawFace(p, q, r, display, face);
6198
+ display.DrawFace(this, p, q, r, face);
62746199 }
6275
- gl.glEnd();
6200
+ display.EndTriangles();
62766201 }
62776202
62786203 if (false) // live && support != null && support.bRep != null) // debug weights
62796204 {
6205
+ /*
62806206 gl.glDisable(gl.GL_LIGHTING);
62816207 float[] colorV = new float[3];
62826208
....@@ -6355,6 +6281,7 @@
63556281 // gl.glEnd();
63566282 }
63576283 }
6284
+ */
63586285 }
63596286 }
63606287
....@@ -6399,7 +6326,7 @@
63996326 center.add(r);
64006327 center.mul(1.0/3);
64016328
6402
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6329
+ center.sub(Globals.theRenderer.EyeCamera().location);
64036330
64046331 distance = center.dot(center);
64056332 }
....@@ -6410,347 +6337,11 @@
64106337
64116338 transient FaceCompare[] facescompare = null;
64126339
6413
- void SetColor(CameraPane display, Vertex p0)
6414
- {
6415
- if (display.RENDERPROGRAM == 0)
6416
- {
6417
- float r = 0;
6418
- if (bRep != null)
6419
- {
6420
- if (bRep.stripified)
6421
- {
6422
- r = 1;
6423
- }
6424
- }
6425
- float g = 0;
6426
- if (bRep != null)
6427
- {
6428
- if (bRep.trimmed)
6429
- {
6430
- g = 1;
6431
- }
6432
- }
6433
- float b = 0;
6434
- if (support != null && link2master)
6435
- {
6436
- b = 1;
6437
- }
6438
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6439
- return;
6440
- }
6441
-
6442
- if (display.drawMode != CameraPane.SHADOW)
6443
- return;
6444
-
6445
- javax.media.opengl.GL gl = display.GetGL();
6446
-// if (true) return;
6447
-// float ao = p.AO;
6448
-//
6449
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6450
-// // ao = 1;
6451
-//
6452
-// gl.glColor4f(ao, ao, ao, 1);
6453
-
6454
-// CameraPane.selectedpoint.
6455
-// getAverage(cStatic.point1, true);
6456
- if (CameraPane.pointflow == null) // !random) // live)
6457
- {
6458
- return;
6459
- }
6460
-
6461
- cStatic.point1.set(0,0,0);
6462
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6463
-
6464
- cStatic.point1.sub(p0);
6465
-
6466
-
6467
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6468
-// {
6469
-// return;
6470
-// }
6471
-
6472
- //if (true)
6473
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6474
- {
6475
- return;
6476
- }
6477
-
6478
- float[] colorV = new float[3];
6479
-
6480
- if (false) // marked)
6481
- {
6482
- // debug rigging weights
6483
- for (int object = 0; object < p0.vertexlinks.length; object++)
6484
- {
6485
- float weight = p0.weights[object] / p0.totalweight;
6486
-
6487
- // if (weight < 0.1)
6488
- // {
6489
- // assert(weight == 0);
6490
- // continue;
6491
- // }
6492
-
6493
- if (p0.vertexlinks[object] == -1)
6494
- continue;
6495
-
6496
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6497
-
6498
- int color = //1 << object; //
6499
- //p.vertexlinks.length;
6500
- support.bRep.supports[p0.closestsupport].links[object];
6501
- colorV[2] += (color & 1) * weight;
6502
- colorV[1] += ((color & 2) >> 1) * weight;
6503
- colorV[0] += ((color & 4) >> 2) * weight;
6504
- }
6505
- }
6506
- else
6507
- {
6508
- if (drawingstarted)
6509
- {
6510
- // find next point
6511
- if (bRep.GetVertex(0).faceindices == null)
6512
- {
6513
- bRep.InitFaceIndices();
6514
- }
6515
-
6516
- double ymin = p0.y;
6517
-
6518
- Vertex newp = p0;
6519
-
6520
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6521
- {
6522
- int fi = p0.faceindices[fii];
6523
-
6524
- if (fi == -1)
6525
- break;
6526
-
6527
- Face f = bRep.GetFace(fi);
6528
-
6529
- Vertex p = bRep.GetVertex(f.p);
6530
- Vertex q = bRep.GetVertex(f.q);
6531
- Vertex r = bRep.GetVertex(f.r);
6532
-
6533
- int swap = (int)(Math.random()*3);
6534
-
6535
-// for (int s=swap; --s>=0;)
6536
-// {
6537
-// Vertex t = p;
6538
-// p = q;
6539
-// q = r;
6540
-// r = t;
6541
-// }
6542
- if (ymin > p.y)
6543
- {
6544
- ymin = p.y;
6545
- newp = p;
6546
-// break;
6547
- }
6548
- if (ymin > q.y)
6549
- {
6550
- ymin = q.y;
6551
- newp = q;
6552
-// break;
6553
- }
6554
- if (ymin > r.y)
6555
- {
6556
- ymin = r.y;
6557
- newp = r;
6558
-// break;
6559
- }
6560
- }
6561
-
6562
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6563
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6564
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6565
-
6566
- drawingstarted = false;
6567
-
6568
- // return;
6569
- }
6570
-
6571
- if (false) // CameraPane.DRAW
6572
- {
6573
- p0.AO = colorV[0] = 2;
6574
- colorV[1] = 2;
6575
- colorV[2] = 2;
6576
- }
6577
-
6578
- CameraPane.pointflow.add(p0);
6579
- CameraPane.pointflow.Touch();
6580
- }
6581
-
6582
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6583
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6584
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6585
- }
6586
-
65876340 void Print(Vertex v)
65886341 {
65896342 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
65906343 }
65916344
6592
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6593
- {
6594
- if (!selectmode)
6595
- {
6596
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6597
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6598
-
6599
- if (flipV)
6600
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6601
- else
6602
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6603
- }
6604
-
6605
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6606
- }
6607
-
6608
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6609
- CameraPane display, Face face)
6610
- {
6611
- if (pv.y == -10000 ||
6612
- qv.y == -10000 ||
6613
- rv.y == -10000)
6614
- return;
6615
-
6616
-// float b = f.nbiterations & 1;
6617
-// float g = (f.nbiterations>>1) & 1;
6618
-// float r = (f.nbiterations>>2) & 1;
6619
-//
6620
-// //if (f.weight == 10000)
6621
-// //{
6622
-// // r = 1; g = b = 0;
6623
-// //}
6624
-// //else
6625
-// //{
6626
-// // assert(f.weight < 10000);
6627
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6628
-// if (r<0)
6629
-// assert(r>=0);
6630
-// //}
6631
-
6632
- javax.media.opengl.GL gl = display.GetGL();
6633
-
6634
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6635
-
6636
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6637
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6638
- {
6639
- //gl.glBegin(gl.GL_TRIANGLES);
6640
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6641
- if (!hasnorm)
6642
- {
6643
- // System.out.println("FUCK!!");
6644
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6645
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6646
- LA.vecCross(v0, v1, v2);
6647
- LA.vecNormalize(v2);
6648
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6649
- }
6650
-
6651
- if (hasnorm)
6652
- {
6653
-// if (!pv.norm.normalized())
6654
-// assert(pv.norm.normalized());
6655
-
6656
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6657
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6658
- }
6659
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6660
- SetColor(display, pv);
6661
- //gl.glColor4f(r, g, b, 1);
6662
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6663
- if (flipV)
6664
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6665
- else
6666
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6667
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6668
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6669
-// Print(pv);
6670
- if (hasnorm)
6671
- {
6672
-// assert(qv.norm.normalized());
6673
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6674
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6675
- }
6676
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6677
- // boolean locked = false;
6678
- // float eps = 0.1f;
6679
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6680
-
6681
- // int dot = 0; //*/ (int)f.dot;
6682
-
6683
- // if ((dot&1) == 0)
6684
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6685
-
6686
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6687
- if (flipV)
6688
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6689
- else
6690
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6691
- // else
6692
- // {
6693
- // locked = true;
6694
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6695
- // }
6696
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6697
- SetColor(display, qv);
6698
- //gl.glColor4f(r, g, b, 1);
6699
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6700
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6701
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6702
-// Print(qv);
6703
- if (hasnorm)
6704
- {
6705
-// assert(rv.norm.normalized());
6706
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6707
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6708
- }
6709
-
6710
- // if ((dot&4) == 0)
6711
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6712
-
6713
- // if (wrap || !locked && (dot&8) != 0)
6714
- if (flipV)
6715
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6716
- else
6717
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6718
- // else
6719
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6720
-
6721
- // f.dot = dot;
6722
-
6723
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6724
- SetColor(display, rv);
6725
- //gl.glColor4f(r, g, b, 1);
6726
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6727
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6728
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6729
-// Print(rv);
6730
- //gl.glEnd();
6731
- }
6732
- else
6733
- {
6734
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6735
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6736
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6737
-
6738
- }
6739
-
6740
- if (false) // (attributes & WIREFRAME) != 0)
6741
- {
6742
- gl.glDisable(gl.GL_LIGHTING);
6743
-
6744
- gl.glBegin(gl.GL_LINE_LOOP);
6745
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6746
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6747
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6748
- gl.glEnd();
6749
-
6750
- gl.glEnable(gl.GL_LIGHTING);
6751
- }
6752
- }
6753
-
67546345 void drawSelf(ClickInfo info, int level, boolean select)
67556346 {
67566347 if (bRep == null)
....@@ -7322,83 +6913,83 @@
73226913 int spotw = spot.x + spot.width;
73236914 int spoth = spot.y + spot.height;
73246915 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7325
- if (CameraPane.Xmin > spot.x)
7326
- {
7327
- CameraPane.Xmin = spot.x;
7328
- }
7329
- if (CameraPane.Xmax < spotw)
7330
- {
7331
- CameraPane.Xmax = spotw;
7332
- }
7333
- if (CameraPane.Ymin > spot.y)
7334
- {
7335
- CameraPane.Ymin = spot.y;
7336
- }
7337
- if (CameraPane.Ymax < spoth)
7338
- {
7339
- CameraPane.Ymax = spoth;
7340
- }
6916
+// if (CameraPane.Xmin > spot.x)
6917
+// {
6918
+// CameraPane.Xmin = spot.x;
6919
+// }
6920
+// if (CameraPane.Xmax < spotw)
6921
+// {
6922
+// CameraPane.Xmax = spotw;
6923
+// }
6924
+// if (CameraPane.Ymin > spot.y)
6925
+// {
6926
+// CameraPane.Ymin = spot.y;
6927
+// }
6928
+// if (CameraPane.Ymax < spoth)
6929
+// {
6930
+// CameraPane.Ymax = spoth;
6931
+// }
73416932 spot.translate(32, 32);
73426933 spotw = spot.x + spot.width;
73436934 spoth = spot.y + spot.height;
73446935 info.g.setColor(Color.blue);
73456936 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7346
- if (CameraPane.Xmin > spot.x)
7347
- {
7348
- CameraPane.Xmin = spot.x;
7349
- }
7350
- if (CameraPane.Xmax < spotw)
7351
- {
7352
- CameraPane.Xmax = spotw;
7353
- }
7354
- if (CameraPane.Ymin > spot.y)
7355
- {
7356
- CameraPane.Ymin = spot.y;
7357
- }
7358
- if (CameraPane.Ymax < spoth)
7359
- {
7360
- CameraPane.Ymax = spoth;
7361
- }
6937
+// if (CameraPane.Xmin > spot.x)
6938
+// {
6939
+// CameraPane.Xmin = spot.x;
6940
+// }
6941
+// if (CameraPane.Xmax < spotw)
6942
+// {
6943
+// CameraPane.Xmax = spotw;
6944
+// }
6945
+// if (CameraPane.Ymin > spot.y)
6946
+// {
6947
+// CameraPane.Ymin = spot.y;
6948
+// }
6949
+// if (CameraPane.Ymax < spoth)
6950
+// {
6951
+// CameraPane.Ymax = spoth;
6952
+// }
73626953 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
73636954 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
73646955 spot.translate(0, -32);
73656956 info.g.setColor(Color.green);
73666957 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7367
- if (CameraPane.Xmin > spot.x)
7368
- {
7369
- CameraPane.Xmin = spot.x;
7370
- }
7371
- if (CameraPane.Xmax < spotw)
7372
- {
7373
- CameraPane.Xmax = spotw;
7374
- }
7375
- if (CameraPane.Ymin > spot.y)
7376
- {
7377
- CameraPane.Ymin = spot.y;
7378
- }
7379
- if (CameraPane.Ymax < spoth)
7380
- {
7381
- CameraPane.Ymax = spoth;
7382
- }
6958
+// if (CameraPane.Xmin > spot.x)
6959
+// {
6960
+// CameraPane.Xmin = spot.x;
6961
+// }
6962
+// if (CameraPane.Xmax < spotw)
6963
+// {
6964
+// CameraPane.Xmax = spotw;
6965
+// }
6966
+// if (CameraPane.Ymin > spot.y)
6967
+// {
6968
+// CameraPane.Ymin = spot.y;
6969
+// }
6970
+// if (CameraPane.Ymax < spoth)
6971
+// {
6972
+// CameraPane.Ymax = spoth;
6973
+// }
73836974 info.g.drawArc(boundary.x, boundary.y,
73846975 boundary.width, boundary.height, 0, 360);
73856976 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7386
- if (CameraPane.Xmin > boundary.x)
7387
- {
7388
- CameraPane.Xmin = boundary.x;
7389
- }
7390
- if (CameraPane.Xmax < boundary.x + boundary.width)
7391
- {
7392
- CameraPane.Xmax = boundary.x + boundary.width;
7393
- }
7394
- if (CameraPane.Ymin > boundary.y)
7395
- {
7396
- CameraPane.Ymin = boundary.y;
7397
- }
7398
- if (CameraPane.Ymax < boundary.y + boundary.height)
7399
- {
7400
- CameraPane.Ymax = boundary.y + boundary.height;
7401
- }
6977
+// if (CameraPane.Xmin > boundary.x)
6978
+// {
6979
+// CameraPane.Xmin = boundary.x;
6980
+// }
6981
+// if (CameraPane.Xmax < boundary.x + boundary.width)
6982
+// {
6983
+// CameraPane.Xmax = boundary.x + boundary.width;
6984
+// }
6985
+// if (CameraPane.Ymin > boundary.y)
6986
+// {
6987
+// CameraPane.Ymin = boundary.y;
6988
+// }
6989
+// if (CameraPane.Ymax < boundary.y + boundary.height)
6990
+// {
6991
+// CameraPane.Ymax = boundary.y + boundary.height;
6992
+// }
74026993 return;
74036994 }
74046995 }
....@@ -7448,7 +7039,7 @@
74487039 }
74497040
74507041 //System.out.println("info.modifiers = " + info.modifiers);
7451
- modified = (info.modifiers & CameraPane.META) != 0;
7042
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
74527043 //System.out.println("modified = " + modified);
74537044 //new Exception().printStackTrace();
74547045 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7476,7 +7067,7 @@
74767067 return true;
74777068 }
74787069
7479
- void doEditDrag0(ClickInfo info)
7070
+ void doEditDrag0(ClickInfo info, boolean opposite)
74807071 {
74817072 if (hitSomething == 0)
74827073 {
....@@ -7501,9 +7092,9 @@
75017092
75027093 case hitCenter: // Translate
75037094
7504
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7095
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75057096
7506
- if (modified)
7097
+ if (modified || opposite)
75077098 {
75087099 //assert(false);
75097100 /*
....@@ -7549,10 +7140,10 @@
75497140 }
75507141 LA.xformDir(up, ClickInfo.matbuffer, up);
75517142 // if (!CameraPane.LOCALTRANSFORM)
7552
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7143
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
75537144 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
75547145 // if (!CameraPane.LOCALTRANSFORM)
7555
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7146
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75567147 //LA.vecCross(up, cVector.Z, right2);
75577148
75587149 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7597,6 +7188,7 @@
75977188
75987189 if (modified)
75997190 {
7191
+ // Rotate 90 degrees
76007192 angle /= (Math.PI / 4);
76017193 angle = Math.floor(angle + 0.5);
76027194 angle *= (Math.PI / 4);
....@@ -7610,7 +7202,7 @@
76107202 }
76117203 /**/
76127204
7613
- switch (info.pane.renderCamera.viewCode)
7205
+ switch (info.pane.RenderCamera().viewCode)
76147206 {
76157207 case 1: // '\001'
76167208 LA.matZRotate(toParent, angle);
....@@ -7666,7 +7258,7 @@
76667258 }
76677259 /**/
76687260
7669
- switch (info.pane.renderCamera.viewCode)
7261
+ switch (info.pane.RenderCamera().viewCode)
76707262 {
76717263 case 3: // '\001'
76727264 if (modified)
....@@ -7719,7 +7311,7 @@
77197311 if (parent == null)
77207312 {
77217313 System.out.println("NULL PARENT");
7722
- new Exception().printStackTrace();
7314
+ //new Exception().printStackTrace();
77237315 } else
77247316 {
77257317 if (parent instanceof BezierPatch)
....@@ -7735,8 +7327,15 @@
77357327 info.pane.repaint();
77367328 }
77377329
7330
+ boolean overflow = false;
7331
+
77387332 void TransformToWorld(cVector out) // , cVector out)
77397333 {
7334
+ if (overflow)
7335
+ return;
7336
+
7337
+ overflow = true;
7338
+
77407339 // june 2013 ??? assert (in == out);
77417340 cVector in = out;
77427341 if (toParent != null && !(this instanceof Texture || this instanceof TextureNode))
....@@ -7753,6 +7352,8 @@
77537352 {
77547353 (parent!=null?parent:fileparent).TransformToWorld(out); //, out);
77557354 }
7355
+
7356
+ overflow = false;
77567357 }
77577358
77587359 void TransformToLocal(cVector out) //, cVector out)
....@@ -7822,14 +7423,22 @@
78227423 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
78237424 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
78247425 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7426
+
7427
+ String objname;
7428
+
78257429 if (false) //parent != null)
78267430 {
7827
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7431
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
78287432 } else
78297433 {
7830
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7434
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
78317435 } // + super.toString();
78327436 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7437
+
7438
+ if (!Globals.ADVANCED)
7439
+ return objname;
7440
+
7441
+ return objname + " " + System.identityHashCode(this);
78337442 }
78347443
78357444 public int hashCode()
....@@ -7885,6 +7494,7 @@
78857494 objectUI.closeUI();
78867495 if (editWindow != null)
78877496 {
7497
+ editWindow.ctrlPanel.FlushUI();
78887498 editWindow.refreshContents();
78897499 } // ? new
78907500 objectUI = null;
....@@ -7995,19 +7605,22 @@
79957605 max = new cVector();
79967606 }
79977607
7998
- Object3D sourcenode = GetFileRoot();
7999
-
8000
- if (!sourcenode.name.contains("rclab"))
7608
+ if (false) // Can crawl!!
80017609 {
8002
- getBounds(min, max, true);
7610
+ Object3D sourcenode = GetFileRoot();
80037611
8004
- if (min.y != Double.POSITIVE_INFINITY && min.y > 2)
7612
+ if (sourcenode != null && !sourcenode.name.contains("rclab"))
80057613 {
8006
-// sourcenode.getBounds(min, max, true);
8007
- sourcenode.getBounds(v0, v1, true);
8008
-// sourcenode.toParent = sourcenode.toParent;
8009
-// get(0).toParent = get(0).toParent;
8010
-// sourcenode.GlobalTransform();
7614
+ getBounds(min, max, true);
7615
+
7616
+ if (min.y != Double.POSITIVE_INFINITY && min.y > 2)
7617
+ {
7618
+ // sourcenode.getBounds(min, max, true);
7619
+ sourcenode.getBounds(v0, v1, true);
7620
+ // sourcenode.toParent = sourcenode.toParent;
7621
+ // get(0).toParent = get(0).toParent;
7622
+ // sourcenode.GlobalTransform();
7623
+ }
80117624 }
80127625 }
80137626
....@@ -8016,7 +7629,8 @@
80167629 if (support != null)
80177630 {
80187631 assert(bRep != null);
8019
- GraphreeD.Assert(support.bRep == bRep.support);
7632
+ if (!(support instanceof GenericJoint)) // support.bRep != null)
7633
+ Grafreed.Assert(support.bRep == bRep.support);
80207634 }
80217635 else
80227636 {
....@@ -8099,6 +7713,8 @@
80997713 {
81007714 Object3D targ = this;
81017715
7716
+ targ.NORMALPUSH = obj.NORMALPUSH;
7717
+
81027718 if (obj.material != null)
81037719 {
81047720 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))