class SG_EXPORT osg::Transform

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

Inheritance:


Public Methods

[more] Transform()
[more] Transform(const Transform&, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more] META_Node(osg, Transform)
[more]virtual Transform* asTransform()
[more]virtual const Transform* asTransform() const
[more]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.
[more]ReferenceFrame getReferenceFrame() const
[more]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.
[more]ComputeTransformCallback* getComputeTransformCallback()
Get the non const ComputerTransfromCallback
[more]const ComputeTransformCallback* getComputeTransformCallback() const
Get the const ComputerTransfromCallback
[more]inline bool getLocalToWorldMatrix(Matrix& matrix, NodeVisitor* nv) const
Get the transformation matrix which moves from local coords to world coords.
[more]inline bool getWorldToLocalMatrix(Matrix& matrix, NodeVisitor* nv) const
Get the transformation matrix which moves from world coords to local coords.
[more]virtual bool computeLocalToWorldMatrix(Matrix& matrix, NodeVisitor*) const
[more]virtual bool computeWorldToLocalMatrix(Matrix& matrix, NodeVisitor*) const

Public Members

[more]enum ReferenceFrame
[more]struct ComputeTransformCallback: public osg::Referenced
Callback attached to an Transform to specify how to compute the modelview transformation for the transform below the Transform node.

Protected Fields

[more]ref_ptr<ComputeTransformCallback> _computeTransformCallback
[more]ReferenceFrame _referenceFrame

Protected Methods

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


Inherited from Group:

Public Methods

ovirtual Group* asGroup()
ovirtual const Group* asGroup() const
ovirtual void traverse(NodeVisitor& nv)
ovirtual bool addChild( Node* child )
ovirtual bool removeChild( Node* child )
ovirtual bool replaceChild( Node* origChild, Node* newChild )
oinline unsigned int getNumChildren() const
oinline Node* getChild( unsigned int i )
oinline const Node* getChild( unsigned int i ) const
oinline bool containsNode( const Node* node ) const
oinline ChildList::iterator findNode( const Node* node )
oinline ChildList::const_iterator findNode( const Node* node ) const
oinline unsigned int findChildNo( const Node* node ) const

Public Members

otypedef std::vector<ref_ptr<Node> > ChildList

Protected Fields

oChildList _children


Documentation

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);

o Transform()

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

o META_Node(osg, Transform)

ovirtual Transform* asTransform()

ovirtual const Transform* asTransform() const

oenum ReferenceFrame

o RELATIVE_TO_PARENTS

o RELATIVE_TO_ABSOLUTE

ovoid 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.

oReferenceFrame getReferenceFrame() const

ostruct ComputeTransformCallback: public osg::Referenced
Callback attached to an Transform to specify how to compute the modelview transformation for the transform below the Transform node.

ovirtual bool computeLocalToWorldMatrix(Matrix& matrix, const Transform* transform, NodeVisitor* nv) const = 0
Get the transformation matrix which moves from local coords to world coords

ovirtual bool computeWorldToLocalMatrix(Matrix& matrix, const Transform* transform, NodeVisitor* nv) const = 0
Get the transformation matrix which moves from world coords to local coords

ovoid 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.

oComputeTransformCallback* getComputeTransformCallback()
Get the non const ComputerTransfromCallback

oconst ComputeTransformCallback* getComputeTransformCallback() const
Get the const ComputerTransfromCallback

oinline bool getLocalToWorldMatrix(Matrix& matrix, NodeVisitor* nv) const
Get the transformation matrix which moves from local coords to world coords. Returns true if the Matrix passed in has been updated.

oinline bool getWorldToLocalMatrix(Matrix& matrix, NodeVisitor* nv) const
Get the transformation matrix which moves from world coords to local coords. Return true if the Matrix passed in has been updated.

ovirtual bool computeLocalToWorldMatrix(Matrix& matrix, NodeVisitor*) const

ovirtual bool computeWorldToLocalMatrix(Matrix& matrix, NodeVisitor*) const

ovirtual ~Transform()

ovirtual bool computeBound() const
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.)

oref_ptr<ComputeTransformCallback> _computeTransformCallback

oReferenceFrame _referenceFrame


Direct child classes:
PositionAttitudeTransform
MatrixTransform
DOFTransform

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.