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 {
....@@ -296,6 +310,8 @@
296310 boolean speedup = false;
297311 boolean rewind = false;
298312
313
+ float NORMALPUSH = 0;
314
+
299315 Object3D support;
300316
301317 Object3D GetObject()
....@@ -355,7 +371,7 @@
355371
356372 int MemorySize()
357373 {
358
- if (memorysize == 0)
374
+ if (true) // memorysize == 0)
359375 {
360376 try
361377 {
....@@ -415,16 +431,16 @@
415431 {
416432 Object3D copy = this;
417433
418
- Camera parentcam = CameraPane.theRenderer.manipCamera;
434
+ Camera parentcam = Globals.theRenderer.ManipCamera();
419435
420
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
436
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[0])
421437 {
422
- parentcam = CameraPane.theRenderer.cameras[1];
438
+ parentcam = Globals.theRenderer.Cameras()[1];
423439 }
424440
425
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
441
+ if (Globals.theRenderer.ManipCamera() == Globals.theRenderer.Cameras()[1])
426442 {
427
- parentcam = CameraPane.theRenderer.cameras[0];
443
+ parentcam = Globals.theRenderer.Cameras()[0];
428444 }
429445
430446 if (this == parentcam)
....@@ -432,7 +448,7 @@
432448 //assert(this instanceof Camera);
433449
434450 for (int count = parentcam.GetTransformCount(); --count>=0;)
435
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
451
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.toParent, Globals.theRenderer.TargetLookAt());
436452 }
437453
438454 copy.marked ^= true;
....@@ -452,7 +468,7 @@
452468 //assert(this instanceof Camera);
453469
454470 for (int count = parentcam.GetTransformCount(); --count>=0;)
455
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
471
+ LA.xformPos(Globals.theRenderer.TargetLookAt(), parentcam.fromParent, Globals.theRenderer.TargetLookAt());
456472 }
457473
458474 copy.Touch(); // display list issue
....@@ -587,7 +603,7 @@
587603 return;
588604 }
589605
590
- if (CameraPane.fromscript)
606
+ if (Globals.fromscript)
591607 {
592608 transformcount = 0;
593609 return;
....@@ -745,7 +761,7 @@
745761
746762 int GetTransformCount()
747763 {
748
- // marde pour serialization de Texture
764
+ // patch pour serialization de Texture
749765 resetmaxcount();
750766 resettransformcount();
751767 resetstep();
....@@ -779,9 +795,12 @@
779795 // factor = CameraPane.STEP;
780796 // }
781797
782
- 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)
783802 {
784
- currentframe = CameraPane.framecount;
803
+ currentframe = Globals.framecount;
785804
786805 // System.err.println("transformcount = " + transformcount);
787806 // System.err.println("factor = " + factor);
....@@ -1446,7 +1465,16 @@
14461465 // if (other == null)
14471466 // return;
14481467
1449
- System.out.println("Link support this = " + this + "; other = " + other);
1468
+ if (other != null)
1469
+ {
1470
+ BoundaryRep.SEUIL = other.material.cameralight;
1471
+
1472
+ // Set default to 0.1
1473
+ BoundaryRep.SEUIL /= 2;
1474
+ System.out.println("SEUIL = " + BoundaryRep.SEUIL);
1475
+ }
1476
+
1477
+ System.out.println("Link this = " + this + "; support = " + other);
14501478
14511479 //if (bRep != null)
14521480 // bRep.linkVerticesThis(other.bRep);
....@@ -1816,8 +1844,9 @@
18161844 if (obj.name == null)
18171845 continue; // can't be a null one
18181846
1819
- //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count
1820
- if (n.startsWith(obj.name))
1847
+ String name = obj.name.split(":")[0]; // Poser generates a count
1848
+ //if (n.startsWith(obj.name))
1849
+ if (n.contains(name))
18211850 {
18221851 theobj = obj;
18231852 count++;
....@@ -2120,15 +2149,8 @@
21202149 if (/*parent != null &&*/ material == null)
21212150 {
21222151 material = new cMaterial(GetMaterial());
2123
- if (projectedVertices == null || projectedVertices.length <= 2)
2124
- {
2125
- projectedVertices = new Object3D.cVector2[3];
2126
- }
2127
- for (int i = 0; i < 3; i++)
2128
- {
2129
- projectedVertices[i] = new cVector2(); // Others
2130
- }
2131
- projectedVertices[0].x = 100; // bump
2152
+
2153
+ InitOthers();
21322154
21332155 if (this instanceof Camera)
21342156 {
....@@ -2278,6 +2300,7 @@
22782300 {
22792301 if (newWindow)
22802302 {
2303
+ new Exception().printStackTrace();
22812304 System.exit(0);
22822305 if (parent != null)
22832306 {
....@@ -2732,6 +2755,24 @@
27322755 blockloop = false;
27332756 }
27342757
2758
+ void GenNormalsMINE()
2759
+ {
2760
+ if (blockloop)
2761
+ return;
2762
+
2763
+ blockloop = true;
2764
+ GenNormalsMINE0();
2765
+ for (int i = 0; i < Children().Size(); i++)
2766
+ {
2767
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2768
+ if (child == null)
2769
+ continue;
2770
+ child.GenNormalsMINE();
2771
+// Children().release(i);
2772
+ }
2773
+ blockloop = false;
2774
+ }
2775
+
27352776 void ClearColors()
27362777 {
27372778 if (blockloop)
....@@ -2866,7 +2907,8 @@
28662907 {
28672908 if (bRep != null)
28682909 {
2869
- bRep.GenUV();
2910
+ bRep.GenUV(); //1);
2911
+ //bRep.UnfoldUV();
28702912 Touch();
28712913 }
28722914 }
....@@ -2876,6 +2918,15 @@
28762918 if (bRep != null)
28772919 {
28782920 bRep.GenerateNormals(crease);
2921
+ Touch();
2922
+ }
2923
+ }
2924
+
2925
+ void GenNormalsMINE0()
2926
+ {
2927
+ if (bRep != null)
2928
+ {
2929
+ bRep.GenerateNormalsMINE();
28792930 Touch();
28802931 }
28812932 }
....@@ -4111,7 +4162,7 @@
41114162 if (blockloop)
41124163 return;
41134164
4114
- for (int i=0; i<size(); i++)
4165
+ for (int i=0; i<Size(); i++)
41154166 {
41164167 if (get(i).parent != this)
41174168 {
....@@ -4120,6 +4171,22 @@
41204171 }
41214172 blockloop = true;
41224173 get(i).RepairParent();
4174
+ blockloop = false;
4175
+ }
4176
+ }
4177
+
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();
41234190 blockloop = false;
41244191 }
41254192 }
....@@ -4790,7 +4857,7 @@
47904857 return globalTransform;
47914858 }
47924859
4793
- void PreprocessOcclusion(CameraPane cp)
4860
+ void PreprocessOcclusion(iCameraPane cp)
47944861 {
47954862 /*
47964863 if (AOdone)
....@@ -4937,7 +5004,8 @@
49375004 } else //
49385005 if (editWindow != null)
49395006 {
4940
- editWindow.cameraView.lighttouched = true;
5007
+ //editWindow.cameraView.lighttouched = true;
5008
+ Globals.lighttouched = true;
49415009 }
49425010 }
49435011
....@@ -5091,10 +5159,34 @@
50915159
50925160 // System.out.println("Fullname = " + fullname);
50935161
5094
- if (fullname.name.indexOf(":") == -1)
5095
- 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(":"));
50965167
5097
- 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];
50985190 }
50995191
51005192 static String GetBump(cTexture fullname)
....@@ -5103,10 +5195,38 @@
51035195 return "";
51045196
51055197 // System.out.println("Fullname = " + fullname);
5106
- if (fullname.name.indexOf(":") == -1)
5107
- return "";
5108
-
5109
- return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length());
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];
51105230 }
51115231
51125232 String GetPigmentTexture()
....@@ -5180,7 +5300,7 @@
51805300 System.out.print("; textures = " + textures);
51815301 System.out.println("; usedtextures = " + usedtextures);
51825302
5183
- if (GetTextures() == null)
5303
+ if (GetTextures() == null) // What is that??
51845304 GetTextures().name = ":";
51855305
51865306 String texname = tex;
....@@ -5249,25 +5369,22 @@
52495369 }
52505370 }
52515371
5252
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5372
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52535373 {
52545374 Draw(display, root, selected, blocked);
52555375 }
52565376
5257
- static cMaterial[] materialstack = new cMaterial[65536];
5258
- static boolean[] selectedstack = new boolean[65536];
5259
- static int materialdepth = 0;
5260
-
52615377 boolean NeedSupport()
52625378 {
52635379 return
52645380 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
52655381 // PROBLEM with CROWD!!
5266
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5382
+ && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
52675383 }
52685384
5385
+ static boolean DEBUG_SELECTION = false;
52695386
5270
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5387
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52715388 {
52725389 Invariants(); // june 2013
52735390
....@@ -5276,7 +5393,7 @@
52765393 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
52775394 }
52785395
5279
- if (display.drawMode == CameraPane.SELECTION &&
5396
+ if (display.DrawMode() == iCameraPane.SELECTION &&
52805397 hide)
52815398 return;
52825399
....@@ -5295,7 +5412,7 @@
52955412 if (this instanceof Checker)
52965413 return;
52975414
5298
- if (display.drawMode == display.SHADOW && PASSTEST)
5415
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
52995416 return;
53005417
53015418 if (count <= 0)
....@@ -5303,13 +5420,13 @@
53035420 return;
53045421 }
53055422
5306
- if ((//display.drawMode == CameraPane.SHADOW ||
5307
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5423
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5424
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53085425 {
53095426 return;
53105427 }
53115428
5312
- javax.media.opengl.GL gl = display.GetGL();
5429
+ //javax.media.opengl.GL gl = display.GetGL();
53135430
53145431 /*
53155432 if (touched)
....@@ -5345,15 +5462,15 @@
53455462
53465463 boolean compiled = false;
53475464
5348
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5465
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53495466
5350
- if (!selectmode && //display.drawMode != display.SELECTION &&
5467
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53515468 (touched || (bRep != null && bRep.displaylist <= 0)))
53525469 {
5353
- display.lighttouched = true;
5470
+ Globals.lighttouched = true;
53545471 } // all panes...
5355
- //if (usecalllists && display.drawMode != display.SELECTION && display.drawMode != display.SHADOW &&
5356
- if (bRep != null && usecalllists && !selectmode && // june 2013 display.drawMode != display.SHADOW &&
5472
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5473
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53575474 (touched || (bRep != null && bRep.displaylist <= 0)))
53585475 {
53595476 if (!(this instanceof Composite))
....@@ -5361,7 +5478,7 @@
53615478 //if (displaylist == -1 && usecalllists)
53625479 if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
53635480 {
5364
- bRep.displaylist = gl.glGenLists(1);
5481
+ bRep.displaylist = display.GenList();
53655482 assert(bRep.displaylist != 0);
53665483 // System.err.println("glGenLists: " + bRep.displaylist + " for " + this);
53675484 //System.out.println("\tgen list " + list);
....@@ -5373,18 +5490,20 @@
53735490 if (usecalllists)
53745491 {
53755492 // System.err.println("new list " + bRep.displaylist + " for " + this);
5376
- gl.glNewList(bRep.displaylist, gl.GL_COMPILE); //_AND_EXECUTE);
5493
+ display.NewList(bRep.displaylist);
53775494 }
5495
+
53785496 CallList(display, root, selected, blocked);
5497
+
53795498 // compiled = true;
53805499 if (usecalllists)
53815500 {
53825501 // System.err.println("end list " + bRep.displaylist + " for " + this);
5383
- gl.glEndList();
5502
+ display.EndList();
53845503 }
53855504 //gl.glDrawBuffer(gl.GL_BACK);
53865505 // XXX touched = false;
5387
- display.lighttouched = true; // all panes...
5506
+ Globals.lighttouched = true; // all panes...
53885507 }
53895508
53905509 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5423,12 +5542,12 @@
54235542
54245543 // frustum culling
54255544 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5426
- && display.drawMode != CameraPane.SELECTION)
5545
+ && display.DrawMode() != iCameraPane.SELECTION)
54275546 {
5428
- if (display.drawMode == CameraPane.SHADOW)
5547
+ if (display.DrawMode() == iCameraPane.SHADOW)
54295548 {
54305549 if (!link2master // tricky to cull in shadow mode.
5431
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5550
+ && GetBRep().FrustumCull(this, null, display.LightCamera(), true))
54325551 {
54335552 //System.out.print("CULLED");
54345553 culled = true;
....@@ -5436,7 +5555,7 @@
54365555 }
54375556 else
54385557 //GetBRep().getBounds(v0, v1, this);
5439
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5558
+ if (GetBRep().FrustumCull(this, null, display.RenderCamera(), false))
54405559 culled = true;
54415560
54425561 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5472,11 +5591,11 @@
54725591
54735592
54745593 if (!culled)
5475
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5594
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
54765595 {
54775596 if (GetBRep() != null)
54785597 {
5479
- CameraPane.NextIndex(this, gl);
5598
+ display.NextIndex();
54805599 // vertex color conflict : gl.glCallList(list);
54815600 DrawNode(display, root, selected);
54825601 if (this instanceof BezierPatch)
....@@ -5498,53 +5617,7 @@
54985617 color[2] /= 2;
54995618 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55005619 */
5501
- if (material != null)
5502
- {
5503
- materialstack[materialdepth] = material;
5504
- selectedstack[materialdepth] = selected;
5505
- cStatic.objectstack[materialdepth++] = this;
5506
- //System.out.println("material " + material);
5507
- //Applet3D.tracein(this, selected);
5508
- display.vector2buffer = projectedVertices;
5509
- if (this instanceof Camera)
5510
- {
5511
- display.options1[0] = material.shift;
5512
- //System.out.println("shift " + material.shift);
5513
- display.options1[1] = material.lightarea;
5514
- display.options1[2] = material.shadowbias;
5515
- display.options1[3] = material.aniso;
5516
- display.options1[4] = material.anisoV;
5517
- display.options2[0] = material.opacity;
5518
- display.options2[1] = material.diffuse;
5519
- display.options2[2] = material.factor;
5520
-
5521
- cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5522
- display.options3[3] = material.cameralight/0.2f;
5523
-
5524
- // if (display.CURRENTANTIALIAS > 0)
5525
- // display.options3[3] /= 4;
5526
-
5527
- /*
5528
- System.out.println("Focus = " + display.options1[0]);
5529
- System.out.println("Aperture = " + display.options1[1]);
5530
- System.out.println("ShadowBlur = " + display.options1[2]);
5531
- System.out.println("Antialiasing = " + display.options1[3]);
5532
- System.out.println("Fog = " + display.options2[0]);
5533
- System.out.println("Intensity = " + display.options2[1]);
5534
- System.out.println("Elevation = " + display.options2[2]);
5535
- /**/
5536
- } else
5537
- {
5538
- material.Draw(display, selected);
5539
- }
5540
- } else
5541
- {
5542
- if (selected && CameraPane.flash)
5543
- {
5544
- display.modelParams4[1] = 100;
5545
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5546
- }
5547
- }
5620
+ display.PushMaterial(this, selected);
55485621
55495622 //System.out.println("call list " + list);
55505623 //System.out.println();
....@@ -5579,30 +5652,15 @@
55795652
55805653 // System.err.println("glCallList: " + bRep.displaylist + " for " + this);
55815654 assert(bRep.displaylist != 0);
5582
- gl.glCallList(bRep.displaylist);
5655
+ display.CallList(bRep.displaylist);
55835656 // june 2013 drawSelf(display, root, selected);
55845657 }
55855658 }
55865659 }
55875660
55885661 display.ReleaseTextures(tex);
5589
-
5590
- //if (parent != null && parent.GetMaterial() != null)
5591
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5592
- if (material != null)
5593
- {
5594
- materialdepth -= 1;
5595
- if (materialdepth > 0)
5596
- {
5597
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5598
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5599
- }
5600
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5601
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5602
- {
5603
- display.modelParams4[1] = GetMaterial().cameralight;
5604
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5605
- }
5662
+
5663
+ display.PopMaterial(this, selected);
56065664 }
56075665
56085666 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5644,7 +5702,7 @@
56445702 // resetMasterNode();
56455703 }
56465704
5647
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5705
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56485706 {
56495707 if (GetBRep() == null)
56505708 {
....@@ -5727,7 +5785,7 @@
57275785 boolean flipV = false; // true;
57285786 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57295787
5730
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5788
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57315789 {
57325790 if (hide)
57335791 return;
....@@ -5786,16 +5844,7 @@
57865844 // // ??????????????????????????? Touch();
57875845 // }
57885846
5789
- if (material != null)
5790
- {
5791
- materialstack[materialdepth] = material;
5792
- selectedstack[materialdepth] = selected;
5793
- cStatic.objectstack[materialdepth++] = this;
5794
- //System.out.println("material " + material);
5795
- //Applet3D.tracein("selected ", selected);
5796
- display.vector2buffer = projectedVertices;
5797
- material.Draw(display, selected);
5798
- }
5847
+display.PushMaterial2(this, selected);
57995848
58005849 Object3D child;
58015850 boolean sel;
....@@ -5847,19 +5896,7 @@
58475896 */
58485897 //depth += 1;
58495898
5850
- if (material != null)
5851
- {
5852
- materialdepth -= 1;
5853
- if (materialdepth > 0)
5854
- {
5855
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5856
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5857
- }
5858
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5859
- //else
5860
- //material.Draw(display, false);
5861
- }
5862
-
5899
+display.PopMaterial2(this);
58635900 /*
58645901 display.ReleaseTextures(tex);
58655902 */
....@@ -5870,9 +5907,9 @@
58705907
58715908 //static cVector min,max;
58725909
5873
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5910
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
58745911 {
5875
- 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)
58765913 return; // no shadow for transparent objects
58775914
58785915 if (hide)
....@@ -5915,11 +5952,12 @@
59155952 return;
59165953 }
59175954
5955
+ //bRep.GenUV(1/material.diffuseness);
59185956 // bRep.lock = true;
59195957
5920
- javax.media.opengl.GL gl = display.GetGL();
5958
+ //javax.media.opengl.GL gl = display.GetGL();
59215959
5922
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5960
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59235961 {
59245962 int fc = bRep.FaceCount();
59255963 int vc = bRep.VertexCount();
....@@ -5934,23 +5972,7 @@
59345972
59355973 bRep.getMinMax(min, max, 100);
59365974
5937
- gl.glBegin(gl.GL_LINES);
5938
-
5939
- gl.glVertex3d(min.x, min.y, min.z);
5940
- gl.glVertex3d(min.x, min.y, max.z);
5941
- gl.glVertex3d(min.x, min.y, min.z);
5942
- gl.glVertex3d(min.x, max.y, min.z);
5943
- gl.glVertex3d(min.x, min.y, min.z);
5944
- gl.glVertex3d(max.x, min.y, min.z);
5945
-
5946
- gl.glVertex3d(max.x, max.y, max.z);
5947
- gl.glVertex3d(min.x, max.y, max.z);
5948
- gl.glVertex3d(max.x, max.y, max.z);
5949
- gl.glVertex3d(max.x, min.y, max.z);
5950
- gl.glVertex3d(max.x, max.y, max.z);
5951
- gl.glVertex3d(max.x, max.y, min.z);
5952
-
5953
- gl.glEnd();
5975
+ display.DrawBox(min, max);
59545976
59555977 return;
59565978 }
....@@ -5994,7 +6016,7 @@
59946016 {
59956017 //throw new Error();
59966018
5997
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6019
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
59986020
59996021 int[] strips = bRep.getRawIndices();
60006022
....@@ -6004,178 +6026,14 @@
60046026 new Exception().printStackTrace();
60056027 return;
60066028 }
6007
-
6008
- // TRIANGLE STRIP ARRAY
6009
- if (bRep.trimmed)
6010
- {
6011
- float[] v = bRep.getRawVertices();
6012
- float[] n = bRep.getRawNormals();
6013
- float[] c = bRep.getRawColors();
6014
- float[] uv = bRep.getRawUVMap();
6015
-
6016
- int count2 = 0;
6017
- int count3 = 0;
6018
-
6019
- if (n.length > 0)
6020
- {
6021
- for (int i = 0; i < strips.length; i++)
6022
- {
6023
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6024
-
6025
- /*
6026
- boolean locked = false;
6027
- float eps = 0.1f;
6028
- boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6029
-
6030
- int dot = 0;
6031
-
6032
- if ((dot&1) == 0)
6033
- dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6034
-
6035
- if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6036
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6037
- else
6038
- {
6039
- locked = true;
6040
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6041
- }
6042
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6043
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6044
- if (hasnorm)
6045
- {
6046
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6047
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6048
- }
6049
-
6050
- if ((dot&4) == 0)
6051
- dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6052
-
6053
- if (wrap || !locked && (dot&8) != 0)
6054
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6055
- else
6056
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6057
-
6058
- f.dot = dot;
6059
- */
6060
-
6061
- if (!selectmode)
6062
- {
6063
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6064
- {
6065
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6066
- } else
6067
- {
6068
- gl.glNormal3f(0, 0, 1);
6069
- }
6070
-
6071
- if (c != null)
6072
- //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
6073
- {
6074
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6075
- }
6076
- }
6077
- if (flipV)
6078
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6079
- else
6080
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6081
- //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6082
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6083
-
6084
- count2 += 2;
6085
- count3 += 3;
6086
- if (!selectmode)
6087
- {
6088
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6089
- {
6090
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6091
- } else
6092
- {
6093
- gl.glNormal3f(0, 0, 1);
6094
- }
6095
- if (c != null)
6096
- {
6097
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6098
- }
6099
- }
6100
- if (flipV)
6101
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6102
- else
6103
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6104
- //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
6105
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6106
-
6107
- count2 += 2;
6108
- count3 += 3;
6109
- for (int j = 0; j < strips[i] - 2; j++)
6110
- {
6111
- //gl.glTexCoord2d(...);
6112
- if (!selectmode)
6113
- {
6114
- if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
6115
- {
6116
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
6117
- } else
6118
- {
6119
- gl.glNormal3f(0, 0, 1);
6120
- }
6121
- if (c != null)
6122
- {
6123
- gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
6124
- }
6125
- }
6126
-
6127
- if (flipV)
6128
- gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
6129
- else
6130
- gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
6131
- //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
6132
- gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
6133
- count2 += 2;
6134
- count3 += 3;
6135
- }
6136
-
6137
- gl.glEnd();
6138
- }
6139
- }
6140
-
6141
- assert count3 == v.length;
6142
- }
6143
- else // !trimmed
6144
- {
6145
- int count = 0;
6146
- for (int i = 0; i < strips.length; i++)
6147
- {
6148
- gl.glBegin(gl.GL_TRIANGLE_STRIP);
6149
-
6150
- Vertex p = bRep.GetVertex(bRep.indices[count++]);
6151
- Vertex q = bRep.GetVertex(bRep.indices[count++]);
6152
-
6153
- drawVertex(gl, p, selectmode);
6154
- drawVertex(gl, q, selectmode);
6155
-
6156
- for (int j = 0; j < strips[i] - 2; j++)
6157
- {
6158
- Vertex r = bRep.GetVertex(bRep.indices[count++]);
6159
-
6160
-// if (j%2 == 0)
6161
-// drawFace(p, q, r, display, null);
6162
-// else
6163
-// drawFace(p, r, q, display, null);
6164
-
6165
-// p = q;
6166
-// q = r;
6167
- drawVertex(gl, r, selectmode);
6168
- }
6169
-
6170
- gl.glEnd();
6171
- }
6172
- }
6029
+
6030
+ display.DrawGeometry(bRep, flipV, selectmode);
61736031 } else // catch (Error e)
61746032 {
61756033 // TRIANGLE ARRAY
61766034 if (IsOpaque()) // Static())
61776035 {
6178
- gl.glBegin(gl.GL_TRIANGLES);
6036
+ display.StartTriangles();
61796037 int facecount = bRep.FaceCount();
61806038 for (int i = 0; i < facecount; i++)
61816039 {
....@@ -6238,9 +6096,9 @@
62386096 // // r.norm.dot(v3) > -0.5)
62396097 // // continue;
62406098
6241
- drawFace(p, q, r, display, face);
6099
+ display.DrawFace(this, p, q, r, face);
62426100 }
6243
- gl.glEnd();
6101
+ display.EndTriangles();
62446102 }
62456103 else
62466104 {
....@@ -6269,8 +6127,8 @@
62696127 //System.out.println("SORT");
62706128
62716129 java.util.Arrays.sort(facescompare);
6272
-
6273
- gl.glBegin(gl.GL_TRIANGLES);
6130
+
6131
+ display.StartTriangles();
62746132 for (int i = 0; i < facecount; i++)
62756133 {
62766134 Face face = bRep.GetFace(facescompare[i].index);
....@@ -6282,13 +6140,14 @@
62826140 Vertex q = bRep.GetVertex(face.q);
62836141 Vertex r = bRep.GetVertex(face.r);
62846142
6285
- drawFace(p, q, r, display, face);
6143
+ display.DrawFace(this, p, q, r, face);
62866144 }
6287
- gl.glEnd();
6145
+ display.EndTriangles();
62886146 }
62896147
62906148 if (false) // live && support != null && support.bRep != null) // debug weights
62916149 {
6150
+ /*
62926151 gl.glDisable(gl.GL_LIGHTING);
62936152 float[] colorV = new float[3];
62946153
....@@ -6367,6 +6226,7 @@
63676226 // gl.glEnd();
63686227 }
63696228 }
6229
+ */
63706230 }
63716231 }
63726232
....@@ -6411,7 +6271,7 @@
64116271 center.add(r);
64126272 center.mul(1.0/3);
64136273
6414
- center.sub(CameraPane.theRenderer.eyeCamera.location);
6274
+ center.sub(Globals.theRenderer.EyeCamera().location);
64156275
64166276 distance = center.dot(center);
64176277 }
....@@ -6422,347 +6282,11 @@
64226282
64236283 transient FaceCompare[] facescompare = null;
64246284
6425
- void SetColor(CameraPane display, Vertex p0)
6426
- {
6427
- if (display.RENDERPROGRAM == 0)
6428
- {
6429
- float r = 0;
6430
- if (bRep != null)
6431
- {
6432
- if (bRep.stripified)
6433
- {
6434
- r = 1;
6435
- }
6436
- }
6437
- float g = 0;
6438
- if (bRep != null)
6439
- {
6440
- if (bRep.trimmed)
6441
- {
6442
- g = 1;
6443
- }
6444
- }
6445
- float b = 0;
6446
- if (support != null && link2master)
6447
- {
6448
- b = 1;
6449
- }
6450
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6451
- return;
6452
- }
6453
-
6454
- if (display.drawMode != CameraPane.SHADOW)
6455
- return;
6456
-
6457
- javax.media.opengl.GL gl = display.GetGL();
6458
-// if (true) return;
6459
-// float ao = p.AO;
6460
-//
6461
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6462
-// // ao = 1;
6463
-//
6464
-// gl.glColor4f(ao, ao, ao, 1);
6465
-
6466
-// CameraPane.selectedpoint.
6467
-// getAverage(cStatic.point1, true);
6468
- if (CameraPane.pointflow == null) // !random) // live)
6469
- {
6470
- return;
6471
- }
6472
-
6473
- cStatic.point1.set(0,0,0);
6474
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6475
-
6476
- cStatic.point1.sub(p0);
6477
-
6478
-
6479
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6480
-// {
6481
-// return;
6482
-// }
6483
-
6484
- //if (true)
6485
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6486
- {
6487
- return;
6488
- }
6489
-
6490
- float[] colorV = new float[3];
6491
-
6492
- if (false) // marked)
6493
- {
6494
- // debug rigging weights
6495
- for (int object = 0; object < p0.vertexlinks.length; object++)
6496
- {
6497
- float weight = p0.weights[object] / p0.totalweight;
6498
-
6499
- // if (weight < 0.1)
6500
- // {
6501
- // assert(weight == 0);
6502
- // continue;
6503
- // }
6504
-
6505
- if (p0.vertexlinks[object] == -1)
6506
- continue;
6507
-
6508
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6509
-
6510
- int color = //1 << object; //
6511
- //p.vertexlinks.length;
6512
- support.bRep.supports[p0.closestsupport].links[object];
6513
- colorV[2] += (color & 1) * weight;
6514
- colorV[1] += ((color & 2) >> 1) * weight;
6515
- colorV[0] += ((color & 4) >> 2) * weight;
6516
- }
6517
- }
6518
- else
6519
- {
6520
- if (drawingstarted)
6521
- {
6522
- // find next point
6523
- if (bRep.GetVertex(0).faceindices == null)
6524
- {
6525
- bRep.InitFaceIndices();
6526
- }
6527
-
6528
- double ymin = p0.y;
6529
-
6530
- Vertex newp = p0;
6531
-
6532
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6533
- {
6534
- int fi = p0.faceindices[fii];
6535
-
6536
- if (fi == -1)
6537
- break;
6538
-
6539
- Face f = bRep.GetFace(fi);
6540
-
6541
- Vertex p = bRep.GetVertex(f.p);
6542
- Vertex q = bRep.GetVertex(f.q);
6543
- Vertex r = bRep.GetVertex(f.r);
6544
-
6545
- int swap = (int)(Math.random()*3);
6546
-
6547
-// for (int s=swap; --s>=0;)
6548
-// {
6549
-// Vertex t = p;
6550
-// p = q;
6551
-// q = r;
6552
-// r = t;
6553
-// }
6554
- if (ymin > p.y)
6555
- {
6556
- ymin = p.y;
6557
- newp = p;
6558
-// break;
6559
- }
6560
- if (ymin > q.y)
6561
- {
6562
- ymin = q.y;
6563
- newp = q;
6564
-// break;
6565
- }
6566
- if (ymin > r.y)
6567
- {
6568
- ymin = r.y;
6569
- newp = r;
6570
-// break;
6571
- }
6572
- }
6573
-
6574
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6575
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6576
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6577
-
6578
- drawingstarted = false;
6579
-
6580
- // return;
6581
- }
6582
-
6583
- if (false) // CameraPane.DRAW
6584
- {
6585
- p0.AO = colorV[0] = 2;
6586
- colorV[1] = 2;
6587
- colorV[2] = 2;
6588
- }
6589
-
6590
- CameraPane.pointflow.add(p0);
6591
- CameraPane.pointflow.Touch();
6592
- }
6593
-
6594
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6595
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6596
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6597
- }
6598
-
65996285 void Print(Vertex v)
66006286 {
66016287 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
66026288 }
66036289
6604
- void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean selectmode)
6605
- {
6606
- if (!selectmode)
6607
- {
6608
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6609
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6610
-
6611
- if (flipV)
6612
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6613
- else
6614
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6615
- }
6616
-
6617
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6618
- }
6619
-
6620
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6621
- CameraPane display, Face face)
6622
- {
6623
- if (pv.y == -10000 ||
6624
- qv.y == -10000 ||
6625
- rv.y == -10000)
6626
- return;
6627
-
6628
-// float b = f.nbiterations & 1;
6629
-// float g = (f.nbiterations>>1) & 1;
6630
-// float r = (f.nbiterations>>2) & 1;
6631
-//
6632
-// //if (f.weight == 10000)
6633
-// //{
6634
-// // r = 1; g = b = 0;
6635
-// //}
6636
-// //else
6637
-// //{
6638
-// // assert(f.weight < 10000);
6639
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6640
-// if (r<0)
6641
-// assert(r>=0);
6642
-// //}
6643
-
6644
- javax.media.opengl.GL gl = display.GetGL();
6645
-
6646
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6647
-
6648
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6649
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6650
- {
6651
- //gl.glBegin(gl.GL_TRIANGLES);
6652
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6653
- if (!hasnorm)
6654
- {
6655
- // System.out.println("FUCK!!");
6656
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6657
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6658
- LA.vecCross(v0, v1, v2);
6659
- LA.vecNormalize(v2);
6660
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6661
- }
6662
-
6663
- if (hasnorm)
6664
- {
6665
-// if (!pv.norm.normalized())
6666
-// assert(pv.norm.normalized());
6667
-
6668
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6669
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6670
- }
6671
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6672
- SetColor(display, pv);
6673
- //gl.glColor4f(r, g, b, 1);
6674
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6675
- if (flipV)
6676
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6677
- else
6678
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6679
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6680
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6681
-// Print(pv);
6682
- if (hasnorm)
6683
- {
6684
-// assert(qv.norm.normalized());
6685
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6686
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6687
- }
6688
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6689
- // boolean locked = false;
6690
- // float eps = 0.1f;
6691
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6692
-
6693
- // int dot = 0; //*/ (int)f.dot;
6694
-
6695
- // if ((dot&1) == 0)
6696
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6697
-
6698
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6699
- if (flipV)
6700
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6701
- else
6702
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6703
- // else
6704
- // {
6705
- // locked = true;
6706
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6707
- // }
6708
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6709
- SetColor(display, qv);
6710
- //gl.glColor4f(r, g, b, 1);
6711
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6712
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6713
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6714
-// Print(qv);
6715
- if (hasnorm)
6716
- {
6717
-// assert(rv.norm.normalized());
6718
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6719
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6720
- }
6721
-
6722
- // if ((dot&4) == 0)
6723
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6724
-
6725
- // if (wrap || !locked && (dot&8) != 0)
6726
- if (flipV)
6727
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6728
- else
6729
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6730
- // else
6731
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6732
-
6733
- // f.dot = dot;
6734
-
6735
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6736
- SetColor(display, rv);
6737
- //gl.glColor4f(r, g, b, 1);
6738
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6739
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6740
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6741
-// Print(rv);
6742
- //gl.glEnd();
6743
- }
6744
- else
6745
- {
6746
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6747
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6748
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6749
-
6750
- }
6751
-
6752
- if (false) // (attributes & WIREFRAME) != 0)
6753
- {
6754
- gl.glDisable(gl.GL_LIGHTING);
6755
-
6756
- gl.glBegin(gl.GL_LINE_LOOP);
6757
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6758
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6759
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6760
- gl.glEnd();
6761
-
6762
- gl.glEnable(gl.GL_LIGHTING);
6763
- }
6764
- }
6765
-
67666290 void drawSelf(ClickInfo info, int level, boolean select)
67676291 {
67686292 if (bRep == null)
....@@ -7334,83 +6858,83 @@
73346858 int spotw = spot.x + spot.width;
73356859 int spoth = spot.y + spot.height;
73366860 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7337
- if (CameraPane.Xmin > spot.x)
7338
- {
7339
- CameraPane.Xmin = spot.x;
7340
- }
7341
- if (CameraPane.Xmax < spotw)
7342
- {
7343
- CameraPane.Xmax = spotw;
7344
- }
7345
- if (CameraPane.Ymin > spot.y)
7346
- {
7347
- CameraPane.Ymin = spot.y;
7348
- }
7349
- if (CameraPane.Ymax < spoth)
7350
- {
7351
- CameraPane.Ymax = spoth;
7352
- }
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
+// }
73536877 spot.translate(32, 32);
73546878 spotw = spot.x + spot.width;
73556879 spoth = spot.y + spot.height;
73566880 info.g.setColor(Color.blue);
73576881 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7358
- if (CameraPane.Xmin > spot.x)
7359
- {
7360
- CameraPane.Xmin = spot.x;
7361
- }
7362
- if (CameraPane.Xmax < spotw)
7363
- {
7364
- CameraPane.Xmax = spotw;
7365
- }
7366
- if (CameraPane.Ymin > spot.y)
7367
- {
7368
- CameraPane.Ymin = spot.y;
7369
- }
7370
- if (CameraPane.Ymax < spoth)
7371
- {
7372
- CameraPane.Ymax = spoth;
7373
- }
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
+// }
73746898 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
73756899 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
73766900 spot.translate(0, -32);
73776901 info.g.setColor(Color.green);
73786902 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7379
- if (CameraPane.Xmin > spot.x)
7380
- {
7381
- CameraPane.Xmin = spot.x;
7382
- }
7383
- if (CameraPane.Xmax < spotw)
7384
- {
7385
- CameraPane.Xmax = spotw;
7386
- }
7387
- if (CameraPane.Ymin > spot.y)
7388
- {
7389
- CameraPane.Ymin = spot.y;
7390
- }
7391
- if (CameraPane.Ymax < spoth)
7392
- {
7393
- CameraPane.Ymax = spoth;
7394
- }
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
+// }
73956919 info.g.drawArc(boundary.x, boundary.y,
73966920 boundary.width, boundary.height, 0, 360);
73976921 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7398
- if (CameraPane.Xmin > boundary.x)
7399
- {
7400
- CameraPane.Xmin = boundary.x;
7401
- }
7402
- if (CameraPane.Xmax < boundary.x + boundary.width)
7403
- {
7404
- CameraPane.Xmax = boundary.x + boundary.width;
7405
- }
7406
- if (CameraPane.Ymin > boundary.y)
7407
- {
7408
- CameraPane.Ymin = boundary.y;
7409
- }
7410
- if (CameraPane.Ymax < boundary.y + boundary.height)
7411
- {
7412
- CameraPane.Ymax = boundary.y + boundary.height;
7413
- }
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
+// }
74146938 return;
74156939 }
74166940 }
....@@ -7513,7 +7037,7 @@
75137037
75147038 case hitCenter: // Translate
75157039
7516
- scale *= 0.05f * info.pane.theRenderer.renderCamera.Distance();
7040
+ scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance();
75177041
75187042 if (modified)
75197043 {
....@@ -7561,10 +7085,10 @@
75617085 }
75627086 LA.xformDir(up, ClickInfo.matbuffer, up);
75637087 // if (!CameraPane.LOCALTRANSFORM)
7564
- LA.xformDir(up, info.pane.theRenderer.renderCamera.toScreen, up);
7088
+ LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up);
75657089 LA.xformDir(info.camera.away, ClickInfo.matbuffer, away);
75667090 // if (!CameraPane.LOCALTRANSFORM)
7567
- LA.xformDir(away, info.pane.theRenderer.renderCamera.toScreen, away);
7091
+ LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away);
75687092 //LA.vecCross(up, cVector.Z, right2);
75697093
75707094 cVector delta = LA.newVector(info.x - startX, startY - info.y, 0);
....@@ -7622,7 +7146,7 @@
76227146 }
76237147 /**/
76247148
7625
- switch (info.pane.renderCamera.viewCode)
7149
+ switch (info.pane.RenderCamera().viewCode)
76267150 {
76277151 case 1: // '\001'
76287152 LA.matZRotate(toParent, angle);
....@@ -7678,7 +7202,7 @@
76787202 }
76797203 /**/
76807204
7681
- switch (info.pane.renderCamera.viewCode)
7205
+ switch (info.pane.RenderCamera().viewCode)
76827206 {
76837207 case 3: // '\001'
76847208 if (modified)
....@@ -7731,7 +7255,7 @@
77317255 if (parent == null)
77327256 {
77337257 System.out.println("NULL PARENT");
7734
- new Exception().printStackTrace();
7258
+ //new Exception().printStackTrace();
77357259 } else
77367260 {
77377261 if (parent instanceof BezierPatch)
....@@ -7906,6 +7430,7 @@
79067430 objectUI.closeUI();
79077431 if (editWindow != null)
79087432 {
7433
+ editWindow.ctrlPanel.FlushUI();
79097434 editWindow.refreshContents();
79107435 } // ? new
79117436 objectUI = null;
....@@ -8124,6 +7649,8 @@
81247649 {
81257650 Object3D targ = this;
81267651
7652
+ targ.NORMALPUSH = obj.NORMALPUSH;
7653
+
81277654 if (obj.material != null)
81287655 {
81297656 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))