Add support for specifying a ";" delimited list of scenery locations to
search when loading scenery tiles. (I am not set on using ";" as the delimiter because it is a command separator in unix, but ":" is a critical part of the windows file naming scheme (c:\foo\bar) so that is even worse.) Example: --fg-scenery=/stage/fgfs04/curt/Scenery-0.9.1/Scenery;/stage/helio1/curt/Scenery -0.7.9
This commit is contained in:
parent
85feefa59f
commit
b206ef0a4b
4 changed files with 187 additions and 178 deletions
|
@ -92,12 +92,14 @@ FGTileLoader::add( FGTileEntry* tile )
|
|||
static bool beenhere = false;
|
||||
if (!beenhere)
|
||||
{
|
||||
SGPath tmp;
|
||||
if ( !globals->get_fg_scenery().empty() ) {
|
||||
tile_path.set( globals->get_fg_scenery() );
|
||||
tmp.set( globals->get_fg_scenery() );
|
||||
} else {
|
||||
tile_path.set( globals->get_fg_root() );
|
||||
tmp.set( globals->get_fg_root() );
|
||||
tile_path.append( "Scenery" );
|
||||
}
|
||||
tile_path = tmp.str();
|
||||
beenhere = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ private:
|
|||
/**
|
||||
* Base name of directory containing tile data file.
|
||||
*/
|
||||
SGPath tile_path;
|
||||
string tile_path;
|
||||
|
||||
#ifdef ENABLE_THREADS
|
||||
/**
|
||||
|
|
|
@ -557,17 +557,6 @@ bool FGTileEntry::obj_load( const string& path,
|
|||
center = c;
|
||||
bounding_radius = br;
|
||||
}
|
||||
} else {
|
||||
// default to an ocean tile
|
||||
if ( sgGenTile( path, tile_bucket, &c, &br,
|
||||
globals->get_matlib(), geometry ) )
|
||||
{
|
||||
center = c;
|
||||
bounding_radius = br;
|
||||
} else {
|
||||
SG_LOG( SG_TERRAIN, SG_ALERT,
|
||||
"Warning: failed to generate ocean tile!" );
|
||||
}
|
||||
}
|
||||
|
||||
return (geometry != NULL);
|
||||
|
@ -575,14 +564,27 @@ bool FGTileEntry::obj_load( const string& path,
|
|||
|
||||
|
||||
void
|
||||
FGTileEntry::load( const SGPath& base, bool is_base )
|
||||
FGTileEntry::load( const string &base_path, bool is_base )
|
||||
{
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "load() base = " << base.str() );
|
||||
SG_LOG( SG_TERRAIN, SG_INFO, "load() base search path = "
|
||||
<< base_path );
|
||||
|
||||
bool found_tile_base = false;
|
||||
|
||||
string_list search = sgPathSplit( base_path );
|
||||
|
||||
// obj_load() will generate ground lighting for us ...
|
||||
ssgVertexArray *light_pts = new ssgVertexArray( 100 );
|
||||
|
||||
ssgBranch* new_tile = new ssgBranch;
|
||||
|
||||
unsigned int i = 0;
|
||||
while ( i < search.size() && !found_tile_base ) {
|
||||
|
||||
// Generate names for later use
|
||||
string index_str = tile_bucket.gen_index_str();
|
||||
|
||||
SGPath tile_path = base;
|
||||
SGPath tile_path = search[i];
|
||||
tile_path.append( tile_bucket.gen_base_path() );
|
||||
|
||||
SGPath basename = tile_path;
|
||||
|
@ -593,11 +595,6 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
|
||||
#define FG_MAX_LIGHTS 1000
|
||||
|
||||
// obj_load() will generate ground lighting for us ...
|
||||
ssgVertexArray *light_pts = new ssgVertexArray( 100 );
|
||||
|
||||
ssgBranch* new_tile = new ssgBranch;
|
||||
|
||||
// Check for master .stg (scene terra gear) file
|
||||
SGPath stg_name = basename;
|
||||
stg_name.concat( ".stg" );
|
||||
|
@ -615,6 +612,8 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
|
||||
<< " name = " << name );
|
||||
|
||||
found_tile_base = true;
|
||||
|
||||
SGPath custom_path = tile_path;
|
||||
custom_path.append( name );
|
||||
|
||||
|
@ -676,8 +675,9 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
// object loading is deferred to main render thread,
|
||||
// but lets figure out the paths right now.
|
||||
SGPath custom_path;
|
||||
if ( token == "OBJECT_STATIC" )
|
||||
if ( token == "OBJECT_STATIC" ) {
|
||||
custom_path= tile_path;
|
||||
}
|
||||
custom_path.append( name );
|
||||
|
||||
sgCoord obj_pos;
|
||||
|
@ -694,7 +694,8 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
|
||||
// push an entry onto the model load queue
|
||||
FGDeferredModel *dm
|
||||
= new FGDeferredModel( custom_path.str(), tile_path.str(),
|
||||
= new FGDeferredModel( custom_path.str(),
|
||||
tile_path.str(),
|
||||
this, obj_trans );
|
||||
FGTileMgr::model_ready( dm );
|
||||
} else if ( token == "OBJECT_TAXI_SIGN" ) {
|
||||
|
@ -773,14 +774,20 @@ FGTileEntry::load( const SGPath& base, bool is_base )
|
|||
in >> ::skipws;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no .stg file, generate an ocean tile on the fly for this
|
||||
// area
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( !found_tile_base ) {
|
||||
// no tile base found, generate an ocean tile on the fly for
|
||||
// this area
|
||||
ssgBranch *geometry = new ssgBranch;
|
||||
Point3D c;
|
||||
double br;
|
||||
if ( sgGenTile( basename.str(), tile_bucket, &c, &br,
|
||||
globals->get_matlib(), geometry ) ) {
|
||||
if ( sgGenTile( search[0], tile_bucket, &c, &br,
|
||||
globals->get_matlib(), geometry ) )
|
||||
{
|
||||
center = c;
|
||||
bounding_radius = br;
|
||||
new_tile -> addKid( geometry );
|
||||
|
|
|
@ -212,7 +212,7 @@ public:
|
|||
* @param base name of directory containing tile data file.
|
||||
* @param is_base is this a base terrain object for which we should generate
|
||||
* random ground light points */
|
||||
void load( const SGPath& base, bool is_base );
|
||||
void load( const string &base_path, bool is_base );
|
||||
|
||||
/**
|
||||
* Return true if the tile entry is loaded, otherwise return false
|
||||
|
|
Loading…
Reference in a new issue