-// 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 ) {
-
- static SGConstPropertyNode_ptr longitude
- = fgGetNode("/position/longitude-deg");
- static SGConstPropertyNode_ptr latitude
- = fgGetNode("/position/latitude-deg");
- static SGConstPropertyNode_ptr altitude
- = fgGetNode("/position/altitude-ft");
- static SGConstPropertyNode_ptr vn_fps
- = fgGetNode("/velocities/speed-north-fps");
- static SGConstPropertyNode_ptr ve_fps
- = fgGetNode("/velocities/speed-east-fps");
- static SGConstPropertyNode_ptr vd_fps
- = fgGetNode("/velocities/speed-down-fps");
-
- static SGPropertyNode_ptr frame_signal
- = fgGetNode("/sim/signals/frame", true);
-
- static SGPropertyNode_ptr _statisticsFlag
- = fgGetNode("/sim/timing-statistics/enabled", true);
- static SGPropertyNode_ptr _statisticsInterval
- = fgGetNode("/sim/timing-statistics/interval-s", true);
- static SGPropertyNode_ptr _statiticsMinJitter
- = fgGetNode("/sim/timing-statistics/min-jitter-ms", true);
- static SGPropertyNode_ptr _statiticsMinTime
- = fgGetNode("/sim/timing-statistics/min-time-ms", true);
-
- frame_signal->fireValueChanged();
- SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping");
-
- SG_LOG( SG_ALL, SG_DEBUG, "Running Main Loop");
- SG_LOG( SG_ALL, SG_DEBUG, "======= ==== ====");
-
-
- // update "time"
- double sim_dt, real_dt;
- TimeManager* timeMgr = (TimeManager*) globals->get_subsystem("time");
- // compute simulated time (allowing for pause, warp, etc) and
- // real elapsed time
- timeMgr->computeTimeDeltas(sim_dt, real_dt);
-
- // update magvar model
- globals->get_mag()->update( longitude->getDoubleValue()
- * SGD_DEGREES_TO_RADIANS,
- latitude->getDoubleValue()
- * SGD_DEGREES_TO_RADIANS,
- altitude->getDoubleValue() * SG_FEET_TO_METER,
- globals->get_time_params()->getJD() );
-
- // Run ATC subsystem
- globals->get_ATC_mgr()->update(sim_dt);
-
- globals->get_subsystem_mgr()->update(sim_dt);
-
- // Update the sound manager last so it can use the CPU while the GPU
- // is processing the scenery (doubled the frame-rate for me) -EMH-
-#ifdef ENABLE_AUDIO_SUPPORT
- static bool smgr_init = true;
- static SGPropertyNode *sound_working = fgGetNode("/sim/sound/working");
- if (smgr_init == true) {
- if (sound_working->getBoolValue() == true) {
- fgInitSoundManager();
- smgr_init = false;
- }
- } else {
- static SGPropertyNode *sound_enabled = fgGetNode("/sim/sound/enabled");
- static SGSoundMgr *smgr = globals->get_soundmgr();
- static bool smgr_enabled = true;
-
- if (sound_working->getBoolValue() == false) { // request to reinit
- smgr->reinit();
- smgr->resume();
- sound_working->setBoolValue(true);
- }