- while ( ! in.eof() ) {
- in >> token;
-
- if ( token[0] == '#' ) {
- in >> ::skipeol;
- continue;
- }
- // Load only once (first found)
- if ( token == "OBJECT_BASE" ) {
- in >> name >> ::skipws;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " name = " << name );
-
- if (!found_tile_base) {
- found_tile_base = true;
- has_base = true;
-
- SGPath custom_path = tile_path;
- custom_path.append( name );
-
- ssgBranch *geometry = new ssgBranch;
- if ( obj_load( custom_path.str(),
- geometry, NULL, NULL, NULL, light_pts,
- true ) )
- {
- geometry->getKid( 0 )->setTravCallback(
- SSG_CALLBACK_PRETRAV,
- &FGTileMgr::tile_filter_cb );
- new_tile -> addKid( geometry );
- } else {
- delete geometry;
- }
- } else {
- SG_LOG( SG_TERRAIN, SG_INFO, " (skipped)" );
- }
-
- // Load only if base is not in another file
- } else if ( token == "OBJECT" ) {
- if (!found_tile_base || has_base) {
- in >> name >> ::skipws;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " name = " << name );
-
- SGPath custom_path = tile_path;
- custom_path.append( name );
-
- ssgBranch *geometry = new ssgBranch;
- ssgBranch *vasi_lights = new ssgBranch;
- ssgBranch *rwy_lights = new ssgBranch;
- ssgBranch *taxi_lights = new ssgBranch;
- if ( obj_load( custom_path.str(),
- geometry, vasi_lights, rwy_lights,
- taxi_lights, NULL, false ) )
- {
- if ( geometry -> getNumKids() > 0 ) {
- geometry->getKid( 0 )->setTravCallback(
- SSG_CALLBACK_PRETRAV,
- &FGTileMgr::tile_filter_cb );
- new_tile -> addKid( geometry );
- } else {
- delete geometry;
- }
- if ( vasi_lights -> getNumKids() > 0 ) {
- vasi_lights_transform -> addKid( vasi_lights );
- } else {
- delete vasi_lights;
- }
- if ( rwy_lights -> getNumKids() > 0 ) {
- rwy_lights_transform -> addKid( rwy_lights );
- } else {
- delete rwy_lights;
- }
- if ( taxi_lights -> getNumKids() > 0 ) {
- taxi_lights_transform -> addKid( taxi_lights );
- } else {
- delete taxi_lights;
- }
- } else {
- delete geometry;
- delete vasi_lights;
- delete rwy_lights;
- delete taxi_lights;
- }
- }
-
- // Always OK to load
- } else if ( token == "OBJECT_STATIC" ||
- token == "OBJECT_SHARED" ) {
- // load object info
- double lon, lat, elev, hdg;
- in >> name >> lon >> lat >> elev >> hdg >> ::skipws;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " name = " << name
- << " pos = " << lon << ", " << lat
- << " elevation = " << elev
- << " heading = " << hdg );
-
- // object loading is deferred to main render thread,
- // but lets figure out the paths right now.
- SGPath custom_path;
- if ( token == "OBJECT_STATIC" ) {
- custom_path= tile_path;
- } else {
- custom_path = globals->get_fg_root();
- }
- custom_path.append( name );
-
- sgCoord obj_pos;
- WorldCoordinate( &obj_pos, center, lat, lon, elev, hdg );
-
- ssgTransform *obj_trans = new ssgTransform;
- obj_trans->setTransform( &obj_pos );
-
- // wire as much of the scene graph together as we can
- new_tile->addKid( obj_trans );
-
- // bump up the pending models count
- pending_models++;
-
- // push an entry onto the model load queue
- FGDeferredModel *dm
- = new FGDeferredModel( custom_path.str(),
- tile_path.str(),
- tile_bucket,
- this, obj_trans );
- FGTileMgr::model_ready( dm );
-
- // Do we even use this one?
- } else if ( token == "OBJECT_TAXI_SIGN" ) {
- // load object info
- double lon, lat, elev, hdg;
- in >> name >> lon >> lat >> elev >> hdg >> ::skipws;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " name = " << name
- << " pos = " << lon << ", " << lat
- << " elevation = " << elev
- << " heading = " << hdg );
-
- // load the object itself
- SGPath custom_path = tile_path;
- custom_path.append( name );
-
- sgCoord obj_pos;
- WorldCoordinate( &obj_pos, center, lat, lon, elev, hdg );
-
- ssgTransform *obj_trans = new ssgTransform;
- obj_trans->setTransform( &obj_pos );
-
- ssgBranch *custom_obj
- = sgMakeTaxiSign( globals->get_matlib(),
- custom_path.str(), name );
-
- // wire the pieces together
- if ( custom_obj != NULL ) {
- obj_trans -> addKid( custom_obj );
- }
- new_tile->addKid( obj_trans );
-
- // Do we even use this one?
- } else if ( token == "OBJECT_RUNWAY_SIGN" ) {
- // load object info
- double lon, lat, elev, hdg;
- in >> name >> lon >> lat >> elev >> hdg >> ::skipws;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " name = " << name
- << " pos = " << lon << ", " << lat
- << " elevation = " << elev
- << " heading = " << hdg );
-
- // load the object itself
- SGPath custom_path = tile_path;
- custom_path.append( name );
-
- sgCoord obj_pos;
- WorldCoordinate( &obj_pos, center, lat, lon, elev, hdg );
-
- ssgTransform *obj_trans = new ssgTransform;
- obj_trans->setTransform( &obj_pos );
-
- ssgBranch *custom_obj
- = sgMakeRunwaySign( globals->get_matlib(),
- custom_path.str(), name );
-
- // wire the pieces together
- if ( custom_obj != NULL ) {
- obj_trans -> addKid( custom_obj );
- }
- new_tile->addKid( obj_trans );
-
- // I don't think we use this, either
- } else if ( token == "RWY_LIGHTS" ) {
- double lon, lat, hdg, len, width;
- string common, end1, end2;
- in >> lon >> lat >> hdg >> len >> width
- >> common >> end1 >> end2;
- SG_LOG( SG_TERRAIN, SG_INFO, "token = " << token
- << " pos = " << lon << ", " << lat
- << " hdg = " << hdg
- << " size = " << len << ", " << width
- << " codes = " << common << " "
- << end1 << " " << end2 );
- } else {
- SG_LOG( SG_TERRAIN, SG_DEBUG,
- "Unknown token " << token << " in "
- << stg_name.str() );
- in >> ::skipws;