Fix MWRender::Mask_ParticleSystem

openmw-37
scrawl 9 years ago
parent 637cd3a628
commit 91583fc027

@ -137,6 +137,8 @@ namespace MWRender
, mUnderwaterIndoorFog(fallback->getFallbackFloat("Water_UnderwaterIndoorFog"))
, mNightEyeFactor(0.f)
{
resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem);
osg::ref_ptr<SceneUtil::LightManager> lightRoot = new SceneUtil::LightManager;
mLightRoot = lightRoot;
lightRoot->setStartLight(1);

@ -25,8 +25,10 @@ namespace
class InitWorldSpaceParticlesVisitor : public osg::NodeVisitor
{
public:
InitWorldSpaceParticlesVisitor()
/// @param mask The node mask to set on ParticleSystem nodes.
InitWorldSpaceParticlesVisitor(unsigned int mask)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mMask(mask)
{
}
@ -47,7 +49,7 @@ namespace
if (geode->getNumParents() && geode->getParent(0)->getNumParents())
transformInitialParticles(partsys, geode->getParent(0)->getParent(0));
}
geode->setNodeMask((1<<10)); //MWRender::Mask_ParticleSystem
geode->setNodeMask(mMask);
}
}
}
@ -74,8 +76,9 @@ namespace
box.expandBy(sphere);
partsys->setInitialBound(box);
}
private:
unsigned int mMask;
};
}
namespace Resource
@ -84,6 +87,7 @@ namespace Resource
SceneManager::SceneManager(const VFS::Manager *vfs, Resource::TextureManager* textureManager)
: mVFS(vfs)
, mTextureManager(textureManager)
, mParticleSystemMask(~0u)
{
}
@ -183,7 +187,7 @@ namespace Resource
void SceneManager::notifyAttached(osg::Node *node) const
{
InitWorldSpaceParticlesVisitor visitor;
InitWorldSpaceParticlesVisitor visitor (mParticleSystemMask);
node->accept(visitor);
}
@ -197,4 +201,9 @@ namespace Resource
return mTextureManager;
}
void SceneManager::setParticleSystemMask(unsigned int mask)
{
mParticleSystemMask = mask;
}
}

@ -73,12 +73,17 @@ namespace Resource
Resource::TextureManager* getTextureManager();
/// @param mask The node mask to apply to loaded particle system nodes.
void setParticleSystemMask(unsigned int mask);
private:
const VFS::Manager* mVFS;
Resource::TextureManager* mTextureManager;
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
unsigned int mParticleSystemMask;
// observer_ptr?
typedef std::map<std::string, osg::ref_ptr<const osg::Node> > Index;
Index mIndex;

Loading…
Cancel
Save