done every frame.
}
+// Clear the inner ring flag for all tiles in the cache so that the
+// external tile scheduler can flag the inner ring correctly.
+void FGNewCache::clear_inner_ring_flags() {
+ tile_map_iterator current = tile_cache.begin();
+ tile_map_iterator end = tile_cache.end();
+
+ for ( ; current != end; ++current ) {
+ FGTileEntry *e = current->second;
+ if ( e->is_loaded() && (e->get_pending_models() == 0) ) {
+ e->set_inner_ring( false );
+ }
+ }
+}
+
// Clear a cache entry, note that the cache only holds pointers
// and this does not free the object which is pointed to.
void FGNewCache::clear_entry( long cache_index ) {
// nothing available to be removed.
long get_oldest_tile();
+ // Clear the inner ring flag for all tiles in the cache so that
+ // the external tile scheduler can flag the inner ring correctly.
+ void clear_inner_ring_flags();
+
// Clear a cache entry, note that the cache only holds pointers
// and this does not free the object which is pointed to.
void clear_entry( long cache_entry );
// Clear all completely loaded tiles (ignores partially loaded tiles)
void clear_cache();
- // Fill in a tile cache entry with real data for the specified bucket
- // void fill_in( const SGBucket& b );
-
// Return a pointer to the specified tile cache entry
inline FGTileEntry *get_tile( const long tile_index ) {
tile_map_iterator it = tile_cache.find( tile_index );
taxi_lights_selector( new ssgSelector ),
loaded(false),
pending_models(0),
+ is_inner_ring(false),
free_tracker(0)
{
// update the contents
}
}
- if ( vasi_lights_transform ) {
+ if ( vasi_lights_transform && is_inner_ring ) {
// now we need to traverse the list of vasi lights and update
- // their coloring
+ // their coloring (but only for the inner ring, no point in
+ // doing this extra work for tiles that are relatively far
+ // away.)
for ( int i = 0; i < vasi_lights_transform->getNumKids(); ++i ) {
// cout << "vasi root = " << i << endl;
ssgBranch *v = (ssgBranch *)vasi_lights_transform->getKid(i);
double timestamp;
+ /**
+ * this value is used by the tile scheduler/loader to mark which
+ * tiles are in the primary ring (i.e. the current tile or the
+ * surrounding eight.) Other routines then can use this as an
+ * optimization and not do some operation to tiles outside of this
+ * inner ring. (For instance vasi color updating)
+ */
+ bool is_inner_ring;
- // this variable tracks the status of the incremental memory freeing.
+ /**
+ * this variable tracks the status of the incremental memory
+ * freeing.
+ */
enum {
NODES = 0x01,
VEC_PTRS = 0x02,
*/
inline ssgTransform *get_terra_transform() { return terra_transform; }
- void set_timestamp(double time_ms) { timestamp = time_ms; }
-
inline double get_timestamp() const { return timestamp; }
+ inline void set_timestamp( double time_ms ) { timestamp = time_ms; }
+ inline bool get_inner_ring() const { return is_inner_ring; }
+ inline void set_inner_ring( bool val ) { is_inner_ring = val; }
};
// schedule a tile for loading
-void FGTileMgr::sched_tile( const SGBucket& b ) {
+void FGTileMgr::sched_tile( const SGBucket& b, const bool is_inner_ring ) {
// see if tile already exists in the cache
FGTileEntry *t = tile_cache.get_tile( b );
// delete.) Try again later
delete e;
}
+ } else {
+ t->set_inner_ring( is_inner_ring );
}
}
// note * 2 at end doubles cache size (for fdm and viewer)
tile_cache.set_max_cache_size( (2*xrange + 2) * (2*yrange + 2) * 2 );
-
/*
cout << "xrange = " << xrange << " yrange = " << yrange << endl;
cout << "max cache size = " << tile_cache.get_max_cache_size()
<< " current cache size = " << tile_cache.get_size() << endl;
*/
+ // clear the inner ring flags so we can set them below. This
+ // prevents us from having "true" entries we aren't able to find
+ // to get rid of if we teleport a long ways away from the current
+ // location.
+ tile_cache.clear_inner_ring_flags();
+
SGBucket b;
// schedule center tile first so it can be loaded first
b = sgBucketOffset( longitude, latitude, 0, 0 );
- sched_tile( b );
+ sched_tile( b, true );
int x, y;
for ( y = -1; y <= 1; ++y ) {
if ( x != 0 || y != 0 ) {
b = sgBucketOffset( longitude, latitude, x, y );
- sched_tile( b );
+ sched_tile( b, true );
}
}
}
for ( y = -yrange; y <= yrange; ++y ) {
if ( x < -1 || x > 1 || y < -1 || y > 1 ) {
SGBucket b = sgBucketOffset( longitude, latitude, x, y );
- sched_tile( b );
+ sched_tile( b, false );
}
}
}
void initialize_queue();
// schedule a tile for loading
- void sched_tile( const SGBucket& b );
+ void sched_tile( const SGBucket& b, const bool is_inner_ring );
// schedule a needed buckets for loading
void schedule_needed(double visibility_meters, SGBucket curr_bucket);
- // see comment at prep_ssg_nodes()
- void prep_ssg_node( int idx );
-
FGHitList hit_list;
SGBucket previous_bucket;