deprecate alpha test / point sprite
This commit is contained in:
parent
37f8ee91af
commit
876015ab47
@ -50,8 +50,9 @@ public abstract class ParticleMesh extends Mesh {
|
|||||||
public enum Type {
|
public enum Type {
|
||||||
/**
|
/**
|
||||||
* The particle mesh is composed of points. Each particle is a point.
|
* 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}
|
* Note that point based particles do not support certain features such
|
||||||
* to render particles the usual way.
|
* as {@link ParticleEmitter#setRotateSpeed(float) rotation}, and
|
||||||
|
* {@link ParticleEmitter#setFacingVelocity(boolean) velocity following}.
|
||||||
*/
|
*/
|
||||||
Point,
|
Point,
|
||||||
|
|
||||||
|
@ -1097,14 +1097,11 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
// Try to guess values of "apply" render state based on defaults
|
// Try to guess values of "apply" render state based on defaults
|
||||||
// if value != default then set apply to true
|
// if value != default then set apply to true
|
||||||
additionalState.applyPolyOffset = additionalState.offsetEnabled;
|
additionalState.applyPolyOffset = additionalState.offsetEnabled;
|
||||||
additionalState.applyAlphaFallOff = additionalState.alphaTest;
|
|
||||||
additionalState.applyAlphaTest = additionalState.alphaTest;
|
|
||||||
additionalState.applyBlendMode = additionalState.blendMode != BlendMode.Off;
|
additionalState.applyBlendMode = additionalState.blendMode != BlendMode.Off;
|
||||||
additionalState.applyColorWrite = !additionalState.colorWrite;
|
additionalState.applyColorWrite = !additionalState.colorWrite;
|
||||||
additionalState.applyCullMode = additionalState.cullMode != FaceCullMode.Back;
|
additionalState.applyCullMode = additionalState.cullMode != FaceCullMode.Back;
|
||||||
additionalState.applyDepthTest = !additionalState.depthTest;
|
additionalState.applyDepthTest = !additionalState.depthTest;
|
||||||
additionalState.applyDepthWrite = !additionalState.depthWrite;
|
additionalState.applyDepthWrite = !additionalState.depthWrite;
|
||||||
additionalState.applyPointSprite = additionalState.pointSprite;
|
|
||||||
additionalState.applyStencilTest = additionalState.stencilTest;
|
additionalState.applyStencilTest = additionalState.stencilTest;
|
||||||
additionalState.applyWireFrame = additionalState.wireframe;
|
additionalState.applyWireFrame = additionalState.wireframe;
|
||||||
}
|
}
|
||||||
|
@ -75,12 +75,11 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>TestFunction</code> specifies the testing function for stencil test
|
* <code>TestFunction</code> specifies the testing function for stencil test
|
||||||
* function and alpha test function.
|
* function.
|
||||||
*
|
*
|
||||||
* <p>The functions work similarly as described except that for stencil
|
* <p>
|
||||||
* test function, the reference value given in the stencil command is
|
* The reference value given in the stencil command is the input value while
|
||||||
* the input value while the reference is the value already in the stencil
|
* the reference is the value already in the stencil buffer.
|
||||||
* buffer.
|
|
||||||
*/
|
*/
|
||||||
public enum TestFunction {
|
public enum TestFunction {
|
||||||
|
|
||||||
@ -118,7 +117,8 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
/**
|
/**
|
||||||
* The test always passes
|
* The test always passes
|
||||||
*/
|
*/
|
||||||
Always,}
|
Always
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>BlendMode</code> specifies the blending operation to use.
|
* <code>BlendMode</code> specifies the blending operation to use.
|
||||||
@ -276,19 +276,14 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ADDITIONAL.applyPointSprite = false;
|
|
||||||
ADDITIONAL.applyWireFrame = false;
|
ADDITIONAL.applyWireFrame = false;
|
||||||
ADDITIONAL.applyCullMode = false;
|
ADDITIONAL.applyCullMode = false;
|
||||||
ADDITIONAL.applyDepthWrite = false;
|
ADDITIONAL.applyDepthWrite = false;
|
||||||
ADDITIONAL.applyDepthTest = false;
|
ADDITIONAL.applyDepthTest = false;
|
||||||
ADDITIONAL.applyColorWrite = false;
|
ADDITIONAL.applyColorWrite = false;
|
||||||
ADDITIONAL.applyBlendMode = false;
|
ADDITIONAL.applyBlendMode = false;
|
||||||
ADDITIONAL.applyAlphaTest = false;
|
|
||||||
ADDITIONAL.applyAlphaFallOff = false;
|
|
||||||
ADDITIONAL.applyPolyOffset = false;
|
ADDITIONAL.applyPolyOffset = false;
|
||||||
}
|
}
|
||||||
boolean pointSprite = false;
|
|
||||||
boolean applyPointSprite = true;
|
|
||||||
boolean wireframe = false;
|
boolean wireframe = false;
|
||||||
boolean applyWireFrame = true;
|
boolean applyWireFrame = true;
|
||||||
FaceCullMode cullMode = FaceCullMode.Back;
|
FaceCullMode cullMode = FaceCullMode.Back;
|
||||||
@ -301,10 +296,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
boolean applyColorWrite = true;
|
boolean applyColorWrite = true;
|
||||||
BlendMode blendMode = BlendMode.Off;
|
BlendMode blendMode = BlendMode.Off;
|
||||||
boolean applyBlendMode = true;
|
boolean applyBlendMode = true;
|
||||||
boolean alphaTest = false;
|
|
||||||
boolean applyAlphaTest = true;
|
|
||||||
float alphaFallOff = 0;
|
|
||||||
boolean applyAlphaFallOff = true;
|
|
||||||
float offsetFactor = 0;
|
float offsetFactor = 0;
|
||||||
float offsetUnits = 0;
|
float offsetUnits = 0;
|
||||||
boolean offsetEnabled = false;
|
boolean offsetEnabled = false;
|
||||||
@ -316,9 +307,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
TestFunction depthFunc = TestFunction.LessOrEqual;
|
TestFunction depthFunc = TestFunction.LessOrEqual;
|
||||||
//by default depth func will be applied anyway if depth test is applied
|
//by default depth func will be applied anyway if depth test is applied
|
||||||
boolean applyDepthFunc = false;
|
boolean applyDepthFunc = false;
|
||||||
//by default alpha func will be applied anyway if alpha test is applied
|
|
||||||
TestFunction alphaFunc = TestFunction.Greater;
|
|
||||||
boolean applyAlphaFunc = false;
|
|
||||||
StencilOperation frontStencilStencilFailOperation = StencilOperation.Keep;
|
StencilOperation frontStencilStencilFailOperation = StencilOperation.Keep;
|
||||||
StencilOperation frontStencilDepthFailOperation = StencilOperation.Keep;
|
StencilOperation frontStencilDepthFailOperation = StencilOperation.Keep;
|
||||||
StencilOperation frontStencilDepthPassOperation = StencilOperation.Keep;
|
StencilOperation frontStencilDepthPassOperation = StencilOperation.Keep;
|
||||||
@ -331,15 +319,13 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
|
|
||||||
public void write(JmeExporter ex) throws IOException {
|
public void write(JmeExporter ex) throws IOException {
|
||||||
OutputCapsule oc = ex.getCapsule(this);
|
OutputCapsule oc = ex.getCapsule(this);
|
||||||
oc.write(pointSprite, "pointSprite", false);
|
oc.write(true, "pointSprite", false);
|
||||||
oc.write(wireframe, "wireframe", false);
|
oc.write(wireframe, "wireframe", false);
|
||||||
oc.write(cullMode, "cullMode", FaceCullMode.Back);
|
oc.write(cullMode, "cullMode", FaceCullMode.Back);
|
||||||
oc.write(depthWrite, "depthWrite", true);
|
oc.write(depthWrite, "depthWrite", true);
|
||||||
oc.write(depthTest, "depthTest", true);
|
oc.write(depthTest, "depthTest", true);
|
||||||
oc.write(colorWrite, "colorWrite", true);
|
oc.write(colorWrite, "colorWrite", true);
|
||||||
oc.write(blendMode, "blendMode", BlendMode.Off);
|
oc.write(blendMode, "blendMode", BlendMode.Off);
|
||||||
oc.write(alphaTest, "alphaTest", false);
|
|
||||||
oc.write(alphaFallOff, "alphaFallOff", 0);
|
|
||||||
oc.write(offsetEnabled, "offsetEnabled", false);
|
oc.write(offsetEnabled, "offsetEnabled", false);
|
||||||
oc.write(offsetFactor, "offsetFactor", 0);
|
oc.write(offsetFactor, "offsetFactor", 0);
|
||||||
oc.write(offsetUnits, "offsetUnits", 0);
|
oc.write(offsetUnits, "offsetUnits", 0);
|
||||||
@ -353,37 +339,29 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
oc.write(frontStencilFunction, "frontStencilFunction", TestFunction.Always);
|
oc.write(frontStencilFunction, "frontStencilFunction", TestFunction.Always);
|
||||||
oc.write(backStencilFunction, "backStencilFunction", TestFunction.Always);
|
oc.write(backStencilFunction, "backStencilFunction", TestFunction.Always);
|
||||||
oc.write(depthFunc, "depthFunc", TestFunction.LessOrEqual);
|
oc.write(depthFunc, "depthFunc", TestFunction.LessOrEqual);
|
||||||
oc.write(alphaFunc, "alphaFunc", TestFunction.Greater);
|
|
||||||
oc.write(lineWidth, "lineWidth", 1);
|
oc.write(lineWidth, "lineWidth", 1);
|
||||||
|
|
||||||
// Only "additional render state" has them set to false by default
|
// Only "additional render state" has them set to false by default
|
||||||
oc.write(applyPointSprite, "applyPointSprite", true);
|
|
||||||
oc.write(applyWireFrame, "applyWireFrame", true);
|
oc.write(applyWireFrame, "applyWireFrame", true);
|
||||||
oc.write(applyCullMode, "applyCullMode", true);
|
oc.write(applyCullMode, "applyCullMode", true);
|
||||||
oc.write(applyDepthWrite, "applyDepthWrite", true);
|
oc.write(applyDepthWrite, "applyDepthWrite", true);
|
||||||
oc.write(applyDepthTest, "applyDepthTest", true);
|
oc.write(applyDepthTest, "applyDepthTest", true);
|
||||||
oc.write(applyColorWrite, "applyColorWrite", true);
|
oc.write(applyColorWrite, "applyColorWrite", true);
|
||||||
oc.write(applyBlendMode, "applyBlendMode", true);
|
oc.write(applyBlendMode, "applyBlendMode", true);
|
||||||
oc.write(applyAlphaTest, "applyAlphaTest", true);
|
|
||||||
oc.write(applyAlphaFallOff, "applyAlphaFallOff", true);
|
|
||||||
oc.write(applyPolyOffset, "applyPolyOffset", true);
|
oc.write(applyPolyOffset, "applyPolyOffset", true);
|
||||||
oc.write(applyDepthFunc, "applyDepthFunc", true);
|
oc.write(applyDepthFunc, "applyDepthFunc", true);
|
||||||
oc.write(applyAlphaFunc, "applyAlphaFunc", false);
|
|
||||||
oc.write(applyLineWidth, "applyLineWidth", true);
|
oc.write(applyLineWidth, "applyLineWidth", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(JmeImporter im) throws IOException {
|
public void read(JmeImporter im) throws IOException {
|
||||||
InputCapsule ic = im.getCapsule(this);
|
InputCapsule ic = im.getCapsule(this);
|
||||||
pointSprite = ic.readBoolean("pointSprite", false);
|
|
||||||
wireframe = ic.readBoolean("wireframe", false);
|
wireframe = ic.readBoolean("wireframe", false);
|
||||||
cullMode = ic.readEnum("cullMode", FaceCullMode.class, FaceCullMode.Back);
|
cullMode = ic.readEnum("cullMode", FaceCullMode.class, FaceCullMode.Back);
|
||||||
depthWrite = ic.readBoolean("depthWrite", true);
|
depthWrite = ic.readBoolean("depthWrite", true);
|
||||||
depthTest = ic.readBoolean("depthTest", true);
|
depthTest = ic.readBoolean("depthTest", true);
|
||||||
colorWrite = ic.readBoolean("colorWrite", true);
|
colorWrite = ic.readBoolean("colorWrite", true);
|
||||||
blendMode = ic.readEnum("blendMode", BlendMode.class, BlendMode.Off);
|
blendMode = ic.readEnum("blendMode", BlendMode.class, BlendMode.Off);
|
||||||
alphaTest = ic.readBoolean("alphaTest", false);
|
|
||||||
alphaFallOff = ic.readFloat("alphaFallOff", 0);
|
|
||||||
offsetEnabled = ic.readBoolean("offsetEnabled", false);
|
offsetEnabled = ic.readBoolean("offsetEnabled", false);
|
||||||
offsetFactor = ic.readFloat("offsetFactor", 0);
|
offsetFactor = ic.readFloat("offsetFactor", 0);
|
||||||
offsetUnits = ic.readFloat("offsetUnits", 0);
|
offsetUnits = ic.readFloat("offsetUnits", 0);
|
||||||
@ -397,22 +375,16 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
frontStencilFunction = ic.readEnum("frontStencilFunction", TestFunction.class, TestFunction.Always);
|
frontStencilFunction = ic.readEnum("frontStencilFunction", TestFunction.class, TestFunction.Always);
|
||||||
backStencilFunction = ic.readEnum("backStencilFunction", TestFunction.class, TestFunction.Always);
|
backStencilFunction = ic.readEnum("backStencilFunction", TestFunction.class, TestFunction.Always);
|
||||||
depthFunc = ic.readEnum("depthFunc", TestFunction.class, TestFunction.LessOrEqual);
|
depthFunc = ic.readEnum("depthFunc", TestFunction.class, TestFunction.LessOrEqual);
|
||||||
alphaFunc = ic.readEnum("alphaFunc", TestFunction.class, TestFunction.Greater);
|
|
||||||
lineWidth = ic.readFloat("lineWidth", 1);
|
lineWidth = ic.readFloat("lineWidth", 1);
|
||||||
|
|
||||||
|
|
||||||
applyPointSprite = ic.readBoolean("applyPointSprite", true);
|
|
||||||
applyWireFrame = ic.readBoolean("applyWireFrame", true);
|
applyWireFrame = ic.readBoolean("applyWireFrame", true);
|
||||||
applyCullMode = ic.readBoolean("applyCullMode", true);
|
applyCullMode = ic.readBoolean("applyCullMode", true);
|
||||||
applyDepthWrite = ic.readBoolean("applyDepthWrite", true);
|
applyDepthWrite = ic.readBoolean("applyDepthWrite", true);
|
||||||
applyDepthTest = ic.readBoolean("applyDepthTest", true);
|
applyDepthTest = ic.readBoolean("applyDepthTest", true);
|
||||||
applyColorWrite = ic.readBoolean("applyColorWrite", true);
|
applyColorWrite = ic.readBoolean("applyColorWrite", true);
|
||||||
applyBlendMode = ic.readBoolean("applyBlendMode", true);
|
applyBlendMode = ic.readBoolean("applyBlendMode", true);
|
||||||
applyAlphaTest = ic.readBoolean("applyAlphaTest", true);
|
|
||||||
applyAlphaFallOff = ic.readBoolean("applyAlphaFallOff", true);
|
|
||||||
applyPolyOffset = ic.readBoolean("applyPolyOffset", true);
|
applyPolyOffset = ic.readBoolean("applyPolyOffset", true);
|
||||||
applyDepthFunc = ic.readBoolean("applyDepthFunc", true);
|
applyDepthFunc = ic.readBoolean("applyDepthFunc", true);
|
||||||
applyAlphaFunc = ic.readBoolean("applyAlphaFunc", false);
|
|
||||||
applyLineWidth = ic.readBoolean("applyLineWidth", true);
|
applyLineWidth = ic.readBoolean("applyLineWidth", true);
|
||||||
|
|
||||||
|
|
||||||
@ -446,9 +418,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RenderState rs = (RenderState) o;
|
RenderState rs = (RenderState) o;
|
||||||
if (pointSprite != rs.pointSprite) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wireframe != rs.wireframe) {
|
if (wireframe != rs.wireframe) {
|
||||||
return false;
|
return false;
|
||||||
@ -479,19 +448,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return false;
|
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) {
|
if (offsetEnabled != rs.offsetEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -544,70 +500,30 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables point sprite mode.
|
* @deprecated Does nothing. Point sprite is already enabled by default for
|
||||||
*
|
* all supported platforms. jME3 does not support rendering conventional
|
||||||
* <p>When point sprite is enabled, any meshes
|
* point clouds.
|
||||||
* with the type of {@link Mode#Points} will be rendered as 2D quads
|
|
||||||
* with texturing enabled. Fragment shaders can write to the
|
|
||||||
* <code>gl_PointCoord</code> variable to manipulate the texture coordinate
|
|
||||||
* for each pixel. The size of the 2D quad can be controlled by writing
|
|
||||||
* to the <code>gl_PointSize</code> variable in the vertex shader.
|
|
||||||
*
|
|
||||||
* @param pointSprite Enables Point Sprite mode.
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setPointSprite(boolean pointSprite) {
|
public void setPointSprite(boolean pointSprite) {
|
||||||
applyPointSprite = true;
|
|
||||||
this.pointSprite = pointSprite;
|
|
||||||
cachedHashCode = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the alpha fall off value for alpha testing.
|
* @deprecated Does nothing. To use alpha test, set the
|
||||||
*
|
* <code>AlphaDiscardThreshold</code> material parameter.
|
||||||
* <p>If the pixel's alpha value is greater than the
|
* @param alphaFallOff does nothing
|
||||||
* <code>alphaFallOff</code> 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
|
||||||
public void setAlphaFallOff(float alphaFallOff) {
|
public void setAlphaFallOff(float alphaFallOff) {
|
||||||
applyAlphaFallOff = true;
|
|
||||||
this.alphaFallOff = alphaFallOff;
|
|
||||||
cachedHashCode = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable alpha testing.
|
* @deprecated Does nothing. To use alpha test, set the
|
||||||
*
|
* <code>AlphaDiscardThreshold</code> material parameter.
|
||||||
* <p>When alpha testing is enabled, all input pixels' alpha are compared
|
* @param alphaTest does nothing
|
||||||
* 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
|
||||||
public void setAlphaTest(boolean alphaTest) {
|
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
|
* @deprecated
|
||||||
* 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) {
|
public void setAlphaFunc(TestFunction alphaFunc) {
|
||||||
applyAlphaFunc = true;
|
|
||||||
this.alphaFunc = alphaFunc;
|
|
||||||
cachedHashCode = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1001,25 +903,22 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if point sprite mode is enabled
|
* @return true
|
||||||
*
|
* @deprecated Always returns true since point sprite is always enabled.
|
||||||
* @return True if point sprite mode is enabled.
|
* @see #setPointSprite(boolean)
|
||||||
*
|
|
||||||
* @see RenderState#setPointSprite(boolean)
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isPointSprite() {
|
public boolean isPointSprite() {
|
||||||
return pointSprite;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if alpha test is enabled.
|
* @deprecated To use alpha test, set the <code>AlphaDiscardThreshold</code>
|
||||||
*
|
* material parameter.
|
||||||
* @return True if alpha test is enabled.
|
* @return false
|
||||||
*
|
|
||||||
* @see RenderState#setAlphaTest(boolean)
|
|
||||||
*/
|
*/
|
||||||
public boolean isAlphaTest() {
|
public boolean isAlphaTest() {
|
||||||
return alphaTest;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1111,14 +1010,12 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the alpha falloff value.
|
* @return 0
|
||||||
*
|
* @deprecated
|
||||||
* @return the alpha falloff value.
|
|
||||||
*
|
|
||||||
* @see RenderState#setAlphaFallOff(float)
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public float getAlphaFallOff() {
|
public float getAlphaFallOff() {
|
||||||
return alphaFallOff;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1133,14 +1030,12 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the alpha comparison function
|
* @return {@link TestFunction#Greater}.
|
||||||
*
|
* @deprecated
|
||||||
* @return the alpha comparison function
|
|
||||||
*
|
|
||||||
* @see RenderState#setAlphaFunc(com.jme3.material.RenderState.TestFunction)
|
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TestFunction getAlphaFunc() {
|
public TestFunction getAlphaFunc() {
|
||||||
return alphaFunc;
|
return TestFunction.Greater;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1152,15 +1047,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return lineWidth;
|
return lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isApplyAlphaFallOff() {
|
|
||||||
return applyAlphaFallOff;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isApplyAlphaTest() {
|
|
||||||
return applyAlphaTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isApplyBlendMode() {
|
public boolean isApplyBlendMode() {
|
||||||
return applyBlendMode;
|
return applyBlendMode;
|
||||||
}
|
}
|
||||||
@ -1181,10 +1067,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return applyDepthWrite;
|
return applyDepthWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isApplyPointSprite() {
|
|
||||||
return applyPointSprite;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isApplyPolyOffset() {
|
public boolean isApplyPolyOffset() {
|
||||||
return applyPolyOffset;
|
return applyPolyOffset;
|
||||||
}
|
}
|
||||||
@ -1197,10 +1079,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return applyDepthFunc;
|
return applyDepthFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isApplyAlphaFunc() {
|
|
||||||
return applyAlphaFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isApplyLineWidth() {
|
public boolean isApplyLineWidth() {
|
||||||
return applyLineWidth;
|
return applyLineWidth;
|
||||||
}
|
}
|
||||||
@ -1211,7 +1089,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
public int contentHashCode() {
|
public int contentHashCode() {
|
||||||
if (cachedHashCode == -1){
|
if (cachedHashCode == -1){
|
||||||
int hash = 7;
|
int hash = 7;
|
||||||
hash = 79 * hash + (this.pointSprite ? 1 : 0);
|
|
||||||
hash = 79 * hash + (this.wireframe ? 1 : 0);
|
hash = 79 * hash + (this.wireframe ? 1 : 0);
|
||||||
hash = 79 * hash + (this.cullMode != null ? this.cullMode.hashCode() : 0);
|
hash = 79 * hash + (this.cullMode != null ? this.cullMode.hashCode() : 0);
|
||||||
hash = 79 * hash + (this.depthWrite ? 1 : 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.depthFunc != null ? this.depthFunc.hashCode() : 0);
|
||||||
hash = 79 * hash + (this.colorWrite ? 1 : 0);
|
hash = 79 * hash + (this.colorWrite ? 1 : 0);
|
||||||
hash = 79 * hash + (this.blendMode != null ? this.blendMode.hashCode() : 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.offsetFactor);
|
||||||
hash = 79 * hash + Float.floatToIntBits(this.offsetUnits);
|
hash = 79 * hash + Float.floatToIntBits(this.offsetUnits);
|
||||||
hash = 79 * hash + (this.offsetEnabled ? 1 : 0);
|
hash = 79 * hash + (this.offsetEnabled ? 1 : 0);
|
||||||
@ -1266,11 +1140,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalState.applyPointSprite) {
|
|
||||||
state.pointSprite = additionalState.pointSprite;
|
|
||||||
} else {
|
|
||||||
state.pointSprite = pointSprite;
|
|
||||||
}
|
|
||||||
if (additionalState.applyWireFrame) {
|
if (additionalState.applyWireFrame) {
|
||||||
state.wireframe = additionalState.wireframe;
|
state.wireframe = additionalState.wireframe;
|
||||||
} else {
|
} else {
|
||||||
@ -1307,22 +1176,7 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
} else {
|
} else {
|
||||||
state.blendMode = blendMode;
|
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) {
|
if (additionalState.applyPolyOffset) {
|
||||||
state.offsetEnabled = additionalState.offsetEnabled;
|
state.offsetEnabled = additionalState.offsetEnabled;
|
||||||
state.offsetFactor = additionalState.offsetFactor;
|
state.offsetFactor = additionalState.offsetFactor;
|
||||||
@ -1367,16 +1221,13 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
state.cachedHashCode = -1;
|
state.cachedHashCode = -1;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
public void set(RenderState state) {
|
public void set(RenderState state) {
|
||||||
pointSprite = state.pointSprite;
|
|
||||||
wireframe = state.wireframe;
|
wireframe = state.wireframe;
|
||||||
cullMode = state.cullMode;
|
cullMode = state.cullMode;
|
||||||
depthWrite = state.depthWrite;
|
depthWrite = state.depthWrite;
|
||||||
depthTest = state.depthTest;
|
depthTest = state.depthTest;
|
||||||
colorWrite = state.colorWrite;
|
colorWrite = state.colorWrite;
|
||||||
blendMode = state.blendMode;
|
blendMode = state.blendMode;
|
||||||
alphaTest = state.alphaTest;
|
|
||||||
alphaFallOff = state.alphaFallOff;
|
|
||||||
offsetEnabled = state.offsetEnabled;
|
offsetEnabled = state.offsetEnabled;
|
||||||
offsetFactor = state.offsetFactor;
|
offsetFactor = state.offsetFactor;
|
||||||
offsetUnits = state.offsetUnits;
|
offsetUnits = state.offsetUnits;
|
||||||
@ -1390,29 +1241,22 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
frontStencilFunction = state.frontStencilFunction;
|
frontStencilFunction = state.frontStencilFunction;
|
||||||
backStencilFunction = state.backStencilFunction;
|
backStencilFunction = state.backStencilFunction;
|
||||||
depthFunc = state.depthFunc;
|
depthFunc = state.depthFunc;
|
||||||
alphaFunc = state.alphaFunc;
|
|
||||||
lineWidth = state.lineWidth;
|
lineWidth = state.lineWidth;
|
||||||
|
|
||||||
applyPointSprite = true;
|
|
||||||
applyWireFrame = true;
|
applyWireFrame = true;
|
||||||
applyCullMode = true;
|
applyCullMode = true;
|
||||||
applyDepthWrite = true;
|
applyDepthWrite = true;
|
||||||
applyDepthTest = true;
|
applyDepthTest = true;
|
||||||
applyColorWrite = true;
|
applyColorWrite = true;
|
||||||
applyBlendMode = true;
|
applyBlendMode = true;
|
||||||
applyAlphaTest = true;
|
|
||||||
applyAlphaFallOff = true;
|
|
||||||
applyPolyOffset = true;
|
applyPolyOffset = true;
|
||||||
applyDepthFunc = true;
|
applyDepthFunc = true;
|
||||||
applyAlphaFunc = false;
|
|
||||||
applyLineWidth = true;
|
applyLineWidth = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RenderState[\n"
|
return "RenderState[\n"
|
||||||
+ "pointSprite=" + pointSprite
|
|
||||||
+ "\napplyPointSprite=" + applyPointSprite
|
|
||||||
+ "\nwireframe=" + wireframe
|
+ "\nwireframe=" + wireframe
|
||||||
+ "\napplyWireFrame=" + applyWireFrame
|
+ "\napplyWireFrame=" + applyWireFrame
|
||||||
+ "\ncullMode=" + cullMode
|
+ "\ncullMode=" + cullMode
|
||||||
@ -1426,11 +1270,6 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
+ "\napplyColorWrite=" + applyColorWrite
|
+ "\napplyColorWrite=" + applyColorWrite
|
||||||
+ "\nblendMode=" + blendMode
|
+ "\nblendMode=" + blendMode
|
||||||
+ "\napplyBlendMode=" + applyBlendMode
|
+ "\napplyBlendMode=" + applyBlendMode
|
||||||
+ "\nalphaTest=" + alphaTest
|
|
||||||
+ "\nalphaFunc=" + alphaFunc
|
|
||||||
+ "\napplyAlphaTest=" + applyAlphaTest
|
|
||||||
+ "\nalphaFallOff=" + alphaFallOff
|
|
||||||
+ "\napplyAlphaFallOff=" + applyAlphaFallOff
|
|
||||||
+ "\noffsetEnabled=" + offsetEnabled
|
+ "\noffsetEnabled=" + offsetEnabled
|
||||||
+ "\napplyPolyOffset=" + applyPolyOffset
|
+ "\napplyPolyOffset=" + applyPolyOffset
|
||||||
+ "\noffsetFactor=" + offsetFactor
|
+ "\noffsetFactor=" + offsetFactor
|
||||||
|
@ -55,16 +55,6 @@ public class RenderContext {
|
|||||||
*/
|
*/
|
||||||
public boolean depthTestEnabled = false;
|
public boolean depthTestEnabled = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RenderState#setAlphaFallOff(float)
|
|
||||||
*/
|
|
||||||
public float alphaTestFallOff = 0f;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RenderState#setAlphaTest(boolean)
|
|
||||||
*/
|
|
||||||
public boolean alphaTestEnabled = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see RenderState#setDepthWrite(boolean)
|
* @see RenderState#setDepthWrite(boolean)
|
||||||
*/
|
*/
|
||||||
@ -115,11 +105,6 @@ public class RenderContext {
|
|||||||
*/
|
*/
|
||||||
public boolean wireframe = false;
|
public boolean wireframe = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @see RenderState#setPointSprite(boolean)
|
|
||||||
*/
|
|
||||||
public boolean pointSprite = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Renderer#setShader(com.jme3.shader.Shader)
|
* @see Renderer#setShader(com.jme3.shader.Shader)
|
||||||
*/
|
*/
|
||||||
@ -261,7 +246,6 @@ public class RenderContext {
|
|||||||
public void reset(){
|
public void reset(){
|
||||||
cullMode = RenderState.FaceCullMode.Off;
|
cullMode = RenderState.FaceCullMode.Off;
|
||||||
depthTestEnabled = false;
|
depthTestEnabled = false;
|
||||||
alphaTestFallOff = 0f;
|
|
||||||
depthWriteEnabled = false;
|
depthWriteEnabled = false;
|
||||||
colorWriteEnabled = false;
|
colorWriteEnabled = false;
|
||||||
clipRectEnabled = false;
|
clipRectEnabled = false;
|
||||||
|
@ -533,7 +533,6 @@ public final class GLRenderer implements Renderer {
|
|||||||
gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE);
|
gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||||
if (!caps.contains(Caps.CoreProfile)) {
|
if (!caps.contains(Caps.CoreProfile)) {
|
||||||
gl2.glEnable(GL2.GL_POINT_SPRITE);
|
gl2.glEnable(GL2.GL_POINT_SPRITE);
|
||||||
context.pointSprite = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,28 +589,26 @@ public class Mesh implements Savable, Cloneable, JmeCloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size of points for point meshes
|
* @deprecated Always returns <code>1.0</code> since point size is
|
||||||
|
* determined in the vertex shader.
|
||||||
*
|
*
|
||||||
* @return the size of points
|
* @return <code>1.0</code>
|
||||||
*
|
*
|
||||||
* @see #setPointSize(float)
|
* @see #setPointSize(float)
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public float getPointSize() {
|
public float getPointSize() {
|
||||||
return pointSize;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of points for meshes of mode {@link Mode#Points}.
|
* @deprecated Does nothing, since the size of {@link Mode#Points points} is
|
||||||
* The point size is specified as on-screen pixels, the default
|
* determined via the vertex shader's <code>gl_PointSize</code> output.
|
||||||
* 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 <code>gl_PointSize</code>.
|
|
||||||
*
|
*
|
||||||
* @param pointSize The size of points
|
* @param pointSize ignored
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setPointSize(float pointSize) {
|
public void setPointSize(float pointSize) {
|
||||||
this.pointSize = pointSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,8 +149,7 @@ public class MTLLoader implements AssetLoader {
|
|||||||
if (transparent){
|
if (transparent){
|
||||||
material.setTransparent(true);
|
material.setTransparent(true);
|
||||||
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
|
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
|
||||||
material.getAdditionalRenderState().setAlphaTest(true);
|
material.setFloat("AlphaDiscardThreshold", 0.01f);
|
||||||
material.getAdditionalRenderState().setAlphaFallOff(0.01f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
matList.put(matName, material);
|
matList.put(matName, material);
|
||||||
|
@ -504,7 +504,6 @@ public class TextureAtlas {
|
|||||||
geom.setMesh(mesh);
|
geom.setMesh(mesh);
|
||||||
|
|
||||||
Material mat = new Material(mgr, "Common/MatDefs/Light/Lighting.j3md");
|
Material mat = new Material(mgr, "Common/MatDefs/Light/Lighting.j3md");
|
||||||
mat.getAdditionalRenderState().setAlphaTest(true);
|
|
||||||
Texture diffuseMap = atlas.getAtlasTexture("DiffuseMap");
|
Texture diffuseMap = atlas.getAtlasTexture("DiffuseMap");
|
||||||
Texture normalMap = atlas.getAtlasTexture("NormalMap");
|
Texture normalMap = atlas.getAtlasTexture("NormalMap");
|
||||||
Texture specularMap = atlas.getAtlasTexture("SpecularMap");
|
Texture specularMap = atlas.getAtlasTexture("SpecularMap");
|
||||||
|
@ -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("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.setColor("Specular", new ColorRGBA(data.specularColor.x, data.specularColor.y, data.specularColor.z, 1));
|
||||||
m.setFloat("Shininess", data.shininessExponent);
|
m.setFloat("Shininess", data.shininessExponent);
|
||||||
m.setBoolean("UseMaterialColors", true);
|
m.setBoolean("UseMaterialColors", true);
|
||||||
m.getAdditionalRenderState().setAlphaTest(true);
|
|
||||||
m.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user