mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
RemoveParticlesVisitor fix
This commit is contained in:
parent
6199c0bbc5
commit
7b35882814
1 changed files with 15 additions and 1 deletions
|
@ -35,12 +35,26 @@ namespace
|
|||
|
||||
virtual void apply(osg::Node &node)
|
||||
{
|
||||
if (dynamic_cast<osgParticle::ParticleSystem*>(&node) || dynamic_cast<osgParticle::ParticleProcessor*>(&node))
|
||||
if (dynamic_cast<osgParticle::ParticleProcessor*>(&node))
|
||||
mToRemove.push_back(&node);
|
||||
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
virtual void apply(osg::Geode& geode)
|
||||
{
|
||||
std::vector<osgParticle::ParticleSystem*> partsysVector;
|
||||
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
||||
{
|
||||
osg::Drawable* drw = geode.getDrawable(i);
|
||||
if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(drw))
|
||||
partsysVector.push_back(partsys);
|
||||
}
|
||||
|
||||
for (std::vector<osgParticle::ParticleSystem*>::iterator it = partsysVector.begin(); it != partsysVector.end(); ++it)
|
||||
geode.removeDrawable(*it);
|
||||
}
|
||||
|
||||
void remove()
|
||||
{
|
||||
for (std::vector<osg::ref_ptr<osg::Node> >::iterator it = mToRemove.begin(); it != mToRemove.end(); ++it)
|
||||
|
|
Loading…
Reference in a new issue