.. | .. |
---|
173 | 173 | static boolean doublesided = false; // true; // reversed normals are awful for conformance |
---|
174 | 174 | boolean anisotropy = true; |
---|
175 | 175 | boolean softshadow = true; // slower but better false; |
---|
176 | | - boolean opacityhalo = false; |
---|
| 176 | + boolean opacityhalo = false; // reverse the halo effect (e.g. glass) |
---|
177 | 177 | |
---|
178 | 178 | boolean macromode = false; |
---|
179 | 179 | |
---|
.. | .. |
---|
8358 | 8358 | // else |
---|
8359 | 8359 | // if (!texname.startsWith("/")) |
---|
8360 | 8360 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8361 | | - if (!FileExists(texname)) |
---|
| 8361 | + if (!FileExists(texname) && !texname.startsWith("@")) |
---|
8362 | 8362 | { |
---|
8363 | 8363 | texname = fallbackTextureName; |
---|
8364 | 8364 | } |
---|
.. | .. |
---|
8441 | 8441 | new Exception().printStackTrace(); |
---|
8442 | 8442 | } else |
---|
8443 | 8443 | { |
---|
| 8444 | + if (texname.startsWith("@")) |
---|
| 8445 | + { |
---|
| 8446 | + // texturecache = textures.get(texname); // suspicious |
---|
| 8447 | + if (texturecache == null) |
---|
| 8448 | + texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution); |
---|
| 8449 | + else |
---|
| 8450 | + new Exception().printStackTrace(); |
---|
| 8451 | + } else |
---|
| 8452 | + { |
---|
8444 | 8453 | if (textureon) |
---|
8445 | 8454 | { |
---|
8446 | 8455 | String cachename = texname; |
---|
.. | .. |
---|
8500 | 8509 | texturecache = new CacheTexture(texturedata,resolution); |
---|
8501 | 8510 | //texture = GetTexture(tex, bump); |
---|
8502 | 8511 | } |
---|
| 8512 | + } |
---|
8503 | 8513 | } |
---|
8504 | 8514 | //} |
---|
8505 | 8515 | } |
---|
.. | .. |
---|
8768 | 8778 | |
---|
8769 | 8779 | gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0); |
---|
8770 | 8780 | MAXSTACK = temp[0]; |
---|
8771 | | - System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
| 8781 | + if (Globals.DEBUG) |
---|
| 8782 | + System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
8772 | 8783 | gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0); |
---|
8773 | 8784 | MAXSTACK = temp[0]; |
---|
8774 | | - System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
| 8785 | + if (Globals.DEBUG) |
---|
| 8786 | + System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
8775 | 8787 | |
---|
8776 | 8788 | // Use debug pipeline |
---|
8777 | 8789 | //drawable.setGL(new DebugGL(gl)); // |
---|
.. | .. |
---|
8779 | 8791 | gl = drawable.getGL(); // |
---|
8780 | 8792 | |
---|
8781 | 8793 | GL gl3 = getGL(); |
---|
8782 | | - System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
| 8794 | + if (Globals.DEBUG) |
---|
| 8795 | + System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
8783 | 8796 | |
---|
8784 | 8797 | |
---|
8785 | 8798 | //float pos[] = { 100, 100, 100, 0 }; |
---|
.. | .. |
---|
16657 | 16670 | private void DrawSkyBox(GL gl, float ratio) |
---|
16658 | 16671 | { |
---|
16659 | 16672 | if (//envyoff || |
---|
| 16673 | + WIREFRAME || |
---|
16660 | 16674 | cubemap == null) |
---|
16661 | 16675 | { |
---|
16662 | 16676 | gl.glClearColor(BGcolor, BGcolor, BGcolor, 1); |
---|
.. | .. |
---|
17519 | 17533 | gl.glFlush(); |
---|
17520 | 17534 | |
---|
17521 | 17535 | /**/ |
---|
17522 | | - gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer); |
---|
| 17536 | + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer); |
---|
17523 | 17537 | |
---|
17524 | | - float[] pixels = occlusionsizebuffer.array(); |
---|
| 17538 | + float[] depths = occlusiondepthbuffer.array(); |
---|
17525 | 17539 | |
---|
| 17540 | + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer); |
---|
| 17541 | + |
---|
| 17542 | + int[] pixels = selectsizebuffer.array(); |
---|
| 17543 | + |
---|
17526 | 17544 | double r = 0, g = 0, b = 0; |
---|
17527 | 17545 | |
---|
17528 | 17546 | double count = 0; |
---|
.. | .. |
---|
17533 | 17551 | |
---|
17534 | 17552 | double FACTOR = 1; |
---|
17535 | 17553 | |
---|
17536 | | - for (int i = 0; i < pixels.length; i++) |
---|
| 17554 | + for (int i = 0; i < depths.length; i++) |
---|
17537 | 17555 | { |
---|
17538 | 17556 | int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2; |
---|
17539 | 17557 | int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2; |
---|
.. | .. |
---|
17616 | 17634 | |
---|
17617 | 17635 | double scale = ray.z; // 1; // cos |
---|
17618 | 17636 | |
---|
17619 | | - float depth = pixels[newindex]; |
---|
| 17637 | + float depth = depths[newindex]; |
---|
17620 | 17638 | |
---|
17621 | 17639 | /* |
---|
17622 | 17640 | int newindex2 = (x + 1) * OCCLUSION_SIZE + y; |
---|
.. | .. |
---|
17813 | 17831 | static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE); |
---|
17814 | 17832 | static IntBuffer bigAAbuffer; |
---|
17815 | 17833 | static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3); |
---|
17816 | | - static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); |
---|
| 17834 | + //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); |
---|
17817 | 17835 | static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
17818 | 17836 | static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
17819 | 17837 | //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
17820 | | - static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17838 | + static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17839 | + |
---|
| 17840 | + static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17841 | + |
---|
17821 | 17842 | static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB); |
---|
17822 | 17843 | static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); |
---|
17823 | 17844 | static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>(); |
---|