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

sglTextureMatrix Class Reference

#include <sglStatelet.hpp>

Inheritance diagram for sglTextureMatrix::

sglTexturingStatelet sglStatelet sglObject List of all members.

Public Methods

 sglTextureMatrix (sglMat4f *tmat=NULL)
virtual ~sglTextureMatrix ()
void setTextureMatrix (sglMat4f *tmat)
const sglMat4f& getTextureMatrix () const
void applyToUnit (sglCurrState *, unsigned int) const
virtual bool getSorted () const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Detailed Description

In SGL, the modelview matrix is affected by sglBillboard, sglUnProject, sglUnScale, sglTransform, sglTranslate, and sglScale group nodes, and is accumulated as the scene graph is traversed during the cull operation. Currently, there is no analagous process for the texture matrix. Instead, a texture matrix can be set via the statelet mechanism using the sglTextureMatrix class. This statelet encapsulates the OpenGL's manipulation of the texture matrix [glMatrixMode(GL_TEXTURE)] for the various texture units. The matrix can be specified during construction by passing a pointer to an sglMat4f that has already been set to the desired value (the value is copied into the statelet). Subsequent changes to the matrix can be done by calling the sglTextureMatrix::setTextureMatrix(..). The statelet can be disabled by passing a NULL pointer when setting the matrix, or applying a matrix that is identity.

Example:

   sglMat4 mat;
   mat.buildRotation(0.f, 0.f, 1.f, M_PI*0.25f);

   sglTextureMatrix *tmat = new sglTextureMatrix(&mat);

   mat.buildTranslation(1.0, -2.0, 1.5);
   statelet->setTextureMatrix(&mat);

Definition at line 2343 of file sglStatelet.hpp.


Constructor & Destructor Documentation

sglTextureMatrix::sglTextureMatrix ( sglMat4f * tmat = NULL ) [inline]
 

Constructor (also the default constructor).

Parameters:
tmat   Pointer to an sglMat4f object containing the value of the texture matrix. If non-NULL, this matrix will get copied into the statelet. If NULL, then the matrix resets to identity (the default).

Definition at line 2352 of file sglStatelet.hpp.

sglTextureMatrix::~sglTextureMatrix ( ) [inline, virtual]
 

Virtual destructor.

Definition at line 2356 of file sglStatelet.hpp.


Member Function Documentation

void sglTextureMatrix::setTextureMatrix ( sglMat4f * tmat )
 

Set the current texture matrix value. Texturing must be enabled (above) for this matrix to have an effect.

Parameters:
tmat   Pointer to an sglMat4f object containing the value of the texture matrix. If non-NULL, this matrix will get copied into the statelet. If NULL, then the matrix resets to identity.

Referenced by sglTextureMatrix().

const sglMat4f & sglTextureMatrix::getTextureMatrix ( ) const [inline]
 

Query the current texture matrix stored in this statelet.

Returns:
Reference to the internally stored matrix.

Definition at line 2369 of file sglStatelet.hpp.

void sglTextureMatrix::applyToUnit ( sglCurrState * curr_state,
unsigned int unit ) const [virtual]
 

Apply this state change to the current rendering state for the given texture unit.

Parameters:
curr_state   Required for statelets that affect one another. For example the sglTransparency sets up depth mask and blending modes which interact with the sglBlending and sglDepthMask statelets, and the curr_state object is used to resolve these internal issues.
unit   Index for the texture unit (0 is the first).

Reimplemented from sglTexturingStatelet.

bool sglTextureMatrix::getSorted ( ) const [inline, virtual]
 

Query the sorting mode for this statelet.

Returns:
true if this type of statelet should be sorted by pointer rather than using m_index to index into an array. The defualt implementation is the latter, but if a statelet can take on an inordinate number of states (e.g. a floating point parameter) then true should be returned.

Reimplemented from sglStatelet.

Definition at line 2375 of file sglStatelet.hpp.

virtual void sglTextureMatrix::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglStatelet.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:10 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001