From 640fa53bb82ce4ef079d91daf22e7b037b785bfd Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 30 Dec 2023 04:00:20 +0300 Subject: [PATCH] Make rain and snow ripple settings global rather than per-weather (#7748) --- apps/openmw/mwrender/sky.cpp | 15 ++++++++++++--- apps/openmw/mwrender/sky.hpp | 3 ++- apps/openmw/mwrender/skyutil.hpp | 1 - apps/openmw/mwworld/weather.cpp | 4 ---- apps/openmw/mwworld/weather.hpp | 2 -- components/fallback/validate.cpp | 6 ++---- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 87c6d1f2e7..6df3734252 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -257,7 +257,8 @@ namespace MWRender , mRainMaxHeight(0.f) , mRainEntranceSpeed(1.f) , mRainMaxRaindrops(0) - , mRipples(false) + , mRainRipplesEnabled(Fallback::Map::getBool("Weather_Rain_Ripples")) + , mSnowRipplesEnabled(Fallback::Map::getBool("Weather_Snow_Ripples")) , mWindSpeed(0.f) , mBaseWindSpeed(0.f) , mEnabled(true) @@ -519,7 +520,16 @@ namespace MWRender bool SkyManager::getRainRipplesEnabled() const { - return mRipples; + if (!mEnabled || mIsStorm) + return false; + + if (hasRain()) + return mRainRipplesEnabled; + + if (mParticleNode && mCurrentParticleEffect == "meshes\\snow.nif") + return mSnowRipplesEnabled; + + return false; } float SkyManager::getPrecipitationAlpha() const @@ -636,7 +646,6 @@ namespace MWRender mRainMinHeight = weather.mRainMinHeight; mRainMaxHeight = weather.mRainMaxHeight; mRainSpeed = weather.mRainSpeed; - mRipples = weather.mRipples; mWindSpeed = weather.mWindSpeed; mBaseWindSpeed = weather.mBaseWindSpeed; diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index 9e4801ad7d..96af2e6ec9 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -196,7 +196,8 @@ namespace MWRender float mRainMaxHeight; float mRainEntranceSpeed; int mRainMaxRaindrops; - bool mRipples; + bool mRainRipplesEnabled; + bool mSnowRipplesEnabled; float mWindSpeed; float mBaseWindSpeed; diff --git a/apps/openmw/mwrender/skyutil.hpp b/apps/openmw/mwrender/skyutil.hpp index 9e279fb5c2..1018724595 100644 --- a/apps/openmw/mwrender/skyutil.hpp +++ b/apps/openmw/mwrender/skyutil.hpp @@ -77,7 +77,6 @@ namespace MWRender float mRainSpeed; float mRainEntranceSpeed; int mRainMaxRaindrops; - bool mRipples; osg::Vec3f mStormDirection; osg::Vec3f mNextStormDirection; diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 5e2d7d3fec..aa75730b40 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -175,7 +175,6 @@ namespace MWWorld , mRainMaxHeight(Fallback::Map::getFloat("Weather_" + name + "_Rain_Height_Max")) , mParticleEffect(particleEffect) , mRainEffect(Fallback::Map::getBool("Weather_" + name + "_Using_Precip") ? "meshes\\raindrop.nif" : "") - , mRipples(Fallback::Map::getBool("Weather_" + name + "_Ripples")) , mStormDirection(Weather::defaultDirection()) , mCloudsMaximumPercent(Fallback::Map::getFloat("Weather_" + name + "_Clouds_Maximum_Percent")) , mTransitionDelta(Fallback::Map::getFloat("Weather_" + name + "_Transition_Delta")) @@ -1130,7 +1129,6 @@ namespace MWWorld mResult.mRainMinHeight = current.mRainMinHeight; mResult.mRainMaxHeight = current.mRainMaxHeight; mResult.mRainMaxRaindrops = current.mRainMaxRaindrops; - mResult.mRipples = current.mRipples; mResult.mParticleEffect = current.mParticleEffect; mResult.mRainEffect = current.mRainEffect; @@ -1243,7 +1241,6 @@ namespace MWWorld mResult.mRainMinHeight = current.mRainMinHeight; mResult.mRainMaxHeight = current.mRainMaxHeight; mResult.mRainMaxRaindrops = current.mRainMaxRaindrops; - mResult.mRipples = current.mRipples; } else { @@ -1260,7 +1257,6 @@ namespace MWWorld mResult.mRainMinHeight = other.mRainMinHeight; mResult.mRainMaxHeight = other.mRainMaxHeight; mResult.mRainMaxRaindrops = other.mRainMaxRaindrops; - mResult.mRipples = other.mRipples; } } } diff --git a/apps/openmw/mwworld/weather.hpp b/apps/openmw/mwworld/weather.hpp index d40f7030c8..65f926c096 100644 --- a/apps/openmw/mwworld/weather.hpp +++ b/apps/openmw/mwworld/weather.hpp @@ -191,8 +191,6 @@ namespace MWWorld std::string mRainEffect; - bool mRipples; - osg::Vec3f mStormDirection; float mCloudsMaximumPercent; diff --git a/components/fallback/validate.cpp b/components/fallback/validate.cpp index 2a6d1817c9..8dfcd97570 100644 --- a/components/fallback/validate.cpp +++ b/components/fallback/validate.cpp @@ -11,10 +11,8 @@ static const std::set allowedKeysInt = { "LightAttenuation_Lin "Water_RippleFrameCount", "Water_SurfaceTileCount", "Water_SurfaceFrameCount", "Weather_Clear_Using_Precip", "Weather_Cloudy_Using_Precip", "Weather_Foggy_Using_Precip", "Weather_Overcast_Using_Precip", "Weather_Rain_Using_Precip", "Weather_Thunderstorm_Using_Precip", "Weather_Ashstorm_Using_Precip", - "Weather_Blight_Using_Precip", "Weather_Snow_Using_Precip", "Weather_Blizzard_Using_Precip", - "Weather_Clear_Ripples", "Weather_Cloudy_Ripples", "Weather_Foggy_Ripples", "Weather_Overcast_Ripples", - "Weather_Rain_Ripples", "Weather_Thunderstorm_Ripples", "Weather_Ashstorm_Ripples", "Weather_Blight_Ripples", - "Weather_Snow_Ripples", "Weather_Blizzard_Ripples" }; + "Weather_Blight_Using_Precip", "Weather_Snow_Using_Precip", "Weather_Blizzard_Using_Precip", "Weather_Rain_Ripples", + "Weather_Snow_Ripples" }; static const std::set allowedKeysFloat = { "General_Werewolf_FOV", "Inventory_DirectionalAmbientB", "Inventory_DirectionalAmbientG", "Inventory_DirectionalAmbientR", "Inventory_DirectionalDiffuseB",