Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
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;
....@@ -430,16 +431,16 @@
430431 {
431432 Object3D copy = this;
432433
433
- Camera parentcam = CameraPane.theRenderer.manipCamera;
434
+ Camera parentcam = Globals.theRenderer.ManipCamera();
434435
435
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
436
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
436437 {
437
- parentcam = CameraPane.theRenderer.cameras[1];
438
+ parentcam = Globals.theRenderer.Cameras()[1];
438439 }
439440
440
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
441
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
441442 {
442
- parentcam = CameraPane.theRenderer.cameras[0];
443
+ parentcam = Globals.theRenderer.Cameras()[0];
443444 }
444445
445446 if (this == parentcam)
....@@ -447,7 +448,7 @@
447448 //assert(this instanceof Camera);
448449
449450 for (int count = parentcam.GetTransformCount(); --count>=0;)
450
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
451
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
451452 }
452453
453454 copy.marked ^= true;
....@@ -467,7 +468,7 @@
467468 //assert(this instanceof Camera);
468469
469470 for (int count = parentcam.GetTransformCount(); --count>=0;)
470
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
471
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
471472 }
472473
473474 copy.Touch(); // display list issue
....@@ -602,7 +603,7 @@
602603 return;
603604 }
604605
605
- if (CameraPane.fromscript)
606
+ if (Globals.fromscript)
606607 {
607608 transformcount = 0;
608609 return;
....@@ -796,7 +797,7 @@
796797
797798 if (marked && Globals.isLIVE() && live &&
798799 //TEMP21aug2018
799
- Globals.DrawMode() == iCameraPane.SHADOW &&
800
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
800801 currentframe != Globals.framecount)
801802 {
802803 currentframe = Globals.framecount;
....@@ -911,6 +912,11 @@
911912 fromParent = null; // LA.newMatrix();
912913 bRep = null; // new BoundaryRep();
913914
915
+ if (oname != null && oname.equals("LeftHand"))
916
+ {
917
+ name = oname;
918
+ }
919
+
914920 /*
915921 float hue = (float)Math.random();
916922 Color col;
....@@ -953,7 +959,7 @@
953959
954960 public Object clone()
955961 {
956
- return GrafreeD.clone(this);
962
+ return Grafreed.clone(this);
957963 }
958964
959965 Object3D copyExpand()
....@@ -1469,7 +1475,7 @@
14691475 BoundaryRep.SEUIL = other.material.cameralight;
14701476
14711477 // Set default to 0.1
1472
- BoundaryRep.SEUIL /= 2;
1478
+ BoundaryRep.SEUIL /= 4; // 2;
14731479 System.out.println("SEUIL = " + BoundaryRep.SEUIL);
14741480 }
14751481
....@@ -1728,7 +1734,7 @@
17281734 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17291735 o.bRep = transientrep;
17301736 if (clone)
1731
- o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
1737
+ o.bRep = (BoundaryRep) Grafreed.clone(transientrep);
17321738 o.CreateMaterial();
17331739 o.SetAttributes(this, -1);
17341740 //parent
....@@ -1741,7 +1747,7 @@
17411747 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17421748 o.bRep = bRep;
17431749 if (clone)
1744
- o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
1750
+ o.bRep = (BoundaryRep) Grafreed.clone(bRep);
17451751 o.CreateMaterial();
17461752 //o.overwriteThis(this, -1);
17471753 o.SetAttributes(this, -1);
....@@ -2299,6 +2305,7 @@
22992305 {
23002306 if (newWindow)
23012307 {
2308
+ new Exception().printStackTrace();
23022309 System.exit(0);
23032310 if (parent != null)
23042311 {
....@@ -2475,13 +2482,13 @@
24752482 return retval;
24762483 }
24772484
2478
- void doEditDrag(ClickInfo info)
2485
+ void doEditDrag(ClickInfo info, boolean opposite)
24792486 {
24802487 switch (doSomething)
24812488 {
24822489 case 1: // '\001'
24832490 //super.
2484
- doEditDrag0(info);
2491
+ doEditDrag0(info, opposite);
24852492 break;
24862493
24872494 case 2: // '\002'
....@@ -2494,11 +2501,11 @@
24942501 {
24952502 //sel.hitSomething = childToDrag.hitSomething;
24962503 //childToDrag.doEditDrag(info);
2497
- sel.doEditDrag(info);
2504
+ sel.doEditDrag(info, opposite);
24982505 } else
24992506 {
25002507 //super.
2501
- doEditDrag0(info);
2508
+ doEditDrag0(info, opposite);
25022509 }
25032510 }
25042511 break;
....@@ -2905,7 +2912,8 @@
29052912 {
29062913 if (bRep != null)
29072914 {
2908
- bRep.GenUV();
2915
+ bRep.GenUV(); //1);
2916
+ //bRep.UnfoldUV();
29092917 Touch();
29102918 }
29112919 }
....@@ -2980,6 +2988,31 @@
29802988 blockloop = false;
29812989 }
29822990
2991
+ void TransformChildren()
2992
+ {
2993
+ if (toParent != null)
2994
+ {
2995
+ for (int i=Size(); --i>=0;)
2996
+ {
2997
+ Object3D v = get(i);
2998
+
2999
+ if (v.toParent == null)
3000
+ {
3001
+ v.toParent = LA.newMatrix();
3002
+ v.fromParent = LA.newMatrix();
3003
+ }
3004
+
3005
+ LA.matConcat(v.toParent, toParent, v.toParent);
3006
+ LA.matConcat(fromParent, v.fromParent, v.fromParent);
3007
+ }
3008
+
3009
+ toParent = null; // LA.matIdentity(toParent);
3010
+ fromParent = null; // LA.matIdentity(fromParent);
3011
+
3012
+ Touch();
3013
+ }
3014
+ }
3015
+
29833016 void TransformGeometry()
29843017 {
29853018 Object3D obj = this;
....@@ -3201,7 +3234,7 @@
32013234
32023235 BoundaryRep sup = bRep.support;
32033236 bRep.support = null;
3204
- BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
3237
+ BoundaryRep temprep = (BoundaryRep) Grafreed.clone(bRep);
32053238 // bRep.SplitInTwo(onlyone); // thread...
32063239 temprep.SplitInTwo(reduction34, onlyone);
32073240 bRep = temprep;
....@@ -3725,7 +3758,7 @@
37253758 if (child == null)
37263759 continue;
37273760
3728
- if (GrafreeD.RENDERME > 0)
3761
+ if (Grafreed.RENDERME > 0)
37293762 {
37303763 if (child instanceof Merge)
37313764 ((Merge)child).renderme();
....@@ -3876,7 +3909,7 @@
38763909 if (child == null)
38773910 continue;
38783911
3879
- if (GrafreeD.RENDERME > 0)
3912
+ if (Grafreed.RENDERME > 0)
38803913 {
38813914 if (child instanceof Merge)
38823915 ((Merge)child).renderme();
....@@ -4071,7 +4104,7 @@
40714104 if (child == null)
40724105 continue;
40734106
4074
- if (GrafreeD.RENDERME > 0)
4107
+ if (Grafreed.RENDERME > 0)
40754108 {
40764109 if (child instanceof Merge)
40774110 ((Merge)child).renderme();
....@@ -4854,7 +4887,7 @@
48544887 return globalTransform;
48554888 }
48564889
4857
- void PreprocessOcclusion(CameraPane cp)
4890
+ void PreprocessOcclusion(iCameraPane cp)
48584891 {
48594892 /*
48604893 if (AOdone)
....@@ -5156,10 +5189,34 @@
51565189
51575190 // System.out.println("Fullname = " + fullname);
51585191
5159
- if (fullname.name.indexOf(":") == -1)
5160
- return fullname.name;
5192
+ // Does not work on Windows due to C:
5193
+// if (fullname.name.indexOf(":") == -1)
5194
+// return fullname.name;
5195
+//
5196
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51615197
5162
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5198
+ String[] split = fullname.name.split(":");
5199
+
5200
+ if (split.length == 0)
5201
+ {
5202
+ return "";
5203
+ }
5204
+
5205
+ if (split.length <= 2)
5206
+ {
5207
+ if (fullname.name.endsWith(":"))
5208
+ {
5209
+ // Windows
5210
+ return fullname.name.substring(0, fullname.name.length()-1);
5211
+ }
5212
+
5213
+ return split[0];
5214
+ }
5215
+
5216
+ // Windows
5217
+ assert(split.length == 4);
5218
+
5219
+ return split[0] + ":" + split[1];
51635220 }
51645221
51655222 static String GetBump(cTexture fullname)
....@@ -5168,10 +5225,38 @@
51685225 return "";
51695226
51705227 // System.out.println("Fullname = " + fullname);
5171
- if (fullname.name.indexOf(":") == -1)
5172
- return "";
5173
-
5174
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5228
+ // Does not work on Windows due to C:
5229
+// if (fullname.name.indexOf(":") == -1)
5230
+// return "";
5231
+//
5232
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5233
+ String[] split = fullname.name.split(":");
5234
+
5235
+ if (split.length == 0)
5236
+ {
5237
+ return "";
5238
+ }
5239
+
5240
+ if (split.length == 1)
5241
+ {
5242
+ return "";
5243
+ }
5244
+
5245
+ if (split.length == 2)
5246
+ {
5247
+ if (fullname.name.endsWith(":"))
5248
+ {
5249
+ // Windows
5250
+ return "";
5251
+ }
5252
+
5253
+ return split[1];
5254
+ }
5255
+
5256
+ // Windows
5257
+ assert(split.length == 4);
5258
+
5259
+ return split[2] + ":" + split[3];
51755260 }
51765261
51775262 String GetPigmentTexture()
....@@ -5245,7 +5330,7 @@
52455330 System.out.print("; textures = " + textures);
52465331 System.out.println("; usedtextures = " + usedtextures);
52475332
5248
- if (GetTextures() == null)
5333
+ if (GetTextures() == null) // What is that??
52495334 GetTextures().name = ":";
52505335
52515336 String texname = tex;
....@@ -5324,9 +5409,10 @@
53245409 return
53255410 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
53265411 // PROBLEM with CROWD!!
5327
- && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
5412
+ && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
53285413 }
53295414
5415
+ static boolean DEBUG_SELECTION = false;
53305416
53315417 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53325418 {
....@@ -5365,12 +5451,12 @@
53655451 }
53665452
53675453 if ((//display.DrawMode() == CameraPane.SHADOW ||
5368
- display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5454
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53695455 {
53705456 return;
53715457 }
53725458
5373
- javax.media.opengl.GL gl = display.GetGL();
5459
+ //javax.media.opengl.GL gl = display.GetGL();
53745460
53755461 /*
53765462 if (touched)
....@@ -5406,7 +5492,7 @@
54065492
54075493 boolean compiled = false;
54085494
5409
- boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
5495
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54105496
54115497 if (!selectmode && //display.DrawMode() != display.SELECTION &&
54125498 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5422,7 +5508,7 @@
54225508 //if (displaylist == -1 && usecalllists)
54235509 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54245510 {
5425
- bRep.displaylist = gl.glGenLists(1);
5511
+ bRep.displaylist = display.GenList();
54265512 assert(bRep.displaylist != 0);
54275513 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54285514 //System.out.println("\tgen list " + list);
....@@ -5434,14 +5520,16 @@
54345520 if (usecalllists)
54355521 {
54365522 // System.err.println("new list " + bRep.displaylist + " for " + this);
5437
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5523
+ display.NewList(bRep.displaylist);
54385524 }
5525
+
54395526 CallList(display, root, selected, blocked);
5527
+
54405528 // compiled = true;
54415529 if (usecalllists)
54425530 {
54435531 // System.err.println("end list " + bRep.displaylist + " for " + this);
5444
- gl.glEndList();
5532
+ display.EndList();
54455533 }
54465534 //gl.glDrawBuffer(gl.GL_BACK);
54475535 // XXX touched = false;
....@@ -5484,12 +5572,12 @@
54845572
54855573 // frustum culling
54865574 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5487
- && display.DrawMode() != CameraPane.SELECTION)
5575
+ && display.DrawMode() != iCameraPane.SELECTION)
54885576 {
5489
- if (display.DrawMode() == CameraPane.SHADOW)
5577
+ if (display.DrawMode() == iCameraPane.SHADOW)
54905578 {
54915579 if (!link2master // tricky to cull in shadow mode.
5492
- && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
5580
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54935581 {
54945582 //System.out.print("CULLED");
54955583 culled = true;
....@@ -5497,7 +5585,7 @@
54975585 }
54985586 else
54995587 //GetBRep().getBounds(v0, v1, this);
5500
- if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
5588
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
55015589 culled = true;
55025590
55035591 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5533,11 +5621,11 @@
55335621
55345622
55355623 if (!culled)
5536
- if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)
5624
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55375625 {
55385626 if (GetBRep() != null)
55395627 {
5540
- CameraPane.NextIndex(this, gl);
5628
+ display.NextIndex();
55415629 // vertex color conflict : gl.glCallList(list);
55425630 DrawNode(display, root, selected);
55435631 if (this instanceof BezierPatch)
....@@ -5594,7 +5682,7 @@
55945682
55955683 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55965684 assert(bRep.displaylist != 0);
5597
- gl.glCallList(bRep.displaylist);
5685
+ display.CallList(bRep.displaylist);
55985686 // june 2013 drawSelf(display, root, selected);
55995687 }
56005688 }
....@@ -5894,9 +5982,10 @@
58945982 return;
58955983 }
58965984
5985
+ //bRep.GenUV(1/material.diffuseness);
58975986 // bRep.lock = true;
58985987
5899
- javax.media.opengl.GL gl = display.GetGL();
5988
+ //javax.media.opengl.GL gl = display.GetGL();
59005989
59015990 if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59025991 {
....@@ -5913,23 +6002,7 @@
59136002
59146003 bRep.getMinMax(min, max, 100);
59156004
5916
- gl.glBegin(gl.GL_LINES);
5917
-
5918
- gl.glVertex3d(min.x, min.y, min.z);
5919
- gl.glVertex3d(min.x, min.y, max.z);
5920
- gl.glVertex3d(min.x, min.y, min.z);
5921
- gl.glVertex3d(min.x, max.y, min.z);
5922
- gl.glVertex3d(min.x, min.y, min.z);
5923
- gl.glVertex3d(max.x, min.y, min.z);
5924
-
5925
- gl.glVertex3d(max.x, max.y, max.z);
5926
- gl.glVertex3d(min.x, max.y, max.z);
5927
- gl.glVertex3d(max.x, max.y, max.z);
5928
- gl.glVertex3d(max.x, min.y, max.z);
5929
- gl.glVertex3d(max.x, max.y, max.z);
5930
- gl.glVertex3d(max.x, max.y, min.z);
5931
-
5932
- gl.glEnd();
6005
+ display.DrawBox(min, max);
59336006
59346007 return;
59356008 }
....@@ -5973,7 +6046,7 @@
59736046 {
59746047 //throw new Error();
59756048
5976
- boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
6049
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
59776050
59786051 int[] strips = bRep.getRawIndices();
59796052
....@@ -5983,178 +6056,14 @@
59836056 new Exception().printStackTrace();
59846057 return;
59856058 }
5986
-
5987
- // TRIANGLE STRIP ARRAY
5988
- if (bRep.trimmed)
5989
- {
5990
- float[] v = bRep.getRawVertices();
5991
- float[] n = bRep.getRawNormals();
5992
- float[] c = bRep.getRawColors();
5993
- float[] uv = bRep.getRawUVMap();
5994
-
5995
- int count2 = 0;
5996
- int count3 = 0;
5997
-
5998
- if (n.length > 0)
5999
- {
6000
- for (int i = 0; i < strips.length; i++)
6001
- {
6002
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6003
-
6004
- /*
6005
- boolean locked = false;
6006
- float eps = 0.1f;
6007
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6008
-
6009
- int dot = 0;
6010
-
6011
- if ((dot&1) == 0)
6012
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6013
-
6014
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6015
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6016
- else
6017
- {
6018
- locked = true;
6019
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6020
- }
6021
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6022
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6023
- if (hasnorm)
6024
- {
6025
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6026
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6027
- }
6028
-
6029
- if ((dot&4) == 0)
6030
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6031
-
6032
- if (wrap || !locked && (dot&8) != 0)
6033
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6034
- else
6035
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6036
-
6037
- f.dot = dot;
6038
- */
6039
-
6040
- if (!selectmode)
6041
- {
6042
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6043
- {
6044
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6045
- } else
6046
- {
6047
- gl.glNormal3f(0, 0, 1);
6048
- }
6049
-
6050
- if (c != null)
6051
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6052
- {
6053
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6054
- }
6055
- }
6056
- if (flipV)
6057
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6058
- else
6059
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6060
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6061
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6062
-
6063
- count2 += 2;
6064
- count3 += 3;
6065
- if (!selectmode)
6066
- {
6067
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6068
- {
6069
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6070
- } else
6071
- {
6072
- gl.glNormal3f(0, 0, 1);
6073
- }
6074
- if (c != null)
6075
- {
6076
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6077
- }
6078
- }
6079
- if (flipV)
6080
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6081
- else
6082
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6083
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6084
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6085
-
6086
- count2 += 2;
6087
- count3 += 3;
6088
- for (int j = 0; j < strips[i] - 2; j++)
6089
- {
6090
- //gl.glTexCoord2d(...);
6091
- if (!selectmode)
6092
- {
6093
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6094
- {
6095
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6096
- } else
6097
- {
6098
- gl.glNormal3f(0, 0, 1);
6099
- }
6100
- if (c != null)
6101
- {
6102
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6103
- }
6104
- }
6105
-
6106
- if (flipV)
6107
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6108
- else
6109
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6110
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6111
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6112
- count2 += 2;
6113
- count3 += 3;
6114
- }
6115
-
6116
- gl.glEnd();
6117
- }
6118
- }
6119
-
6120
- assert count3 == v.length;
6121
- }
6122
- else // !trimmed
6123
- {
6124
- int count = 0;
6125
- for (int i = 0; i < strips.length; i++)
6126
- {
6127
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6128
-
6129
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6130
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6131
-
6132
- drawVertex(gl, p, selectmode);
6133
- drawVertex(gl, q, selectmode);
6134
-
6135
- for (int j = 0; j < strips[i] - 2; j++)
6136
- {
6137
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6138
-
6139
-// if (j%2 == 0)
6140
-// drawFace(p, q, r, display, null);
6141
-// else
6142
-// drawFace(p, r, q, display, null);
6143
-
6144
-// p = q;
6145
-// q = r;
6146
- drawVertex(gl, r, selectmode);
6147
- }
6148
-
6149
- gl.glEnd();
6150
- }
6151
- }
6059
+
6060
+ display.DrawGeometry(bRep, flipV, selectmode);
61526061 } else // catch (Error e)
61536062 {
61546063 // TRIANGLE ARRAY
61556064 if (IsOpaque()) // Static())
61566065 {
6157
- gl.glBegin(gl.GL_TRIANGLES);
6066
+ display.StartTriangles();
61586067 int facecount = bRep.FaceCount();
61596068 for (int i = 0; i < facecount; i++)
61606069 {
....@@ -6219,7 +6128,7 @@
62196128
62206129 display.DrawFace(this, p, q, r, face);
62216130 }
6222
- gl.glEnd();
6131
+ display.EndTriangles();
62236132 }
62246133 else
62256134 {
....@@ -6248,8 +6157,8 @@
62486157 //System.out.println("SORT");
62496158
62506159 java.util.Arrays.sort(facescompare);
6251
-
6252
- gl.glBegin(gl.GL_TRIANGLES);
6160
+
6161
+ display.StartTriangles();
62536162 for (int i = 0; i < facecount; i++)
62546163 {
62556164 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6263,11 +6172,12 @@
62636172
62646173 display.DrawFace(this, p, q, r, face);
62656174 }
6266
- gl.glEnd();
6175
+ display.EndTriangles();
62676176 }
62686177
62696178 if (false) // live && support != null && support.bRep != null) // debug weights
62706179 {
6180
+ /*
62716181 gl.glDisable(gl.GL_LIGHTING);
62726182 float[] colorV = new float[3];
62736183
....@@ -6346,6 +6256,7 @@
63466256 // gl.glEnd();
63476257 }
63486258 }
6259
+ */
63496260 }
63506261 }
63516262
....@@ -6390,7 +6301,7 @@
63906301 center.add(r);
63916302 center.mul(1.0/3);
63926303
6393
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6304
+ center.sub(Globals.theRenderer.EyeCamera().location);
63946305
63956306 distance = center.dot(center);
63966307 }
....@@ -6404,22 +6315,6 @@
64046315 void Print(Vertex v)
64056316 {
64066317 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
6407
- }
6408
-
6409
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6410
- {
6411
- if (!selectmode)
6412
- {
6413
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6414
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6415
-
6416
- if (flipV)
6417
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6418
- else
6419
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6420
- }
6421
-
6422
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
64236318 }
64246319
64256320 void drawSelf(ClickInfo info, int level, boolean select)
....@@ -6993,83 +6888,83 @@
69936888 int spotw = spot.x + spot.width;
69946889 int spoth = spot.y + spot.height;
69956890 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
6996
- if (CameraPane.Xmin > spot.x)
6997
- {
6998
- CameraPane.Xmin = spot.x;
6999
- }
7000
- if (CameraPane.Xmax < spotw)
7001
- {
7002
- CameraPane.Xmax = spotw;
7003
- }
7004
- if (CameraPane.Ymin > spot.y)
7005
- {
7006
- CameraPane.Ymin = spot.y;
7007
- }
7008
- if (CameraPane.Ymax < spoth)
7009
- {
7010
- CameraPane.Ymax = spoth;
7011
- }
6891
+// if (CameraPane.Xmin > spot.x)
6892
+// {
6893
+// CameraPane.Xmin = spot.x;
6894
+// }
6895
+// if (CameraPane.Xmax < spotw)
6896
+// {
6897
+// CameraPane.Xmax = spotw;
6898
+// }
6899
+// if (CameraPane.Ymin > spot.y)
6900
+// {
6901
+// CameraPane.Ymin = spot.y;
6902
+// }
6903
+// if (CameraPane.Ymax < spoth)
6904
+// {
6905
+// CameraPane.Ymax = spoth;
6906
+// }
70126907 spot.translate(32, 32);
70136908 spotw = spot.x + spot.width;
70146909 spoth = spot.y + spot.height;
70156910 info.g.setColor(Color.blue);
70166911 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7017
- if (CameraPane.Xmin > spot.x)
7018
- {
7019
- CameraPane.Xmin = spot.x;
7020
- }
7021
- if (CameraPane.Xmax < spotw)
7022
- {
7023
- CameraPane.Xmax = spotw;
7024
- }
7025
- if (CameraPane.Ymin > spot.y)
7026
- {
7027
- CameraPane.Ymin = spot.y;
7028
- }
7029
- if (CameraPane.Ymax < spoth)
7030
- {
7031
- CameraPane.Ymax = spoth;
7032
- }
6912
+// if (CameraPane.Xmin > spot.x)
6913
+// {
6914
+// CameraPane.Xmin = spot.x;
6915
+// }
6916
+// if (CameraPane.Xmax < spotw)
6917
+// {
6918
+// CameraPane.Xmax = spotw;
6919
+// }
6920
+// if (CameraPane.Ymin > spot.y)
6921
+// {
6922
+// CameraPane.Ymin = spot.y;
6923
+// }
6924
+// if (CameraPane.Ymax < spoth)
6925
+// {
6926
+// CameraPane.Ymax = spoth;
6927
+// }
70336928 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
70346929 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
70356930 spot.translate(0, -32);
70366931 info.g.setColor(Color.green);
70376932 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7038
- if (CameraPane.Xmin > spot.x)
7039
- {
7040
- CameraPane.Xmin = spot.x;
7041
- }
7042
- if (CameraPane.Xmax < spotw)
7043
- {
7044
- CameraPane.Xmax = spotw;
7045
- }
7046
- if (CameraPane.Ymin > spot.y)
7047
- {
7048
- CameraPane.Ymin = spot.y;
7049
- }
7050
- if (CameraPane.Ymax < spoth)
7051
- {
7052
- CameraPane.Ymax = spoth;
7053
- }
6933
+// if (CameraPane.Xmin > spot.x)
6934
+// {
6935
+// CameraPane.Xmin = spot.x;
6936
+// }
6937
+// if (CameraPane.Xmax < spotw)
6938
+// {
6939
+// CameraPane.Xmax = spotw;
6940
+// }
6941
+// if (CameraPane.Ymin > spot.y)
6942
+// {
6943
+// CameraPane.Ymin = spot.y;
6944
+// }
6945
+// if (CameraPane.Ymax < spoth)
6946
+// {
6947
+// CameraPane.Ymax = spoth;
6948
+// }
70546949 info.g.drawArc(boundary.x, boundary.y,
70556950 boundary.width, boundary.height, 0, 360);
70566951 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7057
- if (CameraPane.Xmin > boundary.x)
7058
- {
7059
- CameraPane.Xmin = boundary.x;
7060
- }
7061
- if (CameraPane.Xmax < boundary.x + boundary.width)
7062
- {
7063
- CameraPane.Xmax = boundary.x + boundary.width;
7064
- }
7065
- if (CameraPane.Ymin > boundary.y)
7066
- {
7067
- CameraPane.Ymin = boundary.y;
7068
- }
7069
- if (CameraPane.Ymax < boundary.y + boundary.height)
7070
- {
7071
- CameraPane.Ymax = boundary.y + boundary.height;
7072
- }
6952
+// if (CameraPane.Xmin > boundary.x)
6953
+// {
6954
+// CameraPane.Xmin = boundary.x;
6955
+// }
6956
+// if (CameraPane.Xmax < boundary.x + boundary.width)
6957
+// {
6958
+// CameraPane.Xmax = boundary.x + boundary.width;
6959
+// }
6960
+// if (CameraPane.Ymin > boundary.y)
6961
+// {
6962
+// CameraPane.Ymin = boundary.y;
6963
+// }
6964
+// if (CameraPane.Ymax < boundary.y + boundary.height)
6965
+// {
6966
+// CameraPane.Ymax = boundary.y + boundary.height;
6967
+// }
70736968 return;
70746969 }
70756970 }
....@@ -7119,7 +7014,7 @@
71197014 }
71207015
71217016 //System.out.println("info.modifiers = " + info.modifiers);
7122
- modified = (info.modifiers & CameraPane.META) != 0;
7017
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
71237018 //System.out.println("modified = " + modified);
71247019 //new Exception().printStackTrace();
71257020 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7147,7 +7042,7 @@
71477042 return true;
71487043 }
71497044
7150
- void doEditDrag0(ClickInfo info)
7045
+ void doEditDrag0(ClickInfo info, boolean opposite)
71517046 {
71527047 if (hitSomething == 0)
71537048 {
....@@ -7172,9 +7067,9 @@
71727067
71737068 case hitCenter: // Translate
71747069
7175
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7070
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
71767071
7177
- if (modified)
7072
+ if (modified || opposite)
71787073 {
71797074 //assert(false);
71807075 /*
....@@ -7220,10 +7115,10 @@
72207115 }
72217116 LA.xformDir(up, ClickInfo.matbuffer, up);
72227117 // if (!CameraPane.LOCALTRANSFORM)
7223
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7118
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
72247119 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
72257120 // if (!CameraPane.LOCALTRANSFORM)
7226
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7121
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
72277122 //LA.vecCross(up, cVector.Z, right2);
72287123
72297124 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7268,6 +7163,7 @@
72687163
72697164 if (modified)
72707165 {
7166
+ // Rotate 90 degrees
72717167 angle /= (Math.PI / 4);
72727168 angle = Math.floor(angle + 0.5);
72737169 angle *= (Math.PI / 4);
....@@ -7281,7 +7177,7 @@
72817177 }
72827178 /**/
72837179
7284
- switch (info.pane.renderCamera.viewCode)
7180
+ switch (info.pane.RenderCamera().viewCode)
72857181 {
72867182 case 1: // '\001'
72877183 LA.matZRotate(toParent, angle);
....@@ -7337,7 +7233,7 @@
73377233 }
73387234 /**/
73397235
7340
- switch (info.pane.renderCamera.viewCode)
7236
+ switch (info.pane.RenderCamera().viewCode)
73417237 {
73427238 case 3: // '\001'
73437239 if (modified)
....@@ -7502,14 +7398,22 @@
75027398 //return super.toString() + " (id=" + list + ")" + " (brep=" + bRep + ")";
75037399 //return name + " (id=" + list + ")" + " (brep=" + bRep + ") " + super.toString();
75047400 //return name + " (#tri = " + (bRep==null?0:bRep.VertexCount()) + ") " + super.toString();
7401
+
7402
+ String objname;
7403
+
75057404 if (false) //parent != null)
75067405 {
7507
- return name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
7406
+ objname = name + " " + System.identityHashCode(this) + " (" + parent.name + " " + System.identityHashCode(parent) + ")";
75087407 } else
75097408 {
7510
- return GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ") ")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ +System.identityHashCode(this);
7409
+ objname = GetName() + (Math.abs(count) == 1000 ? (count == 1000 ? " " : " * ") : (" (" + (count /*- 1*/) + ")")) + /*(IsSelected()?"(selected) ":"") + (touched?"(touched) ":"") */ "";
75117410 } // + super.toString();
75127411 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
7412
+
7413
+ if (!Globals.ADVANCED)
7414
+ return objname;
7415
+
7416
+ return objname + " " + System.identityHashCode(this);
75137417 }
75147418
75157419 public int hashCode()
....@@ -7565,6 +7469,7 @@
75657469 objectUI.closeUI();
75667470 if (editWindow != null)
75677471 {
7472
+ editWindow.ctrlPanel.FlushUI();
75687473 editWindow.refreshContents();
75697474 } // ? new
75707475 objectUI = null;
....@@ -7700,7 +7605,7 @@
77007605 {
77017606 assert(bRep != null);
77027607 if (!(support instanceof GenericJoint)) // support.bRep != null)
7703
- GrafreeD.Assert(support.bRep == bRep.support);
7608
+ Grafreed.Assert(support.bRep == bRep.support);
77047609 }
77057610 else
77067611 {