diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index b2639671d..61d342588 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -742,14 +742,6 @@ void fgCreateSubsystems(bool duringReset) { globals->add_subsystem( "http", new FGHTTPClient ); } - //////////////////////////////////////////////////////////////////// - // Initialize the scenery management subsystem. - //////////////////////////////////////////////////////////////////// - - globals->get_scenery()->get_scene_graph() - ->addChild(simgear::Particles::getCommonRoot()); - simgear::GlobalParticleCallback::setSwitch(fgGetNode("/sim/rendering/particles", true)); - //////////////////////////////////////////////////////////////////// // Initialize the flight model subsystem. //////////////////////////////////////////////////////////////////// diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index f160b4267..8ec3e5703 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -327,6 +327,12 @@ void FGScenery::init() { interiorLOD->addChild(interior_branch.get(), 0.0, 50.0); aircraft_branch->addChild( interiorLOD ); + // Set up the particle system as a directly accessible branch of the scene graph. + particles_branch = simgear::Particles::getCommonRoot(); + particles_branch->setName("Particles"); + scene_graph->addChild(particles_branch.get()); + simgear::GlobalParticleCallback::setSwitch(fgGetNode("/sim/rendering/particles", true)); + // Initials values needed by the draw-time object loader sgUserDataInit( globals->get_props() ); @@ -341,6 +347,7 @@ void FGScenery::shutdown() terrain_branch = NULL; models_branch = NULL; aircraft_branch = NULL; + particles_branch = NULL; } diff --git a/src/Scenery/scenery.hxx b/src/Scenery/scenery.hxx index cc659882c..593707d14 100644 --- a/src/Scenery/scenery.hxx +++ b/src/Scenery/scenery.hxx @@ -34,6 +34,7 @@ #include #include +#include #include #include "SceneryPager.hxx" @@ -55,6 +56,7 @@ class FGScenery : public SGSubsystem osg::ref_ptr models_branch; osg::ref_ptr aircraft_branch; osg::ref_ptr interior_branch; + osg::ref_ptr particles_branch; osg::ref_ptr _pager; ScenerySwitchListener* _listener; @@ -114,6 +116,7 @@ public: osg::Group *get_models_branch () const { return models_branch.get(); } osg::Group *get_aircraft_branch () const { return aircraft_branch.get(); } osg::Group *get_interior_branch () const { return interior_branch.get(); } + osg::Group *get_particles_branch () const { return particles_branch.get(); } /// Returns true if scenery is available for the given lat, lon position /// within a range of range_m.