Documentation
¶
Overview ¶
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:
package main import ( "graphics.gd/classdb/RDPipelineColorBlendStateAttachment" "graphics.gd/classdb/Rendering" ) func ExampleBlendMix() { var attachment = RDPipelineColorBlendStateAttachment.New() attachment.SetEnableBlend(true) attachment.SetColorBlendOp(Rendering.BlendOpAdd) attachment.SetSrcColorBlendFactor(Rendering.BlendFactorSrcAlpha) attachment.SetDstColorBlendFactor(Rendering.BlendFactorOneMinusSrcAlpha) attachment.SetAlphaBlendOp(Rendering.BlendOpAdd) attachment.SetSrcAlphaBlendFactor(Rendering.BlendFactorOne) attachment.SetDstAlphaBlendFactor(Rendering.BlendFactorOneMinusSrcAlpha) }
Add:
package main import ( "graphics.gd/classdb/RDPipelineColorBlendStateAttachment" "graphics.gd/classdb/Rendering" ) func ExampleBlendAdd() { var attachment = RDPipelineColorBlendStateAttachment.New() attachment.SetEnableBlend(true) attachment.SetColorBlendOp(Rendering.BlendOpAdd) attachment.SetSrcColorBlendFactor(Rendering.BlendFactorOne) attachment.SetDstColorBlendFactor(Rendering.BlendFactorOne) attachment.SetAlphaBlendOp(Rendering.BlendOpAdd) attachment.SetSrcAlphaBlendFactor(Rendering.BlendFactorOne) attachment.SetDstAlphaBlendFactor(Rendering.BlendFactorOne) }
Subtract:
package main import ( "graphics.gd/classdb/RDPipelineColorBlendStateAttachment" "graphics.gd/classdb/Rendering" ) func ExampleBlendSubtract() { var attachment = RDPipelineColorBlendStateAttachment.New() attachment.SetEnableBlend(true) attachment.SetColorBlendOp(Rendering.BlendOpReverseSubtract) attachment.SetSrcColorBlendFactor(Rendering.BlendFactorOne) attachment.SetDstColorBlendFactor(Rendering.BlendFactorOne) attachment.SetAlphaBlendOp(Rendering.BlendOpReverseSubtract) attachment.SetSrcAlphaBlendFactor(Rendering.BlendFactorOne) attachment.SetDstAlphaBlendFactor(Rendering.BlendFactorOne) }
Multiply:
package main import ( "graphics.gd/classdb/RDPipelineColorBlendStateAttachment" "graphics.gd/classdb/Rendering" ) func ExampleBlendMultiply() { var attachment = RDPipelineColorBlendStateAttachment.New() attachment.SetEnableBlend(true) attachment.SetColorBlendOp(Rendering.BlendOpAdd) attachment.SetSrcColorBlendFactor(Rendering.BlendFactorDstColor) attachment.SetDstColorBlendFactor(Rendering.BlendFactorZero) attachment.SetAlphaBlendOp(Rendering.BlendOpAdd) attachment.SetSrcAlphaBlendFactor(Rendering.BlendFactorDstAlpha) attachment.SetDstAlphaBlendFactor(Rendering.BlendFactorZero) }
Pre-multiplied alpha:
package main import ( "graphics.gd/classdb/RDPipelineColorBlendStateAttachment" "graphics.gd/classdb/Rendering" ) func ExampleBlendPremultipliedAlpha() { var attachment = RDPipelineColorBlendStateAttachment.New() attachment.SetEnableBlend(true) attachment.SetColorBlendOp(Rendering.BlendOpAdd) attachment.SetSrcColorBlendFactor(Rendering.BlendFactorOne) attachment.SetDstColorBlendFactor(Rendering.BlendFactorOneMinusSrcAlpha) attachment.SetAlphaBlendOp(Rendering.BlendOpAdd) attachment.SetSrcAlphaBlendFactor(Rendering.BlendFactorOne) attachment.SetDstAlphaBlendFactor(Rendering.BlendFactorOneMinusSrcAlpha) }
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AlphaBlendOp() Rendering.BlendOperation
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRDPipelineColorBlendStateAttachment() Instance
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) ColorBlendOp() Rendering.BlendOperation
- func (self Instance) DstAlphaBlendFactor() Rendering.BlendFactor
- func (self Instance) DstColorBlendFactor() Rendering.BlendFactor
- func (self Instance) EnableBlend() bool
- func (self Instance) ID() ID
- func (self Instance) SetAlphaBlendOp(value Rendering.BlendOperation)
- func (self Instance) SetAsMix()
- func (self Instance) SetColorBlendOp(value Rendering.BlendOperation)
- func (self Instance) SetDstAlphaBlendFactor(value Rendering.BlendFactor)
- func (self Instance) SetDstColorBlendFactor(value Rendering.BlendFactor)
- func (self Instance) SetEnableBlend(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSrcAlphaBlendFactor(value Rendering.BlendFactor)
- func (self Instance) SetSrcColorBlendFactor(value Rendering.BlendFactor)
- func (self Instance) SetWriteA(value bool)
- func (self Instance) SetWriteB(value bool)
- func (self Instance) SetWriteG(value bool)
- func (self Instance) SetWriteR(value bool)
- func (self Instance) SrcAlphaBlendFactor() Rendering.BlendFactor
- func (self Instance) SrcColorBlendFactor() Rendering.BlendFactor
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) WriteA() bool
- func (self Instance) WriteB() bool
- func (self Instance) WriteG() bool
- func (self Instance) WriteR() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRDPipelineColorBlendStateAttachment ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.RDPipelineColorBlendStateAttachment
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AlphaBlendOp ¶
func (self Instance) AlphaBlendOp() Rendering.BlendOperation
func (Instance) AsRDPipelineColorBlendStateAttachment ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) ColorBlendOp ¶
func (self Instance) ColorBlendOp() Rendering.BlendOperation
func (Instance) DstAlphaBlendFactor ¶
func (self Instance) DstAlphaBlendFactor() Rendering.BlendFactor
func (Instance) DstColorBlendFactor ¶
func (self Instance) DstColorBlendFactor() Rendering.BlendFactor
func (Instance) EnableBlend ¶
func (Instance) SetAlphaBlendOp ¶
func (self Instance) SetAlphaBlendOp(value Rendering.BlendOperation)
func (Instance) SetAsMix ¶
func (self Instance) SetAsMix()
Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets EnableBlend to true, SrcColorBlendFactor to [Renderingdevice.BlendFactorSrcAlpha], DstColorBlendFactor to [Renderingdevice.BlendFactorOneMinusSrcAlpha], SrcAlphaBlendFactor to [Renderingdevice.BlendFactorSrcAlpha] and DstAlphaBlendFactor to [Renderingdevice.BlendFactorOneMinusSrcAlpha].
func (Instance) SetColorBlendOp ¶
func (self Instance) SetColorBlendOp(value Rendering.BlendOperation)
func (Instance) SetDstAlphaBlendFactor ¶
func (self Instance) SetDstAlphaBlendFactor(value Rendering.BlendFactor)
func (Instance) SetDstColorBlendFactor ¶
func (self Instance) SetDstColorBlendFactor(value Rendering.BlendFactor)
func (Instance) SetEnableBlend ¶
func (Instance) SetSrcAlphaBlendFactor ¶
func (self Instance) SetSrcAlphaBlendFactor(value Rendering.BlendFactor)
func (Instance) SetSrcColorBlendFactor ¶
func (self Instance) SetSrcColorBlendFactor(value Rendering.BlendFactor)
func (Instance) SrcAlphaBlendFactor ¶
func (self Instance) SrcAlphaBlendFactor() Rendering.BlendFactor
func (Instance) SrcColorBlendFactor ¶
func (self Instance) SrcColorBlendFactor() Rendering.BlendFactor