]> git.mxchange.org Git - flightgear.git/commitdiff
Viewer update from Jim Wilson:
authordavid <david>
Sat, 6 Apr 2002 17:23:18 +0000 (17:23 +0000)
committerdavid <david>
Sat, 6 Apr 2002 17:23:18 +0000 (17:23 +0000)
Minor patches to initial tower view code.  Added calculation for "tower" at
any airport, placed a couple fractions of a degree off the center.  Moved the
farplane from 100m to 5km so that "lookfrom" mode can see the model.  5km is
still in a reasonable range for a depth buffer.  Note that looking at a model
anything but a small distance will cause some problems on older cards.
Temporarily changed viewer to always report elevation/lon/lat of the aircraft
in order to avoid a problem with the ground trim getting recalculated when
tower and aircraft are on different tiles.

src/Main/fg_init.cxx
src/Main/fg_init.hxx
src/Main/main.cxx
src/Main/viewer.cxx

index 84bcc0399e0d5e0566bd05770ca43a28865b8e7b..14b5376396a9323f295f56b85aa8b57e159bda53 100644 (file)
@@ -349,6 +349,29 @@ bool fgSetPosFromAirportID( const string& id ) {
 }
 
 
+
+// Set current tower position lon/lat given an airport id
+bool fgSetTowerPosFromAirportID( const string& id, double hdg ) {
+    FGAirport a;
+    // tower height hard coded for now...
+    float towerheight=50.0f;
+
+    // make a little off the heading for 1 runway airports...
+    float fudge_lon = fabs(sin(hdg)) * .003f;
+    float fudge_lat = .003f - fudge_lon;
+
+    if ( fgFindAirportID( id, &a ) ) {
+       fgSetDouble("/sim/tower/longitude-deg",  a.longitude + fudge_lon);
+       fgSetDouble("/sim/tower/latitude-deg",  a.latitude + fudge_lat);
+        fgSetDouble("/sim/tower/altitude-ft", a.elevation + towerheight);
+       return true;
+    } else {
+       return false;
+    }
+
+}
+
+
 // Set current_options lon/lat given an airport id and heading (degrees)
 bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
     FGRunway r;
@@ -1078,3 +1101,4 @@ void fgReInitSubsystems( void )
        fgSetBool("/sim/freeze/master", false);
     }
 }
+
index 6ed654e7cb774a5716a7f97f39ff6d7bd172e30b..caba67dc5c92a57215da592f73ebfa6b7b546741 100644 (file)
@@ -77,6 +77,9 @@ bool fgFindAirportID( const string& id, FGAirport *a );
 // Set pos given an airport id
 bool fgSetPosFromAirportID( const string& id );
 
+// Set tower position given an airport id
+bool fgSetTowerPosFromAirportID( const string& id, double hdg );
+
 // Set position and heading given an airport id and heading (degrees)
 bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg );
 
@@ -91,3 +94,4 @@ SGTime *fgInitTime();
 #endif // _FG_INIT_HXX
 
 
+
index 9781bf653c3fad85679b643127466b91678128e1..e83f4b70605242e6c0e4efa1243c6097a78ddcd1 100644 (file)
@@ -143,7 +143,7 @@ sgVec3 rway_ols;
 // ADA
 // Clip plane settings...
 float cockpit_nearplane = 0.01f;
-float cockpit_farplane = 100.0f;
+float cockpit_farplane = 5000.0f;
 float scene_nearplane = 0.5f;
 float scene_farplane = 120000.0f;
 
@@ -1448,6 +1448,8 @@ int mainLoop( int argc, char **argv ) {
        // fgSetPosFromAirportID( fgGetString("/sim/startup/airport-id") );
        fgSetPosFromAirportIDandHdg( fgGetString("/sim/startup/airport-id"),
                                     fgGetDouble("/orientation/heading-deg") );
+        // set tower position (a little off the heading for single runway airports)
+        fgSetTowerPosFromAirportID( fgGetString("/sim/startup/airport-id"), fgGetDouble("orientation/heading") );
     }
 
     SGTime *t = fgInitTime();
@@ -1938,3 +1940,4 @@ void fgUpdateDCS (void) {
 
 
 
+
index bed93454bb58e0a447b74c7b874a8cdc754743db..749f650d1c0ea8557ef5f28483025a82166bb9d9 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <simgear/compiler.h>
 
+#include <fg_props.hxx>
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -521,6 +523,16 @@ FGViewer::recalc ()
   sgCopyVec3(_zero_elev, _zero_elev_view_pos);
   sgCopyVec3(_view_pos, _relative_view_pos);
 
+  // FIXME:
+  // Doing this last recalc here for published values...where the airplane is
+  // This should be per aircraft or model (for published values) before
+  // multiple FDM can be done.
+  recalcPositionVectors(fgGetDouble("/position/longitude-deg"),
+                        fgGetDouble("/position/latitude-deg"),
+                        fgGetDouble("/position/altitude-deg"));
+
+
+
   // Make the world up rotation matrix for eye positioin...
   sgMakeRotMat4( UP, _lon_deg, 0.0, -_lat_deg );
 
@@ -794,3 +806,4 @@ FGViewer::update (int dt)
 
 
 
+