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++)
....@@ -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 {
....@@ -415,16 +430,16 @@
415430 {
416431 Object3D copy = this;
417432
418
- Camera parentcam = CameraPane.theRenderer.manipCamera;
433
+ Camera parentcam = CameraPane.theRenderer.ManipCamera();
419434
420
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[0])
435
+ if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[0])
421436 {
422
- parentcam = CameraPane.theRenderer.cameras[1];
437
+ parentcam = CameraPane.theRenderer.Cameras()[1];
423438 }
424439
425
- if (CameraPane.theRenderer.manipCamera == CameraPane.theRenderer.cameras[1])
440
+ if (CameraPane.theRenderer.ManipCamera() == CameraPane.theRenderer.Cameras()[1])
426441 {
427
- parentcam = CameraPane.theRenderer.cameras[0];
442
+ parentcam = CameraPane.theRenderer.Cameras()[0];
428443 }
429444
430445 if (this == parentcam)
....@@ -432,7 +447,7 @@
432447 //assert(this instanceof Camera);
433448
434449 for (int count = parentcam.GetTransformCount(); --count>=0;)
435
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.toParent, CameraPane.theRenderer.targetLookAt);
450
+ LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.toParent, CameraPane.theRenderer.TargetLookAt());
436451 }
437452
438453 copy.marked ^= true;
....@@ -452,7 +467,7 @@
452467 //assert(this instanceof Camera);
453468
454469 for (int count = parentcam.GetTransformCount(); --count>=0;)
455
- LA.xformPos(CameraPane.theRenderer.targetLookAt, parentcam.fromParent, CameraPane.theRenderer.targetLookAt);
470
+ LA.xformPos(CameraPane.theRenderer.TargetLookAt(), parentcam.fromParent, CameraPane.theRenderer.TargetLookAt());
456471 }
457472
458473 copy.Touch(); // display list issue
....@@ -587,7 +602,7 @@
587602 return;
588603 }
589604
590
- if (CameraPane.fromscript)
605
+ if (Globals.fromscript)
591606 {
592607 transformcount = 0;
593608 return;
....@@ -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);
....@@ -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);
....@@ -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 }
....@@ -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 }
....@@ -4790,7 +4854,7 @@
47904854 return globalTransform;
47914855 }
47924856
4793
- void PreprocessOcclusion(CameraPane cp)
4857
+ void PreprocessOcclusion(iCameraPane cp)
47944858 {
47954859 /*
47964860 if (AOdone)
....@@ -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,22 @@
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
5330
+ static boolean DEBUG_SELECTION = false;
52695331
5270
- void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5332
+ void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
52715333 {
52725334 Invariants(); // june 2013
52735335
....@@ -5276,7 +5338,7 @@
52765338 // System.err.println("Draw " + this + " Frame # " + ((Mocap)((Merge)support).object).frame);
52775339 }
52785340
5279
- if (display.drawMode == CameraPane.SELECTION &&
5341
+ if (display.DrawMode() == iCameraPane.SELECTION &&
52805342 hide)
52815343 return;
52825344
....@@ -5295,7 +5357,7 @@
52955357 if (this instanceof Checker)
52965358 return;
52975359
5298
- if (display.drawMode == display.SHADOW && PASSTEST)
5360
+ if (display.DrawMode() == display.SHADOW && PASSTEST)
52995361 return;
53005362
53015363 if (count <= 0)
....@@ -5303,8 +5365,8 @@
53035365 return;
53045366 }
53055367
5306
- if ((//display.drawMode == CameraPane.SHADOW ||
5307
- display.drawMode == CameraPane.SELECTION || CameraPane.DEBUG_SELECTION) && HasTransparency())
5368
+ if ((//display.DrawMode() == CameraPane.SHADOW ||
5369
+ display.DrawMode() == iCameraPane.SELECTION || display.IsDebugSelection()) && HasTransparency())
53085370 {
53095371 return;
53105372 }
....@@ -5345,15 +5407,15 @@
53455407
53465408 boolean compiled = false;
53475409
5348
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5410
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
53495411
5350
- if (!selectmode && //display.drawMode != display.SELECTION &&
5412
+ if (!selectmode && //display.DrawMode() != display.SELECTION &&
53515413 (touched || (bRep != null && bRep.displaylist <= 0)))
53525414 {
5353
- display.lighttouched = true;
5415
+ Globals.lighttouched = true;
53545416 } // 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 &&
5417
+ //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
5418
+ if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
53575419 (touched || (bRep != null && bRep.displaylist <= 0)))
53585420 {
53595421 if (!(this instanceof Composite))
....@@ -5384,7 +5446,7 @@
53845446 }
53855447 //gl.glDrawBuffer(gl.GL_BACK);
53865448 // XXX touched = false;
5387
- display.lighttouched = true; // all panes...
5449
+ Globals.lighttouched = true; // all panes...
53885450 }
53895451
53905452 touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
....@@ -5423,12 +5485,12 @@
54235485
54245486 // frustum culling
54255487 if (CameraPane.FRUSTUM && !blocked && !IsInfinite() && GetBRep() != null // && GetBRep().VertexCount() != 1260 // default grid
5426
- && display.drawMode != CameraPane.SELECTION)
5488
+ && display.DrawMode() != iCameraPane.SELECTION)
54275489 {
5428
- if (display.drawMode == CameraPane.SHADOW)
5490
+ if (display.DrawMode() == iCameraPane.SHADOW)
54295491 {
54305492 if (!link2master // tricky to cull in shadow mode.
5431
- && GetBRep().FrustumCull(this, gl, display.lightCamera, true))
5493
+ && GetBRep().FrustumCull(this, gl, display.LightCamera(), true))
54325494 {
54335495 //System.out.print("CULLED");
54345496 culled = true;
....@@ -5436,7 +5498,7 @@
54365498 }
54375499 else
54385500 //GetBRep().getBounds(v0, v1, this);
5439
- if (GetBRep().FrustumCull(this, gl, display.renderCamera, false))
5501
+ if (GetBRep().FrustumCull(this, gl, display.RenderCamera(), false))
54405502 culled = true;
54415503
54425504 // LA.xformPos(v0, display.renderCamera.toScreen, v0);
....@@ -5472,7 +5534,7 @@
54725534
54735535
54745536 if (!culled)
5475
- if (display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION)
5537
+ if (display.DrawMode() == display.SELECTION || display.IsDebugSelection())
54765538 {
54775539 if (GetBRep() != null)
54785540 {
....@@ -5498,55 +5560,7 @@
54985560 color[2] /= 2;
54995561 gl.glMaterialfv(gl.GL_BACK, gl.GL_AMBIENT_AND_DIFFUSE, color, 0);
55005562 */
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.options4[0] = material.cameralight/0.2f;
5523
- display.options4[1] = material.subsurface;
5524
- display.options4[2] = material.sheen;
5525
-
5526
- // if (display.CURRENTANTIALIAS > 0)
5527
- // display.options3[3] /= 4;
5528
-
5529
- /*
5530
- System.out.println("Focus = " + display.options1[0]);
5531
- System.out.println("Aperture = " + display.options1[1]);
5532
- System.out.println("ShadowBlur = " + display.options1[2]);
5533
- System.out.println("Antialiasing = " + display.options1[3]);
5534
- System.out.println("Fog = " + display.options2[0]);
5535
- System.out.println("Intensity = " + display.options2[1]);
5536
- System.out.println("Elevation = " + display.options2[2]);
5537
- /**/
5538
- } else
5539
- {
5540
- material.Draw(display, selected);
5541
- }
5542
- } else
5543
- {
5544
- if (selected && CameraPane.flash)
5545
- {
5546
- display.modelParams4[1] = 100;
5547
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5548
- }
5549
- }
5563
+ display.PushMaterial(this, selected);
55505564
55515565 //System.out.println("call list " + list);
55525566 //System.out.println();
....@@ -5588,23 +5602,8 @@
55885602 }
55895603
55905604 display.ReleaseTextures(tex);
5591
-
5592
- //if (parent != null && parent.GetMaterial() != null)
5593
- // parent.GetMaterial().Draw(display, parent.IsSelected(this));
5594
- if (material != null)
5595
- {
5596
- materialdepth -= 1;
5597
- if (materialdepth > 0)
5598
- {
5599
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5600
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5601
- }
5602
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5603
- } else if (selected && CameraPane.flash && GetMaterial() != null)
5604
- {
5605
- display.modelParams4[1] = GetMaterial().cameralight;
5606
- gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 4, display.modelParams4, 0);
5607
- }
5605
+
5606
+ display.PopMaterial(this, selected);
56085607 }
56095608
56105609 if (this instanceof Texture || this instanceof TextureNode)
....@@ -5646,7 +5645,7 @@
56465645 // resetMasterNode();
56475646 }
56485647
5649
- void CallList(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5648
+ void CallList(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56505649 {
56515650 if (GetBRep() == null)
56525651 {
....@@ -5729,7 +5728,7 @@
57295728 boolean flipV = false; // true;
57305729 int texres = 0; // 0 = low, 1 = normal, 2 = high res texture
57315730
5732
- void drawSelf(CameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
5731
+ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
57335732 {
57345733 if (hide)
57355734 return;
....@@ -5788,16 +5787,7 @@
57885787 // // ??????????????????????????? Touch();
57895788 // }
57905789
5791
- if (material != null)
5792
- {
5793
- materialstack[materialdepth] = material;
5794
- selectedstack[materialdepth] = selected;
5795
- cStatic.objectstack[materialdepth++] = this;
5796
- //System.out.println("material " + material);
5797
- //Applet3D.tracein("selected ", selected);
5798
- display.vector2buffer = projectedVertices;
5799
- material.Draw(display, selected);
5800
- }
5790
+display.PushMaterial2(this, selected);
58015791
58025792 Object3D child;
58035793 boolean sel;
....@@ -5849,19 +5839,7 @@
58495839 */
58505840 //depth += 1;
58515841
5852
- if (material != null)
5853
- {
5854
- materialdepth -= 1;
5855
- if (materialdepth > 0)
5856
- {
5857
- display.vector2buffer = cStatic.objectstack[materialdepth - 1].projectedVertices;
5858
- materialstack[materialdepth - 1].Draw(display, selectedstack[materialdepth - 1]);
5859
- }
5860
- //Applet3D.traceout("selected ", (stackdepth>0)?selectedstack[stackdepth-1]:"???");
5861
- //else
5862
- //material.Draw(display, false);
5863
- }
5864
-
5842
+display.PopMaterial2(this);
58655843 /*
58665844 display.ReleaseTextures(tex);
58675845 */
....@@ -5872,9 +5850,9 @@
58725850
58735851 //static cVector min,max;
58745852
5875
- void DrawNode(CameraPane display, Object3D /*Composite*/ root, boolean selected)
5853
+ void DrawNode(iCameraPane display, Object3D /*Composite*/ root, boolean selected)
58765854 {
5877
- 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)
58785856 return; // no shadow for transparent objects
58795857
58805858 if (hide)
....@@ -5921,7 +5899,7 @@
59215899
59225900 javax.media.opengl.GL gl = display.GetGL();
59235901
5924
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5902
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59255903 {
59265904 int fc = bRep.FaceCount();
59275905 int vc = bRep.VertexCount();
....@@ -5996,7 +5974,7 @@
59965974 {
59975975 //throw new Error();
59985976
5999
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
5977
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
60005978
60015979 int[] strips = bRep.getRawIndices();
60025980
....@@ -6240,7 +6218,7 @@
62406218 // // r.norm.dot(v3) > -0.5)
62416219 // // continue;
62426220
6243
- drawFace(p, q, r, display, face);
6221
+ display.DrawFace(this, p, q, r, face);
62446222 }
62456223 gl.glEnd();
62466224 }
....@@ -6284,7 +6262,7 @@
62846262 Vertex q = bRep.GetVertex(face.q);
62856263 Vertex r = bRep.GetVertex(face.r);
62866264
6287
- drawFace(p, q, r, display, face);
6265
+ display.DrawFace(this, p, q, r, face);
62886266 }
62896267 gl.glEnd();
62906268 }
....@@ -6424,180 +6402,6 @@
64246402
64256403 transient FaceCompare[] facescompare = null;
64266404
6427
- void SetColor(CameraPane display, Vertex p0)
6428
- {
6429
- if (display.RENDERPROGRAM == 0)
6430
- {
6431
- float r = 0;
6432
- if (bRep != null)
6433
- {
6434
- if (bRep.stripified)
6435
- {
6436
- r = 1;
6437
- }
6438
- }
6439
- float g = 0;
6440
- if (bRep != null)
6441
- {
6442
- if (bRep.trimmed)
6443
- {
6444
- g = 1;
6445
- }
6446
- }
6447
- float b = 0;
6448
- if (support != null && link2master)
6449
- {
6450
- b = 1;
6451
- }
6452
- display.GetGL().glColor3f(r*p0.AO, g*p0.AO, b*p0.AO);
6453
- return;
6454
- }
6455
-
6456
- if (display.drawMode != CameraPane.SHADOW)
6457
- return;
6458
-
6459
- javax.media.opengl.GL gl = display.GetGL();
6460
-// if (true) return;
6461
-// float ao = p.AO;
6462
-//
6463
-// // if (ao == 0 && !bRep.AOdone) // transient problem!
6464
-// // ao = 1;
6465
-//
6466
-// gl.glColor4f(ao, ao, ao, 1);
6467
-
6468
-// CameraPane.selectedpoint.
6469
-// getAverage(cStatic.point1, true);
6470
- if (CameraPane.pointflow == null) // !random) // live)
6471
- {
6472
- return;
6473
- }
6474
-
6475
- cStatic.point1.set(0,0,0);
6476
- LA.xformPos(cStatic.point1, CameraPane.selectedpoint.toParent, cStatic.point1);
6477
-
6478
- cStatic.point1.sub(p0);
6479
-
6480
-
6481
-// if (marked && (p0.vertexlinks == null || support == null || support.bRep == null)) // no position delta?
6482
-// {
6483
-// return;
6484
-// }
6485
-
6486
- //if (true)
6487
- if (cStatic.point1.dot(cStatic.point1) > 0.000001)
6488
- {
6489
- return;
6490
- }
6491
-
6492
- float[] colorV = new float[3];
6493
-
6494
- if (false) // marked)
6495
- {
6496
- // debug rigging weights
6497
- for (int object = 0; object < p0.vertexlinks.length; object++)
6498
- {
6499
- float weight = p0.weights[object] / p0.totalweight;
6500
-
6501
- // if (weight < 0.1)
6502
- // {
6503
- // assert(weight == 0);
6504
- // continue;
6505
- // }
6506
-
6507
- if (p0.vertexlinks[object] == -1)
6508
- continue;
6509
-
6510
- Vertex q = support.bRep.GetVertex(p0.vertexlinks[object]);
6511
-
6512
- int color = //1 << object; //
6513
- //p.vertexlinks.length;
6514
- support.bRep.supports[p0.closestsupport].links[object];
6515
- colorV[2] += (color & 1) * weight;
6516
- colorV[1] += ((color & 2) >> 1) * weight;
6517
- colorV[0] += ((color & 4) >> 2) * weight;
6518
- }
6519
- }
6520
- else
6521
- {
6522
- if (drawingstarted)
6523
- {
6524
- // find next point
6525
- if (bRep.GetVertex(0).faceindices == null)
6526
- {
6527
- bRep.InitFaceIndices();
6528
- }
6529
-
6530
- double ymin = p0.y;
6531
-
6532
- Vertex newp = p0;
6533
-
6534
- for (int fii = 0; fii < p0.faceindices.length; fii++)
6535
- {
6536
- int fi = p0.faceindices[fii];
6537
-
6538
- if (fi == -1)
6539
- break;
6540
-
6541
- Face f = bRep.GetFace(fi);
6542
-
6543
- Vertex p = bRep.GetVertex(f.p);
6544
- Vertex q = bRep.GetVertex(f.q);
6545
- Vertex r = bRep.GetVertex(f.r);
6546
-
6547
- int swap = (int)(Math.random()*3);
6548
-
6549
-// for (int s=swap; --s>=0;)
6550
-// {
6551
-// Vertex t = p;
6552
-// p = q;
6553
-// q = r;
6554
-// r = t;
6555
-// }
6556
- if (ymin > p.y)
6557
- {
6558
- ymin = p.y;
6559
- newp = p;
6560
-// break;
6561
- }
6562
- if (ymin > q.y)
6563
- {
6564
- ymin = q.y;
6565
- newp = q;
6566
-// break;
6567
- }
6568
- if (ymin > r.y)
6569
- {
6570
- ymin = r.y;
6571
- newp = r;
6572
-// break;
6573
- }
6574
- }
6575
-
6576
- CameraPane.selectedpoint.toParent[3][0] = newp.x;
6577
- CameraPane.selectedpoint.toParent[3][1] = newp.y;
6578
- CameraPane.selectedpoint.toParent[3][2] = newp.z;
6579
-
6580
- drawingstarted = false;
6581
-
6582
- // return;
6583
- }
6584
-
6585
- if (false) // CameraPane.DRAW
6586
- {
6587
- p0.AO = colorV[0] = 2;
6588
- colorV[1] = 2;
6589
- colorV[2] = 2;
6590
- }
6591
-
6592
- CameraPane.pointflow.add(p0);
6593
- CameraPane.pointflow.Touch();
6594
- }
6595
-
6596
-// gl.glColor3f(colorV[0], colorV[1], colorV[2]);
6597
-// gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, colorV, 0);
6598
-// gl.glMaterialfv(gl.GL_BACK, gl.GL_DIFFUSE, colorV, 0);
6599
- }
6600
-
66016405 void Print(Vertex v)
66026406 {
66036407 //System.err.println("(" + v.x + ", " + v.y + ", " + v.z + ")");
....@@ -6619,152 +6423,6 @@
66196423 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
66206424 }
66216425
6622
- void drawFace(Vertex pv, Vertex qv, Vertex rv,
6623
- CameraPane display, Face face)
6624
- {
6625
- if (pv.y == -10000 ||
6626
- qv.y == -10000 ||
6627
- rv.y == -10000)
6628
- return;
6629
-
6630
-// float b = f.nbiterations & 1;
6631
-// float g = (f.nbiterations>>1) & 1;
6632
-// float r = (f.nbiterations>>2) & 1;
6633
-//
6634
-// //if (f.weight == 10000)
6635
-// //{
6636
-// // r = 1; g = b = 0;
6637
-// //}
6638
-// //else
6639
-// //{
6640
-// // assert(f.weight < 10000);
6641
-// r = g = b = (float)bRep.FaceWeight(f)*100;
6642
-// if (r<0)
6643
-// assert(r>=0);
6644
-// //}
6645
-
6646
- javax.media.opengl.GL gl = display.GetGL();
6647
-
6648
- boolean selectmode = display.drawMode == display.SELECTION || CameraPane.DEBUG_SELECTION;
6649
-
6650
- //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
6651
- if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
6652
- {
6653
- //gl.glBegin(gl.GL_TRIANGLES);
6654
- boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);
6655
- if (!hasnorm)
6656
- {
6657
- // System.out.println("FUCK!!");
6658
- LA.vecSub(pv/*.pos*/, qv/*.pos*/, v0);
6659
- LA.vecSub(pv/*.pos*/, rv/*.pos*/, v1);
6660
- LA.vecCross(v0, v1, v2);
6661
- LA.vecNormalize(v2);
6662
- gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
6663
- }
6664
-
6665
- if (hasnorm)
6666
- {
6667
-// if (!pv.norm.normalized())
6668
-// assert(pv.norm.normalized());
6669
-
6670
- //System.out.println("normalp = " + pv.norm.x + ", " + pv.norm.y + ", " + pv.norm.z);
6671
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
6672
- }
6673
- gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
6674
- SetColor(display, pv);
6675
- //gl.glColor4f(r, g, b, 1);
6676
- //gl.glColor4f(pv.boundary, pv.boundary, pv.boundary, 1);
6677
- if (flipV)
6678
- gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
6679
- else
6680
- gl.glTexCoord2f((float) pv.s, (float) pv.t);
6681
- //System.out.println("vertexp = " + pv.x + ", " + pv.y + ", " + pv.z);
6682
- gl.glVertex3f((float) pv./*pos.*/x, (float) pv./*pos.*/y, (float) pv./*pos.*/z);
6683
-// Print(pv);
6684
- if (hasnorm)
6685
- {
6686
-// assert(qv.norm.normalized());
6687
- //System.out.println("normalq = " + qv.norm.x + ", " + qv.norm.y + ", " + qv.norm.z);
6688
- gl.glNormal3f((float) qv.norm.x, (float) qv.norm.y, (float) qv.norm.z);
6689
- }
6690
- //System.out.println("vertexq = " + qv.s + ", " + qv.t);
6691
- // boolean locked = false;
6692
- // float eps = 0.1f;
6693
- // boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
6694
-
6695
- // int dot = 0; //*/ (int)f.dot;
6696
-
6697
- // if ((dot&1) == 0)
6698
- // dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
6699
-
6700
- // if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
6701
- if (flipV)
6702
- gl.glTexCoord2f((float) qv.s, 1-(float) qv.t);
6703
- else
6704
- gl.glTexCoord2f((float) qv.s, (float) qv.t);
6705
- // else
6706
- // {
6707
- // locked = true;
6708
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6709
- // }
6710
- gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
6711
- SetColor(display, qv);
6712
- //gl.glColor4f(r, g, b, 1);
6713
- //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
6714
- //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
6715
- gl.glVertex3f((float) qv./*pos.*/x, (float) qv./*pos.*/y, (float) qv./*pos.*/z);
6716
-// Print(qv);
6717
- if (hasnorm)
6718
- {
6719
-// assert(rv.norm.normalized());
6720
- //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
6721
- gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
6722
- }
6723
-
6724
- // if ((dot&4) == 0)
6725
- // dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
6726
-
6727
- // if (wrap || !locked && (dot&8) != 0)
6728
- if (flipV)
6729
- gl.glTexCoord2f((float) rv.s, 1-(float) rv.t);
6730
- else
6731
- gl.glTexCoord2f((float) rv.s, (float) rv.t);
6732
- // else
6733
- // gl.glTexCoord2f((float) pv.s, (float) pv.t);
6734
-
6735
- // f.dot = dot;
6736
-
6737
- gl.glColor4f(rv.AO, rv.AO, rv.AO, 1);
6738
- SetColor(display, rv);
6739
- //gl.glColor4f(r, g, b, 1);
6740
- //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
6741
- //System.out.println("vertexr = " + rv.x + ", " + rv.y + ", " + rv.z);
6742
- gl.glVertex3f((float) rv./*pos.*/x, (float) rv./*pos.*/y, (float) rv./*pos.*/z);
6743
-// Print(rv);
6744
- //gl.glEnd();
6745
- }
6746
- else
6747
- {
6748
- gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
6749
- gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
6750
- gl.glVertex3f((float) rv.x, (float) rv.y, (float) rv.z);
6751
-
6752
- }
6753
-
6754
- if (false) // (attributes & WIREFRAME) != 0)
6755
- {
6756
- gl.glDisable(gl.GL_LIGHTING);
6757
-
6758
- gl.glBegin(gl.GL_LINE_LOOP);
6759
- gl.glVertex3d(pv./*pos.*/x, pv./*pos.*/y, pv./*pos.*/z);
6760
- gl.glVertex3d(qv./*pos.*/x, qv./*pos.*/y, qv./*pos.*/z);
6761
- gl.glVertex3d(rv./*pos.*/x, rv./*pos.*/y, rv./*pos.*/z);
6762
- gl.glEnd();
6763
-
6764
- gl.glEnable(gl.GL_LIGHTING);
6765
- }
6766
- }
6767
-
67686426 void drawSelf(ClickInfo info, int level, boolean select)
67696427 {
67706428 if (bRep == null)
....@@ -7336,83 +6994,83 @@
73366994 int spotw = spot.x + spot.width;
73376995 int spoth = spot.y + spot.height;
73386996 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7339
- if (CameraPane.Xmin > spot.x)
7340
- {
7341
- CameraPane.Xmin = spot.x;
7342
- }
7343
- if (CameraPane.Xmax < spotw)
7344
- {
7345
- CameraPane.Xmax = spotw;
7346
- }
7347
- if (CameraPane.Ymin > spot.y)
7348
- {
7349
- CameraPane.Ymin = spot.y;
7350
- }
7351
- if (CameraPane.Ymax < spoth)
7352
- {
7353
- CameraPane.Ymax = spoth;
7354
- }
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
+// }
73557013 spot.translate(32, 32);
73567014 spotw = spot.x + spot.width;
73577015 spoth = spot.y + spot.height;
73587016 info.g.setColor(Color.blue);
73597017 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7360
- if (CameraPane.Xmin > spot.x)
7361
- {
7362
- CameraPane.Xmin = spot.x;
7363
- }
7364
- if (CameraPane.Xmax < spotw)
7365
- {
7366
- CameraPane.Xmax = spotw;
7367
- }
7368
- if (CameraPane.Ymin > spot.y)
7369
- {
7370
- CameraPane.Ymin = spot.y;
7371
- }
7372
- if (CameraPane.Ymax < spoth)
7373
- {
7374
- CameraPane.Ymax = spoth;
7375
- }
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
+// }
73767034 info.g.drawLine(spotw, spoth, spotw, spoth - 15);
73777035 info.g.drawLine(spotw, spoth, spotw - 15, spoth);
73787036 spot.translate(0, -32);
73797037 info.g.setColor(Color.green);
73807038 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7381
- if (CameraPane.Xmin > spot.x)
7382
- {
7383
- CameraPane.Xmin = spot.x;
7384
- }
7385
- if (CameraPane.Xmax < spotw)
7386
- {
7387
- CameraPane.Xmax = spotw;
7388
- }
7389
- if (CameraPane.Ymin > spot.y)
7390
- {
7391
- CameraPane.Ymin = spot.y;
7392
- }
7393
- if (CameraPane.Ymax < spoth)
7394
- {
7395
- CameraPane.Ymax = spoth;
7396
- }
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
+// }
73977055 info.g.drawArc(boundary.x, boundary.y,
73987056 boundary.width, boundary.height, 0, 360);
73997057 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
7400
- if (CameraPane.Xmin > boundary.x)
7401
- {
7402
- CameraPane.Xmin = boundary.x;
7403
- }
7404
- if (CameraPane.Xmax < boundary.x + boundary.width)
7405
- {
7406
- CameraPane.Xmax = boundary.x + boundary.width;
7407
- }
7408
- if (CameraPane.Ymin > boundary.y)
7409
- {
7410
- CameraPane.Ymin = boundary.y;
7411
- }
7412
- if (CameraPane.Ymax < boundary.y + boundary.height)
7413
- {
7414
- CameraPane.Ymax = boundary.y + boundary.height;
7415
- }
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
+// }
74167074 return;
74177075 }
74187076 }
....@@ -7733,7 +7391,7 @@
77337391 if (parent == null)
77347392 {
77357393 System.out.println("NULL PARENT");
7736
- new Exception().printStackTrace();
7394
+ //new Exception().printStackTrace();
77377395 } else
77387396 {
77397397 if (parent instanceof BezierPatch)
....@@ -8126,6 +7784,8 @@
81267784 {
81277785 Object3D targ = this;
81287786
7787
+ targ.NORMALPUSH = obj.NORMALPUSH;
7788
+
81297789 if (obj.material != null)
81307790 {
81317791 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))