#include <simgear/scene/material/matlib.hxx>
#include <simgear/scene/model/particles.hxx>
+#include <simgear/scene/tsync/terrasync.hxx>
#include <Aircraft/controls.hxx>
#include <Aircraft/replay.hxx>
// main-loop
flightgear::initPosition();
+ simgear::SGTerraSync* terraSync =
+ static_cast<simgear::SGTerraSync*>(globals->get_subsystem("terrasync"));
+ if (terraSync) {
+ terraSync->reposition();
+ }
+
// Force reupdating the positions of the ai 3d models. They are used for
// initializing ground level for the FDM.
globals->get_subsystem("ai-model")->reinit();
}
} else if ( idle_state == 2 ) {
+
+ // start TerraSync up now, so it can be synchronizing shared models
+ // and airports data in parallel with a nav-cahce rebuild.
+ SGPath tsyncCache(globals->get_fg_home());
+ tsyncCache.append("terrasync-cache.xml");
+ fgSetString("/sim/terrasync/cache-path", tsyncCache.c_str());
+
+ simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync(globals->get_props());
+ globals->add_subsystem("terrasync", terra_sync);
+
+ terra_sync->bind();
+ terra_sync->init();
+
idle_state++;
fgSplashProgress("loading-nav-dat");
////////////////////////////////////////////////////////////////////
// Initialize the TG scenery subsystem.
////////////////////////////////////////////////////////////////////
- simgear::SGTerraSync* terra_sync = new simgear::SGTerraSync(globals->get_props());
- globals->add_subsystem("terrasync", terra_sync);
+
globals->set_scenery( new FGScenery );
globals->get_scenery()->init();
globals->get_scenery()->bind();
}
SGPath p(terrasyncDir);
- if (!p.exists()) {
- simgear::Dir dd(p);
- dd.create(0700);
+ // following is necessary to ensure NavDataCache sees stable scenery paths from
+ // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
+ // than waiting for the first tiles to be scheduled.
+ simgear::Dir terrainDir(SGPath(p, "Terrain")),
+ objectsDir(SGPath(p, "Objects"));
+ if (!terrainDir.exists()) {
+ terrainDir.create(0755);
}
-
+
+ if (!objectsDir.exists()) {
+ objectsDir.create(0755);
+ }
+
const string_list& scenery_paths(globals->get_fg_scenery());
if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
// terrasync dir is not in the scenery paths, add it