ColorBlendAttrib

class ColorBlendAttrib

Bases: RenderAttrib

This specifies how colors are blended into the frame buffer, for special effects. This overrides transparency if transparency is also specified.

Inheritance diagram

Inheritance diagram of ColorBlendAttrib

enum Mode
enumerator M_none = 0

Blending is disabled

enumerator M_add = 1

incoming color * A + fbuffer color * B

enumerator M_subtract = 2

incoming color * A - fbuffer color * B

enumerator M_inv_subtract = 3

fbuffer color * B - incoming color * A

enumerator M_min = 4

min(incoming color, fbuffer color)

enumerator M_max = 5

max(incoming color, fbuffer color)

enum Operand
enumerator O_zero = 0
enumerator O_one = 1
enumerator O_incoming_color = 2
enumerator O_one_minus_incoming_color = 3
enumerator O_fbuffer_color = 4
enumerator O_one_minus_fbuffer_color = 5
enumerator O_incoming_alpha = 6
enumerator O_one_minus_incoming_alpha = 7
enumerator O_fbuffer_alpha = 8
enumerator O_one_minus_fbuffer_alpha = 9
enumerator O_constant_color = 10
enumerator O_one_minus_constant_color = 11
enumerator O_constant_alpha = 12
enumerator O_one_minus_constant_alpha = 13
enumerator O_incoming_color_saturate = 14

valid only for operand a

enumerator O_incoming1_color = 15

The following are used for dual-source blending, where the fragment shader outputs a second color that will be used for blending.

enumerator O_one_minus_incoming1_color = 16
enumerator O_incoming1_alpha = 17
enumerator O_one_minus_incoming1_alpha = 18
enumerator O_color_scale = 19

These modes are being considered for deprecation.

enumerator O_one_minus_color_scale = 20
enumerator O_alpha_scale = 21
enumerator O_one_minus_alpha_scale = 22
Mode get_alpha_mode(void) const

Returns the blending mode for the alpha channel.

Operand get_alpha_operand_a(void) const

Returns the alpha multiplier for the first component.

Operand get_alpha_operand_b(void) const

Returns the alpha multiplier for the second component.

static int get_class_slot(void)
static TypeHandle get_class_type(void)
LColor get_color(void) const

Returns the constant color associated with the attrib.

Mode get_mode(void) const

Returns the blending mode for the RGB channels.

Operand get_operand_a(void) const

Returns the RGB multiplier for the first component.

Operand get_operand_b(void) const

Returns the RGB multiplier for the second component.

bool involves_color_scale(void) const
bool involves_color_scale(ColorBlendAttrib::Operand operand)

Returns true if the this attrib uses the color scale attrib, false otherwise.

Returns true if the indicated operand uses the color scale attrib, false otherwise.

bool involves_constant_color(void) const
bool involves_constant_color(ColorBlendAttrib::Operand operand)

Returns true if the this attrib uses the constant color, false otherwise.

Returns true if the indicated operand uses the constant color, false otherwise.

static ConstPointerTo<RenderAttrib> make(ColorBlendAttrib::Mode mode)
static ConstPointerTo<RenderAttrib> make(ColorBlendAttrib::Mode mode, Operand a, Operand b, LColor const &color = LColor::zero())
static ConstPointerTo<RenderAttrib> make(ColorBlendAttrib::Mode rgb_mode, Operand rgb_a, Operand rgb_b, Mode alpha_mode, Operand alpha_a, Operand alpha_b, LColor const &color = LColor::zero())

Constructs a new ColorBlendAttrib object.

Deprecated: Use the three- or four-parameter constructor instead.

Constructs a new ColorBlendAttrib object that enables special-effect blending. This supercedes transparency. The given mode and operands are used for both the RGB and alpha channels.

Constructs a new ColorBlendAttrib object that enables special-effect blending. This supercedes transparency. This form is used to specify separate blending parameters for the RGB and alpha channels.

static ConstPointerTo<RenderAttrib> make_default(void)

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

static ConstPointerTo<RenderAttrib> make_off(void)

Constructs a new ColorBlendAttrib object that disables special-effect blending, allowing normal transparency to be used instead.