- FGPath tile_base = tile_path;
- tile_base.append( b.gen_index_str() );
- ssgBranch *new_tile = fgObjLoad( tile_base.str(), e, light_pts, true );
-
- if ( new_tile != NULL ) {
- e->terra_range->addKid( new_tile );
- }
-
- // load custom objects
- FG_LOG( FG_TERRAIN, FG_DEBUG, "CUSTOM OBJECTS" );
-
- FGPath index_path = tile_path;
- index_path.append( b.gen_index_str() );
- index_path.concat( ".ind" );
-
- FG_LOG( FG_TERRAIN, FG_DEBUG, "Looking in " << index_path.str() );
-
- fg_gzifstream in( index_path.str() );
-
- if ( in.is_open() ) {
- string token, name;
-
- while ( ! in.eof() ) {
- in >> token;
- in >> name;
-#if defined ( macintosh ) || defined ( _MSC_VER )
- in >> ::skipws;
-#else
- in >> skipws;
-#endif
- FG_LOG( FG_TERRAIN, FG_DEBUG, "token = " << token
- << " name = " << name );
-
- FGPath custom_path = tile_path;
- custom_path.append( name );
- ssgBranch *custom_obj =
- fgObjLoad( custom_path.str(), e, NULL, false );
- if ( (new_tile != NULL) && (custom_obj != NULL) ) {
- new_tile -> addKid( custom_obj );
- }
- }
- }
-
- e->terra_transform->addKid( e->terra_range );
-
- // calculate initial tile offset
- e->SetOffset( scenery.center );
- sgCoord sgcoord;
- sgSetCoord( &sgcoord,
- e->offset.x(), e->offset.y(), e->offset.z(),
- 0.0, 0.0, 0.0 );
- e->terra_transform->setTransform( &sgcoord );
- terrain->addKid( e->terra_transform );
-
- e->lights_transform = NULL;
- e->lights_range = NULL;
- /* uncomment this section for testing ground lights */
- if ( light_pts->getNum() ) {
- FG_LOG( FG_TERRAIN, FG_DEBUG, "generating lights" );
- e->lights_transform = new ssgTransform;
- e->lights_range = new ssgRangeSelector;
- e->lights_brightness = new ssgSelector;
- ssgLeaf *lights;
-
- lights = gen_lights( light_pts, 4, 0.7 );
- e->lights_brightness->addKid( lights );
-
- lights = gen_lights( light_pts, 2, 0.85 );
- e->lights_brightness->addKid( lights );
-
- lights = gen_lights( light_pts, 1, 1.0 );
- e->lights_brightness->addKid( lights );
-
- e->lights_range->addKid( e->lights_brightness );
- e->lights_transform->addKid( e->lights_range );
- e->lights_transform->setTransform( &sgcoord );
- ground->addKid( e->lights_transform );
- }
- /* end of ground light section */