]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Model.hpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / FDM / YASim / Model.hpp
index 6c1682a96e6cc7190fbd650d8479b289b36412eb..7c31b8ac8edc414ee24bae3426e1cf4e28e1cbd1 100644 (file)
@@ -5,6 +5,8 @@
 #include "RigidBody.hpp"
 #include "BodyEnvironment.hpp"
 #include "Vector.hpp"
+#include "Turbulence.hpp"
+#include "Rotor.hpp"
 
 namespace yasim {
 
@@ -12,7 +14,12 @@ namespace yasim {
 class Integrator;
 class Thruster;
 class Surface;
+class Rotorpart;
 class Gear;
+class Ground;
+class Hook;
+class Launchbar;
+class Hitch;
 
 class Model : public BodyEnvironment {
 public:
@@ -22,17 +29,29 @@ public:
     RigidBody* getBody();
     Integrator* getIntegrator();
 
+    void setTurbulence(Turbulence* turb) { _turb = turb; }
+
     State* getState();
     void setState(State* s);
 
+    bool isCrashed();
+    void setCrashed(bool crashed);
+    float getAGL();
+
     void iterate();
 
     // Externally-managed subcomponents
     int addThruster(Thruster* t);
     int addSurface(Surface* surf);
     int addGear(Gear* gear);
+    void addHook(Hook* hook);
+    void addLaunchbar(Launchbar* launchbar);
     Surface* getSurface(int handle);
+    Rotorgear* getRotorgear(void);
     Gear* getGear(int handle);
+    Hook* getHook(void);
+    int addHitch(Hitch* hitch);
+    Launchbar* getLaunchbar(void);
 
     // Semi-private methods for use by the Airplane solver.
     int numThrusters();
@@ -41,38 +60,50 @@ public:
     void initIteration();
     void getThrust(float* out);
 
+    void setGroundCallback(Ground* ground_cb);
+    Ground* getGroundCallback(void);
+
     //
     // Per-iteration settables
     //
-    void setGroundPlane(double* planeNormal, double fromOrigin);
     void setGroundEffect(float* pos, float span, float mul);
     void setWind(float* wind);
-    void setAir(float pressure, float temp);
+    void setAir(float pressure, float temp, float density);
+
+    void updateGround(State* s);
 
     // BodyEnvironment callbacks
     virtual void calcForces(State* s);
     virtual void newState(State* s);
 
 private:
+    void initRotorIteration();
     void calcGearForce(Gear* g, float* v, float* rot, float* ground);
     float gearFriction(float wgt, float v, Gear* g);
-    float localGround(State* s, float* out);
-    void localWind(float* pos, State* s, float* out);
+    void localWind(float* pos, State* s, float* out, float alt,
+        bool is_rotor = false);
 
     Integrator _integrator;
     RigidBody _body;
 
+    Turbulence* _turb;
+
     Vector _thrusters;
     Vector _surfaces;
+    Rotorgear _rotorgear;
     Vector _gears;
+    Hook* _hook;
+    Launchbar* _launchbar;
+    Vector _hitches;
 
     float _groundEffectSpan;
     float _groundEffect;
     float _wingCenter[3];
 
-    double _ground[4];
-    float _P;
-    float _T;
+    Ground* _ground_cb;
+    double _global_ground[4];
+    float _pressure;
+    float _temp;
     float _rho;
     float _wind[3];
 
@@ -81,6 +112,8 @@ private:
     float _torque[3];
 
     State* _s;
+    bool _crashed;
+    float _agl;
 };
 
 }; // namespace yasim