Moved some scenery component initialization into FGScenery.
This commit is contained in:
parent
92a58f6555
commit
487a14d05b
4 changed files with 43 additions and 38 deletions
|
@ -745,9 +745,6 @@ bool fgInitSubsystems( void ) {
|
||||||
// Initialize the scenery management subsystem.
|
// Initialize the scenery management subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
globals->get_scenery()->init();
|
|
||||||
globals->get_scenery()->bind();
|
|
||||||
|
|
||||||
if ( global_tile_mgr.init() ) {
|
if ( global_tile_mgr.init() ) {
|
||||||
// Load the local scenery data
|
// Load the local scenery data
|
||||||
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
double visibility_meters = fgGetDouble("/environment/visibility-m");
|
||||||
|
@ -796,7 +793,7 @@ bool fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the lighting subsystem.
|
// Initialize the lightingsubsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// fgUpdateSunPos() needs a few position and view parameters set
|
// fgUpdateSunPos() needs a few position and view parameters set
|
||||||
|
|
|
@ -195,9 +195,6 @@ static GLfloat fog_exp_density;
|
||||||
static GLfloat fog_exp2_density;
|
static GLfloat fog_exp2_density;
|
||||||
static GLfloat fog_exp2_punch_through;
|
static GLfloat fog_exp2_punch_through;
|
||||||
|
|
||||||
ssgRoot *lighting = NULL;
|
|
||||||
// ssgBranch *airport = NULL;
|
|
||||||
|
|
||||||
#ifdef FG_NETWORK_OLK
|
#ifdef FG_NETWORK_OLK
|
||||||
ssgSelector *fgd_sel = NULL;
|
ssgSelector *fgd_sel = NULL;
|
||||||
ssgTransform *fgd_pos = NULL;
|
ssgTransform *fgd_pos = NULL;
|
||||||
|
@ -378,7 +375,7 @@ void trRenderFrame( void ) {
|
||||||
// draw the lights
|
// draw the lights
|
||||||
glFogf (GL_FOG_DENSITY, fog_exp2_punch_through);
|
glFogf (GL_FOG_DENSITY, fog_exp2_punch_through);
|
||||||
ssgSetNearFar( scene_nearplane, scene_farplane );
|
ssgSetNearFar( scene_nearplane, scene_farplane );
|
||||||
ssgCullAndDraw( lighting );
|
ssgCullAndDraw( globals->get_scenery()->get_lighting() );
|
||||||
|
|
||||||
thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
|
thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
|
||||||
|
|
||||||
|
@ -687,7 +684,7 @@ void fgRenderFrame() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ssgSetNearFar( scene_nearplane, scene_farplane );
|
ssgSetNearFar( scene_nearplane, scene_farplane );
|
||||||
ssgCullAndDraw( lighting );
|
ssgCullAndDraw( globals->get_scenery()->get_lighting() );
|
||||||
|
|
||||||
|
|
||||||
#ifdef FG_EXPERIMENTAL_LIGHTING
|
#ifdef FG_EXPERIMENTAL_LIGHTING
|
||||||
|
@ -1454,35 +1451,8 @@ int mainLoop( int argc, char **argv ) {
|
||||||
|
|
||||||
// Initialize the global scenery manager
|
// Initialize the global scenery manager
|
||||||
globals->set_scenery( new FGScenery );
|
globals->set_scenery( new FGScenery );
|
||||||
|
globals->get_scenery()->init();
|
||||||
// Scene graph root
|
globals->get_scenery()->bind();
|
||||||
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() );
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the general model subsystem.
|
// Initialize the general model subsystem.
|
||||||
|
|
|
@ -50,21 +50,54 @@ FGScenery::FGScenery() {
|
||||||
cur_elev = -9999;
|
cur_elev = -9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialize the Scenery Management system
|
// Initialize the Scenery Management system
|
||||||
FGScenery::~FGScenery() {
|
FGScenery::~FGScenery() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGScenery::init() {
|
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::update(double dt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGScenery::bind() {
|
void FGScenery::bind() {
|
||||||
fgTie("/environment/ground-elevation-m", this,
|
fgTie("/environment/ground-elevation-m", this,
|
||||||
&FGScenery::get_cur_elev, &FGScenery::set_cur_elev);
|
&FGScenery::get_cur_elev, &FGScenery::set_cur_elev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGScenery::unbind() {
|
void FGScenery::unbind() {
|
||||||
fgUntie("/environment/ground-elevation-m");
|
fgUntie("/environment/ground-elevation-m");
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,8 @@ class FGScenery : public FGSubsystem {
|
||||||
ssgBranch * models_branch;
|
ssgBranch * models_branch;
|
||||||
ssgBranch * aircraft_branch;
|
ssgBranch * aircraft_branch;
|
||||||
|
|
||||||
|
ssgRoot *lighting;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGScenery();
|
FGScenery();
|
||||||
|
@ -124,6 +126,9 @@ public:
|
||||||
inline void set_aircraft_branch (ssgBranch * t) {
|
inline void set_aircraft_branch (ssgBranch * t) {
|
||||||
aircraft_branch = t;
|
aircraft_branch = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline ssgRoot * get_lighting () const { return lighting; }
|
||||||
|
inline void set_lighting (ssgRoot *l) { lighting = l; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue