]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/model.hxx
Make sure that all elapsed time gets passed to update when a subsystem
[flightgear.git] / src / Model / model.hxx
index edfbfdae0d7d26751f80f2ae440f03b2e7c623cd..623d529f68121c9fe9847d340b7353e3e28fc452 100644 (file)
@@ -17,6 +17,8 @@ SG_USING_STD(vector);
 #include <plib/sg.h>
 #include <plib/ssg.h>
 
+#include <simgear/misc/props.hxx>
+
 
 // Don't pull in the headers, since we don't need them here.
 class ssgBranch;
@@ -26,7 +28,6 @@ class ssgRangeSelector;
 class ssgSelector;
 class ssgTransform;
 
-class SGPropertyNode;
 class SGInterpTable;
 class FGCondition;
 class FGLocation;
@@ -74,10 +75,15 @@ public:
    */
   virtual ssgBranch * getBranch () { return _branch; }
 
+  /**
+   * Initialize the animation, after children have been added.
+   */
+  virtual void init ();
+
   /**
    * Update the animation.
    */
-  virtual void update () = 0;
+  virtual void update ();
 
 protected:
 
@@ -94,7 +100,6 @@ class NullAnimation : public Animation
 public:
   NullAnimation (SGPropertyNode_ptr props);
   virtual ~NullAnimation ();
-  virtual void update ();
 };
 
 
@@ -106,7 +111,6 @@ class RangeAnimation : public Animation
 public:
   RangeAnimation (SGPropertyNode_ptr props);
   virtual ~RangeAnimation ();
-  virtual void update ();
 };
 
 
@@ -118,7 +122,6 @@ class BillboardAnimation : public Animation
 public:
   BillboardAnimation (SGPropertyNode_ptr props);
   virtual ~BillboardAnimation ();
-  virtual void update ();
 };
 
 
@@ -148,7 +151,7 @@ public:
   virtual ~SpinAnimation ();
   virtual void update ();
 private:
-  SGPropertyNode * _prop;
+  SGPropertyNode_ptr _prop;
   double _factor;
   double _position_deg;
   double _last_time_sec;
@@ -158,6 +161,22 @@ private:
 };
 
 
+/**
+ * Animation to draw objects for a specific amount of time each.
+ */
+class TimedAnimation : public Animation
+{
+public:
+    TimedAnimation (SGPropertyNode_ptr props);
+    virtual ~TimedAnimation ();
+    virtual void update ();
+private:
+    double _duration_sec;
+    double _last_time_sec;
+    int _step;
+};
+
+
 /**
  * Animation to rotate an object around a center point.
  *
@@ -170,7 +189,7 @@ public:
   virtual ~RotateAnimation ();
   virtual void update ();
 private:
-  SGPropertyNode * _prop;
+  SGPropertyNode_ptr _prop;
   double _offset_deg;
   double _factor;
   SGInterpTable * _table;
@@ -195,7 +214,7 @@ public:
   virtual ~TranslateAnimation ();
   virtual void update ();
 private:
-  SGPropertyNode * _prop;
+  SGPropertyNode_ptr _prop;
   double _offset_m;
   double _factor;
   SGInterpTable * _table;
@@ -274,6 +293,3 @@ private:
 };
 
 #endif // __MODEL_HXX
-
-
-