Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

GeomTransformer Class Reference

An object specifically designed to transform the vertices of a Geom without disturbing indexing or affecting any other Geoms that may share the same vertex arrays, and without needlessly wasting memory when different Geoms sharing the same vertex arrays are transformed by the same amount. More...

#include <geomTransformer.h>

List of all members.

Public Member Functions

 GeomTransformer ()
 ~GeomTransformer ()
bool transform_vertices (Geom *geom, const LMatrix4f &mat)
 Transforms the vertices and the normals in the indicated Geom by the indicated matrix.

bool transform_vertices (GeomNode *node, const LMatrix4f &mat)
 Transforms the vertices and the normals in all of the Geoms within the indicated GeomNode by the indicated matrix.

bool transform_texcoords (Geom *geom, const LMatrix4f &mat)
 Transforms the texture coordinates in the indicated Geom by the indicated matrix.

bool transform_texcoords (GeomNode *node, const LMatrix4f &mat)
 Transforms the texture coordinates in all of the Geoms within the indicated GeomNode by the indicated matrix.

bool set_color (Geom *geom, const Colorf &color)
 Overrides the color indicated within the Geom with the given replacement color.

bool set_color (GeomNode *node, const Colorf &color)
 Overrides the color indicated within the GeomNode with the given replacement color.

bool transform_colors (Geom *geom, const LVecBase4f &scale)
 Transforms the colors in the indicated Geom by the indicated scale.

bool transform_colors (GeomNode *node, const LVecBase4f &scale)
 Transforms the colors in all of the Geoms within the indicated GeomNode by the indicated scale.

bool apply_state (GeomNode *node, const RenderState *state)
 Applies the indicated render state to all the of Geoms.


Private Types

typedef pmap< SourceVertices,
PTA_Vertexf
Vertices
typedef pmap< SourceNormals,
PTA_Normalf
Normals
typedef pmap< SourceTexCoords,
PTA_TexCoordf
TexCoords
typedef pmap< Colorf, PTA_ColorfFColors
typedef pmap< SourceColors,
PTA_Colorf
TColors

Private Attributes

Vertices _vertices
Normals _normals
TexCoords _texcoords
FColors _fcolors
TColors _tcolors


Detailed Description

An object specifically designed to transform the vertices of a Geom without disturbing indexing or affecting any other Geoms that may share the same vertex arrays, and without needlessly wasting memory when different Geoms sharing the same vertex arrays are transformed by the same amount.

If you create a single GeomTransformer and use it to transform a number of different Geoms by various transformations, then those Geoms which happen to share the same arrays and are transformed by the same amounts will still share the same arrays as each other (but different from the original arrays).

Definition at line 63 of file geomTransformer.h.


Member Typedef Documentation

typedef pmap<Colorf, PTA_Colorf> GeomTransformer::FColors [private]
 

Definition at line 117 of file geomTransformer.h.

typedef pmap<SourceNormals, PTA_Normalf> GeomTransformer::Normals [private]
 

Definition at line 100 of file geomTransformer.h.

typedef pmap<SourceColors, PTA_Colorf> GeomTransformer::TColors [private]
 

Definition at line 127 of file geomTransformer.h.

typedef pmap<SourceTexCoords, PTA_TexCoordf> GeomTransformer::TexCoords [private]
 

Definition at line 110 of file geomTransformer.h.

typedef pmap<SourceVertices, PTA_Vertexf> GeomTransformer::Vertices [private]
 

Definition at line 90 of file geomTransformer.h.


Constructor & Destructor Documentation

GeomTransformer::GeomTransformer  ) 
 

Definition at line 34 of file geomTransformer.cxx.

GeomTransformer::~GeomTransformer  ) 
 

Definition at line 45 of file geomTransformer.cxx.

References PointerToArray< Vertexf >::empty(), Geom::get_coords(), nassertr, and NULL.


Member Function Documentation

bool GeomTransformer::apply_state GeomNode node,
const RenderState state
 

Applies the indicated render state to all the of Geoms.

Returns true if the GeomNode was changed, false otherwise.

Definition at line 427 of file geomTransformer.cxx.

bool GeomTransformer::set_color GeomNode node,
const Colorf color
 

Overrides the color indicated within the GeomNode with the given replacement color.

Returns true if any Geom in the GeomNode was changed, false otherwise.

Definition at line 304 of file geomTransformer.cxx.

References Colorf.

bool GeomTransformer::set_color Geom geom,
const Colorf color
 

Overrides the color indicated within the Geom with the given replacement color.

Returns true if the Geom was changed, false otherwise.

Definition at line 272 of file geomTransformer.cxx.

Referenced by GeomNode::~GeomNode().

bool GeomTransformer::transform_colors GeomNode node,
const LVecBase4f &  scale
 

Transforms the colors in all of the Geoms within the indicated GeomNode by the indicated scale.

Does not destructively change Geoms; instead, a copy will be made of each Geom to be changed, in case multiple GeomNodes reference the same Geom. Returns true if the GeomNode was changed, false otherwise.

Definition at line 396 of file geomTransformer.cxx.

bool GeomTransformer::transform_colors Geom geom,
const LVecBase4f &  scale
 

Transforms the colors in the indicated Geom by the indicated scale.

Returns true if the Geom was changed, false otherwise.

Definition at line 334 of file geomTransformer.cxx.

References GeomNode::_cycler, GeomNode::GeomEntry::_geom, and PT.

bool GeomTransformer::transform_texcoords GeomNode node,
const LMatrix4f &  mat
 

Transforms the texture coordinates in all of the Geoms within the indicated GeomNode by the indicated matrix.

Does not destructively change Geoms; instead, a copy will be made of each Geom to be changed, in case multiple GeomNodes reference the same Geom. Returns true if the GeomNode was changed, false otherwise.

Definition at line 241 of file geomTransformer.cxx.

bool GeomTransformer::transform_texcoords Geom geom,
const LMatrix4f &  mat
 

Transforms the texture coordinates in the indicated Geom by the indicated matrix.

Returns true if the Geom was changed, false otherwise.

Definition at line 179 of file geomTransformer.cxx.

bool GeomTransformer::transform_vertices GeomNode node,
const LMatrix4f &  mat
 

Transforms the vertices and the normals in all of the Geoms within the indicated GeomNode by the indicated matrix.

Does not destructively change Geoms; instead, a copy will be made of each Geom to be changed, in case multiple GeomNodes reference the same Geom. Returns true if the GeomNode was changed, false otherwise.

Definition at line 148 of file geomTransformer.cxx.

References GeomTransformer::SourceTexCoords::_mat, _texcoords, GeomTransformer::SourceTexCoords::_texcoords, PointerToArray< TexCoordf >::begin(), PointerToArray< TexCoordf >::end(), G_OFF, GeomBindType, Geom::get_texcoords(), PointerToBase< RefCountObj< pvector< TexCoordf > > >::is_null(), nassertr, NULL, PointerToArray< TexCoordf >::reserve(), PointerToArray< TexCoordf >::size(), and TexCoordf.

bool GeomTransformer::transform_vertices Geom geom,
const LMatrix4f &  mat
 

Transforms the vertices and the normals in the indicated Geom by the indicated matrix.

Returns true if the Geom was changed, false otherwise.

Definition at line 61 of file geomTransformer.cxx.

References _vertices, PointerToArray< Vertexf >::begin(), PointerToArray< Vertexf >::end(), nassertr, PointerToArray< Vertexf >::push_back(), PointerToArray< Vertexf >::reserve(), and PointerToArray< Vertexf >::size().

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


Member Data Documentation

FColors GeomTransformer::_fcolors [private]
 

Definition at line 118 of file geomTransformer.h.

Normals GeomTransformer::_normals [private]
 

Definition at line 101 of file geomTransformer.h.

TColors GeomTransformer::_tcolors [private]
 

Definition at line 128 of file geomTransformer.h.

TexCoords GeomTransformer::_texcoords [private]
 

Definition at line 111 of file geomTransformer.h.

Referenced by transform_vertices().

Vertices GeomTransformer::_vertices [private]
 

Definition at line 91 of file geomTransformer.h.

Referenced by transform_vertices().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:51:03 2003 for Panda by doxygen1.3