|
|
@ -304,6 +304,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
StencilOperation backStencilDepthPassOperation = StencilOperation.Keep; |
|
|
|
StencilOperation backStencilDepthPassOperation = StencilOperation.Keep; |
|
|
|
TestFunction frontStencilFunction = TestFunction.Always; |
|
|
|
TestFunction frontStencilFunction = TestFunction.Always; |
|
|
|
TestFunction backStencilFunction = TestFunction.Always; |
|
|
|
TestFunction backStencilFunction = TestFunction.Always; |
|
|
|
|
|
|
|
int cachedHashCode = -1; |
|
|
|
|
|
|
|
|
|
|
|
public void write(JmeExporter ex) throws IOException { |
|
|
|
public void write(JmeExporter ex) throws IOException { |
|
|
|
OutputCapsule oc = ex.getCapsule(this); |
|
|
|
OutputCapsule oc = ex.getCapsule(this); |
|
|
@ -505,6 +506,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setPointSprite(boolean pointSprite) { |
|
|
|
public void setPointSprite(boolean pointSprite) { |
|
|
|
applyPointSprite = true; |
|
|
|
applyPointSprite = true; |
|
|
|
this.pointSprite = pointSprite; |
|
|
|
this.pointSprite = pointSprite; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -522,6 +524,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setAlphaFallOff(float alphaFallOff) { |
|
|
|
public void setAlphaFallOff(float alphaFallOff) { |
|
|
|
applyAlphaFallOff = true; |
|
|
|
applyAlphaFallOff = true; |
|
|
|
this.alphaFallOff = alphaFallOff; |
|
|
|
this.alphaFallOff = alphaFallOff; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -539,6 +542,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setAlphaTest(boolean alphaTest) { |
|
|
|
public void setAlphaTest(boolean alphaTest) { |
|
|
|
applyAlphaTest = true; |
|
|
|
applyAlphaTest = true; |
|
|
|
this.alphaTest = alphaTest; |
|
|
|
this.alphaTest = alphaTest; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -553,6 +557,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setColorWrite(boolean colorWrite) { |
|
|
|
public void setColorWrite(boolean colorWrite) { |
|
|
|
applyColorWrite = true; |
|
|
|
applyColorWrite = true; |
|
|
|
this.colorWrite = colorWrite; |
|
|
|
this.colorWrite = colorWrite; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -570,6 +575,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setFaceCullMode(FaceCullMode cullMode) { |
|
|
|
public void setFaceCullMode(FaceCullMode cullMode) { |
|
|
|
applyCullMode = true; |
|
|
|
applyCullMode = true; |
|
|
|
this.cullMode = cullMode; |
|
|
|
this.cullMode = cullMode; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -589,6 +595,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setBlendMode(BlendMode blendMode) { |
|
|
|
public void setBlendMode(BlendMode blendMode) { |
|
|
|
applyBlendMode = true; |
|
|
|
applyBlendMode = true; |
|
|
|
this.blendMode = blendMode; |
|
|
|
this.blendMode = blendMode; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -604,6 +611,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setDepthTest(boolean depthTest) { |
|
|
|
public void setDepthTest(boolean depthTest) { |
|
|
|
applyDepthTest = true; |
|
|
|
applyDepthTest = true; |
|
|
|
this.depthTest = depthTest; |
|
|
|
this.depthTest = depthTest; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -618,6 +626,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setDepthWrite(boolean depthWrite) { |
|
|
|
public void setDepthWrite(boolean depthWrite) { |
|
|
|
applyDepthWrite = true; |
|
|
|
applyDepthWrite = true; |
|
|
|
this.depthWrite = depthWrite; |
|
|
|
this.depthWrite = depthWrite; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -632,6 +641,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
public void setWireframe(boolean wireframe) { |
|
|
|
public void setWireframe(boolean wireframe) { |
|
|
|
applyWireFrame = true; |
|
|
|
applyWireFrame = true; |
|
|
|
this.wireframe = wireframe; |
|
|
|
this.wireframe = wireframe; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -651,6 +661,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
offsetEnabled = true; |
|
|
|
offsetEnabled = true; |
|
|
|
offsetFactor = factor; |
|
|
|
offsetFactor = factor; |
|
|
|
offsetUnits = units; |
|
|
|
offsetUnits = units; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -699,6 +710,7 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
this.backStencilDepthPassOperation = _backStencilDepthPassOperation; |
|
|
|
this.backStencilDepthPassOperation = _backStencilDepthPassOperation; |
|
|
|
this.frontStencilFunction = _frontStencilFunction; |
|
|
|
this.frontStencilFunction = _frontStencilFunction; |
|
|
|
this.backStencilFunction = _backStencilFunction; |
|
|
|
this.backStencilFunction = _backStencilFunction; |
|
|
|
|
|
|
|
cachedHashCode = -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1032,6 +1044,36 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
return applyWireFrame; |
|
|
|
return applyWireFrame; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int hashCode() { |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.depthTest ? 1 : 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 + 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); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.stencilTest ? 1 : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.frontStencilStencilFailOperation != null ? this.frontStencilStencilFailOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.frontStencilDepthFailOperation != null ? this.frontStencilDepthFailOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.frontStencilDepthPassOperation != null ? this.frontStencilDepthPassOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.backStencilStencilFailOperation != null ? this.backStencilStencilFailOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.backStencilDepthFailOperation != null ? this.backStencilDepthFailOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.backStencilDepthPassOperation != null ? this.backStencilDepthPassOperation.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.frontStencilFunction != null ? this.frontStencilFunction.hashCode() : 0); |
|
|
|
|
|
|
|
hash = 79 * hash + (this.backStencilFunction != null ? this.backStencilFunction.hashCode() : 0); |
|
|
|
|
|
|
|
cachedHashCode = hash; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cachedHashCode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Merges <code>this</code> state and <code>additionalState</code> into |
|
|
|
* Merges <code>this</code> state and <code>additionalState</code> into |
|
|
|
* the parameter <code>state</code> based on a specific criteria. |
|
|
|
* the parameter <code>state</code> based on a specific criteria. |
|
|
@ -1141,11 +1183,35 @@ public class RenderState implements Cloneable, Savable { |
|
|
|
state.frontStencilFunction = frontStencilFunction; |
|
|
|
state.frontStencilFunction = frontStencilFunction; |
|
|
|
state.backStencilFunction = backStencilFunction; |
|
|
|
state.backStencilFunction = backStencilFunction; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
state.cachedHashCode = -1; |
|
|
|
return state; |
|
|
|
return state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return "RenderState[\n" + "pointSprite=" + pointSprite + "\napplyPointSprite=" + applyPointSprite + "\nwireframe=" + wireframe + "\napplyWireFrame=" + applyWireFrame + "\ncullMode=" + cullMode + "\napplyCullMode=" + applyCullMode + "\ndepthWrite=" + depthWrite + "\napplyDepthWrite=" + applyDepthWrite + "\ndepthTest=" + depthTest + "\napplyDepthTest=" + applyDepthTest + "\ncolorWrite=" + colorWrite + "\napplyColorWrite=" + applyColorWrite + "\nblendMode=" + blendMode + "\napplyBlendMode=" + applyBlendMode + "\nalphaTest=" + alphaTest + "\napplyAlphaTest=" + applyAlphaTest + "\nalphaFallOff=" + alphaFallOff + "\napplyAlphaFallOff=" + applyAlphaFallOff + "\noffsetEnabled=" + offsetEnabled + "\napplyPolyOffset=" + applyPolyOffset + "\noffsetFactor=" + offsetFactor + "\noffsetUnits=" + offsetUnits + "\n]"; |
|
|
|
return "RenderState[\n" |
|
|
|
|
|
|
|
+ "pointSprite=" + pointSprite |
|
|
|
|
|
|
|
+ "\napplyPointSprite=" + applyPointSprite |
|
|
|
|
|
|
|
+ "\nwireframe=" + wireframe |
|
|
|
|
|
|
|
+ "\napplyWireFrame=" + applyWireFrame |
|
|
|
|
|
|
|
+ "\ncullMode=" + cullMode |
|
|
|
|
|
|
|
+ "\napplyCullMode=" + applyCullMode |
|
|
|
|
|
|
|
+ "\ndepthWrite=" + depthWrite |
|
|
|
|
|
|
|
+ "\napplyDepthWrite=" + applyDepthWrite |
|
|
|
|
|
|
|
+ "\ndepthTest=" + depthTest |
|
|
|
|
|
|
|
+ "\napplyDepthTest=" + applyDepthTest |
|
|
|
|
|
|
|
+ "\ncolorWrite=" + colorWrite |
|
|
|
|
|
|
|
+ "\napplyColorWrite=" + applyColorWrite |
|
|
|
|
|
|
|
+ "\nblendMode=" + blendMode |
|
|
|
|
|
|
|
+ "\napplyBlendMode=" + applyBlendMode |
|
|
|
|
|
|
|
+ "\nalphaTest=" + alphaTest |
|
|
|
|
|
|
|
+ "\napplyAlphaTest=" + applyAlphaTest |
|
|
|
|
|
|
|
+ "\nalphaFallOff=" + alphaFallOff |
|
|
|
|
|
|
|
+ "\napplyAlphaFallOff=" + applyAlphaFallOff |
|
|
|
|
|
|
|
+ "\noffsetEnabled=" + offsetEnabled |
|
|
|
|
|
|
|
+ "\napplyPolyOffset=" + applyPolyOffset |
|
|
|
|
|
|
|
+ "\noffsetFactor=" + offsetFactor |
|
|
|
|
|
|
|
+ "\noffsetUnits=" + offsetUnits |
|
|
|
|
|
|
|
+ "\n]"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|