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

sglTranslate Class Template Reference

#include <sglTranslate.hpp>

Inheritance diagram for sglTranslate::

sglGroup sglNode sglObject List of all members.

Public Methods

 sglTranslate ()
virtual ~sglTranslate ()
void setTranslation (T x, T y, T z)
void getTranslation (T &x, T &y, T &z) const
virtual sglBound::IntersectResultEnum intersect (sglIntersectf &isector) const
virtual sglBound::IntersectResultEnum intersect (sglIntersectd &isector) const
virtual void pick (sglPickf &pick_state, unsigned int cull_flags) const
virtual void pick (sglPickd &pick_state, unsigned int cull_flags) const
virtual void computeTxToParent (sglMat4f &curr_mat) const
virtual void computeTxToParent (sglMat4d &curr_mat) const
virtual sglNodeclone (unsigned int mode) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Protected Methods

virtual void computeBound ()
virtual void cull (sglCull< float > &trav_state, unsigned int cull_flags) const
virtual void cull (sglCull< double > &trav_state, unsigned int cull_flags) const
void copyTo (sglTranslate *dst, unsigned int mode) const

Protected Attributes

bool m_no_translation_flag
sglVec3<T> m_translation

Detailed Description

template<class T> class sglTranslate

Like the sglTransform node, the sglTranslate node also modifies the model view matrix. When only a change in position is needed, it is more efficient to use an sglTranslate node instead of a more complex sglTransform node. As with the sglTransform nodes this can also be instantiated as single or double precision: sglTranslated or sglTranslatef.

Example:

   sglTranslated *dp_translate_node = new sglTranslated;
   dp_translate_node->setTranslation(0.0, 0.0, 25.0000001);
   dp_translate_node->addChild(...);

Definition at line 53 of file sglTranslate.hpp.


Constructor & Destructor Documentation

template<class T>
sglTranslate<T>::sglTranslate<T> ( ) [inline]
 

default constructor initializes to no translation.

Definition at line 57 of file sglTranslate.hpp.

template<class T>
sglTranslate<T>::~sglTranslate<T> ( ) [inline, virtual]
 

virtual destructor.

Definition at line 61 of file sglTranslate.hpp.


Member Function Documentation

template<class T>
void sglTranslate<T>::setTranslation ( T x,
T y,
T z )
 

Set the translation part of the transform (affects the 4th row of the matrix only).

Parameters:
x   Translation along the x axis.
y   Translation along the y axis.
z   Translation along the z axis.

template<class T>
void sglTranslate<T>::getTranslation ( T & x,
T & y,
T & z ) const
 

Get the current translation

Parameters:
x   Translation along the x axis.
y   Translation along the y axis.
z   Translation along the z axis.

template<class T>
virtual sglBound::IntersectResultEnum sglTranslate<T>::intersect ( sglIntersectf & isector ) const [virtual]
 

The single precision intersection traversal function which returns the closest object (bounding volume and/or triangle) that intersects with the given intersect segment.

Parameters:
isector   A reference to a single precision intersection state

Reimplemented from sglGroup.

template<class T>
virtual sglBound::IntersectResultEnum sglTranslate<T>::intersect ( sglIntersectd & isector ) const [virtual]
 

The double precision intersection traversal function which returns the closest object (bounding volume and/or triangle) that intersects with the given intersect segment.

Parameters:
isector   A reference to a double precision intersection state

Reimplemented from sglGroup.

template<class T>
virtual void sglTranslate<T>::pick ( sglPickf & pick_state,
unsigned int cull_flags ) const [virtual]
 

The single precision pick traversal function which returns all objects that fall within the pick frustum.

Parameters:
pick_state   A reference to a single precision pick state.
cull_flags   Bit flags that indicate which planes of the pick frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free picking can be accomplished by setting this to 0.

Reimplemented from sglGroup.

template<class T>
virtual void sglTranslate<T>::pick ( sglPickd & pick_state,
unsigned int cull_flags ) const [virtual]
 

The double precision pick traversal function which returns all objects that fall within the pick frustum.

Parameters:
pick_state   A reference to a double precision pick state.
cull_flags   Bit flags that indicate which planes of the pick frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free picking can be accomplished by setting this to 0.

Reimplemented from sglGroup.

template<class T>
virtual void sglTranslate<T>::computeTxToParent ( sglMat4f & curr_mat ) const [virtual]
 

Compute a single precision transform to parent and append (via multiplication) the matrix passed in. This is part of an upward traversal, which most commonly begins with an sglViewPlatform and used for computing the position and orientation of said platform. This is the default implementation for all nodes that do not affect this matrix and therefore this function does nothing.

Parameters:
curr_mat   The current view matrix for nodes below this one.

Reimplemented from sglNode.

template<class T>
virtual void sglTranslate<T>::computeTxToParent ( sglMat4d & curr_mat ) const [virtual]
 

Compute a double precision transform to parent and append (via multiplication) the matrix passed in. This is part of an upward traversal, which most commonly begins with an sglViewPlatform and used for computing the position and orientation of said platform. This is the default implementation for all nodes that do not affect this matrix and therefore this function does nothing.

Parameters:
curr_mat   The current view matrix for nodes below this one.

Reimplemented from sglNode.

template<class T>
virtual sglNode* sglTranslate<T>::clone ( unsigned int mode ) const [virtual]
 

Make a copy of the scenegraph rooted at this node.

Parameters:
mode   Bit masks to control the behaviour of the clone. These are OR-ed together from the mode values in sglObject::CloneModeEnum.
Returns:
Pointer to root of cloned scene graph.

Reimplemented from sglGroup.

template<class T>
virtual void sglTranslate<T>::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 sglGroup.

template<class T>
virtual void sglTranslate<T>::cull ( sglCull< float > & trav_state,
unsigned int cull_flags ) const [protected, virtual]
 

The single precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.

Parameters:
trav_state   The single precision traversal state that collects all the state and geometry information that passes the cull.
cull_flags   Bit flags that indicate which planes of the view frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free drawing can be accomplished with cull_flags = 0.

Reimplemented from sglGroup.

template<class T>
virtual void sglTranslate<T>::cull ( sglCull< double > & trav_state,
unsigned int cull_flags ) const [protected, virtual]
 

The double precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.

Parameters:
trav_state   The single precision traversal state that collects all the state and geometry information that passes the cull.
cull_flags   Bit flags that indicate which planes of the view frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free drawing can be accomplished with cull_flags = 0.

Reimplemented from sglGroup.


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