Normand Briere
2019-04-22 c60a1ad4f6aa4904e80280586b440a584b5ff061
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++)
....@@ -285,7 +298,6 @@
285298 return parent.GetName() + "#";
286299 }
287300
288
- boolean timeline = false;
289301 boolean live = false;
290302 boolean hide = false;
291303 boolean link2master = false; // performs reset support/master at each frame
....@@ -296,6 +308,8 @@
296308 boolean random = false;
297309 boolean speedup = false;
298310 boolean rewind = false;
311
+
312
+ float NORMALPUSH = 0;
299313
300314 Object3D support;
301315
....@@ -746,7 +760,7 @@
746760
747761 int GetTransformCount()
748762 {
749
- // marde pour serialization de Texture
763
+ // patch pour serialization de Texture
750764 resetmaxcount();
751765 resettransformcount();
752766 resetstep();
....@@ -780,9 +794,12 @@
780794 // factor = CameraPane.STEP;
781795 // }
782796
783
- 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)
784801 {
785
- currentframe = CameraPane.framecount;
802
+ currentframe = Globals.framecount;
786803
787804 // System.err.println("transformcount = " + transformcount);
788805 // System.err.println("factor = " + factor);
....@@ -2131,15 +2148,8 @@
21312148 if (/*parent != null &&*/ material == null)
21322149 {
21332150 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
2151
+
2152
+ InitOthers();
21432153
21442154 if (this instanceof Camera)
21452155 {
....@@ -4162,6 +4172,22 @@
41624172 }
41634173 }
41644174
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();
4187
+ blockloop = false;
4188
+ }
4189
+ }
4190
+
41654191 void RepairTexture()
41664192 {
41674193 if (this instanceof FileObject || blockloop)
....@@ -4975,7 +5001,8 @@
49755001 } else //
49765002 if (editWindow != null)
49775003 {
4978
- editWindow.cameraView.lighttouched = true;
5004
+ //editWindow.cameraView.lighttouched = true;
5005
+ Globals.lighttouched = true;
49795006 }
49805007 }
49815008
....@@ -5287,25 +5314,21 @@
52875314 }
52885315 }
52895316
5290
- void draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5317
+ void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52915318 {
52925319 Draw(display, root, selected, blocked);
52935320 }
52945321
5295
- static cMaterial[] materialstack = new cMaterial[65536];
5296
- static boolean[] selectedstack = new boolean[65536];
5297
- static int materialdepth = 0;
5298
-
52995322 boolean NeedSupport()
53005323 {
53015324 return
53025325 CameraPane.SUPPORT && !CameraPane.movingcamera && link2master && /*live &&*/ support != null
53035326 // PROBLEM with CROWD!!
5304
- && (CameraPane.drawMode == CameraPane.SHADOW || CameraPane.CROWD);
5327
+ && (Globals.DrawMode() == iCameraPane.SHADOW || Globals.CROWD);
53055328 }
53065329
53075330
5308
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5331
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53095332 {
53105333 Invariants(); // june 2013
53115334
....@@ -5314,7 +5337,7 @@
53145337 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
53155338 }
53165339
5317
- if (display.drawMode == CameraPane.SELECTION &&
5340
+ if (display.DrawMode() == iCameraPane.SELECTION &&
53185341 hide)
53195342 return;
53205343
....@@ -5333,7 +5356,7 @@
53335356 if (this instanceof Checker)
53345357 return;
53355358
5336
- if (display.drawMode == display.SHADOW && PASSTEST)
5359
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
53375360 return;
53385361
53395362 if (count <= 0)
....@@ -5341,8 +5364,8 @@
53415364 return;
53425365 }
53435366
5344
- if ((//display.drawMode == CameraPane.SHADOW ||
5345
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5367
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5368
+ display.DrawMode() == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
53465369 {
53475370 return;
53485371 }
....@@ -5383,15 +5406,15 @@
53835406
53845407 boolean compiled = false;
53855408
5386
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5409
+ boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
53875410
5388
- if (!selectmode && //display.drawMode != display.SELECTION &&
5411
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53895412 (touched || (bRep != null && bRep.displaylist <= 0)))
53905413 {
5391
- display.lighttouched = true;
5414
+ Globals.lighttouched = true;
53925415 } // 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 &&
5416
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5417
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53955418 (touched || (bRep != null && bRep.displaylist <= 0)))
53965419 {
53975420 if (!(this instanceof Composite))
....@@ -5422,7 +5445,7 @@
54225445 }
54235446 //gl.glDrawBuffer(gl.GL_BACK);
54245447 // XXX touched = false;
5425
- display.lighttouched = true; // all panes...
5448
+ Globals.lighttouched = true; // all panes...
54265449 }
54275450
54285451 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5461,12 +5484,12 @@
54615484
54625485 // frustum culling
54635486 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5464
- && display.drawMode != CameraPane.SELECTION)
5487
+ && display.DrawMode() != CameraPane.SELECTION)
54655488 {
5466
- if (display.drawMode == CameraPane.SHADOW)
5489
+ if (display.DrawMode() == CameraPane.SHADOW)
54675490 {
54685491 if (!link2master // tricky to cull in shadow mode.
5469
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5492
+ && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
54705493 {
54715494 //System.out.print("CULLED");
54725495 culled = true;
....@@ -5474,7 +5497,7 @@
54745497 }
54755498 else
54765499 //GetBRep().getBounds(v0, v1, this);
5477
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5500
+ if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
54785501 culled = true;
54795502
54805503 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5510,7 +5533,7 @@
55105533
55115534
55125535 if (!culled)
5513
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5536
+ if (display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION)
55145537 {
55155538 if (GetBRep() != null)
55165539 {
....@@ -5536,55 +5559,7 @@
55365559 color[2] /= 2;
55375560 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55385561 */
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
- }
5562
+ display.PushMaterial(this, selected);
55885563
55895564 //System.out.println("call list " + list);
55905565 //System.out.println();
....@@ -5626,23 +5601,8 @@
56265601 }
56275602
56285603 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
- }
5604
+
5605
+ display.PopMaterial(this, selected);
56465606 }
56475607
56485608 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5684,7 +5644,7 @@
56845644 // resetMasterNode();
56855645 }
56865646
5687
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5647
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56885648 {
56895649 if (GetBRep() == null)
56905650 {
....@@ -5767,7 +5727,7 @@
57675727 boolean flipV = false; // true;
57685728 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57695729
5770
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5730
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57715731 {
57725732 if (hide)
57735733 return;
....@@ -5826,16 +5786,7 @@
58265786 // // ??????????????????????????? Touch();
58275787 // }
58285788
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
- }
5789
+display.PushMaterial2(this, selected);
58395790
58405791 Object3D child;
58415792 boolean sel;
....@@ -5887,19 +5838,7 @@
58875838 */
58885839 //depth += 1;
58895840
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
-
5841
+display.PopMaterial2(this);
59035842 /*
59045843 display.ReleaseTextures(tex);
59055844 */
....@@ -5910,9 +5849,9 @@
59105849
59115850 //static cVector min,max;
59125851
5913
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5852
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
59145853 {
5915
- 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)
59165855 return; // no shadow for transparent objects
59175856
59185857 if (hide)
....@@ -5959,7 +5898,7 @@
59595898
59605899 javax.media.opengl.GL gl = display.GetGL();
59615900
5962
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5901
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59635902 {
59645903 int fc = bRep.FaceCount();
59655904 int vc = bRep.VertexCount();
....@@ -6034,7 +5973,7 @@
60345973 {
60355974 //throw new Error();
60365975
6037
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5976
+ boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
60385977
60395978 int[] strips = bRep.getRawIndices();
60405979
....@@ -6278,7 +6217,7 @@
62786217 // // r.norm.dot(v3) > -0.5)
62796218 // // continue;
62806219
6281
- drawFace(p, q, r, display, face);
6220
+ display.DrawFace(this, p, q, r, face);
62826221 }
62836222 gl.glEnd();
62846223 }
....@@ -6322,7 +6261,7 @@
63226261 Vertex q = bRep.GetVertex(face.q);
63236262 Vertex r = bRep.GetVertex(face.r);
63246263
6325
- drawFace(p, q, r, display, face);
6264
+ display.DrawFace(this, p, q, r, face);
63266265 }
63276266 gl.glEnd();
63286267 }
....@@ -6462,180 +6401,6 @@
64626401
64636402 transient FaceCompare[] facescompare = null;
64646403
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
-
66396404 void Print(Vertex v)
66406405 {
66416406 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
....@@ -6657,152 +6422,6 @@
66576422 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
66586423 }
66596424
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
-
68066425 void drawSelf(ClickInfo info, int level, boolean select)
68076426 {
68086427 if (bRep == null)
....@@ -8164,6 +7783,8 @@
81647783 {
81657784 Object3D targ = this;
81667785
7786
+ targ.NORMALPUSH = obj.NORMALPUSH;
7787
+
81677788 if (obj.material != null)
81687789 {
81697790 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))