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
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumstatic enumNested 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
ConstructorsConstructorDescriptionConstructor instantiates a newBlendStateobject with default values. -
Method Summary
Modifier and TypeMethodDescriptiongetDestinationFunctionreturns the destination function for the blending function.getDestinationFunctionreturns the destination function for the blending function.floatgetReferencereturns the reference value that incoming alpha values are compared to.floatgetSourceFunctionreturns the source function for the blending function.getSourceFunctionreturns the source function for the blending function.getTestFunctionreturns the testing function used for the alpha testing.getType()booleanisBlendEnabledreturns true if blending is turned on, otherwise false is returned.booleanbooleanbooleanbooleanbooleanisTestEnabledreturns true if alpha testing is enabled, false otherwise.voidread(InputCapsule capsule) voidsetBlendEnabled(boolean value) setBlendEnabledsets whether or not blending is enabled.voidsetBlendEquation(BlendState.BlendEquation blendEquation) voidsetBlendEquationAlpha(BlendState.BlendEquation blendEquation) voidsetBlendEquationRGB(BlendState.BlendEquation blendEquation) voidsetConstantColor(ReadOnlyColorRGBA constantColor) voidsetDestinationFunctionsets the destination function for the blending equation for both Alpha and RGB values.voidsetDestinationFunctionAlphasets the destination function for the blending equation.voidsetDestinationFunctionRGBsets the destination function for the blending equation.voidsetReference(float reference) setReferencesets the reference value that incoming alpha values are compared to when doing alpha testing.voidsetSampleAlphaToCoverageEnabled(boolean sampleAlphaToCoverageEnabled) voidsetSampleAlphaToOneEnabled(boolean sampleAlphaToOneEnabled) voidsetSampleCoverage(float value) voidsetSampleCoverageEnabled(boolean sampleCoverageEnabled) voidsetSampleCoverageInverted(boolean sampleCoverageInverted) voidsetSourceFunction(BlendState.SourceFunction function) setSrcFunctionsets the source function for the blending equation for both rgb and alpha values.voidsetSourceFunctionAlphasets the source function for the blending equation used with alpha values.voidsetSrcFunctionsets the source function for the blending equation.voidsetTestEnabled(boolean value) setTestEnabledturns alpha testing on and off.voidsetTestFunction(BlendState.TestFunction function) setTestFunctionsets the testing function used for the alpha testing.voidwrite(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 newBlendStateobject with default values.
-
-
Method Details
-
getType
- Specified by:
getTypein classRenderState- Returns:
- An statetype enum value for the subclass.
- See Also:
-
isBlendEnabled
public boolean isBlendEnabled()isBlendEnabledreturns true if blending is turned on, otherwise false is returned.- Returns:
- true if blending is enabled, false otherwise.
-
setBlendEnabled
public void setBlendEnabled(boolean value) setBlendEnabledsets whether or not blending is enabled.- Parameters:
value- true to enable the blending, false to disable it.
-
setSourceFunction
setSrcFunctionsets 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
setSrcFunctionsets 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
setSourceFunctionAlphasets 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
getSourceFunctionreturns the source function for the blending function.- Returns:
- the source function for the blending function.
-
getSourceFunctionAlpha
getSourceFunctionreturns the source function for the blending function.- Returns:
- the source function for the blending function.
-
setDestinationFunction
setDestinationFunctionsets 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
setDestinationFunctionRGBsets 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
setDestinationFunctionAlphasets 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
getDestinationFunctionreturns the destination function for the blending function.- Returns:
- the destination function for the blending function.
-
getDestinationFunctionAlpha
getDestinationFunctionreturns the destination function for the blending function.- Returns:
- the destination function for the blending function.
-
setBlendEquation
-
setBlendEquationRGB
-
setBlendEquationAlpha
-
getBlendEquationRGB
-
getBlendEquationAlpha
-
isTestEnabled
public boolean isTestEnabled()isTestEnabledreturns true if alpha testing is enabled, false otherwise.- Returns:
- true if alpha testing is enabled, false otherwise.
-
setTestEnabled
public void setTestEnabled(boolean value) setTestEnabledturns 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
setTestFunctionsets 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
getTestFunctionreturns the testing function used for the alpha testing.- Returns:
- the testing function used for the alpha testing.
-
setReference
public void setReference(float reference) setReferencesets 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()getReferencereturns 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:
writein interfaceSavable- Overrides:
writein classRenderState- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Overrides:
readin classRenderState- Throws:
IOException
-
createStateRecord
- Specified by:
createStateRecordin classRenderState
-