From 76bde5ee13de76d15a9a355906fa2dfe909dbcd4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Dec 2015 11:24:23 -0800 Subject: [PATCH 1/7] Separate and expand texture filtering options --- apps/openmw/engine.cpp | 35 +++++++++++++++++++---- apps/openmw/mwgui/settingswindow.cpp | 26 +++++++++++++++-- apps/openmw/mwgui/settingswindow.hpp | 2 ++ apps/openmw/mwrender/renderingmanager.cpp | 30 ++++++++++++++++--- files/mygui/openmw_settings_window.layout | 14 +++++++-- files/settings-default.cfg | 7 +++-- 6 files changed, 96 insertions(+), 18 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 6c360acf6e..86ccb7b3b3 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -451,12 +451,35 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get())); mResourceSystem->getTextureManager()->setUnRefImageDataAfterApply(true); - osg::Texture::FilterMode min = osg::Texture::LINEAR_MIPMAP_NEAREST; - osg::Texture::FilterMode mag = osg::Texture::LINEAR; - if (Settings::Manager::getString("texture filtering", "General") == "trilinear") - min = osg::Texture::LINEAR_MIPMAP_LINEAR; - int maxAnisotropy = Settings::Manager::getInt("anisotropy", "General"); - mResourceSystem->getTextureManager()->setFilterSettings(min, mag, maxAnisotropy); + { + osg::Texture::FilterMode min = osg::Texture::LINEAR; + osg::Texture::FilterMode mag = osg::Texture::LINEAR; + + std::string filter = Settings::Manager::getString("texture filtering", "General"); + if(filter == "nearest") + { + min = osg::Texture::NEAREST; + mag = osg::Texture::NEAREST; + } + + std::string mipmap = Settings::Manager::getString("texture mipmapping", "General"); + if(mipmap == "nearest") + { + if(min == osg::Texture::NEAREST) + min = osg::Texture::NEAREST_MIPMAP_NEAREST; + else if(min == osg::Texture::LINEAR) + min = osg::Texture::LINEAR_MIPMAP_NEAREST; + } + else if(mipmap != "none") + { + if(min == osg::Texture::NEAREST) + min = osg::Texture::NEAREST_MIPMAP_LINEAR; + else if(min == osg::Texture::LINEAR) + min = osg::Texture::LINEAR_MIPMAP_LINEAR; + } + int maxAnisotropy = Settings::Manager::getInt("anisotropy", "General"); + mResourceSystem->getTextureManager()->setFilterSettings(min, mag, maxAnisotropy); + } // Create input and UI first to set up a bootstrapping environment for // showing a loading screen and keeping the window responsive while doing so diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 78ff965328..72c0042711 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -37,10 +37,20 @@ namespace std::string textureFilteringToStr(const std::string& val) { - if (val == "trilinear") - return "Trilinear"; + if (val == "nearest") + return "Nearest"; else - return "Bilinear"; + return "Linear"; + } + + std::string textureMipmappingToStr(const std::string& val) + { + if (val == "linear") + return "Linear"; + else if (val == "none") + return "None"; + else + return "Nearest"; } void parseResolution (int &x, int &y, const std::string& str) @@ -169,6 +179,7 @@ namespace MWGui getWidget(mFOVSlider, "FOVSlider"); getWidget(mAnisotropySlider, "AnisotropySlider"); getWidget(mTextureFilteringButton, "TextureFilteringButton"); + getWidget(mTextureMipmappingButton, "TextureMipmappingButton"); getWidget(mAnisotropyLabel, "AnisotropyLabel"); getWidget(mAnisotropyBox, "AnisotropyBox"); getWidget(mShadersButton, "ShadersButton"); @@ -200,6 +211,7 @@ namespace MWGui mSettingsTab->eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); + mTextureMipmappingButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureMipmappingChanged); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged); @@ -237,6 +249,8 @@ namespace MWGui std::string tf = Settings::Manager::getString("texture filtering", "General"); mTextureFilteringButton->setCaption(textureFilteringToStr(tf)); + std::string tmip = Settings::Manager::getString("texture mipmapping", "General"); + mTextureMipmappingButton->setCaption(textureMipmappingToStr(tmip)); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")"); int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water"); @@ -429,6 +443,12 @@ namespace MWGui apply(); } + void SettingsWindow::onTextureMipmappingChanged(MyGUI::ComboBox* _sender, size_t pos) + { + Settings::Manager::setString("texture mipmapping", "General", Misc::StringUtils::lowerCase(_sender->getItemNameAt(pos))); + apply(); + } + void SettingsWindow::onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos) { if (getSettingType(scroller) == "Slider") diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 99553808b4..da9c8628e0 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -34,6 +34,7 @@ namespace MWGui MyGUI::ScrollBar* mDifficultySlider; MyGUI::ScrollBar* mAnisotropySlider; MyGUI::ComboBox* mTextureFilteringButton; + MyGUI::ComboBox* mTextureMipmappingButton; MyGUI::TextBox* mAnisotropyLabel; MyGUI::Widget* mAnisotropyBox; MyGUI::Button* mShadersButton; @@ -53,6 +54,7 @@ namespace MWGui void onTabChanged(MyGUI::TabControl* _sender, size_t index); void onOkButtonClicked(MyGUI::Widget* _sender); void onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos); + void onTextureMipmappingChanged(MyGUI::ComboBox* _sender, size_t pos); void onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos); void onButtonToggled(MyGUI::Widget* _sender); void onResolutionSelected(MyGUI::ListBox* _sender, size_t index); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 4b208fa944..f66398d2f3 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -781,11 +781,31 @@ namespace MWRender void RenderingManager::updateTextureFiltering() { - osg::Texture::FilterMode min = osg::Texture::LINEAR_MIPMAP_NEAREST; + osg::Texture::FilterMode min = osg::Texture::LINEAR; osg::Texture::FilterMode mag = osg::Texture::LINEAR; - if (Settings::Manager::getString("texture filtering", "General") == "trilinear") - min = osg::Texture::LINEAR_MIPMAP_LINEAR; + std::string filter = Settings::Manager::getString("texture filtering", "General"); + if(filter == "nearest") + { + min = osg::Texture::NEAREST; + mag = osg::Texture::NEAREST; + } + + std::string mipmap = Settings::Manager::getString("texture mipmapping", "General"); + if(mipmap == "nearest") + { + if(min == osg::Texture::NEAREST) + min = osg::Texture::NEAREST_MIPMAP_NEAREST; + else if(min == osg::Texture::LINEAR) + min = osg::Texture::LINEAR_MIPMAP_NEAREST; + } + else if(mipmap != "none") + { + if(min == osg::Texture::NEAREST) + min = osg::Texture::NEAREST_MIPMAP_LINEAR; + else if(min == osg::Texture::LINEAR) + min = osg::Texture::LINEAR_MIPMAP_LINEAR; + } int maxAnisotropy = Settings::Manager::getInt("anisotropy", "General"); @@ -826,7 +846,9 @@ namespace MWRender mStateUpdater->setFogEnd(mViewDistance); updateProjectionMatrix(); } - else if (it->first == "General" && (it->second == "texture filtering" || it->second == "anisotropy")) + else if (it->first == "General" && (it->second == "texture filtering" || + it->second == "texture mipmapping" || + it->second == "anisotropy")) updateTextureFiltering(); else if (it->first == "Water") mWater->processChangedSettings(changed); diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index 6d2424aa5b..df268eec40 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -322,10 +322,18 @@ - - + + - + + + + + + + + + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index a5fd3cccd0..c9132dadad 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -110,8 +110,11 @@ anisotropy = 4 # File format for screenshots. (jpg, png, tga, and possibly more). screenshot format = png -# Isotropic texture filtering. (bilinear or trilinear). -texture filtering = trilinear +# Texture filtering. (nearest or linear). +texture filtering = linear + +# Texture mipmapping. (none, nearest, or linear). +texture mipmapping = nearest [Input] From fb6abb53aeb8d3e65a5ddc376df2a80530b008cc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Dec 2015 15:02:36 -0800 Subject: [PATCH 2/7] Simplify the in-game texture options This makes it behave like it originally did, although the config options remain expanded. --- apps/openmw/mwgui/settingswindow.cpp | 38 +++++++---------------- apps/openmw/mwgui/settingswindow.hpp | 1 - files/mygui/openmw_settings_window.layout | 14 ++------- 3 files changed, 15 insertions(+), 38 deletions(-) diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 72c0042711..b9aa3aa267 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -35,22 +35,13 @@ namespace return "#{sOn}"; } - std::string textureFilteringToStr(const std::string& val) - { - if (val == "nearest") - return "Nearest"; - else - return "Linear"; - } - std::string textureMipmappingToStr(const std::string& val) { - if (val == "linear") - return "Linear"; - else if (val == "none") - return "None"; - else - return "Nearest"; + if (val == "linear") return "Trilinear"; + if (val == "nearest") return "Bilinear"; + if (val != "none") + std::cerr<< "Invalid texture mipmap option: "<eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); - mTextureMipmappingButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureMipmappingChanged); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged); @@ -247,10 +236,8 @@ namespace MWGui } highlightCurrentResolution(); - std::string tf = Settings::Manager::getString("texture filtering", "General"); - mTextureFilteringButton->setCaption(textureFilteringToStr(tf)); std::string tmip = Settings::Manager::getString("texture mipmapping", "General"); - mTextureMipmappingButton->setCaption(textureMipmappingToStr(tmip)); + mTextureFilteringButton->setCaption(textureMipmappingToStr(tmip)); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")"); int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water"); @@ -439,13 +426,12 @@ namespace MWGui void SettingsWindow::onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos) { - Settings::Manager::setString("texture filtering", "General", Misc::StringUtils::lowerCase(_sender->getItemNameAt(pos))); - apply(); - } - - void SettingsWindow::onTextureMipmappingChanged(MyGUI::ComboBox* _sender, size_t pos) - { - Settings::Manager::setString("texture mipmapping", "General", Misc::StringUtils::lowerCase(_sender->getItemNameAt(pos))); + if(pos == 0) + Settings::Manager::setString("texture mipmapping", "General", "nearest"); + else if(pos == 1) + Settings::Manager::setString("texture mipmapping", "General", "linear"); + else + std::cerr<< "Unexpected option pos "< - - + + - - - - - - - - - + From 646092ce3ad88edeb001216c03cc31a70072d141 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Dec 2015 15:20:59 -0800 Subject: [PATCH 3/7] Add warnings when loading unknown texture options --- apps/openmw/engine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 86ccb7b3b3..eeba6e65ca 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -461,6 +461,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) min = osg::Texture::NEAREST; mag = osg::Texture::NEAREST; } + else if(filter != "linear") + std::cerr<< "Invalid texture filtering option: "< Date: Sun, 13 Dec 2015 16:02:09 -0800 Subject: [PATCH 4/7] Rename the texture filter options To avoid compatibility issues with upgrading from or downgrading to older builds. --- apps/openmw/engine.cpp | 8 ++++---- apps/openmw/mwgui/settingswindow.cpp | 6 +++--- apps/openmw/mwrender/renderingmanager.cpp | 8 ++++---- files/settings-default.cfg | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index eeba6e65ca..1441f8b4f5 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -455,16 +455,16 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) osg::Texture::FilterMode min = osg::Texture::LINEAR; osg::Texture::FilterMode mag = osg::Texture::LINEAR; - std::string filter = Settings::Manager::getString("texture filtering", "General"); + std::string filter = Settings::Manager::getString("texture filter", "General"); if(filter == "nearest") { min = osg::Texture::NEAREST; mag = osg::Texture::NEAREST; } else if(filter != "linear") - std::cerr<< "Invalid texture filtering option: "<setCaption(textureMipmappingToStr(tmip)); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")"); @@ -427,9 +427,9 @@ namespace MWGui void SettingsWindow::onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos) { if(pos == 0) - Settings::Manager::setString("texture mipmapping", "General", "nearest"); + Settings::Manager::setString("texture mipmap", "General", "nearest"); else if(pos == 1) - Settings::Manager::setString("texture mipmapping", "General", "linear"); + Settings::Manager::setString("texture mipmap", "General", "linear"); else std::cerr<< "Unexpected option pos "<setFogEnd(mViewDistance); updateProjectionMatrix(); } - else if (it->first == "General" && (it->second == "texture filtering" || - it->second == "texture mipmapping" || + else if (it->first == "General" && (it->second == "texture filter" || + it->second == "texture mipmap" || it->second == "anisotropy")) updateTextureFiltering(); else if (it->first == "Water") diff --git a/files/settings-default.cfg b/files/settings-default.cfg index c9132dadad..b77b95c52b 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -110,11 +110,11 @@ anisotropy = 4 # File format for screenshots. (jpg, png, tga, and possibly more). screenshot format = png -# Texture filtering. (nearest or linear). -texture filtering = linear +# Texture filter type. (nearest or linear). +texture filter = linear -# Texture mipmapping. (none, nearest, or linear). -texture mipmapping = nearest +# Texture mipmap type. (none, nearest, or linear). +texture mipmap = nearest [Input] From 5c0a847eafb2c3c31850870709d65b3ee8631254 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Dec 2015 16:51:27 -0800 Subject: [PATCH 5/7] Combine some duplicate code --- apps/openmw/engine.cpp | 39 ++++------------------- apps/openmw/mwrender/renderingmanager.cpp | 37 ++++----------------- components/resource/texturemanager.cpp | 36 +++++++++++++++++++++ components/resource/texturemanager.hpp | 12 +++++-- 4 files changed, 58 insertions(+), 66 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 1441f8b4f5..50f097ce72 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -451,39 +451,12 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get())); mResourceSystem->getTextureManager()->setUnRefImageDataAfterApply(true); - { - osg::Texture::FilterMode min = osg::Texture::LINEAR; - osg::Texture::FilterMode mag = osg::Texture::LINEAR; - - std::string filter = Settings::Manager::getString("texture filter", "General"); - if(filter == "nearest") - { - min = osg::Texture::NEAREST; - mag = osg::Texture::NEAREST; - } - else if(filter != "linear") - std::cerr<< "Invalid texture filter option: "<getTextureManager()->setFilterSettings(min, mag, maxAnisotropy); - } + mResourceSystem->getTextureManager()->setFilterSettings( + Settings::Manager::getString("texture filter", "General"), + Settings::Manager::getString("texture mipmap", "General"), + Settings::Manager::getInt("anisotropy", "General"), + NULL + ); // Create input and UI first to set up a bootstrapping environment for // showing a loading screen and keeping the window responsive while doing so diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index edc877ad43..ceea7ce970 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -781,37 +781,12 @@ namespace MWRender void RenderingManager::updateTextureFiltering() { - osg::Texture::FilterMode min = osg::Texture::LINEAR; - osg::Texture::FilterMode mag = osg::Texture::LINEAR; - - std::string filter = Settings::Manager::getString("texture filter", "General"); - if(filter == "nearest") - { - min = osg::Texture::NEAREST; - mag = osg::Texture::NEAREST; - } - - std::string mipmap = Settings::Manager::getString("texture mipmap", "General"); - if(mipmap == "nearest") - { - if(min == osg::Texture::NEAREST) - min = osg::Texture::NEAREST_MIPMAP_NEAREST; - else if(min == osg::Texture::LINEAR) - min = osg::Texture::LINEAR_MIPMAP_NEAREST; - } - else if(mipmap != "none") - { - if(min == osg::Texture::NEAREST) - min = osg::Texture::NEAREST_MIPMAP_LINEAR; - else if(min == osg::Texture::LINEAR) - min = osg::Texture::LINEAR_MIPMAP_LINEAR; - } - - int maxAnisotropy = Settings::Manager::getInt("anisotropy", "General"); - - mViewer->stopThreading(); - mResourceSystem->getTextureManager()->setFilterSettings(min, mag, maxAnisotropy); - mViewer->startThreading(); + mResourceSystem->getTextureManager()->setFilterSettings( + Settings::Manager::getString("texture filter", "General"), + Settings::Manager::getString("texture mipmap", "General"), + Settings::Manager::getInt("anisotropy", "General"), + mViewer + ); } void RenderingManager::updateAmbient() diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index 15ac375142..ea9e7ae5d5 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -65,6 +66,41 @@ namespace Resource mUnRefImageDataAfterApply = unref; } + void TextureManager::setFilterSettings(const std::string &filter, const std::string &mipmap, int maxAnisotropy, osgViewer::Viewer *viewer) + { + osg::Texture::FilterMode min = osg::Texture::LINEAR; + osg::Texture::FilterMode mag = osg::Texture::LINEAR; + + if(filter == "nearest") + { + min = osg::Texture::NEAREST; + mag = osg::Texture::NEAREST; + } + else if(filter != "linear") + std::cerr<< "Invalid texture filter: "<stopThreading(); + setFilterSettings(min, mag, maxAnisotropy); + if(viewer) viewer->startThreading(); + } + void TextureManager::setFilterSettings(osg::Texture::FilterMode minFilter, osg::Texture::FilterMode magFilter, int maxAnisotropy) { mMinFilter = minFilter; diff --git a/components/resource/texturemanager.hpp b/components/resource/texturemanager.hpp index 0f40d7dfec..c7b4d4f595 100644 --- a/components/resource/texturemanager.hpp +++ b/components/resource/texturemanager.hpp @@ -8,6 +8,11 @@ #include #include +namespace osgViewer +{ + class Viewer; +} + namespace VFS { class Manager; @@ -23,8 +28,8 @@ namespace Resource TextureManager(const VFS::Manager* vfs); ~TextureManager(); - /// @warning It is unsafe to call this function when a draw thread is using the textures. Call stopThreading() first! - void setFilterSettings(osg::Texture::FilterMode minFilter, osg::Texture::FilterMode maxFilter, int maxAnisotropy); + void setFilterSettings(const std::string &filter, const std::string &mipmap, int maxAnisotropy, + osgViewer::Viewer *view); /// Keep a copy of the texture data around in system memory? This is needed when using multiple graphics contexts, /// otherwise should be disabled to reduce memory usage. @@ -58,6 +63,9 @@ namespace Resource bool mUnRefImageDataAfterApply; + /// @warning It is unsafe to call this function when a draw thread is using the textures. Call stopThreading() first! + void setFilterSettings(osg::Texture::FilterMode minFilter, osg::Texture::FilterMode maxFilter, int maxAnisotropy); + TextureManager(const TextureManager&); void operator = (const TextureManager&); }; From f1faeeae3a765c3967270c36239fd84f5d798205 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Dec 2015 17:05:19 -0800 Subject: [PATCH 6/7] Use separate config options for min and mag texture filters --- apps/openmw/engine.cpp | 3 ++- apps/openmw/mwrender/renderingmanager.cpp | 3 ++- components/resource/texturemanager.cpp | 18 +++++++++++------- components/resource/texturemanager.hpp | 3 ++- files/settings-default.cfg | 7 +++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 50f097ce72..b43fd2f530 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -452,7 +452,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get())); mResourceSystem->getTextureManager()->setUnRefImageDataAfterApply(true); mResourceSystem->getTextureManager()->setFilterSettings( - Settings::Manager::getString("texture filter", "General"), + Settings::Manager::getString("texture mag filter", "General"), + Settings::Manager::getString("texture min filter", "General"), Settings::Manager::getString("texture mipmap", "General"), Settings::Manager::getInt("anisotropy", "General"), NULL diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index ceea7ce970..b44d777220 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -782,7 +782,8 @@ namespace MWRender void RenderingManager::updateTextureFiltering() { mResourceSystem->getTextureManager()->setFilterSettings( - Settings::Manager::getString("texture filter", "General"), + Settings::Manager::getString("texture mag filter", "General"), + Settings::Manager::getString("texture min filter", "General"), Settings::Manager::getString("texture mipmap", "General"), Settings::Manager::getInt("anisotropy", "General"), mViewer diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index ea9e7ae5d5..d7f3fc61a1 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -66,18 +66,22 @@ namespace Resource mUnRefImageDataAfterApply = unref; } - void TextureManager::setFilterSettings(const std::string &filter, const std::string &mipmap, int maxAnisotropy, osgViewer::Viewer *viewer) + void TextureManager::setFilterSettings(const std::string &magfilter, const std::string &minfilter, + const std::string &mipmap, int maxAnisotropy, + osgViewer::Viewer *viewer) { osg::Texture::FilterMode min = osg::Texture::LINEAR; osg::Texture::FilterMode mag = osg::Texture::LINEAR; - if(filter == "nearest") - { - min = osg::Texture::NEAREST; + if(magfilter == "nearest") mag = osg::Texture::NEAREST; - } - else if(filter != "linear") - std::cerr<< "Invalid texture filter: "< Date: Sun, 13 Dec 2015 17:13:36 -0800 Subject: [PATCH 7/7] Remove left over declaration --- apps/openmw/mwgui/settingswindow.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 5910f07e00..99553808b4 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -53,7 +53,6 @@ namespace MWGui void onTabChanged(MyGUI::TabControl* _sender, size_t index); void onOkButtonClicked(MyGUI::Widget* _sender); void onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos); - void onTextureMipmappingChanged(MyGUI::ComboBox* _sender, size_t pos); void onSliderChangePosition(MyGUI::ScrollBar* scroller, size_t pos); void onButtonToggled(MyGUI::Widget* _sender); void onResolutionSelected(MyGUI::ListBox* _sender, size_t index);