1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

address review comments

This commit is contained in:
wareya 2021-10-31 15:32:24 -04:00
parent e1378cd290
commit 838fc634c6
2 changed files with 6 additions and 5 deletions

View File

@ -396,14 +396,14 @@ namespace MWGui
void SettingsWindow::onWaterReflectionDetailChanged(MyGUI::ComboBox* _sender, size_t pos)
{
unsigned int level = std::min(unsigned int(pos), unsigned int(5));
unsigned int level = unsigned int(std::min<size_t>(pos, 5));
Settings::Manager::setInt("reflection detail", "Water", level);
apply();
}
void SettingsWindow::onWaterRainRippleDetailChanged(MyGUI::ComboBox* _sender, size_t pos)
{
unsigned int level = std::min(unsigned int(pos), unsigned int(2));
unsigned int level = unsigned int(std::min<size_t>(pos, 2));
Settings::Manager::setInt("rain ripple detail", "Water", level);
apply();
}

View File

@ -647,9 +647,10 @@ void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, R
{
// use a define map to conditionally compile the shader
std::map<std::string, std::string> defineMap;
defineMap.insert(std::make_pair(std::string("refraction_enabled"), std::string(mRefraction ? "1" : "0")));
unsigned int rippleDetail = std::clamp(Settings::Manager::getInt("rain ripple detail", "Water"), 0, 2);
defineMap.insert(std::make_pair(std::string("rain_ripple_detail"), Misc::StringUtils::format("%u", rippleDetail)));
defineMap["refraction_enabled"] = std::string(mRefraction ? "1" : "0");
const auto rippleDetail = std::clamp(Settings::Manager::getInt("rain ripple detail", "Water"), 0, 2);
defineMap["rain_ripple_detail"] = std::to_string(rippleDetail);
Shader::ShaderManager& shaderMgr = mResourceSystem->getSceneManager()->getShaderManager();
osg::ref_ptr<osg::Shader> vertexShader(shaderMgr.getShader("water_vertex.glsl", defineMap, osg::Shader::VERTEX));