1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 17:15:32 +00:00

fix rain delay when exiting water

When the particle system updates its internal state noting that it's
been culled, it stops emitting any further particles. Prevent it from
having that knowledge.

v2: Fix off-by-one-frame error following review by @AnyOldName3
This commit is contained in:
Stanislaw Halik 2018-11-04 12:42:34 +01:00
parent c114e1278e
commit 8fd71fe4ad
3 changed files with 19 additions and 2 deletions

View file

@ -1,6 +1,7 @@
0.46.0
------
Bug #4540: Rain delay when exiting water
Feature #2229: Improve pathfinding AI
Feature #3442: Default values for fallbacks from ini file
Task #4686: Upgrade media decoder to a more current FFmpeg API

View file

@ -401,11 +401,15 @@ public:
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
bool isUnderwater()
{
osg::Vec3f eyePoint = mCameraRelativeTransform->getLastEyePoint();
return mEnabled && eyePoint.z() < mWaterLevel;
}
if (mEnabled && eyePoint.z() < mWaterLevel)
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (isUnderwater())
return;
traverse(node, nv);
@ -1575,6 +1579,8 @@ void SkyManager::update(float duration)
mRainIntensityUniform->set((float) mWeatherAlpha);
}
switchUnderwaterRain();
if (mIsStorm)
{
osg::Quat quat;
@ -1626,6 +1632,15 @@ void SkyManager::updateRainParameters()
}
}
void SkyManager::switchUnderwaterRain()
{
if (!mRainParticleSystem)
return;
bool freeze = mUnderwaterSwitch->isUnderwater();
mRainParticleSystem->setFrozen(freeze);
}
void SkyManager::setWeather(const WeatherResult& weather)
{
if (!mCreated) return;

View file

@ -180,6 +180,7 @@ namespace MWRender
void createRain();
void destroyRain();
void switchUnderwaterRain();
void updateRainParameters();
Resource::SceneManager* mSceneManager;