1 /*****************************************************************************
2  * $LastChangedDate: 2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011) $
3  * @file
4  * @author  Jim E. Brooks  http://www.palomino3d.org
5  * @brief   Aircraft classes.
6  *//*
7  * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
8  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
9  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
10  *****************************************************************************/
11 
12 #ifndef PROGRAM_AIRCRAFT_HH
13 #define PROGRAM_AIRCRAFT_HH 1
14 
15 #include <vector>
16 #include "graph/module.hh"
17 #include "graph/subgraph.hh"
18 using namespace graph;
19 
20 namespace program {
21 
22 enum eAircraftType
23 {
24     // And update Lua and gui/gui.cc
25     eAircraftType_Spitfire,     // 0
26     eAircraftType_Corsair,      // 1
27     eAircraftType_P51,          // 2
28     eAircraftType_F82,          // 3
29     eAircraftType_F86,          // 4
30     eAircraftType_A4,           // 5
31     eAircraftType_F14,          // 6
32     eAircraftType_F15,          // 7
33     eAircraftType_F16,          // 8
34     eAircraftType_F18,          // 9
35     eAircraftType_SR71,         // 10
36     eAircraftType_Mirage2000,   // 11
37     eAircraftType_SU37,         // 12
38     eAircraftType_SpaceShuttle, // 13
39 
40     // Special aircraft that cannot be selected by user:
41     eAircraftType_Sikorsky      = 100,
42 };
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// @brief Spitfire (Seafire IIIC).
46 ///
47 class SpitfireAircraft : public Aircraft
48 {
49 PREVENT_COPYING(SpitfireAircraft)
50 typedef Aircraft Parent;
51 public:
52                     SpitfireAircraft( shptr<Graph> graph, const WorldVertex& pos );
53                     ~SpitfireAircraft();
GetName(void)54     virtual const string GetName( void ) { return string("SpitfireAircraft"); }
55     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
56     virtual      const AircraftSpecs&      GetSpecs( void );
57     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)58     virtual bool    IfHasPropeller( void ) { return true; }
59     virtual void    SetThrottle( const fp throttle );
60     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
61 
62 private:
63     virtual void    Tick( const Milliseconds millisecElapsed );
64     void            RotatePropeller( void );
65 
66 private:
67     shptr<Subgraph>     mSubgraphPropeller1, mSubgraphPropeller2;  // 4 blades
68     shptr<Subgraph>     mSubgraphPropeller3, mSubgraphPropeller4, mSubgraphPropellerDisc;
69     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
70     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
71     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
72     shptr<Subgraph>     mSubgraphRudder;
73 };
74 
75 ////////////////////////////////////////////////////////////////////////////////
76 /// @brief F4U Corsair.
77 ///
78 class CorsairAircraft : public Aircraft
79 {
80 PREVENT_COPYING(CorsairAircraft)
81 typedef Aircraft Parent;
82 public:
83                     CorsairAircraft( shptr<Graph> graph, const WorldVertex& pos );
84                     ~CorsairAircraft();
GetName(void)85     virtual const string GetName( void ) { return string("CorsairAircraft"); }
86     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
87     virtual      const AircraftSpecs&      GetSpecs( void );
88     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)89     virtual bool    IfHasPropeller( void ) { return true; }
90     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
91 
92 private:
93     virtual void    Tick( const Milliseconds millisecElapsed );
94     void            RotatePropeller( void );
95 
96 private:
97     shptr<Subgraph>     mSubgraphPropeller0, mSubgraphPropeller1;
98     shptr<Subgraph>     mSubgraphGear0,  mSubgraphGear1,  mSubgraphGear2,  mSubgraphGear3;
99     shptr<Subgraph>     mSubgraphGear4,  mSubgraphGear5,  mSubgraphGear6,  mSubgraphGear7;
100     shptr<Subgraph>     mSubgraphGear8,  mSubgraphGear9,  mSubgraphGear10, mSubgraphGear11;
101     shptr<Subgraph>     mSubgraphGear12, mSubgraphGear13, mSubgraphGear14, mSubgraphGear15;
102     shptr<Subgraph>     mSubgraphGear16, mSubgraphGear17, mSubgraphGear18, mSubgraphGear19;
103     shptr<Subgraph>     mSubgraphGear20;
104     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
105     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
106     shptr<Subgraph>     mSubgraphRudder;
107 };
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// @brief P-51D Mustang.
111 ///
112 class P51Aircraft : public Aircraft
113 {
114 PREVENT_COPYING(P51Aircraft)
115 typedef Aircraft Parent;
116 public:
117                     P51Aircraft( shptr<Graph> graph, const WorldVertex& pos );
118                     ~P51Aircraft();
GetName(void)119     virtual const string GetName( void ) { return string("P51Aircraft"); }
120     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
121     virtual      const AircraftSpecs&      GetSpecs( void );
122     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)123     virtual bool    IfHasPropeller( void ) { return true; }
124     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
125 
126 private:
127     virtual void    Tick( const Milliseconds millisecElapsed );
128     void            RotatePropeller( void );
129 
130 private:
131     shptr<Subgraph>     mSubgraphPropeller1;    ///< this particular P-51 model
132     shptr<Subgraph>     mSubgraphPropeller2;    ///< has two nodes for a 4 bladed propeller
133     //
134     shptr<Subgraph>     mSubgraphLeftGearWheel;
135     shptr<Subgraph>     mSubgraphLeftGearStrut;
136     shptr<Subgraph>     mSubgraphLeftInnerGearCover;
137     shptr<Subgraph>     mSubgraphLeftOuterGearCover;
138     shptr<Subgraph>     mSubgraphLeftTailGearDoor;
139     //
140     shptr<Subgraph>     mSubgraphRightGearWheel;
141     shptr<Subgraph>     mSubgraphRightGearStrut;
142     shptr<Subgraph>     mSubgraphRightInnerGearCover;
143     shptr<Subgraph>     mSubgraphRightOuterGearCover;
144     shptr<Subgraph>     mSubgraphRightTailGearDoor;
145     //
146     shptr<Subgraph>     mSubgraphTailGearWheel;
147     shptr<Subgraph>     mSubgraphTailGearStrut;
148     //
149     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
150     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight, mSubgraphRudder;
151     //
152     shptr<Subgraph>     mSubgraphJunk0, mSubgraphJunk1;
153 };
154 
155 ////////////////////////////////////////////////////////////////////////////////
156 /// @brief F-82 Twin Mustang.
157 ///
158 class F82Aircraft : public Aircraft
159 {
160 PREVENT_COPYING(F82Aircraft)
161 typedef Aircraft Parent;
162 public:
163                     F82Aircraft( shptr<Graph> graph, const WorldVertex& pos );
164                     ~F82Aircraft();
GetName(void)165     virtual const string GetName( void ) { return string("F82Aircraft"); }
166     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
167     virtual      const AircraftSpecs&      GetSpecs( void );
168     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)169     virtual bool    IfHasPropeller( void ) { return true; }
170     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
171 
172 private:
173     virtual void    Tick( const Milliseconds millisecElapsed );
174     void            RotatePropeller( void );
175     void            TranslatePropeller( const fp dir );  // (F82-specific)
176 
177 private:
178     shptr<Subgraph>     mSubgraphPropeller1;  // each propeller of the Twin Mustang
179     shptr<Subgraph>     mSubgraphPropeller2;  // has 2 subgraphs
180     shptr<Subgraph>     mSubgraphPropeller3;
181     shptr<Subgraph>     mSubgraphPropeller4;
182     //
183     shptr<Subgraph>     mSubgraphLeftGearWheel;
184     shptr<Subgraph>     mSubgraphLeftGearStrut;
185     shptr<Subgraph>     mSubgraphLeftInnerGearCover;
186     shptr<Subgraph>     mSubgraphLeftInnerGearCover2;
187     shptr<Subgraph>     mSubgraphLeftOuterGearCover;
188     shptr<Subgraph>     mSubgraphLeftTailGearDoor;
189     //
190     shptr<Subgraph>     mSubgraphRightGearWheel;
191     shptr<Subgraph>     mSubgraphRightGearStrut;
192     shptr<Subgraph>     mSubgraphRightInnerGearCover;
193     shptr<Subgraph>     mSubgraphRightInnerGearCover2;
194     shptr<Subgraph>     mSubgraphRightOuterGearCover;
195     shptr<Subgraph>     mSubgraphRightTailGearDoor;
196     //
197     shptr<Subgraph>     mSubgraphTailGearWheel;
198     shptr<Subgraph>     mSubgraphTailGearStrut;
199     shptr<Subgraph>     mSubgraphTailGearWheel2;
200     shptr<Subgraph>     mSubgraphTailGearStrut2;
201     //
202     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
203     shptr<Subgraph>     mSubgraphElevator;
204     shptr<Subgraph>     mSubgraphRudderLeft, mSubgraphRudderRight;
205     //
206     shptr<Subgraph>     mSubgraphJunk0, mSubgraphJunk1;
207 };
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 /// @brief F-86 Sabre.
211 ///
212 class F86Aircraft : public Aircraft
213 {
214 PREVENT_COPYING(F86Aircraft)
215 typedef Aircraft Parent;
216 public:
217                     F86Aircraft( shptr<Graph> graph, const WorldVertex& pos );
218                     ~F86Aircraft();
GetName(void)219     virtual const string GetName( void ) { return string("F86Aircraft"); }
220     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
221     virtual      const AircraftSpecs&      GetSpecs( void );
222     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)223     virtual bool    IfHasPropeller( void ) { return false; }
224     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
225 
226 private:
227     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
228     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
229     //
230     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
231     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
232     shptr<Subgraph>     mSubgraphRudder;
233 };
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// @brief A-4 Skyhawk.
237 ///
238 class A4Aircraft : public Aircraft
239 {
240 PREVENT_COPYING(A4Aircraft)
241 typedef Aircraft Parent;
242 public:
243                     A4Aircraft( shptr<Graph> graph, const WorldVertex& pos );
244                     ~A4Aircraft();
GetName(void)245     virtual const string GetName( void ) { return string("A4Aircraft"); }
246     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
247     virtual      const AircraftSpecs&      GetSpecs( void );
248     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)249     virtual bool    IfHasPropeller( void ) { return false; }
250     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
251 
252 private:
253     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
254     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
255     shptr<Subgraph>     mSubgraphGear6, mSubgraphGear7, mSubgraphGear8;
256     shptr<Subgraph>     mSubgraphGear9, mSubgraphGear10, mSubgraphGear11;
257     shptr<Subgraph>     mSubgraphGear12, mSubgraphGear13, mSubgraphGear14;
258     shptr<Subgraph>     mSubgraphGear15, mSubgraphGear16, mSubgraphGear17;
259     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
260     shptr<Subgraph>     mSubgraphAileronLeft2, mSubgraphAileronRight2;
261     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
262     shptr<Subgraph>     mSubgraphRudder;
263 };
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// @brief F-14 Tomcat.
267 ///
268 class F14Aircraft : public Aircraft
269 {
270 PREVENT_COPYING(F14Aircraft)
271 typedef Aircraft Parent;
272 public:
273                     F14Aircraft( shptr<Graph> graph, const WorldVertex& pos );
274                     ~F14Aircraft();
275     virtual void    Reset( void );
GetName(void)276     virtual const string GetName( void ) { return string("F14Aircraft"); }
277     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
278     virtual      const AircraftSpecs&      GetSpecs( void );
279     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)280     virtual bool    IfHasPropeller( void ) { return false; }
281     virtual void    SetThrottle( const fp throttle );
282     virtual void    SwingWings( const float fraction );
283     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
284 
285 private:
286     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
287     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
288     shptr<Subgraph>     mSubgraphGear6, mSubgraphGear7, mSubgraphGear8;
289     shptr<Subgraph>     mSubgraphGear9, mSubgraphGear10, mSubgraphGear11;
290     shptr<Subgraph>     mSubgraphGear12, mSubgraphGear13, mSubgraphGear14;
291     shptr<Subgraph>     mSubgraphGear15, mSubgraphGear16, mSubgraphGear17;
292     shptr<Subgraph>     mSubgraphGear18, mSubgraphGear19, mSubgraphGear20;
293     shptr<Subgraph>     mSubgraphGear21, mSubgraphGear22, mSubgraphGear23;
294     shptr<Subgraph>     mSubgraphGear24, mSubgraphGear25, mSubgraphGear26;
295     shptr<Subgraph>     mSubgraphGear27, mSubgraphGear28, mSubgraphGear29;
296     shptr<Subgraph>     mSubgraphGear30, mSubgraphGear31, mSubgraphGear32;
297     shptr<Subgraph>     mSubgraphGear33, mSubgraphGear34;
298     shptr<Subgraph>     mSubgraphWingLeft0, mSubgraphWingLeft1, mSubgraphWingLeft2, mSubgraphWingLeft3;
299     shptr<Subgraph>     mSubgraphWingLeft4, mSubgraphWingLeft5, mSubgraphWingLeft6, mSubgraphWingLeft7;
300     shptr<Subgraph>     mSubgraphWingLeft8, mSubgraphWingLeft9, mSubgraphWingLeft10, mSubgraphWingLeft11;
301     shptr<Subgraph>     mSubgraphWingLeft12, mSubgraphWingLeft13, mSubgraphWingLeft14, mSubgraphWingLeft15;
302     shptr<Subgraph>     mSubgraphWingLeft16, mSubgraphWingLeft17, mSubgraphWingLeft18, mSubgraphWingLeft19;
303     shptr<Subgraph>     mSubgraphWingLeft20, mSubgraphWingLeft21, mSubgraphWingLeft22, mSubgraphWingLeft23;
304     shptr<Subgraph>     mSubgraphWingLeft24, mSubgraphWingLeft25, mSubgraphWingLeft26, mSubgraphWingLeft27;
305     shptr<Subgraph>     mSubgraphWingLeft28, mSubgraphWingLeft29;
306     shptr<Subgraph>     mSubgraphWingRight0, mSubgraphWingRight1, mSubgraphWingRight2, mSubgraphWingRight3;
307     shptr<Subgraph>     mSubgraphWingRight4, mSubgraphWingRight5, mSubgraphWingRight6, mSubgraphWingRight7;
308     shptr<Subgraph>     mSubgraphWingRight8, mSubgraphWingRight9, mSubgraphWingRight10, mSubgraphWingRight11;
309     shptr<Subgraph>     mSubgraphWingRight12, mSubgraphWingRight13, mSubgraphWingRight14, mSubgraphWingRight15;
310     shptr<Subgraph>     mSubgraphWingRight16, mSubgraphWingRight17, mSubgraphWingRight18, mSubgraphWingRight19;
311     shptr<Subgraph>     mSubgraphWingRight20, mSubgraphWingRight21, mSubgraphWingRight22, mSubgraphWingRight23;
312     shptr<Subgraph>     mSubgraphWingRight24, mSubgraphWingRight25, mSubgraphWingRight26, mSubgraphWingRight27;
313     shptr<Subgraph>     mSubgraphWingRight28, mSubgraphWingRight29;
314     shptr<Subgraph>     mSubgraphTaileronLeft, mSubgraphTaileronRight, mSubgraphRudderLeft, mSubgraphRudderRight;
315     shptr<Subgraph>     mSubgraphLadder0, mSubgraphLadder1, mSubgraphLadder2, mSubgraphRefuelProbe;
316     shptr<Subgraph>     mSubgraphFlameInner0, mSubgraphFlameInner1, mSubgraphFlameOuter0, mSubgraphFlameOuter1;
317     shptr<Subgraph>     mSubgraphShockWave, mSubgraphManeuverVortexLeft, mSubgraphManeuverVortexRight;
318     std::vector<shptr<Subgraph> > mGearSubgraphs, mLeftWingSubgraphs, mRightWingSubgraphs;
319     fp                  mSwingWingsFraction;
320     fp                  mAileronFraction;
321 };
322 
323 ////////////////////////////////////////////////////////////////////////////////
324 /// @brief F-15 Eagle.
325 ///
326 class F15Aircraft : public Aircraft
327 {
328 PREVENT_COPYING(F15Aircraft)
329 typedef Aircraft Parent;
330 public:
331                     F15Aircraft( shptr<Graph> graph, const WorldVertex& pos );
332                     ~F15Aircraft();
GetName(void)333     virtual const string GetName( void ) { return string("F15Aircraft"); }
334     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
335     virtual      const AircraftSpecs&      GetSpecs( void );
336     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)337     virtual bool    IfHasPropeller( void ) { return false; }
338     virtual void    SetThrottle( const fp throttle );
339     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
340 
341 private:
342     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
343     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
344     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1;
345     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
346     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
347     shptr<Subgraph>     mSubgraphRudderLeft, mSubgraphRudderRight;
348 };
349 
350 ////////////////////////////////////////////////////////////////////////////////
351 /// @brief F-16 Falcon.
352 ///
353 class F16Aircraft : public Aircraft
354 {
355 PREVENT_COPYING(F16Aircraft)
356 typedef Aircraft Parent;
357 public:
358                     F16Aircraft( shptr<Graph> graph, const WorldVertex& pos );
359                     ~F16Aircraft();
GetName(void)360     virtual const string GetName( void ) { return string("F16Aircraft"); }
361     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
362     virtual      const AircraftSpecs&      GetSpecs( void );
363     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)364     virtual bool    IfHasPropeller( void ) { return false; }
365     virtual void    SetThrottle( const fp throttle );
366     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
367 
368 private:
369     shptr<Subgraph>     mSubgraphGear0,  mSubgraphGear1,  mSubgraphGear2;
370     shptr<Subgraph>     mSubgraphGear3,  mSubgraphGear4,  mSubgraphGear5;
371     shptr<Subgraph>     mSubgraphGear6,  mSubgraphGear7,  mSubgraphGear8;
372     shptr<Subgraph>     mSubgraphGear9,  mSubgraphGear10, mSubgraphGear11;
373     shptr<Subgraph>     mSubgraphGear12, mSubgraphGear13, mSubgraphGear14;
374     shptr<Subgraph>     mSubgraphGear15, mSubgraphGear16, mSubgraphGear17;
375     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1;
376     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
377     shptr<Subgraph>     mSubgraphFlapLeft, mSubgraphFlapRight;
378     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
379     shptr<Subgraph>     mSubgraphRudder0, mSubgraphRudder1, mSubgraphRudder2, mSubgraphRudder3;
380     shptr<Subgraph>     mSubgraphJunk0, mSubgraphJunk1;
381 };
382 
383 ////////////////////////////////////////////////////////////////////////////////
384 /// @brief F-18 Hornet.
385 ///
386 class F18Aircraft : public Aircraft
387 {
388 PREVENT_COPYING(F18Aircraft)
389 typedef Aircraft Parent;
390 public:
391                     F18Aircraft( shptr<Graph> graph, const WorldVertex& pos );
392                     ~F18Aircraft();
GetName(void)393     virtual const string GetName( void ) { return string("F18Aircraft"); }
394     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
395     virtual      const AircraftSpecs&      GetSpecs( void );
396     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)397     virtual bool    IfHasPropeller( void ) { return false; }
398     virtual void    SetThrottle( const fp throttle );
399     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
400 
401 private:
402     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
403     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
404     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1;
405     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
406     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
407     shptr<Subgraph>     mSubgraphRudderLeft, mSubgraphRudderRight;
408 };
409 
410 ////////////////////////////////////////////////////////////////////////////////
411 /// @brief SR-71 Blackbird.
412 ///
413 class SR71Aircraft : public Aircraft
414 {
415 PREVENT_COPYING(SR71Aircraft)
416 typedef Aircraft Parent;
417 public:
418                     SR71Aircraft( shptr<Graph> graph, const WorldVertex& pos );
419                     ~SR71Aircraft();
GetName(void)420     virtual const string GetName( void ) { return string("SR71Aircraft"); }
421     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
422     virtual      const AircraftSpecs&      GetSpecs( void );
423     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)424     virtual bool    IfHasPropeller( void ) { return false; }
IfHasGuns(void)425     virtual bool    IfHasGuns( void ) { return false; }
426     virtual void    SetThrottle( const fp throttle );
427     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
428 
429 private:
430     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
431     shptr<Subgraph>     mSubgraphStrut0,  mSubgraphStrut1,  mSubgraphStrut2,  mSubgraphStrut3;
432     shptr<Subgraph>     mSubgraphStrut4,  mSubgraphStrut5,  mSubgraphStrut6,  mSubgraphStrut7;
433     shptr<Subgraph>     mSubgraphStrut8,  mSubgraphStrut9,  mSubgraphStrut10, mSubgraphStrut11;
434     shptr<Subgraph>     mSubgraphStrut12, mSubgraphStrut13, mSubgraphStrut14, mSubgraphStrut15;
435     shptr<Subgraph>     mSubgraphParachute;
436     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1, mSubgraphFlame2;
437     shptr<Subgraph>     mSubgraphFlame3, mSubgraphFlame4, mSubgraphFlame5;
438     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
439     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
440 };
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// @brief Mirage 2000.
444 ///
445 class Mirage2000Aircraft : public Aircraft
446 {
447 PREVENT_COPYING(Mirage2000Aircraft)
448 typedef Aircraft Parent;
449 public:
450                     Mirage2000Aircraft( shptr<Graph> graph, const WorldVertex& pos );
451                     ~Mirage2000Aircraft();
GetName(void)452     virtual const string GetName( void ) { return string("Mirage2000Aircraft"); }
453     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
454     virtual      const AircraftSpecs&      GetSpecs( void );
455     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)456     virtual bool    IfHasPropeller( void ) { return false; }
457     virtual void    SetThrottle( const fp throttle );
458     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
459 
460 private:
461     shptr<Subgraph>     mSubgraphGear0, mSubgraphGear1, mSubgraphGear2;
462     shptr<Subgraph>     mSubgraphGear3, mSubgraphGear4, mSubgraphGear5;
463     shptr<Subgraph>     mSubgraphGear6, mSubgraphGear7, mSubgraphGear8;
464     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1;
465     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;  // are elevators also
466     shptr<Subgraph>     mSubgraphRudder;
467 };
468 
469 ////////////////////////////////////////////////////////////////////////////////
470 /// @brief SU-37 Flanker.
471 ///
472 class SU37Aircraft : public Aircraft
473 {
474 PREVENT_COPYING(SU37Aircraft)
475 typedef Aircraft Parent;
476 public:
477                     SU37Aircraft( shptr<Graph> graph, const WorldVertex& pos );
478                     ~SU37Aircraft();
GetName(void)479     virtual const string GetName( void ) { return string("SU37Aircraft"); }
480     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
481     virtual      const AircraftSpecs&      GetSpecs( void );
482     virtual void    SetLandingGear( const bool down );
IfHasPropeller(void)483     virtual bool    IfHasPropeller( void ) { return false; }
484     virtual void    SetThrottle( const fp throttle );
485     virtual void    RotateControlSurfaces( const uint axis, const fp controlFraction );
486 
487 private:
488     shptr<Subgraph>     mSubgraphGear0;
489     shptr<Subgraph>     mSubgraphFlame0, mSubgraphFlame1;
490     shptr<Subgraph>     mSubgraphAileronLeft, mSubgraphAileronRight;
491     shptr<Subgraph>     mSubgraphElevatorLeft, mSubgraphElevatorRight;
492     shptr<Subgraph>     mSubgraphRudderLeft, mSubgraphRudderRight;
493 };
494 
495 ////////////////////////////////////////////////////////////////////////////////
496 /// @brief Space Shuttle.
497 ///
498 class SpaceShuttleAircraft : public Aircraft
499 {
500 PREVENT_COPYING(SpaceShuttleAircraft)
501 typedef Aircraft Parent;
502 public:
503                     SpaceShuttleAircraft( shptr<Graph> graph, const WorldVertex& pos );
504                     ~SpaceShuttleAircraft();
505     virtual void    Reset( void );
GetName(void)506     virtual const string GetName( void ) { return string("SpaceShuttleAircraft"); }
507     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
508     virtual      const AircraftSpecs&      GetSpecs( void );
IfLandingGear(void)509     virtual bool    IfLandingGear( void ) { return false; }
IfHasPropeller(void)510     virtual bool    IfHasPropeller( void ) { return false; }
511     virtual void    SwingWings( const float fraction );  // really open bay doors
512     virtual void    SwingBayDoors( const float fraction );
513 
514 private:
515     shptr<Subgraph>     mSubgraphBayDoorLeft, mSubgraphBayDoorRight;
516     fp                  mBayDoorsFraction;
517 };
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// @brief Sikorsky-76 rescue helicopter.
521 ///
522 class SikorskyAircraft : public Aircraft
523 {
524 PREVENT_COPYING(SikorskyAircraft)
525 typedef Aircraft Parent;
526 public:
527                     SikorskyAircraft( shptr<Graph> graph, const WorldVertex& pos );
528                     ~SikorskyAircraft();
GetName(void)529     virtual const string GetName( void ) { return string("SikorskyAircraft"); }
530     CLASS_METHOD const AircraftSpecs& ClassGetSpecs( void );
531     virtual      const AircraftSpecs&      GetSpecs( void );
532     virtual void    SetLandingGear( const bool down );
IfLandingGear(void)533     virtual bool    IfLandingGear( void ) { return false; }
IfHasPropeller(void)534     virtual bool    IfHasPropeller( void ) { return false; }
535 
536 private:
537     virtual void    Tick( const Milliseconds millisecElapsed );
538     void            RotateRotors( void );
539 
540 private:
541     shptr<Subgraph>     mSubgraphRotor0, mSubgraphRotor1, mSubgraphRotor2, mSubgraphRotor3;
542     shptr<Subgraph>     mSubgraphRotor4, mSubgraphRotor5, mSubgraphRotor6, mSubgraphRotor7;
543     shptr<Subgraph>     mSubgraphTailRotor;
544 };
545 
546 shptr<Aircraft>
547 MakeAircraft( eAircraftType aircraftType, const WorldVertex& pos, const bool loadCopy );
548 
549 } // namespace program
550 
551 #endif // PROGRAM_AIRCRAFT_HH
552