mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-03 15:27:58 +03: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);
|
createWaterRippleStateSet(resourceSystem, mParticleNode);
|
||||||
|
|
||||||
resourceSystem->getSceneManager()->recreateShaders(mParticleNode);
|
resourceSystem->getSceneManager()->recreateShaders(mParticleNode, "objects", false, nullptr, true);
|
||||||
|
|
||||||
mParent->addChild(mParticleNode);
|
mParent->addChild(mParticleNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,13 +340,15 @@ namespace Resource
|
||||||
return mForceShaders;
|
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));
|
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor(shaderPrefix));
|
||||||
shaderVisitor->setAllowedToModifyStateSets(false);
|
shaderVisitor->setAllowedToModifyStateSets(false);
|
||||||
shaderVisitor->setProgramTemplate(programTemplate);
|
shaderVisitor->setProgramTemplate(programTemplate);
|
||||||
if (forceShadersForNode)
|
if (forceShadersForNode)
|
||||||
shaderVisitor->setForceShaders(true);
|
shaderVisitor->setForceShaders(true);
|
||||||
|
if (disableSoftParticles)
|
||||||
|
shaderVisitor->setOpaqueDepthTex(nullptr);
|
||||||
node->accept(*shaderVisitor);
|
node->accept(*shaderVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Resource
|
||||||
Shader::ShaderManager& getShaderManager();
|
Shader::ShaderManager& getShaderManager();
|
||||||
|
|
||||||
/// Re-create shaders for this node, need to call this if alpha testing, texture stages or vertex color mode have changed.
|
/// 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.
|
/// Applying shaders to a node may replace some fixed-function state.
|
||||||
/// This restores it.
|
/// This restores it.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue