//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield //Distributed under the terms of the GNU Library General Public License (LGPL) //as published by the Free Software Foundation. #ifndef OSG_POSITIONATTITIDETRANSFORM #define OSG_POSITIONATTITIDETRANSFORM 1 #include #include #include #include namespace osg { /** PositionAttitideTransform - is Transform the set the coordinates transform up via a Vec3 position and Quat attitude. */ class SG_EXPORT PositionAttitudeTransform : public Transform { public : PositionAttitudeTransform(); PositionAttitudeTransform(const PositionAttitudeTransform& pat,const CopyOp& copyop=CopyOp::SHALLOW_COPY): Transform(pat,copyop), _position(pat._position), _attitude(pat._attitude), _pivotPoint(pat._pivotPoint) {} META_Node(osg, PositionAttitudeTransform); void setPosition(const Vec3& pos) { _position = pos; dirtyBound(); } const Vec3& getPosition() const { return _position; } void setAttitude(const Quat& quat) { _attitude = quat; dirtyBound(); } const Quat& getAttitude() const { return _attitude; } void setPivotPoint(const Vec3& pivot) { _pivotPoint = pivot; dirtyBound(); } const Vec3& setPivotPoint() const { return _pivotPoint; } virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const; virtual const bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const; /** Callback which can be attached to a PositionAttitudeTransform * as an app callback to allow it to follow the path defined by a * AnimationPath.*/ class SG_EXPORT AnimationPathCallback : public NodeCallback { public: AnimationPathCallback(AnimationPath* ap): _animationPath(ap), _firstTime(0.0) {} /** implements the callback*/ virtual void operator()(Node* node, NodeVisitor* nv); ref_ptr _animationPath; double _firstTime; }; protected : Vec3 _position; Quat _attitude; Vec3 _pivotPoint; }; } #endif