Class RDPipelineColorBlendStateAttachment
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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_ALPHAAdd:
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_ONESubtract:
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_ONEMultiply:
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_ZEROPre-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_ALPHApublic class RDPipelineColorBlendStateAttachment : RefCounted, IDisposable- Inheritance
- 
      
      
      
      RDPipelineColorBlendStateAttachment
- Implements
- Inherited Members
Constructors
RDPipelineColorBlendStateAttachment()
public RDPipelineColorBlendStateAttachment()Properties
AlphaBlendOp
The blend mode to use for the alpha channel.
public RenderingDevice.BlendOperation AlphaBlendOp { get; set; }Property Value
ColorBlendOp
The blend mode to use for the red/green/blue color channels.
public RenderingDevice.BlendOperation ColorBlendOp { get; set; }Property Value
DstAlphaBlendFactor
Controls how the blend factor for the alpha channel is determined based on the destination's fragments.
public RenderingDevice.BlendFactor DstAlphaBlendFactor { get; set; }Property Value
DstColorBlendFactor
Controls how the blend factor for the color channels is determined based on the destination's fragments.
public RenderingDevice.BlendFactor DstColorBlendFactor { get; set; }Property Value
EnableBlend
If true, performs blending between the source and destination according to the factors defined in SrcColorBlendFactor, DstColorBlendFactor, SrcAlphaBlendFactor and DstAlphaBlendFactor. The blend modes ColorBlendOp and AlphaBlendOp are also taken into account, with WriteR, WriteG, WriteB and WriteA controlling the output.
public bool EnableBlend { get; set; }Property Value
SrcAlphaBlendFactor
Controls how the blend factor for the alpha channel is determined based on the source's fragments.
public RenderingDevice.BlendFactor SrcAlphaBlendFactor { get; set; }Property Value
SrcColorBlendFactor
Controls how the blend factor for the color channels is determined based on the source's fragments.
public RenderingDevice.BlendFactor SrcColorBlendFactor { get; set; }Property Value
WriteA
If true, writes the new alpha channel to the final result.
public bool WriteA { get; set; }Property Value
WriteB
If true, writes the new blue color channel to the final result.
public bool WriteB { get; set; }Property Value
WriteG
If true, writes the new green color channel to the final result.
public bool WriteG { get; set; }Property Value
WriteR
If true, writes the new red color channel to the final result.
public bool WriteR { get; set; }Property Value
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)Parameters
- methodgodot_string_name
- Name of the method to check for. 
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)Parameters
- signalgodot_string_name
- Name of the signal to check for. 
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)Parameters
- methodgodot_string_name
- Name of the method to invoke. 
- argsNativeVariantPtrArgs
- Arguments to use with the invoked method. 
- retgodot_variant
- Value returned by the invoked method. 
Returns
SetAsMix()
Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets EnableBlend to true, SrcColorBlendFactor to SrcAlpha, DstColorBlendFactor to OneMinusSrcAlpha, SrcAlphaBlendFactor to SrcAlpha and DstAlphaBlendFactor to OneMinusSrcAlpha.
public void SetAsMix()