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

TexMatrixAttrib Class Reference

Applies a transform matrix to UV's before they are rendered. More...

#include "texMatrixAttrib.h"

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

List of all members.

Classes

class  CompareTextureStagePointer
class  StageNode

Public Member Functions

virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
 CPT (RenderAttrib) add_stage(TextureStage *stage
 CPT (TransformState) get_transform(TextureStage *stage) const
 CPT (RenderAttrib) remove_stage(TextureStage *stage) const
virtual TypeHandle force_init_type ()
int get_geom_rendering (int geom_rendering) const
 Returns the union of the Geom::GeomRendering bits that will be required once this TexMatrixAttrib is applied to a geom which includes the indicated geom_rendering bits.
const LMatrix4get_mat () const
 Returns the transformation matrix associated with the default texture stage.
const LMatrix4get_mat (TextureStage *stage) const
 Returns the transformation matrix associated with the indicated texture stage, or identity matrix if nothing is associated with the indicated stage.
int get_num_stages () const
 Returns the number of stages that are represented by this attrib.
int get_override (TextureStage *stage) const
 Returns the override value associated with the indicated stage.
virtual int get_slot () const
TextureStageget_stage (int n) const
 Returns the nth stage that is represented by this attrib.
virtual TypeHandle get_type () const
bool has_stage (TextureStage *stage) const
 Returns true if there is a transform associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return the identity transform).
bool is_empty () const
 Returns true if no stages are defined in the TexMatrixAttrib, false if at least one is.
 MAKE_SEQ (get_stages, get_num_stages, get_stage)
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()
static CPT (RenderAttrib) make(const LMatrix4 &mat)
static CPT (RenderAttrib) make_default()
static CPT (RenderAttrib) make(TextureStage *stage
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 TexMatrixAttrib.

Public Attributes

const TransformState int override = 0) const
static const TransformStatetransform
const TransformStatetransform

Protected Member Functions

 TexMatrixAttrib ()
 Use TexMatrixAttrib::make() to construct a new TexMatrixAttrib object.
 TexMatrixAttrib (const TexMatrixAttrib &copy)
 Use TexMatrixAttrib::make() to construct a new TexMatrixAttrib object.
virtual int compare_to_impl (const RenderAttrib *other) const
 Intended to be overridden by derived TexMatrixAttrib types to return a unique number indicating whether this TexMatrixAttrib 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 TexMatrixAttrib.
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 TexMatrixAttrib is encountered in the Bam file.

Detailed Description

Applies a transform matrix to UV's before they are rendered.

Definition at line 33 of file texMatrixAttrib.h.


Constructor & Destructor Documentation

TexMatrixAttrib::TexMatrixAttrib ( ) [inline, protected]

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

Definition at line 23 of file texMatrixAttrib.I.

Referenced by make_from_bam().

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

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

Definition at line 33 of file texMatrixAttrib.I.


Member Function Documentation

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

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

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

Reimplemented from RenderAttrib.

Definition at line 249 of file texMatrixAttrib.cxx.

References ordered_vector< Key, Compare >::begin(), and ordered_vector< Key, Compare >::end().

int TexMatrixAttrib::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual]

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 540 of file texMatrixAttrib.cxx.

References get_stage(), ordered_vector< Key, Compare >::size(), and ov_set< Key, Compare >::sort().

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

Reimplemented from RenderAttrib.

Definition at line 587 of file texMatrixAttrib.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_int32(), DatagramIterator::get_uint16(), ordered_vector< Key, Compare >::push_back(), and BamReader::read_pointer().

Referenced by make_from_bam().

int TexMatrixAttrib::get_geom_rendering ( int  geom_rendering) const [inline]

Returns the union of the Geom::GeomRendering bits that will be required once this TexMatrixAttrib is applied to a geom which includes the indicated geom_rendering bits.

Definition at line 64 of file texMatrixAttrib.I.

References is_empty().

Referenced by RenderState::get_geom_rendering().

size_t TexMatrixAttrib::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 296 of file texMatrixAttrib.cxx.

References integer_hash< Key, Compare >::add_hash(), pointer_hash::add_hash(), ordered_vector< Key, Compare >::begin(), and ordered_vector< Key, Compare >::end().

const LMatrix4 & TexMatrixAttrib::get_mat ( ) const

Returns the transformation matrix associated with the default texture stage.

Definition at line 133 of file texMatrixAttrib.cxx.

References TextureStage::get_default().

Referenced by GeomNode::apply_attribs_to_vertices(), GeomTransformer::apply_texture_colors(), and GraphicsStateGuardian::fetch_specified_part().

const LMatrix4 & TexMatrixAttrib::get_mat ( TextureStage stage) const

Returns the transformation matrix associated with the indicated texture stage, or identity matrix if nothing is associated with the indicated stage.

Definition at line 194 of file texMatrixAttrib.cxx.

int TexMatrixAttrib::get_num_stages ( ) const

Returns the number of stages that are represented by this attrib.

Definition at line 169 of file texMatrixAttrib.cxx.

References ordered_vector< Key, Compare >::size().

Referenced by GeomNode::apply_attribs_to_vertices().

int TexMatrixAttrib::get_override ( TextureStage stage) const [inline]

Returns the override value associated with the indicated stage.

Definition at line 45 of file texMatrixAttrib.I.

References ordered_vector< Key, Compare >::end().

TextureStage * TexMatrixAttrib::get_stage ( int  n) const

Returns the nth stage that is represented by this attrib.

The TextureStages are in no particular order.

Definition at line 181 of file texMatrixAttrib.cxx.

References ordered_vector< Key, Compare >::size().

Referenced by GeomNode::apply_attribs_to_vertices(), and complete_pointers().

bool TexMatrixAttrib::has_stage ( TextureStage stage) const

Returns true if there is a transform associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return the identity transform).

Definition at line 157 of file texMatrixAttrib.cxx.

References ordered_vector< Key, Compare >::end().

Referenced by GeomTransformer::apply_texture_colors(), and NodePath::has_tex_transform().

bool TexMatrixAttrib::is_empty ( ) const

Returns true if no stages are defined in the TexMatrixAttrib, false if at least one is.

Definition at line 144 of file texMatrixAttrib.cxx.

References ordered_vector< Key, Compare >::empty().

Referenced by get_geom_rendering().

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

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

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

Definition at line 568 of file texMatrixAttrib.cxx.

References fillin(), and TexMatrixAttrib().

Referenced by register_with_read_factory().

void TexMatrixAttrib::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type TexMatrixAttrib.

Definition at line 506 of file texMatrixAttrib.cxx.

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

void TexMatrixAttrib::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 517 of file texMatrixAttrib.cxx.

References Datagram::add_int32(), Datagram::add_uint16(), ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), ordered_vector< Key, Compare >::size(), and BamWriter::write_pointer().


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