mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:23:51 +00:00
Merge branch 'settings' into 'master'
Remove shader visitor settings manager dependency See merge request OpenMW/openmw!397
This commit is contained in:
commit
10fc3331d5
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()->setAutoUseSpecularMaps(Settings::Manager::getBool("auto use object specular maps", "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;
|
||||
sceneRoot->setLightingMask(Mask_Lighting);
|
||||
|
|
|
@ -220,6 +220,7 @@ namespace Resource
|
|||
, mClampLighting(true)
|
||||
, mAutoUseNormalMaps(false)
|
||||
, mAutoUseSpecularMaps(false)
|
||||
, mApplyLightingToEnvMaps(false)
|
||||
, mInstanceCache(new MultiObjectCache)
|
||||
, mSharedStateManager(new SharedStateManager)
|
||||
, mImageManager(imageManager)
|
||||
|
@ -284,6 +285,11 @@ namespace Resource
|
|||
mSpecularMapPattern = pattern;
|
||||
}
|
||||
|
||||
void SceneManager::setApplyLightingToEnvMaps(bool apply)
|
||||
{
|
||||
mApplyLightingToEnvMaps = apply;
|
||||
}
|
||||
|
||||
SceneManager::~SceneManager()
|
||||
{
|
||||
// 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->setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
||||
shaderVisitor->setSpecularMapPattern(mSpecularMapPattern);
|
||||
shaderVisitor->setApplyLightingToEnvMaps(mApplyLightingToEnvMaps);
|
||||
return shaderVisitor;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ namespace Resource
|
|||
|
||||
void setSpecularMapPattern(const std::string& pattern);
|
||||
|
||||
void setApplyLightingToEnvMaps(bool apply);
|
||||
|
||||
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
|
||||
|
@ -156,6 +158,7 @@ namespace Resource
|
|||
std::string mNormalHeightMapPattern;
|
||||
bool mAutoUseSpecularMaps;
|
||||
std::string mSpecularMapPattern;
|
||||
bool mApplyLightingToEnvMaps;
|
||||
|
||||
osg::ref_ptr<MultiObjectCache> mInstanceCache;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <components/vfs/manager.hpp>
|
||||
#include <components/sceneutil/riggeometry.hpp>
|
||||
#include <components/sceneutil/morphgeometry.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "shadermanager.hpp"
|
||||
|
||||
|
@ -43,6 +42,7 @@ namespace Shader
|
|||
, mAllowedToModifyStateSets(true)
|
||||
, mAutoUseNormalMaps(false)
|
||||
, mAutoUseSpecularMaps(false)
|
||||
, mApplyLightingToEnvMaps(false)
|
||||
, mShaderManager(shaderManager)
|
||||
, mImageManager(imageManager)
|
||||
, mDefaultVsTemplate(defaultVsTemplate)
|
||||
|
@ -144,11 +144,9 @@ namespace Shader
|
|||
// Bump maps are off by default as well
|
||||
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");
|
||||
if (preLightEnv)
|
||||
mRequirements.back().mShaderRequired = true;
|
||||
mRequirements.back().mShaderRequired = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -477,4 +475,9 @@ namespace Shader
|
|||
mSpecularMapPattern = pattern;
|
||||
}
|
||||
|
||||
void ShaderVisitor::setApplyLightingToEnvMaps(bool apply)
|
||||
{
|
||||
mApplyLightingToEnvMaps = apply;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace Shader
|
|||
|
||||
void setSpecularMapPattern(const std::string& pattern);
|
||||
|
||||
void setApplyLightingToEnvMaps(bool apply);
|
||||
|
||||
void apply(osg::Node& node) override;
|
||||
|
||||
void apply(osg::Drawable& drawable) override;
|
||||
|
@ -59,6 +61,8 @@ namespace Shader
|
|||
bool mAutoUseSpecularMaps;
|
||||
std::string mSpecularMapPattern;
|
||||
|
||||
bool mApplyLightingToEnvMaps;
|
||||
|
||||
ShaderManager& mShaderManager;
|
||||
Resource::ImageManager& mImageManager;
|
||||
|
||||
|
|
Loading…
Reference in a new issue