]> git.mxchange.org Git - flightgear.git/blob - src/Systems/submodel.hxx
David Culp:
[flightgear.git] / src / Systems / submodel.hxx
1 // submodel.hxx - models a releasable submodel.
2 // Written by Dave Culp, started Aug 2004
3 //
4 // This file is in the Public Domain and comes with no warranty.
5
6
7 #ifndef __SYSTEMS_SUBMODEL_HXX
8 #define __SYSTEMS_SUBMODEL_HXX 1
9
10 #ifndef __cplusplus
11 # error This library requires C++
12 #endif
13
14 #include <simgear/props/props.hxx>
15 #include <simgear/structure/subsystem_mgr.hxx>
16 #include <AIModel/AIManager.hxx>
17 #include <vector>
18 #include <string>
19 SG_USING_STD(vector);
20 SG_USING_STD(string);
21
22
23 class SubmodelSystem : public SGSubsystem
24 {
25
26 public:
27
28  typedef struct {
29   SGPropertyNode_ptr trigger;
30   string             name;
31   string             model;
32   double             speed;
33   bool               slaved;
34   bool               repeat;
35   double             delay;
36   double             timer;
37   int                count;
38   double             x_offset;
39   double             y_offset;
40   double             z_offset;
41   double             yaw_offset;
42   double             pitch_offset;
43   double             drag_area; 
44  } submodel; 
45
46  typedef struct {
47   double     lat;
48   double     lon;
49   double     alt;
50   double     azimuth;
51   double     elevation;
52   double     speed;
53  } IC_struct;  
54
55     SubmodelSystem ();
56     ~SubmodelSystem ();
57
58     void load ();
59     void init ();
60     void bind ();
61     void unbind ();
62     void update (double dt);
63     bool release (submodel* sm, double dt);
64     void transform (submodel* sm);
65
66 private:
67
68     typedef vector <submodel*> submodel_vector_type;
69     typedef submodel_vector_type::iterator submodel_vector_iterator;
70
71     submodel_vector_type       submodels;
72     submodel_vector_iterator   submodel_iterator;
73
74
75     double x_offset, y_offset, z_offset;
76     double pitch_offset, yaw_offset;
77
78     SGPropertyNode_ptr _serviceable_node;
79     SGPropertyNode_ptr _user_lat_node;
80     SGPropertyNode_ptr _user_lon_node;
81     SGPropertyNode_ptr _user_heading_node;
82     SGPropertyNode_ptr _user_alt_node;
83     SGPropertyNode_ptr _user_pitch_node;
84     SGPropertyNode_ptr _user_roll_node;
85     SGPropertyNode_ptr _user_yaw_node;
86     SGPropertyNode_ptr _user_speed_node;
87
88     FGAIManager* ai;
89     IC_struct  IC;
90 };
91
92 #endif // __SYSTEMS_SUBMODEL_HXX