Renamed FGBucket -> SGBucket.
This commit is contained in:
parent
da97ac5b9f
commit
95d6d93bed
9 changed files with 32 additions and 30 deletions
|
@ -345,7 +345,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
|||
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" );
|
||||
|
|
|
@ -159,7 +159,7 @@ ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
|
|||
}
|
||||
|
||||
// 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();
|
||||
|
|
|
@ -100,7 +100,7 @@ void FGNewCache::init( void ) {
|
|||
|
||||
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);
|
||||
|
@ -114,7 +114,7 @@ void FGNewCache::init( void ) {
|
|||
|
||||
|
||||
// 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 );
|
||||
|
||||
|
@ -191,7 +191,7 @@ static ssgLeaf *gen_lights( ssgVertexArray *lights, int inc, float bright ) {
|
|||
|
||||
|
||||
// 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.
|
||||
|
@ -239,13 +239,13 @@ void FGNewCache::fill_in( const FGBucket& b ) {
|
|||
}
|
||||
|
||||
// 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() );
|
||||
|
||||
|
@ -260,7 +260,8 @@ void FGNewCache::fill_in( const FGBucket& b ) {
|
|||
#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 );
|
||||
|
@ -287,7 +288,7 @@ void FGNewCache::fill_in( const FGBucket& b ) {
|
|||
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;
|
||||
|
@ -316,8 +317,8 @@ void FGNewCache::make_space() {
|
|||
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
|
||||
|
|
|
@ -82,13 +82,13 @@ public:
|
|||
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 ) {
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
}
|
||||
|
||||
// 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() );
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
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
|
||||
|
|
|
@ -111,7 +111,7 @@ int FGTileMgr::init() {
|
|||
|
||||
|
||||
// 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 );
|
||||
|
||||
|
@ -123,7 +123,7 @@ void FGTileMgr::sched_tile( const FGBucket& 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 );
|
||||
|
||||
|
@ -230,7 +230,7 @@ void FGTileMgr::schedule_needed() {
|
|||
|
||||
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 );
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void FGTileMgr::initialize_queue()
|
|||
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 );
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ int FGTileMgr::update( double lon, double lat ) {
|
|||
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 );
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ private:
|
|||
load_state state;
|
||||
|
||||
// pending tile load queue
|
||||
list < FGBucket > load_queue;
|
||||
list < SGBucket > load_queue;
|
||||
|
||||
// initialize the cache
|
||||
void initialize_queue();
|
||||
|
@ -78,10 +78,10 @@ private:
|
|||
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();
|
||||
|
@ -95,9 +95,9 @@ private:
|
|||
// 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;
|
||||
|
||||
|
|
|
@ -391,8 +391,8 @@ void fgUpdateMoonPos( void ) {
|
|||
// << 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],
|
||||
|
@ -421,7 +421,7 @@ void fgUpdateMoonPos( void ) {
|
|||
// 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
|
||||
|
|
|
@ -298,7 +298,8 @@ void fgUpdateSunPos( void ) {
|
|||
// << 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],
|
||||
|
|
Loading…
Reference in a new issue