]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Sat, 8 Oct 2005 12:33:06 +0000 (12:33 +0000)
committerehofman <ehofman>
Sat, 8 Oct 2005 12:33:06 +0000 (12:33 +0000)
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.

configure.ac
src/FDM/MagicCarpet.cxx
src/FDM/SP/ACMS.cxx
src/FDM/UFO.cxx
src/FDM/YASim/YASim.cxx
src/FDM/flight.cxx
src/FDM/flight.hxx
src/Main/renderer.cxx

index 6e021f9ef1919dca97a8b3aabc25eea6f1d42a09..c89d87aa2475941bded130871c692abfee25e143 100644 (file)
@@ -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"
index 0402c28a50bcdb190a6310f43b9b595ba032b76d..2dc4008fdcfdffe3625badeac86f34392ab7f2ac 100644 (file)
@@ -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 );
 }
index c5b7eefdd23e501b3cfb756df4f7aeff6210f5bd..5b75f85204c4ac4328c445563d0a7fc771d8052d 100644 (file)
@@ -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);
 
 }
index e8df63e42bf4b6a3d77eeb5802a344123f0e5eed..357c26258d66d08a581ce9935514a7bfd0333c2c 100644 (file)
@@ -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 );
 }
index 74210191786c6abe5b5a05ae80c6c930f2e0ccf8..d374a3e5e09f5dc368735c06b566066205b2a683 100644 (file)
@@ -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);
index 9bda7929a94ccee04dc0a25c3bd01f27240f8466..43b5aa03b62d6b21084263e2717e0c9c82e92403 100644 (file)
@@ -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 ) {
index 5b01cff0a22eda9776d5ea3c913a0f2415bde6b6..dd32bde2cbb03afc0bab4b6ae835e5c720ef585a 100644 (file)
@@ -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, 
index 06ef1bcd9be5b2d4da9b946979c19e64318f3133..b5566b0c292eed9a184688cc848c2c8cd7a15340 100644 (file)
@@ -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 {