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
....@@ -355,7 +437,7 @@
355437
356438 int MemorySize()
357439 {
358
- if (memorysize == 0)
440
+ if (true) // memorysize == 0)
359441 {
360442 try
361443 {
....@@ -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()
....@@ -1446,7 +1536,16 @@
14461536 // if (other == null)
14471537 // return;
14481538
1449
- System.out.println("Link support this = " + this + "; other = " + other);
1539
+ if (other != null)
1540
+ {
1541
+ BoundaryRep.SEUIL = other.material.cameralight;
1542
+
1543
+ // Set default to 0.1
1544
+ BoundaryRep.SEUIL /= 4; // 2;
1545
+ System.out.println("SEUIL = " + BoundaryRep.SEUIL);
1546
+ }
1547
+
1548
+ System.out.println("Link this = " + this + "; support = " + other);
14501549
14511550 //if (bRep != null)
14521551 // bRep.linkVerticesThis(other.bRep);
....@@ -1701,7 +1800,7 @@
17011800 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17021801 o.bRep = transientrep;
17031802 if (clone)
1704
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1803
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17051804 o.CreateMaterial();
17061805 o.SetAttributes(this, -1);
17071806 //parent
....@@ -1714,7 +1813,7 @@
17141813 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17151814 o.bRep = bRep;
17161815 if (clone)
1717
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1816
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17181817 o.CreateMaterial();
17191818 //o.overwriteThis(this, -1);
17201819 o.SetAttributes(this, -1);
....@@ -1801,12 +1900,15 @@
18011900 if (obj.name == null)
18021901 continue; // can't be a null one
18031902
1903
+ // Try perfect match first.
18041904 if (n.equals(obj.name))
18051905 {
18061906 theobj = obj;
18071907 count++;
18081908 }
18091909 }
1910
+
1911
+ // not needed: n = n.split(":")[0]; // Poser generates a count
18101912
18111913 if (count != 1)
18121914 for (int i=Size(); --i>=0;)
....@@ -1816,8 +1918,9 @@
18161918 if (obj.name == null)
18171919 continue; // can't be a null one
18181920
1819
- //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count
1820
- if (n.startsWith(obj.name))
1921
+ String name = obj.name.split(":")[0]; // Poser generates a count
1922
+ //if (n.startsWith(obj.name))
1923
+ if (n.contains(name))
18211924 {
18221925 theobj = obj;
18231926 count++;
....@@ -2120,15 +2223,8 @@
21202223 if (/*parent != null &&*/ material == null)
21212224 {
21222225 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
2226
+
2227
+ InitOthers();
21322228
21332229 if (this instanceof Camera)
21342230 {
....@@ -2278,6 +2374,7 @@
22782374 {
22792375 if (newWindow)
22802376 {
2377
+ new Exception().printStackTrace();
22812378 System.exit(0);
22822379 if (parent != null)
22832380 {
....@@ -2454,13 +2551,13 @@
24542551 return retval;
24552552 }
24562553
2457
- void doEditDrag(ClickInfo info)
2554
+ void doEditDrag(ClickInfo info, boolean opposite)
24582555 {
24592556 switch (doSomething)
24602557 {
24612558 case 1: // '\001'
24622559 //super.
2463
- doEditDrag0(info);
2560
+ doEditDrag0(info, opposite);
24642561 break;
24652562
24662563 case 2: // '\002'
....@@ -2473,11 +2570,11 @@
24732570 {
24742571 //sel.hitSomething = childToDrag.hitSomething;
24752572 //childToDrag.doEditDrag(info);
2476
- sel.doEditDrag(info);
2573
+ sel.doEditDrag(info, opposite);
24772574 } else
24782575 {
24792576 //super.
2480
- doEditDrag0(info);
2577
+ doEditDrag0(info, opposite);
24812578 }
24822579 }
24832580 break;
....@@ -2732,6 +2829,24 @@
27322829 blockloop = false;
27332830 }
27342831
2832
+ void GenNormalsMINE()
2833
+ {
2834
+ if (blockloop)
2835
+ return;
2836
+
2837
+ blockloop = true;
2838
+ GenNormalsMINE0();
2839
+ for (int i = 0; i < Children().Size(); i++)
2840
+ {
2841
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2842
+ if (child == null)
2843
+ continue;
2844
+ child.GenNormalsMINE();
2845
+// Children().release(i);
2846
+ }
2847
+ blockloop = false;
2848
+ }
2849
+
27352850 void ClearColors()
27362851 {
27372852 if (blockloop)
....@@ -2866,7 +2981,8 @@
28662981 {
28672982 if (bRep != null)
28682983 {
2869
- bRep.GenUV();
2984
+ bRep.GenUV(); //1);
2985
+ //bRep.UnfoldUV();
28702986 Touch();
28712987 }
28722988 }
....@@ -2876,6 +2992,15 @@
28762992 if (bRep != null)
28772993 {
28782994 bRep.GenerateNormals(crease);
2995
+ Touch();
2996
+ }
2997
+ }
2998
+
2999
+ void GenNormalsMINE0()
3000
+ {
3001
+ if (bRep != null)
3002
+ {
3003
+ bRep.GenerateNormalsMINE();
28793004 Touch();
28803005 }
28813006 }
....@@ -2932,6 +3057,33 @@
29323057 blockloop = false;
29333058 }
29343059
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
+
29353087 void TransformGeometry()
29363088 {
29373089 Object3D obj = this;
....@@ -3153,9 +3305,11 @@
31533305
31543306 BoundaryRep sup = bRep.support;
31553307 bRep.support = null;
3156
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3308
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
31573309 // bRep.SplitInTwo(onlyone); // thread...
3158
- temprep.SplitInTwo(reduction34, onlyone);
3310
+
3311
+ while(temprep.SplitInTwo(reduction34, onlyone));
3312
+
31593313 bRep = temprep;
31603314 bRep.support = sup;
31613315 Touch();
....@@ -3677,7 +3831,7 @@
36773831 if (child == null)
36783832 continue;
36793833
3680
- if (GrafreeD.RENDERME > 0)
3834
+ if (Grafreed.RENDERME > 0)
36813835 {
36823836 if (child instanceof Merge)
36833837 ((Merge)child).renderme();
....@@ -3828,7 +3982,7 @@
38283982 if (child == null)
38293983 continue;
38303984
3831
- if (GrafreeD.RENDERME > 0)
3985
+ if (Grafreed.RENDERME > 0)
38323986 {
38333987 if (child instanceof Merge)
38343988 ((Merge)child).renderme();
....@@ -4023,7 +4177,7 @@
40234177 if (child == null)
40244178 continue;
40254179
4026
- if (GrafreeD.RENDERME > 0)
4180
+ if (Grafreed.RENDERME > 0)
40274181 {
40284182 if (child instanceof Merge)
40294183 ((Merge)child).renderme();
....@@ -4111,7 +4265,7 @@
41114265 if (blockloop)
41124266 return;
41134267
4114
- for (int i=0; i<size(); i++)
4268
+ for (int i=0; i<Size(); i++)
41154269 {
41164270 if (get(i).parent != this)
41174271 {
....@@ -4120,6 +4274,22 @@
41204274 }
41214275 blockloop = true;
41224276 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();
41234293 blockloop = false;
41244294 }
41254295 }
....@@ -4614,7 +4784,7 @@
46144784
46154785 cTreePath SelectLeaf(int indexcount, boolean deselect)
46164786 {
4617
- if (hide)
4787
+ if (hide || dontselect)
46184788 return null;
46194789
46204790 if (count <= 0)
....@@ -4640,7 +4810,7 @@
46404810
46414811 cTreePath Select(int indexcount, boolean deselect)
46424812 {
4643
- if (hide)
4813
+ if (hide || dontselect)
46444814 return null;
46454815
46464816 if (count <= 0)
....@@ -4790,7 +4960,7 @@
47904960 return globalTransform;
47914961 }
47924962
4793
- void PreprocessOcclusion(CameraPane cp)
4963
+ void PreprocessOcclusion(iCameraPane cp)
47944964 {
47954965 /*
47964966 if (AOdone)
....@@ -4937,7 +5107,8 @@
49375107 } else //
49385108 if (editWindow != null)
49395109 {
4940
- editWindow.cameraView.lighttouched = true;
5110
+ //editWindow.cameraView.lighttouched = true;
5111
+ Globals.lighttouched = true;
49415112 }
49425113 }
49435114
....@@ -5091,10 +5262,34 @@
50915262
50925263 // System.out.println("Fullname = " + fullname);
50935264
5094
- if (fullname.name.indexOf(":") == -1)
5095
- 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(":"));
50965270
5097
- 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];
50985293 }
50995294
51005295 static String GetBump(cTexture fullname)
....@@ -5103,10 +5298,38 @@
51035298 return "";
51045299
51055300 // System.out.println("Fullname = " + fullname);
5106
- if (fullname.name.indexOf(":") == -1)
5107
- return "";
5108
-
5109
- 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];
51105333 }
51115334
51125335 String GetPigmentTexture()
....@@ -5180,7 +5403,7 @@
51805403 System.out.print("; textures = " + textures);
51815404 System.out.println("; usedtextures = " + usedtextures);
51825405
5183
- if (GetTextures() == null)
5406
+ if (GetTextures() == null) // What is that??
51845407 GetTextures().name = ":";
51855408
51865409 String texname = tex;
....@@ -5211,6 +5434,43 @@
52115434 child.ResetPigmentTexture();
52125435 blockloop = false;
52135436 }
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;
52145474 }
52155475
52165476 void SetBumpTexture(String tex)
....@@ -5249,25 +5509,22 @@
52495509 }
52505510 }
52515511
5252
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5512
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52535513 {
52545514 Draw(display, root, selected, blocked);
52555515 }
52565516
5257
- static cMaterial[] materialstack = new cMaterial[65536];
5258
- static boolean[] selectedstack = new boolean[65536];
5259
- static int materialdepth = 0;
5260
-
52615517 boolean NeedSupport()
52625518 {
52635519 return
5264
- CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
5520
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
52655521 // PROBLEM with CROWD!!
5266
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5522
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
52675523 }
52685524
5525
+ static boolean DEBUG_SELECTION = false;
52695526
5270
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5527
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52715528 {
52725529 Invariants(); // june 2013
52735530
....@@ -5276,8 +5533,8 @@
52765533 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
52775534 }
52785535
5279
- if (display.drawMode == CameraPane.SELECTION &&
5280
- hide)
5536
+ if (display.DrawMode() == iCameraPane.SELECTION &&
5537
+ (hide || dontselect))
52815538 return;
52825539
52835540 if (name != null && name.contains("sclera"))
....@@ -5295,7 +5552,7 @@
52955552 if (this instanceof Checker)
52965553 return;
52975554
5298
- if (display.drawMode == display.SHADOW && PASSTEST)
5555
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
52995556 return;
53005557
53015558 if (count <= 0)
....@@ -5303,13 +5560,13 @@
53035560 return;
53045561 }
53055562
5306
- if ((//display.drawMode == CameraPane.SHADOW ||
5307
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5563
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5564
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53085565 {
53095566 return;
53105567 }
53115568
5312
- javax.media.opengl.GL gl = display.GetGL();
5569
+ //javax.media.opengl.GL gl = display.GetGL();
53135570
53145571 /*
53155572 if (touched)
....@@ -5345,15 +5602,15 @@
53455602
53465603 boolean compiled = false;
53475604
5348
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5605
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53495606
5350
- if (!selectmode && //display.drawMode != display.SELECTION &&
5607
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53515608 (touched || (bRep != null && bRep.displaylist <= 0)))
53525609 {
5353
- display.lighttouched = true;
5610
+ Globals.lighttouched = true;
53545611 } // all panes...
5355
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5356
- 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 &&
53575614 (touched || (bRep != null && bRep.displaylist <= 0)))
53585615 {
53595616 if (!(this instanceof Composite))
....@@ -5361,7 +5618,7 @@
53615618 //if (displaylist == -1 && usecalllists)
53625619 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
53635620 {
5364
- bRep.displaylist = gl.glGenLists(1);
5621
+ bRep.displaylist = display.GenList();
53655622 assert(bRep.displaylist != 0);
53665623 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
53675624 //System.out.println("\tgen list " + list);
....@@ -5373,18 +5630,20 @@
53735630 if (usecalllists)
53745631 {
53755632 // System.err.println("new list " + bRep.displaylist + " for " + this);
5376
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5633
+ display.NewList(bRep.displaylist);
53775634 }
5635
+
53785636 CallList(display, root, selected, blocked);
5637
+
53795638 // compiled = true;
53805639 if (usecalllists)
53815640 {
53825641 // System.err.println("end list " + bRep.displaylist + " for " + this);
5383
- gl.glEndList();
5642
+ display.EndList();
53845643 }
53855644 //gl.glDrawBuffer(gl.GL_BACK);
53865645 // XXX touched = false;
5387
- display.lighttouched = true; // all panes...
5646
+ Globals.lighttouched = true; // all panes...
53885647 }
53895648
53905649 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5423,12 +5682,12 @@
54235682
54245683 // frustum culling
54255684 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5426
- && display.drawMode != CameraPane.SELECTION)
5685
+ && display.DrawMode() != iCameraPane.SELECTION)
54275686 {
5428
- if (display.drawMode == CameraPane.SHADOW)
5687
+ if (display.DrawMode() == iCameraPane.SHADOW)
54295688 {
54305689 if (!link2master // tricky to cull in shadow mode.
5431
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5690
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54325691 {
54335692 //System.out.print("CULLED");
54345693 culled = true;
....@@ -5436,7 +5695,7 @@
54365695 }
54375696 else
54385697 //GetBRep().getBounds(v0, v1, this);
5439
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5698
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54405699 culled = true;
54415700
54425701 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5472,11 +5731,11 @@
54725731
54735732
54745733 if (!culled)
5475
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5734
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
54765735 {
54775736 if (GetBRep() != null)
54785737 {
5479
- CameraPane.NextIndex(this, gl);
5738
+ display.NextIndex();
54805739 // vertex color conflict : gl.glCallList(list);
54815740 DrawNode(display, root, selected);
54825741 if (this instanceof BezierPatch)
....@@ -5498,53 +5757,7 @@
54985757 color[2] /= 2;
54995758 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55005759 */
5501
- if (material != null)
5502
- {
5503
- materialstack[materialdepth] = material;
5504
- selectedstack[materialdepth] = selected;
5505
- cStatic.objectstack[materialdepth++] = this;
5506
- //System.out.println("material " + material);
5507
- //Applet3D.tracein(this, selected);
5508
- display.vector2buffer = projectedVertices;
5509
- if (this instanceof Camera)
5510
- {
5511
- display.options1[0] = material.shift;
5512
- //System.out.println("shift " + material.shift);
5513
- display.options1[1] = material.lightarea;
5514
- display.options1[2] = material.shadowbias;
5515
- display.options1[3] = material.aniso;
5516
- display.options1[4] = material.anisoV;
5517
- display.options2[0] = material.opacity;
5518
- display.options2[1] = material.diffuse;
5519
- display.options2[2] = material.factor;
5520
-
5521
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5522
- display.options3[3] = material.cameralight/0.2f;
5523
-
5524
- // if (display.CURRENTANTIALIAS > 0)
5525
- // display.options3[3] /= 4;
5526
-
5527
- /*
5528
- System.out.println("Focus = " + display.options1[0]);
5529
- System.out.println("Aperture = " + display.options1[1]);
5530
- System.out.println("ShadowBlur = " + display.options1[2]);
5531
- System.out.println("Antialiasing = " + display.options1[3]);
5532
- System.out.println("Fog = " + display.options2[0]);
5533
- System.out.println("Intensity = " + display.options2[1]);
5534
- System.out.println("Elevation = " + display.options2[2]);
5535
- /**/
5536
- } else
5537
- {
5538
- material.Draw(display, selected);
5539
- }
5540
- } else
5541
- {
5542
- if (selected && CameraPane.flash)
5543
- {
5544
- display.modelParams4[1] = 100;
5545
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5546
- }
5547
- }
5760
+ display.PushMaterial(this, selected);
55485761
55495762 //System.out.println("call list " + list);
55505763 //System.out.println();
....@@ -5563,7 +5776,17 @@
55635776 tex = GetTextures();
55645777 }
55655778
5566
- 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
+ }
55675790
55685791 if (!compiled)
55695792 {
....@@ -5579,30 +5802,16 @@
55795802
55805803 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55815804 assert(bRep.displaylist != 0);
5582
- gl.glCallList(bRep.displaylist);
5805
+ display.CallList(bRep.displaylist);
55835806 // june 2013 drawSelf(display, root, selected);
55845807 }
55855808 }
55865809 }
55875810
5588
- display.ReleaseTextures(tex);
5589
-
5590
- //if (parent != null && parent.GetMaterial() != null)
5591
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5592
- if (material != null)
5593
- {
5594
- materialdepth -= 1;
5595
- if (materialdepth > 0)
5596
- {
5597
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5598
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5599
- }
5600
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5601
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5602
- {
5603
- display.modelParams4[1] = GetMaterial().cameralight;
5604
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5605
- }
5811
+ if (!failed)
5812
+ display.ReleaseTextures(tex);
5813
+
5814
+ display.PopMaterial(this, selected);
56065815 }
56075816
56085817 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5644,7 +5853,7 @@
56445853 // resetMasterNode();
56455854 }
56465855
5647
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5856
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56485857 {
56495858 if (GetBRep() == null)
56505859 {
....@@ -5727,8 +5936,11 @@
57275936 boolean flipV = false; // true;
57285937 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57295938
5730
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5939
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57315940 {
5941
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
5942
+ return;
5943
+
57325944 if (hide)
57335945 return;
57345946 // shadow optimisation
....@@ -5786,16 +5998,7 @@
57865998 // // ??????????????????????????? Touch();
57875999 // }
57886000
5789
- if (material != null)
5790
- {
5791
- materialstack[materialdepth] = material;
5792
- selectedstack[materialdepth] = selected;
5793
- cStatic.objectstack[materialdepth++] = this;
5794
- //System.out.println("material " + material);
5795
- //Applet3D.tracein("selected ", selected);
5796
- display.vector2buffer = projectedVertices;
5797
- material.Draw(display, selected);
5798
- }
6001
+display.PushMaterial2(this, selected);
57996002
58006003 Object3D child;
58016004 boolean sel;
....@@ -5847,19 +6050,7 @@
58476050 */
58486051 //depth += 1;
58496052
5850
- if (material != null)
5851
- {
5852
- materialdepth -= 1;
5853
- if (materialdepth > 0)
5854
- {
5855
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5856
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5857
- }
5858
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5859
- //else
5860
- //material.Draw(display, false);
5861
- }
5862
-
6053
+display.PopMaterial2(this);
58636054 /*
58646055 display.ReleaseTextures(tex);
58656056 */
....@@ -5870,10 +6061,13 @@
58706061
58716062 //static cVector min,max;
58726063
5873
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
6064
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
58746065 {
5875
- 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)
58766067 return; // no shadow for transparent objects
6068
+
6069
+ if (display.DrawMode() == iCameraPane.SELECTION && dontselect)
6070
+ return;
58776071
58786072 if (hide)
58796073 return;
....@@ -5915,11 +6109,12 @@
59156109 return;
59166110 }
59176111
6112
+ //bRep.GenUV(1/material.diffuseness);
59186113 // bRep.lock = true;
59196114
5920
- javax.media.opengl.GL gl = display.GetGL();
6115
+ //javax.media.opengl.GL gl = display.GetGL();
59216116
5922
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
6117
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59236118 {
59246119 int fc = bRep.FaceCount();
59256120 int vc = bRep.VertexCount();
....@@ -5934,23 +6129,7 @@
59346129
59356130 bRep.getMinMax(min, max, 100);
59366131
5937
- gl.glBegin(gl.GL_LINES);
5938
-
5939
- gl.glVertex3d(min.x, min.y, min.z);
5940
- gl.glVertex3d(min.x, min.y, max.z);
5941
- gl.glVertex3d(min.x, min.y, min.z);
5942
- gl.glVertex3d(min.x, max.y, min.z);
5943
- gl.glVertex3d(min.x, min.y, min.z);
5944
- gl.glVertex3d(max.x, min.y, min.z);
5945
-
5946
- gl.glVertex3d(max.x, max.y, max.z);
5947
- gl.glVertex3d(min.x, max.y, max.z);
5948
- gl.glVertex3d(max.x, max.y, max.z);
5949
- gl.glVertex3d(max.x, min.y, max.z);
5950
- gl.glVertex3d(max.x, max.y, max.z);
5951
- gl.glVertex3d(max.x, max.y, min.z);
5952
-
5953
- gl.glEnd();
6132
+ display.DrawBox(min, max);
59546133
59556134 return;
59566135 }
....@@ -5994,7 +6173,7 @@
59946173 {
59956174 //throw new Error();
59966175
5997
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6176
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
59986177
59996178 int[] strips = bRep.getRawIndices();
60006179
....@@ -6004,178 +6183,14 @@
60046183 new Exception().printStackTrace();
60056184 return;
60066185 }
6007
-
6008
- // TRIANGLE STRIP ARRAY
6009
- if (bRep.trimmed)
6010
- {
6011
- float[] v = bRep.getRawVertices();
6012
- float[] n = bRep.getRawNormals();
6013
- float[] c = bRep.getRawColors();
6014
- float[] uv = bRep.getRawUVMap();
6015
-
6016
- int count2 = 0;
6017
- int count3 = 0;
6018
-
6019
- if (n.length > 0)
6020
- {
6021
- for (int i = 0; i < strips.length; i++)
6022
- {
6023
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6024
-
6025
- /*
6026
- boolean locked = false;
6027
- float eps = 0.1f;
6028
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6029
-
6030
- int dot = 0;
6031
-
6032
- if ((dot&1) == 0)
6033
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6034
-
6035
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6036
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6037
- else
6038
- {
6039
- locked = true;
6040
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6041
- }
6042
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6043
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6044
- if (hasnorm)
6045
- {
6046
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6047
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6048
- }
6049
-
6050
- if ((dot&4) == 0)
6051
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6052
-
6053
- if (wrap || !locked && (dot&8) != 0)
6054
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6055
- else
6056
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6057
-
6058
- f.dot = dot;
6059
- */
6060
-
6061
- if (!selectmode)
6062
- {
6063
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6064
- {
6065
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6066
- } else
6067
- {
6068
- gl.glNormal3f(0, 0, 1);
6069
- }
6070
-
6071
- if (c != null)
6072
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6073
- {
6074
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6075
- }
6076
- }
6077
- if (flipV)
6078
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6079
- else
6080
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6081
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6082
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6083
-
6084
- count2 += 2;
6085
- count3 += 3;
6086
- if (!selectmode)
6087
- {
6088
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6089
- {
6090
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6091
- } else
6092
- {
6093
- gl.glNormal3f(0, 0, 1);
6094
- }
6095
- if (c != null)
6096
- {
6097
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6098
- }
6099
- }
6100
- if (flipV)
6101
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6102
- else
6103
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6104
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6105
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6106
-
6107
- count2 += 2;
6108
- count3 += 3;
6109
- for (int j = 0; j < strips[i] - 2; j++)
6110
- {
6111
- //gl.glTexCoord2d(...);
6112
- if (!selectmode)
6113
- {
6114
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6115
- {
6116
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6117
- } else
6118
- {
6119
- gl.glNormal3f(0, 0, 1);
6120
- }
6121
- if (c != null)
6122
- {
6123
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6124
- }
6125
- }
6126
-
6127
- if (flipV)
6128
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6129
- else
6130
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6131
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6132
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6133
- count2 += 2;
6134
- count3 += 3;
6135
- }
6136
-
6137
- gl.glEnd();
6138
- }
6139
- }
6140
-
6141
- assert count3 == v.length;
6142
- }
6143
- else // !trimmed
6144
- {
6145
- int count = 0;
6146
- for (int i = 0; i < strips.length; i++)
6147
- {
6148
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6149
-
6150
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6151
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6152
-
6153
- drawVertex(gl, p, selectmode);
6154
- drawVertex(gl, q, selectmode);
6155
-
6156
- for (int j = 0; j < strips[i] - 2; j++)
6157
- {
6158
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6159
-
6160
-// if (j%2 == 0)
6161
-// drawFace(p, q, r, display, null);
6162
-// else
6163
-// drawFace(p, r, q, display, null);
6164
-
6165
-// p = q;
6166
-// q = r;
6167
- drawVertex(gl, r, selectmode);
6168
- }
6169
-
6170
- gl.glEnd();
6171
- }
6172
- }
6186
+
6187
+ display.DrawGeometry(bRep, flipV, selectmode);
61736188 } else // catch (Error e)
61746189 {
61756190 // TRIANGLE ARRAY
61766191 if (IsOpaque()) // Static())
61776192 {
6178
- gl.glBegin(gl.GL_TRIANGLES);
6193
+ display.StartTriangles();
61796194 int facecount = bRep.FaceCount();
61806195 for (int i = 0; i < facecount; i++)
61816196 {
....@@ -6238,9 +6253,9 @@
62386253 // // r.norm.dot(v3) > -0.5)
62396254 // // continue;
62406255
6241
- drawFace(p, q, r, display, face);
6256
+ display.DrawFace(this, p, q, r, face);
62426257 }
6243
- gl.glEnd();
6258
+ display.EndTriangles();
62446259 }
62456260 else
62466261 {
....@@ -6269,8 +6284,8 @@
62696284 //System.out.println("SORT");
62706285
62716286 java.util.Arrays.sort(facescompare);
6272
-
6273
- gl.glBegin(gl.GL_TRIANGLES);
6287
+
6288
+ display.StartTriangles();
62746289 for (int i = 0; i < facecount; i++)
62756290 {
62766291 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6282,13 +6297,14 @@
62826297 Vertex q = bRep.GetVertex(face.q);
62836298 Vertex r = bRep.GetVertex(face.r);
62846299
6285
- drawFace(p, q, r, display, face);
6300
+ display.DrawFace(this, p, q, r, face);
62866301 }
6287
- gl.glEnd();
6302
+ display.EndTriangles();
62886303 }
62896304
62906305 if (false) // live && support != null && support.bRep != null) // debug weights
62916306 {
6307
+ /*
62926308 gl.glDisable(gl.GL_LIGHTING);
62936309 float[] colorV = new float[3];
62946310
....@@ -6367,6 +6383,7 @@
63676383 // gl.glEnd();
63686384 }
63696385 }
6386
+ */
63706387 }
63716388 }
63726389
....@@ -6411,7 +6428,7 @@
64116428 center.add(r);
64126429 center.mul(1.0/3);
64136430
6414
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6431
+ center.sub(Globals.theRenderer.EyeCamera().location);
64156432
64166433 distance = center.dot(center);
64176434 }
....@@ -6422,347 +6439,11 @@
64226439
64236440 transient FaceCompare[] facescompare = null;
64246441
6425
- void SetColor(CameraPane display, Vertex p0)
6426
- {
6427
- if (display.RENDERPROGRAM == 0)
6428
- {
6429
- float r = 0;
6430
- if (bRep != null)
6431
- {
6432
- if (bRep.stripified)
6433
- {
6434
- r = 1;
6435
- }
6436
- }
6437
- float g = 0;
6438
- if (bRep != null)
6439
- {
6440
- if (bRep.trimmed)
6441
- {
6442
- g = 1;
6443
- }
6444
- }
6445
- float b = 0;
6446
- if (support != null && link2master)
6447
- {
6448
- b = 1;
6449
- }
6450
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6451
- return;
6452
- }
6453
-
6454
- if (display.drawMode != CameraPane.SHADOW)
6455
- return;
6456
-
6457
- javax.media.opengl.GL gl = display.GetGL();
6458
-// if (true) return;
6459
-// float ao = p.AO;
6460
-//
6461
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6462
-// // ao = 1;
6463
-//
6464
-// gl.glColor4f(ao, ao, ao, 1);
6465
-
6466
-// CameraPane.selectedpoint.
6467
-// getAverage(cStatic.point1, true);
6468
- if (CameraPane.pointflow == null) // !random) // live)
6469
- {
6470
- return;
6471
- }
6472
-
6473
- cStatic.point1.set(0,0,0);
6474
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6475
-
6476
- cStatic.point1.sub(p0);
6477
-
6478
-
6479
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6480
-// {
6481
-// return;
6482
-// }
6483
-
6484
- //if (true)
6485
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6486
- {
6487
- return;
6488
- }
6489
-
6490
- float[] colorV = new float[3];
6491
-
6492
- if (false) // marked)
6493
- {
6494
- // debug rigging weights
6495
- for (int object = 0; object < p0.vertexlinks.length; object++)
6496
- {
6497
- float weight = p0.weights[object] / p0.totalweight;
6498
-
6499
- // if (weight < 0.1)
6500
- // {
6501
- // assert(weight == 0);
6502
- // continue;
6503
- // }
6504
-
6505
- if (p0.vertexlinks[object] == -1)
6506
- continue;
6507
-
6508
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6509
-
6510
- int color = //1 << object; //
6511
- //p.vertexlinks.length;
6512
- support.bRep.supports[p0.closestsupport].links[object];
6513
- colorV[2] += (color & 1) * weight;
6514
- colorV[1] += ((color & 2) >> 1) * weight;
6515
- colorV[0] += ((color & 4) >> 2) * weight;
6516
- }
6517
- }
6518
- else
6519
- {
6520
- if (drawingstarted)
6521
- {
6522
- // find next point
6523
- if (bRep.GetVertex(0).faceindices == null)
6524
- {
6525
- bRep.InitFaceIndices();
6526
- }
6527
-
6528
- double ymin = p0.y;
6529
-
6530
- Vertex newp = p0;
6531
-
6532
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6533
- {
6534
- int fi = p0.faceindices[fii];
6535
-
6536
- if (fi == -1)
6537
- break;
6538
-
6539
- Face f = bRep.GetFace(fi);
6540
-
6541
- Vertex p = bRep.GetVertex(f.p);
6542
- Vertex q = bRep.GetVertex(f.q);
6543
- Vertex r = bRep.GetVertex(f.r);
6544
-
6545
- int swap = (int)(Math.random()*3);
6546
-
6547
-// for (int s=swap; --s>=0;)
6548
-// {
6549
-// Vertex t = p;
6550
-// p = q;
6551
-// q = r;
6552
-// r = t;
6553
-// }
6554
- if (ymin > p.y)
6555
- {
6556
- ymin = p.y;
6557
- newp = p;
6558
-// break;
6559
- }
6560
- if (ymin > q.y)
6561
- {
6562
- ymin = q.y;
6563
- newp = q;
6564
-// break;
6565
- }
6566
- if (ymin > r.y)
6567
- {
6568
- ymin = r.y;
6569
- newp = r;
6570
-// break;
6571
- }
6572
- }
6573
-
6574
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6575
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6576
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6577
-
6578
- drawingstarted = false;
6579
-
6580
- // return;
6581
- }
6582
-
6583
- if (false) // CameraPane.DRAW
6584
- {
6585
- p0.AO = colorV[0] = 2;
6586
- colorV[1] = 2;
6587
- colorV[2] = 2;
6588
- }
6589
-
6590
- CameraPane.pointflow.add(p0);
6591
- CameraPane.pointflow.Touch();
6592
- }
6593
-
6594
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6595
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6596
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6597
- }
6598
-
65996442 void Print(Vertex v)
66006443 {
66016444 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
66026445 }
66036446
6604
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6605
- {
6606
- if (!selectmode)
6607
- {
6608
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6609
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6610
-
6611
- if (flipV)
6612
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6613
- else
6614
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6615
- }
6616
-
6617
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6618
- }
6619
-
6620
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6621
- CameraPane display, Face face)
6622
- {
6623
- if (pv.y == -10000 ||
6624
- qv.y == -10000 ||
6625
- rv.y == -10000)
6626
- return;
6627
-
6628
-// float b = f.nbiterations & 1;
6629
-// float g = (f.nbiterations>>1) & 1;
6630
-// float r = (f.nbiterations>>2) & 1;
6631
-//
6632
-// //if (f.weight == 10000)
6633
-// //{
6634
-// // r = 1; g = b = 0;
6635
-// //}
6636
-// //else
6637
-// //{
6638
-// // assert(f.weight < 10000);
6639
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6640
-// if (r<0)
6641
-// assert(r>=0);
6642
-// //}
6643
-
6644
- javax.media.opengl.GL gl = display.GetGL();
6645
-
6646
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6647
-
6648
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6649
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6650
- {
6651
- //gl.glBegin(gl.GL_TRIANGLES);
6652
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6653
- if (!hasnorm)
6654
- {
6655
- // System.out.println("FUCK!!");
6656
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6657
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6658
- LA.vecCross(v0, v1, v2);
6659
- LA.vecNormalize(v2);
6660
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6661
- }
6662
-
6663
- if (hasnorm)
6664
- {
6665
-// if (!pv.norm.normalized())
6666
-// assert(pv.norm.normalized());
6667
-
6668
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6669
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6670
- }
6671
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6672
- SetColor(display, pv);
6673
- //gl.glColor4f(r, g, b, 1);
6674
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6675
- if (flipV)
6676
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6677
- else
6678
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6679
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6680
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6681
-// Print(pv);
6682
- if (hasnorm)
6683
- {
6684
-// assert(qv.norm.normalized());
6685
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6686
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6687
- }
6688
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6689
- // boolean locked = false;
6690
- // float eps = 0.1f;
6691
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6692
-
6693
- // int dot = 0; //*/ (int)f.dot;
6694
-
6695
- // if ((dot&1) == 0)
6696
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6697
-
6698
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6699
- if (flipV)
6700
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6701
- else
6702
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6703
- // else
6704
- // {
6705
- // locked = true;
6706
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6707
- // }
6708
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6709
- SetColor(display, qv);
6710
- //gl.glColor4f(r, g, b, 1);
6711
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6712
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6713
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6714
-// Print(qv);
6715
- if (hasnorm)
6716
- {
6717
-// assert(rv.norm.normalized());
6718
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6719
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6720
- }
6721
-
6722
- // if ((dot&4) == 0)
6723
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6724
-
6725
- // if (wrap || !locked && (dot&8) != 0)
6726
- if (flipV)
6727
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6728
- else
6729
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6730
- // else
6731
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6732
-
6733
- // f.dot = dot;
6734
-
6735
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6736
- SetColor(display, rv);
6737
- //gl.glColor4f(r, g, b, 1);
6738
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6739
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6740
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6741
-// Print(rv);
6742
- //gl.glEnd();
6743
- }
6744
- else
6745
- {
6746
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6747
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6748
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6749
-
6750
- }
6751
-
6752
- if (false) // (attributes & WIREFRAME) != 0)
6753
- {
6754
- gl.glDisable(gl.GL_LIGHTING);
6755
-
6756
- gl.glBegin(gl.GL_LINE_LOOP);
6757
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6758
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6759
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6760
- gl.glEnd();
6761
-
6762
- gl.glEnable(gl.GL_LIGHTING);
6763
- }
6764
- }
6765
-
67666447 void drawSelf(ClickInfo info, int level, boolean select)
67676448 {
67686449 if (bRep == null)
....@@ -7334,83 +7015,83 @@
73347015 int spotw = spot.x + spot.width;
73357016 int spoth = spot.y + spot.height;
73367017 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7337
- if (CameraPane.Xmin > spot.x)
7338
- {
7339
- CameraPane.Xmin = spot.x;
7340
- }
7341
- if (CameraPane.Xmax < spotw)
7342
- {
7343
- CameraPane.Xmax = spotw;
7344
- }
7345
- if (CameraPane.Ymin > spot.y)
7346
- {
7347
- CameraPane.Ymin = spot.y;
7348
- }
7349
- if (CameraPane.Ymax < spoth)
7350
- {
7351
- CameraPane.Ymax = spoth;
7352
- }
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
+// }
73537034 spot.translate(32, 32);
73547035 spotw = spot.x + spot.width;
73557036 spoth = spot.y + spot.height;
73567037 info.g.setColor(Color.blue);
73577038 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7358
- if (CameraPane.Xmin > spot.x)
7359
- {
7360
- CameraPane.Xmin = spot.x;
7361
- }
7362
- if (CameraPane.Xmax < spotw)
7363
- {
7364
- CameraPane.Xmax = spotw;
7365
- }
7366
- if (CameraPane.Ymin > spot.y)
7367
- {
7368
- CameraPane.Ymin = spot.y;
7369
- }
7370
- if (CameraPane.Ymax < spoth)
7371
- {
7372
- CameraPane.Ymax = spoth;
7373
- }
7374
- info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7375
- 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);
73767057 spot.translate(0, -32);
73777058 info.g.setColor(Color.green);
73787059 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7379
- if (CameraPane.Xmin > spot.x)
7380
- {
7381
- CameraPane.Xmin = spot.x;
7382
- }
7383
- if (CameraPane.Xmax < spotw)
7384
- {
7385
- CameraPane.Xmax = spotw;
7386
- }
7387
- if (CameraPane.Ymin > spot.y)
7388
- {
7389
- CameraPane.Ymin = spot.y;
7390
- }
7391
- if (CameraPane.Ymax < spoth)
7392
- {
7393
- CameraPane.Ymax = spoth;
7394
- }
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
+// }
73957076 info.g.drawArc(boundary.x, boundary.y,
73967077 boundary.width, boundary.height, 0, 360);
73977078 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7398
- if (CameraPane.Xmin > boundary.x)
7399
- {
7400
- CameraPane.Xmin = boundary.x;
7401
- }
7402
- if (CameraPane.Xmax < boundary.x + boundary.width)
7403
- {
7404
- CameraPane.Xmax = boundary.x + boundary.width;
7405
- }
7406
- if (CameraPane.Ymin > boundary.y)
7407
- {
7408
- CameraPane.Ymin = boundary.y;
7409
- }
7410
- if (CameraPane.Ymax < boundary.y + boundary.height)
7411
- {
7412
- CameraPane.Ymax = boundary.y + boundary.height;
7413
- }
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
+// }
74147095 return;
74157096 }
74167097 }
....@@ -7427,7 +7108,7 @@
74277108 startX = info.x;
74287109 startY = info.y;
74297110
7430
- hitSomething = 0;
7111
+ hitSomething = -1;
74317112 cVector origin = new cVector();
74327113 //LA.xformPos(origin, toParent, origin);
74337114 Rectangle spot = new Rectangle();
....@@ -7460,7 +7141,7 @@
74607141 }
74617142
74627143 //System.out.println("info.modifiers = " + info.modifiers);
7463
- modified = (info.modifiers & CameraPane.META) != 0;
7144
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
74647145 //System.out.println("modified = " + modified);
74657146 //new Exception().printStackTrace();
74667147 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7488,7 +7169,7 @@
74887169 return true;
74897170 }
74907171
7491
- void doEditDrag0(ClickInfo info)
7172
+ void doEditDrag0(ClickInfo info, boolean opposite)
74927173 {
74937174 if (hitSomething == 0)
74947175 {
....@@ -7503,6 +7184,7 @@
75037184 //System.out.println("hitSomething = " + hitSomething);
75047185
75057186 double scale = 0.005f * info.camera.Distance();
7187
+
75067188 cVector xlate = new cVector();
75077189 //cVector xlate2 = new cVector();
75087190 switch (hitSomething)
....@@ -7513,9 +7195,9 @@
75137195
75147196 case hitCenter: // Translate
75157197
7516
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7198
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75177199
7518
- if (modified)
7200
+ if (modified || opposite)
75197201 {
75207202 //assert(false);
75217203 /*
....@@ -7561,10 +7243,10 @@
75617243 }
75627244 LA.xformDir(up, ClickInfo.matbuffer, up);
75637245 // if (!CameraPane.LOCALTRANSFORM)
7564
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7246
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
75657247 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
75667248 // if (!CameraPane.LOCALTRANSFORM)
7567
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7249
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75687250 //LA.vecCross(up, cVector.Z, right2);
75697251
75707252 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7609,6 +7291,7 @@
76097291
76107292 if (modified)
76117293 {
7294
+ // Rotate 90 degrees
76127295 angle /= (Math.PI / 4);
76137296 angle = Math.floor(angle + 0.5);
76147297 angle *= (Math.PI / 4);
....@@ -7622,7 +7305,7 @@
76227305 }
76237306 /**/
76247307
7625
- switch (info.pane.renderCamera.viewCode)
7308
+ switch (info.pane.RenderCamera().viewCode)
76267309 {
76277310 case 1: // '\001'
76287311 LA.matZRotate(toParent, angle);
....@@ -7650,24 +7333,27 @@
76507333
76517334 case hitScale: // scale
76527335 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);
76537342 if (hScale < 0.01)
76547343 {
7655
- hScale = 0.01;
7344
+ //hScale = 0.01;
76567345 }
7657
- hScale = Math.pow(hScale, scale * 50);
7658
- if (hScale < 0.01)
7659
- {
7660
- hScale = 0.01;
7661
- }
7346
+
76627347 double vScale = (double) (info.y - centerPt.y) / 32;
7663
- if (vScale < 0.01)
7348
+ sign = 1;
7349
+ if (vScale < 0)
76647350 {
7665
- vScale = 0.01;
7351
+ sign = -1;
76667352 }
7667
- vScale = Math.pow(vScale, scale * 50);
7353
+ vScale = sign*Math.pow(sign*vScale, scale * 50);
76687354 if (vScale < 0.01)
76697355 {
7670
- vScale = 0.01;
7356
+ //vScale = 0.01;
76717357 }
76727358 LA.matCopy(startMat, toParent);
76737359 /**/
....@@ -7678,17 +7364,24 @@
76787364 }
76797365 /**/
76807366
7681
- 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)
76827375 {
76837376 case 3: // '\001'
76847377 if (modified)
76857378 {
76867379 //LA.matScale(toParent, 1, hScale, vScale);
7687
- LA.matScale(toParent, vScale, 1, 1);
7380
+ LA.matScale(toParent, totalScale, 1, 1);
76887381 } // vScale, 1);
76897382 else
76907383 {
7691
- LA.matScale(toParent, vScale, vScale, vScale);
7384
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
76927385 } // vScale, 1);
76937386 break;
76947387
....@@ -7696,10 +7389,10 @@
76967389 if (modified)
76977390 {
76987391 //LA.matScale(toParent, hScale, 1, vScale);
7699
- LA.matScale(toParent, 1, vScale, 1);
7392
+ LA.matScale(toParent, 1, totalScale, 1);
77007393 } else
77017394 {
7702
- LA.matScale(toParent, vScale, 1, vScale);
7395
+ LA.matScale(toParent, totalScale, 1, totalScale);
77037396 }
77047397 break;
77057398
....@@ -7707,10 +7400,10 @@
77077400 if (modified)
77087401 {
77097402 //LA.matScale(toParent, hScale, vScale, 1);
7710
- LA.matScale(toParent, 1, 1, vScale);
7403
+ LA.matScale(toParent, 1, 1, totalScale);
77117404 } else
77127405 {
7713
- LA.matScale(toParent, vScale, vScale, 1);
7406
+ LA.matScale(toParent, totalScale, totalScale, 1);
77147407 }
77157408 break;
77167409 }
....@@ -7731,7 +7424,7 @@
77317424 if (parent == null)
77327425 {
77337426 System.out.println("NULL PARENT");
7734
- new Exception().printStackTrace();
7427
+ //new Exception().printStackTrace();
77357428 } else
77367429 {
77377430 if (parent instanceof BezierPatch)
....@@ -7843,14 +7536,22 @@
78437536 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
78447537 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
78457538 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7539
+
7540
+ String objname;
7541
+
78467542 if (false) //parent != null)
78477543 {
7848
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7544
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
78497545 } else
78507546 {
7851
- 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) ":"") */ "";
78527548 } // + super.toString();
78537549 //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);
78547555 }
78557556
78567557 public int hashCode()
....@@ -7906,6 +7607,7 @@
79067607 objectUI.closeUI();
79077608 if (editWindow != null)
79087609 {
7610
+ editWindow.ctrlPanel.FlushUI();
79097611 editWindow.refreshContents();
79107612 } // ? new
79117613 objectUI = null;
....@@ -7926,7 +7628,7 @@
79267628 /*transient*/ cVector2[] projectedVertices = new cVector2[0];
79277629
79287630 Object3D /*Composite*/ parent;
7929
- Object3D /*Composite*/ fileparent;
7631
+ Object3D /*Composite*/ fileparent; // In the case of FileObject
79307632
79317633 double[][] toParent; // dynamic matrix
79327634 double[][] fromParent;
....@@ -8041,7 +7743,7 @@
80417743 {
80427744 assert(bRep != null);
80437745 if (!(support instanceof GenericJoint)) // support.bRep != null)
8044
- GrafreeD.Assert(support.bRep == bRep.support);
7746
+ Grafreed.Assert(support.bRep == bRep.support);
80457747 }
80467748 else
80477749 {
....@@ -8090,9 +7792,9 @@
80907792 private static cVector edge2 = new cVector();
80917793 //private static cVector norm = new cVector();
80927794 /*transient private*/ int hitSomething;
8093
- private static final int hitCenter = 1;
8094
- private static final int hitScale = 2;
8095
- private static final int hitRotate = 3;
7795
+ static final int hitCenter = 1;
7796
+ static final int hitScale = 2;
7797
+ static final int hitRotate = 3;
80967798 /*transient*/ /*private*/ int viewCode; // Now used for transparency cache flag
80977799 /*transient*/ private Point centerPt;
80987800 /*transient*/ private int startX;
....@@ -8124,6 +7826,8 @@
81247826 {
81257827 Object3D targ = this;
81267828
7829
+ targ.NORMALPUSH = obj.NORMALPUSH;
7830
+
81277831 if (obj.material != null)
81287832 {
81297833 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))