// particles.cxx - classes to manage particles
-// started in 2008 by Tiago Gusmão, using animation.hxx as reference
-// Copyright (C) 2008 Tiago Gusmão
+// started in 2008 by Tiago Gusm�o, using animation.hxx as reference
+// Copyright (C) 2008 Tiago Gusm�o
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
#include "particles.hxx"
-#if SG_OSG_VERSION >= 27004
-#define OSG_PARTICLE_FIX 1
-#endif
-
namespace simgear
{
void GlobalParticleCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
osg::ref_ptr<osg::Group> Particles::commonRoot;
osg::ref_ptr<osgParticle::ParticleSystemUpdater> Particles::psu = new osgParticle::ParticleSystemUpdater;
-osg::ref_ptr<osg::Geode> Particles::commonGeode = new osg::Geode;;
+osg::ref_ptr<osg::Geode> Particles::commonGeode = new osg::Geode;
osg::Vec3 Particles::_wind;
bool Particles::_frozen = false;
commonGeode.get()->setName("common particle system geode");
commonRoot.get()->addChild(commonGeode.get());
commonRoot.get()->addChild(psu.get());
+ commonRoot->setNodeMask( ~simgear::MODELLIGHT_BIT );
}
return commonRoot.get();
}
osg::Geode* g = new osg::Geode;
align->addChild(g);
g->addDrawable(particleSys);
-#ifndef OSG_PARTICLE_FIX
- emitter->setReferenceFrame(osgParticle::Emitter::ABSOLUTE_RF);
-#endif
} else {
-#ifdef OSG_PARTICLE_FIX
callback()->particleFrame = new osg::MatrixTransform();
osg::Geode* g = new osg::Geode;
g->addDrawable(particleSys);
callback()->particleFrame->addChild(g);
getCommonRoot()->addChild(callback()->particleFrame.get());
-#else
- getCommonGeode()->addDrawable(particleSys);
-#endif
}
std::string textureFile;
if (configNode->hasValue("texture")) {
program->setFluidToWater();
if (programnode->getBoolValue("gravity", true)) {
-#ifdef OSG_PARTICLE_FIX
program->setToGravity();
-#else
- if (attach == "world")
- callback()->setupProgramGravity(true);
- else
- program->setToGravity();
-#endif
} else
program->setAcceleration(osg::Vec3(0,0,0));
particleSys->getDefaultParticleTemplate().setSizeRange(osgParticle::rangef(startSize, endSize));
if (lifeValue)
particleSys->getDefaultParticleTemplate().setLifeTime(lifeValue->getValue());
-#ifdef OSG_PARTICLE_FIX
+
if (particleFrame.valid()) {
MatrixList mlist = node->getWorldMatrices();
if (!mlist.empty()) {
}
if (program.valid() && useWind)
program->setWind(_wind);
-#else
- if (program.valid()) {
- if (useGravity)
- program->setAcceleration(GlobalParticleCallback::getGravityVector());
- if (useWind)
- program->setWind(GlobalParticleCallback::getWindVector());
- }
-#endif
}
} // namespace simgear