1
0
Fork 0
flightgear/src/FDM/YASim/FGFDM.hpp
curt 2119db35c3 This is step "1" of probably "many" in the process of separating out the
scene management code and organizing it within simgear.  My strategy is
to identify the code I want to move, and break it's direct flightgear
dependencies.  Then it will be free to move over into the simgear package.

- Moved some property specific code into simgear/props/
- Split out the condition code from fgfs/src/Main/fg_props and put it
  in it's own source file in simgear/props/
- Created a scene subdirectory for scenery, model, and material property
  related code.
- Moved location.[ch]xx into simgear/scene/model/
- The location and condition code had dependencies on flightgear's global
  state (all the globals-> stuff, the flightgear property tree, etc.)  SimGear
  code can't depend on it so that data has to be passed as parameters to the
  functions/methods/constructors.
- This need to pass data as function parameters had a dramatic cascading
  effect throughout the FlightGear code.
2003-05-06 23:46:24 +00:00

74 lines
2 KiB
C++

#ifndef _FGFDM_HPP
#define _FGFDM_HPP
#include <simgear/xml/easyxml.hxx>
#include <simgear/props/props.hxx>
#include "Airplane.hpp"
#include "Vector.hpp"
namespace yasim {
class Wing;
// This class forms the "glue" to the FlightGear codebase. It handles
// parsing of XML airplane files, interfacing to the properties
// system, and providing data for the use of the FGInterface object.
class FGFDM : public XMLVisitor {
public:
FGFDM();
~FGFDM();
void init();
void iterate(float dt);
void getExternalInput(float dt=1e6);
Airplane* getAirplane();
// XML parsing callback from XMLVisitor
virtual void startElement(const char* name, const XMLAttributes &atts);
private:
struct AxisRec { char* name; int handle; };
struct EngRec { char* prefix; Thruster* eng; };
struct WeightRec { char* prop; float size; int handle; };
struct PropOut { SGPropertyNode* prop; int handle, type; bool left;
float min, max; };
void setOutputProperties();
Wing* parseWing(XMLAttributes* a, const char* name);
int parseAxis(const char* name);
int parseOutput(const char* name);
void parseWeight(XMLAttributes* a);
void parsePropeller(XMLAttributes* a);
bool eq(const char* a, const char* b);
char* dup(const char* s);
int attri(XMLAttributes* atts, char* attr);
int attri(XMLAttributes* atts, char* attr, int def);
float attrf(XMLAttributes* atts, char* attr);
float attrf(XMLAttributes* atts, char* attr, float def);
// The core Airplane object we manage.
Airplane _airplane;
// The list of "axes" that we expect to find as input. These are
// typically property names.
Vector _axes;
// Settable weights
Vector _weights;
// Engine types. Contains an EngRec structure.
Vector _thrusters;
// Output properties for the ControlMap
Vector _controlProps;
// Parsing temporaries
void* _currObj;
bool _cruiseCurr;
int _nextEngine;
};
}; // namespace yasim
#endif // _FGFDM_HPP