]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/model.hxx
Change FGSteam into a proper subsystem rather than a collection of
[flightgear.git] / src / Model / model.hxx
index 86ceb019fbfc2dd8ad03a5d60ac54fb0744fda4e..cc5142519d7029adcacd476a60e18d8d1c7ef7e8 100644 (file)
@@ -19,6 +19,7 @@ SG_USING_STD(vector);
 
 // Don't pull in the headers, since we don't need them here.
 class ssgBranch;
+class ssgCutout;
 class ssgEntity;
 class ssgRangeSelector;
 class ssgSelector;
@@ -38,6 +39,7 @@ class FGLocation;
 #undef max
 #endif
 
+
 class FG3DModel
 {
 public:
@@ -46,59 +48,23 @@ public:
   virtual ~FG3DModel ();
 
   virtual void init (const string &path);
-  virtual void update (int dt);
-
-  virtual bool getVisible () const;
-  virtual void setVisible (bool visible);
+  virtual void update (double dt);
 
-  virtual double getLongitudeDeg () const { return _lon_deg; }
-  virtual double getLatitudeDeg () const { return _lat_deg; }
-  virtual double getElevationFt () const { return _elev_ft; }
-
-  virtual void setLongitudeDeg (double lon_deg);
-  virtual void setLatitudeDeg (double lat_deg);
-  virtual void setElevationFt (double elev_ft);
-  virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
-
-  virtual double getRollDeg () const { return _roll_deg; }
-  virtual double getPitchDeg () const { return _pitch_deg; }
-  virtual double getHeadingDeg () const { return _heading_deg; }
-
-  virtual void setRollDeg (double roll_deg);
-  virtual void setPitchDeg (double pitch_deg);
-  virtual void setHeadingDeg (double heading_deg);
-  virtual void setOrientation (double roll_deg, double pitch_deg,
-                              double heading_deg);
-
-  virtual ssgEntity * getSceneGraph () const { return (ssgEntity *)_selector; }
-
-  virtual FGLocation * getFGLocation () const { return _location; }
+  virtual ssgEntity * getSceneGraph () const { return (ssgEntity *)_model; }
 
 private:
 
   class Animation;
   Animation * make_animation (const char * object_name, SGPropertyNode * node);
 
-                               // Geodetic position
-  double _lon_deg;
-  double _lat_deg;
-  double _elev_ft;
-
-                               // Orientation
-  double _roll_deg;
-  double _pitch_deg;
-  double _heading_deg;
+                               // Child models.
+  vector<FG3DModel *> _children;
 
                                // Animations
   vector <Animation *> _animations;
 
                                // Scene graph
   ssgBranch * _model;
-  ssgSelector * _selector;
-  ssgTransform * _position;
-
-                               // Location
-  FGLocation * _location;
 
 
   \f
@@ -129,9 +95,9 @@ private:
     /**
      * Update the animation.
      *
-     * @param dt The elapsed time in milliseconds since the last call.
+     * @param dt The elapsed time in seconds since the last call.
      */
-    virtual void update (int dt) = 0;
+    virtual void update (double dt) = 0;
 
   };
 
@@ -145,7 +111,7 @@ private:
     NullAnimation ();
     virtual ~NullAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     ssgBranch * _branch;
   };
@@ -160,12 +126,27 @@ private:
     RangeAnimation ();
     virtual ~RangeAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     ssgRangeSelector * _branch;
   };
 
 
+  /**
+   * Animation to turn and face the screen.
+   */
+  class BillboardAnimation : public Animation
+  {
+  public:
+    BillboardAnimation ();
+    virtual ~BillboardAnimation ();
+    virtual void init (ssgEntity * object, SGPropertyNode * props);
+    virtual void update (double dt);
+  private:
+    ssgCutout * _branch;
+  };
+
+
   /**
    * Animation to select alternative versions of the same object.
    */
@@ -175,7 +156,7 @@ private:
     SelectAnimation ();
     virtual ~SelectAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     FGCondition * _condition;
     ssgSelector * _selector;
@@ -193,7 +174,7 @@ private:
     SpinAnimation ();
     virtual ~SpinAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     SGPropertyNode * _prop;
     double _factor;
@@ -216,7 +197,7 @@ private:
     RotateAnimation ();
     virtual ~RotateAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     SGPropertyNode * _prop;
     double _offset_deg;
@@ -243,7 +224,7 @@ private:
     TranslateAnimation ();
     virtual ~TranslateAnimation ();
     virtual void init (ssgEntity * object, SGPropertyNode * props);
-    virtual void update (int dt);
+    virtual void update (double dt);
   private:
     SGPropertyNode * _prop;
     double _offset_m;
@@ -259,6 +240,66 @@ private:
     ssgTransform * _transform;
   };
 
+
+};
+
+
+class FGModelPlacement
+{
+public:
+
+  FGModelPlacement ();
+  virtual ~FGModelPlacement ();
+
+  virtual void init (const string &path);
+  virtual void update (double dt);
+
+  virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; }
+
+  virtual FGLocation * getFGLocation () { return _location; }
+
+  virtual bool getVisible () const;
+  virtual void setVisible (bool visible);
+
+  virtual double getLongitudeDeg () const { return _lon_deg; }
+  virtual double getLatitudeDeg () const { return _lat_deg; }
+  virtual double getElevationFt () const { return _elev_ft; }
+
+  virtual void setLongitudeDeg (double lon_deg);
+  virtual void setLatitudeDeg (double lat_deg);
+  virtual void setElevationFt (double elev_ft);
+  virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
+
+  virtual double getRollDeg () const { return _roll_deg; }
+  virtual double getPitchDeg () const { return _pitch_deg; }
+  virtual double getHeadingDeg () const { return _heading_deg; }
+
+  virtual void setRollDeg (double roll_deg);
+  virtual void setPitchDeg (double pitch_deg);
+  virtual void setHeadingDeg (double heading_deg);
+  virtual void setOrientation (double roll_deg, double pitch_deg,
+                              double heading_deg);
+
+private:
+  
+  FG3DModel * _model;
+
+                               // Geodetic position
+  double _lon_deg;
+  double _lat_deg;
+  double _elev_ft;
+
+                               // Orientation
+  double _roll_deg;
+  double _pitch_deg;
+  double _heading_deg;
+
+  ssgSelector * _selector;
+  ssgTransform * _position;
+
+                               // Location
+  FGLocation * _location;
+
 };
 
 #endif // __MODEL_HXX