Splash-screen feedback on scenery download.
This commit is contained in:
parent
cb087dc4de
commit
ad4834c651
3 changed files with 46 additions and 26 deletions
|
@ -242,7 +242,7 @@ void FGTileMgr::schedule_needed(const SGBucket& curr_bucket, double vis)
|
|||
* Update the various queues maintained by the tilemagr (private
|
||||
* internal function, do not call directly.)
|
||||
*/
|
||||
void FGTileMgr::update_queues()
|
||||
void FGTileMgr::update_queues(bool& isDownloadingScenery)
|
||||
{
|
||||
osg::FrameStamp* framestamp
|
||||
= globals->get_renderer()->getViewer()->getFrameStamp();
|
||||
|
@ -265,22 +265,22 @@ void FGTileMgr::update_queues()
|
|||
// based on current visibilty
|
||||
e->prep_ssg_node(vis);
|
||||
|
||||
bool nonExpiredOrCurrent = !e->is_expired(current_time) || e->is_current_view();
|
||||
if ( !e->is_loaded() &&
|
||||
!isTileDirSyncing(e->tileFileName) &&
|
||||
nonExpiredOrCurrent)
|
||||
{
|
||||
// schedule tile for loading with osg pager
|
||||
_pager->queueRequest(e->tileFileName,
|
||||
e->getNode(),
|
||||
e->get_priority(),
|
||||
framestamp,
|
||||
e->getDatabaseRequest(),
|
||||
_options.get());
|
||||
loading++;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (!e->is_loaded()) {
|
||||
bool nonExpiredOrCurrent = !e->is_expired(current_time) || e->is_current_view();
|
||||
bool downloading = isTileDirSyncing(e->tileFileName);
|
||||
isDownloadingScenery |= downloading;
|
||||
if ( !downloading && nonExpiredOrCurrent) {
|
||||
// schedule tile for loading with osg pager
|
||||
_pager->queueRequest(e->tileFileName,
|
||||
e->getNode(),
|
||||
e->get_priority(),
|
||||
framestamp,
|
||||
e->getDatabaseRequest(),
|
||||
_options.get());
|
||||
loading++;
|
||||
}
|
||||
} // of tile not loaded case
|
||||
} else {
|
||||
SG_LOG(SG_TERRAIN, SG_ALERT, "Warning: empty tile in cache!");
|
||||
}
|
||||
tile_cache.next();
|
||||
|
@ -321,7 +321,8 @@ void FGTileMgr::update(double)
|
|||
double vis = _visibilityMeters->getDoubleValue();
|
||||
schedule_tiles_at(globals->get_view_position(), vis);
|
||||
|
||||
update_queues();
|
||||
bool waitingOnTerrasync = false;
|
||||
update_queues(waitingOnTerrasync);
|
||||
|
||||
// scenery loading check, triggers after each sim (tile manager) reinit
|
||||
if (!_scenery_loaded->getBoolValue())
|
||||
|
@ -330,6 +331,7 @@ void FGTileMgr::update(double)
|
|||
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)))
|
||||
|
@ -339,7 +341,14 @@ void FGTileMgr::update(double)
|
|||
}
|
||||
else
|
||||
{
|
||||
fgSplashProgress(positionFinalized ? "loading-scenery" : "finalize-position");
|
||||
if (!positionFinalized) {
|
||||
fgSplashProgress("finalize-position");
|
||||
} else if (waitingOnTerrasync) {
|
||||
fgSplashProgress("downloading-scenery");
|
||||
} else {
|
||||
fgSplashProgress("loading-scenery");
|
||||
}
|
||||
|
||||
// be nice to loader threads while waiting for initial scenery, reduce to 20fps
|
||||
SGTimeStamp::sleepForMSec(50);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
simgear::SGTerraSync* _terra_sync;
|
||||
|
||||
// update various queues internal queues
|
||||
void update_queues();
|
||||
void update_queues(bool& isDownloadingScenery);
|
||||
|
||||
// schedule tiles for the viewer bucket
|
||||
void schedule_tiles_at(const SGGeod& location, double rangeM);
|
||||
|
|
|
@ -402,11 +402,22 @@ void fgSplashProgress( const char *identifier ) {
|
|||
text = globals->get_locale()->getLocalizedString(id.c_str(),
|
||||
"sys", "<incomplete language resource>");
|
||||
}
|
||||
|
||||
if (!strcmp(fgGetString("/sim/startup/splash-progress-text"), text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(fgGetString("/sim/startup/splash-progress-text"), text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(identifier,"downloading-scenery")) {
|
||||
std::ostringstream oss;
|
||||
unsigned int kbytesPerSec = fgGetInt("/sim/terrasync/transfer-rate-bytes-sec") / 1024;
|
||||
oss << text;
|
||||
if (kbytesPerSec > 0) {
|
||||
oss << " - " << kbytesPerSec << " KBytes/sec";
|
||||
}
|
||||
fgSetString("/sim/startup/splash-progress-text", oss.str());
|
||||
} else {
|
||||
SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << identifier );
|
||||
fgSetString("/sim/startup/splash-progress-text", text);
|
||||
}
|
||||
|
||||
SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << identifier );
|
||||
fgSetString("/sim/startup/splash-progress-text", text);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue