Files
OpenSceneGraph/include/osg/PositionAttitudeTransform
Robert Osfield 12226e4371 Converted the instances of const built in types being returned from methods
and passed as paramters into straight forward non const built in types,
i.e. const bool foogbar(const int) becomes bool foobar(int).
2002-09-02 12:31:35 +00:00

83 lines
2.4 KiB
Plaintext

//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 <osg/Group>
#include <osg/Transform>
#include <osg/AnimationPath>
#include <osg/Quat>
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& getPivotPoint() const { return _pivotPoint; }
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const;
virtual 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> _animationPath;
double _firstTime;
};
protected :
Vec3 _position;
Quat _attitude;
Vec3 _pivotPoint;
};
}
#endif