From 687eb0ff1930c4a2930713b95de12ba01aba4310 Mon Sep 17 00:00:00 2001 From: "dan..om" Date: Wed, 5 Feb 2014 15:19:15 +0000 Subject: [PATCH] - Removed SafeArray usage as it wasn't used. - Added a forgotten break for cubemap texture parameters. - Imports and some code cleanup. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11015 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/renderer/lwjgl/LwjglRenderer.java | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java b/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java index fe775f9be..1d63bb14d 100644 --- a/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java +++ b/engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java @@ -55,9 +55,7 @@ import com.jme3.texture.Texture; import com.jme3.texture.Texture.WrapAxis; import com.jme3.util.BufferUtils; import com.jme3.util.ListMap; -import com.jme3.util.NativeObject; import com.jme3.util.NativeObjectManager; -import com.jme3.util.SafeArrayList; import java.nio.*; import java.util.EnumSet; import java.util.List; @@ -482,7 +480,7 @@ public class LwjglRenderer implements Renderer { } if (state.isDepthTest() && !context.depthTestEnabled) { - glEnable(GL_DEPTH_TEST); + glEnable(GL_DEPTH_TEST); glDepthFunc(convertTestFunction(context.depthFunc)); context.depthTestEnabled = true; } else if (!state.isDepthTest() && context.depthTestEnabled) { @@ -503,9 +501,9 @@ public class LwjglRenderer implements Renderer { context.alphaTestEnabled = false; } if (state.getAlphaFallOff() != context.alphaTestFallOff) { - glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff); + glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff); context.alphaTestFallOff = state.getAlphaFallOff(); - } + } if (state.getAlphaFunc() != context.alphaFunc) { glAlphaFunc(convertTestFunction(state.getAlphaFunc()), context.alphaTestFallOff); context.alphaFunc = state.getAlphaFunc(); @@ -1168,13 +1166,13 @@ public class LwjglRenderer implements Renderer { if (GLContext.getCapabilities().GL_EXT_framebuffer_blit) { int srcX0 = 0; int srcY0 = 0; - int srcX1 = 0; - int srcY1 = 0; + int srcX1; + int srcY1; int dstX0 = 0; int dstY0 = 0; - int dstX1 = 0; - int dstY1 = 0; + int dstX1; + int dstY1; int prevFBO = context.boundFBO; @@ -1768,12 +1766,13 @@ public class LwjglRenderer implements Renderer { if (context.pointSprite) { return; // Attempt to fix glTexParameter crash for some ATI GPUs } - + // repeat modes switch (tex.getType()) { case ThreeDimensional: case CubeMap: // cubemaps use 3D coords glTexParameteri(target, GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R))); + break; case TwoDimensional: case TwoDimensionalArray: glTexParameteri(target, GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T))); @@ -1789,7 +1788,7 @@ public class LwjglRenderer implements Renderer { // R to Texture compare mode if (tex.getShadowCompareMode() != Texture.ShadowCompareMode.Off) { glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); - glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY); + glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY); if (tex.getShadowCompareMode() == Texture.ShadowCompareMode.GreaterOrEqual) { glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_GEQUAL); } else { @@ -1797,7 +1796,7 @@ public class LwjglRenderer implements Renderer { } }else{ //restoring default value - glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE); + glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE); } tex.compareModeUpdated(); } @@ -1805,7 +1804,7 @@ public class LwjglRenderer implements Renderer { /** * Uploads the given image to the GL driver. - * + * * @param img The image to upload * @param type How the data in the image argument should be interpreted. * @param unit The texture slot to be used to upload the image, not important @@ -1822,7 +1821,7 @@ public class LwjglRenderer implements Renderer { statistics.onNewTexture(); } - // bind texture + // bind texture int target = convertTextureType(type, img.getMultiSamples(), -1); if (context.boundTextureUnit != unit) { glActiveTexture(GL_TEXTURE0 + unit); @@ -1879,7 +1878,7 @@ public class LwjglRenderer implements Renderer { throw new RendererException("Multisample textures not supported by graphics hardware"); } } - + if (target == GL_TEXTURE_CUBE_MAP) { // Check max texture size before upload if (img.getWidth() > maxCubeTexSize || img.getHeight() > maxCubeTexSize) { @@ -1905,12 +1904,12 @@ public class LwjglRenderer implements Renderer { if (!caps.contains(Caps.TextureArray)) { throw new RendererException("Texture arrays not supported by graphics hardware"); } - + List data = img.getData(); - + // -1 index specifies prepare data for 2D Array TextureUtil.uploadTexture(img, target, -1, 0); - + for (int i = 0; i < data.size(); i++) { // upload each slice of 2D array in turn // this time with the appropriate index @@ -2406,7 +2405,7 @@ public class LwjglRenderer implements Renderer { } private void renderMeshDefault(Mesh mesh, int lod, int count) { - VertexBuffer indices = null; + VertexBuffer indices; VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData); if (interleavedData != null && interleavedData.isUpdateNeeded()) { @@ -2414,7 +2413,7 @@ public class LwjglRenderer implements Renderer { } // IntMap buffers = mesh.getBuffers(); - SafeArrayList buffersList = mesh.getBufferList(); +// SafeArrayList buffersList = mesh.getBufferList(); if (mesh.getNumLodLevels() > 0) { indices = mesh.getLodLevel(lod);