1 // model.hxx - manage a 3D aircraft model.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain, and comes with no warranty.
10 # error This library requires C++
20 #include <simgear/misc/props.hxx>
21 #include <simgear/timing/timestamp.hxx>
23 // Has anyone done anything *really* stupid, like making min and max macros?
31 class FGAircraftModel : public FGSubsystem
36 virtual ~FGAircraftModel ();
40 virtual void unbind ();
41 virtual void update (int dt);
47 Animation * make_animation (const char * object_name, SGPropertyNode * node);
50 ssgSelector * _selector;
51 ssgTransform * _position;
53 vector <Animation *> _animations;
57 //////////////////////////////////////////////////////////////////////
58 // Internal classes for individual animations.
59 //////////////////////////////////////////////////////////////////////
62 * Abstract base class for all animations.
70 virtual ~Animation ();
73 * Initialize the animation.
75 * @param object The object to animate.
76 * @param props The property node with configuration information.
78 virtual void init (ssgEntity * object, SGPropertyNode * props) = 0;
82 * Update the animation.
84 * @param dt The elapsed time in milliseconds since the last call.
86 virtual void update (int dt) = 0;
94 class NullAnimation : public Animation
98 virtual ~NullAnimation ();
99 virtual void init (ssgEntity * object, SGPropertyNode * props);
100 virtual void update (int dt);
107 * Animation to select alternative versions of the same object.
109 class SelectAnimation : public Animation
113 virtual ~SelectAnimation ();
114 virtual void init (ssgEntity * object, SGPropertyNode * props);
115 virtual void update (int dt);
117 FGCondition * _condition;
118 ssgSelector * _selector;
123 * Animation to spin an object around a center point.
125 * This animation rotates at a specific velocity.
127 class SpinAnimation : public Animation
131 virtual ~SpinAnimation ();
132 virtual void init (ssgEntity * object, SGPropertyNode * props);
133 virtual void update (int dt);
135 SGPropertyNode * _prop;
137 double _position_deg;
141 ssgTransform * _transform;
146 * Animation to rotate an object around a center point.
148 * This animation rotates to a specific position.
150 class RotateAnimation : public Animation
154 virtual ~RotateAnimation ();
155 virtual void init (ssgEntity * object, SGPropertyNode * props);
156 virtual void update (int dt);
158 SGPropertyNode * _prop;
165 double _position_deg;
169 ssgTransform * _transform;
174 * Animation to slide along an axis.
176 class TranslateAnimation : public Animation
179 TranslateAnimation ();
180 virtual ~TranslateAnimation ();
181 virtual void init (ssgEntity * object, SGPropertyNode * props);
182 virtual void update (int dt);
184 SGPropertyNode * _prop;
194 ssgTransform * _transform;
199 extern FGAircraftModel current_model;
201 #endif // __MODEL_HXX