mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 09:39:42 +00:00
Fix MWRender::Mask_ParticleSystem
This commit is contained in:
parent
637cd3a628
commit
91583fc027
3 changed files with 20 additions and 4 deletions
|
@ -137,6 +137,8 @@ namespace MWRender
|
||||||
, mUnderwaterIndoorFog(fallback->getFallbackFloat("Water_UnderwaterIndoorFog"))
|
, mUnderwaterIndoorFog(fallback->getFallbackFloat("Water_UnderwaterIndoorFog"))
|
||||||
, mNightEyeFactor(0.f)
|
, mNightEyeFactor(0.f)
|
||||||
{
|
{
|
||||||
|
resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem);
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::LightManager> lightRoot = new SceneUtil::LightManager;
|
osg::ref_ptr<SceneUtil::LightManager> lightRoot = new SceneUtil::LightManager;
|
||||||
mLightRoot = lightRoot;
|
mLightRoot = lightRoot;
|
||||||
lightRoot->setStartLight(1);
|
lightRoot->setStartLight(1);
|
||||||
|
|
|
@ -25,8 +25,10 @@ namespace
|
||||||
class InitWorldSpaceParticlesVisitor : public osg::NodeVisitor
|
class InitWorldSpaceParticlesVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InitWorldSpaceParticlesVisitor()
|
/// @param mask The node mask to set on ParticleSystem nodes.
|
||||||
|
InitWorldSpaceParticlesVisitor(unsigned int mask)
|
||||||
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
||||||
|
, mMask(mask)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ namespace
|
||||||
if (geode->getNumParents() && geode->getParent(0)->getNumParents())
|
if (geode->getNumParents() && geode->getParent(0)->getNumParents())
|
||||||
transformInitialParticles(partsys, geode->getParent(0)->getParent(0));
|
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);
|
box.expandBy(sphere);
|
||||||
partsys->setInitialBound(box);
|
partsys->setInitialBound(box);
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
unsigned int mMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Resource
|
namespace Resource
|
||||||
|
@ -84,6 +87,7 @@ namespace Resource
|
||||||
SceneManager::SceneManager(const VFS::Manager *vfs, Resource::TextureManager* textureManager)
|
SceneManager::SceneManager(const VFS::Manager *vfs, Resource::TextureManager* textureManager)
|
||||||
: mVFS(vfs)
|
: mVFS(vfs)
|
||||||
, mTextureManager(textureManager)
|
, mTextureManager(textureManager)
|
||||||
|
, mParticleSystemMask(~0u)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +187,7 @@ namespace Resource
|
||||||
|
|
||||||
void SceneManager::notifyAttached(osg::Node *node) const
|
void SceneManager::notifyAttached(osg::Node *node) const
|
||||||
{
|
{
|
||||||
InitWorldSpaceParticlesVisitor visitor;
|
InitWorldSpaceParticlesVisitor visitor (mParticleSystemMask);
|
||||||
node->accept(visitor);
|
node->accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,4 +201,9 @@ namespace Resource
|
||||||
return mTextureManager;
|
return mTextureManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneManager::setParticleSystemMask(unsigned int mask)
|
||||||
|
{
|
||||||
|
mParticleSystemMask = mask;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,12 +73,17 @@ namespace Resource
|
||||||
|
|
||||||
Resource::TextureManager* getTextureManager();
|
Resource::TextureManager* getTextureManager();
|
||||||
|
|
||||||
|
/// @param mask The node mask to apply to loaded particle system nodes.
|
||||||
|
void setParticleSystemMask(unsigned int mask);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
Resource::TextureManager* mTextureManager;
|
Resource::TextureManager* mTextureManager;
|
||||||
|
|
||||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
|
||||||
|
|
||||||
|
unsigned int mParticleSystemMask;
|
||||||
|
|
||||||
// observer_ptr?
|
// observer_ptr?
|
||||||
typedef std::map<std::string, osg::ref_ptr<const osg::Node> > Index;
|
typedef std::map<std::string, osg::ref_ptr<const osg::Node> > Index;
|
||||||
Index mIndex;
|
Index mIndex;
|
||||||
|
|
Loading…
Reference in a new issue