Mathias Frhlich:
I believe I have found the agl hud problems as well as the 'hole' in the carrier's deck. I spent half the day to reproduce that problem, it did not occure when you start on the carrier not does it occure with JSBSim and my really often used testaircraft. So I really need to improove my helicopter flying qualities. I was under the impression that *all* FDM's call FGInterface::updateGeo*Position(..) so set the new position in the FDM interface. Therefore I had added at the some code that updates the scenery elevation below the aircraft to *those* functions. Ok, not all FDM's do so :/ The attached patch factors out a function computing the scenery altitude at the current FDM's position. This function is also used in those FDM's which need to update this value themselves. Also this patch restores the nearplane setting and uses the current views altitude instead of the current aircrafts. I think that this should further be changed to the eypoint's agl in the future. The agl is again ok in YASim's hud.
This commit is contained in:
parent
68f248879c
commit
411d133a54
8 changed files with 19 additions and 11 deletions
|
@ -193,7 +193,8 @@ network_LIBS="$LIBS"
|
|||
LIBS=""
|
||||
|
||||
dnl check for some default libraries
|
||||
AC_SEARCH_LIBS(cos, [fastm m])
|
||||
AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
|
||||
AC_SEARCH_LIBS(ceil, m)
|
||||
AC_SEARCH_LIBS(dlclose, dl)
|
||||
|
||||
base_LIBS="$LIBS"
|
||||
|
|
|
@ -111,6 +111,7 @@ void FGMagicCarpet::update( double dt ) {
|
|||
sl_radius + get_Altitude() + climb );
|
||||
// cout << "sea level radius (ft) = " << sl_radius << endl;
|
||||
// cout << "(setto) sea level radius (ft) = " << get_Sea_level_radius() << endl;
|
||||
_update_ground_elev_at_pos();
|
||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
|
||||
_set_Altitude( get_Altitude() + climb );
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ void FGACMS::update( double dt ) {
|
|||
_set_Euler_Rates(0,0,0);
|
||||
|
||||
_set_Geocentric_Position( lat_geoc, get_Longitude(), sl_radius);
|
||||
_update_ground_elev_at_pos();
|
||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
|
||||
|
||||
}
|
||||
|
|
|
@ -191,6 +191,7 @@ void FGUFO::update( double dt ) {
|
|||
sl_radius + get_Altitude() + climb );
|
||||
// cout << "sea level radius (ft) = " << sl_radius << endl;
|
||||
// cout << "(setto) sea level radius (ft) = " << get_Sea_level_radius() << endl;
|
||||
_update_ground_elev_at_pos();
|
||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
|
||||
_set_Altitude( get_Altitude() + climb );
|
||||
}
|
||||
|
|
|
@ -366,6 +366,7 @@ void YASim::copyFromYASim()
|
|||
double lat, lon, alt;
|
||||
sgCartToGeod(s->pos, &lat, &lon, &alt);
|
||||
_set_Geodetic_Position(lat, lon, alt*M2FT);
|
||||
_update_ground_elev_at_pos();
|
||||
|
||||
// UNUSED
|
||||
//_set_Geocentric_Position(Glue::geod2geocLat(lat), lon, alt*M2FT);
|
||||
|
|
|
@ -515,9 +515,7 @@ void FGInterface::_updateGeodeticPosition( double lat, double lon, double alt )
|
|||
_set_Geodetic_Position( lat, lon, alt );
|
||||
|
||||
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET );
|
||||
double alt_m = alt*SG_FEET_TO_METER;
|
||||
double groundlevel_m = get_groundlevel_m(lat, lon, alt_m);
|
||||
_set_Runway_altitude( groundlevel_m * SG_METER_TO_FEET );
|
||||
_update_ground_elev_at_pos();
|
||||
|
||||
_set_sin_lat_geocentric( lat_geoc );
|
||||
_set_cos_lat_geocentric( lat_geoc );
|
||||
|
@ -554,9 +552,7 @@ void FGInterface::_updateGeocentricPosition( double lat_geoc, double lon,
|
|||
_set_Geodetic_Position( lat_geod, lon, alt );
|
||||
|
||||
_set_Sea_level_radius( sl_radius2 * SG_METER_TO_FEET );
|
||||
double alt_m = alt*SG_FEET_TO_METER;
|
||||
double groundlevel_m = get_groundlevel_m(lat_geod, lon, alt_m);
|
||||
_set_Runway_altitude( groundlevel_m * SG_METER_TO_FEET );
|
||||
_update_ground_elev_at_pos();
|
||||
|
||||
_set_sin_lat_geocentric( lat_geoc );
|
||||
_set_cos_lat_geocentric( lat_geoc );
|
||||
|
@ -566,6 +562,13 @@ void FGInterface::_updateGeocentricPosition( double lat_geoc, double lon,
|
|||
_set_sin_cos_latitude( lat_geod );
|
||||
}
|
||||
|
||||
void FGInterface::_update_ground_elev_at_pos( void ) {
|
||||
double lat = get_Latitude();
|
||||
double lon = get_Longitude();
|
||||
double alt_m = get_Altitude()*SG_FEET_TO_METER;
|
||||
double groundlevel_m = get_groundlevel_m(lat, lon, alt_m);
|
||||
_set_Runway_altitude( groundlevel_m * SG_METER_TO_FEET );
|
||||
}
|
||||
|
||||
// Extrapolate fdm based on time_offset (in usec)
|
||||
void FGInterface::extrapolate( int time_offset ) {
|
||||
|
|
|
@ -238,6 +238,7 @@ public:
|
|||
void _busdump(void);
|
||||
void _updateGeodeticPosition( double lat, double lon, double alt );
|
||||
void _updateGeocentricPosition( double lat_geoc, double lon, double alt );
|
||||
void _update_ground_elev_at_pos( void );
|
||||
void _updateWeather( void );
|
||||
|
||||
inline void _set_Inertias( double m, double xx, double yy,
|
||||
|
|
|
@ -494,11 +494,10 @@ FGRenderer::update( bool refresh_camera_settings ) {
|
|||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ) ;
|
||||
|
||||
double agl =
|
||||
current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER
|
||||
- cur_fdm_state->get_Runway_altitude_m();
|
||||
double agl = current__view->getAltitudeASL_ft()*SG_FEET_TO_METER
|
||||
- current__view->getSGLocation()->get_cur_elev_m();
|
||||
|
||||
if ( agl > 50.0 ) {
|
||||
if ( agl > 10.0 ) {
|
||||
scene_nearplane = 10.0f;
|
||||
scene_farplane = 120000.0f;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue