Normand Briere
2019-05-05 481df91095a82824d2a98d4db860b3caadbda70a
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;
....@@ -2299,6 +2300,7 @@
22992300 {
23002301 if (newWindow)
23012302 {
2303
+ new Exception().printStackTrace();
23022304 System.exit(0);
23032305 if (parent != null)
23042306 {
....@@ -2475,13 +2477,13 @@
24752477 return retval;
24762478 }
24772479
2478
- void doEditDrag(ClickInfo info)
2480
+ void doEditDrag(ClickInfo info, boolean opposite)
24792481 {
24802482 switch (doSomething)
24812483 {
24822484 case 1: // '\001'
24832485 //super.
2484
- doEditDrag0(info);
2486
+ doEditDrag0(info, opposite);
24852487 break;
24862488
24872489 case 2: // '\002'
....@@ -2494,11 +2496,11 @@
24942496 {
24952497 //sel.hitSomething = childToDrag.hitSomething;
24962498 //childToDrag.doEditDrag(info);
2497
- sel.doEditDrag(info);
2499
+ sel.doEditDrag(info, opposite);
24982500 } else
24992501 {
25002502 //super.
2501
- doEditDrag0(info);
2503
+ doEditDrag0(info, opposite);
25022504 }
25032505 }
25042506 break;
....@@ -2905,7 +2907,8 @@
29052907 {
29062908 if (bRep != null)
29072909 {
2908
- bRep.GenUV();
2910
+ bRep.GenUV(); //1);
2911
+ //bRep.UnfoldUV();
29092912 Touch();
29102913 }
29112914 }
....@@ -4854,7 +4857,7 @@
48544857 return globalTransform;
48554858 }
48564859
4857
- void PreprocessOcclusion(CameraPane cp)
4860
+ void PreprocessOcclusion(iCameraPane cp)
48584861 {
48594862 /*
48604863 if (AOdone)
....@@ -5156,10 +5159,34 @@
51565159
51575160 // System.out.println("Fullname = " + fullname);
51585161
5159
- if (fullname.name.indexOf(":") == -1)
5160
- return fullname.name;
5162
+ // Does not work on Windows due to C:
5163
+// if (fullname.name.indexOf(":") == -1)
5164
+// return fullname.name;
5165
+//
5166
+// return fullname.name.substring(0,fullname.name.indexOf(":"));
51615167
5162
- return fullname.name.substring(0,fullname.name.indexOf(":"));
5168
+ String[] split = fullname.name.split(":");
5169
+
5170
+ if (split.length == 0)
5171
+ {
5172
+ return "";
5173
+ }
5174
+
5175
+ if (split.length <= 2)
5176
+ {
5177
+ if (fullname.name.endsWith(":"))
5178
+ {
5179
+ // Windows
5180
+ return fullname.name.substring(0, fullname.name.length()-1);
5181
+ }
5182
+
5183
+ return split[0];
5184
+ }
5185
+
5186
+ // Windows
5187
+ assert(split.length == 4);
5188
+
5189
+ return split[0] + ":" + split[1];
51635190 }
51645191
51655192 static String GetBump(cTexture fullname)
....@@ -5168,10 +5195,38 @@
51685195 return "";
51695196
51705197 // 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());
5198
+ // Does not work on Windows due to C:
5199
+// if (fullname.name.indexOf(":") == -1)
5200
+// return "";
5201
+//
5202
+// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
5203
+ String[] split = fullname.name.split(":");
5204
+
5205
+ if (split.length == 0)
5206
+ {
5207
+ return "";
5208
+ }
5209
+
5210
+ if (split.length == 1)
5211
+ {
5212
+ return "";
5213
+ }
5214
+
5215
+ if (split.length == 2)
5216
+ {
5217
+ if (fullname.name.endsWith(":"))
5218
+ {
5219
+ // Windows
5220
+ return "";
5221
+ }
5222
+
5223
+ return split[1];
5224
+ }
5225
+
5226
+ // Windows
5227
+ assert(split.length == 4);
5228
+
5229
+ return split[2] + ":" + split[3];
51755230 }
51765231
51775232 String GetPigmentTexture()
....@@ -5245,7 +5300,7 @@
52455300 System.out.print("; textures = " + textures);
52465301 System.out.println("; usedtextures = " + usedtextures);
52475302
5248
- if (GetTextures() == null)
5303
+ if (GetTextures() == null) // What is that??
52495304 GetTextures().name = ":";
52505305
52515306 String texname = tex;
....@@ -5327,6 +5382,7 @@
53275382 && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
53285383 }
53295384
5385
+ static boolean DEBUG_SELECTION = false;
53305386
53315387 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53325388 {
....@@ -5365,12 +5421,12 @@
53655421 }
53665422
53675423 if ((//display.DrawMode() == CameraPane.SHADOW ||
5368
- display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5424
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53695425 {
53705426 return;
53715427 }
53725428
5373
- javax.media.opengl.GL gl = display.GetGL();
5429
+ //javax.media.opengl.GL gl = display.GetGL();
53745430
53755431 /*
53765432 if (touched)
....@@ -5406,7 +5462,7 @@
54065462
54075463 boolean compiled = false;
54085464
5409
- boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
5465
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
54105466
54115467 if (!selectmode && //display.DrawMode() != display.SELECTION &&
54125468 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5422,7 +5478,7 @@
54225478 //if (displaylist == -1 && usecalllists)
54235479 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54245480 {
5425
- bRep.displaylist = gl.glGenLists(1);
5481
+ bRep.displaylist = display.GenList();
54265482 assert(bRep.displaylist != 0);
54275483 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54285484 //System.out.println("\tgen list " + list);
....@@ -5434,14 +5490,16 @@
54345490 if (usecalllists)
54355491 {
54365492 // System.err.println("new list " + bRep.displaylist + " for " + this);
5437
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5493
+ display.NewList(bRep.displaylist);
54385494 }
5495
+
54395496 CallList(display, root, selected, blocked);
5497
+
54405498 // compiled = true;
54415499 if (usecalllists)
54425500 {
54435501 // System.err.println("end list " + bRep.displaylist + " for " + this);
5444
- gl.glEndList();
5502
+ display.EndList();
54455503 }
54465504 //gl.glDrawBuffer(gl.GL_BACK);
54475505 // XXX touched = false;
....@@ -5484,12 +5542,12 @@
54845542
54855543 // frustum culling
54865544 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5487
- && display.DrawMode() != CameraPane.SELECTION)
5545
+ && display.DrawMode() != iCameraPane.SELECTION)
54885546 {
5489
- if (display.DrawMode() == CameraPane.SHADOW)
5547
+ if (display.DrawMode() == iCameraPane.SHADOW)
54905548 {
54915549 if (!link2master // tricky to cull in shadow mode.
5492
- && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
5550
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54935551 {
54945552 //System.out.print("CULLED");
54955553 culled = true;
....@@ -5497,7 +5555,7 @@
54975555 }
54985556 else
54995557 //GetBRep().getBounds(v0, v1, this);
5500
- if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
5558
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
55015559 culled = true;
55025560
55035561 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5533,11 +5591,11 @@
55335591
55345592
55355593 if (!culled)
5536
- if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)
5594
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55375595 {
55385596 if (GetBRep() != null)
55395597 {
5540
- CameraPane.NextIndex(this, gl);
5598
+ display.NextIndex();
55415599 // vertex color conflict : gl.glCallList(list);
55425600 DrawNode(display, root, selected);
55435601 if (this instanceof BezierPatch)
....@@ -5594,7 +5652,7 @@
55945652
55955653 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55965654 assert(bRep.displaylist != 0);
5597
- gl.glCallList(bRep.displaylist);
5655
+ display.CallList(bRep.displaylist);
55985656 // june 2013 drawSelf(display, root, selected);
55995657 }
56005658 }
....@@ -5894,9 +5952,10 @@
58945952 return;
58955953 }
58965954
5955
+ //bRep.GenUV(1/material.diffuseness);
58975956 // bRep.lock = true;
58985957
5899
- javax.media.opengl.GL gl = display.GetGL();
5958
+ //javax.media.opengl.GL gl = display.GetGL();
59005959
59015960 if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59025961 {
....@@ -5913,23 +5972,7 @@
59135972
59145973 bRep.getMinMax(min, max, 100);
59155974
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();
5975
+ display.DrawBox(min, max);
59335976
59345977 return;
59355978 }
....@@ -5973,7 +6016,7 @@
59736016 {
59746017 //throw new Error();
59756018
5976
- boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
6019
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
59776020
59786021 int[] strips = bRep.getRawIndices();
59796022
....@@ -5983,178 +6026,14 @@
59836026 new Exception().printStackTrace();
59846027 return;
59856028 }
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
- }
6029
+
6030
+ display.DrawGeometry(bRep, flipV, selectmode);
61526031 } else // catch (Error e)
61536032 {
61546033 // TRIANGLE ARRAY
61556034 if (IsOpaque()) // Static())
61566035 {
6157
- gl.glBegin(gl.GL_TRIANGLES);
6036
+ display.StartTriangles();
61586037 int facecount = bRep.FaceCount();
61596038 for (int i = 0; i < facecount; i++)
61606039 {
....@@ -6219,7 +6098,7 @@
62196098
62206099 display.DrawFace(this, p, q, r, face);
62216100 }
6222
- gl.glEnd();
6101
+ display.EndTriangles();
62236102 }
62246103 else
62256104 {
....@@ -6248,8 +6127,8 @@
62486127 //System.out.println("SORT");
62496128
62506129 java.util.Arrays.sort(facescompare);
6251
-
6252
- gl.glBegin(gl.GL_TRIANGLES);
6130
+
6131
+ display.StartTriangles();
62536132 for (int i = 0; i < facecount; i++)
62546133 {
62556134 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6263,11 +6142,12 @@
62636142
62646143 display.DrawFace(this, p, q, r, face);
62656144 }
6266
- gl.glEnd();
6145
+ display.EndTriangles();
62676146 }
62686147
62696148 if (false) // live && support != null && support.bRep != null) // debug weights
62706149 {
6150
+ /*
62716151 gl.glDisable(gl.GL_LIGHTING);
62726152 float[] colorV = new float[3];
62736153
....@@ -6346,6 +6226,7 @@
63466226 // gl.glEnd();
63476227 }
63486228 }
6229
+ */
63496230 }
63506231 }
63516232
....@@ -6390,7 +6271,7 @@
63906271 center.add(r);
63916272 center.mul(1.0/3);
63926273
6393
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6274
+ center.sub(Globals.theRenderer.EyeCamera().location);
63946275
63956276 distance = center.dot(center);
63966277 }
....@@ -6404,22 +6285,6 @@
64046285 void Print(Vertex v)
64056286 {
64066287 //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);
64236288 }
64246289
64256290 void drawSelf(ClickInfo info, int level, boolean select)
....@@ -6993,83 +6858,83 @@
69936858 int spotw = spot.x + spot.width;
69946859 int spoth = spot.y + spot.height;
69956860 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
- }
6861
+// if (CameraPane.Xmin > spot.x)
6862
+// {
6863
+// CameraPane.Xmin = spot.x;
6864
+// }
6865
+// if (CameraPane.Xmax < spotw)
6866
+// {
6867
+// CameraPane.Xmax = spotw;
6868
+// }
6869
+// if (CameraPane.Ymin > spot.y)
6870
+// {
6871
+// CameraPane.Ymin = spot.y;
6872
+// }
6873
+// if (CameraPane.Ymax < spoth)
6874
+// {
6875
+// CameraPane.Ymax = spoth;
6876
+// }
70126877 spot.translate(32, 32);
70136878 spotw = spot.x + spot.width;
70146879 spoth = spot.y + spot.height;
70156880 info.g.setColor(Color.blue);
70166881 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
- }
6882
+// if (CameraPane.Xmin > spot.x)
6883
+// {
6884
+// CameraPane.Xmin = spot.x;
6885
+// }
6886
+// if (CameraPane.Xmax < spotw)
6887
+// {
6888
+// CameraPane.Xmax = spotw;
6889
+// }
6890
+// if (CameraPane.Ymin > spot.y)
6891
+// {
6892
+// CameraPane.Ymin = spot.y;
6893
+// }
6894
+// if (CameraPane.Ymax < spoth)
6895
+// {
6896
+// CameraPane.Ymax = spoth;
6897
+// }
70336898 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
70346899 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
70356900 spot.translate(0, -32);
70366901 info.g.setColor(Color.green);
70376902 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
- }
6903
+// if (CameraPane.Xmin > spot.x)
6904
+// {
6905
+// CameraPane.Xmin = spot.x;
6906
+// }
6907
+// if (CameraPane.Xmax < spotw)
6908
+// {
6909
+// CameraPane.Xmax = spotw;
6910
+// }
6911
+// if (CameraPane.Ymin > spot.y)
6912
+// {
6913
+// CameraPane.Ymin = spot.y;
6914
+// }
6915
+// if (CameraPane.Ymax < spoth)
6916
+// {
6917
+// CameraPane.Ymax = spoth;
6918
+// }
70546919 info.g.drawArc(boundary.x, boundary.y,
70556920 boundary.width, boundary.height, 0, 360);
70566921 //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
- }
6922
+// if (CameraPane.Xmin > boundary.x)
6923
+// {
6924
+// CameraPane.Xmin = boundary.x;
6925
+// }
6926
+// if (CameraPane.Xmax < boundary.x + boundary.width)
6927
+// {
6928
+// CameraPane.Xmax = boundary.x + boundary.width;
6929
+// }
6930
+// if (CameraPane.Ymin > boundary.y)
6931
+// {
6932
+// CameraPane.Ymin = boundary.y;
6933
+// }
6934
+// if (CameraPane.Ymax < boundary.y + boundary.height)
6935
+// {
6936
+// CameraPane.Ymax = boundary.y + boundary.height;
6937
+// }
70736938 return;
70746939 }
70756940 }
....@@ -7119,7 +6984,7 @@
71196984 }
71206985
71216986 //System.out.println("info.modifiers = " + info.modifiers);
7122
- modified = (info.modifiers & CameraPane.META) != 0;
6987
+ modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META
71236988 //System.out.println("modified = " + modified);
71246989 //new Exception().printStackTrace();
71256990 //viewCode = info.pane.renderCamera.viewCode;
....@@ -7147,7 +7012,7 @@
71477012 return true;
71487013 }
71497014
7150
- void doEditDrag0(ClickInfo info)
7015
+ void doEditDrag0(ClickInfo info, boolean opposite)
71517016 {
71527017 if (hitSomething == 0)
71537018 {
....@@ -7172,9 +7037,9 @@
71727037
71737038 case hitCenter: // Translate
71747039
7175
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7040
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
71767041
7177
- if (modified)
7042
+ if (modified || opposite)
71787043 {
71797044 //assert(false);
71807045 /*
....@@ -7220,10 +7085,10 @@
72207085 }
72217086 LA.xformDir(up, ClickInfo.matbuffer, up);
72227087 // if (!CameraPane.LOCALTRANSFORM)
7223
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7088
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
72247089 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
72257090 // if (!CameraPane.LOCALTRANSFORM)
7226
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7091
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
72277092 //LA.vecCross(up, cVector.Z, right2);
72287093
72297094 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7268,6 +7133,7 @@
72687133
72697134 if (modified)
72707135 {
7136
+ // Rotate 90 degrees
72717137 angle /= (Math.PI / 4);
72727138 angle = Math.floor(angle + 0.5);
72737139 angle *= (Math.PI / 4);
....@@ -7281,7 +7147,7 @@
72817147 }
72827148 /**/
72837149
7284
- switch (info.pane.renderCamera.viewCode)
7150
+ switch (info.pane.RenderCamera().viewCode)
72857151 {
72867152 case 1: // '\001'
72877153 LA.matZRotate(toParent, angle);
....@@ -7337,7 +7203,7 @@
73377203 }
73387204 /**/
73397205
7340
- switch (info.pane.renderCamera.viewCode)
7206
+ switch (info.pane.RenderCamera().viewCode)
73417207 {
73427208 case 3: // '\001'
73437209 if (modified)
....@@ -7565,6 +7431,7 @@
75657431 objectUI.closeUI();
75667432 if (editWindow != null)
75677433 {
7434
+ editWindow.ctrlPanel.FlushUI();
75687435 editWindow.refreshContents();
75697436 } // ? new
75707437 objectUI = null;