// is initialized.
extern int _bootstrap_OSInit;
-
-static void fgLoadInitialScenery()
-{
- static SGPropertyNode_ptr scenery_loaded
- = fgGetNode("sim/sceneryloaded", true);
- static SGPropertyNode_ptr scenery_override
- = fgGetNode("/sim/sceneryloaded-override", true);
-
- if (!scenery_loaded->getBoolValue())
- {
- if (scenery_override->getBoolValue() ||
- (globals->get_tile_mgr()->isSceneryLoaded()
- && fgGetBool("sim/fdm-initialized"))) {
- fgSetBool("sim/sceneryloaded",true);
- fgSplashProgress("");
- }
- else
- {
- fgSplashProgress("loading-scenery");
- // be nice to loader threads while waiting for initial scenery, reduce to 20fps
- SGTimeStamp::sleepForMSec(50);
- }
- }
-}
-
// What should we do when we have nothing else to do? Let's get ready
// for the next move and update the display?
static void fgMainLoop( void )
// update all subsystems
globals->get_subsystem_mgr()->update(sim_dt);
- // END Tile Manager updates
- fgLoadInitialScenery();
-
simgear::AtomicChangeListener::fireChangeListeners();
SG_LOG( SG_GENERAL, SG_DEBUG, "" );
#include <Main/fg_props.hxx>
#include <Viewer/renderer.hxx>
#include <Viewer/viewer.hxx>
+#include <Viewer/splash.hxx>
#include <Scripting/NasalSys.hxx>
#include "scenery.hxx"
_visibilityMeters(fgGetNode("/environment/visibility-m", true)),
_maxTileRangeM(fgGetNode("/sim/rendering/static-lod/bare", true)),
_disableNasalHooks(fgGetNode("/sim/temp/disable-scenery-nasal", true)),
+ _scenery_loaded(fgGetNode("/sim/sceneryloaded", true)),
+ _scenery_override(fgGetNode("/sim/sceneryloaded-override", true)),
_pager(FGScenery::getPagerSingleton())
{
}
schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
update_queues();
+
+ // scenery loading check, triggers after each sim (tile manager) reinit
+ if (!_scenery_loaded->getBoolValue())
+ {
+ if (_scenery_override->getBoolValue() || isSceneryLoaded())
+ {
+ _scenery_loaded->setBoolValue(true);
+ fgSplashProgress("");
+ }
+ else
+ {
+ fgSplashProgress("loading-scenery");
+ // be nice to loader threads while waiting for initial scenery, reduce to 20fps
+ SGTimeStamp::sleepForMSec(50);
+ }
+ }
}
-// schedule tiles for the viewer bucket (FDM/AI/groundcache/... use
-// "schedule_scenery" instead
-int FGTileMgr::schedule_tiles_at(const SGGeod& location, double range_m)
+// schedule tiles for the viewer bucket
+// (FDM/AI/groundcache/... should use "schedule_scenery" instead)
+void FGTileMgr::schedule_tiles_at(const SGGeod& location, double range_m)
{
longitude = location.getLongitudeDeg();
latitude = location.getLatitudeDeg();
// SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update() for "
- // << longitude << " " << latatitude );
+ // << longitude << " " << latitude );
current_bucket.set_bucket( location );
previous_bucket.make_bad();
}
last_state = state;
-
- return 1;
}
/** Schedules scenery for given position. Load request remains valid for given duration
TileCache tile_cache;
simgear::SGTerraSync* _terra_sync;
- // Update the various queues maintained by the tilemagr (private
- // internal function, do not call directly.)
+ // update various queues internal queues
void update_queues();
+ // schedule tiles for the viewer bucket
+ void schedule_tiles_at(const SGGeod& location, double rangeM);
+
static void refresh_tile(void* tileMgr, long tileIndex);
SGPropertyNode_ptr _visibilityMeters;
SGPropertyNode_ptr _maxTileRangeM, _disableNasalHooks;
+ SGPropertyNode_ptr _scenery_loaded, _scenery_override;
osg::ref_ptr<flightgear::SceneryPager> _pager;
public:
FGTileMgr();
-
~FGTileMgr();
// Initialize the Tile Manager
virtual void init();
virtual void reinit();
-
virtual void update(double dt);
- int schedule_tiles_at(const SGGeod& location, double rangeM);
-
-
const SGBucket& get_current_bucket () const { return current_bucket; }
- /// Returns true if scenery is available for the given lat, lon position
- /// within a range of range_m.
- /// lat and lon are expected to be in degrees.
+ // Returns true if scenery is available for the given lat, lon position
+ // within a range of range_m.
+ // lat and lon are expected to be in degrees.
bool schedule_scenery(const SGGeod& position, double range_m, double duration=0.0);
// Returns true if tiles around current view position have been loaded