Simplify the in-game texture options

This makes it behave like it originally did, although the config options remain
expanded.
openmw-38
Chris Robinson 9 years ago
parent 76bde5ee13
commit fb6abb53ae

@ -35,22 +35,13 @@ namespace
return "#{sOn}"; return "#{sOn}";
} }
std::string textureFilteringToStr(const std::string& val)
{
if (val == "nearest")
return "Nearest";
else
return "Linear";
}
std::string textureMipmappingToStr(const std::string& val) std::string textureMipmappingToStr(const std::string& val)
{ {
if (val == "linear") if (val == "linear") return "Trilinear";
return "Linear"; if (val == "nearest") return "Bilinear";
else if (val == "none") if (val != "none")
return "None"; std::cerr<< "Invalid texture mipmap option: "<<val <<std::endl;
else return "Other";
return "Nearest";
} }
void parseResolution (int &x, int &y, const std::string& str) void parseResolution (int &x, int &y, const std::string& str)
@ -179,7 +170,6 @@ namespace MWGui
getWidget(mFOVSlider, "FOVSlider"); getWidget(mFOVSlider, "FOVSlider");
getWidget(mAnisotropySlider, "AnisotropySlider"); getWidget(mAnisotropySlider, "AnisotropySlider");
getWidget(mTextureFilteringButton, "TextureFilteringButton"); getWidget(mTextureFilteringButton, "TextureFilteringButton");
getWidget(mTextureMipmappingButton, "TextureMipmappingButton");
getWidget(mAnisotropyLabel, "AnisotropyLabel"); getWidget(mAnisotropyLabel, "AnisotropyLabel");
getWidget(mAnisotropyBox, "AnisotropyBox"); getWidget(mAnisotropyBox, "AnisotropyBox");
getWidget(mShadersButton, "ShadersButton"); getWidget(mShadersButton, "ShadersButton");
@ -211,7 +201,6 @@ namespace MWGui
mSettingsTab->eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged); mSettingsTab->eventTabChangeSelect += MyGUI::newDelegate(this, &SettingsWindow::onTabChanged);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged);
mTextureMipmappingButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureMipmappingChanged);
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged); mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged);
@ -247,10 +236,8 @@ namespace MWGui
} }
highlightCurrentResolution(); highlightCurrentResolution();
std::string tf = Settings::Manager::getString("texture filtering", "General");
mTextureFilteringButton->setCaption(textureFilteringToStr(tf));
std::string tmip = Settings::Manager::getString("texture mipmapping", "General"); 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")) + ")"); mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")");
int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water"); int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
@ -439,13 +426,12 @@ namespace MWGui
void SettingsWindow::onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos) void SettingsWindow::onTextureFilteringChanged(MyGUI::ComboBox* _sender, size_t pos)
{ {
Settings::Manager::setString("texture filtering", "General", Misc::StringUtils::lowerCase(_sender->getItemNameAt(pos))); if(pos == 0)
apply(); Settings::Manager::setString("texture mipmapping", "General", "nearest");
} else if(pos == 1)
Settings::Manager::setString("texture mipmapping", "General", "linear");
void SettingsWindow::onTextureMipmappingChanged(MyGUI::ComboBox* _sender, size_t pos) else
{ std::cerr<< "Unexpected option pos "<<pos <<std::endl;
Settings::Manager::setString("texture mipmapping", "General", Misc::StringUtils::lowerCase(_sender->getItemNameAt(pos)));
apply(); apply();
} }

@ -34,7 +34,6 @@ namespace MWGui
MyGUI::ScrollBar* mDifficultySlider; MyGUI::ScrollBar* mDifficultySlider;
MyGUI::ScrollBar* mAnisotropySlider; MyGUI::ScrollBar* mAnisotropySlider;
MyGUI::ComboBox* mTextureFilteringButton; MyGUI::ComboBox* mTextureFilteringButton;
MyGUI::ComboBox* mTextureMipmappingButton;
MyGUI::TextBox* mAnisotropyLabel; MyGUI::TextBox* mAnisotropyLabel;
MyGUI::Widget* mAnisotropyBox; MyGUI::Widget* mAnisotropyBox;
MyGUI::Button* mShadersButton; MyGUI::Button* mShadersButton;

@ -322,18 +322,10 @@
<Property key="Caption" value="Texture filtering"/> <Property key="Caption" value="Texture filtering"/>
</Widget> </Widget>
<Widget type="ComboBox" skin="MW_ComboBox" position="14 28 110 24" align="Left Top" name="TextureFilteringButton"> <Widget type="ComboBox" skin="MW_ComboBox" position="14 28 110 24" align="Left Top" name="TextureFilteringButton">
<Property key="AddItem" value="Nearest"/> <Property key="AddItem" value="Bilinear"/>
<Property key="AddItem" value="Linear"/> <Property key="AddItem" value="Trilinear"/>
</Widget> </Widget>
<Widget type="TextBox" skin="NormalText" position="184 4 300 24" align="Left Top"> <Widget type="Widget" skin="" position="184 4 300 50" align="Left Top" name="AnisotropyBox">
<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"> <Widget type="TextBox" skin="SandText" position="0 0 300 24" align="Left Top" name="AnisotropyLabel">
<Property key="Caption" value="Anisotropy"/> <Property key="Caption" value="Anisotropy"/>
</Widget> </Widget>

Loading…
Cancel
Save