Normand Briere
2019-04-22 ec1ab4278b2408d3b19083e530e0376f809cca44
Object3D.java
....@@ -21,6 +21,19 @@
2121
2222 ScriptNode scriptnode;
2323
24
+ void InitOthers()
25
+ {
26
+ if (projectedVertices == null || projectedVertices.length <= 2)
27
+ {
28
+ projectedVertices = new Object3D.cVector2[3];
29
+ }
30
+ for (int i = 0; i < 3; i++)
31
+ {
32
+ projectedVertices[i] = new cVector2(); // Others
33
+ }
34
+ projectedVertices[0].x = 100; // bump
35
+ }
36
+
2437 void MinMax(cVector minima, cVector maxima)
2538 {
2639 for (int xyz = 0; xyz < 3; xyz++)
....@@ -296,6 +309,8 @@
296309 boolean speedup = false;
297310 boolean rewind = false;
298311
312
+ float NORMALPUSH = 0;
313
+
299314 Object3D support;
300315
301316 Object3D GetObject()
....@@ -355,7 +370,7 @@
355370
356371 int MemorySize()
357372 {
358
- if (memorysize == 0)
373
+ if (true) // memorysize == 0)
359374 {
360375 try
361376 {
....@@ -745,7 +760,7 @@
745760
746761 int GetTransformCount()
747762 {
748
- // marde pour serialization de Texture
763
+ // patch pour serialization de Texture
749764 resetmaxcount();
750765 resettransformcount();
751766 resetstep();
....@@ -779,9 +794,12 @@
779794 // factor = CameraPane.STEP;
780795 // }
781796
782
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
797
+ if (marked && Globals.isLIVE() && live &&
798
+ //TEMP21aug2018
799
+ Globals.DrawMode() == iCameraPane.SHADOW &&
800
+ currentframe != Globals.framecount)
783801 {
784
- currentframe = CameraPane.framecount;
802
+ currentframe = Globals.framecount;
785803
786804 // System.err.println("transformcount = " + transformcount);
787805 // System.err.println("factor = " + factor);
....@@ -935,7 +953,7 @@
935953
936954 public Object clone()
937955 {
938
- return GraphreeD.clone(this);
956
+ return GrafreeD.clone(this);
939957 }
940958
941959 Object3D copyExpand()
....@@ -1446,7 +1464,16 @@
14461464 // if (other == null)
14471465 // return;
14481466
1449
- System.out.println("Link support this = " + this + "; other = " + other);
1467
+ if (other != null)
1468
+ {
1469
+ BoundaryRep.SEUIL = other.material.cameralight;
1470
+
1471
+ // Set default to 0.1
1472
+ BoundaryRep.SEUIL /= 2;
1473
+ System.out.println("SEUIL = " + BoundaryRep.SEUIL);
1474
+ }
1475
+
1476
+ System.out.println("Link this = " + this + "; support = " + other);
14501477
14511478 //if (bRep != null)
14521479 // bRep.linkVerticesThis(other.bRep);
....@@ -1701,7 +1728,7 @@
17011728 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17021729 o.bRep = transientrep;
17031730 if (clone)
1704
- o.bRep = (BoundaryRep) GraphreeD.clone(transientrep);
1731
+ o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
17051732 o.CreateMaterial();
17061733 o.SetAttributes(this, -1);
17071734 //parent
....@@ -1714,7 +1741,7 @@
17141741 Object3D o = new Object3D((clone?"Ge:":"Li:") + this.name);
17151742 o.bRep = bRep;
17161743 if (clone)
1717
- o.bRep = (BoundaryRep) GraphreeD.clone(bRep);
1744
+ o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
17181745 o.CreateMaterial();
17191746 //o.overwriteThis(this, -1);
17201747 o.SetAttributes(this, -1);
....@@ -1756,7 +1783,7 @@
17561783 // {
17571784 // assert(bRep == null);
17581785 // Object3D o = new Object3D("Geometry:" + this.name);
1759
-// o.bRep = (BoundaryRep) GraphreeD.clone(transientrep);
1786
+// o.bRep = (BoundaryRep) GrafreeD.clone(transientrep);
17601787 // o.CreateMaterial();
17611788 // parent.addChild(o);
17621789 // }
....@@ -1765,7 +1792,7 @@
17651792 // {
17661793 // assert(transientrep == null);
17671794 // Object3D o = new Object3D("Geometry:" + this.name);
1768
-// o.bRep = (BoundaryRep) GraphreeD.clone(bRep);
1795
+// o.bRep = (BoundaryRep) GrafreeD.clone(bRep);
17691796 // o.CreateMaterial();
17701797 // parent.addChild(o);
17711798 // }
....@@ -1816,8 +1843,9 @@
18161843 if (obj.name == null)
18171844 continue; // can't be a null one
18181845
1819
- //if (n.contains(obj.name)) // dec 2013 name.split(":")[0])) // Poser generates a count
1820
- if (n.startsWith(obj.name))
1846
+ String name = obj.name.split(":")[0]; // Poser generates a count
1847
+ //if (n.startsWith(obj.name))
1848
+ if (n.contains(name))
18211849 {
18221850 theobj = obj;
18231851 count++;
....@@ -2120,15 +2148,8 @@
21202148 if (/*parent != null &&*/ material == null)
21212149 {
21222150 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
2151
+
2152
+ InitOthers();
21322153
21332154 if (this instanceof Camera)
21342155 {
....@@ -2732,6 +2753,24 @@
27322753 blockloop = false;
27332754 }
27342755
2756
+ void GenNormalsMINE()
2757
+ {
2758
+ if (blockloop)
2759
+ return;
2760
+
2761
+ blockloop = true;
2762
+ GenNormalsMINE0();
2763
+ for (int i = 0; i < Children().Size(); i++)
2764
+ {
2765
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2766
+ if (child == null)
2767
+ continue;
2768
+ child.GenNormalsMINE();
2769
+// Children().release(i);
2770
+ }
2771
+ blockloop = false;
2772
+ }
2773
+
27352774 void ClearColors()
27362775 {
27372776 if (blockloop)
....@@ -2876,6 +2915,15 @@
28762915 if (bRep != null)
28772916 {
28782917 bRep.GenerateNormals(crease);
2918
+ Touch();
2919
+ }
2920
+ }
2921
+
2922
+ void GenNormalsMINE0()
2923
+ {
2924
+ if (bRep != null)
2925
+ {
2926
+ bRep.GenerateNormalsMINE();
28792927 Touch();
28802928 }
28812929 }
....@@ -3153,7 +3201,7 @@
31533201
31543202 BoundaryRep sup = bRep.support;
31553203 bRep.support = null;
3156
- BoundaryRep temprep = (BoundaryRep) GraphreeD.clone(bRep);
3204
+ BoundaryRep temprep = (BoundaryRep) GrafreeD.clone(bRep);
31573205 // bRep.SplitInTwo(onlyone); // thread...
31583206 temprep.SplitInTwo(reduction34, onlyone);
31593207 bRep = temprep;
....@@ -3677,7 +3725,7 @@
36773725 if (child == null)
36783726 continue;
36793727
3680
- if (GraphreeD.RENDERME > 0)
3728
+ if (GrafreeD.RENDERME > 0)
36813729 {
36823730 if (child instanceof Merge)
36833731 ((Merge)child).renderme();
....@@ -3828,7 +3876,7 @@
38283876 if (child == null)
38293877 continue;
38303878
3831
- if (GraphreeD.RENDERME > 0)
3879
+ if (GrafreeD.RENDERME > 0)
38323880 {
38333881 if (child instanceof Merge)
38343882 ((Merge)child).renderme();
....@@ -4023,7 +4071,7 @@
40234071 if (child == null)
40244072 continue;
40254073
4026
- if (GraphreeD.RENDERME > 0)
4074
+ if (GrafreeD.RENDERME > 0)
40274075 {
40284076 if (child instanceof Merge)
40294077 ((Merge)child).renderme();
....@@ -4111,7 +4159,7 @@
41114159 if (blockloop)
41124160 return;
41134161
4114
- for (int i=0; i<size(); i++)
4162
+ for (int i=0; i<Size(); i++)
41154163 {
41164164 if (get(i).parent != this)
41174165 {
....@@ -4120,6 +4168,22 @@
41204168 }
41214169 blockloop = true;
41224170 get(i).RepairParent();
4171
+ blockloop = false;
4172
+ }
4173
+ }
4174
+
4175
+ void RepairShadow()
4176
+ {
4177
+ if (blockloop)
4178
+ return;
4179
+
4180
+ if (this.material != null)
4181
+ this.InitOthers();
4182
+
4183
+ for (int i=0; i<Size(); i++)
4184
+ {
4185
+ blockloop = true;
4186
+ get(i).RepairShadow();
41234187 blockloop = false;
41244188 }
41254189 }
....@@ -4937,7 +5001,8 @@
49375001 } else //
49385002 if (editWindow != null)
49395003 {
4940
- editWindow.cameraView.lighttouched = true;
5004
+ //editWindow.cameraView.lighttouched = true;
5005
+ Globals.lighttouched = true;
49415006 }
49425007 }
49435008
....@@ -5249,25 +5314,21 @@
52495314 }
52505315 }
52515316
5252
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5317
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52535318 {
52545319 Draw(display, root, selected, blocked);
52555320 }
52565321
5257
- static cMaterial[] materialstack = new cMaterial[65536];
5258
- static boolean[] selectedstack = new boolean[65536];
5259
- static int materialdepth = 0;
5260
-
52615322 boolean NeedSupport()
52625323 {
52635324 return
52645325 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
52655326 // PROBLEM with CROWD!!
5266
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5327
+ && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
52675328 }
52685329
52695330
5270
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5331
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52715332 {
52725333 Invariants(); // june 2013
52735334
....@@ -5276,7 +5337,7 @@
52765337 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
52775338 }
52785339
5279
- if (display.drawMode == CameraPane.SELECTION &&
5340
+ if (display.DrawMode() == iCameraPane.SELECTION &&
52805341 hide)
52815342 return;
52825343
....@@ -5295,7 +5356,7 @@
52955356 if (this instanceof Checker)
52965357 return;
52975358
5298
- if (display.drawMode == display.SHADOW && PASSTEST)
5359
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
52995360 return;
53005361
53015362 if (count <= 0)
....@@ -5303,8 +5364,8 @@
53035364 return;
53045365 }
53055366
5306
- if ((//display.drawMode == CameraPane.SHADOW ||
5307
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5367
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5368
+ display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
53085369 {
53095370 return;
53105371 }
....@@ -5345,15 +5406,15 @@
53455406
53465407 boolean compiled = false;
53475408
5348
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5409
+ boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
53495410
5350
- if (!selectmode && //display.drawMode != display.SELECTION &&
5411
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53515412 (touched || (bRep != null && bRep.displaylist <= 0)))
53525413 {
5353
- display.lighttouched = true;
5414
+ Globals.lighttouched = true;
53545415 } // 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 &&
5416
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5417
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53575418 (touched || (bRep != null && bRep.displaylist <= 0)))
53585419 {
53595420 if (!(this instanceof Composite))
....@@ -5384,7 +5445,7 @@
53845445 }
53855446 //gl.glDrawBuffer(gl.GL_BACK);
53865447 // XXX touched = false;
5387
- display.lighttouched = true; // all panes...
5448
+ Globals.lighttouched = true; // all panes...
53885449 }
53895450
53905451 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5423,12 +5484,12 @@
54235484
54245485 // frustum culling
54255486 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5426
- && display.drawMode != CameraPane.SELECTION)
5487
+ && display.DrawMode() != CameraPane.SELECTION)
54275488 {
5428
- if (display.drawMode == CameraPane.SHADOW)
5489
+ if (display.DrawMode() == CameraPane.SHADOW)
54295490 {
54305491 if (!link2master // tricky to cull in shadow mode.
5431
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5492
+ && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
54325493 {
54335494 //System.out.print("CULLED");
54345495 culled = true;
....@@ -5436,7 +5497,7 @@
54365497 }
54375498 else
54385499 //GetBRep().getBounds(v0, v1, this);
5439
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5500
+ if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
54405501 culled = true;
54415502
54425503 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5472,7 +5533,7 @@
54725533
54735534
54745535 if (!culled)
5475
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5536
+ if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)
54765537 {
54775538 if (GetBRep() != null)
54785539 {
....@@ -5498,53 +5559,7 @@
54985559 color[2] /= 2;
54995560 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55005561 */
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
- }
5562
+ display.PushMaterial(this, selected);
55485563
55495564 //System.out.println("call list " + list);
55505565 //System.out.println();
....@@ -5586,23 +5601,8 @@
55865601 }
55875602
55885603 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
- }
5604
+
5605
+ display.PopMaterial(this, selected);
56065606 }
56075607
56085608 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5644,7 +5644,7 @@
56445644 // resetMasterNode();
56455645 }
56465646
5647
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5647
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56485648 {
56495649 if (GetBRep() == null)
56505650 {
....@@ -5727,7 +5727,7 @@
57275727 boolean flipV = false; // true;
57285728 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57295729
5730
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5730
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57315731 {
57325732 if (hide)
57335733 return;
....@@ -5786,16 +5786,7 @@
57865786 // // ??????????????????????????? Touch();
57875787 // }
57885788
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
- }
5789
+display.PushMaterial2(this, selected);
57995790
58005791 Object3D child;
58015792 boolean sel;
....@@ -5819,12 +5810,12 @@
58195810 if (!child.HasTransparency())
58205811 {
58215812 sel = root != null && root.selection != null && root.selection.indexOf(child) != -1;
5822
- // GraphreeD.tracein("draw ", child);
5813
+ // GrafreeD.tracein("draw ", child);
58235814 boolean wasblocked = blockdraw;
58245815 blockdraw = true;
58255816 child.draw(display, root, selected || sel, wasblocked || blocked); // || child.IsSelected());
58265817 blockdraw = false;
5827
- // GraphreeD.traceout("draw ", child);
5818
+ // GrafreeD.traceout("draw ", child);
58285819 }
58295820
58305821 release(i);
....@@ -5847,19 +5838,7 @@
58475838 */
58485839 //depth += 1;
58495840
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
-
5841
+display.PopMaterial2(this);
58635842 /*
58645843 display.ReleaseTextures(tex);
58655844 */
....@@ -5870,9 +5849,9 @@
58705849
58715850 //static cVector min,max;
58725851
5873
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5852
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
58745853 {
5875
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
5854
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
58765855 return; // no shadow for transparent objects
58775856
58785857 if (hide)
....@@ -5919,7 +5898,7 @@
59195898
59205899 javax.media.opengl.GL gl = display.GetGL();
59215900
5922
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5901
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59235902 {
59245903 int fc = bRep.FaceCount();
59255904 int vc = bRep.VertexCount();
....@@ -5994,7 +5973,7 @@
59945973 {
59955974 //throw new Error();
59965975
5997
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5976
+ boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
59985977
59995978 int[] strips = bRep.getRawIndices();
60005979
....@@ -6238,7 +6217,7 @@
62386217 // // r.norm.dot(v3) > -0.5)
62396218 // // continue;
62406219
6241
- drawFace(p, q, r, display, face);
6220
+ display.DrawFace(this, p, q, r, face);
62426221 }
62436222 gl.glEnd();
62446223 }
....@@ -6282,7 +6261,7 @@
62826261 Vertex q = bRep.GetVertex(face.q);
62836262 Vertex r = bRep.GetVertex(face.r);
62846263
6285
- drawFace(p, q, r, display, face);
6264
+ display.DrawFace(this, p, q, r, face);
62866265 }
62876266 gl.glEnd();
62886267 }
....@@ -6422,180 +6401,6 @@
64226401
64236402 transient FaceCompare[] facescompare = null;
64246403
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
-
65996404 void Print(Vertex v)
66006405 {
66016406 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
....@@ -6617,152 +6422,6 @@
66176422 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
66186423 }
66196424
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
-
67666425 void drawSelf(ClickInfo info, int level, boolean select)
67676426 {
67686427 if (bRep == null)
....@@ -7731,7 +7390,7 @@
77317390 if (parent == null)
77327391 {
77337392 System.out.println("NULL PARENT");
7734
- new Exception().printStackTrace();
7393
+ //new Exception().printStackTrace();
77357394 } else
77367395 {
77377396 if (parent instanceof BezierPatch)
....@@ -8041,7 +7700,7 @@
80417700 {
80427701 assert(bRep != null);
80437702 if (!(support instanceof GenericJoint)) // support.bRep != null)
8044
- GraphreeD.Assert(support.bRep == bRep.support);
7703
+ GrafreeD.Assert(support.bRep == bRep.support);
80457704 }
80467705 else
80477706 {
....@@ -8124,6 +7783,8 @@
81247783 {
81257784 Object3D targ = this;
81267785
7786
+ targ.NORMALPUSH = obj.NORMALPUSH;
7787
+
81277788 if (obj.material != null)
81287789 {
81297790 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))