Package com.ardor3d.renderer.state
Class BlendState
java.lang.Object
com.ardor3d.renderer.state.RenderState
com.ardor3d.renderer.state.BlendState
- All Implemented Interfaces:
Savable
BlendState
maintains the state of the blending values of a particular node and its children. The blend
state provides a method for blending a source pixel with a destination pixel. The blend value provides a transparent
or translucent surfaces. For example, this would allow for the rendering of green glass. Where you could see all
objects behind this green glass but they would be tinted green.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static enum
static enum
Nested classes/interfaces inherited from class com.ardor3d.renderer.state.RenderState
RenderState.StateStack, RenderState.StateType
-
Field Summary
Fields inherited from class com.ardor3d.renderer.state.RenderState
_quickCompare
-
Constructor Summary
ConstructorDescriptionConstructor instantiates a newBlendState
object with default values. -
Method Summary
Modifier and TypeMethodDescriptiongetDestinationFunction
returns the destination function for the blending function.getDestinationFunction
returns the destination function for the blending function.float
getReference
returns the reference value that incoming alpha values are compared to.float
getSourceFunction
returns the source function for the blending function.getSourceFunction
returns the source function for the blending function.getTestFunction
returns the testing function used for the alpha testing.getType()
boolean
isBlendEnabled
returns true if blending is turned on, otherwise false is returned.boolean
boolean
boolean
boolean
boolean
isTestEnabled
returns true if alpha testing is enabled, false otherwise.void
read
(InputCapsule capsule) void
setBlendEnabled
(boolean value) setBlendEnabled
sets whether or not blending is enabled.void
setBlendEquation
(BlendState.BlendEquation blendEquation) void
setBlendEquationAlpha
(BlendState.BlendEquation blendEquation) void
setBlendEquationRGB
(BlendState.BlendEquation blendEquation) void
setConstantColor
(ReadOnlyColorRGBA constantColor) void
setDestinationFunction
sets the destination function for the blending equation for both Alpha and RGB values.void
setDestinationFunctionAlpha
sets the destination function for the blending equation.void
setDestinationFunctionRGB
sets the destination function for the blending equation.void
setReference
(float reference) setReference
sets the reference value that incoming alpha values are compared to when doing alpha testing.void
setSampleAlphaToCoverageEnabled
(boolean sampleAlphaToCoverageEnabled) void
setSampleAlphaToOneEnabled
(boolean sampleAlphaToOneEnabled) void
setSampleCoverage
(float value) void
setSampleCoverageEnabled
(boolean sampleCoverageEnabled) void
setSampleCoverageInverted
(boolean sampleCoverageInverted) void
setSourceFunction
(BlendState.SourceFunction function) setSrcFunction
sets the source function for the blending equation for both rgb and alpha values.void
setSourceFunctionAlpha
sets the source function for the blending equation used with alpha values.void
setSrcFunction
sets the source function for the blending equation.void
setTestEnabled
(boolean value) setTestEnabled
turns alpha testing on and off.void
setTestFunction
(BlendState.TestFunction function) setTestFunction
sets the testing function used for the alpha testing.void
write
(OutputCapsule capsule) Methods inherited from class com.ardor3d.renderer.state.RenderState
createState, extract, getClassTag, isEnabled, needsRefresh, setEnabled, setNeedsRefresh, setQuickCompares
-
Constructor Details
-
BlendState
public BlendState()Constructor instantiates a newBlendState
object with default values.
-
-
Method Details
-
getType
- Specified by:
getType
in classRenderState
- Returns:
- An statetype enum value for the subclass.
- See Also:
-
isBlendEnabled
public boolean isBlendEnabled()isBlendEnabled
returns true if blending is turned on, otherwise false is returned.- Returns:
- true if blending is enabled, false otherwise.
-
setBlendEnabled
public void setBlendEnabled(boolean value) setBlendEnabled
sets whether or not blending is enabled.- Parameters:
value
- true to enable the blending, false to disable it.
-
setSourceFunction
setSrcFunction
sets the source function for the blending equation for both rgb and alpha values.- Parameters:
function
- the source function for the blending equation.- Throws:
IllegalArgumentException
- if function is null
-
setSourceFunctionRGB
setSrcFunction
sets the source function for the blending equation. If supportsSeparateFunc is false, this value will be used for RGB and Alpha.- Parameters:
function
- the source function for the blending equation.- Throws:
IllegalArgumentException
- if function is null
-
setSourceFunctionAlpha
setSourceFunctionAlpha
sets the source function for the blending equation used with alpha values.- Parameters:
function
- the source function for the blending equation for alpha values.- Throws:
IllegalArgumentException
- if function is null
-
getSourceFunctionRGB
getSourceFunction
returns the source function for the blending function.- Returns:
- the source function for the blending function.
-
getSourceFunctionAlpha
getSourceFunction
returns the source function for the blending function.- Returns:
- the source function for the blending function.
-
setDestinationFunction
setDestinationFunction
sets the destination function for the blending equation for both Alpha and RGB values.- Parameters:
function
- the destination function for the blending equation.- Throws:
IllegalArgumentException
- if function is null
-
setDestinationFunctionRGB
setDestinationFunctionRGB
sets the destination function for the blending equation. If supportsSeparateFunc is false, this value will be used for RGB and Alpha.- Parameters:
function
- the destination function for the blending equation for RGB values.- Throws:
IllegalArgumentException
- if function is null
-
setDestinationFunctionAlpha
setDestinationFunctionAlpha
sets the destination function for the blending equation.- Parameters:
function
- the destination function for the blending equation for Alpha values.- Throws:
IllegalArgumentException
- if function is null
-
getDestinationFunctionRGB
getDestinationFunction
returns the destination function for the blending function.- Returns:
- the destination function for the blending function.
-
getDestinationFunctionAlpha
getDestinationFunction
returns the destination function for the blending function.- Returns:
- the destination function for the blending function.
-
setBlendEquation
-
setBlendEquationRGB
-
setBlendEquationAlpha
-
getBlendEquationRGB
-
getBlendEquationAlpha
-
isTestEnabled
public boolean isTestEnabled()isTestEnabled
returns true if alpha testing is enabled, false otherwise.- Returns:
- true if alpha testing is enabled, false otherwise.
-
setTestEnabled
public void setTestEnabled(boolean value) setTestEnabled
turns alpha testing on and off. True turns on the testing, while false diables it.- Parameters:
value
- true to enabled alpha testing, false to disable it.
-
setTestFunction
setTestFunction
sets the testing function used for the alpha testing. If an invalid value is passed, the default TF_ALWAYS is used.- Parameters:
function
- the testing function used for the alpha testing.- Throws:
IllegalArgumentException
- if function is null
-
getTestFunction
getTestFunction
returns the testing function used for the alpha testing.- Returns:
- the testing function used for the alpha testing.
-
setReference
public void setReference(float reference) setReference
sets the reference value that incoming alpha values are compared to when doing alpha testing. This is clamped to [0, 1].- Parameters:
reference
- the reference value that alpha values are compared to.
-
getReference
public float getReference()getReference
returns the reference value that incoming alpha values are compared to.- Returns:
- the reference value that alpha values are compared to.
-
getConstantColor
- Returns:
- the color used in constant blending functions. (0,0,0,0) is the default.
-
setConstantColor
-
isSampleAlphaToCoverageEnabled
public boolean isSampleAlphaToCoverageEnabled() -
setSampleAlphaToCoverageEnabled
public void setSampleAlphaToCoverageEnabled(boolean sampleAlphaToCoverageEnabled) -
isSampleAlphaToOneEnabled
public boolean isSampleAlphaToOneEnabled() -
setSampleAlphaToOneEnabled
public void setSampleAlphaToOneEnabled(boolean sampleAlphaToOneEnabled) -
isSampleCoverageEnabled
public boolean isSampleCoverageEnabled() -
setSampleCoverageEnabled
public void setSampleCoverageEnabled(boolean sampleCoverageEnabled) -
getSampleCoverage
public float getSampleCoverage() -
setSampleCoverage
public void setSampleCoverage(float value) - Parameters:
value
- new sample coverage value - must be in range [0f, 1f]- Throws:
IllegalArgumentException
- if value is not in correct range.
-
isSampleCoverageInverted
public boolean isSampleCoverageInverted() -
setSampleCoverageInverted
public void setSampleCoverageInverted(boolean sampleCoverageInverted) -
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classRenderState
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classRenderState
- Throws:
IOException
-
createStateRecord
- Specified by:
createStateRecord
in classRenderState
-