#include <simgear/misc/exception.hxx>
#include <simgear/ephemeris/ephemeris.hxx>
#include <simgear/route/route.hxx>
+#include <simgear/screen/extensions.hxx>
+
+#include <Environment/environment_mgr.hxx>
#ifdef SG_MATH_EXCEPTION_CLASH
# include <math.h>
#include <simgear/scene/model/model.hxx>
#include <simgear/scene/model/modellib.hxx>
#ifdef FG_USE_CLOUDS_3D
-# include <simgear/sky/clouds3d/SkySceneLoader.hpp>
-# include <simgear/sky/clouds3d/SkyUtil.hpp>
+# include <simgear/scene/sky/clouds3d/SkySceneLoader.hpp>
+# include <simgear/scene/sky/clouds3d/SkyUtil.hpp>
#endif
-#include <simgear/sky/sky.hxx>
+#include <simgear/scene/sky/sky.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Include/general.hxx>
#include <ATC/ATCdisplay.hxx>
#include <ATC/AIMgr.hxx>
-
#include <Autopilot/newauto.hxx>
#include <Cockpit/hud.hxx>
#include <MultiPlayer/multiplayrxmgr.hxx>
#endif
+#include <Replay/replay.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#ifdef ENABLE_AUDIO_SUPPORT
#include "fg_commands.hxx"
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
-#ifdef WIN32
- typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)(GLenum pname,
- GLfloat param);
- typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC)(GLenum pname,
- const GLfloat *params);
-
- PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
- PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
-#elif linux
- #include <GL/glx.h>
-
- typedef void (* OpenGLFuncExt)(GLenum pname, GLfloat param);
- typedef void (* OpenGLFuncExtv)(GLenum pname, const GLfloat *params);
-
- OpenGLFuncExt glPointParameterfEXT = 0;
- OpenGLFuncExtv glPointParameterfvEXT = 0;
-#endif
-#endif
+glPointParameterfProc glPointParameterfPtr = 0;
+glPointParameterfvProc glPointParameterfvPtr = 0;
+bool glPointParameterIsSupported = false;
float default_attenuation[3] = {1.0, 0.0, 0.0};
//Required for using GL_extensions
float scene_nearplane = 0.5f;
float scene_farplane = 120000.0f;
-static double delta_time_sec = 0;
+static double delta_time_sec = 0.0;
#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
-#else
-# include <Environment/environment_mgr.hxx>
#endif
#include "version.h"
// Update all Visuals (redraws anything graphics related)
void fgRenderFrame() {
+ bool draw_otw = fgGetBool("/sim/rendering/draw-otw");
+ bool skyblend = fgGetBool("/sim/rendering/skyblend");
+ bool enhanced_lighting = fgGetBool("/sim/rendering/enhanced-lighting");
+ bool distance_attenuation = fgGetBool("/sim/rendering/distance-attenuation");
GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
clear_mask |= GL_COLOR_BUFFER_BIT;
}
- if ( fgGetBool("/sim/rendering/skyblend") ) {
+ if ( skyblend ) {
if ( fgGetBool("/sim/rendering/textures") ) {
// glClearColor(black[0], black[1], black[2], black[3]);
glClearColor(l->adj_fog_color[0], l->adj_fog_color[1],
thesky->set_visibility(visibility_meters);
thesky->modify_vis( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
- ( global_multi_loop * fgGetInt("/sim/speed-up") )
+ ( global_multi_loop * fgGetInt("/sim/speed-up") )
/ (double)fgGetInt("/sim/model-hz") );
// Set correct opengl fog density
glFogf (GL_FOG_DENSITY, fog_exp2_density);
// update the sky dome
- if ( fgGetBool("/sim/rendering/skyblend") ) {
+ if ( skyblend ) {
/*
SG_LOG( SG_GENERAL, SG_BULK, "thesky->repaint() sky_color = "
<< cur_light_params.sky_color[0] << " "
" sun_angle = " << cur_light_params.sun_angle
<< " moon_angle = " << cur_light_params.moon_angle );
*/
- thesky->repaint( cur_light_params.sky_color,
- cur_light_params.adj_fog_color,
- cur_light_params.cloud_color,
- cur_light_params.sun_angle,
- cur_light_params.moon_angle,
- globals->get_ephem()->getNumPlanets(),
- globals->get_ephem()->getPlanets(),
- globals->get_ephem()->getNumStars(),
- globals->get_ephem()->getStars() );
+
+ static SGSkyColor scolor;
+
+ scolor.sky_color = cur_light_params.sky_color;
+ scolor.fog_color = cur_light_params.adj_fog_color;
+ scolor.cloud_color = cur_light_params.cloud_color;
+ scolor.sun_angle = cur_light_params.sun_angle;
+ scolor.moon_angle = cur_light_params.moon_angle;
+ scolor.nplanets = globals->get_ephem()->getNumPlanets();
+ scolor.nstars = globals->get_ephem()->getNumStars();
+ scolor.planet_data = globals->get_ephem()->getPlanets();
+ scolor.star_data = globals->get_ephem()->getStars();
+
+ thesky->repaint( scolor );
/*
SG_LOG( SG_GENERAL, SG_BULK,
<< " moon dec = " << globals->get_ephem()->getMoonDeclination() );
*/
- thesky->reposition( current__view->get_view_pos(),
- current__view->get_zero_elev(),
- current__view->get_world_up(),
- current__view->getLongitude_deg()
- * SGD_DEGREES_TO_RADIANS,
- current__view->getLatitude_deg()
- * SGD_DEGREES_TO_RADIANS,
- current__view->getAltitudeASL_ft()
- * SG_FEET_TO_METER,
- cur_light_params.sun_rotation,
- globals->get_time_params()->getGst(),
- globals->get_ephem()->getSunRightAscension(),
- globals->get_ephem()->getSunDeclination(),
- 50000.0,
- globals->get_ephem()->getMoonRightAscension(),
- globals->get_ephem()->getMoonDeclination(),
- 50000.0 );
+ // The sun and moon distances are scaled down versions
+ // of the actual distance to get both the moon and the sun
+ // within the range of the far clip plane.
+ // Moon distance: 384,467 kilometers
+ // Sun distance: 150,000,000 kilometers
+ double sun_horiz_eff, moon_horiz_eff;
+ if (fgGetBool("/sim/rendering/horizon-effect")) {
+ sun_horiz_eff = 0.67+pow(0.5+cos(cur_light_params.sun_angle*2)/2,0.33)/3;
+ moon_horiz_eff = 0.67+pow(0.5+cos(cur_light_params.moon_angle*2)/2,0.33)/3;
+ } else {
+ sun_horiz_eff = moon_horiz_eff = 1.0;
+ }
+
+ static SGSkyState sstate;
+
+ sstate.view_pos = current__view->get_view_pos();
+ sstate.zero_elev = current__view->get_zero_elev();
+ sstate.view_up = current__view->get_world_up();
+ sstate.lon = current__view->getLongitude_deg()
+ * SGD_DEGREES_TO_RADIANS;
+ sstate.lat = current__view->getLatitude_deg()
+ * SGD_DEGREES_TO_RADIANS;
+ sstate.alt = current__view->getAltitudeASL_ft()
+ * SG_FEET_TO_METER;
+ sstate.spin = cur_light_params.sun_rotation;
+ sstate.gst = globals->get_time_params()->getGst();
+ sstate.sun_ra = globals->get_ephem()->getSunRightAscension();
+ sstate.sun_dec = globals->get_ephem()->getSunDeclination();
+ sstate.sun_dist = 50000.0 * sun_horiz_eff;
+ sstate.moon_ra = globals->get_ephem()->getMoonRightAscension();
+ sstate.moon_dec = globals->get_ephem()->getMoonDeclination();
+ sstate.moon_dist = 40000.0 * moon_horiz_eff;
+
+ thesky->reposition( sstate );
}
glEnable( GL_DEPTH_TEST );
globals->get_multiplayer_rx_mgr()->Update();
#endif
- if ( fgGetBool("/sim/rendering/skyblend") &&
- fgGetBool("/sim/rendering/draw-otw") )
+ if ( draw_otw && skyblend )
{
// draw the sky backdrop
// draw wire frame
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
- if ( fgGetBool("/sim/rendering/draw-otw") ) {
+ if ( draw_otw ) {
ssgCullAndDraw( globals->get_scenery()->get_scene_graph() );
}
glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through);
ssgSetNearFar( scene_nearplane, scene_farplane );
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
- // Enable states for drawing points with GL_extension
- glEnable(GL_POINT_SMOOTH);
+ if ( enhanced_lighting ) {
- if ( fgGetBool("/sim/rendering/distance-attenuation")
- && glutExtensionSupported("GL_EXT_point_parameters") )
- {
- float quadratic[3] = {1.0, 0.001, 0.0000001};
- // makes the points fade as they move away
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, quadratic);
- glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, 1.0);
- }
- glPointSize(4.0);
+ // Enable states for drawing points with GL_extension
+ glEnable(GL_POINT_SMOOTH);
- // blending function for runway lights
- glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
-#endif
+ if ( distance_attenuation && glPointParameterIsSupported )
+ {
+ // Enable states for drawing points with GL_extension
+ glEnable(GL_POINT_SMOOTH);
+
+ float quadratic[3] = {1.0, 0.001, 0.0000001};
+ // makes the points fade as they move away
+ glPointParameterfvPtr(GL_DISTANCE_ATTENUATION_EXT, quadratic);
+ glPointParameterfPtr(GL_POINT_SIZE_MIN_EXT, 1.0);
+ }
+
+ glPointSize(4.0);
+
+ // blending function for runway lights
+ glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
+ }
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glPolygonMode(GL_FRONT, GL_POINT);
// draw runway lighting
- if ( fgGetBool("/sim/rendering/draw-otw") ) {
+ if ( draw_otw ) {
ssgCullAndDraw( globals->get_scenery()->get_rwy_lights_root() );
}
// sgVec3 taxi_fog;
// sgSetVec3( taxi_fog, 0.0, 0.0, 0.0 );
// glFogfv ( GL_FOG_COLOR, taxi_fog );
- if ( fgGetBool("/sim/rendering/draw-otw") ) {
+ if ( draw_otw ) {
ssgCullAndDraw( globals->get_scenery()->get_taxi_lights_root() );
}
//_frame_count++;
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
- if ( fgGetBool("/sim/rendering/distance-attenuation")
- && glutExtensionSupported("GL_EXT_point_parameters") )
- {
- glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT,
- default_attenuation);
- }
+ if ( enhanced_lighting ) {
+ if ( distance_attenuation && glPointParameterIsSupported )
+ {
+ glPointParameterfvPtr(GL_DISTANCE_ATTENUATION_EXT,
+ default_attenuation);
+ }
- glPointSize(1.0);
- glDisable(GL_POINT_SMOOTH);
-#endif
+ glPointSize(1.0);
+ glDisable(GL_POINT_SMOOTH);
+ }
// draw ground lighting
glFogf (GL_FOG_DENSITY, ground_exp2_punch_through);
- if ( fgGetBool("/sim/rendering/draw-otw") ) {
+ if ( draw_otw ) {
ssgCullAndDraw( globals->get_scenery()->get_gnd_lights_root() );
}
- if ( fgGetBool("/sim/rendering/skyblend") ) {
+ if ( skyblend ) {
// draw the sky cloud layers
- if ( fgGetBool("/environment/clouds/status") &&
- fgGetBool("/sim/rendering/draw-otw") )
+ if ( draw_otw && fgGetBool("/environment/clouds/status") )
{
thesky->postDraw( cur_fdm_state->get_Altitude()
* SG_FEET_TO_METER );
}
}
- if ( fgGetBool("/sim/rendering/clouds3d") &&
- fgGetBool("/sim/rendering/draw-otw") )
+ if ( draw_otw && fgGetBool("/sim/rendering/clouds3d") )
{
glDisable( GL_FOG );
glDisable( GL_LIGHTING );
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
}
- if ( fgGetBool("/sim/rendering/draw-otw") ) {
+ if ( draw_otw ) {
globals->get_model_mgr()->draw();
globals->get_aircraft_model()->draw();
}
void fgUpdateTimeDepCalcs() {
static bool inited = false;
+ static const SGPropertyNode *replay_master
+ = fgGetNode( "/sim/freeze/replay", true );
+ static SGPropertyNode *replay_time
+ = fgGetNode( "/sim/replay/time", true );
+ static const SGPropertyNode *replay_end_time
+ = fgGetNode( "/sim/replay/end-time", true );
+
//SG_LOG(SG_FLIGHT,SG_INFO, "Updating time dep calcs()");
fgLIGHT *l = &cur_light_params;
cur_fdm_state->bind();
}
-#ifndef FG_WEATHERCM
- globals->get_environment_mgr()->update(delta_time_sec);
-#endif
-
// conceptually, the following block could be done for each fdm
// instance ...
- if ( !cur_fdm_state->get_inited() ) {
- // do nothing, fdm isn't inited yet
- } else {
+ if ( cur_fdm_state->get_inited() ) {
// we have been inited, and we are good to go ...
if ( !inited ) {
inited = true;
}
- globals->get_autopilot()->update(delta_time_sec);
- cur_fdm_state->update(delta_time_sec);
+ if ( ! replay_master->getBoolValue() ) {
+ globals->get_autopilot()->update( delta_time_sec );
+ cur_fdm_state->update( delta_time_sec );
+ } else {
+ FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
+ r->replay( replay_time->getDoubleValue() );
+ replay_time->setDoubleValue( replay_time->getDoubleValue()
+ + ( delta_time_sec
+ * fgGetInt("/sim/speed-up") ) );
+ }
+ } else {
+ // do nothing, fdm isn't inited yet
}
globals->get_model_mgr()->update(delta_time_sec);
// 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 ) {
+ int model_hz = fgGetInt("/sim/model-hz");
static const SGPropertyNode *longitude
= fgGetNode("/position/longitude-deg");
= fgGetNode("/sim/freeze/clock", true);
static const SGPropertyNode *cur_time_override
= fgGetNode("/sim/time/cur-time-override", true);
+ static const SGPropertyNode *replay_master
+ = fgGetNode("/sim/freeze/replay", true);
// Update the elapsed time.
static bool first_time = true;
last_time_stamp.stamp();
first_time = false;
}
- current_time_stamp.stamp();
+
+ double throttle_hz = fgGetDouble("/sim/frame-rate-throttle-hz", 0.0);
+ if ( throttle_hz > 0.0 ) {
+ // simple frame rate throttle
+ double dt = 1000000.0 / throttle_hz;
+ current_time_stamp.stamp();
+ while ( current_time_stamp - last_time_stamp < dt ) {
+ current_time_stamp.stamp();
+ }
+ } else {
+ // run as fast as the app will go
+ current_time_stamp.stamp();
+ }
+
delta_time_sec = double(current_time_stamp - last_time_stamp) / 1000000.0;
- if (clock_freeze->getBoolValue())
+ if ( clock_freeze->getBoolValue() ) {
delta_time_sec = 0;
+ }
last_time_stamp = current_time_stamp;
globals->inc_sim_time_sec( delta_time_sec );
SGAnimation::set_sim_time_sec( globals->get_sim_time_sec() );
cur_fdm_state->get_Runway_altitude() * SG_FEET_TO_METER,
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER); */
-// Curt is this code used? I don't see any problems when I comment it out.
+#if 0
+// This code is used by LaRCsim/UIUC to position the aircraft at a proper
+// place. This code should eventually go into the LaRCsim directory.
+// Commented out at Jul 27 2003 because tests show it is not needed.
+// Can probbaly be safely removed after Spet. 2003 - EMH
+
if ( acmodel_location != 0 ) {
if ( acmodel_location->get_cur_elev_m() > -9990 && cur_fdm_state->get_inited() ) {
if ( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER <
- (acmodel_location->get_cur_elev_m() + alt_adjust_m - 3.0) ) {
+ (acmodel_location->get_cur_elev_m() + alt_adjust_m - 130.0) ) {
// now set aircraft altitude above ground
printf("(*) Current Altitude = %.2f < %.2f forcing to %.2f\n",
cur_fdm_state->get_Altitude() * SG_FEET_TO_METER,
- acmodel_location->get_cur_elev_m() + alt_adjust_m - 3.0,
+ acmodel_location->get_cur_elev_m() + alt_adjust_m - 130.0,
acmodel_location->get_cur_elev_m() + alt_adjust_m );
cur_fdm_state->set_Altitude( (acmodel_location->get_cur_elev_m()
+ alt_adjust_m) * SG_METER_TO_FEET );
}
}
// End of code in question. (see Curt is this code used? above)
+#endif
/* printf("Adjustment - ground = %.2f runway = %.2f alt = %.2f\n",
scenery.get_cur_elev(),
// Calculate model iterations needed for next frame
elapsed += remainder;
- global_multi_loop = (long)(((double)elapsed * 0.000001) *
- fgGetInt("/sim/model-hz"));
- remainder = elapsed - ( (global_multi_loop*1000000) /
- fgGetInt("/sim/model-hz") );
+ global_multi_loop = (long)(((double)elapsed * 0.000001) * model_hz );
+ remainder = elapsed - ( (global_multi_loop*1000000) / model_hz );
SG_LOG( SG_ALL, SG_DEBUG,
"Model iterations needed = " << global_multi_loop
<< ", new remainder = " << remainder );
// chop max interations to something reasonable if the sim was
// delayed for an excesive amount of time
- if ( global_multi_loop > 2.0 * fgGetInt("/sim/model-hz") ) {
- global_multi_loop = (int)(2.0 * fgGetInt("/sim/model-hz") );
+ if ( global_multi_loop > 2.0 * model_hz ) {
+ global_multi_loop = (int)(2.0 * model_hz );
remainder = 0;
}
globals = new FGGlobals;
-#ifndef FG_WEATHERCM
- globals->set_environment_mgr(new FGEnvironmentMgr);
-#endif
-
// seed the random number generater
sg_srandom_time();
fgInitFGRoot(argc, argv);
// Check for the correct base package version
- static char required_version[] = "0.9.1";
+ static char required_version[] = "0.9.2";
string base_version = fgBasePackageVersion();
if ( !(base_version == required_version) ) {
// tell the operator how to use this application
// Initialize the various GLUT Event Handlers.
if( !fgGlutInitEvents() ) {
- SG_LOG( SG_GENERAL, SG_ALERT,
+ SG_LOG( SG_GENERAL, SG_ALERT,
"GLUT event handler initialization failed ..." );
exit(-1);
}
glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
#endif
-#ifdef FG_EXPERIMENTAL_POINT_LIGHTING
// get the address of our OpenGL extensions
if ( fgGetBool("/sim/rendering/distance-attenuation") )
{
-#ifdef WIN32
- glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)
- wglGetProcAddress("glPointParameterfEXT");
- glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC)
- wglGetProcAddress("glPointParameterfvEXT");
-#elif linux
- glPointParameterfEXT = (OpenGLFuncExt)
- glXGetProcAddressARB((GLubyte *)"glPointParameterfEXT");
- glPointParameterfvEXT = (OpenGLFuncExtv)
- glXGetProcAddressARB((GLubyte *)"glPointParameterfvEXT");
-#endif
+ if (SGIsOpenGLExtensionSupported("GL_EXT_point_parameters") ) {
+ glPointParameterIsSupported = true;
+ glPointParameterfPtr = (glPointParameterfProc)
+ SGLookupFunction("glPointParameterfEXT");
+ glPointParameterfvPtr = (glPointParameterfvProc)
+ SGLookupFunction("glPointParameterfvEXT");
+
+ } else if ( SGIsOpenGLExtensionSupported("GL_ARB_point_parameters") ) {
+ glPointParameterIsSupported = true;
+ glPointParameterfPtr = (glPointParameterfProc)
+ SGLookupFunction("glPointParameterfARB");
+ glPointParameterfvPtr = (glPointParameterfvProc)
+ SGLookupFunction("glPointParameterfvARB");
+ } else
+ glPointParameterIsSupported = false;
}
-#endif
// based on the requested presets, calculate the true starting
// lon, lat
////////////////////////////////////////////////////////////////////
globals->set_matlib( new SGMaterialLib );
- ////////////////////////////////////////////////////////////////////
- // Initialize the general model subsystem.
- ////////////////////////////////////////////////////////////////////
globals->set_model_lib(new SGModelLib);
- globals->set_model_mgr(new FGModelMgr);
- globals->get_model_mgr()->init();
- globals->get_model_mgr()->bind();
////////////////////////////////////////////////////////////////////
// Initialize the TG scenery subsystem.
globals->get_scenery()->bind();
globals->set_tile_mgr( new FGTileMgr );
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the general model subsystem.
+ ////////////////////////////////////////////////////////////////////
+ globals->set_model_mgr(new FGModelMgr);
+ globals->get_model_mgr()->init();
+ globals->get_model_mgr()->bind();
+
////////////////////////////////////////////////////////////////////
// Initialize the 3D aircraft model subsystem (has a dependency on
// the scenery subsystem.)
////////////////////////////////////////////////////////////////////
// Initialize the view manager subsystem.
////////////////////////////////////////////////////////////////////
-
FGViewMgr *viewmgr = new FGViewMgr;
globals->set_viewmgr( viewmgr );
viewmgr->init();
sky_tex_path.append( "Sky" );
thesky->texture_path( sky_tex_path.str() );
- thesky->build( 550.0, 550.0,
- globals->get_ephem()->getNumPlanets(),
- globals->get_ephem()->getPlanets(), 60000.0,
- globals->get_ephem()->getNumStars(),
- globals->get_ephem()->getStars(), 60000.0 );
+ // The sun and moon diameters are scaled down numbers of the
+ // actual diameters. This was needed to fit bot the sun and the
+ // moon within the distance to the far clip plane.
+ // Moon diameter: 3,476 kilometers
+ // Sun diameter: 1,390,000 kilometers
+ thesky->build( 80000.0, 80000.0,
+ 463.3, 361.8,
+ globals->get_ephem()->getNumPlanets(),
+ globals->get_ephem()->getPlanets(),
+ globals->get_ephem()->getNumStars(),
+ globals->get_ephem()->getStars() );
// Initialize MagVar model
SGMagVar *magvar = new SGMagVar();
globals->set_mag( magvar );
+
+ // kludge to initialize mag compass
+ // (should only be done for in-flight
+ // startup)
+ // update magvar model
+ globals->get_mag()->update( fgGetDouble("/position/longitude-deg")
+ * SGD_DEGREES_TO_RADIANS,
+ fgGetDouble("/position/latitude-deg")
+ * SGD_DEGREES_TO_RADIANS,
+ fgGetDouble("/position/altitude-ft")
+ * SG_FEET_TO_METER,
+ globals->get_time_params()->getJD() );
+ double var = globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES;
+ fgSetDouble("/instrumentation/heading-indicator/offset-deg", -var);
+
// airport = new ssgBranch;
// airport->setName( "Airport Lighting" );
// lighting->addKid( airport );