class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectRefCounted RDPipelineColorBlendStateAttachment
Pipeline color blend state attachment (used by RenderingDevice).
Controls how blending between source and destination fragments is performed when using RenderingDevice.
For reference, this is how common user-facing blend modes are implemented in Godot's 2D renderer:
Mix:
var attachment = RDPipelineColorBlendStateAttachment.new() attachment.enable_blend = true attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
Add:
var attachment = RDPipelineColorBlendStateAttachment.new() attachment.enable_blend = true attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
Subtract:
var attachment = RDPipelineColorBlendStateAttachment.new() attachment.enable_blend = true attachment.alpha_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT attachment.color_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
Multiply:
var attachment = RDPipelineColorBlendStateAttachment.new() attachment.enable_blend = true attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_DST_COLOR attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_DST_ALPHA attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
Pre-multiplied alpha:
var attachment = RDPipelineColorBlendStateAttachment.new() attachment.enable_blend = true attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
set get int alpha_blend_op<>():int set get
The blend mode to use for the alpha channel.

set get int color_blend_op<>():int set get
The blend mode to use for the red/green/blue color channels.

set get int dst_alpha_blend_factor<>():int set get
Controls how the blend factor for the alpha channel is determined based on the destination's fragments.

set get int dst_color_blend_factor<>():int set get
Controls how the blend factor for the color channels is determined based on the destination's fragments.

set get bool enable_blend<>():bool set get
If true, performs blending between the source and destination according to the factors defined in src_color_blend_factor, dst_color_blend_factor, src_alpha_blend_factor and dst_alpha_blend_factor. The blend modes color_blend_op and alpha_blend_op are also taken into account, with write_r, write_g, write_b and write_a controlling the output.

set get int src_alpha_blend_factor<>():int set get
Controls how the blend factor for the alpha channel is determined based on the source's fragments.

set get int src_color_blend_factor<>():int set get
Controls how the blend factor for the color channels is determined based on the source's fragments.

set get bool write_a<>():bool set get
If true, writes the new alpha channel to the final result.

set get bool write_b<>():bool set get
If true, writes the new blue color channel to the final result.

set get bool write_g<>():bool set get
If true, writes the new green color channel to the final result.

set get bool write_r<>():bool set get
If true, writes the new red color channel to the final result.

void set_as_mix<>():void
Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets enable_blend to true, src_color_blend_factor to [constant RenderingDevice.BLEND_FACTOR_SRC_ALPHA], dst_color_blend_factor to [constant RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA], src_alpha_blend_factor to [constant RenderingDevice.BLEND_FACTOR_SRC_ALPHA] and dst_alpha_blend_factor to [constant RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA].




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...