mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Fix incomplete settings in recreateShaders()
This commit is contained in:
parent
03554b2f4b
commit
136ef1f738
2 changed files with 22 additions and 16 deletions
|
@ -244,12 +244,9 @@ namespace Resource
|
|||
|
||||
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node)
|
||||
{
|
||||
Shader::ShaderVisitor shaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
||||
shaderVisitor.setForceShaders(mForceShaders);
|
||||
shaderVisitor.setClampLighting(mClampLighting);
|
||||
shaderVisitor.setForcePerPixelLighting(mForcePerPixelLighting);
|
||||
shaderVisitor.setAllowedToModifyStateSets(false);
|
||||
node->accept(shaderVisitor);
|
||||
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor());
|
||||
shaderVisitor->setAllowedToModifyStateSets(false);
|
||||
node->accept(*shaderVisitor);
|
||||
}
|
||||
|
||||
void SceneManager::setClampLighting(bool clamp)
|
||||
|
@ -516,16 +513,8 @@ namespace Resource
|
|||
SetFilterSettingsControllerVisitor setFilterSettingsControllerVisitor(mMinFilter, mMagFilter, mMaxAnisotropy);
|
||||
loaded->accept(setFilterSettingsControllerVisitor);
|
||||
|
||||
Shader::ShaderVisitor shaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
||||
shaderVisitor.setForceShaders(mForceShaders);
|
||||
shaderVisitor.setClampLighting(mClampLighting);
|
||||
shaderVisitor.setForcePerPixelLighting(mForcePerPixelLighting);
|
||||
shaderVisitor.setAutoUseNormalMaps(mAutoUseNormalMaps);
|
||||
shaderVisitor.setNormalMapPattern(mNormalMapPattern);
|
||||
shaderVisitor.setNormalHeightMapPattern(mNormalHeightMapPattern);
|
||||
shaderVisitor.setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
||||
shaderVisitor.setSpecularMapPattern(mSpecularMapPattern);
|
||||
loaded->accept(shaderVisitor);
|
||||
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor (createShaderVisitor());
|
||||
loaded->accept(*shaderVisitor);
|
||||
|
||||
// share state
|
||||
// do this before optimizing so the optimizer will be able to combine nodes more aggressively
|
||||
|
@ -748,4 +737,18 @@ namespace Resource
|
|||
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
||||
}
|
||||
|
||||
Shader::ShaderVisitor *SceneManager::createShaderVisitor()
|
||||
{
|
||||
Shader::ShaderVisitor* shaderVisitor = new Shader::ShaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
||||
shaderVisitor->setForceShaders(mForceShaders);
|
||||
shaderVisitor->setClampLighting(mClampLighting);
|
||||
shaderVisitor->setForcePerPixelLighting(mForcePerPixelLighting);
|
||||
shaderVisitor->setAutoUseNormalMaps(mAutoUseNormalMaps);
|
||||
shaderVisitor->setNormalMapPattern(mNormalMapPattern);
|
||||
shaderVisitor->setNormalHeightMapPattern(mNormalHeightMapPattern);
|
||||
shaderVisitor->setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
||||
shaderVisitor->setSpecularMapPattern(mSpecularMapPattern);
|
||||
return shaderVisitor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace osgDB
|
|||
namespace Shader
|
||||
{
|
||||
class ShaderManager;
|
||||
class ShaderVisitor;
|
||||
}
|
||||
|
||||
namespace Resource
|
||||
|
@ -149,6 +150,8 @@ namespace Resource
|
|||
|
||||
private:
|
||||
|
||||
Shader::ShaderVisitor* createShaderVisitor();
|
||||
|
||||
std::unique_ptr<Shader::ShaderManager> mShaderManager;
|
||||
bool mForceShaders;
|
||||
bool mClampLighting;
|
||||
|
|
Loading…
Reference in a new issue