1
0
Fork 0

Use new thread-safe particles manager.

Requires corresponding SG commit
This commit is contained in:
James Turner 2020-08-16 12:32:06 +01:00
parent 2295e82a0f
commit 86f6b94300
4 changed files with 9 additions and 6 deletions

View file

@ -266,8 +266,9 @@ FGEnvironmentMgr::update (double dt)
SGGeod aircraftPos(globals->get_aircraft_position()); SGGeod aircraftPos(globals->get_aircraft_position());
_environment->set_elevation_ft( aircraftPos.getElevationFt() ); _environment->set_elevation_ft( aircraftPos.getElevationFt() );
simgear::Particles::setWindFrom( _environment->get_wind_from_heading_deg(), auto particlesManager = simgear::ParticlesGlobalManager::instance();
_environment->get_wind_speed_kt() ); particlesManager->setWindFrom(_environment->get_wind_from_heading_deg(),
_environment->get_wind_speed_kt());
if( _cloudLayersDirty ) { if( _cloudLayersDirty ) {
_cloudLayersDirty = false; _cloudLayersDirty = false;
fgClouds->set_update_event( fgClouds->get_update_event()+1 ); fgClouds->set_update_event( fgClouds->get_update_event()+1 );

View file

@ -1309,7 +1309,7 @@ void fgStartNewReset()
simgear::clearSharedTreeGeometry(); simgear::clearSharedTreeGeometry();
simgear::clearEffectCache(); simgear::clearEffectCache();
simgear::SGModelLib::resetPropertyRoot(); simgear::SGModelLib::resetPropertyRoot();
simgear::GlobalParticleCallback::setSwitch(NULL); simgear::ParticlesGlobalManager::clear();
simgear::UniformFactory::instance()->reset(); simgear::UniformFactory::instance()->reset();
flightgear::addons::AddonManager::reset(); flightgear::addons::AddonManager::reset();

View file

@ -229,7 +229,8 @@ setFreeze (bool f)
frozen = f; frozen = f;
// Pause the particle system // Pause the particle system
simgear::Particles::setFrozen(f); auto p = simgear::ParticlesGlobalManager::instance();
p->setFrozen(f);
} }

View file

@ -391,10 +391,11 @@ void FGScenery::init() {
aircraft_branch->addChild( interiorLOD ); aircraft_branch->addChild( interiorLOD );
// Set up the particle system as a directly accessible branch of the scene graph. // Set up the particle system as a directly accessible branch of the scene graph.
particles_branch = simgear::Particles::getCommonRoot(); auto paricles = simgear::ParticlesGlobalManager::instance();
particles_branch = paricles->getCommonRoot();
particles_branch->setName("Particles"); particles_branch->setName("Particles");
scene_graph->addChild(particles_branch.get()); scene_graph->addChild(particles_branch.get());
simgear::GlobalParticleCallback::setSwitch(fgGetNode("/sim/rendering/particles", true)); paricles->setSwitchNode(fgGetNode("/sim/rendering/particles", true));
// Set up the precipitation system. // Set up the precipitation system.
precipitation_branch = new osg::Group; precipitation_branch = new osg::Group;