1 // placement.hxx - manage the placment of a 3D model.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain, and comes with no warranty.
7 #ifndef _SG_PLACEMENT_HXX
8 #define _SG_PLACEMENT_HXX 1
11 # error This library requires C++
14 #include <osg/ref_ptr>
17 #include <osg/PositionAttitudeTransform>
19 #include <simgear/math/SGMath.hxx>
21 // Has anyone done anything *really* stupid, like making min and max macros?
30 ////////////////////////////////////////////////////////////////////////
32 ////////////////////////////////////////////////////////////////////////
35 * A wrapper for a model with a definite placement.
37 class SGModelPlacement
42 virtual ~SGModelPlacement ();
44 virtual void init( osg::Node* model );
46 void add( osg::Node* model );
48 virtual void update();
50 virtual osg::Node* getSceneGraph () { return _selector.get(); }
52 virtual bool getVisible () const;
53 virtual void setVisible (bool visible);
55 void setPosition(const SGGeod& position);
56 const SGGeod& getPosition() const { return _position; }
58 virtual double getRollDeg () const { return _roll_deg; }
59 virtual double getPitchDeg () const { return _pitch_deg; }
60 virtual double getHeadingDeg () const { return _heading_deg; }
62 virtual void setRollDeg (double roll_deg);
63 virtual void setPitchDeg (double pitch_deg);
64 virtual void setHeadingDeg (double heading_deg);
65 virtual void setOrientation (double roll_deg, double pitch_deg,
67 void setOrientation(const SGQuatd& orientation);
69 void setReferenceTime(const double& referenceTime);
70 void setBodyLinearVelocity(const SGVec3d& velocity);
71 void setBodyAngularVelocity(const SGVec3d& velocity);
82 osg::ref_ptr<osg::Switch> _selector;
83 osg::ref_ptr<osg::PositionAttitudeTransform> _transform;
86 #endif // _SG_PLACEMENT_HXX