#include <simgear/math/sg_random.h>
#include <Time/light.hxx>
-#include <Include/general.hxx>
#include <Aircraft/replay.hxx>
#include <Cockpit/cockpit.hxx>
#include <Cockpit/hud.hxx>
using std::cerr;
-// This is a record containing a bit of global housekeeping information
-FGGeneral general;
-
// Specify our current idle function state. This is used to run all
// our initializations out of the idle callback so that we can get a
// splash screen up and running right away.
#endif
globals->get_subsystem_mgr()->update(sim_dt);
- globals->get_aircraft_model()->update(sim_dt);
-
- //
- // Tile Manager updates - see if we need to load any new scenery tiles.
- // this code ties together the fdm, viewer and scenery classes...
- // we may want to move this to its own class at some point
- //
- double visibility_meters = fgGetDouble("/environment/visibility-m");
- globals->get_tile_mgr()->prep_ssg_nodes( visibility_meters );
-
- // update tile manager for view...
- SGVec3d viewPos = globals->get_current_view()->get_view_pos();
- SGGeod geodViewPos = SGGeod::fromCart(viewPos);
- globals->get_tile_mgr()->update(geodViewPos, visibility_meters);
// run Nasal's settimer() loops right before the view manager
globals->get_event_mgr()->update(sim_dt);
SGRawValueFunctions<const char *>(0, fgSetNewSoundDevice), false);
}
simgear::AtomicChangeListener::fireChangeListeners();
- fgRequestRedraw();
SG_LOG( SG_ALL, SG_DEBUG, "" );
}
}
void run(osg::GraphicsContext* gc)
{
- general.set_glVendor( (char *)glGetString ( GL_VENDOR ) );
- general.set_glRenderer( (char *)glGetString ( GL_RENDERER ) );
- general.set_glVersion( (char *)glGetString ( GL_VERSION ) );
- SG_LOG( SG_GENERAL, SG_INFO, general.get_glVendor() );
- SG_LOG( SG_GENERAL, SG_INFO, general.get_glRenderer() );
- SG_LOG( SG_GENERAL, SG_INFO, general.get_glVersion() );
+ SGPropertyNode* simRendering = fgGetNode("/sim/rendering");
+
+ simRendering->setStringValue("gl-vendor", (char*) glGetString(GL_VENDOR));
+ SG_LOG( SG_GENERAL, SG_INFO, glGetString(GL_VENDOR));
+
+ simRendering->setStringValue("gl-renderer", (char*) glGetString(GL_RENDERER));
+ SG_LOG( SG_GENERAL, SG_INFO, glGetString(GL_RENDERER));
+
+ simRendering->setStringValue("gl-version", (char*) glGetString(GL_VERSION));
+ SG_LOG( SG_GENERAL, SG_INFO, glGetString(GL_VERSION));
GLint tmp;
glGetIntegerv( GL_MAX_TEXTURE_SIZE, &tmp );
- general.set_glMaxTexSize( tmp );
- SG_LOG ( SG_GENERAL, SG_INFO, "Max texture size = " << tmp );
+ simRendering->setIntValue("max-texture-size", tmp);
glGetIntegerv( GL_DEPTH_BITS, &tmp );
- general.set_glDepthBits( tmp );
- SG_LOG ( SG_GENERAL, SG_INFO, "Depth buffer bits = " << tmp );
+ simRendering->setIntValue("depth-buffer-bits", tmp);
}
};
globals->set_matlib( new SGMaterialLib );
simgear::SGModelLib::init(globals->get_fg_root());
simgear::SGModelLib::setPropRoot(globals->get_props());
- simgear::SGModelLib::setResolveFunc(resolve_path);
simgear::SGModelLib::setPanelFunc(load_panel);
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
FGAircraftModel* acm = new FGAircraftModel;
globals->set_aircraft_model(acm);
- //globals->add_subsystem("aircraft-model", acm);
- acm->init();
- acm->bind();
+ globals->add_subsystem("aircraft-model", acm, SGSubsystemMgr::DISPLAY);
////////////////////////////////////////////////////////////////////
// Initialize the view manager subsystem.
// Main top level initialization
-bool fgMainInit( int argc, char **argv ) {
+int fgMainInit( int argc, char **argv ) {
// set default log levels
sglog().setLogLevels( SG_ALL, SG_ALERT );
fgSplashInit();
// pass control off to the master event handler
- fgOSMainLoop();
-
- // we never actually get here ... but to avoid compiler warnings,
- // etc.
- return false;
+ int result = fgOSMainLoop();
+
+ // clean up here; ensure we null globals to avoid
+ // confusing the atexit() handler
+ delete globals;
+ globals = NULL;
+
+ return result;
}