Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class 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:

[legend]
List of all members.

## Public Types
enum | ReferenceFrame { RELATIVE_RF, ABSOLUTE_RF }
## Public Member Functions
| Transform ()
| Transform (const Transform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
| Copy constructor using CopyOp to manage deep vs shallow copy.
| META_Node (osg, Transform)
virtual Transform * | asTransform ()
| Convert 'this' into a Transform pointer if Node is a Transform, otherwise return 0.
virtual const Transform * | asTransform () const
| convert 'const this' into a const Transform pointer if Node is a Transform, otherwise return 0.
virtual MatrixTransform * | asMatrixTransform ()
virtual const MatrixTransform * | asMatrixTransform () const
virtual PositionAttitudeTransform * | asPositionAttitudeTransform ()
virtual const PositionAttitudeTransform * | asPositionAttitudeTransform () const
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.
ReferenceFrame | getReferenceFrame () const
virtual bool | computeLocalToWorldMatrix (Matrix &matrix, NodeVisitor *) const
virtual bool | computeWorldToLocalMatrix (Matrix &matrix, NodeVisitor *) const
virtual BoundingSphere | computeBound () const
| Overrides Group's computeBound.
## Protected Member Functions
virtual | ~Transform ()
## Protected Attributes
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 respectively.

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_RF |
  ABSOLUTE_RF |

## 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 MatrixTransform* osg::Transform::asMatrixTransform | ( |  | ) | const`[inline, virtual]`

| Reimplemented in osg::MatrixTransform.

virtual MatrixTransform* osg::Transform::asMatrixTransform | ( |  | ) | `[inline, virtual]`

| Reimplemented in osg::MatrixTransform.

virtual const PositionAttitudeTransform* osg::Transform::asPositionAttitudeTransform | ( |  | ) | const`[inline, virtual]`

| Reimplemented in osg::PositionAttitudeTransform.

virtual PositionAttitudeTransform* osg::Transform::asPositionAttitudeTransform | ( |  | ) | `[inline, virtual]`

| Reimplemented in osg::PositionAttitudeTransform.

virtual const Transform* osg::Transform::asTransform | ( |  | ) | const`[inline, virtual]`

| convert 'const this' into a const Transform pointer if Node is a Transform, otherwise return 0. Equivalent to dynamic_cast<const Transform*>(this). Reimplemented from osg::Node.

virtual Transform* osg::Transform::asTransform | ( |  | ) | `[inline, virtual]`

| Convert 'this' into a Transform pointer if Node is a Transform, otherwise return 0. Equivalent to dynamic_cast<Transform*>(this). Reimplemented from osg::Node.

virtual BoundingSphere osg::Transform::computeBound | ( |  | ) | const`[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 bool osg::Transform::computeLocalToWorldMatrix | ( | Matrix & | matrix,
|  | NodeVisitor * |
| ) | const`[inline, virtual]`

| Reimplemented in osg::AutoTransform, osg::CameraNode, osg::CameraView, osg::MatrixTransform, osg::PositionAttitudeTransform, and osgSim::DOFTransform.

virtual bool osg::Transform::computeWorldToLocalMatrix | ( | Matrix & | matrix,
|  | NodeVisitor * |
| ) | const`[inline, virtual]`

| Reimplemented in osg::AutoTransform, osg::CameraNode, osg::CameraView, osg::MatrixTransform, osg::PositionAttitudeTransform, and osgSim::DOFTransform.

ReferenceFrame osg::Transform::getReferenceFrame | ( |  | ) | const`[inline]`

osg::Transform::META_Node | ( | osg | ,
|  | Transform |
| ) |

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_RF is the default. Note: Setting the ReferenceFrame to be ABSOLUTE_RF 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 recommended to only use absolute Transforms at the top of the scene, for such things as heads up displays.

## Member Data Documentation

ReferenceFrame osg::Transform::_referenceFrame`[protected]`

The documentation for this class was generated from the following file:

- Transform