From 0d4e96974672988078a4807e255ffc8abcb6baa8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Jan 2003 09:37:56 +0000 Subject: [PATCH] Added support for osg::Transform::asMatrixTransform, asPositionAttitudeTransform and as DOFTransform. --- include/osg/DOFTransform | 3 +++ include/osg/MatrixTransform | 4 ++++ include/osg/PositionAttitudeTransform | 2 ++ include/osg/Transform | 9 +++++++++ 4 files changed, 18 insertions(+) diff --git a/include/osg/DOFTransform b/include/osg/DOFTransform index 8f4ea6764..bb1fd62fd 100644 --- a/include/osg/DOFTransform +++ b/include/osg/DOFTransform @@ -52,6 +52,9 @@ class SG_EXPORT DOFTransform : public Transform META_Node(osg, DOFTransform); + virtual DOFTransform* asDOFTransform() { return this; } + virtual const DOFTransform* asDOFTransform() const { return this; } + virtual void traverse(NodeVisitor& nv); void setMinHPR(const Vec3& hpr) { _minHPR = hpr;} diff --git a/include/osg/MatrixTransform b/include/osg/MatrixTransform index 6f27002c4..8bd9dd924 100644 --- a/include/osg/MatrixTransform +++ b/include/osg/MatrixTransform @@ -37,6 +37,10 @@ class SG_EXPORT MatrixTransform : public Transform META_Node(osg, MatrixTransform); + virtual MatrixTransform* asMatrixTransform() { return this; } + virtual const MatrixTransform* asMatrixTransform() const { return this; } + + /** Set the transform's matrix.*/ void setMatrix(const Matrix& mat) { _matrix = mat; _inverseDirty=true; dirtyBound(); } diff --git a/include/osg/PositionAttitudeTransform b/include/osg/PositionAttitudeTransform index 4021fc8f5..16e97f581 100644 --- a/include/osg/PositionAttitudeTransform +++ b/include/osg/PositionAttitudeTransform @@ -38,6 +38,8 @@ class SG_EXPORT PositionAttitudeTransform : public Transform META_Node(osg, PositionAttitudeTransform); + virtual PositionAttitudeTransform* asPositionAttitudeTransform() { return this; } + virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const { return this; } inline void setPosition(const Vec3& pos) { _position = pos; dirtyBound(); } diff --git a/include/osg/Transform b/include/osg/Transform index e1c6707be..5c5cff45b 100644 --- a/include/osg/Transform +++ b/include/osg/Transform @@ -57,6 +57,15 @@ class SG_EXPORT Transform : public Group virtual Transform* asTransform() { return this; } virtual const Transform* asTransform() const { return this; } + virtual MatrixTransform* asMatrixTransform() { return 0; } + virtual const MatrixTransform* asMatrixTransform() const { return 0; } + + virtual PositionAttitudeTransform* asPositionAttitudeTransform() { return 0; } + virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const { return 0; } + + virtual DOFTransform* asDOFTransform() { return 0; } + virtual const DOFTransform* asDOFTransform() const { return 0; } + enum ReferenceFrame { RELATIVE_TO_PARENTS,