Viewer update from Jim Wilson:
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.
This commit is contained in:
parent
5fcabc9982
commit
a1294ea398
4 changed files with 45 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue