API Reference

Class List

BlendState

BlendState is a descriptor that defines how output of fragment shader is written and blended into render target. A blend state can be set on a material using Material#blendState, or in some cases on the graphics device using GraphicsDevice#setBlendState.

For the best performance, do not modify blend state after it has been created, but create multiple blend states and assign them to the material or graphics device as needed.

Summary

Static Properties

ALPHABLEND

A blend state that does simple translucency using alpha channel.[read only]

NOBLEND

A blend state that has blending disabled and writes to all color channels.[read only]

NOWRITE

A blend state that does not write to color channels.[read only]

Properties

blend

Enables or disables blending.

Methods

clone

Returns an identical copy of the specified blend state.

copy

Copies the contents of a source blend state to this blend state.

equals

Reports whether two BlendStates are equal.

Details

Static Properties

ALPHABLEND

A blend state that does simple translucency using alpha channel.

[read only]
NOBLEND

A blend state that has blending disabled and writes to all color channels.

[read only]
NOWRITE

A blend state that does not write to color channels.

[read only]

Constructor

BlendState([blend], [colorOp], [colorSrcFactor], [colorDstFactor], [alphaOp], [alphaSrcFactor], [alphaDstFactor], [redWrite], [greenWrite], [blueWrite], [alphaWrite])

Create a new BlendState instance.

All factor parameters can take the following values:

All op parameters can take the following values:

Note that MIN and MAX operations on WebGL platform require either EXT_blend_minmax or WebGL2 to work (check device.extBlendMinmax).

Parameters

blendboolean

Enables or disables blending. Defaults to false.

colorOpnumber

Configures color blending operation. Defaults to BLENDEQUATION_ADD.

colorSrcFactornumber

Configures source color blending factor. Defaults to BLENDMODE_ONE.

colorDstFactornumber

Configures destination color blending factor. Defaults to BLENDMODE_ZERO.

alphaOpnumber

Configures alpha blending operation. Defaults to BLENDEQUATION_ADD.

alphaSrcFactornumber

Configures source alpha blending factor. Defaults to BLENDMODE_ONE.

alphaDstFactornumber

Configures destination alpha blending factor. Defaults to BLENDMODE_ZERO.

redWriteboolean

True to enable writing of the red channel and false otherwise. Defaults to true.

greenWriteboolean

True to enable writing of the green channel and false otherwise. Defaults to true.

blueWriteboolean

True to enable writing of the blue channel and false otherwise. Defaults to true.

alphaWriteboolean

True to enable writing of the alpha channel and false otherwise. Defaults to true.

Properties

booleanblend

Enables or disables blending.

Methods

clone()

Returns an identical copy of the specified blend state.

Returns

this

The result of the cloning.

copy(rhs)

Copies the contents of a source blend state to this blend state.

Parameters

rhsBlendState

A blend state to copy from.

Returns

BlendState

Self for chaining.

equals(rhs)

Reports whether two BlendStates are equal.

Parameters

rhsBlendState

The blend state to compare to.

Returns

boolean

True if the blend states are equal and false otherwise.