#include <simgear/scene/model/modellib.hxx>
#include <simgear/scene/material/matlib.hxx>
+#include <simgear/scene/material/Effect.hxx>
#include <simgear/scene/model/particles.hxx>
#include <simgear/scene/tsync/terrasync.hxx>
options->init(argc, argv, dataPath);
}
- bool loadDefaults = flightgear::Options::sharedInstance()->shouldLoadDefaultConfig();
+ bool loadDefaults = options->shouldLoadDefaultConfig();
if (loadDefaults) {
// Read global preferences from $FG_ROOT/preferences.xml
SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
} else {
SG_LOG(SG_GENERAL, SG_INFO, "not reading default configuration files");
}// of no-default-config selected
-
- // Scan user config files and command line for a specified aircraft.
- options->initAircraft();
+
+ return flightgear::FG_OPTIONS_OK;
+}
+int fgInitAircraft(bool reinit)
+{
+ // Scan user config files and command line for a specified aircraft.
+ if (!reinit) {
+ flightgear::Options::sharedInstance()->initAircraft();
+ }
+
FindAndCacheAircraft f(globals->get_props());
if (!f.loadAircraft()) {
- return flightgear::FG_OPTIONS_ERROR;
+ return flightgear::FG_OPTIONS_ERROR;
}
-
- // parse options after loading aircraft to ensure any user
- // overrides of defaults are honored.
- return options->processOptions();
+
+ return flightgear::FG_OPTIONS_OK;
}
-
-
/**
* Initialize vor/ndb/ils/fix list management and query systems (as
* well as simple airport db list)
// potentially others) can queue delete requests on the pager.
render->getViewer()->getDatabasePager()->cancel();
+ osgDB::Registry::instance()->clearObjectCache();
+
// preserve the event handler; re-creating it would entail fixing the
// idle handler
osg::ref_ptr<flightgear::FGEventHandler> eventHandler = render->getEventHandler();
globals->set_renderer(NULL);
globals->set_matlib(NULL);
- simgear::SGModelLib::resetPropertyRoot();
+ globals->set_chatter_queue(NULL);
+ simgear::clearEffectCache();
+ simgear::SGModelLib::resetPropertyRoot();
+
globals->resetPropertyRoot();
globals->restoreInitialState();
fgInitConfig(0, NULL, true);
fgInitGeneral(); // all of this?
+ fgGetNode("/sim")->removeChild("aircraft-dir");
+ fgInitAircraft(true);
+ flightgear::Options::sharedInstance()->processOptions();
+
render = new FGRenderer;
render->setEventHandler(eventHandler);
globals->set_renderer(render);
flightgear::CameraGroup::buildDefaultGroup(viewer.get());
fgOSResetProperties();
+
// init some things manually
// which do not follow the regular init pattern