Normand Briere
2019-04-22 3c4c16e0a4ca3949a7a37a24607df7f89abfe7ea
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
....@@ -416,16 +430,16 @@
416430 {
417431 Object3D copy = this;
418432
419
- Camera parentcam = CameraPane.theRenderer.manipCamera;
433
+ Camera parentcam = CameraPane.theRenderer.ManipCamera();
420434
421
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
435
+ if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[0])
422436 {
423
- parentcam = CameraPane.theRenderer.cameras[1];
437
+ parentcam = CameraPane.theRenderer.Cameras()[1];
424438 }
425439
426
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
440
+ if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[1])
427441 {
428
- parentcam = CameraPane.theRenderer.cameras[0];
442
+ parentcam = CameraPane.theRenderer.Cameras()[0];
429443 }
430444
431445 if (this == parentcam)
....@@ -433,7 +447,7 @@
433447 //assert(this instanceof Camera);
434448
435449 for (int count = parentcam.GetTransformCount(); --count>=0;)
436
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
450
+ LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.toParent, CameraPane.theRenderer.TargetLookAt());
437451 }
438452
439453 copy.marked ^= true;
....@@ -453,7 +467,7 @@
453467 //assert(this instanceof Camera);
454468
455469 for (int count = parentcam.GetTransformCount(); --count>=0;)
456
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
470
+ LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.fromParent, CameraPane.theRenderer.TargetLookAt());
457471 }
458472
459473 copy.Touch(); // display list issue
....@@ -588,7 +602,7 @@
588602 return;
589603 }
590604
591
- if (CameraPane.fromscript)
605
+ if (Globals.fromscript)
592606 {
593607 transformcount = 0;
594608 return;
....@@ -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)
....@@ -4828,7 +4854,7 @@
48284854 return globalTransform;
48294855 }
48304856
4831
- void PreprocessOcclusion(CameraPane cp)
4857
+ void PreprocessOcclusion(iCameraPane cp)
48324858 {
48334859 /*
48344860 if (AOdone)
....@@ -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,22 @@
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
5330
+ static boolean DEBUG_SELECTION = false;
53075331
5308
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5332
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
53095333 {
53105334 Invariants(); // june 2013
53115335
....@@ -5314,7 +5338,7 @@
53145338 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
53155339 }
53165340
5317
- if (display.drawMode == CameraPane.SELECTION &&
5341
+ if (display.DrawMode() == iCameraPane.SELECTION &&
53185342 hide)
53195343 return;
53205344
....@@ -5333,7 +5357,7 @@
53335357 if (this instanceof Checker)
53345358 return;
53355359
5336
- if (display.drawMode == display.SHADOW && PASSTEST)
5360
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
53375361 return;
53385362
53395363 if (count <= 0)
....@@ -5341,8 +5365,8 @@
53415365 return;
53425366 }
53435367
5344
- if ((//display.drawMode == CameraPane.SHADOW ||
5345
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5368
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5369
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53465370 {
53475371 return;
53485372 }
....@@ -5383,15 +5407,15 @@
53835407
53845408 boolean compiled = false;
53855409
5386
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5410
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53875411
5388
- if (!selectmode && //display.drawMode != display.SELECTION &&
5412
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53895413 (touched || (bRep != null && bRep.displaylist <= 0)))
53905414 {
5391
- display.lighttouched = true;
5415
+ Globals.lighttouched = true;
53925416 } // 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 &&
5417
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5418
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53955419 (touched || (bRep != null && bRep.displaylist <= 0)))
53965420 {
53975421 if (!(this instanceof Composite))
....@@ -5422,7 +5446,7 @@
54225446 }
54235447 //gl.glDrawBuffer(gl.GL_BACK);
54245448 // XXX touched = false;
5425
- display.lighttouched = true; // all panes...
5449
+ Globals.lighttouched = true; // all panes...
54265450 }
54275451
54285452 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5461,12 +5485,12 @@
54615485
54625486 // frustum culling
54635487 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5464
- && display.drawMode != CameraPane.SELECTION)
5488
+ && display.DrawMode() != iCameraPane.SELECTION)
54655489 {
5466
- if (display.drawMode == CameraPane.SHADOW)
5490
+ if (display.DrawMode() == iCameraPane.SHADOW)
54675491 {
54685492 if (!link2master // tricky to cull in shadow mode.
5469
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5493
+ && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
54705494 {
54715495 //System.out.print("CULLED");
54725496 culled = true;
....@@ -5474,7 +5498,7 @@
54745498 }
54755499 else
54765500 //GetBRep().getBounds(v0, v1, this);
5477
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5501
+ if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
54785502 culled = true;
54795503
54805504 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5510,7 +5534,7 @@
55105534
55115535
55125536 if (!culled)
5513
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5537
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
55145538 {
55155539 if (GetBRep() != null)
55165540 {
....@@ -5536,55 +5560,7 @@
55365560 color[2] /= 2;
55375561 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55385562 */
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
- }
5563
+ display.PushMaterial(this, selected);
55885564
55895565 //System.out.println("call list " + list);
55905566 //System.out.println();
....@@ -5626,23 +5602,8 @@
56265602 }
56275603
56285604 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
- }
5605
+
5606
+ display.PopMaterial(this, selected);
56465607 }
56475608
56485609 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5684,7 +5645,7 @@
56845645 // resetMasterNode();
56855646 }
56865647
5687
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5648
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56885649 {
56895650 if (GetBRep() == null)
56905651 {
....@@ -5767,7 +5728,7 @@
57675728 boolean flipV = false; // true;
57685729 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57695730
5770
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5731
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57715732 {
57725733 if (hide)
57735734 return;
....@@ -5826,16 +5787,7 @@
58265787 // // ??????????????????????????? Touch();
58275788 // }
58285789
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
- }
5790
+display.PushMaterial2(this, selected);
58395791
58405792 Object3D child;
58415793 boolean sel;
....@@ -5887,19 +5839,7 @@
58875839 */
58885840 //depth += 1;
58895841
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
-
5842
+display.PopMaterial2(this);
59035843 /*
59045844 display.ReleaseTextures(tex);
59055845 */
....@@ -5910,9 +5850,9 @@
59105850
59115851 //static cVector min,max;
59125852
5913
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5853
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
59145854 {
5915
- if (display.drawMode == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
5855
+ if (display.DrawMode() == display.SHADOW && projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
59165856 return; // no shadow for transparent objects
59175857
59185858 if (hide)
....@@ -5959,7 +5899,7 @@
59595899
59605900 javax.media.opengl.GL gl = display.GetGL();
59615901
5962
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5902
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59635903 {
59645904 int fc = bRep.FaceCount();
59655905 int vc = bRep.VertexCount();
....@@ -6034,7 +5974,7 @@
60345974 {
60355975 //throw new Error();
60365976
6037
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5977
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
60385978
60395979 int[] strips = bRep.getRawIndices();
60405980
....@@ -6278,7 +6218,7 @@
62786218 // // r.norm.dot(v3) > -0.5)
62796219 // // continue;
62806220
6281
- drawFace(p, q, r, display, face);
6221
+ display.DrawFace(this, p, q, r, face);
62826222 }
62836223 gl.glEnd();
62846224 }
....@@ -6322,7 +6262,7 @@
63226262 Vertex q = bRep.GetVertex(face.q);
63236263 Vertex r = bRep.GetVertex(face.r);
63246264
6325
- drawFace(p, q, r, display, face);
6265
+ display.DrawFace(this, p, q, r, face);
63266266 }
63276267 gl.glEnd();
63286268 }
....@@ -6462,180 +6402,6 @@
64626402
64636403 transient FaceCompare[] facescompare = null;
64646404
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
-
66396405 void Print(Vertex v)
66406406 {
66416407 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
....@@ -6657,152 +6423,6 @@
66576423 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
66586424 }
66596425
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
-
68066426 void drawSelf(ClickInfo info, int level, boolean select)
68076427 {
68086428 if (bRep == null)
....@@ -7374,83 +6994,83 @@
73746994 int spotw = spot.x + spot.width;
73756995 int spoth = spot.y + spot.height;
73766996 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7377
- if (CameraPane.Xmin > spot.x)
7378
- {
7379
- CameraPane.Xmin = spot.x;
7380
- }
7381
- if (CameraPane.Xmax < spotw)
7382
- {
7383
- CameraPane.Xmax = spotw;
7384
- }
7385
- if (CameraPane.Ymin > spot.y)
7386
- {
7387
- CameraPane.Ymin = spot.y;
7388
- }
7389
- if (CameraPane.Ymax < spoth)
7390
- {
7391
- CameraPane.Ymax = spoth;
7392
- }
6997
+// if (CameraPane.Xmin > spot.x)
6998
+// {
6999
+// CameraPane.Xmin = spot.x;
7000
+// }
7001
+// if (CameraPane.Xmax < spotw)
7002
+// {
7003
+// CameraPane.Xmax = spotw;
7004
+// }
7005
+// if (CameraPane.Ymin > spot.y)
7006
+// {
7007
+// CameraPane.Ymin = spot.y;
7008
+// }
7009
+// if (CameraPane.Ymax < spoth)
7010
+// {
7011
+// CameraPane.Ymax = spoth;
7012
+// }
73937013 spot.translate(32, 32);
73947014 spotw = spot.x + spot.width;
73957015 spoth = spot.y + spot.height;
73967016 info.g.setColor(Color.blue);
73977017 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7398
- if (CameraPane.Xmin > spot.x)
7399
- {
7400
- CameraPane.Xmin = spot.x;
7401
- }
7402
- if (CameraPane.Xmax < spotw)
7403
- {
7404
- CameraPane.Xmax = spotw;
7405
- }
7406
- if (CameraPane.Ymin > spot.y)
7407
- {
7408
- CameraPane.Ymin = spot.y;
7409
- }
7410
- if (CameraPane.Ymax < spoth)
7411
- {
7412
- CameraPane.Ymax = spoth;
7413
- }
7018
+// if (CameraPane.Xmin > spot.x)
7019
+// {
7020
+// CameraPane.Xmin = spot.x;
7021
+// }
7022
+// if (CameraPane.Xmax < spotw)
7023
+// {
7024
+// CameraPane.Xmax = spotw;
7025
+// }
7026
+// if (CameraPane.Ymin > spot.y)
7027
+// {
7028
+// CameraPane.Ymin = spot.y;
7029
+// }
7030
+// if (CameraPane.Ymax < spoth)
7031
+// {
7032
+// CameraPane.Ymax = spoth;
7033
+// }
74147034 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
74157035 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
74167036 spot.translate(0, -32);
74177037 info.g.setColor(Color.green);
74187038 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7419
- if (CameraPane.Xmin > spot.x)
7420
- {
7421
- CameraPane.Xmin = spot.x;
7422
- }
7423
- if (CameraPane.Xmax < spotw)
7424
- {
7425
- CameraPane.Xmax = spotw;
7426
- }
7427
- if (CameraPane.Ymin > spot.y)
7428
- {
7429
- CameraPane.Ymin = spot.y;
7430
- }
7431
- if (CameraPane.Ymax < spoth)
7432
- {
7433
- CameraPane.Ymax = spoth;
7434
- }
7039
+// if (CameraPane.Xmin > spot.x)
7040
+// {
7041
+// CameraPane.Xmin = spot.x;
7042
+// }
7043
+// if (CameraPane.Xmax < spotw)
7044
+// {
7045
+// CameraPane.Xmax = spotw;
7046
+// }
7047
+// if (CameraPane.Ymin > spot.y)
7048
+// {
7049
+// CameraPane.Ymin = spot.y;
7050
+// }
7051
+// if (CameraPane.Ymax < spoth)
7052
+// {
7053
+// CameraPane.Ymax = spoth;
7054
+// }
74357055 info.g.drawArc(boundary.x, boundary.y,
74367056 boundary.width, boundary.height, 0, 360);
74377057 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7438
- if (CameraPane.Xmin > boundary.x)
7439
- {
7440
- CameraPane.Xmin = boundary.x;
7441
- }
7442
- if (CameraPane.Xmax < boundary.x + boundary.width)
7443
- {
7444
- CameraPane.Xmax = boundary.x + boundary.width;
7445
- }
7446
- if (CameraPane.Ymin > boundary.y)
7447
- {
7448
- CameraPane.Ymin = boundary.y;
7449
- }
7450
- if (CameraPane.Ymax < boundary.y + boundary.height)
7451
- {
7452
- CameraPane.Ymax = boundary.y + boundary.height;
7453
- }
7058
+// if (CameraPane.Xmin > boundary.x)
7059
+// {
7060
+// CameraPane.Xmin = boundary.x;
7061
+// }
7062
+// if (CameraPane.Xmax < boundary.x + boundary.width)
7063
+// {
7064
+// CameraPane.Xmax = boundary.x + boundary.width;
7065
+// }
7066
+// if (CameraPane.Ymin > boundary.y)
7067
+// {
7068
+// CameraPane.Ymin = boundary.y;
7069
+// }
7070
+// if (CameraPane.Ymax < boundary.y + boundary.height)
7071
+// {
7072
+// CameraPane.Ymax = boundary.y + boundary.height;
7073
+// }
74547074 return;
74557075 }
74567076 }
....@@ -8164,6 +7784,8 @@
81647784 {
81657785 Object3D targ = this;
81667786
7787
+ targ.NORMALPUSH = obj.NORMALPUSH;
7788
+
81677789 if (obj.material != null)
81687790 {
81697791 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))