]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Thruster.hpp
David Megginson writes:
[flightgear.git] / src / FDM / YASim / Thruster.hpp
1 #ifndef _THRUSTER_HPP
2 #define _THRUSTER_HPP
3
4 namespace yasim {
5
6 class Jet;
7 class PropEngine;
8 class Propeller;
9 class PistonEngine;
10
11 class Thruster {
12 public:
13     Thruster();
14     virtual ~Thruster();
15
16     // Typing info, these are the possible sub-type (or sub-parts)
17     // that a thruster might have.  Any might return null.  A little
18     // clumsy, but much simpler than an RTTI-based implementation.
19     virtual Jet* getJet() { return 0; }
20     virtual PropEngine* getPropEngine() { return 0; }
21     virtual Propeller* getPropeller() { return 0; }
22     virtual PistonEngine* getPistonEngine() { return 0; }
23     
24     // Static data
25     void getPosition(float* out);
26     void setPosition(float* pos);
27     void getDirection(float* out);
28     void setDirection(float* dir);
29
30     // Controls
31     void setThrottle(float throttle);
32     void setMixture(float mixture);
33
34     // Dynamic output
35     virtual void getThrust(float* out)=0;
36     virtual void getTorque(float* out)=0;
37     virtual void getGyro(float* out)=0;
38     virtual float getFuelFlow()=0;
39
40     // Runtime instructions
41     void setWind(float* wind);
42     void setAir(float pressure, float temp);
43     virtual void integrate(float dt)=0;
44     virtual void stabilize()=0;
45
46 protected:
47     float _pos[3];
48     float _dir[3];
49     float _throttle;
50     float _mixture;
51
52     float _wind[3];
53     float _pressure;
54     float _temp;
55     float _rho;
56 };
57
58 }; // namespace yasim
59 #endif // _THRUSTER_HPP
60