Normand Briere
2019-04-23 ec9d13e42c9c8674739acefb0769a9273a1048c9
BoundaryRep.java
....@@ -15,7 +15,7 @@
1515 {
1616 this(0, 0);
1717 }
18
-
18
+
1919 void SaveSupports()
2020 {
2121 transientsupport = support;
....@@ -2661,7 +2661,7 @@
26612661 if (false) // slow && stepout && onein)
26622662 {
26632663 // sound
2664
- cVector eye = CameraPane.theRenderer.eyeCamera.location;
2664
+ cVector eye = Globals.theRenderer.EyeCamera().location;
26652665
26662666 Vertex v = GetVertex(0);
26672667
....@@ -4428,7 +4428,7 @@
44284428 }
44294429 }
44304430
4431
- void CullVertex(javax.media.opengl.GL gl, boolean shadow)
4431
+ void CullVertex(javax.media.opengl.GL glNOTUSED, boolean shadowNOTUSED)
44324432 {
44334433 CameraPane.glu.gluProject(vect5.x,vect5.y,vect5.z,
44344434 CameraPane.tempmat,0, CameraPane.tempmat2,0,
....@@ -4460,14 +4460,14 @@
44604460 // june 2014
44614461 // Camera parentcam = cam;
44624462 //
4463
-// if (cam == CameraPane.theRenderer.cameras[0])
4463
+// if (cam == Globals.theRenderer.cameras[0])
44644464 // {
4465
-// parentcam = CameraPane.theRenderer.cameras[1];
4465
+// parentcam = Globals.theRenderer.cameras[1];
44664466 // }
44674467 //
4468
-// if (cam == CameraPane.theRenderer.cameras[1])
4468
+// if (cam == Globals.theRenderer.cameras[1])
44694469 // {
4470
-// parentcam = CameraPane.theRenderer.cameras[0];
4470
+// parentcam = Globals.theRenderer.cameras[0];
44714471 // }
44724472
44734473 gl.glGetDoublev(gl.GL_MODELVIEW_MATRIX, CameraPane.tempmat, 0);
....@@ -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 % 100) == 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 == null || 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 % 100) == 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 }
....@@ -7633,7 +7560,7 @@
76337560 s3 = new cVector();
76347561 }
76357562
7636
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
7563
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
76377564
76387565 try
76397566 {
....@@ -7728,7 +7655,7 @@
77287655 {
77297656 if (i++%100 == 0)
77307657 {
7731
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
7658
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
77327659 System.out.println("#faces = " + faces.size());
77337660 // if (i != 1)
77347661 // break;
....@@ -7772,7 +7699,7 @@
77727699 //Trim(true,cJME.gennormals,true,false); // doesn't work
77737700 Trim(true,false,false,false,false);
77747701
7775
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
7702
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
77767703 }
77777704
77787705 void UpdateIndices(Face face, Face minface)
....@@ -8354,9 +8281,6 @@
83548281 return "trim = " + trimmed + "; stripped = " + stripified + "; colors = " + colors + "; faces = " + (faces!=null?faces.size():null) + "; triangles = " + (triangles!=null?triangles.length:null) + "; indices = " + indices;
83558282 }
83568283
8357
- static Camera localcamera = new Camera();
8358
- static cVector from = new cVector();
8359
- static cVector to = new cVector();
83608284 boolean trimmed = false;
83618285 boolean stripified = false;
83628286 transient boolean AOdone = false;
....@@ -8364,8 +8288,10 @@
83648288 /*transient*/ int maxIndexV = 0;
83658289 /*transient*/ int bufV, bufF;
83668290 // Raw version
8367
- private float[] positions;
8368
- private float[] normals;
8291
+ //private
8292
+ float[] positions;
8293
+ //private
8294
+ float[] normals;
83698295 float[] colors;
83708296 private float[] uvmap;
83718297 private int[] triangles;