mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:45:34 +00:00
Remove shader visitor settings manager dependency
This commit is contained in:
parent
35115f2f24
commit
b523574090
5 changed files with 23 additions and 5 deletions
|
@ -216,6 +216,7 @@ namespace MWRender
|
||||||
resourceSystem->getSceneManager()->setNormalHeightMapPattern(Settings::Manager::getString("normal height map pattern", "Shaders"));
|
resourceSystem->getSceneManager()->setNormalHeightMapPattern(Settings::Manager::getString("normal height map pattern", "Shaders"));
|
||||||
resourceSystem->getSceneManager()->setAutoUseSpecularMaps(Settings::Manager::getBool("auto use object specular maps", "Shaders"));
|
resourceSystem->getSceneManager()->setAutoUseSpecularMaps(Settings::Manager::getBool("auto use object specular maps", "Shaders"));
|
||||||
resourceSystem->getSceneManager()->setSpecularMapPattern(Settings::Manager::getString("specular map pattern", "Shaders"));
|
resourceSystem->getSceneManager()->setSpecularMapPattern(Settings::Manager::getString("specular map pattern", "Shaders"));
|
||||||
|
resourceSystem->getSceneManager()->setApplyLightingToEnvMaps(Settings::Manager::getBool("apply lighting to environment maps", "Shaders"));
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::LightManager> sceneRoot = new SceneUtil::LightManager;
|
osg::ref_ptr<SceneUtil::LightManager> sceneRoot = new SceneUtil::LightManager;
|
||||||
sceneRoot->setLightingMask(Mask_Lighting);
|
sceneRoot->setLightingMask(Mask_Lighting);
|
||||||
|
|
|
@ -220,6 +220,7 @@ namespace Resource
|
||||||
, mClampLighting(true)
|
, mClampLighting(true)
|
||||||
, mAutoUseNormalMaps(false)
|
, mAutoUseNormalMaps(false)
|
||||||
, mAutoUseSpecularMaps(false)
|
, mAutoUseSpecularMaps(false)
|
||||||
|
, mApplyLightingToEnvMaps(false)
|
||||||
, mInstanceCache(new MultiObjectCache)
|
, mInstanceCache(new MultiObjectCache)
|
||||||
, mSharedStateManager(new SharedStateManager)
|
, mSharedStateManager(new SharedStateManager)
|
||||||
, mImageManager(imageManager)
|
, mImageManager(imageManager)
|
||||||
|
@ -284,6 +285,11 @@ namespace Resource
|
||||||
mSpecularMapPattern = pattern;
|
mSpecularMapPattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneManager::setApplyLightingToEnvMaps(bool apply)
|
||||||
|
{
|
||||||
|
mApplyLightingToEnvMaps = apply;
|
||||||
|
}
|
||||||
|
|
||||||
SceneManager::~SceneManager()
|
SceneManager::~SceneManager()
|
||||||
{
|
{
|
||||||
// this has to be defined in the .cpp file as we can't delete incomplete types
|
// this has to be defined in the .cpp file as we can't delete incomplete types
|
||||||
|
@ -770,6 +776,7 @@ namespace Resource
|
||||||
shaderVisitor->setNormalHeightMapPattern(mNormalHeightMapPattern);
|
shaderVisitor->setNormalHeightMapPattern(mNormalHeightMapPattern);
|
||||||
shaderVisitor->setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
shaderVisitor->setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
||||||
shaderVisitor->setSpecularMapPattern(mSpecularMapPattern);
|
shaderVisitor->setSpecularMapPattern(mSpecularMapPattern);
|
||||||
|
shaderVisitor->setApplyLightingToEnvMaps(mApplyLightingToEnvMaps);
|
||||||
return shaderVisitor;
|
return shaderVisitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ namespace Resource
|
||||||
|
|
||||||
void setSpecularMapPattern(const std::string& pattern);
|
void setSpecularMapPattern(const std::string& pattern);
|
||||||
|
|
||||||
|
void setApplyLightingToEnvMaps(bool apply);
|
||||||
|
|
||||||
void setShaderPath(const std::string& path);
|
void setShaderPath(const std::string& path);
|
||||||
|
|
||||||
/// Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded
|
/// Check if a given scene is loaded and if so, update its usage timestamp to prevent it from being unloaded
|
||||||
|
@ -156,6 +158,7 @@ namespace Resource
|
||||||
std::string mNormalHeightMapPattern;
|
std::string mNormalHeightMapPattern;
|
||||||
bool mAutoUseSpecularMaps;
|
bool mAutoUseSpecularMaps;
|
||||||
std::string mSpecularMapPattern;
|
std::string mSpecularMapPattern;
|
||||||
|
bool mApplyLightingToEnvMaps;
|
||||||
|
|
||||||
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
#include <components/sceneutil/riggeometry.hpp>
|
#include <components/sceneutil/riggeometry.hpp>
|
||||||
#include <components/sceneutil/morphgeometry.hpp>
|
#include <components/sceneutil/morphgeometry.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
|
||||||
|
|
||||||
#include "shadermanager.hpp"
|
#include "shadermanager.hpp"
|
||||||
|
|
||||||
|
@ -43,6 +42,7 @@ namespace Shader
|
||||||
, mAllowedToModifyStateSets(true)
|
, mAllowedToModifyStateSets(true)
|
||||||
, mAutoUseNormalMaps(false)
|
, mAutoUseNormalMaps(false)
|
||||||
, mAutoUseSpecularMaps(false)
|
, mAutoUseSpecularMaps(false)
|
||||||
|
, mApplyLightingToEnvMaps(false)
|
||||||
, mShaderManager(shaderManager)
|
, mShaderManager(shaderManager)
|
||||||
, mImageManager(imageManager)
|
, mImageManager(imageManager)
|
||||||
, mDefaultVsTemplate(defaultVsTemplate)
|
, mDefaultVsTemplate(defaultVsTemplate)
|
||||||
|
@ -144,11 +144,9 @@ namespace Shader
|
||||||
// Bump maps are off by default as well
|
// Bump maps are off by default as well
|
||||||
writableStateSet->setTextureMode(unit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
writableStateSet->setTextureMode(unit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
else if (texName == "envMap")
|
else if (texName == "envMap" && mApplyLightingToEnvMaps)
|
||||||
{
|
{
|
||||||
static const bool preLightEnv = Settings::Manager::getBool("apply lighting to environment maps", "Shaders");
|
mRequirements.back().mShaderRequired = true;
|
||||||
if (preLightEnv)
|
|
||||||
mRequirements.back().mShaderRequired = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -477,4 +475,9 @@ namespace Shader
|
||||||
mSpecularMapPattern = pattern;
|
mSpecularMapPattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShaderVisitor::setApplyLightingToEnvMaps(bool apply)
|
||||||
|
{
|
||||||
|
mApplyLightingToEnvMaps = apply;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,8 @@ namespace Shader
|
||||||
|
|
||||||
void setSpecularMapPattern(const std::string& pattern);
|
void setSpecularMapPattern(const std::string& pattern);
|
||||||
|
|
||||||
|
void setApplyLightingToEnvMaps(bool apply);
|
||||||
|
|
||||||
void apply(osg::Node& node) override;
|
void apply(osg::Node& node) override;
|
||||||
|
|
||||||
void apply(osg::Drawable& drawable) override;
|
void apply(osg::Drawable& drawable) override;
|
||||||
|
@ -59,6 +61,8 @@ namespace Shader
|
||||||
bool mAutoUseSpecularMaps;
|
bool mAutoUseSpecularMaps;
|
||||||
std::string mSpecularMapPattern;
|
std::string mSpecularMapPattern;
|
||||||
|
|
||||||
|
bool mApplyLightingToEnvMaps;
|
||||||
|
|
||||||
ShaderManager& mShaderManager;
|
ShaderManager& mShaderManager;
|
||||||
Resource::ImageManager& mImageManager;
|
Resource::ImageManager& mImageManager;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue