// ssg variables
ssgRoot *scene = NULL;
-ssgBranch *terrain = NULL;
+ssgBranch *terrain_branch = NULL;
+ssgBranch *gnd_lights_branch = NULL;
+ssgBranch *rwy_lights_branch = NULL;
ssgRoot *lighting = NULL;
-ssgBranch *ground = NULL;
-ssgBranch *airport = NULL;
+// ssgBranch *airport = NULL;
#ifdef FG_NETWORK_OLK
ssgSelector *fgd_sel = NULL;
globals->set_mag( magvar );
// Terrain branch
- terrain = new ssgBranch;
- terrain->setName( "Terrain" );
- scene->addKid( terrain );
+ terrain_branch = new ssgBranch;
+ terrain_branch->setName( "Terrain" );
+ scene->addKid( terrain_branch );
// Lighting
- ground = new ssgBranch;
- ground->setName( "Ground Lighting" );
- lighting->addKid( ground );
+ gnd_lights_branch = new ssgBranch;
+ gnd_lights_branch->setName( "Ground Lighting" );
+ lighting->addKid( gnd_lights_branch );
- airport = new ssgBranch;
- airport->setName( "Airport Lighting" );
- lighting->addKid( airport );
+ rwy_lights_branch = new ssgBranch;
+ rwy_lights_branch->setName( "Runway Lighting" );
+ lighting->addKid( rwy_lights_branch );
+
+ // airport = new ssgBranch;
+ // airport->setName( "Airport Lighting" );
+ // lighting->addKid( airport );
// ADA
fgLoadDCS();
//dummy_tile->lightmaps_sequence->setTraversalMaskBits( SSGTRAV_HOT );
lightpoints_transform->addKid( dummy_tile->lightmaps_sequence );
lightpoints_transform->ref();
- ground->addKid( lightpoints_transform );
+ gnd_lights_branch->addKid( lightpoints_transform );
}
} //if in1
} //if objc
SG_LOG ( SG_TERRAIN, SG_ALERT, "Finished object processing." );
- terrain->addKid( ship_sel ); //add selector node to root node
+ terrain_branch->addKid( ship_sel ); //add selector node to root node
}
return;
point_list normals = obj.get_normals();
point_list texcoords = obj.get_texcoords();
- string material;
+ string material, tmp_mat;
int_list vertex_index;
int_list tex_index;
int i;
+ bool is_lighting = false;
// generate points
string_list pt_materials = obj.get_pt_materials();
group_list pts_v = obj.get_pts_v();
for ( i = 0; i < (int)pts_v.size(); ++i ) {
cout << "pts_v.size() = " << pts_v.size() << endl;
- material = pt_materials[i];
+ tmp_mat = pt_materials[i];
+ if ( tmp_mat.substr(0, 3) == "RWY" ) {
+ material = "LIGHTS";
+ is_lighting = true;
+ } else {
+ material = tmp_mat;
+ }
vertex_index = pts_v[i];
tex_index.clear();
ssgLeaf *leaf = gen_leaf( path, GL_POINTS, material,
vertex_index, tex_index,
false, ground_lights );
- geometry->addKid( leaf );
+ if ( is_lighting ) {
+ rwy_lights->addKid( leaf );
+ } else {
+ geometry->addKid( leaf );
+ }
}
// generate triangles
#include "hitlist.hxx"
-extern ssgBranch *terrain;
+extern ssgBranch *terrain_branch;
#if 0
// check to see if the intersection point is
sgdCopyVec3(orig, view_pos );
sgdCopyVec3(dir, abs_view_pos );
- hit_list->Intersect( terrain, orig, dir );
+ hit_list->Intersect( terrain_branch, orig, dir );
int this_hit=0;
Point3D geoc;
// Clear all completely loaded tiles (ignores partially loaded tiles)
void FGNewCache::clear_cache() {
// This is a hack that should really get cleaned up at some point
- extern ssgBranch *terrain;
+ extern ssgBranch *terrain_branch;
tile_map_iterator current = tile_cache.begin();
tile_map_iterator end = tile_cache.end();
}
// and ... just in case we missed something ...
- terrain->removeAllKids();
+ terrain_branch->removeAllKids();
}
ssgBranch* new_tile = new ssgBranch;
+ // runway lights
+ rwy_lights_transform = NULL;
+ rwy_lights_range = NULL;
+
// Check for master .stg (scene terra gear) file
SGPath stg_name = basename;
stg_name.concat( ".stg" );
void
-FGTileEntry::add_ssg_nodes( ssgBranch* terrain, ssgBranch* ground )
+FGTileEntry::add_ssg_nodes( ssgBranch* terrain_branch,
+ ssgBranch* gnd_lights_branch,
+ ssgBranch* rwy_lights_branch )
{
// bump up the ref count so we can remove this later without
// having ssg try to free the memory.
terra_transform->ref();
- terrain->addKid( terra_transform );
+ terrain_branch->addKid( terra_transform );
SG_LOG( SG_TERRAIN, SG_DEBUG,
"connected a tile into scene graph. terra_transform = "
SG_LOG( SG_TERRAIN, SG_DEBUG, "num parents now = "
<< terra_transform->getNumParents() );
- if ( gnd_lights_transform != 0 ) {
+ if ( gnd_lights_transform != NULL ) {
// bump up the ref count so we can remove this later without
// having ssg try to free the memory.
gnd_lights_transform->ref();
- ground->addKid( gnd_lights_transform );
+ gnd_lights_branch->addKid( gnd_lights_transform );
+ }
+
+ if ( rwy_lights_transform != NULL ) {
+ // bump up the ref count so we can remove this later without
+ // having ssg try to free the memory.
+ rwy_lights_transform->ref();
+ rwy_lights_branch->addKid( rwy_lights_transform );
}
// ADA
// bump up the ref count so we can remove this later without
// having ssg try to free the memory.
lightmaps_transform->ref();
- ground->addKid( lightmaps_transform );
+ gnd_lights_branch->addKid( lightmaps_transform );
}
// ADA
/**
* Add terrain mesh and ground lighting to scene graph.
*/
- void add_ssg_nodes( ssgBranch* terrain, ssgBranch* ground );
+ void add_ssg_nodes( ssgBranch* terrain_branch,
+ ssgBranch* gnd_lights_branch,
+ ssgBranch* rwy_lights_branch );
/**
* disconnect terrain mesh and ground lighting nodes from scene
#define TEST_LAST_HIT_CACHE
extern ssgRoot *scene;
-extern ssgBranch *terrain;
-extern ssgBranch *ground;
+extern ssgBranch *terrain_branch; // branch that holds world geometry
+extern ssgBranch *gnd_lights_branch; // branch that holds ground lighting
+extern ssgBranch *rwy_lights_branch; // branch that holds runway lighting
// the tile manager
FGTileMgr global_tile_mgr;
FGTileEntry* e = attach_queue.front();
attach_queue.pop();
#endif
- e->add_ssg_nodes( terrain, ground );
+ e->add_ssg_nodes( terrain_branch,
+ gnd_lights_branch,
+ rwy_lights_branch );
// cout << "Adding ssg nodes for "
}