Create a new BlendState instance.
All factor parameters can take the following values:
All op parameters can take the following values:
Optionalblend: boolean = false
Enables or disables blending. Defaults to false.
OptionalcolorOp: number = BLENDEQUATION_ADD
Configures color blending operation. Defaults to BLENDEQUATION_ADD.
OptionalcolorSrcFactor: number = BLENDMODE_ONE
Configures source color blending factor. Defaults to BLENDMODE_ONE.
OptionalcolorDstFactor: number = BLENDMODE_ZERO
Configures destination color blending factor. Defaults to BLENDMODE_ZERO.
OptionalalphaOp: number
Configures alpha blending operation. Defaults to BLENDEQUATION_ADD.
OptionalalphaSrcFactor: number
Configures source alpha blending factor. Defaults to BLENDMODE_ONE.
OptionalalphaDstFactor: number
Configures destination alpha blending factor. Defaults to BLENDMODE_ZERO.
OptionalredWrite: boolean = true
True to enable writing of the red channel and false otherwise. Defaults to true.
OptionalgreenWrite: boolean = true
True to enable writing of the green channel and false otherwise. Defaults to true.
OptionalblueWrite: boolean = true
True to enable writing of the blue channel and false otherwise. Defaults to true.
OptionalalphaWrite: boolean = true
True to enable writing of the alpha channel and false otherwise. Defaults to true.
Static ReadonlyADDBLENDA blend state that does simple additive blending.
Static ReadonlyALPHABLENDA blend state that does simple translucency using alpha channel.
Static ReadonlyNOBLENDA blend state that has blending disabled and writes to all color channels.
Static ReadonlyNOWRITEA blend state that does not write to color channels.
Gets whether blending is enabled.
Sets whether blending is enabled.
Gets whether any color attachment has been given an independent blend state using BlendState#setAttachment.
Removes the independent blend state of the specified color attachment, making it follow attachment 0 again.
The index of the color attachment, in 1 to 7 range.
Returns an identical copy of the specified blend state.
The result of the cloning.
Copies the contents of a source blend state to this blend state.
A blend state to copy from.
Self for chaining.
Reports whether two BlendStates are equal.
The blend state to compare to.
True if the blend states are equal and false otherwise.
Stores the blend state of the specified color attachment in the supplied blend state. When the attachment does not have an independent blend state, the state of attachment 0 is stored.
The index of the color attachment, in 0 to 7 range.
The blend state to store the result in. This avoids allocations, as a single instance can be reused.
The supplied dst, for chaining.
Assigns an independent blend state to the specified color attachment. The blend state of the supplied source is copied, and so subsequent changes to either the source or to attachment 0 do not affect it. An attachment which has not been assigned an independent state instead follows attachment 0.
Note that this requires GraphicsDevice#supportsIndependentBlending - on devices without support, the state of attachment 0 is used for all attachments.
The index of the color attachment, in 1 to 7 range. Attachment 0 is configured using the other functions and properties of this class.
The blend state to copy from, or null to make the attachment follow attachment 0 again.
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.
By default the blend state applies to all color attachments of the render target. When multiple color attachments are used, individual attachments can be given an independent blend state using BlendState#setAttachment. This requires GraphicsDevice#supportsIndependentBlending - on devices without support, the state of the attachment 0 is used for all attachments.