Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions

ColorScaleAttrib Class Reference

Applies a scale to colors in the scene graph and on vertices. More...

#include "colorScaleAttrib.h"

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

List of all members.

Public Member Functions

 CPT (RenderAttrib) set_scale(const LVecBase4 &scale) const
virtual TypeHandle force_init_type ()
const LVecBase4get_scale () const
 Returns the scale to be applied to colors.
virtual int get_slot () const
virtual TypeHandle get_type () const
bool has_alpha_scale () const
 Returns true if the ColorScaleAttrib has a non-identity scale in the alpha component (ignoring RGB), or false otherwise.
bool has_rgb_scale () const
 Returns true if the ColorScaleAttrib has a non-identity scale in the RGB components (ignoring alpha), or false otherwise.
bool has_scale () const
 Returns true if the ColorScaleAttrib has a non-identity scale, false otherwise (in which case it might be an off attrib or an identity attrib).
bool is_identity () const
 Returns true if the ColorScaleAttrib is an identity attrib, false if it is either an off attrib or it has a scale.
bool is_off () const
 Returns true if the ColorScaleAttrib will ignore any color scales inherited from above, false otherwise.
virtual bool lower_attrib_can_override () const
 Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact.
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_identity()
static CPT (RenderAttrib) make(const LVecBase4 &scale)
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make_off()
static int get_class_slot ()
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type ColorScaleAttrib.

Protected Member Functions

 ColorScaleAttrib (bool off, const LVecBase4 &scale)
 ColorScaleAttrib (const ColorScaleAttrib &copy)
 Use ColorScaleAttrib::make() to construct a new ColorScaleAttrib object.
virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived ColorScaleAttrib types to return a unique number indicating whether this ColorScaleAttrib is equivalent to the other one.
virtual CPT (RenderAttrib) invert_compose_impl(const RenderAttrib *other) const
virtual CPT (RenderAttrib) compose_impl(const RenderAttrib *other) const
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 ColorScaleAttrib.
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 ColorScaleAttrib is encountered in the Bam file.

Detailed Description

Applies a scale to colors in the scene graph and on vertices.

Definition at line 30 of file colorScaleAttrib.h.


Constructor & Destructor Documentation

ColorScaleAttrib::ColorScaleAttrib ( const ColorScaleAttrib copy) [inline, protected]

Use ColorScaleAttrib::make() to construct a new ColorScaleAttrib object.

Definition at line 23 of file colorScaleAttrib.I.


Member Function Documentation

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

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

This should return 0 if the two ColorScaleAttrib 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 ColorScaleAttrib objects whose get_type() functions return the same.

Reimplemented from RenderAttrib.

Definition at line 188 of file colorScaleAttrib.cxx.

References LVecBase4f::compare_to(), and is_off().

void ColorScaleAttrib::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 ColorScaleAttrib.

Reimplemented from RenderAttrib.

Definition at line 362 of file colorScaleAttrib.cxx.

References LVecBase3f::almost_equal(), LVecBase4f::almost_equal(), DatagramIterator::get_bool(), and LVecBase4f::read_datagram().

Referenced by make_from_bam().

size_t ColorScaleAttrib::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 210 of file colorScaleAttrib.cxx.

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

const LVecBase4 & ColorScaleAttrib::get_scale ( ) const [inline]
bool ColorScaleAttrib::has_alpha_scale ( ) const [inline]

Returns true if the ColorScaleAttrib has a non-identity scale in the alpha component (ignoring RGB), or false otherwise.

Definition at line 90 of file colorScaleAttrib.I.

bool ColorScaleAttrib::has_rgb_scale ( ) const [inline]

Returns true if the ColorScaleAttrib has a non-identity scale in the RGB components (ignoring alpha), or false otherwise.

Definition at line 78 of file colorScaleAttrib.I.

bool ColorScaleAttrib::has_scale ( ) const [inline]

Returns true if the ColorScaleAttrib has a non-identity scale, false otherwise (in which case it might be an off attrib or an identity attrib).

Definition at line 66 of file colorScaleAttrib.I.

bool ColorScaleAttrib::is_identity ( ) const [inline]

Returns true if the ColorScaleAttrib is an identity attrib, false if it is either an off attrib or it has a scale.

Definition at line 54 of file colorScaleAttrib.I.

Referenced by GraphicsStateGuardian::fetch_specified_part().

bool ColorScaleAttrib::is_off ( ) const [inline]

Returns true if the ColorScaleAttrib will ignore any color scales inherited from above, false otherwise.

This is not the same thing as !has_scale(); a ColorScaleAttrib may have the "off" flag set and also have another scale specified.

Definition at line 42 of file colorScaleAttrib.I.

Referenced by compare_to_impl(), and get_hash_impl().

bool ColorScaleAttrib::lower_attrib_can_override ( ) const [virtual]

Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact.

This should return false if a RenderAttrib on a higher node will compose into a RenderAttrib on a lower node that has a higher override value, or false if the lower RenderAttrib will completely replace the state.

The default behavior is false: normally, a RenderAttrib in the graph cannot completely override a RenderAttrib above it, regardless of its override value--instead, the two attribs are composed. But for some kinds of RenderAttribs, it is useful to allow this kind of override.

This method only handles the one special case of a lower RenderAttrib with a higher override value. If the higher RenderAttrib has a higher override value, it always completely overrides. And if both RenderAttribs have the same override value, they are always composed.

Reimplemented from RenderAttrib.

Definition at line 146 of file colorScaleAttrib.cxx.

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

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

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

Definition at line 343 of file colorScaleAttrib.cxx.

References fillin().

Referenced by register_with_read_factory().

void ColorScaleAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type ColorScaleAttrib.

Definition at line 313 of file colorScaleAttrib.cxx.

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

void ColorScaleAttrib::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 324 of file colorScaleAttrib.cxx.

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


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