Water: add texture quality setting to the settings window

openmw-37
scrawl 9 years ago
parent 60bc7dbabc
commit c9d7078b4b

@ -177,10 +177,10 @@ namespace MWGui
getWidget(mShadowsTextureSize, "ShadowsTextureSize");
getWidget(mControlsBox, "ControlsBox");
getWidget(mResetControlsButton, "ResetControlsButton");
getWidget(mRefractionButton, "RefractionButton");
getWidget(mDifficultySlider, "DifficultySlider");
getWidget(mKeyboardSwitch, "KeyboardButton");
getWidget(mControllerSwitch, "ControllerButton");
getWidget(mWaterTextureSize, "WaterTextureSize");
#ifndef WIN32
// hide gamma controls since it currently does not work under Linux
@ -204,6 +204,8 @@ namespace MWGui
mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled);
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
mWaterTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWaterTextureSizeChanged);
mShadowsTextureSize->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onShadowTextureSizeChanged);
mKeyboardSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onKeyboardSwitchClicked);
@ -239,11 +241,18 @@ namespace MWGui
mTextureFilteringButton->setCaption(textureFilteringToStr(tf));
mAnisotropyLabel->setCaption("Anisotropy (" + MyGUI::utility::toString(Settings::Manager::getInt("anisotropy", "General")) + ")");
int waterTextureSize = Settings::Manager::getInt ("rtt size", "Water");
if (waterTextureSize >= 512)
mWaterTextureSize->setIndexSelected(0);
if (waterTextureSize >= 1024)
mWaterTextureSize->setIndexSelected(1);
if (waterTextureSize >= 2048)
mWaterTextureSize->setIndexSelected(2);
mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows"));
if (!Settings::Manager::getBool("shaders", "Objects"))
{
mRefractionButton->setEnabled(false);
mShadowsEnabledButton->setEnabled(false);
}
@ -324,6 +333,19 @@ namespace MWGui
}
}
void SettingsWindow::onWaterTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos)
{
int size = 0;
if (pos == 0)
size = 512;
else if (pos == 1)
size = 1024;
else if (pos == 2)
size = 2048;
Settings::Manager::setInt("rtt size", "Water", size);
apply();
}
void SettingsWindow::onShadowTextureSizeChanged(MyGUI::ComboBox *_sender, size_t pos)
{
Settings::Manager::setString("texture size", "Shadows", _sender->getItemNameAt(pos));
@ -350,12 +372,6 @@ namespace MWGui
{
if (newState == false)
{
// refraction needs shaders to display underwater fog
mRefractionButton->setCaptionWithReplacing("#{sOff}");
mRefractionButton->setEnabled(false);
Settings::Manager::setBool("refraction", "Water", false);
// shadows not supported
mShadowsEnabledButton->setEnabled(false);
mShadowsEnabledButton->setCaptionWithReplacing("#{sOff}");
@ -363,9 +379,6 @@ namespace MWGui
}
else
{
// re-enable
mRefractionButton->setEnabled(true);
mShadowsEnabledButton->setEnabled(true);
}
}

@ -38,7 +38,8 @@ namespace MWGui
MyGUI::TextBox* mAnisotropyLabel;
MyGUI::Widget* mAnisotropyBox;
MyGUI::Button* mShadersButton;
MyGUI::Button* mRefractionButton;
MyGUI::ComboBox* mWaterTextureSize;
MyGUI::Button* mShadowsEnabledButton;
MyGUI::ComboBox* mShadowsTextureSize;
@ -61,6 +62,8 @@ namespace MWGui
void onResolutionCancel();
void highlightCurrentResolution();
void onWaterTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos);
void onShadowTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos);
void onRebindAction(MyGUI::Widget* _sender);

@ -444,7 +444,6 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
void Water::updateWaterMaterial()
{
// TODO: add ingame setting for texture quality
if (mReflection)
{
mParent->removeChild(mReflection);
@ -543,6 +542,7 @@ void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, R
shaderStateset->setTextureAttributeAndModes(3, refraction->getRefractionDepthTexture(), osg::StateAttribute::ON);
shaderStateset->addUniform(new osg::Uniform("refractionMap", 2));
shaderStateset->addUniform(new osg::Uniform("refractionDepthMap", 3));
// FIXME: zfighting with ripples
shaderStateset->setRenderBinDetails(MWRender::RenderBin_Default, "RenderBin");
}
else

@ -365,12 +365,11 @@
<UserString key="SettingType" value="CheckButton"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 75 16" align="Left Top">
<Property key="Caption" value="Reflection"/>
<Property key="Caption" value="Water shader"/>
</Widget>
</Widget>
<Widget type="Widget" skin="" position="24 32 300 230">
</Widget>
<Widget type="HBox" skin="" position="4 135 350 24">
<Widget type="HBox" skin="" position="4 0 350 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="RefractionButton">
<UserString key="SettingCategory" value="Water"/>
<UserString key="SettingName" value="refraction"/>
@ -380,6 +379,18 @@
<Property key="Caption" value="Refraction"/>
</Widget>
</Widget>
<Widget type="HBox" skin="" position="4 28 350 24">
<Widget type="ComboBox" skin="MW_ComboBox" position="0 0 85 24" align="Left Top" name="WaterTextureSize">
<Property key="AddItem" value="Low"/>
<Property key="AddItem" value="Medium"/>
<Property key="AddItem" value="High"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="64 4 90 16" align="Left Top">
<Property key="Caption" value="Texture quality"/>
</Widget>
</Widget>
</Widget>
</Widget>
<Widget type="TabItem" skin="" position="0 28 352 268">
<Property key="Caption" value=" Shadows "/>

Loading…
Cancel
Save