globals->set_freeze( ! globals->get_freeze() );
{
- FGBucket p( f->get_Longitude() * RAD_TO_DEG,
+ SGBucket p( f->get_Longitude() * RAD_TO_DEG,
f->get_Latitude() * RAD_TO_DEG );
FGPath tile_path( globals->get_options()->get_fg_root() );
tile_path.append( "Scenery" );
}
// Calculate center point
- FGBucket b = t->tile_bucket;
+ SGBucket b = t->tile_bucket;
double clon = b.get_center_lon();
double clat = b.get_center_lat();
double height = b.get_height();
for ( ; current != end; ++current ) {
long index = current->first;
- cout << "clearing " << index << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "clearing " << index );
FGTileEntry *e = current->second;
e->tile_bucket.make_bad();
entry_free(index);
// Search for the specified "bucket" in the cache
-bool FGNewCache::exists( const FGBucket& b ) {
+bool FGNewCache::exists( const SGBucket& b ) {
long tile_index = b.gen_index();
tile_map_iterator it = tile_cache.find( tile_index );
// Fill in a tile cache entry with real data for the specified bucket
-void FGNewCache::fill_in( const FGBucket& b ) {
+void FGNewCache::fill_in( const SGBucket& b ) {
FG_LOG( FG_TERRAIN, FG_INFO, "FILL IN CACHE ENTRY = " << b.gen_index() );
// clear out a distant entry in the cache if needed.
}
// load custom objects
- cout << "CUSTOM OBJECTS" << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "CUSTOM OBJECTS" );
FGPath index_path = tile_path;
index_path.append( b.gen_index_str() );
index_path.concat( ".ind" );
- cout << "Looking in " << index_path.str() << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "Looking in " << index_path.str() );
fg_gzifstream in( index_path.str() );
#else
in >> skipws;
#endif
- cout << "token = " << token << " name = " << name << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "token = " << token
+ << " name = " << name );
FGPath custom_path = tile_path;
custom_path.append( name );
e->lights_range = NULL;
/* uncomment this section for testing ground lights */
if ( light_pts->getNum() ) {
- cout << "generating lights" << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "generating lights" );
e->lights_transform = new ssgTransform;
e->lights_range = new ssgRangeSelector;
e->lights_brightness = new ssgSelector;
FG_LOG( FG_TERRAIN, FG_INFO, "Make space in cache" );
- cout << "cache size = " << tile_cache.size() << endl;
- cout << "max size = " << max_cache_size << endl;
+ FG_LOG( FG_TERRAIN, FG_DEBUG, "cache entries = " << tile_cache.size() );
+ FG_LOG( FG_TERRAIN, FG_INFO, "max size = " << max_cache_size );
if ( (int)tile_cache.size() < max_cache_size ) {
// space in the cache, return
void init( void );
// Check if the specified "bucket" exists in the cache
- bool exists( const FGBucket& b );
+ bool exists( const SGBucket& b );
// Ensure at least one entry is free in the cache
void FGNewCache::make_space();
// Fill in a tile cache entry with real data for the specified bucket
- void fill_in( const FGBucket& b );
+ void fill_in( const SGBucket& b );
// Return a pointer to the specified tile cache entry
inline FGTileEntry *get_tile( const long tile_index ) {
}
// Return a pointer to the specified tile cache entry
- inline FGTileEntry *get_tile( const FGBucket& b ) {
+ inline FGTileEntry *get_tile( const SGBucket& b ) {
return get_tile( b.gen_index() );
}
Point3D offset;
// this tile's official location in the world
- FGBucket tile_bucket;
+ SGBucket tile_bucket;
// list of pointers to memory chunks that need to be freed when
// tile entry goes away
// schedule a tile for loading
-void FGTileMgr::sched_tile( const FGBucket& b ) {
+void FGTileMgr::sched_tile( const SGBucket& b ) {
// see if tile already exists in the cache
FGTileEntry *t = global_tile_cache.get_tile( b );
// load a tile
-void FGTileMgr::load_tile( const FGBucket& b ) {
+void FGTileMgr::load_tile( const SGBucket& b ) {
// see if tile already exists in the cache
FGTileEntry *t = global_tile_cache.get_tile( b );
for ( int x = -xrange; x <= xrange; ++x ) {
for ( int y = -yrange; y <= yrange; ++y ) {
- FGBucket b = fgBucketOffset( longitude, latitude, x, y );
+ SGBucket b = sgBucketOffset( longitude, latitude, x, y );
if ( ! global_tile_cache.exists( b ) ) {
sched_tile( b );
}
FG_LOG( FG_TERRAIN, FG_DEBUG,
"Load queue not empty, loading a tile" );
- FGBucket pending = load_queue.front();
+ SGBucket pending = load_queue.front();
load_queue.pop_front();
load_tile( pending );
}
FG_LOG( FG_TERRAIN, FG_INFO, "Load queue size = " << load_queue.size()
<< " loading a tile" );
- FGBucket pending = load_queue.front();
+ SGBucket pending = load_queue.front();
load_queue.pop_front();
load_tile( pending );
}
load_state state;
// pending tile load queue
- list < FGBucket > load_queue;
+ list < SGBucket > load_queue;
// initialize the cache
void initialize_queue();
void destroy_queue();
// schedule a tile for loading
- void sched_tile( const FGBucket& b );
+ void sched_tile( const SGBucket& b );
// load a tile
- void load_tile( const FGBucket& b );
+ void load_tile( const SGBucket& b );
// schedule a needed buckets for loading
void FGTileMgr::schedule_needed();
// ssgEntity *last_hit;
FGHitList hit_list;
- FGBucket previous_bucket;
- FGBucket current_bucket;
- FGBucket pending;
+ SGBucket previous_bucket;
+ SGBucket current_bucket;
+ SGBucket pending;
FGTileEntry *current_tile;
// << nmoon[2] << endl;
l->moon_angle = acos( sgScalarProductVec3( nup, nmoon ) );
- cout << "moon angle relative to current location = "
- << l->moon_angle << endl;
+ FG_LOG( FG_EVENT, FG_INFO, "moon angle relative to current location = "
+ << l->moon_angle );
// calculate vector to moon's position on the earth's surface
Point3D vp( v->get_view_pos()[0],
// v->surface_east. We do this so we can sort out the acos()
// ambiguity. I wish I could think of a more efficient way ... :-(
east_dot = sgScalarProductVec3( surface_to_moon, v->get_surface_east() );
- // cout << " East dot product = " << east_dot << endl;
+ // cout << " East dot product = " << east_dot << endl;
// calculate the angle between v->surface_to_moon and
// v->surface_south. this is how much we have to rotate the sky
// << nsun[2] << endl;
l->sun_angle = acos( sgScalarProductVec3 ( nup, nsun ) );
- cout << "sun angle relative to current location = " << l->sun_angle << endl;
+ FG_LOG( FG_EVENT, FG_INFO, "sun angle relative to current location = "
+ << l->sun_angle );
// calculate vector to sun's position on the earth's surface
Point3D vp( v->get_view_pos()[0],