void fgAircraftInit( void ) {
FG_LOG( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure" );
- current_aircraft.flight = &cur_flight_params;
+ current_aircraft.fdm_state = &cur_fdm_state;
current_aircraft.controls = &controls;
}
// Display various parameters to stdout
void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
- fgFLIGHT *f;
+ FGState *f;
- f = a->flight;
+ f = a->fdm_state;
FG_LOG( FG_FLIGHT, FG_DEBUG,
"Pos = ("
// $Log$
+// Revision 1.6 1998/12/05 15:53:59 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.5 1998/12/03 01:14:58 curt
// Converted fgFLIGHT to a class.
//
// Define a structure containing all the parameters for an aircraft
typedef struct{
- fgFLIGHT *flight;
+ FGState *fdm_state;
fgCONTROLS *controls;
} fgAIRCRAFT ;
// $Log$
+// Revision 1.3 1998/12/05 15:54:01 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.2 1998/10/17 01:33:54 curt
// C++ ifying ...
//
geoRa, geoDec;
fgAIRCRAFT *air;
- fgFLIGHT *f;
+ FGState *f;
air = ¤t_aircraft;
- f = air->flight;
+ f = air->fdm_state;
updateOrbElements(t);
actTime = fgCalcActTime(t);
// Draw the Sky
void fgSkyRender( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgLIGHT *l;
fgVIEW *v;
float inner_color[4];
double diff;
int i;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
v = ¤t_view;
// $Log$
+// Revision 1.16 1998/12/05 15:54:03 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.15 1998/12/03 01:15:36 curt
// Converted fgFLIGHT to a class.
// Tweaks for Sun portability.
// Draw the Stars
void fgStarsRender( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgVIEW *v;
fgLIGHT *l;
fgTIME *t;
int i;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
t = &cur_time_params;
v = ¤t_view;
// $Log$
+// Revision 1.24 1998/12/05 15:54:04 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.23 1998/11/23 21:48:28 curt
// Borland portability tweaks.
//
static double get_speed( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_V_equiv_kts() ); // Make an explicit function call.
}
static double get_aoa( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
}
static double fgAPget_roll( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Phi() * RAD_TO_DEG );
}
static double get_pitch( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Theta() );
}
double fgAPget_heading( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Psi() * RAD_TO_DEG );
}
static double fgAPget_altitude( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Altitude() * FEET_TO_METER /* -rough_elev */ );
}
static double fgAPget_climb( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
// return in meters per minute
return( f->get_Climb_Rate() * FEET_TO_METER * 60 );
static double get_sideslip( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Beta() );
}
static double fgAPget_agl( void )
{
- fgFLIGHT *f;
+ FGState *f;
double agl;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
agl = f->get_Altitude() * FEET_TO_METER - scenery.cur_elev;
return( agl );
double get_latitude( void )
{
- fgFLIGHT *f;
- f = current_aircraft.flight;
+ FGState *f;
+ f = current_aircraft.fdm_state;
// return( toDM(FG_Latitude * RAD_TO_DEG) );
return((double)((int)( f->get_Latitude() * RAD_TO_DEG)) );
double get_lat_min( void )
{
- fgFLIGHT *f;
+ FGState *f;
double a, d;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
a = f->get_Latitude() * RAD_TO_DEG;
if (a < 0.0) {
double get_longitude( void )
{
- fgFLIGHT *f;
- f = current_aircraft.flight;
+ FGState *f;
+ f = current_aircraft.fdm_state;
// return( toDM(FG_Longitude * RAD_TO_DEG) );
return((double)((int) (f->get_Longitude() * RAD_TO_DEG)) );
}
double get_long_min( void )
{
- fgFLIGHT *f;
+ FGState *f;
double a, d;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
a = f->get_Longitude() * RAD_TO_DEG;
if (a < 0.0) {
double get_speed( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_V_equiv_kts() ); // Make an explicit function call.
}
double get_aoa( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Gamma_vert_rad() * RAD_TO_DEG );
}
double get_roll( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Phi() );
}
double get_pitch( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Theta() );
}
double get_heading( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Psi() * RAD_TO_DEG );
}
double get_altitude( void )
{
- fgFLIGHT *f;
+ FGState *f;
// double rough_elev;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
// rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
// f->get_Latitude() * RAD_TO_ARCSEC);
double get_agl( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
return f->get_Altitude() - scenery.cur_elev * METER_TO_FEET;
double get_sideslip( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
return( f->get_Beta() );
}
double get_climb_rate( void )
{
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
return f->get_Climb_Rate() * 60.0;
// $Log$
+// Revision 1.25 1998/12/05 15:54:07 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.24 1998/12/03 01:16:00 curt
// Converted fgFLIGHT to a class.
//
// reset flight params to a specific position
-void fgExternalInit(fgFLIGHT &f, double dt) {
+void fgExternalInit( FGState &f, double dt ) {
}
// update position based on inputs, positions, velocities, etc.
-void fgExternalUpdate( fgFLIGHT& f, int multiloop ) {
+void fgExternalUpdate( FGState& f, int multiloop ) {
}
// $Log$
+// Revision 1.2 1998/12/05 15:54:13 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.1 1998/12/04 01:28:49 curt
// Initial revision.
//
// reset flight params to a specific position
-void fgExternalInit(fgFLIGHT& f, double dt);
+void fgExternalInit( FGState& f, double dt );
// update position based on inputs, positions, velocities, etc.
-void fgExternalUpdate( fgFLIGHT& f, int multiloop );
+void fgExternalUpdate( FGState& f, int multiloop );
#endif // _EXTERNAL_HXX
// $Log$
+// Revision 1.3 1998/12/05 15:54:14 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.2 1998/12/05 14:18:47 curt
// added an fgTIMESTAMP to define when this record is valid.
//
// Run an iteration of the EOM (equations of motion)
-int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop) {
+int fgLaRCsimUpdate(FGState& f, int multiloop) {
double save_alt = 0.0;
// lets try to avoid really screwing up the LaRCsim model
}
// translate FG to LaRCsim structure
- fgFlight_2_LaRCsim(f);
+ FGState_2_LaRCsim(f);
// printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048);
// printf("Altitude = %.2f\n", Altitude * 0.3048);
// printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048);
// translate LaRCsim back to FG structure so that the
// autopilot (and the rest of the sim can use the updated
// values
- fgLaRCsim_2_Flight(f);
+ fgLaRCsim_2_FGState(f);
// but lets restore our original bogus altitude when we are done
if ( save_alt < -9000.0 ) {
}
-// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
-int fgFlight_2_LaRCsim (fgFLIGHT& f) {
+// Convert from the FGState struct to the LaRCsim generic_ struct
+int FGState_2_LaRCsim (FGState& f) {
Lat_control = controls.get_aileron();
Long_control = controls.get_elevator();
}
-// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
-int fgLaRCsim_2_Flight (fgFLIGHT& f) {
+// Convert from the LaRCsim generic_ struct to the FGState struct
+int fgLaRCsim_2_FGState (FGState& f) {
// Mass properties and geometry values
f.set_Inertias( Mass, I_xx, I_yy, I_zz, I_xz );
f.set_Pilot_Location( Dx_pilot, Dy_pilot, Dz_pilot );
// $Log$
+// Revision 1.6 1998/12/05 15:54:08 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.5 1998/12/03 04:25:02 curt
// Working on fixing up new fgFLIGHT class.
//
int fgLaRCsimInit(double dt);
// update position based on inputs, positions, velocities, etc.
-int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop);
+int fgLaRCsimUpdate(FGState& f, int multiloop);
-// Convert from the fgFLIGHT struct to the LaRCsim generic_ struct
-int fgFlight_2_LaRCsim (fgFLIGHT& f);
+// Convert from the FGState struct to the LaRCsim generic_ struct
+int FGState_2_LaRCsim (FGState& f);
-// Convert from the LaRCsim generic_ struct to the fgFLIGHT struct
-int fgLaRCsim_2_Flight (fgFLIGHT& f);
+// Convert from the LaRCsim generic_ struct to the FGState struct
+int fgLaRCsim_2_FGState (FGState& f);
#endif // _LARCSIM_HXX
// $Log$
+// Revision 1.4 1998/12/05 15:54:09 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.3 1998/12/03 01:16:38 curt
// Converted fgFLIGHT to a class.
//
#include <Math/fg_geodesy.hxx>
-fgFLIGHT cur_flight_params;
+FGState cur_fdm_state;
// Initialize the flight model parameters
-int fgFlightModelInit(int model, fgFLIGHT& f, double dt) {
+int fgFlightModelInit(int model, FGState& f, double dt) {
double save_alt = 0.0;
int result;
FG_LOG( FG_FLIGHT ,FG_INFO, "Initializing flight model" );
- if ( model == fgFLIGHT::FG_SLEW ) {
+ if ( model == FGState::FG_SLEW ) {
// fgSlewInit(dt);
- } else if ( model == fgFLIGHT::FG_LARCSIM ) {
+ } else if ( model == FGState::FG_LARCSIM ) {
// lets try to avoid really screwing up the LaRCsim model
if ( f.get_Altitude() < -9000.0 ) {
save_alt = f.get_Altitude();
f.set_Altitude( 0.0 );
}
- fgFlight_2_LaRCsim(f); // translate FG to LaRCsim structure
+ FGState_2_LaRCsim(f); // translate FG to LaRCsim structure
fgLaRCsimInit(dt);
FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << f.get_Latitude() );
- fgLaRCsim_2_Flight(f); // translate LaRCsim back to FG structure
+ fgLaRCsim_2_FGState(f); // translate LaRCsim back to FG structure
// but lets restore our original bogus altitude when we are done
if ( save_alt < -9000.0 ) {
f.set_Altitude( save_alt );
}
- } else if ( model == fgFLIGHT::FG_EXTERNAL ) {
+ } else if ( model == FGState::FG_EXTERNAL ) {
fgExternalInit(f, dt);
} else {
FG_LOG( FG_FLIGHT, FG_WARN,
// Run multiloop iterations of the flight model
-int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) {
+int fgFlightModelUpdate(int model, FGState& f, int multiloop) {
double time_step, start_elev, end_elev;
int result;
// printf("Altitude = %.2f\n", FG_Altitude * 0.3048);
time_step = (1.0 / DEFAULT_MODEL_HZ) * multiloop;
start_elev = f.get_Altitude();
- if ( model == fgFLIGHT::FG_SLEW ) {
+ if ( model == FGState::FG_SLEW ) {
// fgSlewUpdate(f, multiloop);
- } else if ( model == fgFLIGHT::FG_LARCSIM ) {
+ } else if ( model == FGState::FG_LARCSIM ) {
fgLaRCsimUpdate(f, multiloop);
- } else if ( model == fgFLIGHT::FG_EXTERNAL ) {
+ } else if ( model == FGState::FG_EXTERNAL ) {
// fgExternalUpdate(f, multiloop);
} else {
FG_LOG( FG_FLIGHT, FG_WARN,
// Set the altitude (force)
-void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) {
+void fgFlightModelSetAltitude(int model, FGState& f, double alt_meters) {
double sea_level_radius_meters;
double lat_geoc;
// Set the FG variables first
(sea_level_radius_meters * METER_TO_FEET) );
// additional work needed for some flight models
- if ( model == fgFLIGHT::FG_LARCSIM ) {
+ if ( model == FGState::FG_LARCSIM ) {
ls_ForceAltitude( f.get_Altitude() );
}
// $Log$
+// Revision 1.6 1998/12/05 15:54:11 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.5 1998/12/04 01:29:39 curt
// Stubbed in a new flight model called "External" which is expected to be driven
// from some external source.
// This is based heavily on LaRCsim/ls_generic.h
-class fgFLIGHT {
+class FGState {
public:
v_local_v[2] = down;
}
- FG_VECTOR_3 v_local_rel_ground_v; /* V rel w.r.t. earth surface */
+ FG_VECTOR_3 v_local_rel_ground_v; // V rel w.r.t. earth surface
inline double * get_V_local_rel_ground_v() { return v_local_rel_ground_v; }
inline double get_V_north_rel_ground() const {
return v_local_rel_ground_v[0];
v_local_rel_ground_v[2] = down;
}
- FG_VECTOR_3 v_local_airmass_v; /* velocity of airmass (steady winds) */
+ FG_VECTOR_3 v_local_airmass_v; // velocity of airmass (steady winds)
inline double * get_V_local_airmass_v() { return v_local_airmass_v; }
inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
v_local_airmass_v[2] = down;
}
- FG_VECTOR_3 v_local_rel_airmass_v; /* velocity of veh. relative to */
- /* airmass */
+ FG_VECTOR_3 v_local_rel_airmass_v; // velocity of veh. relative to
+ // airmass
inline double * get_V_local_rel_airmass_v() {
return v_local_rel_airmass_v;
}
v_local_rel_airmass_v[2] = down;
}
- FG_VECTOR_3 v_local_gust_v; /* linear turbulence components, L frame */
+ FG_VECTOR_3 v_local_gust_v; // linear turbulence components, L frame
inline double * get_V_local_gust_v() { return v_local_gust_v; }
inline double get_U_gust() const { return v_local_gust_v[0]; }
inline double get_V_gust() const { return v_local_gust_v[1]; }
v_local_gust_v[2] = w;
}
- FG_VECTOR_3 v_wind_body_v; /* Wind-relative velocities in body axis */
+ FG_VECTOR_3 v_wind_body_v; // Wind-relative velocities in body axis
inline double * get_V_wind_body_v() { return v_wind_body_v; }
inline double get_U_body() const { return v_wind_body_v[0]; }
inline double get_V_body() const { return v_wind_body_v[1]; }
inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
- FG_VECTOR_3 omega_body_v; /* Angular B rates */
+ FG_VECTOR_3 omega_body_v; // Angular B rates
inline double * get_Omega_body_v() { return omega_body_v; }
inline double get_P_body() const { return omega_body_v[0]; }
inline double get_Q_body() const { return omega_body_v[1]; }
omega_body_v[2] = r;
}
- FG_VECTOR_3 omega_local_v; /* Angular L rates */
+ FG_VECTOR_3 omega_local_v; // Angular L rates
inline double * get_Omega_local_v() { return omega_local_v; }
inline double get_P_local() const { return omega_local_v[0]; }
inline double get_Q_local() const { return omega_local_v[1]; }
omega_local_v[2] = r;
}
- FG_VECTOR_3 omega_total_v; /* Diff btw B & L */
+ FG_VECTOR_3 omega_total_v; // Diff btw B & L
inline double * get_Omega_total_v() { return omega_total_v; }
inline double get_P_total() const { return omega_total_v[0]; }
inline double get_Q_total() const { return omega_total_v[1]; }
euler_rates_v[2] = psi;
}
- FG_VECTOR_3 geocentric_rates_v; /* Geocentric linear velocities */
+ FG_VECTOR_3 geocentric_rates_v; // Geocentric linear velocities
inline double * get_Geocentric_rates_v() { return geocentric_rates_v; }
inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
/*======================= Miscellaneous quantities ========================*/
- double t_local_to_body_m[3][3]; /* Transformation matrix L to B */
+ double t_local_to_body_m[3][3]; // Transformation matrix L to B
// inline double * get_T_local_to_body_m() { return t_local_to_body_m; }
inline double get_T_local_to_body_11() const {
return t_local_to_body_m[0][0];
}
}
- double gravity; /* Local acceleration due to G */
+ double gravity; // Local acceleration due to G
inline double get_Gravity() const { return gravity; }
inline void set_Gravity(double g) { gravity = g; }
- double centrifugal_relief; /* load factor reduction due to speed */
+ double centrifugal_relief; // load factor reduction due to speed
inline double get_Centrifugal_relief() const { return centrifugal_relief; }
inline void set_Centrifugal_relief(double cr) { centrifugal_relief = cr; }
- double alpha, beta, alpha_dot, beta_dot; /* in radians */
+ double alpha, beta, alpha_dot, beta_dot; // in radians
inline double get_Alpha() const { return alpha; }
inline void set_Alpha( double a ) { alpha = a; }
inline double get_Beta() const { return beta; }
inline double get_Sin_psi() const { return sin_psi; }
inline void set_Sin_psi( double sp ) { sin_psi = sp; }
- double gamma_vert_rad, gamma_horiz_rad; /* Flight path angles */
+ double gamma_vert_rad, gamma_horiz_rad; // Flight path angles
inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
inline void set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
inline double get_Gamma_horiz_rad() const { return gamma_horiz_rad; }
inline double get_Radius_to_rwy() const { return radius_to_rwy; }
inline void set_Radius_to_rwy( double r ) { radius_to_rwy = r; }
- FG_VECTOR_3 d_cg_rwy_local_v; /* CG rel. to rwy in local coords */
+ FG_VECTOR_3 d_cg_rwy_local_v; // CG rel. to rwy in local coords
inline double * get_D_cg_rwy_local_v() { return d_cg_rwy_local_v; }
inline double get_D_cg_north_of_rwy() const { return d_cg_rwy_local_v[0]; }
inline double get_D_cg_east_of_rwy() const { return d_cg_rwy_local_v[1]; }
d_cg_rwy_local_v[2] = above;
}
- FG_VECTOR_3 d_cg_rwy_rwy_v; /* CG relative to rwy, in rwy coordinates */
+ FG_VECTOR_3 d_cg_rwy_rwy_v; // CG relative to rwy, in rwy coordinates
inline double * get_D_cg_rwy_rwy_v() { return d_cg_rwy_rwy_v; }
inline double get_X_cg_rwy() const { return d_cg_rwy_rwy_v[0]; }
inline double get_Y_cg_rwy() const { return d_cg_rwy_rwy_v[1]; }
d_cg_rwy_rwy_v[2] = h;
}
- FG_VECTOR_3 d_pilot_rwy_local_v; /* pilot rel. to rwy in local coords */
+ FG_VECTOR_3 d_pilot_rwy_local_v; // pilot rel. to rwy in local coords
inline double * get_D_pilot_rwy_local_v() { return d_pilot_rwy_local_v; }
inline double get_D_pilot_north_of_rwy() const {
return d_pilot_rwy_local_v[0];
d_pilot_rwy_local_v[2] = above;
}
- FG_VECTOR_3 d_pilot_rwy_rwy_v; /* pilot rel. to rwy, in rwy coords. */
+ FG_VECTOR_3 d_pilot_rwy_rwy_v; // pilot rel. to rwy, in rwy coords.
inline double * get_D_pilot_rwy_rwy_v() { return d_pilot_rwy_rwy_v; }
inline double get_X_pilot_rwy() const { return d_pilot_rwy_rwy_v[0]; }
inline double get_Y_pilot_rwy() const { return d_pilot_rwy_rwy_v[1]; }
d_pilot_rwy_rwy_v[2] = h;
}
- double climb_rate; /* in feet per second */
+ double climb_rate; // in feet per second
inline double get_Climb_Rate() const { return climb_rate; }
inline void set_Climb_Rate(double rate) { climb_rate = rate; }
};
-extern fgFLIGHT cur_flight_params;
+extern FGState cur_fdm_state;
-/* General interface to the flight model routines */
+// General interface to the flight model routines
-/* Initialize the flight model parameters */
-int fgFlightModelInit(int model, fgFLIGHT& f, double dt);
+// Initialize the flight model parameters
+int fgFlightModelInit(int model, FGState& f, double dt);
-/* Run multiloop iterations of the flight model */
-int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop);
+// Run multiloop iterations of the flight model
+int fgFlightModelUpdate(int model, FGState& f, int multiloop);
-/* Set the altitude (force) */
-void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters);
+// Set the altitude (force)
+void fgFlightModelSetAltitude(int model, FGState& f, double alt_meters);
#endif // _FLIGHT_HXX
// $Log$
+// Revision 1.6 1998/12/05 15:54:12 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.5 1998/12/04 01:29:40 curt
// Stubbed in a new flight model called "External" which is expected to be driven
// from some external source.
// Handle keyboard events
void GLUTkey(unsigned char k, int x, int y) {
- fgFLIGHT *f;
+ FGState *f;
fgTIME *t;
fgVIEW *v;
struct fgWEATHER *w;
float fov, tmp;
static bool winding_ccw = true;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
t = &cur_time_params;
v = ¤t_view;
w = ¤t_weather;
// $Log$
+// Revision 1.34 1998/12/05 15:54:17 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.33 1998/12/03 01:17:12 curt
// Converted fgFLIGHT to a class.
//
// Update all Visuals (redraws anything graphics related)
static void fgRenderFrame( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgLIGHT *l;
fgTIME *t;
fgVIEW *v;
GLfloat terrain_color[4] = { 0.54, 0.44, 0.29, 1.0 };
GLbitfield clear_mask;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
t = &cur_time_params;
v = ¤t_view;
// Update internal time dependent calculations (i.e. flight model)
void fgUpdateTimeDepCalcs(int multi_loop) {
- fgFLIGHT *f;
+ FGState *f;
fgLIGHT *l;
fgTIME *t;
fgVIEW *v;
int i;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
t = &cur_time_params;
v = ¤t_view;
// printf("updating flight model x %d\n", multi_loop);
fgFlightModelUpdate( current_options.get_flight_model(),
- cur_flight_params, multi_loop );
+ cur_fdm_state, multi_loop );
} else {
fgFlightModelUpdate( current_options.get_flight_model(),
- cur_flight_params, 0 );
+ cur_fdm_state, 0 );
}
// update the view angle
// What should we do when we have nothing else to do? Let's get ready
// for the next move and update the display?
static void fgMainLoop( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgGENERAL *g;
fgTIME *t;
static int remainder = 0;
int i;
double accum;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
g = &general;
t = &cur_time_params;
scenery.cur_elev + alt_adjust_m - 3.0,
scenery.cur_elev + alt_adjust_m );
fgFlightModelSetAltitude( current_options.get_flight_model(),
- cur_flight_params,
+ cur_fdm_state,
scenery.cur_elev + alt_adjust_m );
FG_LOG( FG_ALL, FG_DEBUG,
// Main ...
int main( int argc, char **argv ) {
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
#ifdef HAVE_BC5PLUS
_control87(MCW_EM, MCW_EM); /* defined in float.h */
// $Log$
+// Revision 1.72 1998/12/05 15:54:18 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.71 1998/12/05 14:19:51 curt
// Looking into a problem with cur_view_params.abs_view_pos initialization.
//
// Set initial position and orientation
int fgInitPosition( void ) {
string id;
- fgFLIGHT *f;
+ FGState *f;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
id = current_options.get_airport_id();
if ( id.length() ) {
// Returns non-zero if a problem encountered.
int fgInitSubsystems( void )
{
- fgFLIGHT *f;
+ FGState *f;
fgLIGHT *l;
fgTIME *t;
fgVIEW *v;
// allocates structures so must happen before any of the flight
// model or control parameters are set
fgAircraftInit(); // In the future this might not be the case.
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
// set the initial position
fgInitPosition();
// Initialize the flight model subsystem data structures base on
// above values
- fgFlightModelInit( current_options.get_flight_model(), cur_flight_params,
+ fgFlightModelInit( current_options.get_flight_model(), cur_fdm_state,
1.0 / DEFAULT_MODEL_HZ );
// I'm just sticking this here for now, it should probably move
// $Log$
+// Revision 1.55 1998/12/05 15:54:20 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.54 1998/12/05 14:19:53 curt
// Looking into a problem with cur_view_params.abs_view_pos initialization.
//
char dir;
int deg;
double min;
- fgFLIGHT *f;
+ FGState *f;
fgTIME *t;
// run once every two seconds
return;
}
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
t = &cur_time_params;
char utc[10];
char dir;
int deg;
double min;
- fgFLIGHT *f;
+ FGState *f;
fgTIME *t;
// run once per second
return;
}
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
t = &cur_time_params;
char utc[10];
// $Log$
+// Revision 1.7 1998/12/05 15:54:21 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.6 1998/12/03 01:17:18 curt
// Converted fgFLIGHT to a class.
//
sound(1),
// Flight Model options
- flight_model(fgFLIGHT::FG_LARCSIM),
+ flight_model(FGState::FG_LARCSIM),
// Rendering options
fog(FG_FOG_NICEST), // nicest
// printf("flight model = %s\n", fm);
if ( fm == "slew" ) {
- return fgFLIGHT::FG_SLEW;
+ return FGState::FG_SLEW;
} else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
- return fgFLIGHT::FG_LARCSIM;
+ return FGState::FG_LARCSIM;
} else if ( fm == "external" ) {
- return fgFLIGHT::FG_EXTERNAL;
+ return FGState::FG_EXTERNAL;
} else {
FG_LOG( FG_GENERAL, FG_ALERT, "Unknown flight model = " << fm );
exit(-1);
// $Log$
+// Revision 1.34 1998/12/05 15:54:22 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.33 1998/12/04 01:30:44 curt
// Added support for the External flight model.
//
// Update the view volume, position, and orientation
void fgVIEW::UpdateViewParams( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgLIGHT *l;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
l = &cur_light_params;
UpdateViewMath(f);
// Update the view parameters
-void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
+void fgVIEW::UpdateViewMath( FGState *f ) {
Point3D p;
MAT3vec vec, forward, v0, minus_z;
MAT3mat R, TMP, UP, LOCAL, VIEW;
// Update the "World to Eye" transformation matrix
// This is most useful for view frustum culling
-void fgVIEW::UpdateWorldToEye( fgFLIGHT *f ) {
+void fgVIEW::UpdateWorldToEye( FGState *f ) {
MAT3mat R_Phi, R_Theta, R_Psi, R_Lat, R_Lon, T_view;
MAT3mat TMP;
MAT3hvec vec;
// $Log$
+// Revision 1.29 1998/12/05 15:54:24 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.28 1998/12/03 01:17:20 curt
// Converted fgFLIGHT to a class.
//
// Initialize a view class
void Init( void );
- void update_globals( fgFLIGHT *f );
+ void update_globals( FGState *f );
// Basically, this is a modified version of the Mesa gluLookAt()
// function that's been modified slightly so we can capture the
- // result before sending it off to OpenGL land.
+ // result (and use it later) otherwise this all gets calculated in
+ // OpenGL land and we don't have access to the results.
void LookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
GLdouble centerx, GLdouble centery, GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz );
void UpdateViewParams( void );
// Update the view parameters
- void UpdateViewMath( fgFLIGHT *f );
+ void UpdateViewMath( FGState *f );
// Update the "World to Eye" transformation matrix
- void UpdateWorldToEye( fgFLIGHT *f );
+ void UpdateWorldToEye( FGState *f );
// Update the field of view parameters
void UpdateFOV( fgOPTIONS *o );
// $Log$
+// Revision 1.16 1998/12/05 15:54:25 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.15 1998/10/16 23:27:56 curt
// C++-ifying.
//
// the chunk isn't already in the cache, then read it from disk.
int fgTileMgrUpdate( void ) {
fgTILECACHE *c;
- fgFLIGHT *f;
+ FGState *f;
fgBUCKET p1, p2;
static fgBUCKET p_last = {-1000, 0, 0, 0};
int tile_diameter;
int i, j, dw, dh;
c = &global_tile_cache;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
tile_diameter = current_options.get_tile_diameter();
// Render the local tiles
void fgTileMgrRender( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgTILECACHE *c;
fgTILE *t;
fgVIEW *v;
int drawn = 0;
c = &global_tile_cache;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
v = ¤t_view;
tile_diameter = current_options.get_tile_diameter();
// $Log$
+// Revision 1.49 1998/12/05 15:54:26 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.48 1998/12/05 14:20:21 curt
// Looking into a terrain intersection problem.
//
// reset flight params to a specific position
void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
- fgFLIGHT *f;
-
- f = current_aircraft.flight;
+ FGState *f;
+
+ f = current_aircraft.fdm_state;
/*
f->pos_x = pos_x;
// update position based on inputs, positions, velocities, etc.
void fgSlewUpdate( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgCONTROLS *c;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
c = current_aircraft.controls;
/* f->Psi += ( c->aileron / 8 );
// $Log$
+// Revision 1.3 1998/12/05 15:54:16 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.2 1998/10/17 01:34:17 curt
// C++ ifying ...
//
// Update time variables such as gmt, julian date, and sidereal time
-void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
+void fgTimeUpdate(FGState *f, fgTIME *t) {
double gst_precise, gst_course;
FG_LOG( FG_EVENT, FG_DEBUG, "Updating time" );
// $Log$
+// Revision 1.26 1998/12/05 15:54:28 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.25 1998/12/05 14:21:30 curt
// Moved struct fg_timestamp to class fgTIMESTAMP and moved it's definition
// to it's own file, timestamp.hxx.
// Update the time dependent variables
-void fgTimeUpdate(fgFLIGHT *f, fgTIME *t);
+void fgTimeUpdate(FGState *f, fgTIME *t);
#endif // _FG_TIME_HXX
// $Log$
+// Revision 1.11 1998/12/05 15:54:29 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.10 1998/12/05 14:21:31 curt
// Moved struct fg_timestamp to class fgTIMESTAMP and moved it's definition
// to it's own file, timestamp.hxx.
// update lighting parameters based on current sun position
void fgLIGHT::Update( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgTIME *t;
fgVIEW *v;
// if the 4th field is 0.0, this specifies a direction ...
GLfloat base_fog_color[4] = {0.90, 0.90, 1.00, 1.0};
double deg, ambient, diffuse, sky_brightness;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
t = &cur_time_params;
v = ¤t_view;
// calculate fog color adjusted for sunrise/sunset effects
void fgLIGHT::UpdateAdjFog( void ) {
- fgFLIGHT *f;
+ FGState *f;
fgVIEW *v;
double sun_angle_deg, rotation, param1[3], param2[3];
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
v = ¤t_view;
FG_LOG( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters." );
// $Log$
+// Revision 1.23 1998/12/05 15:54:30 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.22 1998/12/03 01:18:42 curt
// Converted fgFLIGHT to a class.
//
// temporarily remove the code of this do-nothing routine
// #ifdef FG_WEATHER_UPDATE
- fgFLIGHT *f;
+ FGState *f;
struct fgWEATHER *w;
- f = current_aircraft.flight;
+ f = current_aircraft.fdm_state;
w = ¤t_weather;
// Add some random turbulence
// $Log$
+// Revision 1.4 1998/12/05 15:54:31 curt
+// Renamed class fgFLIGHT to class FGState as per request by JSB.
+//
// Revision 1.3 1998/11/23 21:49:11 curt
// Borland portability tweaks.
//