Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions

ColorBlendAttrib Class Reference

This specifies how colors are blended into the frame buffer, for special effects. More...

#include "colorBlendAttrib.h"

Inheritance diagram for ColorBlendAttrib:
RenderAttrib TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Types

enum  Mode {
  M_none, M_add, M_subtract, M_inv_subtract,
  M_min, M_max
}
enum  Operand {
  O_zero, O_one, O_incoming_color, O_one_minus_incoming_color,
  O_fbuffer_color, O_one_minus_fbuffer_color, O_incoming_alpha, O_one_minus_incoming_alpha,
  O_fbuffer_alpha, O_one_minus_fbuffer_alpha, O_constant_color, O_one_minus_constant_color,
  O_constant_alpha, O_one_minus_constant_alpha, O_incoming_color_saturate, O_color_scale,
  O_one_minus_color_scale, O_alpha_scale, O_one_minus_alpha_scale
}

Public Member Functions

virtual TypeHandle force_init_type ()
LColor get_color () const
 Returns the constant color associated with the attrib.
Mode get_mode () const
 Returns the colorBlend mode.
Operand get_operand_a () const
 Returns the multiplier for the first component.
Operand get_operand_b () const
 Returns the multiplier for the second component.
virtual int get_slot () const
virtual TypeHandle get_type () const
bool involves_color_scale () const
 Returns true if the this attrib uses the color scale attrib, false otherwise.
bool involves_constant_color () const
 Returns true if the this attrib uses the constant color, false otherwise.
virtual void output (ostream &out) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

Static Public Member Functions

static CPT (RenderAttrib) make_off()
static CPT (RenderAttrib) make(Mode mode)
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make(Mode mode
static int get_class_slot ()
static TypeHandle get_class_type ()
static void init_type ()
static bool involves_color_scale (Operand operand)
 Returns true if the indicated operand uses the color scale attrib, false otherwise.
static bool involves_constant_color (Operand operand)
 Returns true if the indicated operand uses the constant color, false otherwise.
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type ColorBlendAttrib.

Public Attributes

static Operand a
static Operand Operand b
static Operand Operand const
LColor
color = LColor::zero())

Protected Member Functions

virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived ColorBlendAttrib types to return a unique number indicating whether this ColorBlendAttrib is equivalent to the other one.
virtual CPT (RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new ColorBlendAttrib.
virtual size_t get_hash_impl () const
 Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type ColorBlendAttrib is encountered in the Bam file.

Detailed Description

This specifies how colors are blended into the frame buffer, for special effects.

This overrides transparency if transparency is also specified.

Definition at line 30 of file colorBlendAttrib.h.


Member Function Documentation

int ColorBlendAttrib::compare_to_impl ( const RenderAttrib other) const [protected, virtual]

Intended to be overridden by derived ColorBlendAttrib types to return a unique number indicating whether this ColorBlendAttrib is equivalent to the other one.

This should return 0 if the two ColorBlendAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.

This will only be called with two ColorBlendAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 115 of file colorBlendAttrib.cxx.

References LVecBase4f::compare_to().

void ColorBlendAttrib::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new ColorBlendAttrib.

Reimplemented from RenderAttrib.

Definition at line 220 of file colorBlendAttrib.cxx.

References DatagramIterator::get_uint8(), involves_color_scale(), involves_constant_color(), and LVecBase4f::read_datagram().

Referenced by make_from_bam().

LColor ColorBlendAttrib::get_color ( ) const [inline]

Returns the constant color associated with the attrib.

Definition at line 88 of file colorBlendAttrib.I.

Referenced by TinyGraphicsStateGuardian::begin_draw_primitives().

size_t ColorBlendAttrib::get_hash_impl ( ) const [protected, virtual]

Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.

RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.

Reimplemented from RenderAttrib.

Definition at line 145 of file colorBlendAttrib.cxx.

References LVecBase4f::add_hash(), and integer_hash< Key, Compare >::add_hash().

ColorBlendAttrib::Mode ColorBlendAttrib::get_mode ( ) const [inline]
ColorBlendAttrib::Operand ColorBlendAttrib::get_operand_a ( ) const [inline]

Returns the multiplier for the first component.

Definition at line 68 of file colorBlendAttrib.I.

Referenced by TinyGraphicsStateGuardian::begin_draw_primitives(), and DXGraphicsStateGuardian8::do_issue_blending().

ColorBlendAttrib::Operand ColorBlendAttrib::get_operand_b ( ) const [inline]

Returns the multiplier for the second component.

Definition at line 78 of file colorBlendAttrib.I.

Referenced by TinyGraphicsStateGuardian::begin_draw_primitives(), and DXGraphicsStateGuardian8::do_issue_blending().

bool ColorBlendAttrib::involves_color_scale ( ColorBlendAttrib::Operand  operand) [inline, static]

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

Definition at line 141 of file colorBlendAttrib.I.

bool ColorBlendAttrib::involves_color_scale ( ) const [inline]

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

Definition at line 110 of file colorBlendAttrib.I.

Referenced by fillin().

bool ColorBlendAttrib::involves_constant_color ( ) const [inline]

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

Definition at line 99 of file colorBlendAttrib.I.

Referenced by fillin().

bool ColorBlendAttrib::involves_constant_color ( ColorBlendAttrib::Operand  operand) [inline, static]

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

Definition at line 121 of file colorBlendAttrib.I.

TypedWritable * ColorBlendAttrib::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type ColorBlendAttrib is encountered in the Bam file.

It should create the ColorBlendAttrib and extract its information from the file.

Definition at line 201 of file colorBlendAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

void ColorBlendAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type ColorBlendAttrib.

Definition at line 172 of file colorBlendAttrib.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void ColorBlendAttrib::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from RenderAttrib.

Definition at line 183 of file colorBlendAttrib.cxx.

References Datagram::add_uint8(), and LVecBase4f::write_datagram().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations