1
0
Fork 0

Renamed class fgFLIGHT to class FGState as per request by JSB.

This commit is contained in:
curt 1998-12-05 15:53:59 +00:00
parent d671446a35
commit 71f334cc0d
26 changed files with 236 additions and 163 deletions

View file

@ -37,16 +37,16 @@ fgAIRCRAFT current_aircraft;
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 = ("
@ -68,6 +68,9 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
// $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.
//

View file

@ -39,7 +39,7 @@
// Define a structure containing all the parameters for an aircraft
typedef struct{
fgFLIGHT *flight;
FGState *fdm_state;
fgCONTROLS *controls;
} fgAIRCRAFT ;
@ -61,6 +61,9 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a);
// $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 ...
//

View file

@ -112,10 +112,10 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun)
geoRa, geoDec;
fgAIRCRAFT *air;
fgFLIGHT *f;
FGState *f;
air = &current_aircraft;
f = air->flight;
f = air->fdm_state;
updateOrbElements(t);
actTime = fgCalcActTime(t);

View file

@ -255,7 +255,7 @@ void fgSkyInit( void ) {
// Draw the Sky
void fgSkyRender( void ) {
fgFLIGHT *f;
FGState *f;
fgLIGHT *l;
fgVIEW *v;
float inner_color[4];
@ -264,7 +264,7 @@ void fgSkyRender( void ) {
double diff;
int i;
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
l = &cur_light_params;
v = &current_view;
@ -365,6 +365,9 @@ void fgSkyRender( void ) {
// $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.

View file

@ -210,13 +210,13 @@ int fgStarsInit( void ) {
// 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 = &current_view;
@ -256,6 +256,9 @@ void fgStarsRender( void ) {
// $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.
//

View file

@ -50,58 +50,58 @@
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 );
@ -109,19 +109,19 @@ static double fgAPget_climb( void )
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 );

View file

@ -66,8 +66,8 @@ static pCockpit ac_cockpit;
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)) );
@ -75,10 +75,10 @@ double get_latitude( void )
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) {
@ -91,18 +91,18 @@ double get_lat_min( void )
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) {
@ -139,50 +139,50 @@ double get_rudderval( void )
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);
@ -195,9 +195,9 @@ double get_altitude( void )
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;
@ -208,9 +208,9 @@ double get_agl( void )
double get_sideslip( void )
{
fgFLIGHT *f;
FGState *f;
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
return( f->get_Beta() );
}
@ -245,9 +245,9 @@ double get_vfc_tris_drawn ( void )
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;
@ -312,6 +312,9 @@ void fgCockpitUpdate( void ) {
// $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.
//

View file

@ -31,18 +31,21 @@
// 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.
//

View file

@ -87,16 +87,19 @@ public:
// 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.
//

View file

@ -42,7 +42,7 @@ int fgLaRCsimInit(double dt) {
// 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
@ -52,7 +52,7 @@ int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop) {
}
// 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);
@ -65,7 +65,7 @@ int fgLaRCsimUpdate(fgFLIGHT& f, int multiloop) {
// 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 ) {
@ -76,8 +76,8 @@ int fgLaRCsimUpdate(fgFLIGHT& 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) {
Lat_control = controls.get_aileron();
Long_control = controls.get_elevator();
@ -260,8 +260,8 @@ int fgFlight_2_LaRCsim (fgFLIGHT& 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) {
// 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 );
@ -382,6 +382,9 @@ int fgLaRCsim_2_Flight (fgFLIGHT& f) {
// $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.
//

View file

@ -35,19 +35,22 @@
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.
//

View file

@ -34,35 +34,35 @@
#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,
@ -76,7 +76,7 @@ int fgFlightModelInit(int model, fgFLIGHT& f, double dt) {
// 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);
@ -84,11 +84,11 @@ int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) {
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,
@ -107,7 +107,7 @@ int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) {
// 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
@ -119,7 +119,7 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) {
(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() );
}
@ -127,6 +127,9 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) {
// $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.

View file

@ -38,7 +38,7 @@ typedef double FG_VECTOR_3[3];
// This is based heavily on LaRCsim/ls_generic.h
class fgFLIGHT {
class FGState {
public:
@ -313,7 +313,7 @@ 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];
@ -330,7 +330,7 @@ public:
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]; }
@ -343,8 +343,8 @@ public:
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;
}
@ -365,7 +365,7 @@ public:
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]; }
@ -377,7 +377,7 @@ public:
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]; }
@ -420,7 +420,7 @@ public:
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]; }
@ -431,7 +431,7 @@ public:
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]; }
@ -442,7 +442,7 @@ public:
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]; }
@ -464,7 +464,7 @@ public:
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]; }
@ -529,7 +529,7 @@ public:
/*======================= 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];
@ -567,15 +567,15 @@ public:
}
}
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; }
@ -609,7 +609,7 @@ public:
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; }
@ -667,7 +667,7 @@ public:
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]; }
@ -679,7 +679,7 @@ public:
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]; }
@ -691,7 +691,7 @@ public:
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];
@ -709,7 +709,7 @@ public:
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]; }
@ -721,31 +721,34 @@ public:
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.

View file

@ -69,14 +69,14 @@ static void local_update_sky_and_lighting_params( void ) {
// 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 = &current_view;
w = &current_weather;
@ -386,6 +386,9 @@ void GLUTspecialkey(int k, int x, int y) {
// $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.
//

View file

@ -228,7 +228,7 @@ static void fgUpdateInstrViewParams( void ) {
// Update all Visuals (redraws anything graphics related)
static void fgRenderFrame( void ) {
fgFLIGHT *f;
FGState *f;
fgLIGHT *l;
fgTIME *t;
fgVIEW *v;
@ -239,7 +239,7 @@ static void fgRenderFrame( void ) {
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 = &current_view;
@ -371,13 +371,13 @@ static void fgRenderFrame( void ) {
// 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 = &current_view;
@ -393,10 +393,10 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
// 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
@ -456,7 +456,7 @@ static const double alt_adjust_m = alt_adjust_ft * FEET_TO_METER;
// 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;
@ -464,7 +464,7 @@ static void fgMainLoop( void ) {
int i;
double accum;
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
g = &general;
t = &cur_time_params;
@ -490,7 +490,7 @@ static void fgMainLoop( void ) {
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,
@ -934,9 +934,9 @@ int fgGlutInitEvents( void ) {
// 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 */
@ -1014,6 +1014,9 @@ int main( int argc, char **argv ) {
// $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.
//

View file

@ -75,9 +75,9 @@ extern const char *default_root;
// 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() ) {
@ -154,7 +154,7 @@ int fgInitGeneral( void ) {
// Returns non-zero if a problem encountered.
int fgInitSubsystems( void )
{
fgFLIGHT *f;
FGState *f;
fgLIGHT *l;
fgTIME *t;
fgVIEW *v;
@ -173,7 +173,7 @@ int fgInitSubsystems( void )
// 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();
@ -332,7 +332,7 @@ int fgInitSubsystems( void )
// 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
@ -370,6 +370,9 @@ int fgInitSubsystems( void )
// $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.
//

View file

@ -227,7 +227,7 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
char dir;
int deg;
double min;
fgFLIGHT *f;
FGState *f;
fgTIME *t;
// run once every two seconds
@ -239,7 +239,7 @@ static void send_nmea_out( fgIOCHANNEL& p ) {
return;
}
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
t = &cur_time_params;
char utc[10];
@ -326,7 +326,7 @@ static void send_garmin_out( fgIOCHANNEL& p ) {
char dir;
int deg;
double min;
fgFLIGHT *f;
FGState *f;
fgTIME *t;
// run once per second
@ -338,7 +338,7 @@ static void send_garmin_out( fgIOCHANNEL& p ) {
return;
}
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
t = &cur_time_params;
char utc[10];
@ -451,6 +451,9 @@ void fgSerialProcess() {
// $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.
//

View file

@ -129,7 +129,7 @@ fgOPTIONS::fgOPTIONS() :
sound(1),
// Flight Model options
flight_model(fgFLIGHT::FG_LARCSIM),
flight_model(FGState::FG_LARCSIM),
// Rendering options
fog(FG_FOG_NICEST), // nicest
@ -310,11 +310,11 @@ fgOPTIONS::parse_flight_model( const string& fm ) {
// 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);
@ -624,6 +624,9 @@ fgOPTIONS::~fgOPTIONS( void ) {
// $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.
//

View file

@ -185,10 +185,10 @@ void fgVIEW::LookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
// 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);
@ -263,7 +263,7 @@ void fgVIEW::UpdateViewParams( void ) {
// 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;
@ -426,7 +426,7 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
// 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;
@ -599,6 +599,9 @@ fgVIEW::~fgVIEW( void ) {
// $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.
//

View file

@ -147,11 +147,12 @@ public:
// 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 );
@ -160,10 +161,10 @@ public:
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 );
@ -180,6 +181,9 @@ extern fgVIEW current_view;
// $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.
//

View file

@ -331,14 +331,14 @@ fgTileMgrCurElevOLD( double lon, double lat, const Point3D& abs_view_pos ) {
// 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();
@ -641,7 +641,7 @@ update_tile_geometry( fgTILE *t, GLdouble *MODEL_VIEW)
// Render the local tiles
void fgTileMgrRender( void ) {
fgFLIGHT *f;
FGState *f;
fgTILECACHE *c;
fgTILE *t;
fgVIEW *v;
@ -655,7 +655,7 @@ void fgTileMgrRender( void ) {
int drawn = 0;
c = &global_tile_cache;
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
v = &current_view;
tile_diameter = current_options.get_tile_diameter();
@ -748,6 +748,9 @@ void fgTileMgrRender( void ) {
// $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.
//

View file

@ -34,9 +34,9 @@
// reset flight params to a specific position
void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
fgFLIGHT *f;
FGState *f;
f = current_aircraft.flight;
f = current_aircraft.fdm_state;
/*
f->pos_x = pos_x;
@ -62,10 +62,10 @@ void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
// 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 );
@ -83,6 +83,9 @@ void fgSlewUpdate( void ) {
// $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 ...
//

View file

@ -332,7 +332,7 @@ double sidereal_course(fgTIME *t, double lng) {
// 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" );
@ -398,6 +398,9 @@ void fgTimeUpdate(fgFLIGHT *f, fgTIME *t) {
// $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.

View file

@ -92,13 +92,16 @@ void fgTimeInit(fgTIME *t);
// 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.

View file

@ -89,7 +89,7 @@ void fgLIGHT::Init( void ) {
// 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 ...
@ -100,7 +100,7 @@ void fgLIGHT::Update( void ) {
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 = &current_view;
@ -150,11 +150,11 @@ void fgLIGHT::Update( void ) {
// 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 = &current_view;
FG_LOG( FG_EVENT, FG_DEBUG, "Updating adjusted fog parameters." );
@ -217,6 +217,9 @@ fgLIGHT::~fgLIGHT( void ) {
// $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.
//

View file

@ -67,10 +67,10 @@ void fgWeatherUpdate( void ) {
// 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 = &current_weather;
// Add some random turbulence
@ -104,6 +104,9 @@ void fgWeatherSetVisibility( float visibility ) {
// $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.
//