.. | .. |
---|
15 | 15 | { |
---|
16 | 16 | this(0, 0); |
---|
17 | 17 | } |
---|
18 | | - |
---|
| 18 | + |
---|
19 | 19 | void SaveSupports() |
---|
20 | 20 | { |
---|
21 | 21 | transientsupport = support; |
---|
.. | .. |
---|
2661 | 2661 | if (false) // slow && stepout && onein) |
---|
2662 | 2662 | { |
---|
2663 | 2663 | // sound |
---|
2664 | | - cVector eye = CameraPane.theRenderer.eyeCamera.location; |
---|
| 2664 | + cVector eye = Globals.theRenderer.EyeCamera().location; |
---|
2665 | 2665 | |
---|
2666 | 2666 | Vertex v = GetVertex(0); |
---|
2667 | 2667 | |
---|
.. | .. |
---|
4460 | 4460 | // june 2014 |
---|
4461 | 4461 | // Camera parentcam = cam; |
---|
4462 | 4462 | // |
---|
4463 | | -// if (cam == CameraPane.theRenderer.cameras[0]) |
---|
| 4463 | +// if (cam == Globals.theRenderer.cameras[0]) |
---|
4464 | 4464 | // { |
---|
4465 | | -// parentcam = CameraPane.theRenderer.cameras[1]; |
---|
| 4465 | +// parentcam = Globals.theRenderer.cameras[1]; |
---|
4466 | 4466 | // } |
---|
4467 | 4467 | // |
---|
4468 | | -// if (cam == CameraPane.theRenderer.cameras[1]) |
---|
| 4468 | +// if (cam == Globals.theRenderer.cameras[1]) |
---|
4469 | 4469 | // { |
---|
4470 | | -// parentcam = CameraPane.theRenderer.cameras[0]; |
---|
| 4470 | +// parentcam = Globals.theRenderer.cameras[0]; |
---|
4471 | 4471 | // } |
---|
4472 | 4472 | |
---|
4473 | 4473 | gl.glGetDoublev(gl.GL_MODELVIEW_MATRIX, CameraPane.tempmat, 0); |
---|
.. | .. |
---|
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 % 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); |
---|
4979 | 4906 | |
---|
4980 | 4907 | AOdone = true; |
---|
4981 | 4908 | } |
---|
.. | .. |
---|
7633 | 7560 | s3 = new cVector(); |
---|
7634 | 7561 | } |
---|
7635 | 7562 | |
---|
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)); |
---|
7637 | 7564 | |
---|
7638 | 7565 | try |
---|
7639 | 7566 | { |
---|
.. | .. |
---|
7728 | 7655 | { |
---|
7729 | 7656 | if (i++%100 == 0) |
---|
7730 | 7657 | { |
---|
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)); |
---|
7732 | 7659 | System.out.println("#faces = " + faces.size()); |
---|
7733 | 7660 | // if (i != 1) |
---|
7734 | 7661 | // break; |
---|
.. | .. |
---|
7772 | 7699 | //Trim(true,cJME.gennormals,true,false); // doesn't work |
---|
7773 | 7700 | Trim(true,false,false,false,false); |
---|
7774 | 7701 | |
---|
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)); |
---|
7776 | 7703 | } |
---|
7777 | 7704 | |
---|
7778 | 7705 | void UpdateIndices(Face face, Face minface) |
---|
.. | .. |
---|
8354 | 8281 | return "trim = " + trimmed + "; stripped = " + stripified + "; colors = " + colors + "; faces = " + (faces!=null?faces.size():null) + "; triangles = " + (triangles!=null?triangles.length:null) + "; indices = " + indices; |
---|
8355 | 8282 | } |
---|
8356 | 8283 | |
---|
8357 | | - static Camera localcamera = new Camera(); |
---|
8358 | | - static cVector from = new cVector(); |
---|
8359 | | - static cVector to = new cVector(); |
---|
8360 | 8284 | boolean trimmed = false; |
---|
8361 | 8285 | boolean stripified = false; |
---|
8362 | 8286 | transient boolean AOdone = false; |
---|
.. | .. |
---|
8364 | 8288 | /*transient*/ int maxIndexV = 0; |
---|
8365 | 8289 | /*transient*/ int bufV, bufF; |
---|
8366 | 8290 | // Raw version |
---|
8367 | | - private float[] positions; |
---|
8368 | | - private float[] normals; |
---|
| 8291 | + //private |
---|
| 8292 | + float[] positions; |
---|
| 8293 | + //private |
---|
| 8294 | + float[] normals; |
---|
8369 | 8295 | float[] colors; |
---|
8370 | 8296 | private float[] uvmap; |
---|
8371 | 8297 | private int[] triangles; |
---|