diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp
index 6c360acf6..86ccb7b3b 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 78ff96532..72c004271 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 99553808b..da9c8628e 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 4b208fa94..f66398d2f 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 6d2424aa5..df268eec4 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 a5fd3cccd..c9132dada 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]