forked from mirror/openmw-tes3mp
Separate and expand texture filtering options
This commit is contained in:
parent
a7e0562e1c
commit
76bde5ee13
6 changed files with 96 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -322,10 +322,18 @@
|
|||
<Property key="Caption" value="Texture filtering"/>
|
||||
</Widget>
|
||||
<Widget type="ComboBox" skin="MW_ComboBox" position="14 28 110 24" align="Left Top" name="TextureFilteringButton">
|
||||
<Property key="AddItem" value="Bilinear"/>
|
||||
<Property key="AddItem" value="Trilinear"/>
|
||||
<Property key="AddItem" value="Nearest"/>
|
||||
<Property key="AddItem" value="Linear"/>
|
||||
</Widget>
|
||||
<Widget type="Widget" skin="" position="184 4 300 50" align="Left Top" name="AnisotropyBox">
|
||||
<Widget type="TextBox" skin="NormalText" position="184 4 300 24" align="Left Top">
|
||||
<Property key="Caption" value="Mipmapping"/>
|
||||
</Widget>
|
||||
<Widget type="ComboBox" skin="MW_ComboBox" position="194 28 110 24" align="Left Top" name="TextureMipmappingButton">
|
||||
<Property key="AddItem" value="None"/>
|
||||
<Property key="AddItem" value="Nearest"/>
|
||||
<Property key="AddItem" value="Linear"/>
|
||||
</Widget>
|
||||
<Widget type="Widget" skin="" position="4 64 300 50" align="Left Top" name="AnisotropyBox">
|
||||
<Widget type="TextBox" skin="SandText" position="0 0 300 24" align="Left Top" name="AnisotropyLabel">
|
||||
<Property key="Caption" value="Anisotropy"/>
|
||||
</Widget>
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
Loading…
Reference in a new issue