#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Viewer/renderer.hxx>
-#include <Viewer/viewer.hxx>
#include <Viewer/splash.hxx>
#include <Scripting/NasalSys.hxx>
void FGTileMgr::reinit()
{
+ _terra_sync = static_cast<simgear::SGTerraSync*> (globals->get_subsystem("terrasync"));
+ if (_terra_sync)
+ _terra_sync->setTileRefreshCb(&refresh_tile, this);
+
// protect against multiple scenery reloads and properly reset flags,
// otherwise aircraft fall through the ground while reloading scenery
if (!fgGetBool("/sim/sceneryloaded",true))
longitude = latitude = -1000.0;
scheduled_visibility = 100.0;
- _terra_sync = (simgear::SGTerraSync*) globals->get_subsystem("terrasync");
- if (_terra_sync)
- _terra_sync->setTileRefreshCb(&refresh_tile, this);
-
// force an update now
update(0.0);
}
// disk.
void FGTileMgr::update(double)
{
- SGVec3d viewPos = globals->get_current_view()->get_view_pos();
double vis = _visibilityMeters->getDoubleValue();
- schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
+ schedule_tiles_at(globals->get_view_position(), vis);
update_queues();
// scenery loading check, triggers after each sim (tile manager) reinit
if (!_scenery_loaded->getBoolValue())
{
- if (_scenery_override->getBoolValue() || isSceneryLoaded())
+ bool fdmInited = fgGetBool("sim/fdm-initialized");
+ bool positionFinalized = fgGetBool("sim/position-finalized");
+ bool sceneryOverride = _scenery_override->getBoolValue();
+
+ // we are done if final position is set and the scenery & FDM are done.
+ // scenery-override can ignore the last two, but not position finalization.
+ if (positionFinalized && (sceneryOverride || (isSceneryLoaded() && fdmInited)))
{
_scenery_loaded->setBoolValue(true);
fgSplashProgress("");
}
else
{
- fgSplashProgress("loading-scenery");
+ fgSplashProgress(positionFinalized ? "loading-scenery" : "finalize-position");
// be nice to loader threads while waiting for initial scenery, reduce to 20fps
SGTimeStamp::sleepForMSec(50);
}