Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

RDPipelineColorBlendStateAttachment

Eredita: RefCounted < Object

Allegato allo stato di fusione dei colori della pipeline (utilizzato da RenderingDevice).

Descrizione

Controlla come viene effettuata la fusione tra i frammenti di origine e destinazione quando si utilizza RenderingDevice.

Per riferimento, ecco come sono implementate le modalità comuni di fusione per gli utenti nel renderer 2D di Godot:

Mescola:

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

Aggiungi:

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

Sottrai:

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

Moltiplica:

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

Alfa premultiplicato:

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

Proprietà

BlendOperation

alpha_blend_op

0

BlendOperation

color_blend_op

0

BlendFactor

dst_alpha_blend_factor

0

BlendFactor

dst_color_blend_factor

0

bool

enable_blend

false

BlendFactor

src_alpha_blend_factor

0

BlendFactor

src_color_blend_factor

0

bool

write_a

true

bool

write_b

true

bool

write_g

true

bool

write_r

true

Metodi

void

set_as_mix()


Descrizioni delle proprietà

BlendOperation alpha_blend_op = 0 🔗

La modalità di fusione da usare per il canale alfa.


BlendOperation color_blend_op = 0 🔗

La modalità di fusione da usare per i canali di colore rosso/verde/blu.


BlendFactor dst_alpha_blend_factor = 0 🔗

Controlla il modo in cui il fattore di fusione per il canale alfa è determinato in base ai frammenti della destinazione.


BlendFactor dst_color_blend_factor = 0 🔗

Controlla il modo in cui il fattore di fusione per i canali di colore è determinato in base ai frammenti di destinazione.


bool enable_blend = false 🔗

  • void set_enable_blend(value: bool)

  • bool get_enable_blend()

Se true, effettua la fusione tra la sorgente e la destinazione in base ai fattori definiti in src_color_blend_factor, dst_color_blend_factor, src_alpha_blend_factor e dst_alpha_blend_factor. Sono prese in considerazione anche le modalità di fusione color_blend_op e alpha_blend_op, con write_r, write_g, write_b e write_a che controllano il risultato.


BlendFactor src_alpha_blend_factor = 0 🔗

Controlla il modo in cui il fattore di fusione per il canale alfa è determinato in base ai frammenti della sorgente.


BlendFactor src_color_blend_factor = 0 🔗

Controlla il modo in cui il fattore di fusione per i canali di colore è determinato in base ai frammenti della sorgente.


bool write_a = true 🔗

  • void set_write_a(value: bool)

  • bool get_write_a()

Se true, scrive il nuovo canale alfa al risultato finale.


bool write_b = true 🔗

  • void set_write_b(value: bool)

  • bool get_write_b()

Se true, scrive il nuovo canale di colore blu al risultato finale.


bool write_g = true 🔗

  • void set_write_g(value: bool)

  • bool get_write_g()

Se true, scrive il nuovo canale di colore verde al risultato finale.


bool write_r = true 🔗

  • void set_write_r(value: bool)

  • bool get_write_r()

Se true, scrive il nuovo canale di colore rosso al risultato finale.


Descrizioni dei metodi

void set_as_mix() 🔗

Metodo di convenienza per effettuare la fusione standard con alfa retto (non premoltiplicato). Questo imposta enable_blend su true, src_color_blend_factor su RenderingDevice.BLEND_FACTOR_SRC_ALPHA, dst_color_blend_factor su RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, src_alpha_blend_factor su RenderingDevice.BLEND_FACTOR_SRC_ALPHA e dst_alpha_blend_factor su RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA.