Normand Briere
2019-04-22 3c4c16e0a4ca3949a7a37a24607df7f89abfe7ea
BoundaryRep.java
....@@ -15,7 +15,7 @@
1515 {
1616 this(0, 0);
1717 }
18
-
18
+
1919 void SaveSupports()
2020 {
2121 transientsupport = support;
....@@ -790,7 +790,7 @@
790790 v.weights[k] = other.ComputeWeight(v, toRoot, k); // (float)(supportsize * normalweight * nz / Math.pow(tx*tx+ty*ty+tz*tz, 1));
791791 v.totalweight += v.weights[k];
792792
793
- if (CameraPane.CROWD)
793
+ if (Globals.CROWD)
794794 {
795795 // System.out.print("weight = " + v.weights[k]);
796796 // System.out.println("; totalweight = " + v.totalweight);
....@@ -2668,11 +2668,11 @@
26682668 tmp.set(v);
26692669 tmp.sub(eye);
26702670
2671
- if (CameraPane.framecount - lastsoundtime > 30) // 0.25 secs
2671
+ if (Globals.framecount - lastsoundtime > 30) // 0.25 secs
26722672 {
26732673 GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1);
26742674
2675
- lastsoundtime = CameraPane.framecount;
2675
+ lastsoundtime = Globals.framecount;
26762676 }
26772677
26782678 stepout = false;
....@@ -4893,7 +4893,7 @@
48934893 return verticesCopy;
48944894 }
48954895
4896
- void PreprocessOcclusion(CameraPane cp, double[][] transform)
4896
+ void PreprocessOcclusion(iCameraPane cp, double[][] transform)
48974897 {
48984898 if (//!trimmed ||
48994899 AOdone)
....@@ -4902,80 +4902,7 @@
49024902 return;
49034903 }
49044904
4905
- Camera keep = cp.renderCamera;
4906
- cp.renderCamera = localcamera;
4907
-
4908
- if (trimmed)
4909
- {
4910
- float[] colors = new float[positions.length / 3];
4911
-
4912
- int i3 = 0;
4913
- for (int i = 0; i < positions.length / 3; i++, i3 += 3)
4914
- {
4915
- if (normals[i3] == 0 && normals[i3+1] == 0 && normals[i3+2] == 0)
4916
- continue;
4917
-
4918
- from.set(positions[i3], positions[i3 + 1], positions[i3 + 2]);
4919
- to.set(positions[i3] + normals[i3],
4920
- positions[i3 + 1] + normals[i3 + 1],
4921
- positions[i3 + 2] + normals[i3 + 2]);
4922
- LA.xformPos(from, transform, from);
4923
- LA.xformPos(to, transform, to); // RIGID ONLY
4924
- localcamera.setAim(from, to);
4925
-
4926
- CameraPane.occlusionbuffer.display();
4927
-
4928
- if (CameraPane.DEBUG_OCCLUSION)
4929
- cp.display(); // debug
4930
-
4931
- colors[i] = cp.vertexOcclusion.r;
4932
- //colors[i3 + 1] = cp.vertexOcclusion.g;
4933
- //colors[i3 + 2] = cp.vertexOcclusion.b;
4934
-
4935
- if ((i % 1000) == 0 && i != 0)
4936
- {
4937
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
4938
- //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
4939
- System.out.println((int) (100.0 * i / (positions.length / 3)) + "% (" + i + " of " + (positions.length / 3) + ")");
4940
- }
4941
- }
4942
-
4943
- this.colors = colors;
4944
- }
4945
- else
4946
- {
4947
- for (int i = 0; i < VertexCount(); i++)
4948
- {
4949
- Vertex v = GetVertex(i);
4950
-
4951
- if (v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0)
4952
- continue;
4953
-
4954
- from.set(v.x, v.y, v.z);
4955
- to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z);
4956
- LA.xformPos(from, transform, from);
4957
- LA.xformPos(to, transform, to); // RIGID ONLY
4958
- localcamera.setAim(from, to);
4959
-
4960
- CameraPane.occlusionbuffer.display();
4961
-
4962
- if (CameraPane.DEBUG_OCCLUSION)
4963
- cp.display(); // debug
4964
-
4965
- v.AO = cp.vertexOcclusion.r;
4966
-
4967
- if ((i % 1000) == 0 && i != 0)
4968
- {
4969
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
4970
- //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
4971
- System.out.println((int) (100.0 * i / VertexCount()) + "% (" + i + " of " + VertexCount() + ")");
4972
- }
4973
- }
4974
- }
4975
-
4976
- //System.out.println("done.");
4977
-
4978
- cp.renderCamera = keep;
4905
+ cp.PrepOcclusion(this, transform);
49794906
49804907 AOdone = true;
49814908 }
....@@ -7230,7 +7157,8 @@
72307157 {
72317158 if (f3.p == f0.p)
72327159 {
7233
- assert(false);
7160
+// assert(false);
7161
+ new Exception().printStackTrace();
72347162 f0.r = f3.q;
72357163 }
72367164 else
....@@ -8353,9 +8281,6 @@
83538281 return "trim = " + trimmed + "; stripped = " + stripified + "; colors = " + colors + "; faces = " + (faces!=null?faces.size():null) + "; triangles = " + (triangles!=null?triangles.length:null) + "; indices = " + indices;
83548282 }
83558283
8356
- static Camera localcamera = new Camera();
8357
- static cVector from = new cVector();
8358
- static cVector to = new cVector();
83598284 boolean trimmed = false;
83608285 boolean stripified = false;
83618286 transient boolean AOdone = false;
....@@ -8363,8 +8288,10 @@
83638288 /*transient*/ int maxIndexV = 0;
83648289 /*transient*/ int bufV, bufF;
83658290 // Raw version
8366
- private float[] positions;
8367
- private float[] normals;
8291
+ //private
8292
+ float[] positions;
8293
+ //private
8294
+ float[] normals;
83688295 float[] colors;
83698296 private float[] uvmap;
83708297 private int[] triangles;