Use fallback weather ripple settings (bug #7292)

macos_ci_fix
Alexei Kotov 1 year ago
parent dff86dc1e2
commit 099c39ae87

@ -70,6 +70,7 @@
Bug #7229: Error marker loading failure is not handled
Bug #7243: Supporting loading external files from VFS from esm files
Bug #7284: "Your weapon has no effect." message doesn't always show when the player character attempts to attack
Bug #7292: Weather settings for disabling or enabling snow and rain ripples don't work
Bug #7298: Water ripples from projectiles sometimes are not spawned
Bug #7307: Alchemy "Magic Effect" search string does not match on tool tip for effects related to attributes
Bug #7322: Shadows don't cover groundcover depending on the view angle and perspective with compute scene bounds = primitives

@ -847,6 +847,7 @@ namespace MWRender
float rainIntensity = mSky->getPrecipitationAlpha();
mWater->setRainIntensity(rainIntensity);
mWater->setRainRipplesEnabled(mSky->getRainRipplesEnabled());
mWater->update(dt, paused);
if (!paused)

@ -257,6 +257,7 @@ namespace MWRender
, mRainMaxHeight(0.f)
, mRainEntranceSpeed(1.f)
, mRainMaxRaindrops(0)
, mRipples(false)
, mWindSpeed(0.f)
, mBaseWindSpeed(0.f)
, mEnabled(true)
@ -516,6 +517,11 @@ namespace MWRender
return mRainNode != nullptr;
}
bool SkyManager::getRainRipplesEnabled() const
{
return mRipples;
}
float SkyManager::getPrecipitationAlpha() const
{
if (mEnabled && !mIsStorm && (hasRain() || mParticleNode))
@ -630,6 +636,7 @@ namespace MWRender
mRainMinHeight = weather.mRainMinHeight;
mRainMaxHeight = weather.mRainMaxHeight;
mRainSpeed = weather.mRainSpeed;
mRipples = weather.mRipples;
mWindSpeed = weather.mWindSpeed;
mBaseWindSpeed = weather.mBaseWindSpeed;

@ -79,6 +79,8 @@ namespace MWRender
bool hasRain() const;
bool getRainRipplesEnabled() const;
float getPrecipitationAlpha() const;
void setRainSpeed(float speed);
@ -194,6 +196,7 @@ namespace MWRender
float mRainMaxHeight;
float mRainEntranceSpeed;
int mRainMaxRaindrops;
bool mRipples;
float mWindSpeed;
float mBaseWindSpeed;

@ -77,6 +77,7 @@ namespace MWRender
float mRainSpeed;
float mRainEntranceSpeed;
int mRainMaxRaindrops;
bool mRipples;
osg::Vec3f mStormDirection;
osg::Vec3f mNextStormDirection;

@ -205,21 +205,25 @@ namespace MWRender
}
};
class RainIntensityUpdater : public SceneUtil::StateSetUpdater
class RainSettingsUpdater : public SceneUtil::StateSetUpdater
{
public:
RainIntensityUpdater()
RainSettingsUpdater()
: mRainIntensity(0.f)
, mEnableRipples(false)
{
}
void setRainIntensity(float rainIntensity) { mRainIntensity = rainIntensity; }
void setRipplesEnabled(bool enableRipples) { mEnableRipples = enableRipples; }
protected:
void setDefaults(osg::StateSet* stateset) override
{
osg::ref_ptr<osg::Uniform> rainIntensityUniform = new osg::Uniform("rainIntensity", 0.0f);
stateset->addUniform(rainIntensityUniform.get());
osg::ref_ptr<osg::Uniform> enableRainRipplesUniform = new osg::Uniform("enableRainRipples", false);
stateset->addUniform(enableRainRipplesUniform.get());
}
void apply(osg::StateSet* stateset, osg::NodeVisitor* /*nv*/) override
@ -227,10 +231,14 @@ namespace MWRender
osg::ref_ptr<osg::Uniform> rainIntensityUniform = stateset->getUniform("rainIntensity");
if (rainIntensityUniform != nullptr)
rainIntensityUniform->set(mRainIntensity);
osg::ref_ptr<osg::Uniform> enableRainRipplesUniform = stateset->getUniform("enableRainRipples");
if (enableRainRipplesUniform != nullptr)
enableRainRipplesUniform->set(mEnableRipples);
}
private:
float mRainIntensity;
bool mEnableRipples;
};
class Refraction : public SceneUtil::RTTNode
@ -430,7 +438,7 @@ namespace MWRender
Water::Water(osg::Group* parent, osg::Group* sceneRoot, Resource::ResourceSystem* resourceSystem,
osgUtil::IncrementalCompileOperation* ico)
: mRainIntensityUpdater(nullptr)
: mRainSettingsUpdater(nullptr)
, mParent(parent)
, mSceneRoot(sceneRoot)
, mResourceSystem(resourceSystem)
@ -579,7 +587,7 @@ namespace MWRender
node->setStateSet(stateset);
node->setUpdateCallback(nullptr);
mRainIntensityUpdater = nullptr;
mRainSettingsUpdater = nullptr;
// Add animated textures
std::vector<osg::ref_ptr<osg::Texture2D>> textures;
@ -711,8 +719,8 @@ namespace MWRender
normalMap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
normalMap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
mRainIntensityUpdater = new RainIntensityUpdater();
node->setUpdateCallback(mRainIntensityUpdater);
mRainSettingsUpdater = new RainSettingsUpdater();
node->setUpdateCallback(mRainSettingsUpdater);
mShaderWaterStateSetUpdater
= new ShaderWaterStateSetUpdater(this, mReflection, mRefraction, mRipples, std::move(program), normalMap);
@ -801,8 +809,14 @@ namespace MWRender
void Water::setRainIntensity(float rainIntensity)
{
if (mRainIntensityUpdater)
mRainIntensityUpdater->setRainIntensity(rainIntensity);
if (mRainSettingsUpdater)
mRainSettingsUpdater->setRainIntensity(rainIntensity);
}
void Water::setRainRipplesEnabled(bool enableRipples)
{
if (mRainSettingsUpdater)
mRainSettingsUpdater->setRipplesEnabled(enableRipples);
}
void Water::update(float dt, bool paused)

@ -46,13 +46,13 @@ namespace MWRender
class Refraction;
class Reflection;
class RippleSimulation;
class RainIntensityUpdater;
class RainSettingsUpdater;
class Ripples;
/// Water rendering
class Water
{
osg::ref_ptr<RainIntensityUpdater> mRainIntensityUpdater;
osg::ref_ptr<RainSettingsUpdater> mRainSettingsUpdater;
osg::ref_ptr<osg::Group> mParent;
osg::ref_ptr<osg::Group> mSceneRoot;
@ -113,6 +113,7 @@ namespace MWRender
void changeCell(const MWWorld::CellStore* store);
void setHeight(const float height);
void setRainIntensity(const float rainIntensity);
void setRainRipplesEnabled(bool enableRipples);
void update(float dt, bool paused);

@ -175,6 +175,7 @@ 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"))
@ -1129,6 +1130,7 @@ 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;
@ -1241,6 +1243,7 @@ namespace MWWorld
mResult.mRainMinHeight = current.mRainMinHeight;
mResult.mRainMaxHeight = current.mRainMaxHeight;
mResult.mRainMaxRaindrops = current.mRainMaxRaindrops;
mResult.mRipples = current.mRipples;
}
else
{
@ -1257,6 +1260,7 @@ namespace MWWorld
mResult.mRainMinHeight = other.mRainMinHeight;
mResult.mRainMaxHeight = other.mRainMaxHeight;
mResult.mRainMaxRaindrops = other.mRainMaxRaindrops;
mResult.mRipples = other.mRipples;
}
}
}

@ -191,6 +191,8 @@ namespace MWWorld
std::string mRainEffect;
bool mRipples;
osg::Vec3f mStormDirection;
float mCloudsMaximumPercent;

@ -11,7 +11,10 @@ static const std::set<std::string_view> 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_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" };
static const std::set<std::string_view> allowedKeysFloat = { "General_Werewolf_FOV", "Inventory_DirectionalAmbientB",
"Inventory_DirectionalAmbientG", "Inventory_DirectionalAmbientR", "Inventory_DirectionalDiffuseB",
@ -160,7 +163,7 @@ static const std::set<std::string_view> allowedKeysNonNumeric = { "Blood_Model_0
"Weather_Rain_Ambient_Sunrise_Color", "Weather_Rain_Ambient_Sunset_Color", "Weather_Rain_Cloud_Texture",
"Weather_Rain_Fog_Day_Color", "Weather_Rain_Fog_Night_Color", "Weather_Rain_Fog_Sunrise_Color",
"Weather_Rain_Fog_Sunset_Color", "Weather_Rain_Rain_Loop_Sound_ID", "Weather_Rain_Ripple_Radius",
"Weather_Rain_Ripples", "Weather_Rain_Ripple_Scale", "Weather_Rain_Ripple_Speed", "Weather_Rain_Ripples_Per_Drop",
"Weather_Rain_Ripple_Scale", "Weather_Rain_Ripple_Speed", "Weather_Rain_Ripples_Per_Drop",
"Weather_Rain_Sky_Day_Color", "Weather_Rain_Sky_Night_Color", "Weather_Rain_Sky_Sunrise_Color",
"Weather_Rain_Sky_Sunset_Color", "Weather_Rain_Sun_Day_Color", "Weather_Rain_Sun_Disc_Sunset_Color",
"Weather_Rain_Sun_Night_Color", "Weather_Rain_Sun_Sunrise_Color", "Weather_Rain_Sun_Sunset_Color",
@ -168,7 +171,7 @@ static const std::set<std::string_view> allowedKeysNonNumeric = { "Blood_Model_0
"Weather_Snow_Ambient_Sunrise_Color", "Weather_Snow_Ambient_Sunset_Color", "Weather_Snow_Cloud_Texture",
"Weather_Snow_Fog_Day_Color", "Weather_Snow_Fog_Night_Color", "Weather_Snow_Fog_Sunrise_Color",
"Weather_Snow_Fog_Sunset_Color", "Weather_Snow_Gravity_Scale", "Weather_Snow_High_Kill", "Weather_Snow_Low_Kill",
"Weather_Snow_Max_Snowflakes", "Weather_Snow_Ripple_Radius", "Weather_Snow_Ripples", "Weather_Snow_Ripple_Scale",
"Weather_Snow_Max_Snowflakes", "Weather_Snow_Ripple_Radius", "Weather_Snow_Ripple_Scale",
"Weather_Snow_Ripple_Speed", "Weather_Snow_Ripples_Per_Flake", "Weather_Snow_Sky_Day_Color",
"Weather_Snow_Sky_Night_Color", "Weather_Snow_Sky_Sunrise_Color", "Weather_Snow_Sky_Sunset_Color",
"Weather_Snow_Snow_Diameter", "Weather_Snow_Snow_Entrance_Speed", "Weather_Snow_Snow_Height_Max",

@ -81,6 +81,7 @@ uniform float near;
uniform float far;
uniform float rainIntensity;
uniform bool enableRainRipples;
uniform vec2 screenRes;
@ -113,7 +114,7 @@ void main(void)
vec4 rainRipple;
if (rainIntensity > 0.01)
if (rainIntensity > 0.01 && enableRainRipples)
rainRipple = rainCombined(position.xy/1000.0, waterTimer) * clamp(rainIntensity, 0.0, 1.0);
else
rainRipple = vec4(0.0);

Loading…
Cancel
Save