.. | .. |
---|
15 | 15 | { |
---|
16 | 16 | this(0, 0); |
---|
17 | 17 | } |
---|
18 | | - |
---|
| 18 | + |
---|
19 | 19 | void SaveSupports() |
---|
20 | 20 | { |
---|
21 | 21 | transientsupport = support; |
---|
.. | .. |
---|
790 | 790 | v.weights[k] = other.ComputeWeight(v, toRoot, k); // (float)(supportsize * normalweight * nz / Math.pow(tx*tx+ty*ty+tz*tz, 1)); |
---|
791 | 791 | v.totalweight += v.weights[k]; |
---|
792 | 792 | |
---|
793 | | - if (CameraPane.CROWD) |
---|
| 793 | + if (Globals.CROWD) |
---|
794 | 794 | { |
---|
795 | 795 | // System.out.print("weight = " + v.weights[k]); |
---|
796 | 796 | // System.out.println("; totalweight = " + v.totalweight); |
---|
.. | .. |
---|
2668 | 2668 | tmp.set(v); |
---|
2669 | 2669 | tmp.sub(eye); |
---|
2670 | 2670 | |
---|
2671 | | - if (CameraPane.framecount - lastsoundtime > 30) // 0.25 secs |
---|
| 2671 | + if (Globals.framecount - lastsoundtime > 30) // 0.25 secs |
---|
2672 | 2672 | { |
---|
2673 | 2673 | GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1); |
---|
2674 | 2674 | |
---|
2675 | | - lastsoundtime = CameraPane.framecount; |
---|
| 2675 | + lastsoundtime = Globals.framecount; |
---|
2676 | 2676 | } |
---|
2677 | 2677 | |
---|
2678 | 2678 | stepout = false; |
---|
.. | .. |
---|
4893 | 4893 | return verticesCopy; |
---|
4894 | 4894 | } |
---|
4895 | 4895 | |
---|
4896 | | - void PreprocessOcclusion(CameraPane cp, double[][] transform) |
---|
| 4896 | + void PreprocessOcclusion(iCameraPane cp, double[][] transform) |
---|
4897 | 4897 | { |
---|
4898 | 4898 | if (//!trimmed || |
---|
4899 | 4899 | AOdone) |
---|
.. | .. |
---|
4902 | 4902 | return; |
---|
4903 | 4903 | } |
---|
4904 | 4904 | |
---|
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); |
---|
4979 | 4906 | |
---|
4980 | 4907 | AOdone = true; |
---|
4981 | 4908 | } |
---|
.. | .. |
---|
7230 | 7157 | { |
---|
7231 | 7158 | if (f3.p == f0.p) |
---|
7232 | 7159 | { |
---|
7233 | | - assert(false); |
---|
| 7160 | +// assert(false); |
---|
| 7161 | + new Exception().printStackTrace(); |
---|
7234 | 7162 | f0.r = f3.q; |
---|
7235 | 7163 | } |
---|
7236 | 7164 | else |
---|
.. | .. |
---|
8353 | 8281 | return "trim = " + trimmed + "; stripped = " + stripified + "; colors = " + colors + "; faces = " + (faces!=null?faces.size():null) + "; triangles = " + (triangles!=null?triangles.length:null) + "; indices = " + indices; |
---|
8354 | 8282 | } |
---|
8355 | 8283 | |
---|
8356 | | - static Camera localcamera = new Camera(); |
---|
8357 | | - static cVector from = new cVector(); |
---|
8358 | | - static cVector to = new cVector(); |
---|
8359 | 8284 | boolean trimmed = false; |
---|
8360 | 8285 | boolean stripified = false; |
---|
8361 | 8286 | transient boolean AOdone = false; |
---|
.. | .. |
---|
8363 | 8288 | /*transient*/ int maxIndexV = 0; |
---|
8364 | 8289 | /*transient*/ int bufV, bufF; |
---|
8365 | 8290 | // Raw version |
---|
8366 | | - private float[] positions; |
---|
8367 | | - private float[] normals; |
---|
| 8291 | + //private |
---|
| 8292 | + float[] positions; |
---|
| 8293 | + //private |
---|
| 8294 | + float[] normals; |
---|
8368 | 8295 | float[] colors; |
---|
8369 | 8296 | private float[] uvmap; |
---|
8370 | 8297 | private int[] triangles; |
---|