1
0
Fork 0

Moved some scenery component initialization into FGScenery.

This commit is contained in:
curt 2002-05-14 06:08:28 +00:00
parent 92a58f6555
commit 487a14d05b
4 changed files with 43 additions and 38 deletions

View file

@ -745,9 +745,6 @@ bool fgInitSubsystems( void ) {
// 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");

View file

@ -195,9 +195,6 @@ static GLfloat fog_exp_density;
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;
@ -378,7 +375,7 @@ void trRenderFrame( void ) {
// 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 );
@ -687,7 +684,7 @@ void fgRenderFrame() {
#endif
ssgSetNearFar( scene_nearplane, scene_farplane );
ssgCullAndDraw( lighting );
ssgCullAndDraw( globals->get_scenery()->get_lighting() );
#ifdef FG_EXPERIMENTAL_LIGHTING
@ -1454,35 +1451,8 @@ int mainLoop( int argc, char **argv ) {
// 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.

View file

@ -50,21 +50,54 @@ FGScenery::FGScenery() {
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");
}

View file

@ -68,6 +68,8 @@ class FGScenery : public FGSubsystem {
ssgBranch * models_branch;
ssgBranch * aircraft_branch;
ssgRoot *lighting;
public:
FGScenery();
@ -124,6 +126,9 @@ public:
inline void set_aircraft_branch (ssgBranch * t) {
aircraft_branch = t;
}
inline ssgRoot * get_lighting () const { return lighting; }
inline void set_lighting (ssgRoot *l) { lighting = l; }
};