Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

UserVehicles.h

Go to the documentation of this file.
00001 /*
00002  * UserVehicles.h
00003  *
00004  * Part of Fly! Legacy project
00005  *
00006  * Copyright 2003 Chris Wallace
00007  *
00008  * Fly! Legacy is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  * Fly! Legacy is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  *   along with Fly! Legacy; if not, write to the Free Software
00020  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00031 #ifndef USERVEHICLES_H
00032 #define USERVEHICLES_H
00033 
00034 #include "FlyLegacy.h"
00035 #include "Cameras.h"
00036 #include "Panels.h"
00037 #include "Subsystems.h"
00038 #include "Utility.h"
00039 
00040 #include <string>
00041 #include <vector>
00042 #include <map>
00043 
00044 
00045 //
00046 // Simulated Vehicle
00047 //
00048 // The SVH file contains some key information about the aircraft weight/balance
00049 //   simulation behaviour and
00050 //
00051 
00052 class CSimulatedVehicle : public CStreamObject {
00053 public:
00054   CSimulatedVehicle (const char* svhFilename);
00055 
00056   int   Read (SStream *stream, Tag tag);
00057   void  ReadFinished (void);
00058   void  Write (SStream *stream);
00059 
00060 // Data members
00061 protected:
00062   Tag       type;
00063   unsigned int  mxdt;   // Minimum simulation frame rate
00064   char      acid[64]; // Default tail number
00065   char      make[64]; // Manufacturer
00066   char      name[64]; // Aircraft name (for UI menu)
00067   float     emas;   // Empty mass (slugs)
00068   SVector     mine;   // Moments of inertia
00069   SVector     CofG;   // Default center of gravity
00070   float     imbl;   // Imbalance limit
00071   float     iceR;   // Ice accumulation rate
00072   float     wingarea; // Wing area (sq. ft.)
00073   float     wingspan; // Wing span (ft.)
00074   float     meanchord;
00075   float     ceiling;
00076   float     maxcruisespeed;
00077   float     approachspeed;
00078   float     vne;
00079   float     aoaL;   // Angle of attack limit
00080   float     stallaoa;
00081   float     posG;
00082   float     negG;
00083   float     stallspeed;
00084   float     blst;   // Local velocity at tail at full throttle
00085   float     wTrbSpeed;  // Wing turbulence
00086   float     wTrbTimK;
00087   float     wTrbCeiling;
00088   float     wTrbDuration;
00089   float     nTrbSpeed;  // ??? turbulence
00090   float     nTrbTimK;
00091   float     nTrbCeiling;
00092   float     nTrbDuration;
00093   // CTable   pitd;
00094   // CTable   acrd;
00095   // CTable   dieh;
00096   Tag       sfxdTag;
00097   char      sfxdFilename[64];
00098 
00099   SMessage    mAlt;
00100   SMessage    mSpd;
00101   SMessage    mVsi;
00102   SMessage    mMag;
00103   SMessage    mRpm;
00104 };
00105 
00106 
00107 //
00108 // Fuel Systems
00109 //
00110 // The GAS file contains the configuration of fuel tanks, sources, shutoffs,
00111 //   crossfeeds, etc.
00112 //
00113 
00114 class CFuelSystem : public CStreamObject {
00115 public:
00116   CFuelSystem (const char* gasFilename);
00117   ~CFuelSystem (void);
00118 
00119   int   Read (SStream *stream, Tag tag);
00120   void  ReadFinished (void);
00121   void  Write (SStream *stream);
00122 
00123 public:
00124   EAirportFuelTypes             grad;   // Preferred fuel grade
00125   std::vector<CFuelSubsystem*>  fsub;   // List of CFuelSubsystem* objects
00126 };
00127 
00128 
00129 //
00130 // Aerodynamic Model
00131 //
00132 // The WNG file contains the aerodynamic flight model for the aircraft.
00133 //
00134 class CAirfoil : public CStreamObject {
00135 public:
00136   // Constructors / destructor
00137   CAirfoil (void);
00138 
00139   // CStreamObject methods
00140   int   Read (SStream *stream, Tag tag);
00141 
00142 protected:
00143   std::string     name;   // Airfoil name
00144   float           samn;   // Min stall AOA (rad)
00145   float           samx;   // Max stall AOA (rad)
00146   CDataMap        *lift;  // Lift coefficient vs. AOA
00147   CDataMap        *drag;  // Drag coefficient vs. AOA
00148 };
00149 
00150 
00151 class CWingFlap : public CStreamObject {
00152 public:
00153   // Constructors / destructor
00154   CWingFlap (void);
00155 
00156   // CStreamObject methods
00157   int   Read (SStream *stream, Tag tag);
00158 
00159 protected:
00160   std::string              chan;       // Control channel name
00161   std::vector<std::string> partVector; // List of affected external model parts
00162   bool                     nvrt;       // Invert animation keyframes
00163   CDataMap                 *lift;      // Lift coefficient delta vs. flap angle
00164   CDataMap                 *drag;      // Drag coefficient delta vs. flap angle
00165 };
00166 
00167 
00168 class CWingDamage : public CStreamObject {
00169 public:
00170   // Constructors / destructor
00171   CWingDamage (void);
00172 
00173   // CStreamObject methods
00174   int   Read (SStream *stream, Tag tag);
00175 
00176 protected:
00177   float                 perd;         // Repair cycle (hours)
00178 };
00179 
00180 
00181 class CWingSection : public CStreamObject {
00182 public:
00183   // Constructors / destructor
00184   CWingSection (void);
00185 
00186   // CStreamObject methods
00187   int   Read (SStream *stream, Tag tag);
00188 
00189 protected:
00190   std::string     foil;   // Airfoil name
00191   float           area;   // Wing area (sq. ft.)
00192   float           span;   // Wing span (ft.)
00193   SVector         bPos;   // Aerodynamic center relative to aircraft MAC
00194   SVector         bAng;   // Incidence angles (deg)
00195   bool            grnd;   // Ground effect enabled
00196   float           geff;   // Ground effect factor
00197   float           gAGL;   // Ground effect altitued (ft)
00198   float           idcf;   // Ice drag coefficient
00199   CWingFlap       *flap;  // Flap data
00200   CWingDamage     *dmge;  // Wing damage data
00201   float           load;   // Loading damage rate (damage/sec)
00202 };
00203 
00204 class CAerodynamicModel : public CStreamObject {
00205 public:
00206   // Constructors / destructor
00207   CAerodynamicModel (const char* wngFilename);
00208 
00209   // CStreamObject methods
00210   int   Read (SStream *stream, Tag tag);
00211 
00212 protected:
00213   SVector                             dofa;     // Vector distance from empty CG to
00214                                                 //    aerodynamic datum (ft)
00215   bool                                grnd;     // Global ground effect enabled
00216   float                               geff;     // Global ground effect factor
00217   float                               gAGL;     // Global ground effect altitude
00218   float                               cd;       // ???
00219   std::map<std::string,CAirfoil*>     foilMap;  // Map of airfoil data
00220   std::map<std::string,CWingSection*> wingMap;  // Map of wing sections
00221 };
00222 
00223 
00224 //
00225 // Electrical Subsytems
00226 //
00227 // The AMP file contains a vast array of internal aircraft systems, which define
00228 //   the substantial part of the cockpit avionics and flight displays.  There
00229 //   are typically many (up to hundreds for a complex aircraft) instances of
00230 //   CSubsystem descendents in the subs list within this class.
00231 //
00232 
00233 class CElectricalSystem : public CStreamObject {
00234 public:
00235   CElectricalSystem (const char* ampFilename);
00236   ~CElectricalSystem (void);
00237 
00238   // CStreamObject methods
00239   int   Read (SStream *stream, Tag tag);
00240   void  ReadFinished (void);
00241   void  Write (SStream *stream);
00242 
00243   // CElectricalSystem methods
00244   void  Timeslice (float dT);
00245   void  Print (FILE *f);
00246 
00247 public:
00248   std::vector<CSubsystem*>    subs;   // List of electrical subsystems
00249 
00250   // Shortcut pointers to special subsystem types
00251   CAileronControl       *pAileron;
00252   CElevatorControl      *pElevator;
00253   CRudderControl        *pRudder;
00254   CAileronTrimControl   *pAileronTrim;
00255   CElevatorTrimControl  *pElevatorTrim;
00256   CRudderTrimControl    *pRudderTrim;
00257 };
00258 
00259 
00260 //
00261 // Pitot-Static System
00262 //
00263 // The PSS file contains specifications for the system of pitot and static
00264 //   ports on the aircraft.  These special subsystems are used by traditional
00265 //   "steam" gauge subsystems such as altimeters and speed indicators,
00266 //   as well as high-tech air data computers.
00267 //
00268 
00269 class CPitotStaticSystem : public CStreamObject {
00270 public:
00271   CPitotStaticSystem (const char* pssFilename);
00272   ~CPitotStaticSystem (void);
00273 
00274   int   Read (SStream *stream, Tag tag);
00275   void  ReadFinished (void);
00276   void  Write (SStream *stream);
00277 
00278 public:
00279   float                           iceT;   // Icing condition duration
00280   std::vector<CPitotStaticPort*>  ports;  // List of CPitotStaticPort*
00281 };
00282 
00283 
00284 //
00285 // Ground Suspension
00286 //
00287 // The WHL file contains the ground handling model parameters.
00288 //
00289 
00290 class CGroundSuspension : public CStreamObject {
00291 public:
00292   CGroundSuspension (const char* whlFilename);
00293 
00294   int   Read (SStream *stream, Tag tag);
00295   void  ReadFinished (void);
00296   void  Write (SStream *stream);
00297 
00298 public:
00299 };
00300 
00301 
00302 //
00303 // Loadout Unit
00304 //
00305 // This class represents a single loadout station
00306 //
00307 class CLoadoutUnit : public CStreamObject {
00308 public:
00309   CLoadoutUnit (void);
00310 
00311   int   Read (SStream *stream, Tag tag);
00312   void  ReadFinished (void);
00313   void  Write (SStream *stream);
00314 
00315 protected:
00316   char  name[64];   // Name of loadout position
00317   SVector bPos;     // Offset from default center of gravity
00318   float load;     // Default load value, in pounds
00319   float hiLm;     // Maximum load value, in pounds
00320   char  utyp[64];   // UI type
00321 };
00322 
00323 
00324 //
00325 // Variable Loadouts
00326 //
00327 // The VLD file contains variable loadout positions such as aircrew, passenger
00328 //   and cargo spaces which can affect aircraft weight/balance
00329 //
00330 
00331 class CVariableLoadouts : public CStreamObject {
00332 public:
00333   CVariableLoadouts (const char* vldFilename);
00334   ~CVariableLoadouts (void);
00335 
00336   int   Read (SStream *stream, Tag tag);
00337   void  ReadFinished (void);
00338   void  Write (SStream *stream);
00339 
00340 protected:
00341   std::vector<CLoadoutUnit*>  unit;   // List of loadout stations
00342 };
00343 
00344 
00345 //
00346 // Cockpit Manager
00347 //
00348 // The PIT file contains the cockpit manager, which determines which interior
00349 //   panel views exist for the user vehicle, and how they are linked together
00350 //
00351 
00352 class CCockpitManager : public CStreamObject {
00353 public:
00354   CCockpitManager (const char* pitFilename);
00355   ~CCockpitManager (void);
00356 
00357   // CStreamObject methods
00358   int   Read (SStream *stream, Tag tag);
00359   void  ReadFinished ();
00360 
00361   // CCockpitManager methods
00362   CPanel* GetCurrentPanel (void);
00363   void  SetPanel (Tag tag);
00364   Tag   GetPanel (void);
00365   void  Draw (void);
00366 
00367 protected:
00368   std::map<Tag,CPanel*>  ckpt;   // List of cockpit panels indexed by unique tag
00369 
00370   // Pointer to current CPanel
00371   CPanel*       pPanel;
00372 };
00373 
00374 
00375 //
00376 // Camera Manager
00377 //
00378 // CCameraManager links together all of the various static and interactive
00379 //   panel views defined in the CCockpitManager (.PIT file).
00380 //
00381 
00382 class CCameraManager : public CStreamObject {
00383 public:
00384   CCameraManager (const char* whlFilename);
00385   ~CCameraManager (void);
00386 
00387   // CStreamObject methods
00388   virtual int   Read (SStream *stream, Tag tag);
00389   virtual void  ReadFinished (void);
00390 
00391   // CCameraManager
00392   virtual void    UpdateCamera (SPosition *targetPosition,
00393                                   SVector *targetOrientation,
00394                     SPosition *eyePosition,
00395                     SVector *eyeOrientation,
00396                     const float dT);
00397   virtual CCamera*  GetActiveCamera (void);
00398   virtual void    SelectCamera (Tag id);
00399   virtual void    NextCamera (void);
00400   virtual void    PrevCamera (void);
00401   virtual void    Print (FILE *f);
00402 
00403 private:
00404   void ActivateCamera (void);
00405 
00406 protected:
00407   std::vector<CCamera*>           came;     // List of cameras
00408   std::vector<CCamera*>::iterator iActive;  // Currently active camera
00409   Tag                             defaultCamera;  // Tag of default camera
00410 
00411   // Current camera parameters
00412   SPosition eyePos, tgtPos;
00413   SVector   eyeOrient, tgtOrient;
00414   sgVec4    ssgCameraEye;
00415 };
00416 
00417 
00418 //
00419 // CLevelOfDetail represents an external model that has a number of varyingly-detailed
00420 //   models for the same object.  High-detail models are typically displayed when
00421 //   the object is close up, and lower-detail models when the object is farther away.
00422 //
00423 // An SSG tree is generated as follows:
00424 //  + ssgSelector daynight
00425 //    + ssgSelector day
00426 //      + ssgTransform day1
00427 //        - ssgLeaf...
00428 //      + ssgTransform day2 ...
00429 //        - ssgLeaf...
00430 //      + ssgTransform dayshadow
00431 //        - ssgLeaf...
00432 //    + ssgSelector night
00433 //      + ssgTransform night1
00434 //        - ssgLeaf...
00435 //      + ssgTransform night2 ...
00436 //        - ssgLeaf...
00437 //      + ssgTransform nightshadow
00438 //        - ssgLeaf...
00439 
00440 
00441 class CLevelOfDetail : public CStreamObject {
00442 public:
00443   // Constructors / Destructor
00444   CLevelOfDetail (const char* lodFilename);
00445   ~CLevelOfDetail (void);
00446 
00447   // CStreamObject methods
00448   int   Read (SStream *stream, Tag tag);
00449 
00450   // CLevelOfDetail methods
00451   ssgEntity *GetSSGEntity (void);
00452 
00453 public:
00454   ssgRoot   *root;    // Root of LOD model
00455   ssgSelector *daynight;  // Selector for either day or night models
00456   ssgSelector *day;   // Selector for day models based on LOD
00457   ssgSelector *night;   // Selector for night models based on LOD
00458 
00459   std::vector<CModelACM*>  modelAcm;     // Daytime models
00460   CModelACM                *shadowAcm;   // Shadow model
00461 };
00462 
00463 
00464 //
00465 // Radio Manager
00466 //
00467 class CRadioManager : public CStreamObject {
00468 public:
00469   CRadioManager (const char* rdoFilename);
00470 
00471   int   Read (SStream *stream, Tag tag);
00472 //  void  ReadFinished (void);
00473 //  void  Write (SStream *stream);
00474 
00475 public:
00476 };
00477 
00478 
00479 //
00480 // External Lights
00481 //
00482 class CExternalLights : public CStreamObject {
00483 public:
00484   CExternalLights (const char* eltFilename);
00485 
00486   int   Read (SStream *stream, Tag tag);
00487   void  ReadFinished (void);
00488   void  Write (SStream *stream);
00489 
00490 public:
00491 };
00492 
00493 
00494 //
00495 // Engine Manager
00496 //
00497 class CEngineManager : public CStreamObject {
00498 public:
00499   CEngineManager (const char* eltFilename);
00500 
00501   int   Read (SStream *stream, Tag tag);
00502   void  ReadFinished (void);
00503   void  Write (SStream *stream);
00504 
00505 public:
00506 };
00507 
00508 
00509 //
00510 // Control Mixer
00511 //
00512 class CControlMixer : public CStreamObject {
00513 public:
00514   CControlMixer (const char* mixFilename);
00515 
00516   int   Read (SStream *stream, Tag tag);
00517   void  ReadFinished (void);
00518   void  Write (SStream *stream);
00519 
00520 public:
00521 };
00522 
00523 
00524 //
00525 // Checklists
00526 //
00527 class CChecklists : public CStreamObject {
00528 public:
00529   CChecklists (const char* eltFilename);
00530 
00531   int   Read (SStream *stream, Tag tag);
00532   void  ReadFinished (void);
00533   void  Write (SStream *stream);
00534 
00535 public:
00536 };
00537 
00538 
00539 //
00540 // Flight Control System
00541 //
00542 // The FCS file contains the specification for the automated flight control
00543 //   system, aka "autopilot".
00544 //
00545 class CFlightControlSystem : public CStreamObject {
00546 public:
00547   CFlightControlSystem (const char* fcsFilename);
00548 
00549   int   Read (SStream *stream, Tag tag);
00550   void  ReadFinished (void);
00551   void  Write (SStream *stream);
00552 
00553 public:
00554 };
00555 
00556 
00557 //
00558 // Slope Wind Data
00559 //
00560 class CSlopeWindData : public CStreamObject {
00561 public:
00562   CSlopeWindData (const char* swdFilename);
00563 
00564   int   Read (SStream *stream, Tag tag);
00565   void  ReadFinished (void);
00566   void  Write (SStream *stream);
00567 
00568 public:
00569 };
00570 
00571 
00572 /*
00573  * User Vehicles
00574  */
00575 
00576 
00577 class CHelicopter : CStreamObject {
00578 public:
00579   CHelicopter (const char* nfoFilename);
00580 
00581   int   Read (SStream *stream, Tag tag);
00582   void  ReadFinished (void);
00583   void  Write (SStream *stream);
00584 
00585 protected:
00586   char  make[64];     // Make/model of aircraft, used as the text for
00587                               //   aircraft in selection menu
00588   char  iconFilename[64]; // Filename of PBM file for aircraft select menu
00589   int   classification;
00590   int   usage;
00591   char  svhFilename[64];
00592   char  gasFilename[64];
00593   char  wngFilename[64];
00594   char  ampFilename[64];
00595   char  pssFilename[64];
00596   char  whlFilename[64];
00597   char  vldFilename[64];
00598   char  pitFilename[64];
00599   char  camFilename[64];
00600   char  lodFilename[64];
00601   char  rdoFilename[64];
00602   char  eltFilename[64];
00603   char  engFilename[64];
00604   char  rtrFilename[64];
00605   char  mixFilename[64];
00606   char  cklFilename[64];
00607   char  fcsFilename[64];
00608   char  swdFilename[64];
00609   char  sitFilename[64];
00610 };
00611 
00612 #endif // USERVEHICLES_H
SourceForge.net Logo Documentation generated by doxygen