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

osg::Transform Class Reference

A Transform is a group node for which all children are transformed by a 4x4 matrix. More...

Inheritance diagram for osg::Transform:

Inheritance graph
[legend]
List of all members.

Public Types

enum  ReferenceFrame { RELATIVE_TO_PARENTS, RELATIVE_TO_ABSOLUTE }

Public Methods

 Transform ()
 Transform (const Transform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.

 META_Node (osg, Transform)
void setReferenceFrame (ReferenceFrame rf)
 Set the transform's ReferenceFrame, either to be relative to its parent reference frame, or relative to an absolute coordinate frame.

const ReferenceFrame getReferenceFrame () const
void setComputeTransformCallback (ComputeTransformCallback *ctc)
 Set the ComputerTransfromCallback which allows users to attach custom computation of the local transformation as seen by cull traversers and the like.

ComputeTransformCallbackgetComputeTransformCallback ()
 Get the non const ComputerTransfromCallback.

const ComputeTransformCallbackgetComputeTransformCallback () const
 Get the const ComputerTransfromCallback.

const bool getLocalToWorldMatrix (Matrix &matrix, NodeVisitor *nv) const
 Get the transformation matrix which moves from local coords to world coords.

const bool getWorldToLocalMatrix (Matrix &matrix, NodeVisitor *nv) const
 Get the transformation matrix which moves from world coords to local coords.

virtual const bool computeLocalToWorldMatrix (Matrix &matrix, NodeVisitor *) const
virtual const bool computeWorldToLocalMatrix (Matrix &matrix, NodeVisitor *) const

Protected Methods

virtual ~Transform ()
virtual const bool computeBound () const
 Overrides Group's computeBound.


Protected Attributes

ref_ptr< ComputeTransformCallback_computeTransformCallback
ReferenceFrame _referenceFrame

Detailed Description

A Transform is a group node for which all children are transformed by a 4x4 matrix.

It is often used for positioning objects within a scene, producing trackball functionality or for animation.

Transform itself does not provide set/get functions, only the interface for defining what the 4x4 transformation is. Subclasses, such as MatrixTransform and PositionAttitudeTransform support the use of an osg::Matrix or a osg::Vec3/osg::Quat resprectively. The Transform node can be customized via the ComputeTransfromCallback which can be attached to the node. This might be used to convert from internal representations of the transformation into generic osg::Matrix objects which are used during scene grpah traversal, such as CullTraversal and IntersectionTraversal.

Note: if the transformation matrix scales the subgraph then the normals of the underlying geometry will need to be renormalized to be unit vectors once more. This can be done transparently through OpenGL's use of either GL_NORMALIZE and GL_SCALE_NORMALIZE modes. For further background reading see the glNormalize documentation in the OpenGL Reference Guide (the blue book). To enable it in the OSG, you simply need to attach a local osg::StateSet to the osg::Transform, and set the appropriate mode to ON via stateset->setMode(GL_NORMALIZE, osg::StateAttribute::ON);


Member Enumeration Documentation

enum osg::Transform::ReferenceFrame
 

Enumeration values:
RELATIVE_TO_PARENTS 
RELATIVE_TO_ABSOLUTE 


Constructor & Destructor Documentation

osg::Transform::Transform  
 

osg::Transform::Transform const Transform &   ,
const CopyOp   copyop = CopyOp::SHALLOW_COPY
 

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Transform::~Transform   [protected, virtual]
 


Member Function Documentation

virtual const bool osg::Transform::computeBound   const [protected, virtual]
 

Overrides Group's computeBound.

There is no need to override in subclasses from osg::Transform since this computeBound() uses the underlying matrix (calling computeMatrix if required.)

Reimplemented from osg::Group.

virtual const bool osg::Transform::computeLocalToWorldMatrix Matrix   matrix,
NodeVisitor  
const [inline, virtual]
 

Reimplemented in osg::DOFTransform, osg::MatrixTransform, and osg::PositionAttitudeTransform.

virtual const bool osg::Transform::computeWorldToLocalMatrix Matrix   matrix,
NodeVisitor  
const [inline, virtual]
 

Reimplemented in osg::DOFTransform, osg::MatrixTransform, and osg::PositionAttitudeTransform.

const ComputeTransformCallback* osg::Transform::getComputeTransformCallback   const [inline]
 

Get the const ComputerTransfromCallback.

ComputeTransformCallback* osg::Transform::getComputeTransformCallback   [inline]
 

Get the non const ComputerTransfromCallback.

const bool osg::Transform::getLocalToWorldMatrix Matrix   matrix,
NodeVisitor   nv
const [inline]
 

Get the transformation matrix which moves from local coords to world coords.

Returns true if the Matrix passed in has been updated.

const ReferenceFrame osg::Transform::getReferenceFrame   const [inline]
 

const bool osg::Transform::getWorldToLocalMatrix Matrix   matrix,
NodeVisitor   nv
const [inline]
 

Get the transformation matrix which moves from world coords to local coords.

Return true if the Matrix passed in has been updated.

osg::Transform::META_Node osg   ,
Transform   
 

void osg::Transform::setComputeTransformCallback ComputeTransformCallback   ctc [inline]
 

Set the ComputerTransfromCallback which allows users to attach custom computation of the local transformation as seen by cull traversers and the like.

void osg::Transform::setReferenceFrame ReferenceFrame    rf
 

Set the transform's ReferenceFrame, either to be relative to its parent reference frame, or relative to an absolute coordinate frame.

RELATIVE_TO_PARENTS is the default. Note: setting the ReferenceFrame to be RELATIVE_TO_ABSOLUTE will also set the CullingActive flag on the transform, and hence all of its parents, to false, thereby disabling culling of it and all its parents. This is neccessary to prevent inappropriate culling, but may impact cull times if the absolute transform is deep in the scene graph. It is therefore recommend to only use absolute Transforms at the top of the scene, for such things as headlight LightSources or Heads up displays.


Member Data Documentation

ref_ptr<ComputeTransformCallback> osg::Transform::_computeTransformCallback [protected]
 

ReferenceFrame osg::Transform::_referenceFrame [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:46 2002 for the Open Scene Graph by doxygen 1.2.16.