Fix for the particle system.
The problem was that the change to make FGScenery a standard subsystem caused the particle OSG group to no longer be inserted into the scene graph. The solution was to convert the particle group to be set up as a standard branch of the scene graph, alongside the terrain, models, aircraft, and interior branches. The particle system is now set up as part of the init() subsystem function call, so it is compatible with the new subsystem design.
This commit is contained in:
parent
34daa4de0b
commit
97f8cdaaea
3 changed files with 10 additions and 8 deletions
|
@ -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.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/scene/model/particles.hxx>
|
||||
#include <simgear/structure/subsystem_mgr.hxx>
|
||||
|
||||
#include "SceneryPager.hxx"
|
||||
|
@ -55,6 +56,7 @@ class FGScenery : public SGSubsystem
|
|||
osg::ref_ptr<osg::Group> models_branch;
|
||||
osg::ref_ptr<osg::Group> aircraft_branch;
|
||||
osg::ref_ptr<osg::Group> interior_branch;
|
||||
osg::ref_ptr<osg::Group> particles_branch;
|
||||
|
||||
osg::ref_ptr<flightgear::SceneryPager> _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.
|
||||
|
|
Loading…
Reference in a new issue