Terrasync tweaks.
- Enable the terrasync persistent cache - Ensure terraysync scenery dirs exist before NavCache init, so the paths are stable - Notify TerraSync on reposition, so we sync the full 3x3 set of tiles.
This commit is contained in:
parent
bebc7235b3
commit
1a9e479e2a
3 changed files with 33 additions and 6 deletions
|
@ -53,6 +53,7 @@
|
|||
|
||||
#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>
|
||||
|
@ -853,6 +854,12 @@ void fgReInitSubsystems()
|
|||
// 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();
|
||||
|
|
|
@ -130,6 +130,19 @@ static void fgIdleFunction ( void ) {
|
|||
}
|
||||
|
||||
} 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");
|
||||
|
||||
|
@ -178,8 +191,7 @@ static void fgIdleFunction ( void ) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// 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();
|
||||
|
|
|
@ -2058,11 +2058,19 @@ void Options::processOptions()
|
|||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue