From cee72d021d114b96500a9f7e17775df5fba3d915 Mon Sep 17 00:00:00 2001 From: mrcheko Date: Mon, 29 Dec 2014 19:51:19 +0300 Subject: [PATCH 1/5] contrast and gamma post-processing effect added initial values are set to approximate vanilla --- apps/openmw/engine.cpp | 1 + apps/openmw/mwrender/renderingmanager.cpp | 11 ++++++ .../brightness_contrast_gamma.compositor | 24 +++++++++++++ files/materials/brightness_contrast_gamma.mat | 14 ++++++++ .../brightness_contrast_gamma.shader | 20 +++++++++++ .../brightness_contrast_gamma.shaderset | 7 ++++ files/mygui/openmw_settings_window.layout | 34 ++++++++++++++++--- files/settings-default.cfg | 2 ++ 8 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 files/materials/brightness_contrast_gamma.compositor create mode 100644 files/materials/brightness_contrast_gamma.mat create mode 100644 files/materials/brightness_contrast_gamma.shader create mode 100644 files/materials/brightness_contrast_gamma.shaderset diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 99a642454..8f695ed8d 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -347,6 +347,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) addResourcesDirectory(mResDir / "mygui"); addResourcesDirectory(mResDir / "water"); addResourcesDirectory(mResDir / "shadows"); + addResourcesDirectory(mResDir / "materials"); OEngine::Render::WindowSettings windowSettings; windowSettings.fullscreen = settings.getBool("fullscreen", "Video"); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 2cddbce75..36aba70fb 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -13,6 +13,7 @@ #include #include #include +#include // for post-processing effects #include @@ -136,6 +137,9 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); + Ogre::CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "brightness_contrast_gamma"); + Ogre::CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "brightness_contrast_gamma", true); + // disable unsupported effects if (!Settings::Manager::getBool("shaders", "Objects")) Settings::Manager::setBool("enabled", "Shadows", false); @@ -155,6 +159,8 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b sh::Factory::getInstance ().setGlobalSetting ("refraction", Settings::Manager::getBool("refraction", "Water") ? "true" : "false"); sh::Factory::getInstance ().setGlobalSetting ("viewproj_fix", "false"); sh::Factory::getInstance ().setSharedParameter ("vpRow2Fix", sh::makeProperty (new sh::Vector4(0,0,0,0))); + sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( + Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); mRootNode = mRendering.getScene()->getRootSceneNode(); mRootNode->createChildSceneNode("player"); @@ -757,6 +763,11 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec changeRes = true; else if (it->second == "field of view" && it->first == "General") mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); + else if ((it->second == "gamma" || it->second == "contrast") && it->first == "General") + { + sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( + Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); + } else if ((it->second == "texture filtering" && it->first == "General") || (it->second == "anisotropy" && it->first == "General")) { diff --git a/files/materials/brightness_contrast_gamma.compositor b/files/materials/brightness_contrast_gamma.compositor new file mode 100644 index 000000000..c5c189dd1 --- /dev/null +++ b/files/materials/brightness_contrast_gamma.compositor @@ -0,0 +1,24 @@ +compositor brightness_contrast_gamma +{ + technique + { + // render scene into texture + texture SceneBuffer target_width target_height PF_A8R8G8B8 + + target SceneBuffer + { + input previous + } + + target_output + { + input none + + pass render_quad + { + material mat_brightness_contrast_gamma + input 0 SceneBuffer + } + } + } +} diff --git a/files/materials/brightness_contrast_gamma.mat b/files/materials/brightness_contrast_gamma.mat new file mode 100644 index 000000000..0a85a1a9c --- /dev/null +++ b/files/materials/brightness_contrast_gamma.mat @@ -0,0 +1,14 @@ +material mat_brightness_contrast_gamma +{ + pass + { + vertex_program transform_vertex + fragment_program openmw_brightness_contrast_gamma_fragment + + depth_check off + + texture_unit SceneBuffer + { + } + } +} diff --git a/files/materials/brightness_contrast_gamma.shader b/files/materials/brightness_contrast_gamma.shader new file mode 100644 index 000000000..7a8f6a82a --- /dev/null +++ b/files/materials/brightness_contrast_gamma.shader @@ -0,0 +1,20 @@ +#include "core.h" + +#ifdef SH_FRAGMENT_SHADER + + SH_BEGIN_PROGRAM + shInput(float2, UV) + shSampler2D(SceneBuffer) + shUniform(float2, contrast_invGamma) @shSharedParameter(contrast_invGamma) + SH_START_PROGRAM + { + shOutputColour(0) = shSample(SceneBuffer, UV); + + // contrast + shOutputColour(0).xyz = (shOutputColour(0).xyz - float3(0.5,0.5,0.5)) * contrast_invGamma.x + float3(0.5,0.5,0.5); + shOutputColour(0).xyz = shSaturate(shOutputColour(0).xyz); + // gamma + shOutputColour(0).xyz = pow(shOutputColour(0).xyz, contrast_invGamma.yyy); + } + +#endif diff --git a/files/materials/brightness_contrast_gamma.shaderset b/files/materials/brightness_contrast_gamma.shaderset new file mode 100644 index 000000000..2dc4ff698 --- /dev/null +++ b/files/materials/brightness_contrast_gamma.shaderset @@ -0,0 +1,7 @@ +shader_set openmw_brightness_contrast_gamma_fragment +{ + source brightness_contrast_gamma.shader + type fragment + profiles_cg ps_2_x ps_2_0 ps fp40 arbfp1 + profiles_hlsl ps_2_0 +} diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index e2f46f2d1..b3da0b9f6 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -1,8 +1,8 @@  - + - + @@ -214,7 +214,7 @@ - + @@ -292,6 +292,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -470,7 +496,7 @@ - + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index df8266f7a..bd4eb208b 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -48,6 +48,8 @@ werewolf overlay = true [General] # Camera field of view field of view = 55 +gamma = 0.88 +contrast = 0.86 # Texture filtering mode. valid values: # none From c47b337fb0b205faede7132e15db91b276a970ec Mon Sep 17 00:00:00 2001 From: mrcheko Date: Mon, 29 Dec 2014 23:10:22 +0300 Subject: [PATCH 2/5] fix tabulation --- apps/openmw/engine.cpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 8f695ed8d..105d5ee05 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -347,7 +347,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) addResourcesDirectory(mResDir / "mygui"); addResourcesDirectory(mResDir / "water"); addResourcesDirectory(mResDir / "shadows"); - addResourcesDirectory(mResDir / "materials"); + addResourcesDirectory(mResDir / "materials"); OEngine::Render::WindowSettings windowSettings; windowSettings.fullscreen = settings.getBool("fullscreen", "Video"); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 36aba70fb..0bcbb9a78 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -137,8 +137,8 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); - Ogre::CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "brightness_contrast_gamma"); - Ogre::CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "brightness_contrast_gamma", true); + Ogre::CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "brightness_contrast_gamma"); + Ogre::CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "brightness_contrast_gamma", true); // disable unsupported effects if (!Settings::Manager::getBool("shaders", "Objects")) @@ -159,8 +159,8 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b sh::Factory::getInstance ().setGlobalSetting ("refraction", Settings::Manager::getBool("refraction", "Water") ? "true" : "false"); sh::Factory::getInstance ().setGlobalSetting ("viewproj_fix", "false"); sh::Factory::getInstance ().setSharedParameter ("vpRow2Fix", sh::makeProperty (new sh::Vector4(0,0,0,0))); - sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( - Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); + sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( + Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); mRootNode = mRendering.getScene()->getRootSceneNode(); mRootNode->createChildSceneNode("player"); @@ -763,11 +763,11 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec changeRes = true; else if (it->second == "field of view" && it->first == "General") mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); - else if ((it->second == "gamma" || it->second == "contrast") && it->first == "General") - { - sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( - Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); - } + else if ((it->second == "gamma" || it->second == "contrast") && it->first == "General") + { + sh::Factory::getInstance ().setSharedParameter ("contrast_invGamma", sh::makeProperty(new sh::Vector2( + Settings::Manager::getFloat("contrast", "General"), 1.0f/Settings::Manager::getFloat("gamma", "General")))); + } else if ((it->second == "texture filtering" && it->first == "General") || (it->second == "anisotropy" && it->first == "General")) { From 04d95810d158148bf56d292f21d92f6978f8d23e Mon Sep 17 00:00:00 2001 From: mrcheko Date: Tue, 30 Dec 2014 18:33:11 +0300 Subject: [PATCH 3/5] gamma/contrast system reworked --- apps/openmw/engine.cpp | 2 ++ apps/openmw/mwrender/renderingmanager.cpp | 4 +++ files/mygui/openmw_settings_window.layout | 34 ++++++++++++++++++++--- files/settings-default.cfg | 2 ++ libs/openengine/ogre/renderer.cpp | 26 +++++++++++++++++ libs/openengine/ogre/renderer.hpp | 9 +++++- 6 files changed, 72 insertions(+), 5 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 99a642454..8912cb19e 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -358,6 +358,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) windowSettings.icon = "openmw.png"; std::string aa = settings.getString("antialiasing", "Video"); windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0"; + windowSettings.gamma = Settings::Manager::getFloat("gamma", "General"); + windowSettings.contrast = Settings::Manager::getFloat("contrast", "General"); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, settings.getBool("minimize on focus loss", "Video") ? "1" : "0"); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 2cddbce75..44edcf03b 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -757,6 +757,10 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec changeRes = true; else if (it->second == "field of view" && it->first == "General") mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); + else if ((it->second == "gamma" || it->second == "contrast") && it->first == "General") + { + mRendering.setWindowGammaContrast(Settings::Manager::getFloat("gamma", "General"), Settings::Manager::getFloat("contrast", "General")); + } else if ((it->second == "texture filtering" && it->first == "General") || (it->second == "anisotropy" && it->first == "General")) { diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index e2f46f2d1..b3da0b9f6 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -1,8 +1,8 @@  - + - + @@ -214,7 +214,7 @@ - + @@ -292,6 +292,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -470,7 +496,7 @@ - + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index df8266f7a..6bd10dc21 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -48,6 +48,8 @@ werewolf overlay = true [General] # Camera field of view field of view = 55 +gamma = 1.34 +contrast = 0.98 # Texture filtering mode. valid values: # none diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index 404602c30..e20d72190 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -23,6 +23,12 @@ using namespace Ogre; using namespace OEngine::Render; +OgreRenderer::~OgreRenderer() +{ + cleanup(); + // restore system gamma ramp + SDL_SetWindowGammaRamp(mSDLWindow, mOldSystemGammaRamp, &mOldSystemGammaRamp[256], &mOldSystemGammaRamp[512]); +} void OgreRenderer::cleanup() { @@ -138,6 +144,8 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& helper.setWindowIcon(settings.icon); mWindow = helper.getWindow(); + SDL_GetWindowGammaRamp(mSDLWindow, mOldSystemGammaRamp, &mOldSystemGammaRamp[256], &mOldSystemGammaRamp[512]); + setWindowGammaContrast(settings.gamma, settings.contrast); // create the semi-transparent black background texture used by the GUI. // has to be created in code with TU_DYNAMIC_WRITE_ONLY param @@ -161,6 +169,24 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& mCamera->setAspectRatio(Real(mView->getActualWidth()) / Real(mView->getActualHeight())); } +void OgreRenderer::setWindowGammaContrast(float gamma, float contrast) +{ + Uint16 red[256], green[256], blue[256]; + for (int i = 0; i < 256; i++) + { + float k = i/256.0f; + k = (k - 0.5f) * contrast + 0.5f; + k = pow(k, 1.f/gamma); + k *= 256; + float value = k*256; + if (value > 65535) value = 65535; + else if (value < 0) value = 0; + + red[i] = green[i] = blue[i] = value; + } + SDL_SetWindowGammaRamp(mSDLWindow, red, green, blue); +} + void OgreRenderer::adjustCamera(float fov, float nearClip) { mCamera->setNearClipDistance(nearClip); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index 70cc3db60..6f2891e6a 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -42,6 +42,8 @@ namespace OEngine int screen; std::string fsaa; std::string icon; + float gamma; + float contrast; }; class WindowSizeListener @@ -67,6 +69,9 @@ namespace OEngine int mWindowHeight; bool mOutstandingResize; + // Store system gamma ramp on window creation. Restore system gamma ramp on exit + uint16_t mOldSystemGammaRamp[256*3]; + public: OgreRenderer() : mRoot(NULL) @@ -83,7 +88,7 @@ namespace OEngine { } - ~OgreRenderer() { cleanup(); } + ~OgreRenderer(); /** Configure the renderer. This will load configuration files and set up the Root and logging classes. */ @@ -95,6 +100,8 @@ namespace OEngine /// Create a window with the given title void createWindow(const std::string &title, const WindowSettings& settings); + void setWindowGammaContrast(float gamma, float contrast); + /// Set up the scene manager, camera and viewport void adjustCamera( float fov=55, // Field of view angle From 60a74d5eb8f5f673d6fecc626e789ecf37c31b40 Mon Sep 17 00:00:00 2001 From: mrcheko Date: Wed, 31 Dec 2014 18:40:01 +0300 Subject: [PATCH 4/5] increase robustness for gamma to persist in the system; use GMST strings for gamma interface --- apps/openmw/engine.cpp | 5 +++-- files/mygui/openmw_settings_window.layout | 22 +++++++++++++++------- libs/openengine/ogre/renderer.cpp | 17 +++++++++++++---- libs/openengine/ogre/renderer.hpp | 3 +-- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 8912cb19e..c5ecfee2d 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -208,6 +208,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) OMW::Engine::~Engine() { + mOgre->restoreWindowGammaRamp(); mEnvironment.cleanup(); delete mScriptContext; delete mOgre; @@ -358,8 +359,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) windowSettings.icon = "openmw.png"; std::string aa = settings.getString("antialiasing", "Video"); windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0"; - windowSettings.gamma = Settings::Manager::getFloat("gamma", "General"); - windowSettings.contrast = Settings::Manager::getFloat("contrast", "General"); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, settings.getBool("minimize on focus loss", "Video") ? "1" : "0"); @@ -384,6 +383,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) // Create sound system mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound)); + mOgre->setWindowGammaContrast(Settings::Manager::getFloat("gamma", "General"), Settings::Manager::getFloat("contrast", "General")); + if (!mSkipMenu) { std::string logo = mFallbackMap["Movies_Company_Logo"]; diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index b3da0b9f6..8fd3d8af1 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -1,8 +1,8 @@  - + - + @@ -214,7 +214,7 @@ - + @@ -293,7 +293,7 @@ - + @@ -305,10 +305,18 @@ - + + + + + + + + + - + @@ -496,7 +504,7 @@ - + diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index e20d72190..022c6473f 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -26,8 +26,7 @@ using namespace OEngine::Render; OgreRenderer::~OgreRenderer() { cleanup(); - // restore system gamma ramp - SDL_SetWindowGammaRamp(mSDLWindow, mOldSystemGammaRamp, &mOldSystemGammaRamp[256], &mOldSystemGammaRamp[512]); + restoreWindowGammaRamp(); } void OgreRenderer::cleanup() @@ -145,7 +144,6 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& mWindow = helper.getWindow(); SDL_GetWindowGammaRamp(mSDLWindow, mOldSystemGammaRamp, &mOldSystemGammaRamp[256], &mOldSystemGammaRamp[512]); - setWindowGammaContrast(settings.gamma, settings.contrast); // create the semi-transparent black background texture used by the GUI. // has to be created in code with TU_DYNAMIC_WRITE_ONLY param @@ -171,6 +169,8 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& void OgreRenderer::setWindowGammaContrast(float gamma, float contrast) { + if (mSDLWindow == NULL) return; + Uint16 red[256], green[256], blue[256]; for (int i = 0; i < 256; i++) { @@ -184,7 +184,16 @@ void OgreRenderer::setWindowGammaContrast(float gamma, float contrast) red[i] = green[i] = blue[i] = value; } - SDL_SetWindowGammaRamp(mSDLWindow, red, green, blue); + if (SDL_SetWindowGammaRamp(mSDLWindow, red, green, blue) < 0) + std::cout << "Couldn't set gamma: " << SDL_GetError() << std::endl; +} + +void OgreRenderer::restoreWindowGammaRamp() +{ + if (mSDLWindow != NULL) + { + SDL_SetWindowGammaRamp(mSDLWindow, mOldSystemGammaRamp, &mOldSystemGammaRamp[256], &mOldSystemGammaRamp[512]); + } } void OgreRenderer::adjustCamera(float fov, float nearClip) diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index 6f2891e6a..1b18a7b0b 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -42,8 +42,6 @@ namespace OEngine int screen; std::string fsaa; std::string icon; - float gamma; - float contrast; }; class WindowSizeListener @@ -101,6 +99,7 @@ namespace OEngine void createWindow(const std::string &title, const WindowSettings& settings); void setWindowGammaContrast(float gamma, float contrast); + void restoreWindowGammaRamp(); /// Set up the scene manager, camera and viewport void adjustCamera( From a8621e62308abafae018e30c76f3f2feddd5edcb Mon Sep 17 00:00:00 2001 From: mrcheko Date: Fri, 2 Jan 2015 16:49:22 +0300 Subject: [PATCH 5/5] defaults are set to 1.0; remove contrast setting (can be changed in config though); disable gamma control for not Windows OSs --- apps/openmw/mwgui/settingswindow.cpp | 14 +++++++++++++ apps/openmw/mwrender/renderingmanager.cpp | 2 +- files/mygui/openmw_settings_window.layout | 25 ++++++----------------- files/settings-default.cfg | 4 ++-- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index ce2a20d8b..05664386b 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -182,6 +182,20 @@ namespace MWGui getWidget(mRefractionButton, "RefractionButton"); getWidget(mDifficultySlider, "DifficultySlider"); +#ifndef WIN32 + // hide gamma controls since it currently does not work under Linux + MyGUI::ScrollBar *gammaSlider; + getWidget(gammaSlider, "GammaSlider"); + gammaSlider->setVisible(false); + MyGUI::TextBox *textBox; + getWidget(textBox, "GammaText"); + textBox->setVisible(false); + getWidget(textBox, "GammaTextDark"); + textBox->setVisible(false); + getWidget(textBox, "GammaTextLight"); + textBox->setVisible(false); +#endif + mMainWidget->castType()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SettingsWindow::onWindowResize); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 44edcf03b..3aff46d43 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -757,7 +757,7 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec changeRes = true; else if (it->second == "field of view" && it->first == "General") mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); - else if ((it->second == "gamma" || it->second == "contrast") && it->first == "General") + else if (it->second == "gamma" && it->first == "General") { mRendering.setWindowGammaContrast(Settings::Manager::getFloat("gamma", "General"), Settings::Manager::getFloat("contrast", "General")); } diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index 8fd3d8af1..4a993e140 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -1,8 +1,8 @@  - + - + @@ -214,7 +214,7 @@ - + @@ -305,27 +305,14 @@ - + - + - - - - - - - - - - - - - @@ -504,7 +491,7 @@ - + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 6bd10dc21..0a55a286b 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -48,8 +48,8 @@ werewolf overlay = true [General] # Camera field of view field of view = 55 -gamma = 1.34 -contrast = 0.98 +gamma = 1.00 +contrast = 1.00 # Texture filtering mode. valid values: # none