Restore ripples with soft particles

psi29a-master-patch-54550
Cody Glassman 2 years ago committed by psi29a
parent 9d0e427ec1
commit 9cafc31c0d

@ -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…
Cancel
Save