mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 15:39:41 +00:00
Merge branch 'ripple_fix' into 'master'
Restore ripples with soft particles See merge request OpenMW/openmw!1566
This commit is contained in:
commit
6eb36c6b76
3 changed files with 5 additions and 3 deletions
|
@ -109,7 +109,7 @@ RippleSimulation::RippleSimulation(osg::Group *parent, Resource::ResourceSystem*
|
|||
|
||||
createWaterRippleStateSet(resourceSystem, mParticleNode);
|
||||
|
||||
resourceSystem->getSceneManager()->recreateShaders(mParticleNode);
|
||||
resourceSystem->getSceneManager()->recreateShaders(mParticleNode, "objects", false, nullptr, true);
|
||||
|
||||
mParent->addChild(mParticleNode);
|
||||
}
|
||||
|
|
|
@ -340,13 +340,15 @@ namespace Resource
|
|||
return mForceShaders;
|
||||
}
|
||||
|
||||
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix, bool forceShadersForNode, const osg::Program* programTemplate)
|
||||
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix, bool forceShadersForNode, const osg::Program* programTemplate, bool disableSoftParticles)
|
||||
{
|
||||
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor(shaderPrefix));
|
||||
shaderVisitor->setAllowedToModifyStateSets(false);
|
||||
shaderVisitor->setProgramTemplate(programTemplate);
|
||||
if (forceShadersForNode)
|
||||
shaderVisitor->setForceShaders(true);
|
||||
if (disableSoftParticles)
|
||||
shaderVisitor->setOpaqueDepthTex(nullptr);
|
||||
node->accept(*shaderVisitor);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace Resource
|
|||
Shader::ShaderManager& getShaderManager();
|
||||
|
||||
/// Re-create shaders for this node, need to call this if alpha testing, texture stages or vertex color mode have changed.
|
||||
void recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix = "objects", bool forceShadersForNode = false, const osg::Program* programTemplate = nullptr);
|
||||
void recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix = "objects", bool forceShadersForNode = false, const osg::Program* programTemplate = nullptr, bool disableSoftParticles = false);
|
||||
|
||||
/// Applying shaders to a node may replace some fixed-function state.
|
||||
/// This restores it.
|
||||
|
|
Loading…
Reference in a new issue