Use settings values for Post Processing settings

macos_ci_fix
elsid 1 year ago
parent 575f43876b
commit 7b4b8763ff
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -1,7 +1,7 @@
#include "luminancecalculator.hpp" #include "luminancecalculator.hpp"
#include <components/misc/mathutil.hpp> #include <components/misc/mathutil.hpp>
#include <components/settings/settings.hpp> #include <components/settings/values.hpp>
#include <components/shader/shadermanager.hpp> #include <components/shader/shadermanager.hpp>
#include "pingpongcanvas.hpp" #include "pingpongcanvas.hpp"
@ -10,11 +10,8 @@ namespace MWRender
{ {
LuminanceCalculator::LuminanceCalculator(Shader::ShaderManager& shaderManager) LuminanceCalculator::LuminanceCalculator(Shader::ShaderManager& shaderManager)
{ {
const float hdrExposureTime
= std::max(Settings::Manager::getFloat("auto exposure speed", "Post Processing"), 0.0001f);
Shader::ShaderManager::DefineMap defines = { Shader::ShaderManager::DefineMap defines = {
{ "hdrExposureTime", std::to_string(hdrExposureTime) }, { "hdrExposureTime", std::to_string(Settings::postProcessing().mAutoExposureSpeed) },
}; };
auto vertex = shaderManager.getShader("fullscreen_tri.vert", {}); auto vertex = shaderManager.getShader("fullscreen_tri.vert", {});

@ -18,7 +18,7 @@
#include <components/sceneutil/color.hpp> #include <components/sceneutil/color.hpp>
#include <components/sceneutil/depth.hpp> #include <components/sceneutil/depth.hpp>
#include <components/sceneutil/nodecallback.hpp> #include <components/sceneutil/nodecallback.hpp>
#include <components/settings/settings.hpp> #include <components/settings/values.hpp>
#include <components/shader/shadermanager.hpp> #include <components/shader/shadermanager.hpp>
#include <components/stereo/multiview.hpp> #include <components/stereo/multiview.hpp>
#include <components/stereo/stereomanager.hpp> #include <components/stereo/stereomanager.hpp>
@ -121,7 +121,7 @@ namespace MWRender
, mTriggerShaderReload(false) , mTriggerShaderReload(false)
, mReload(false) , mReload(false)
, mEnabled(false) , mEnabled(false)
, mUsePostProcessing(false) , mUsePostProcessing(Settings::postProcessing().mEnabled)
, mSoftParticles(false) , mSoftParticles(false)
, mDisableDepthPasses(false) , mDisableDepthPasses(false)
, mLastFrameNumber(0) , mLastFrameNumber(0)
@ -136,7 +136,6 @@ namespace MWRender
, mPrevPassLights(false) , mPrevPassLights(false)
{ {
mSoftParticles = Settings::Manager::getBool("soft particles", "Shaders"); mSoftParticles = Settings::Manager::getBool("soft particles", "Shaders");
mUsePostProcessing = Settings::Manager::getBool("enabled", "Post Processing");
osg::GraphicsContext* gc = viewer->getCamera()->getGraphicsContext(); osg::GraphicsContext* gc = viewer->getCamera()->getGraphicsContext();
osg::GLExtensions* ext = gc->getState()->get<osg::GLExtensions>(); osg::GLExtensions* ext = gc->getState()->get<osg::GLExtensions>();
@ -237,7 +236,7 @@ namespace MWRender
{ {
mReload = true; mReload = true;
mEnabled = true; mEnabled = true;
bool postPass = Settings::Manager::getBool("transparent postpass", "Post Processing"); const bool postPass = Settings::postProcessing().mTransparentPostpass;
mUsePostProcessing = usePostProcessing; mUsePostProcessing = usePostProcessing;
mDisableDepthPasses = !mSoftParticles && !postPass; mDisableDepthPasses = !mSoftParticles && !postPass;
@ -839,9 +838,7 @@ namespace MWRender
mTechniques.clear(); mTechniques.clear();
std::vector<std::string> techniqueStrings = Settings::Manager::getStringArray("chain", "Post Processing"); for (const std::string& techniqueName : Settings::postProcessing().mChain.get())
for (auto& techniqueName : techniqueStrings)
{ {
if (techniqueName.empty()) if (techniqueName.empty())
continue; continue;
@ -863,7 +860,7 @@ namespace MWRender
chain.push_back(technique->getName()); chain.push_back(technique->getName());
} }
Settings::Manager::setStringArray("chain", "Post Processing", chain); Settings::postProcessing().mChain.set(chain);
} }
void PostProcessor::toggleMode() void PostProcessor::toggleMode()

@ -1441,7 +1441,7 @@ namespace MWRender
} }
else if (it->first == "Post Processing" && it->second == "enabled") else if (it->first == "Post Processing" && it->second == "enabled")
{ {
if (Settings::Manager::getBool("enabled", "Post Processing")) if (Settings::postProcessing().mEnabled)
mPostProcessor->enable(); mPostProcessor->enable();
else else
{ {

@ -19,7 +19,7 @@ namespace Settings
using WithIndex::WithIndex; using WithIndex::WithIndex;
SettingValue<bool> mEnabled{ mIndex, "Post Processing", "enabled" }; SettingValue<bool> mEnabled{ mIndex, "Post Processing", "enabled" };
SettingValue<std::string> mChain{ mIndex, "Post Processing", "chain" }; SettingValue<std::vector<std::string>> mChain{ mIndex, "Post Processing", "chain" };
SettingValue<float> mAutoExposureSpeed{ mIndex, "Post Processing", "auto exposure speed", SettingValue<float> mAutoExposureSpeed{ mIndex, "Post Processing", "auto exposure speed",
makeMaxStrictSanitizerFloat(0.0001f) }; makeMaxStrictSanitizerFloat(0.0001f) };
SettingValue<bool> mTransparentPostpass{ mIndex, "Post Processing", "transparent postpass" }; SettingValue<bool> mTransparentPostpass{ mIndex, "Post Processing", "transparent postpass" };

Loading…
Cancel
Save