mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 03:45:32 +00:00
weather transitions (e.g. from clear to cloudy) use timescale
This commit is contained in:
parent
3ae69f792a
commit
1840401172
1 changed files with 15 additions and 11 deletions
|
@ -328,6 +328,9 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, Environmen
|
||||||
|
|
||||||
void WeatherManager::setWeather(const String& weather, bool instant)
|
void WeatherManager::setWeather(const String& weather, bool instant)
|
||||||
{
|
{
|
||||||
|
if (weather == mCurrentWeather && mNextWeather == "")
|
||||||
|
return;
|
||||||
|
|
||||||
if (instant || mFirstUpdate)
|
if (instant || mFirstUpdate)
|
||||||
{
|
{
|
||||||
mNextWeather = "";
|
mNextWeather = "";
|
||||||
|
@ -339,12 +342,12 @@ void WeatherManager::setWeather(const String& weather, bool instant)
|
||||||
if (mNextWeather != "")
|
if (mNextWeather != "")
|
||||||
{
|
{
|
||||||
// transition more than 50% finished?
|
// transition more than 50% finished?
|
||||||
if (mRemainingTransitionTime/(mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*60) <= 0.5)
|
if (mRemainingTransitionTime/(mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*3600) <= 0.5)
|
||||||
mCurrentWeather = mNextWeather;
|
mCurrentWeather = mNextWeather;
|
||||||
}
|
}
|
||||||
|
|
||||||
mNextWeather = weather;
|
mNextWeather = weather;
|
||||||
mRemainingTransitionTime = mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*60;
|
mRemainingTransitionTime = mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*3600;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +462,8 @@ WeatherResult WeatherManager::transition(float factor)
|
||||||
result.mSunDiscColor = lerp(current.mSunDiscColor, other.mSunDiscColor);
|
result.mSunDiscColor = lerp(current.mSunDiscColor, other.mSunDiscColor);
|
||||||
result.mFogDepth = lerp(current.mFogDepth, other.mFogDepth);
|
result.mFogDepth = lerp(current.mFogDepth, other.mFogDepth);
|
||||||
result.mWindSpeed = lerp(current.mWindSpeed, other.mWindSpeed);
|
result.mWindSpeed = lerp(current.mWindSpeed, other.mWindSpeed);
|
||||||
result.mCloudSpeed = lerp(current.mCloudSpeed, other.mCloudSpeed);
|
//result.mCloudSpeed = lerp(current.mCloudSpeed, other.mCloudSpeed);
|
||||||
|
result.mCloudSpeed = current.mCloudSpeed;
|
||||||
result.mCloudOpacity = lerp(current.mCloudOpacity, other.mCloudOpacity);
|
result.mCloudOpacity = lerp(current.mCloudOpacity, other.mCloudOpacity);
|
||||||
result.mGlareView = lerp(current.mGlareView, other.mGlareView);
|
result.mGlareView = lerp(current.mGlareView, other.mGlareView);
|
||||||
|
|
||||||
|
@ -470,7 +474,7 @@ WeatherResult WeatherManager::transition(float factor)
|
||||||
|
|
||||||
void WeatherManager::update(float duration)
|
void WeatherManager::update(float duration)
|
||||||
{
|
{
|
||||||
mWeatherUpdateTime -= duration;
|
mWeatherUpdateTime -= duration * mEnvironment->mWorld->getTimeScaleFactor();
|
||||||
|
|
||||||
bool exterior = (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior());
|
bool exterior = (mEnvironment->mWorld->isCellExterior() || mEnvironment->mWorld->isCellQuasiExterior());
|
||||||
|
|
||||||
|
@ -482,7 +486,7 @@ void WeatherManager::update(float duration)
|
||||||
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
|
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
|
||||||
{
|
{
|
||||||
mCurrentRegion = regionstr;
|
mCurrentRegion = regionstr;
|
||||||
mWeatherUpdateTime = WeatherGlobals::mWeatherUpdateTime*60.f;
|
mWeatherUpdateTime = WeatherGlobals::mWeatherUpdateTime*3600;
|
||||||
|
|
||||||
std::string weather;
|
std::string weather;
|
||||||
|
|
||||||
|
@ -539,7 +543,7 @@ void WeatherManager::update(float duration)
|
||||||
|
|
||||||
if (mNextWeather != "")
|
if (mNextWeather != "")
|
||||||
{
|
{
|
||||||
mRemainingTransitionTime -= duration;
|
mRemainingTransitionTime -= duration * mEnvironment->mWorld->getTimeScaleFactor();
|
||||||
if (mRemainingTransitionTime < 0)
|
if (mRemainingTransitionTime < 0)
|
||||||
{
|
{
|
||||||
mCurrentWeather = mNextWeather;
|
mCurrentWeather = mNextWeather;
|
||||||
|
@ -548,7 +552,7 @@ void WeatherManager::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNextWeather != "")
|
if (mNextWeather != "")
|
||||||
result = transition(1-(mRemainingTransitionTime/(mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*60)));
|
result = transition(1-(mRemainingTransitionTime/(mWeatherSettings[mCurrentWeather].mTransitionDelta*24.f*3600)));
|
||||||
else
|
else
|
||||||
result = getResult(mCurrentWeather);
|
result = getResult(mCurrentWeather);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue