Normand Briere
2018-12-15 6ed65dcb597fb2153cef75bf1845978f1115658c
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 {
....@@ -779,7 +794,10 @@
779794 // factor = CameraPane.STEP;
780795 // }
781796
782
- if (marked && CameraPane.isLIVE() && live && CameraPane.drawMode == CameraPane.SHADOW && currentframe != CameraPane.framecount)
797
+ if (marked && CameraPane.isLIVE() && live &&
798
+ //TEMP21aug2018
799
+ CameraPane.drawMode == CameraPane.SHADOW &&
800
+ currentframe != CameraPane.framecount)
783801 {
784802 currentframe = CameraPane.framecount;
785803
....@@ -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 }
....@@ -5519,7 +5583,9 @@
55195583 display.options2[2] = material.factor;
55205584
55215585 cColor.HSBtoRGB(material.color, material.modulation, 1, display.options3);
5522
- display.options3[3] = material.cameralight/0.2f;
5586
+ display.options4[0] = material.cameralight/0.2f;
5587
+ display.options4[1] = material.subsurface;
5588
+ display.options4[2] = material.sheen;
55235589
55245590 // if (display.CURRENTANTIALIAS > 0)
55255591 // display.options3[3] /= 4;
....@@ -5919,7 +5985,7 @@
59195985
59205986 javax.media.opengl.GL gl = display.GetGL();
59215987
5922
- if (CameraPane.BOXMODE) // || CameraPane.movingcamera)
5988
+ if (CameraPane.BOXMODE && !selected) // || CameraPane.movingcamera)
59235989 {
59245990 int fc = bRep.FaceCount();
59255991 int vc = bRep.VertexCount();
....@@ -6660,13 +6726,26 @@
66606726 gl.glNormal3f((float) v2.x, (float) v2.y, (float) v2.z);
66616727 }
66626728
6729
+ // P
6730
+ float x = (float)pv.x;
6731
+ float y = (float)pv.y;
6732
+ float z = (float)pv.z;
6733
+
66636734 if (hasnorm)
66646735 {
66656736 // if (!pv.norm.normalized())
66666737 // assert(pv.norm.normalized());
66676738
66686739 //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);
6740
+ float nx = (float)pv.norm.x;
6741
+ float ny = (float)pv.norm.y;
6742
+ float nz = (float)pv.norm.z;
6743
+
6744
+ x += nx * NORMALPUSH;
6745
+ y += ny * NORMALPUSH;
6746
+ z += nz * NORMALPUSH;
6747
+
6748
+ gl.glNormal3f(nx, ny, nz);
66706749 }
66716750 gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
66726751 SetColor(display, pv);
....@@ -6677,13 +6756,28 @@
66776756 else
66786757 gl.glTexCoord2f((float) pv.s, (float) pv.t);
66796758 //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);
6759
+
6760
+ gl.glVertex3f(x, y, z);
6761
+
6762
+ // Q
6763
+ x = (float)qv.x;
6764
+ y = (float)qv.y;
6765
+ z = (float)qv.z;
6766
+
66816767 // Print(pv);
66826768 if (hasnorm)
66836769 {
66846770 // assert(qv.norm.normalized());
66856771 //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);
6772
+ float nx = (float)qv.norm.x;
6773
+ float ny = (float)qv.norm.y;
6774
+ float nz = (float)qv.norm.z;
6775
+
6776
+ x += nx * NORMALPUSH;
6777
+ y += ny * NORMALPUSH;
6778
+ z += nz * NORMALPUSH;
6779
+
6780
+ gl.glNormal3f(nx, ny, nz);
66876781 }
66886782 //System.out.println("vertexq = " + qv.s + ", " + qv.t);
66896783 // boolean locked = false;
....@@ -6707,16 +6801,31 @@
67076801 // }
67086802 gl.glColor4f(qv.AO, qv.AO, qv.AO, 1);
67096803 SetColor(display, qv);
6804
+
6805
+ gl.glVertex3f(x, y, z);
67106806 //gl.glColor4f(r, g, b, 1);
67116807 //gl.glColor4f(qv.boundary, qv.boundary, qv.boundary, 1);
67126808 //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);
67146809 // Print(qv);
6810
+
6811
+ // R
6812
+ x = (float)rv.x;
6813
+ y = (float)rv.y;
6814
+ z = (float)rv.z;
6815
+
67156816 if (hasnorm)
67166817 {
67176818 // assert(rv.norm.normalized());
67186819 //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);
6820
+ float nx = (float)rv.norm.x;
6821
+ float ny = (float)rv.norm.y;
6822
+ float nz = (float)rv.norm.z;
6823
+
6824
+ x += nx * NORMALPUSH;
6825
+ y += ny * NORMALPUSH;
6826
+ z += nz * NORMALPUSH;
6827
+
6828
+ gl.glNormal3f(nx, ny, nz);
67206829 }
67216830
67226831 // if ((dot&4) == 0)
....@@ -6737,7 +6846,7 @@
67376846 //gl.glColor4f(r, g, b, 1);
67386847 //gl.glColor4f(rv.boundary, rv.boundary, rv.boundary, 1);
67396848 //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);
6849
+ gl.glVertex3f(x, y, z);
67416850 // Print(rv);
67426851 //gl.glEnd();
67436852 }
....@@ -7731,7 +7840,7 @@
77317840 if (parent == null)
77327841 {
77337842 System.out.println("NULL PARENT");
7734
- new Exception().printStackTrace();
7843
+ //new Exception().printStackTrace();
77357844 } else
77367845 {
77377846 if (parent instanceof BezierPatch)
....@@ -8124,6 +8233,8 @@
81248233 {
81258234 Object3D targ = this;
81268235
8236
+ targ.NORMALPUSH = obj.NORMALPUSH;
8237
+
81278238 if (obj.material != null)
81288239 {
81298240 if ((mask&MATERIAL)!=0) // ==(COLOR|MATERIAL))