1
0
Fork 0

Set viewer-[lon|lat]-deg on initial View bind

Previously /sim/current-view/viewer-[lon|lat]-deg were set to
(0,0) when a view was bind() for the first time by the view
manager.  This cause the scenery tile cache to immediately clear
and all scenery to be reloaded.

Now these values are set correctly the first time the view
bind() is called, so the cache behaves correctly.

Also fixed what looks like a possible bug on code read where
the tiles of the current view had a very short expiry time
set.  Seems wrong.
This commit is contained in:
Stuart Buchanan 2020-05-10 14:17:40 +01:00
parent 61ed9efac8
commit f5b469aee0
3 changed files with 29 additions and 25 deletions

View file

@ -215,7 +215,7 @@ void TileCache::request_tile(TileEntry* t,float priority,bool current_view,doubl
if (current_view)
{
t->update_time_expired( current_time );
t->update_time_expired( current_time + request_time );
t->set_current_view( true );
}
else

View file

@ -129,7 +129,7 @@ public:
inline bool is_current_view() const { return _current_view; }
/**
* Return true if the tile entry is still needed, otherwise return false
* Return false if the tile entry is still needed, otherwise return true
* indicating that the tile is no longer in active use.
*/
inline bool is_expired(double current_time) const { return (_current_view) ? false : (current_time > _time_expired); }

View file

@ -229,6 +229,10 @@ View::init ()
void
View::bind ()
{
// Perform an immediate recalculation to ensure that the data for the
// viewer position is correct.
recalc();
_tiedProperties.setRoot(fgGetNode("/sim/current-view", true));
_tiedProperties.Tie("heading-offset-deg", this,
&View::getHeadingOffset_deg,