RDPipelineColorBlendStateAttachment

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 24 Imported by: 0

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

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 Any

type Any interface {
	gd.IsClass
	AsRDPipelineColorBlendStateAttachment() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRDPipelineColorBlendStateAttachment

func (self *Extension[T]) AsRDPipelineColorBlendStateAttachment() Instance

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

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 New

func New() Instance

func (Instance) AlphaBlendOp

func (self Instance) AlphaBlendOp() Rendering.BlendOperation

The blend mode to use for the alpha channel.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRDPipelineColorBlendStateAttachment

func (self Instance) AsRDPipelineColorBlendStateAttachment() Instance

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) ColorBlendOp

func (self Instance) ColorBlendOp() Rendering.BlendOperation

The blend mode to use for the red/green/blue color channels.

func (Instance) DstAlphaBlendFactor

func (self Instance) DstAlphaBlendFactor() Rendering.BlendFactor

Controls how the blend factor for the alpha channel is determined based on the destination's fragments.

func (Instance) DstColorBlendFactor

func (self Instance) DstColorBlendFactor() Rendering.BlendFactor

Controls how the blend factor for the color channels is determined based on the destination's fragments.

func (Instance) EnableBlend

func (self Instance) EnableBlend() bool

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.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) SetAlphaBlendOp

func (self Instance) SetAlphaBlendOp(value Rendering.BlendOperation)

SetAlphaBlendOp sets the property returned by [GetAlphaBlendOp].

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)

SetColorBlendOp sets the property returned by [GetColorBlendOp].

func (Instance) SetDstAlphaBlendFactor

func (self Instance) SetDstAlphaBlendFactor(value Rendering.BlendFactor)

SetDstAlphaBlendFactor sets the property returned by [GetDstAlphaBlendFactor].

func (Instance) SetDstColorBlendFactor

func (self Instance) SetDstColorBlendFactor(value Rendering.BlendFactor)

SetDstColorBlendFactor sets the property returned by [GetDstColorBlendFactor].

func (Instance) SetEnableBlend

func (self Instance) SetEnableBlend(value bool)

SetEnableBlend sets the property returned by [GetEnableBlend].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSrcAlphaBlendFactor

func (self Instance) SetSrcAlphaBlendFactor(value Rendering.BlendFactor)

SetSrcAlphaBlendFactor sets the property returned by [GetSrcAlphaBlendFactor].

func (Instance) SetSrcColorBlendFactor

func (self Instance) SetSrcColorBlendFactor(value Rendering.BlendFactor)

SetSrcColorBlendFactor sets the property returned by [GetSrcColorBlendFactor].

func (Instance) SetWriteA

func (self Instance) SetWriteA(value bool)

SetWriteA sets the property returned by [GetWriteA].

func (Instance) SetWriteB

func (self Instance) SetWriteB(value bool)

SetWriteB sets the property returned by [GetWriteB].

func (Instance) SetWriteG

func (self Instance) SetWriteG(value bool)

SetWriteG sets the property returned by [GetWriteG].

func (Instance) SetWriteR

func (self Instance) SetWriteR(value bool)

SetWriteR sets the property returned by [GetWriteR].

func (Instance) SrcAlphaBlendFactor

func (self Instance) SrcAlphaBlendFactor() Rendering.BlendFactor

Controls how the blend factor for the alpha channel is determined based on the source's fragments.

func (Instance) SrcColorBlendFactor

func (self Instance) SrcColorBlendFactor() Rendering.BlendFactor

Controls how the blend factor for the color channels is determined based on the source's fragments.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

func (Instance) WriteA

func (self Instance) WriteA() bool

If true, writes the new alpha channel to the final result.

func (Instance) WriteB

func (self Instance) WriteB() bool

If true, writes the new blue color channel to the final result.

func (Instance) WriteG

func (self Instance) WriteG() bool

If true, writes the new green color channel to the final result.

func (Instance) WriteR

func (self Instance) WriteR() bool

If true, writes the new red color channel to the final result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL