// Initialize the scenery management subsystem.
////////////////////////////////////////////////////////////////////
- globals->get_scenery()->init();
- globals->get_scenery()->bind();
-
if ( global_tile_mgr.init() ) {
// Load the local scenery data
double visibility_meters = fgGetDouble("/environment/visibility-m");
////////////////////////////////////////////////////////////////////
- // Initialize the lighting subsystem.
+ // Initialize the lightingsubsystem.
////////////////////////////////////////////////////////////////////
// fgUpdateSunPos() needs a few position and view parameters set
static GLfloat fog_exp2_density;
static GLfloat fog_exp2_punch_through;
-ssgRoot *lighting = NULL;
-// ssgBranch *airport = NULL;
-
#ifdef FG_NETWORK_OLK
ssgSelector *fgd_sel = NULL;
ssgTransform *fgd_pos = NULL;
// draw the lights
glFogf (GL_FOG_DENSITY, fog_exp2_punch_through);
ssgSetNearFar( scene_nearplane, scene_farplane );
- ssgCullAndDraw( lighting );
+ ssgCullAndDraw( globals->get_scenery()->get_lighting() );
thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
#endif
ssgSetNearFar( scene_nearplane, scene_farplane );
- ssgCullAndDraw( lighting );
+ ssgCullAndDraw( globals->get_scenery()->get_lighting() );
#ifdef FG_EXPERIMENTAL_LIGHTING
// Initialize the global scenery manager
globals->set_scenery( new FGScenery );
-
- // Scene graph root
- globals->get_scenery()->set_scene_graph(new ssgRoot);
- globals->get_scenery()->get_scene_graph()->setName( "Scene" );
-
- lighting = new ssgRoot;
- lighting->setName( "Lighting" );
-
- // Terrain branch
- globals->get_scenery()->set_terrain_branch(new ssgBranch);
- globals->get_scenery()->get_terrain_branch()->setName( "Terrain" );
- globals->get_scenery()->get_scene_graph()->addKid( globals->get_scenery()->get_terrain_branch() );
-
- globals->get_scenery()->set_models_branch(new ssgBranch);
- globals->get_scenery()->get_models_branch()->setName( "Models" );
- globals->get_scenery()->get_scene_graph()->addKid( globals->get_scenery()->get_models_branch() );
-
- globals->get_scenery()->set_aircraft_branch(new ssgBranch);
- globals->get_scenery()->get_aircraft_branch()->setName( "Aircraft" );
- globals->get_scenery()->get_scene_graph()->addKid( globals->get_scenery()->get_aircraft_branch() );
-
- // Lighting
- globals->get_scenery()->set_gnd_lights_branch(new ssgBranch);
- globals->get_scenery()->get_gnd_lights_branch()->setName( "Ground Lighting" );
- lighting->addKid( globals->get_scenery()->get_gnd_lights_branch() );
-
- globals->get_scenery()->set_rwy_lights_branch(new ssgBranch);
- globals->get_scenery()->get_rwy_lights_branch()->setName( "Runway Lighting" );
- lighting->addKid( globals->get_scenery()->get_rwy_lights_branch() );
+ globals->get_scenery()->init();
+ globals->get_scenery()->bind();
////////////////////////////////////////////////////////////////////
// Initialize the general model subsystem.
cur_elev = -9999;
}
+
// Initialize the Scenery Management system
FGScenery::~FGScenery() {
}
+
void FGScenery::init() {
+ // Scene graph root
+ scene_graph = new ssgRoot;
+ scene_graph->setName( "Scene" );
+
+ lighting = new ssgRoot;
+ lighting->setName( "Lighting" );
+
+ // Terrain branch
+ terrain_branch = new ssgBranch;
+ terrain_branch->setName( "Terrain" );
+ scene_graph->addKid( terrain_branch );
+
+ models_branch = new ssgBranch;
+ models_branch->setName( "Models" );
+ scene_graph->addKid( models_branch );
+
+ aircraft_branch = new ssgBranch;
+ aircraft_branch->setName( "Aircraft" );
+ scene_graph->addKid( aircraft_branch );
+
+ // Lighting
+ gnd_lights_branch = new ssgBranch;
+ gnd_lights_branch->setName( "Ground Lighting" );
+ lighting->addKid( gnd_lights_branch );
+
+ rwy_lights_branch = new ssgBranch;
+ rwy_lights_branch->setName( "Runway Lighting" );
+ lighting->addKid( rwy_lights_branch );
}
+
void FGScenery::update(double dt) {
}
+
void FGScenery::bind() {
fgTie("/environment/ground-elevation-m", this,
&FGScenery::get_cur_elev, &FGScenery::set_cur_elev);
}
+
void FGScenery::unbind() {
fgUntie("/environment/ground-elevation-m");
}