mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Allow to assign custom shaders to nodes
This commit is contained in:
parent
08fb9073c6
commit
660df19ff7
2 changed files with 6 additions and 6 deletions
|
@ -242,9 +242,9 @@ namespace Resource
|
|||
return mForceShaders;
|
||||
}
|
||||
|
||||
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node)
|
||||
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix)
|
||||
{
|
||||
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor());
|
||||
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor(shaderPrefix));
|
||||
shaderVisitor->setAllowedToModifyStateSets(false);
|
||||
node->accept(*shaderVisitor);
|
||||
}
|
||||
|
@ -761,9 +761,9 @@ namespace Resource
|
|||
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
||||
}
|
||||
|
||||
Shader::ShaderVisitor *SceneManager::createShaderVisitor()
|
||||
Shader::ShaderVisitor *SceneManager::createShaderVisitor(const std::string& shaderPrefix)
|
||||
{
|
||||
Shader::ShaderVisitor* shaderVisitor = new Shader::ShaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
||||
Shader::ShaderVisitor* shaderVisitor = new Shader::ShaderVisitor(*mShaderManager.get(), *mImageManager, shaderPrefix+"_vertex.glsl", shaderPrefix+"_fragment.glsl");
|
||||
shaderVisitor->setForceShaders(mForceShaders);
|
||||
shaderVisitor->setAutoUseNormalMaps(mAutoUseNormalMaps);
|
||||
shaderVisitor->setNormalMapPattern(mNormalMapPattern);
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Resource
|
|||
Shader::ShaderManager& getShaderManager();
|
||||
|
||||
/// Re-create shaders for this node, need to call this if texture stages or vertex color mode have changed.
|
||||
void recreateShaders(osg::ref_ptr<osg::Node> node);
|
||||
void recreateShaders(osg::ref_ptr<osg::Node> node, const std::string& shaderPrefix = "objects");
|
||||
|
||||
/// @see ShaderVisitor::setForceShaders
|
||||
void setForceShaders(bool force);
|
||||
|
@ -146,7 +146,7 @@ namespace Resource
|
|||
|
||||
private:
|
||||
|
||||
Shader::ShaderVisitor* createShaderVisitor();
|
||||
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
|
||||
|
||||
std::unique_ptr<Shader::ShaderManager> mShaderManager;
|
||||
bool mForceShaders;
|
||||
|
|
Loading…
Reference in a new issue