From dcf07a46aac37acd08ea9147cff27c229ec56991 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 27 Mar 2010 10:58:33 +0000 Subject: [PATCH] Allow particles to be frozen on pause. --- simgear/scene/model/particles.cxx | 3 +++ simgear/scene/model/particles.hxx | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/simgear/scene/model/particles.cxx b/simgear/scene/model/particles.cxx index b5687ed4..08037900 100644 --- a/simgear/scene/model/particles.cxx +++ b/simgear/scene/model/particles.cxx @@ -80,6 +80,7 @@ osg::ref_ptr Particles::commonRoot; osg::ref_ptr Particles::psu = new osgParticle::ParticleSystemUpdater; osg::ref_ptr Particles::commonGeode = new osg::Geode;; osg::Vec3 Particles::_wind; +bool Particles::_frozen = false; Particles::Particles() : useGravity(false), @@ -510,6 +511,8 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode, void Particles::operator()(osg::Node* node, osg::NodeVisitor* nv) { //SG_LOG(SG_GENERAL, SG_ALERT, "callback!\n"); + this->particleSys->setFrozen(_frozen); + using namespace osg; if (shooterValue) shooter->setInitialSpeedRange(shooterValue->getValue(), diff --git a/simgear/scene/model/particles.hxx b/simgear/scene/model/particles.hxx index b01b190a..6dda343d 100644 --- a/simgear/scene/model/particles.hxx +++ b/simgear/scene/model/particles.hxx @@ -75,7 +75,7 @@ public: } virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); - + static const osg::Vec3 &getGravityVector() { return gravity; @@ -249,6 +249,8 @@ public: return psu.get(); } + static void setFrozen(bool e) { _frozen = e; } + /** * Set and get the wind vector for particles in the * atmosphere. This vector is in the Z-up Y-north frame, and the @@ -279,6 +281,7 @@ protected: bool useGravity; bool useWind; + static bool _frozen; static osg::ref_ptr psu; static osg::ref_ptr commonRoot; static osg::ref_ptr commonGeode; -- 2.39.5