From 876015ab47da18d39d10990fd0d82a59be2be864 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sun, 10 Apr 2016 12:09:36 -0400 Subject: [PATCH] deprecate alpha test / point sprite --- .../java/com/jme3/effect/ParticleMesh.java | 5 +- .../main/java/com/jme3/material/Material.java | 3 - .../java/com/jme3/material/RenderState.java | 247 +++--------------- .../java/com/jme3/renderer/RenderContext.java | 16 -- .../com/jme3/renderer/opengl/GLRenderer.java | 1 - .../src/main/java/com/jme3/scene/Mesh.java | 20 +- .../com/jme3/scene/plugins/MTLLoader.java | 3 +- .../java/jme3tools/optimize/TextureAtlas.java | 1 - .../jme3/scene/plugins/fbx/SceneLoader.java | 4 +- 9 files changed, 57 insertions(+), 243 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/effect/ParticleMesh.java b/jme3-core/src/main/java/com/jme3/effect/ParticleMesh.java index ed1b80d2a..7d0d2d92d 100644 --- a/jme3-core/src/main/java/com/jme3/effect/ParticleMesh.java +++ b/jme3-core/src/main/java/com/jme3/effect/ParticleMesh.java @@ -50,8 +50,9 @@ public abstract class ParticleMesh extends Mesh { public enum Type { /** * The particle mesh is composed of points. Each particle is a point. - * This can be used in conjuction with {@link RenderState#setPointSprite(boolean) point sprites} - * to render particles the usual way. + * Note that point based particles do not support certain features such + * as {@link ParticleEmitter#setRotateSpeed(float) rotation}, and + * {@link ParticleEmitter#setFacingVelocity(boolean) velocity following}. */ Point, diff --git a/jme3-core/src/main/java/com/jme3/material/Material.java b/jme3-core/src/main/java/com/jme3/material/Material.java index 3de42e7fb..75564d444 100644 --- a/jme3-core/src/main/java/com/jme3/material/Material.java +++ b/jme3-core/src/main/java/com/jme3/material/Material.java @@ -1097,14 +1097,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { // Try to guess values of "apply" render state based on defaults // if value != default then set apply to true additionalState.applyPolyOffset = additionalState.offsetEnabled; - additionalState.applyAlphaFallOff = additionalState.alphaTest; - additionalState.applyAlphaTest = additionalState.alphaTest; additionalState.applyBlendMode = additionalState.blendMode != BlendMode.Off; additionalState.applyColorWrite = !additionalState.colorWrite; additionalState.applyCullMode = additionalState.cullMode != FaceCullMode.Back; additionalState.applyDepthTest = !additionalState.depthTest; additionalState.applyDepthWrite = !additionalState.depthWrite; - additionalState.applyPointSprite = additionalState.pointSprite; additionalState.applyStencilTest = additionalState.stencilTest; additionalState.applyWireFrame = additionalState.wireframe; } diff --git a/jme3-core/src/main/java/com/jme3/material/RenderState.java b/jme3-core/src/main/java/com/jme3/material/RenderState.java index 7ff4a992a..e5f3d4825 100644 --- a/jme3-core/src/main/java/com/jme3/material/RenderState.java +++ b/jme3-core/src/main/java/com/jme3/material/RenderState.java @@ -75,12 +75,11 @@ public class RenderState implements Cloneable, Savable { /** * TestFunction specifies the testing function for stencil test - * function and alpha test function. + * function. * - *

The functions work similarly as described except that for stencil - * test function, the reference value given in the stencil command is - * the input value while the reference is the value already in the stencil - * buffer. + *

+ * The reference value given in the stencil command is the input value while + * the reference is the value already in the stencil buffer. */ public enum TestFunction { @@ -118,7 +117,8 @@ public class RenderState implements Cloneable, Savable { /** * The test always passes */ - Always,} + Always + } /** * BlendMode specifies the blending operation to use. @@ -276,19 +276,14 @@ public class RenderState implements Cloneable, Savable { } static { - ADDITIONAL.applyPointSprite = false; ADDITIONAL.applyWireFrame = false; ADDITIONAL.applyCullMode = false; ADDITIONAL.applyDepthWrite = false; ADDITIONAL.applyDepthTest = false; ADDITIONAL.applyColorWrite = false; ADDITIONAL.applyBlendMode = false; - ADDITIONAL.applyAlphaTest = false; - ADDITIONAL.applyAlphaFallOff = false; ADDITIONAL.applyPolyOffset = false; } - boolean pointSprite = false; - boolean applyPointSprite = true; boolean wireframe = false; boolean applyWireFrame = true; FaceCullMode cullMode = FaceCullMode.Back; @@ -301,10 +296,6 @@ public class RenderState implements Cloneable, Savable { boolean applyColorWrite = true; BlendMode blendMode = BlendMode.Off; boolean applyBlendMode = true; - boolean alphaTest = false; - boolean applyAlphaTest = true; - float alphaFallOff = 0; - boolean applyAlphaFallOff = true; float offsetFactor = 0; float offsetUnits = 0; boolean offsetEnabled = false; @@ -315,10 +306,7 @@ public class RenderState implements Cloneable, Savable { boolean applyLineWidth = false; TestFunction depthFunc = TestFunction.LessOrEqual; //by default depth func will be applied anyway if depth test is applied - boolean applyDepthFunc = false; - //by default alpha func will be applied anyway if alpha test is applied - TestFunction alphaFunc = TestFunction.Greater; - boolean applyAlphaFunc = false; + boolean applyDepthFunc = false; StencilOperation frontStencilStencilFailOperation = StencilOperation.Keep; StencilOperation frontStencilDepthFailOperation = StencilOperation.Keep; StencilOperation frontStencilDepthPassOperation = StencilOperation.Keep; @@ -331,15 +319,13 @@ public class RenderState implements Cloneable, Savable { public void write(JmeExporter ex) throws IOException { OutputCapsule oc = ex.getCapsule(this); - oc.write(pointSprite, "pointSprite", false); + oc.write(true, "pointSprite", false); oc.write(wireframe, "wireframe", false); oc.write(cullMode, "cullMode", FaceCullMode.Back); oc.write(depthWrite, "depthWrite", true); oc.write(depthTest, "depthTest", true); oc.write(colorWrite, "colorWrite", true); oc.write(blendMode, "blendMode", BlendMode.Off); - oc.write(alphaTest, "alphaTest", false); - oc.write(alphaFallOff, "alphaFallOff", 0); oc.write(offsetEnabled, "offsetEnabled", false); oc.write(offsetFactor, "offsetFactor", 0); oc.write(offsetUnits, "offsetUnits", 0); @@ -353,37 +339,29 @@ public class RenderState implements Cloneable, Savable { oc.write(frontStencilFunction, "frontStencilFunction", TestFunction.Always); oc.write(backStencilFunction, "backStencilFunction", TestFunction.Always); oc.write(depthFunc, "depthFunc", TestFunction.LessOrEqual); - oc.write(alphaFunc, "alphaFunc", TestFunction.Greater); oc.write(lineWidth, "lineWidth", 1); // Only "additional render state" has them set to false by default - oc.write(applyPointSprite, "applyPointSprite", true); oc.write(applyWireFrame, "applyWireFrame", true); oc.write(applyCullMode, "applyCullMode", true); oc.write(applyDepthWrite, "applyDepthWrite", true); oc.write(applyDepthTest, "applyDepthTest", true); oc.write(applyColorWrite, "applyColorWrite", true); oc.write(applyBlendMode, "applyBlendMode", true); - oc.write(applyAlphaTest, "applyAlphaTest", true); - oc.write(applyAlphaFallOff, "applyAlphaFallOff", true); oc.write(applyPolyOffset, "applyPolyOffset", true); oc.write(applyDepthFunc, "applyDepthFunc", true); - oc.write(applyAlphaFunc, "applyAlphaFunc", false); oc.write(applyLineWidth, "applyLineWidth", true); } public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); - pointSprite = ic.readBoolean("pointSprite", false); wireframe = ic.readBoolean("wireframe", false); cullMode = ic.readEnum("cullMode", FaceCullMode.class, FaceCullMode.Back); depthWrite = ic.readBoolean("depthWrite", true); depthTest = ic.readBoolean("depthTest", true); colorWrite = ic.readBoolean("colorWrite", true); blendMode = ic.readEnum("blendMode", BlendMode.class, BlendMode.Off); - alphaTest = ic.readBoolean("alphaTest", false); - alphaFallOff = ic.readFloat("alphaFallOff", 0); offsetEnabled = ic.readBoolean("offsetEnabled", false); offsetFactor = ic.readFloat("offsetFactor", 0); offsetUnits = ic.readFloat("offsetUnits", 0); @@ -397,22 +375,16 @@ public class RenderState implements Cloneable, Savable { frontStencilFunction = ic.readEnum("frontStencilFunction", TestFunction.class, TestFunction.Always); backStencilFunction = ic.readEnum("backStencilFunction", TestFunction.class, TestFunction.Always); depthFunc = ic.readEnum("depthFunc", TestFunction.class, TestFunction.LessOrEqual); - alphaFunc = ic.readEnum("alphaFunc", TestFunction.class, TestFunction.Greater); lineWidth = ic.readFloat("lineWidth", 1); - - applyPointSprite = ic.readBoolean("applyPointSprite", true); applyWireFrame = ic.readBoolean("applyWireFrame", true); applyCullMode = ic.readBoolean("applyCullMode", true); applyDepthWrite = ic.readBoolean("applyDepthWrite", true); applyDepthTest = ic.readBoolean("applyDepthTest", true); applyColorWrite = ic.readBoolean("applyColorWrite", true); applyBlendMode = ic.readBoolean("applyBlendMode", true); - applyAlphaTest = ic.readBoolean("applyAlphaTest", true); - applyAlphaFallOff = ic.readBoolean("applyAlphaFallOff", true); applyPolyOffset = ic.readBoolean("applyPolyOffset", true); applyDepthFunc = ic.readBoolean("applyDepthFunc", true); - applyAlphaFunc = ic.readBoolean("applyAlphaFunc", false); applyLineWidth = ic.readBoolean("applyLineWidth", true); @@ -446,9 +418,6 @@ public class RenderState implements Cloneable, Savable { return false; } RenderState rs = (RenderState) o; - if (pointSprite != rs.pointSprite) { - return false; - } if (wireframe != rs.wireframe) { return false; @@ -479,19 +448,6 @@ public class RenderState implements Cloneable, Savable { return false; } - if (alphaTest != rs.alphaTest) { - return false; - } - if (alphaTest) { - if (alphaFunc != rs.alphaFunc) { - return false; - } - } - - if (alphaFallOff != rs.alphaFallOff) { - return false; - } - if (offsetEnabled != rs.offsetEnabled) { return false; } @@ -544,70 +500,30 @@ public class RenderState implements Cloneable, Savable { } /** - * Enables point sprite mode. - * - *

When point sprite is enabled, any meshes - * with the type of {@link Mode#Points} will be rendered as 2D quads - * with texturing enabled. Fragment shaders can write to the - * gl_PointCoord variable to manipulate the texture coordinate - * for each pixel. The size of the 2D quad can be controlled by writing - * to the gl_PointSize variable in the vertex shader. - * - * @param pointSprite Enables Point Sprite mode. + * @deprecated Does nothing. Point sprite is already enabled by default for + * all supported platforms. jME3 does not support rendering conventional + * point clouds. */ + @Deprecated public void setPointSprite(boolean pointSprite) { - applyPointSprite = true; - this.pointSprite = pointSprite; - cachedHashCode = -1; } /** - * Sets the alpha fall off value for alpha testing. - * - *

If the pixel's alpha value is greater than the - * alphaFallOff then the pixel will be rendered, otherwise - * the pixel will be discarded. - * - * Note : Alpha test is deprecated since opengl 3.0 and does not exists in - * openglES 2.0. - * The prefered way is to use the alphaDiscardThreshold on the material - * Or have a shader that discards the pixel when its alpha value meets the - * discarding condition. - * - * @param alphaFallOff The alpha of all rendered pixels must be higher - * than this value to be rendered. This value should be between 0 and 1. - * - * @see RenderState#setAlphaTest(boolean) + * @deprecated Does nothing. To use alpha test, set the + * AlphaDiscardThreshold material parameter. + * @param alphaFallOff does nothing */ + @Deprecated public void setAlphaFallOff(float alphaFallOff) { - applyAlphaFallOff = true; - this.alphaFallOff = alphaFallOff; - cachedHashCode = -1; } /** - * Enable alpha testing. - * - *

When alpha testing is enabled, all input pixels' alpha are compared - * to the {@link RenderState#setAlphaFallOff(float) constant alpha falloff}. - * If the input alpha is greater than the falloff, the pixel will be rendered, - * otherwise it will be discarded. - * - * @param alphaTest Set to true to enable alpha testing. - * - * Note : Alpha test is deprecated since opengl 3.0 and does not exists in - * openglES 2.0. - * The prefered way is to use the alphaDiscardThreshold on the material - * Or have a shader that discards the pixel when its alpha value meets the - * discarding condition. - * - * - * @see RenderState#setAlphaFallOff(float) + * @deprecated Does nothing. To use alpha test, set the + * AlphaDiscardThreshold material parameter. + * @param alphaTest does nothing */ + @Deprecated public void setAlphaTest(boolean alphaTest) { - applyAlphaTest = true; - this.alphaTest = alphaTest; - cachedHashCode = -1; } /** @@ -796,24 +712,10 @@ public class RenderState implements Cloneable, Savable { } /** - * Sets the alpha comparision function to the given TestFunction - * default is Greater (GL_GREATER) - * - * Note : Alpha test is deprecated since opengl 3.0 and does not exists in - * openglES 2.0. - * The prefered way is to use the alphaDiscardThreshold on the material - * Or have a shader taht discards the pixel when its alpha value meets the - * discarding condition. - * - * @see TestFunction - * @see RenderState#setAlphaTest(boolean) - * @see RenderState#setAlphaFallOff(float) - * @param alphaFunc the alpha comparision function + * @deprecated */ - public void setAlphaFunc(TestFunction alphaFunc) { - applyAlphaFunc = true; - this.alphaFunc = alphaFunc; - cachedHashCode = -1; + @Deprecated + public void setAlphaFunc(TestFunction alphaFunc) { } /** @@ -1001,25 +903,22 @@ public class RenderState implements Cloneable, Savable { } /** - * Check if point sprite mode is enabled - * - * @return True if point sprite mode is enabled. - * - * @see RenderState#setPointSprite(boolean) + * @return true + * @deprecated Always returns true since point sprite is always enabled. + * @see #setPointSprite(boolean) */ + @Deprecated public boolean isPointSprite() { - return pointSprite; + return true; } /** - * Check if alpha test is enabled. - * - * @return True if alpha test is enabled. - * - * @see RenderState#setAlphaTest(boolean) + * @deprecated To use alpha test, set the AlphaDiscardThreshold + * material parameter. + * @return false */ public boolean isAlphaTest() { - return alphaTest; + return false; } /** @@ -1111,14 +1010,12 @@ public class RenderState implements Cloneable, Savable { } /** - * Retrieve the alpha falloff value. - * - * @return the alpha falloff value. - * - * @see RenderState#setAlphaFallOff(float) + * @return 0 + * @deprecated */ + @Deprecated public float getAlphaFallOff() { - return alphaFallOff; + return 0f; } /** @@ -1133,14 +1030,12 @@ public class RenderState implements Cloneable, Savable { } /** - * Retrieve the alpha comparison function - * - * @return the alpha comparison function - * - * @see RenderState#setAlphaFunc(com.jme3.material.RenderState.TestFunction) + * @return {@link TestFunction#Greater}. + * @deprecated */ + @Deprecated public TestFunction getAlphaFunc() { - return alphaFunc; + return TestFunction.Greater; } /** @@ -1152,15 +1047,6 @@ public class RenderState implements Cloneable, Savable { return lineWidth; } - - public boolean isApplyAlphaFallOff() { - return applyAlphaFallOff; - } - - public boolean isApplyAlphaTest() { - return applyAlphaTest; - } - public boolean isApplyBlendMode() { return applyBlendMode; } @@ -1181,10 +1067,6 @@ public class RenderState implements Cloneable, Savable { return applyDepthWrite; } - public boolean isApplyPointSprite() { - return applyPointSprite; - } - public boolean isApplyPolyOffset() { return applyPolyOffset; } @@ -1197,10 +1079,6 @@ public class RenderState implements Cloneable, Savable { return applyDepthFunc; } - public boolean isApplyAlphaFunc() { - return applyAlphaFunc; - } - public boolean isApplyLineWidth() { return applyLineWidth; } @@ -1211,7 +1089,6 @@ public class RenderState implements Cloneable, Savable { public int contentHashCode() { if (cachedHashCode == -1){ int hash = 7; - hash = 79 * hash + (this.pointSprite ? 1 : 0); hash = 79 * hash + (this.wireframe ? 1 : 0); hash = 79 * hash + (this.cullMode != null ? this.cullMode.hashCode() : 0); hash = 79 * hash + (this.depthWrite ? 1 : 0); @@ -1219,9 +1096,6 @@ public class RenderState implements Cloneable, Savable { hash = 79 * hash + (this.depthFunc != null ? this.depthFunc.hashCode() : 0); hash = 79 * hash + (this.colorWrite ? 1 : 0); hash = 79 * hash + (this.blendMode != null ? this.blendMode.hashCode() : 0); - hash = 79 * hash + (this.alphaTest ? 1 : 0); - hash = 79 * hash + (this.alphaFunc != null ? this.alphaFunc.hashCode() : 0); - hash = 79 * hash + Float.floatToIntBits(this.alphaFallOff); hash = 79 * hash + Float.floatToIntBits(this.offsetFactor); hash = 79 * hash + Float.floatToIntBits(this.offsetUnits); hash = 79 * hash + (this.offsetEnabled ? 1 : 0); @@ -1266,11 +1140,6 @@ public class RenderState implements Cloneable, Savable { return this; } - if (additionalState.applyPointSprite) { - state.pointSprite = additionalState.pointSprite; - } else { - state.pointSprite = pointSprite; - } if (additionalState.applyWireFrame) { state.wireframe = additionalState.wireframe; } else { @@ -1307,22 +1176,7 @@ public class RenderState implements Cloneable, Savable { } else { state.blendMode = blendMode; } - if (additionalState.applyAlphaTest) { - state.alphaTest = additionalState.alphaTest; - } else { - state.alphaTest = alphaTest; - } - if (additionalState.applyAlphaFunc) { - state.alphaFunc = additionalState.alphaFunc; - } else { - state.alphaFunc = alphaFunc; - } - if (additionalState.applyAlphaFallOff) { - state.alphaFallOff = additionalState.alphaFallOff; - } else { - state.alphaFallOff = alphaFallOff; - } if (additionalState.applyPolyOffset) { state.offsetEnabled = additionalState.offsetEnabled; state.offsetFactor = additionalState.offsetFactor; @@ -1367,16 +1221,13 @@ public class RenderState implements Cloneable, Savable { state.cachedHashCode = -1; return state; } - public void set(RenderState state) { - pointSprite = state.pointSprite; + public void set(RenderState state) { wireframe = state.wireframe; cullMode = state.cullMode; depthWrite = state.depthWrite; depthTest = state.depthTest; colorWrite = state.colorWrite; blendMode = state.blendMode; - alphaTest = state.alphaTest; - alphaFallOff = state.alphaFallOff; offsetEnabled = state.offsetEnabled; offsetFactor = state.offsetFactor; offsetUnits = state.offsetUnits; @@ -1390,29 +1241,22 @@ public class RenderState implements Cloneable, Savable { frontStencilFunction = state.frontStencilFunction; backStencilFunction = state.backStencilFunction; depthFunc = state.depthFunc; - alphaFunc = state.alphaFunc; lineWidth = state.lineWidth; - applyPointSprite = true; applyWireFrame = true; applyCullMode = true; applyDepthWrite = true; applyDepthTest = true; applyColorWrite = true; - applyBlendMode = true; - applyAlphaTest = true; - applyAlphaFallOff = true; + applyBlendMode = true; applyPolyOffset = true; - applyDepthFunc = true; - applyAlphaFunc = false; + applyDepthFunc = true; applyLineWidth = true; } @Override public String toString() { return "RenderState[\n" - + "pointSprite=" + pointSprite - + "\napplyPointSprite=" + applyPointSprite + "\nwireframe=" + wireframe + "\napplyWireFrame=" + applyWireFrame + "\ncullMode=" + cullMode @@ -1426,11 +1270,6 @@ public class RenderState implements Cloneable, Savable { + "\napplyColorWrite=" + applyColorWrite + "\nblendMode=" + blendMode + "\napplyBlendMode=" + applyBlendMode - + "\nalphaTest=" + alphaTest - + "\nalphaFunc=" + alphaFunc - + "\napplyAlphaTest=" + applyAlphaTest - + "\nalphaFallOff=" + alphaFallOff - + "\napplyAlphaFallOff=" + applyAlphaFallOff + "\noffsetEnabled=" + offsetEnabled + "\napplyPolyOffset=" + applyPolyOffset + "\noffsetFactor=" + offsetFactor diff --git a/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java b/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java index 5be184c94..2e0f6e79e 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java +++ b/jme3-core/src/main/java/com/jme3/renderer/RenderContext.java @@ -55,16 +55,6 @@ public class RenderContext { */ public boolean depthTestEnabled = false; - /** - * @see RenderState#setAlphaFallOff(float) - */ - public float alphaTestFallOff = 0f; - - /** - * @see RenderState#setAlphaTest(boolean) - */ - public boolean alphaTestEnabled = false; - /** * @see RenderState#setDepthWrite(boolean) */ @@ -115,11 +105,6 @@ public class RenderContext { */ public boolean wireframe = false; - /** - * @see RenderState#setPointSprite(boolean) - */ - public boolean pointSprite = false; - /** * @see Renderer#setShader(com.jme3.shader.Shader) */ @@ -261,7 +246,6 @@ public class RenderContext { public void reset(){ cullMode = RenderState.FaceCullMode.Off; depthTestEnabled = false; - alphaTestFallOff = 0f; depthWriteEnabled = false; colorWriteEnabled = false; clipRectEnabled = false; diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index 7ef77a2b6..3b4a4d07a 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -533,7 +533,6 @@ public final class GLRenderer implements Renderer { gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE); if (!caps.contains(Caps.CoreProfile)) { gl2.glEnable(GL2.GL_POINT_SPRITE); - context.pointSprite = true; } } } diff --git a/jme3-core/src/main/java/com/jme3/scene/Mesh.java b/jme3-core/src/main/java/com/jme3/scene/Mesh.java index 15c6a5e1d..84c279536 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Mesh.java +++ b/jme3-core/src/main/java/com/jme3/scene/Mesh.java @@ -589,28 +589,26 @@ public class Mesh implements Savable, Cloneable, JmeCloneable { } /** - * Returns the size of points for point meshes + * @deprecated Always returns 1.0 since point size is + * determined in the vertex shader. * - * @return the size of points + * @return 1.0 * * @see #setPointSize(float) */ + @Deprecated public float getPointSize() { - return pointSize; + return 1.0f; } /** - * Set the size of points for meshes of mode {@link Mode#Points}. - * The point size is specified as on-screen pixels, the default - * value is 1.0. The point size - * does nothing if {@link RenderState#setPointSprite(boolean) point sprite} - * render state is enabled, in that case, the vertex shader must specify the - * point size by writing to gl_PointSize. + * @deprecated Does nothing, since the size of {@link Mode#Points points} is + * determined via the vertex shader's gl_PointSize output. * - * @param pointSize The size of points + * @param pointSize ignored */ + @Deprecated public void setPointSize(float pointSize) { - this.pointSize = pointSize; } /** diff --git a/jme3-core/src/plugins/java/com/jme3/scene/plugins/MTLLoader.java b/jme3-core/src/plugins/java/com/jme3/scene/plugins/MTLLoader.java index f09eae150..cdc3655d6 100644 --- a/jme3-core/src/plugins/java/com/jme3/scene/plugins/MTLLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/scene/plugins/MTLLoader.java @@ -149,8 +149,7 @@ public class MTLLoader implements AssetLoader { if (transparent){ material.setTransparent(true); material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); - material.getAdditionalRenderState().setAlphaTest(true); - material.getAdditionalRenderState().setAlphaFallOff(0.01f); + material.setFloat("AlphaDiscardThreshold", 0.01f); } matList.put(matName, material); diff --git a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java index 98347067c..9ca739014 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java @@ -504,7 +504,6 @@ public class TextureAtlas { geom.setMesh(mesh); Material mat = new Material(mgr, "Common/MatDefs/Light/Lighting.j3md"); - mat.getAdditionalRenderState().setAlphaTest(true); Texture diffuseMap = atlas.getAtlasTexture("DiffuseMap"); Texture normalMap = atlas.getAtlasTexture("NormalMap"); Texture specularMap = atlas.getAtlasTexture("SpecularMap"); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java index 491301c22..87e13abed 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java @@ -803,9 +803,7 @@ public class SceneLoader implements AssetLoader { m.setColor("Diffuse", new ColorRGBA(data.diffuseColor.x, data.diffuseColor.y, data.diffuseColor.z, 1)); m.setColor("Specular", new ColorRGBA(data.specularColor.x, data.specularColor.y, data.specularColor.z, 1)); m.setFloat("Shininess", data.shininessExponent); - m.setBoolean("UseMaterialColors", true); - m.getAdditionalRenderState().setAlphaTest(true); - m.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); + m.setBoolean("UseMaterialColors", true); return m; }