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]virtual MatrixTransform* asMatrixTransform()
[more]virtual const MatrixTransform* asMatrixTransform() const
[more]virtual PositionAttitudeTransform* asPositionAttitudeTransform()
[more]virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const
[more]virtual DOFTransform* asDOFTransform()
[more]virtual const DOFTransform* asDOFTransform() 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 virtual 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 removeChild(unsigned int pos, unsigned int numChildrenToRemove=1)
ovirtual bool replaceChild( Node* origChild, Node* newChild )
oinline unsigned int getNumChildren() const
ovirtual bool setChild( unsigned int i, Node* node )
oinline Node* getChild( unsigned int i )
oinline const Node* getChild( unsigned int i ) const
oinline bool containsNode( const Node* node ) const
oinline unsigned int getChildIndex( const Node* node ) const

Public Members

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

Protected Fields

oChildList _children


Inherited from Node:

Public Methods

ovirtual Object* cloneType() const
ovirtual Object* clone(const CopyOp& copyop) const
ovirtual bool isSameKindAs(const Object* obj) const
ovirtual const char* libraryName() const
ovirtual const char* className() const
ovirtual void accept(NodeVisitor& nv)
ovirtual void ascend(NodeVisitor& nv)
oinline void setName( const std::string& name )
oinline void setName( const char* name )
oinline const std::string& getName() const
oinline const ParentList& getParents() const
oinline ParentList getParents()
oinline Group* getParent(unsigned int i)
oinline const Group* getParent(unsigned int i) const
oinline unsigned int getNumParents() const
ovoid setUpdateCallback(NodeCallback* nc)
oinline NodeCallback* getUpdateCallback()
oinline const NodeCallback* getUpdateCallback() const
ovoid setAppCallback(NodeCallback* nc)
oinline NodeCallback* getAppCallback()
oinline const NodeCallback* getAppCallback() const
oinline unsigned int getNumChildrenRequiringUpdateTraversal() const
ovoid setCullCallback(NodeCallback* nc)
oinline NodeCallback* getCullCallback()
oinline const NodeCallback* getCullCallback() const
ovoid setCullingActive(bool active)
oinline bool getCullingActive() const
oinline unsigned int getNumChildrenWithCullingDisabled() const
oinline bool isCullingActive() const
oinline unsigned int getNumChildrenWithOccluderNodes() const
obool containsOccluderNodes() const
oinline void setNodeMask(NodeMask nm)
oinline NodeMask getNodeMask() const
oinline const DescriptionList& getDescriptions() const
oinline DescriptionList& getDescriptions()
oinline const std::string& getDescription(unsigned int i) const
oinline std::string& getDescription(unsigned int i)
oinline unsigned int getNumDescriptions() const
ovoid addDescription(const std::string& desc)
oinline void setStateSet(osg::StateSet* dstate)
oosg::StateSet* getOrCreateStateSet()
oinline osg::StateSet* getStateSet()
oinline const osg::StateSet* getStateSet() const
oinline const BoundingSphere& getBound() const
ovoid dirtyBound()

Public Members

otypedef std::vector<Group*> ParentList
otypedef unsigned int NodeMask
otypedef std::vector<std::string> DescriptionList

Protected Fields

omutable BoundingSphere _bsphere
omutable bool _bsphere_computed
ostd::string _name
oParentList _parents
oref_ptr<NodeCallback> _updateCallback
ounsigned int _numChildrenRequiringUpdateTraversal
oref_ptr<NodeCallback> _cullCallback
obool _cullingActive
ounsigned int _numChildrenWithCullingDisabled
ounsigned int _numChildrenWithOccluderNodes
oNodeMask _nodeMask
oDescriptionList _descriptions
oref_ptr<StateSet> _stateset

Protected Methods

ovoid addParent(osg::Group* node)
ovoid removeParent(osg::Group* node)
ovoid setNumChildrenRequiringUpdateTraversal(unsigned int num)
ovoid setNumChildrenWithCullingDisabled(unsigned int num)
ovoid setNumChildrenWithOccluderNodes(unsigned int num)


Inherited from Object:

Public Methods

oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Public Members

oenum DataVariance

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (Referenced&)
ostatic void setDeleteHandler(DeleteHandler* handler)
ostatic DeleteHandler* getDeleteHandler()
oinline void ref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline void unref() const

Protected Fields

omutable int _refCount


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

ovirtual MatrixTransform* asMatrixTransform()

ovirtual const MatrixTransform* asMatrixTransform() const

ovirtual PositionAttitudeTransform* asPositionAttitudeTransform()

ovirtual const PositionAttitudeTransform* asPositionAttitudeTransform() const

ovirtual DOFTransform* asDOFTransform()

ovirtual const DOFTransform* asDOFTransform() 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 heads up displays.

oReferenceFrame getReferenceFrame() const

ostruct ComputeTransformCallback: public virtual 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++.