mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Merge pull request #2020 from sthalik/pr/fix-rain-delay
fix rain delay when exiting water
This commit is contained in:
commit
4d3a52781d
3 changed files with 19 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -180,6 +180,7 @@ namespace MWRender
|
|||
|
||||
void createRain();
|
||||
void destroyRain();
|
||||
void switchUnderwaterRain();
|
||||
void updateRainParameters();
|
||||
|
||||
Resource::SceneManager* mSceneManager;
|
||||
|
|
Loading…
Reference in a new issue