mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-17 17:43:07 +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
|
0.46.0
|
||||||
------
|
------
|
||||||
|
|
||||||
|
Bug #4540: Rain delay when exiting water
|
||||||
Feature #2229: Improve pathfinding AI
|
Feature #2229: Improve pathfinding AI
|
||||||
Feature #3442: Default values for fallbacks from ini file
|
Feature #3442: Default values for fallbacks from ini file
|
||||||
Task #4686: Upgrade media decoder to a more current FFmpeg API
|
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();
|
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;
|
return;
|
||||||
|
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
|
|
@ -1575,6 +1579,8 @@ void SkyManager::update(float duration)
|
||||||
mRainIntensityUniform->set((float) mWeatherAlpha);
|
mRainIntensityUniform->set((float) mWeatherAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchUnderwaterRain();
|
||||||
|
|
||||||
if (mIsStorm)
|
if (mIsStorm)
|
||||||
{
|
{
|
||||||
osg::Quat quat;
|
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)
|
void SkyManager::setWeather(const WeatherResult& weather)
|
||||||
{
|
{
|
||||||
if (!mCreated) return;
|
if (!mCreated) return;
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ namespace MWRender
|
||||||
|
|
||||||
void createRain();
|
void createRain();
|
||||||
void destroyRain();
|
void destroyRain();
|
||||||
|
void switchUnderwaterRain();
|
||||||
void updateRainParameters();
|
void updateRainParameters();
|
||||||
|
|
||||||
Resource::SceneManager* mSceneManager;
|
Resource::SceneManager* mSceneManager;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue