{
void GlobalParticleCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
+ enabled = !enabledNode || enabledNode->getBoolValue();
+ if (!enabled)
+ return;
SGQuatd q
= SGQuatd::fromLonLatDeg(modelRoot->getFloatValue("/position/longitude-deg",0),
modelRoot->getFloatValue("/position/latitude-deg",0));
//static members
osg::Vec3 GlobalParticleCallback::gravity;
osg::Vec3 GlobalParticleCallback::wind;
+bool GlobalParticleCallback::enabled = true;
+SGConstPropertyNode_ptr GlobalParticleCallback::enabledNode = 0;
osg::ref_ptr<osg::Group> Particles::commonRoot;
osg::ref_ptr<osgParticle::ParticleSystemUpdater> Particles::psu = new osgParticle::ParticleSystemUpdater;
else if (counterCond)
counter->setRateRange(counterStaticValue,
counterStaticValue + counterStaticExtraRange);
- if (counterCond && !counterCond->test())
+ if (!GlobalParticleCallback::getEnabled() || (counterCond && !counterCond->test()))
counter->setRateRange(0, 0);
bool colorchange=false;
for (int i = 0; i < 8; ++i) {
return wind;
}
+ static void setSwitch(const SGPropertyNode* n)
+ {
+ enabledNode = n;
+ }
+
+ static bool getEnabled()
+ {
+ return enabled;
+ }
+
private:
static osg::Vec3 gravity;
static osg::Vec3 wind;
const SGPropertyNode* modelRoot;
+ static SGConstPropertyNode_ptr enabledNode;
+ static bool enabled;
};