Normand Briere
2019-05-05 d7bc8865056ea0d35df261e719f92e1422af7c6e
Object3D.java
....@@ -5,6 +5,7 @@
55 import java.util.Vector;
66
77 import javax.media.j3d.Transform3D;
8
+import javax.media.opengl.GL;
89 import javax.vecmath.Vector3d;
910
1011 import javax.imageio.ImageIO;
....@@ -20,6 +21,19 @@
2021 static final long serialVersionUID = 5022536242724664900L;
2122
2223 ScriptNode scriptnode;
24
+
25
+ void InitOthers()
26
+ {
27
+ if (projectedVertices == null || projectedVertices.length <= 2)
28
+ {
29
+ projectedVertices = new Object3D.cVector2[3];
30
+ }
31
+ for (int i = 0; i < 3; i++)
32
+ {
33
+ projectedVertices[i] = new cVector2(); // Others
34
+ }
35
+ projectedVertices[0].x = 100; // bump
36
+ }
2337
2438 void MinMax(cVector minima, cVector maxima)
2539 {
....@@ -285,7 +299,6 @@
285299 return parent.GetName() + "#";
286300 }
287301
288
- boolean timeline = false;
289302 boolean live = false;
290303 boolean hide = false;
291304 boolean link2master = false; // performs reset support/master at each frame
....@@ -296,6 +309,8 @@
296309 boolean random = false;
297310 boolean speedup = false;
298311 boolean rewind = false;
312
+
313
+ float NORMALPUSH = 0;
299314
300315 Object3D support;
301316
....@@ -416,16 +431,16 @@
416431 {
417432 Object3D copy = this;
418433
419
- Camera parentcam = CameraPane.theRenderer.manipCamera;
434
+ Camera parentcam = Globals.theRenderer.ManipCamera();
420435
421
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
436
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
422437 {
423
- parentcam = CameraPane.theRenderer.cameras[1];
438
+ parentcam = Globals.theRenderer.Cameras()[1];
424439 }
425440
426
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
441
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
427442 {
428
- parentcam = CameraPane.theRenderer.cameras[0];
443
+ parentcam = Globals.theRenderer.Cameras()[0];
429444 }
430445
431446 if (this == parentcam)
....@@ -433,7 +448,7 @@
433448 //assert(this instanceof Camera);
434449
435450 for (int count = parentcam.GetTransformCount(); --count>=0;)
436
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
451
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
437452 }
438453
439454 copy.marked ^= true;
....@@ -453,7 +468,7 @@
453468 //assert(this instanceof Camera);
454469
455470 for (int count = parentcam.GetTransformCount(); --count>=0;)
456
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
471
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
457472 }
458473
459474 copy.Touch(); // display list issue
....@@ -588,7 +603,7 @@
588603 return;
589604 }
590605
591
- if (CameraPane.fromscript)
606
+ if (Globals.fromscript)
592607 {
593608 transformcount = 0;
594609 return;
....@@ -746,7 +761,7 @@
746761
747762 int GetTransformCount()
748763 {
749
- // marde pour serialization de Texture
764
+ // patch pour serialization de Texture
750765 resetmaxcount();
751766 resettransformcount();
752767 resetstep();
....@@ -780,9 +795,12 @@
780795 // factor = CameraPane.STEP;
781796 // }
782797
783
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
798
+ if (marked && Globals.isLIVE() && live &&
799
+ //TEMP21aug2018
800
+ Globals.DrawMode() == iCameraPane.SHADOW &&
801
+ currentframe != Globals.framecount)
784802 {
785
- currentframe = CameraPane.framecount;
803
+ currentframe = Globals.framecount;
786804
787805 // System.err.println("transformcount = " + transformcount);
788806 // System.err.println("factor = " + factor);
....@@ -2131,15 +2149,8 @@
21312149 if (/*parent != null &&*/ material == null)
21322150 {
21332151 material = new cMaterial(GetMaterial());
2134
- if (projectedVertices == null || projectedVertices.length <= 2)
2135
- {
2136
- projectedVertices = new Object3D.cVector2[3];
2137
- }
2138
- for (int i = 0; i < 3; i++)
2139
- {
2140
- projectedVertices[i] = new cVector2(); // Others
2141
- }
2142
- projectedVertices[0].x = 100; // bump
2152
+
2153
+ InitOthers();
21432154
21442155 if (this instanceof Camera)
21452156 {
....@@ -2289,6 +2300,7 @@
22892300 {
22902301 if (newWindow)
22912302 {
2303
+ new Exception().printStackTrace();
22922304 System.exit(0);
22932305 if (parent != null)
22942306 {
....@@ -2895,7 +2907,8 @@
28952907 {
28962908 if (bRep != null)
28972909 {
2898
- bRep.GenUV();
2910
+ bRep.GenUV(); //1);
2911
+ //bRep.UnfoldUV();
28992912 Touch();
29002913 }
29012914 }
....@@ -4162,6 +4175,22 @@
41624175 }
41634176 }
41644177
4178
+ void RepairShadow()
4179
+ {
4180
+ if (blockloop)
4181
+ return;
4182
+
4183
+ if (this.material != null)
4184
+ this.InitOthers();
4185
+
4186
+ for (int i=0; i<Size(); i++)
4187
+ {
4188
+ blockloop = true;
4189
+ get(i).RepairShadow();
4190
+ blockloop = false;
4191
+ }
4192
+ }
4193
+
41654194 void RepairTexture()
41664195 {
41674196 if (this instanceof FileObject || blockloop)
....@@ -4828,7 +4857,7 @@
48284857 return globalTransform;
48294858 }
48304859
4831
- void PreprocessOcclusion(CameraPane cp)
4860
+ void PreprocessOcclusion(iCameraPane cp)
48324861 {
48334862 /*
48344863 if (AOdone)
....@@ -4975,7 +5004,8 @@
49755004 } else //
49765005 if (editWindow != null)
49775006 {
4978
- editWindow.cameraView.lighttouched = true;
5007
+ //editWindow.cameraView.lighttouched = true;
5008
+ Globals.lighttouched = true;
49795009 }
49805010 }
49815011
....@@ -5129,10 +5159,34 @@
51295159
51305160 // System.out.println("Fullname = " + fullname);
51315161
5132
- if (fullname.name.indexOf(":") == -1)
5133
- 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(":"));
51345167
5135
- 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];
51365190 }
51375191
51385192 static String GetBump(cTexture fullname)
....@@ -5141,10 +5195,38 @@
51415195 return "";
51425196
51435197 // System.out.println("Fullname = " + fullname);
5144
- if (fullname.name.indexOf(":") == -1)
5145
- return "";
5146
-
5147
- 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];
51485230 }
51495231
51505232 String GetPigmentTexture()
....@@ -5218,7 +5300,7 @@
52185300 System.out.print("; textures = " + textures);
52195301 System.out.println("; usedtextures = " + usedtextures);
52205302
5221
- if (GetTextures() == null)
5303
+ if (GetTextures() == null) // What is that??
52225304 GetTextures().name = ":";
52235305
52245306 String texname = tex;
....@@ -5287,25 +5369,22 @@
52875369 }
52885370 }
52895371
5290
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5372
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52915373 {
52925374 Draw(display, root, selected, blocked);
52935375 }
52945376
5295
- static cMaterial[] materialstack = new cMaterial[65536];
5296
- static boolean[] selectedstack = new boolean[65536];
5297
- static int materialdepth = 0;
5298
-
52995377 boolean NeedSupport()
53005378 {
53015379 return
53025380 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
53035381 // PROBLEM with CROWD!!
5304
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5382
+ && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
53055383 }
53065384
5385
+ static boolean DEBUG_SELECTION = false;
53075386
5308
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5387
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53095388 {
53105389 Invariants(); // june 2013
53115390
....@@ -5314,7 +5393,7 @@
53145393 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
53155394 }
53165395
5317
- if (display.drawMode == CameraPane.SELECTION &&
5396
+ if (display.DrawMode() == iCameraPane.SELECTION &&
53185397 hide)
53195398 return;
53205399
....@@ -5333,7 +5412,7 @@
53335412 if (this instanceof Checker)
53345413 return;
53355414
5336
- if (display.drawMode == display.SHADOW && PASSTEST)
5415
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
53375416 return;
53385417
53395418 if (count <= 0)
....@@ -5341,13 +5420,13 @@
53415420 return;
53425421 }
53435422
5344
- if ((//display.drawMode == CameraPane.SHADOW ||
5345
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5423
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5424
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53465425 {
53475426 return;
53485427 }
53495428
5350
- javax.media.opengl.GL gl = display.GetGL();
5429
+ //javax.media.opengl.GL gl = display.GetGL();
53515430
53525431 /*
53535432 if (touched)
....@@ -5383,15 +5462,15 @@
53835462
53845463 boolean compiled = false;
53855464
5386
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5465
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53875466
5388
- if (!selectmode && //display.drawMode != display.SELECTION &&
5467
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53895468 (touched || (bRep != null && bRep.displaylist <= 0)))
53905469 {
5391
- display.lighttouched = true;
5470
+ Globals.lighttouched = true;
53925471 } // all panes...
5393
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5394
- if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&
5472
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5473
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53955474 (touched || (bRep != null && bRep.displaylist <= 0)))
53965475 {
53975476 if (!(this instanceof Composite))
....@@ -5399,7 +5478,7 @@
53995478 //if (displaylist == -1 && usecalllists)
54005479 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
54015480 {
5402
- bRep.displaylist = gl.glGenLists(1);
5481
+ bRep.displaylist = display.GenList();
54035482 assert(bRep.displaylist != 0);
54045483 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
54055484 //System.out.println("\tgen list " + list);
....@@ -5411,18 +5490,20 @@
54115490 if (usecalllists)
54125491 {
54135492 // System.err.println("new list " + bRep.displaylist + " for " + this);
5414
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5493
+ display.NewList(bRep.displaylist);
54155494 }
5495
+
54165496 CallList(display, root, selected, blocked);
5497
+
54175498 // compiled = true;
54185499 if (usecalllists)
54195500 {
54205501 // System.err.println("end list " + bRep.displaylist + " for " + this);
5421
- gl.glEndList();
5502
+ display.EndList();
54225503 }
54235504 //gl.glDrawBuffer(gl.GL_BACK);
54245505 // XXX touched = false;
5425
- display.lighttouched = true; // all panes...
5506
+ Globals.lighttouched = true; // all panes...
54265507 }
54275508
54285509 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5461,12 +5542,12 @@
54615542
54625543 // frustum culling
54635544 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5464
- && display.drawMode != CameraPane.SELECTION)
5545
+ && display.DrawMode() != iCameraPane.SELECTION)
54655546 {
5466
- if (display.drawMode == CameraPane.SHADOW)
5547
+ if (display.DrawMode() == iCameraPane.SHADOW)
54675548 {
54685549 if (!link2master // tricky to cull in shadow mode.
5469
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5550
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54705551 {
54715552 //System.out.print("CULLED");
54725553 culled = true;
....@@ -5474,7 +5555,7 @@
54745555 }
54755556 else
54765557 //GetBRep().getBounds(v0, v1, this);
5477
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5558
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54785559 culled = true;
54795560
54805561 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5510,11 +5591,11 @@
55105591
55115592
55125593 if (!culled)
5513
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5594
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55145595 {
55155596 if (GetBRep() != null)
55165597 {
5517
- CameraPane.NextIndex(this, gl);
5598
+ display.NextIndex();
55185599 // vertex color conflict : gl.glCallList(list);
55195600 DrawNode(display, root, selected);
55205601 if (this instanceof BezierPatch)
....@@ -5536,55 +5617,7 @@
55365617 color[2] /= 2;
55375618 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55385619 */
5539
- if (material != null)
5540
- {
5541
- materialstack[materialdepth] = material;
5542
- selectedstack[materialdepth] = selected;
5543
- cStatic.objectstack[materialdepth++] = this;
5544
- //System.out.println("material " + material);
5545
- //Applet3D.tracein(this, selected);
5546
- display.vector2buffer = projectedVertices;
5547
- if (this instanceof Camera)
5548
- {
5549
- display.options1[0] = material.shift;
5550
- //System.out.println("shift " + material.shift);
5551
- display.options1[1] = material.lightarea;
5552
- display.options1[2] = material.shadowbias;
5553
- display.options1[3] = material.aniso;
5554
- display.options1[4] = material.anisoV;
5555
- display.options2[0] = material.opacity;
5556
- display.options2[1] = material.diffuse;
5557
- display.options2[2] = material.factor;
5558
-
5559
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5560
- display.options4[0] = material.cameralight/0.2f;
5561
- display.options4[1] = material.subsurface;
5562
- display.options4[2] = material.sheen;
5563
-
5564
- // if (display.CURRENTANTIALIAS > 0)
5565
- // display.options3[3] /= 4;
5566
-
5567
- /*
5568
- System.out.println("Focus = " + display.options1[0]);
5569
- System.out.println("Aperture = " + display.options1[1]);
5570
- System.out.println("ShadowBlur = " + display.options1[2]);
5571
- System.out.println("Antialiasing = " + display.options1[3]);
5572
- System.out.println("Fog = " + display.options2[0]);
5573
- System.out.println("Intensity = " + display.options2[1]);
5574
- System.out.println("Elevation = " + display.options2[2]);
5575
- /**/
5576
- } else
5577
- {
5578
- material.Draw(display, selected);
5579
- }
5580
- } else
5581
- {
5582
- if (selected && CameraPane.flash)
5583
- {
5584
- display.modelParams4[1] = 100;
5585
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5586
- }
5587
- }
5620
+ display.PushMaterial(this, selected);
55885621
55895622 //System.out.println("call list " + list);
55905623 //System.out.println();
....@@ -5619,30 +5652,15 @@
56195652
56205653 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
56215654 assert(bRep.displaylist != 0);
5622
- gl.glCallList(bRep.displaylist);
5655
+ display.CallList(bRep.displaylist);
56235656 // june 2013 drawSelf(display, root, selected);
56245657 }
56255658 }
56265659 }
56275660
56285661 display.ReleaseTextures(tex);
5629
-
5630
- //if (parent != null && parent.GetMaterial() != null)
5631
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5632
- if (material != null)
5633
- {
5634
- materialdepth -= 1;
5635
- if (materialdepth > 0)
5636
- {
5637
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5638
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5639
- }
5640
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5641
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5642
- {
5643
- display.modelParams4[1] = GetMaterial().cameralight;
5644
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5645
- }
5662
+
5663
+ display.PopMaterial(this, selected);
56465664 }
56475665
56485666 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5684,7 +5702,7 @@
56845702 // resetMasterNode();
56855703 }
56865704
5687
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5705
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56885706 {
56895707 if (GetBRep() == null)
56905708 {
....@@ -5767,7 +5785,7 @@
57675785 boolean flipV = false; // true;
57685786 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57695787
5770
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5788
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57715789 {
57725790 if (hide)
57735791 return;
....@@ -5826,16 +5844,7 @@
58265844 // // ??????????????????????????? Touch();
58275845 // }
58285846
5829
- if (material != null)
5830
- {
5831
- materialstack[materialdepth] = material;
5832
- selectedstack[materialdepth] = selected;
5833
- cStatic.objectstack[materialdepth++] = this;
5834
- //System.out.println("material " + material);
5835
- //Applet3D.tracein("selected ", selected);
5836
- display.vector2buffer = projectedVertices;
5837
- material.Draw(display, selected);
5838
- }
5847
+display.PushMaterial2(this, selected);
58395848
58405849 Object3D child;
58415850 boolean sel;
....@@ -5887,19 +5896,7 @@
58875896 */
58885897 //depth += 1;
58895898
5890
- if (material != null)
5891
- {
5892
- materialdepth -= 1;
5893
- if (materialdepth > 0)
5894
- {
5895
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5896
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5897
- }
5898
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5899
- //else
5900
- //material.Draw(display, false);
5901
- }
5902
-
5899
+display.PopMaterial2(this);
59035900 /*
59045901 display.ReleaseTextures(tex);
59055902 */
....@@ -5910,9 +5907,9 @@
59105907
59115908 //static cVector min,max;
59125909
5913
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5910
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
59145911 {
5915
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
5912
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59165913 return; // no shadow for transparent objects
59175914
59185915 if (hide)
....@@ -5955,11 +5952,12 @@
59555952 return;
59565953 }
59575954
5955
+ //bRep.GenUV(1/material.diffuseness);
59585956 // bRep.lock = true;
59595957
5960
- javax.media.opengl.GL gl = display.GetGL();
5958
+ //javax.media.opengl.GL gl = display.GetGL();
59615959
5962
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5960
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59635961 {
59645962 int fc = bRep.FaceCount();
59655963 int vc = bRep.VertexCount();
....@@ -5974,23 +5972,7 @@
59745972
59755973 bRep.getMinMax(min, max, 100);
59765974
5977
- gl.glBegin(gl.GL_LINES);
5978
-
5979
- gl.glVertex3d(min.x, min.y, min.z);
5980
- gl.glVertex3d(min.x, min.y, max.z);
5981
- gl.glVertex3d(min.x, min.y, min.z);
5982
- gl.glVertex3d(min.x, max.y, min.z);
5983
- gl.glVertex3d(min.x, min.y, min.z);
5984
- gl.glVertex3d(max.x, min.y, min.z);
5985
-
5986
- gl.glVertex3d(max.x, max.y, max.z);
5987
- gl.glVertex3d(min.x, max.y, max.z);
5988
- gl.glVertex3d(max.x, max.y, max.z);
5989
- gl.glVertex3d(max.x, min.y, max.z);
5990
- gl.glVertex3d(max.x, max.y, max.z);
5991
- gl.glVertex3d(max.x, max.y, min.z);
5992
-
5993
- gl.glEnd();
5975
+ display.DrawBox(min, max);
59945976
59955977 return;
59965978 }
....@@ -6034,7 +6016,7 @@
60346016 {
60356017 //throw new Error();
60366018
6037
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6019
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
60386020
60396021 int[] strips = bRep.getRawIndices();
60406022
....@@ -6044,178 +6026,14 @@
60446026 new Exception().printStackTrace();
60456027 return;
60466028 }
6047
-
6048
- // TRIANGLE STRIP ARRAY
6049
- if (bRep.trimmed)
6050
- {
6051
- float[] v = bRep.getRawVertices();
6052
- float[] n = bRep.getRawNormals();
6053
- float[] c = bRep.getRawColors();
6054
- float[] uv = bRep.getRawUVMap();
6055
-
6056
- int count2 = 0;
6057
- int count3 = 0;
6058
-
6059
- if (n.length > 0)
6060
- {
6061
- for (int i = 0; i < strips.length; i++)
6062
- {
6063
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6064
-
6065
- /*
6066
- boolean locked = false;
6067
- float eps = 0.1f;
6068
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6069
-
6070
- int dot = 0;
6071
-
6072
- if ((dot&1) == 0)
6073
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6074
-
6075
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6076
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6077
- else
6078
- {
6079
- locked = true;
6080
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6081
- }
6082
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6083
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6084
- if (hasnorm)
6085
- {
6086
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6087
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6088
- }
6089
-
6090
- if ((dot&4) == 0)
6091
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6092
-
6093
- if (wrap || !locked && (dot&8) != 0)
6094
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6095
- else
6096
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6097
-
6098
- f.dot = dot;
6099
- */
6100
-
6101
- if (!selectmode)
6102
- {
6103
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6104
- {
6105
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6106
- } else
6107
- {
6108
- gl.glNormal3f(0, 0, 1);
6109
- }
6110
-
6111
- if (c != null)
6112
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6113
- {
6114
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6115
- }
6116
- }
6117
- if (flipV)
6118
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6119
- else
6120
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6121
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6122
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6123
-
6124
- count2 += 2;
6125
- count3 += 3;
6126
- if (!selectmode)
6127
- {
6128
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6129
- {
6130
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6131
- } else
6132
- {
6133
- gl.glNormal3f(0, 0, 1);
6134
- }
6135
- if (c != null)
6136
- {
6137
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6138
- }
6139
- }
6140
- if (flipV)
6141
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6142
- else
6143
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6144
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6145
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6146
-
6147
- count2 += 2;
6148
- count3 += 3;
6149
- for (int j = 0; j < strips[i] - 2; j++)
6150
- {
6151
- //gl.glTexCoord2d(...);
6152
- if (!selectmode)
6153
- {
6154
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6155
- {
6156
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6157
- } else
6158
- {
6159
- gl.glNormal3f(0, 0, 1);
6160
- }
6161
- if (c != null)
6162
- {
6163
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6164
- }
6165
- }
6166
-
6167
- if (flipV)
6168
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6169
- else
6170
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6171
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6172
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6173
- count2 += 2;
6174
- count3 += 3;
6175
- }
6176
-
6177
- gl.glEnd();
6178
- }
6179
- }
6180
-
6181
- assert count3 == v.length;
6182
- }
6183
- else // !trimmed
6184
- {
6185
- int count = 0;
6186
- for (int i = 0; i < strips.length; i++)
6187
- {
6188
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6189
-
6190
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6191
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6192
-
6193
- drawVertex(gl, p, selectmode);
6194
- drawVertex(gl, q, selectmode);
6195
-
6196
- for (int j = 0; j < strips[i] - 2; j++)
6197
- {
6198
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6199
-
6200
-// if (j%2 == 0)
6201
-// drawFace(p, q, r, display, null);
6202
-// else
6203
-// drawFace(p, r, q, display, null);
6204
-
6205
-// p = q;
6206
-// q = r;
6207
- drawVertex(gl, r, selectmode);
6208
- }
6209
-
6210
- gl.glEnd();
6211
- }
6212
- }
6029
+
6030
+ display.DrawGeometry(bRep, flipV, selectmode);
62136031 } else // catch (Error e)
62146032 {
62156033 // TRIANGLE ARRAY
62166034 if (IsOpaque()) // Static())
62176035 {
6218
- gl.glBegin(gl.GL_TRIANGLES);
6036
+ display.StartTriangles();
62196037 int facecount = bRep.FaceCount();
62206038 for (int i = 0; i < facecount; i++)
62216039 {
....@@ -6278,9 +6096,9 @@
62786096 // // r.norm.dot(v3) > -0.5)
62796097 // // continue;
62806098
6281
- drawFace(p, q, r, display, face);
6099
+ display.DrawFace(this, p, q, r, face);
62826100 }
6283
- gl.glEnd();
6101
+ display.EndTriangles();
62846102 }
62856103 else
62866104 {
....@@ -6309,8 +6127,8 @@
63096127 //System.out.println("SORT");
63106128
63116129 java.util.Arrays.sort(facescompare);
6312
-
6313
- gl.glBegin(gl.GL_TRIANGLES);
6130
+
6131
+ display.StartTriangles();
63146132 for (int i = 0; i < facecount; i++)
63156133 {
63166134 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6322,13 +6140,14 @@
63226140 Vertex q = bRep.GetVertex(face.q);
63236141 Vertex r = bRep.GetVertex(face.r);
63246142
6325
- drawFace(p, q, r, display, face);
6143
+ display.DrawFace(this, p, q, r, face);
63266144 }
6327
- gl.glEnd();
6145
+ display.EndTriangles();
63286146 }
63296147
63306148 if (false) // live && support != null && support.bRep != null) // debug weights
63316149 {
6150
+ /*
63326151 gl.glDisable(gl.GL_LIGHTING);
63336152 float[] colorV = new float[3];
63346153
....@@ -6407,6 +6226,7 @@
64076226 // gl.glEnd();
64086227 }
64096228 }
6229
+ */
64106230 }
64116231 }
64126232
....@@ -6451,7 +6271,7 @@
64516271 center.add(r);
64526272 center.mul(1.0/3);
64536273
6454
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6274
+ center.sub(Globals.theRenderer.EyeCamera().location);
64556275
64566276 distance = center.dot(center);
64576277 }
....@@ -6462,347 +6282,11 @@
64626282
64636283 transient FaceCompare[] facescompare = null;
64646284
6465
- void SetColor(CameraPane display, Vertex p0)
6466
- {
6467
- if (display.RENDERPROGRAM == 0)
6468
- {
6469
- float r = 0;
6470
- if (bRep != null)
6471
- {
6472
- if (bRep.stripified)
6473
- {
6474
- r = 1;
6475
- }
6476
- }
6477
- float g = 0;
6478
- if (bRep != null)
6479
- {
6480
- if (bRep.trimmed)
6481
- {
6482
- g = 1;
6483
- }
6484
- }
6485
- float b = 0;
6486
- if (support != null && link2master)
6487
- {
6488
- b = 1;
6489
- }
6490
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6491
- return;
6492
- }
6493
-
6494
- if (display.drawMode != CameraPane.SHADOW)
6495
- return;
6496
-
6497
- javax.media.opengl.GL gl = display.GetGL();
6498
-// if (true) return;
6499
-// float ao = p.AO;
6500
-//
6501
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6502
-// // ao = 1;
6503
-//
6504
-// gl.glColor4f(ao, ao, ao, 1);
6505
-
6506
-// CameraPane.selectedpoint.
6507
-// getAverage(cStatic.point1, true);
6508
- if (CameraPane.pointflow == null) // !random) // live)
6509
- {
6510
- return;
6511
- }
6512
-
6513
- cStatic.point1.set(0,0,0);
6514
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6515
-
6516
- cStatic.point1.sub(p0);
6517
-
6518
-
6519
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6520
-// {
6521
-// return;
6522
-// }
6523
-
6524
- //if (true)
6525
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6526
- {
6527
- return;
6528
- }
6529
-
6530
- float[] colorV = new float[3];
6531
-
6532
- if (false) // marked)
6533
- {
6534
- // debug rigging weights
6535
- for (int object = 0; object < p0.vertexlinks.length; object++)
6536
- {
6537
- float weight = p0.weights[object] / p0.totalweight;
6538
-
6539
- // if (weight < 0.1)
6540
- // {
6541
- // assert(weight == 0);
6542
- // continue;
6543
- // }
6544
-
6545
- if (p0.vertexlinks[object] == -1)
6546
- continue;
6547
-
6548
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6549
-
6550
- int color = //1 << object; //
6551
- //p.vertexlinks.length;
6552
- support.bRep.supports[p0.closestsupport].links[object];
6553
- colorV[2] += (color & 1) * weight;
6554
- colorV[1] += ((color & 2) >> 1) * weight;
6555
- colorV[0] += ((color & 4) >> 2) * weight;
6556
- }
6557
- }
6558
- else
6559
- {
6560
- if (drawingstarted)
6561
- {
6562
- // find next point
6563
- if (bRep.GetVertex(0).faceindices == null)
6564
- {
6565
- bRep.InitFaceIndices();
6566
- }
6567
-
6568
- double ymin = p0.y;
6569
-
6570
- Vertex newp = p0;
6571
-
6572
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6573
- {
6574
- int fi = p0.faceindices[fii];
6575
-
6576
- if (fi == -1)
6577
- break;
6578
-
6579
- Face f = bRep.GetFace(fi);
6580
-
6581
- Vertex p = bRep.GetVertex(f.p);
6582
- Vertex q = bRep.GetVertex(f.q);
6583
- Vertex r = bRep.GetVertex(f.r);
6584
-
6585
- int swap = (int)(Math.random()*3);
6586
-
6587
-// for (int s=swap; --s>=0;)
6588
-// {
6589
-// Vertex t = p;
6590
-// p = q;
6591
-// q = r;
6592
-// r = t;
6593
-// }
6594
- if (ymin > p.y)
6595
- {
6596
- ymin = p.y;
6597
- newp = p;
6598
-// break;
6599
- }
6600
- if (ymin > q.y)
6601
- {
6602
- ymin = q.y;
6603
- newp = q;
6604
-// break;
6605
- }
6606
- if (ymin > r.y)
6607
- {
6608
- ymin = r.y;
6609
- newp = r;
6610
-// break;
6611
- }
6612
- }
6613
-
6614
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6615
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6616
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6617
-
6618
- drawingstarted = false;
6619
-
6620
- // return;
6621
- }
6622
-
6623
- if (false) // CameraPane.DRAW
6624
- {
6625
- p0.AO = colorV[0] = 2;
6626
- colorV[1] = 2;
6627
- colorV[2] = 2;
6628
- }
6629
-
6630
- CameraPane.pointflow.add(p0);
6631
- CameraPane.pointflow.Touch();
6632
- }
6633
-
6634
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6635
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6636
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6637
- }
6638
-
66396285 void Print(Vertex v)
66406286 {
66416287 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
66426288 }
66436289
6644
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6645
- {
6646
- if (!selectmode)
6647
- {
6648
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6649
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6650
-
6651
- if (flipV)
6652
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6653
- else
6654
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6655
- }
6656
-
6657
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6658
- }
6659
-
6660
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6661
- CameraPane display, Face face)
6662
- {
6663
- if (pv.y == -10000 ||
6664
- qv.y == -10000 ||
6665
- rv.y == -10000)
6666
- return;
6667
-
6668
-// float b = f.nbiterations & 1;
6669
-// float g = (f.nbiterations>>1) & 1;
6670
-// float r = (f.nbiterations>>2) & 1;
6671
-//
6672
-// //if (f.weight == 10000)
6673
-// //{
6674
-// // r = 1; g = b = 0;
6675
-// //}
6676
-// //else
6677
-// //{
6678
-// // assert(f.weight < 10000);
6679
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6680
-// if (r<0)
6681
-// assert(r>=0);
6682
-// //}
6683
-
6684
- javax.media.opengl.GL gl = display.GetGL();
6685
-
6686
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6687
-
6688
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6689
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6690
- {
6691
- //gl.glBegin(gl.GL_TRIANGLES);
6692
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6693
- if (!hasnorm)
6694
- {
6695
- // System.out.println("FUCK!!");
6696
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6697
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6698
- LA.vecCross(v0, v1, v2);
6699
- LA.vecNormalize(v2);
6700
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6701
- }
6702
-
6703
- if (hasnorm)
6704
- {
6705
-// if (!pv.norm.normalized())
6706
-// assert(pv.norm.normalized());
6707
-
6708
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6709
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6710
- }
6711
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6712
- SetColor(display, pv);
6713
- //gl.glColor4f(r, g, b, 1);
6714
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6715
- if (flipV)
6716
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6717
- else
6718
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6719
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6720
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6721
-// Print(pv);
6722
- if (hasnorm)
6723
- {
6724
-// assert(qv.norm.normalized());
6725
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6726
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6727
- }
6728
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6729
- // boolean locked = false;
6730
- // float eps = 0.1f;
6731
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6732
-
6733
- // int dot = 0; //*/ (int)f.dot;
6734
-
6735
- // if ((dot&1) == 0)
6736
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6737
-
6738
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6739
- if (flipV)
6740
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6741
- else
6742
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6743
- // else
6744
- // {
6745
- // locked = true;
6746
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6747
- // }
6748
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6749
- SetColor(display, qv);
6750
- //gl.glColor4f(r, g, b, 1);
6751
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6752
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6753
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6754
-// Print(qv);
6755
- if (hasnorm)
6756
- {
6757
-// assert(rv.norm.normalized());
6758
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6759
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6760
- }
6761
-
6762
- // if ((dot&4) == 0)
6763
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6764
-
6765
- // if (wrap || !locked && (dot&8) != 0)
6766
- if (flipV)
6767
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6768
- else
6769
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6770
- // else
6771
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6772
-
6773
- // f.dot = dot;
6774
-
6775
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6776
- SetColor(display, rv);
6777
- //gl.glColor4f(r, g, b, 1);
6778
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6779
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6780
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6781
-// Print(rv);
6782
- //gl.glEnd();
6783
- }
6784
- else
6785
- {
6786
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6787
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6788
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6789
-
6790
- }
6791
-
6792
- if (false) // (attributes & WIREFRAME) != 0)
6793
- {
6794
- gl.glDisable(gl.GL_LIGHTING);
6795
-
6796
- gl.glBegin(gl.GL_LINE_LOOP);
6797
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6798
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6799
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6800
- gl.glEnd();
6801
-
6802
- gl.glEnable(gl.GL_LIGHTING);
6803
- }
6804
- }
6805
-
68066290 void drawSelf(ClickInfo info, int level, boolean select)
68076291 {
68086292 if (bRep == null)
....@@ -7374,83 +6858,83 @@
73746858 int spotw = spot.x + spot.width;
73756859 int spoth = spot.y + spot.height;
73766860 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7377
- if (CameraPane.Xmin > spot.x)
7378
- {
7379
- CameraPane.Xmin = spot.x;
7380
- }
7381
- if (CameraPane.Xmax < spotw)
7382
- {
7383
- CameraPane.Xmax = spotw;
7384
- }
7385
- if (CameraPane.Ymin > spot.y)
7386
- {
7387
- CameraPane.Ymin = spot.y;
7388
- }
7389
- if (CameraPane.Ymax < spoth)
7390
- {
7391
- CameraPane.Ymax = spoth;
7392
- }
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
+// }
73936877 spot.translate(32, 32);
73946878 spotw = spot.x + spot.width;
73956879 spoth = spot.y + spot.height;
73966880 info.g.setColor(Color.blue);
73976881 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7398
- if (CameraPane.Xmin > spot.x)
7399
- {
7400
- CameraPane.Xmin = spot.x;
7401
- }
7402
- if (CameraPane.Xmax < spotw)
7403
- {
7404
- CameraPane.Xmax = spotw;
7405
- }
7406
- if (CameraPane.Ymin > spot.y)
7407
- {
7408
- CameraPane.Ymin = spot.y;
7409
- }
7410
- if (CameraPane.Ymax < spoth)
7411
- {
7412
- CameraPane.Ymax = spoth;
7413
- }
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
+// }
74146898 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
74156899 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
74166900 spot.translate(0, -32);
74176901 info.g.setColor(Color.green);
74186902 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7419
- if (CameraPane.Xmin > spot.x)
7420
- {
7421
- CameraPane.Xmin = spot.x;
7422
- }
7423
- if (CameraPane.Xmax < spotw)
7424
- {
7425
- CameraPane.Xmax = spotw;
7426
- }
7427
- if (CameraPane.Ymin > spot.y)
7428
- {
7429
- CameraPane.Ymin = spot.y;
7430
- }
7431
- if (CameraPane.Ymax < spoth)
7432
- {
7433
- CameraPane.Ymax = spoth;
7434
- }
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
+// }
74356919 info.g.drawArc(boundary.x, boundary.y,
74366920 boundary.width, boundary.height, 0, 360);
74376921 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7438
- if (CameraPane.Xmin > boundary.x)
7439
- {
7440
- CameraPane.Xmin = boundary.x;
7441
- }
7442
- if (CameraPane.Xmax < boundary.x + boundary.width)
7443
- {
7444
- CameraPane.Xmax = boundary.x + boundary.width;
7445
- }
7446
- if (CameraPane.Ymin > boundary.y)
7447
- {
7448
- CameraPane.Ymin = boundary.y;
7449
- }
7450
- if (CameraPane.Ymax < boundary.y + boundary.height)
7451
- {
7452
- CameraPane.Ymax = boundary.y + boundary.height;
7453
- }
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
+// }
74546938 return;
74556939 }
74566940 }
....@@ -7553,7 +7037,7 @@
75537037
75547038 case hitCenter: // Translate
75557039
7556
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7040
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75577041
75587042 if (modified)
75597043 {
....@@ -7601,10 +7085,10 @@
76017085 }
76027086 LA.xformDir(up, ClickInfo.matbuffer, up);
76037087 // if (!CameraPane.LOCALTRANSFORM)
7604
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7088
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
76057089 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
76067090 // if (!CameraPane.LOCALTRANSFORM)
7607
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7091
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
76087092 //LA.vecCross(up, cVector.Z, right2);
76097093
76107094 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7662,7 +7146,7 @@
76627146 }
76637147 /**/
76647148
7665
- switch (info.pane.renderCamera.viewCode)
7149
+ switch (info.pane.RenderCamera().viewCode)
76667150 {
76677151 case 1: // '\001'
76687152 LA.matZRotate(toParent, angle);
....@@ -7718,7 +7202,7 @@
77187202 }
77197203 /**/
77207204
7721
- switch (info.pane.renderCamera.viewCode)
7205
+ switch (info.pane.RenderCamera().viewCode)
77227206 {
77237207 case 3: // '\001'
77247208 if (modified)
....@@ -7946,6 +7430,7 @@
79467430 objectUI.closeUI();
79477431 if (editWindow != null)
79487432 {
7433
+ editWindow.ctrlPanel.FlushUI();
79497434 editWindow.refreshContents();
79507435 } // ? new
79517436 objectUI = null;
....@@ -8164,6 +7649,8 @@
81647649 {
81657650 Object3D targ = this;
81667651
7652
+ targ.NORMALPUSH = obj.NORMALPUSH;
7653
+
81677654 if (obj.material != null)
81687655 {
81697656 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))