mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
some restructurings
This commit is contained in:
parent
41a8b22ebd
commit
1badb5d04f
@ -46,9 +46,9 @@ void WeatherManager::setWeather(const String& weather, bool instant)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherResult WeatherManager::getResult()
|
WeatherResult WeatherManager::getResult(const String& weather)
|
||||||
{
|
{
|
||||||
const Weather& current = mWeatherSettings[mCurrentWeather];
|
const Weather& current = mWeatherSettings[weather];
|
||||||
WeatherResult result;
|
WeatherResult result;
|
||||||
|
|
||||||
result.mCloudTexture = current.mCloudTexture;
|
result.mCloudTexture = current.mCloudTexture;
|
||||||
@ -59,9 +59,10 @@ WeatherResult WeatherManager::getResult()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherResult WeatherManager::transition(const Weather& other, float factor)
|
WeatherResult WeatherManager::transition(float factor)
|
||||||
{
|
{
|
||||||
const Weather& current = mWeatherSettings[mCurrentWeather];
|
const WeatherResult& current = getResult(mCurrentWeather);
|
||||||
|
const WeatherResult& other = getResult(mNextWeather);
|
||||||
WeatherResult result;
|
WeatherResult result;
|
||||||
|
|
||||||
result.mCloudTexture = current.mCloudTexture;
|
result.mCloudTexture = current.mCloudTexture;
|
||||||
@ -70,7 +71,7 @@ WeatherResult WeatherManager::transition(const Weather& other, float factor)
|
|||||||
|
|
||||||
#define lerp(x, y) (x * (1-factor) + y * factor)
|
#define lerp(x, y) (x * (1-factor) + y * factor)
|
||||||
|
|
||||||
result.mCloudOpacity = lerp(current.mCloudsMaximumPercent, other.mCloudsMaximumPercent);
|
result.mCloudOpacity = lerp(current.mCloudOpacity, other.mCloudOpacity);
|
||||||
|
|
||||||
/// \todo
|
/// \todo
|
||||||
|
|
||||||
@ -92,9 +93,20 @@ void WeatherManager::update(float duration)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mNextWeather != "")
|
if (mNextWeather != "")
|
||||||
result = transition(mWeatherSettings[mNextWeather], 1-(mRemainingTransitionTime/TRANSITION_TIME));
|
result = transition(1-(mRemainingTransitionTime/TRANSITION_TIME));
|
||||||
else
|
else
|
||||||
result = getResult();
|
result = getResult(mCurrentWeather);
|
||||||
|
|
||||||
mRendering->getSkyManager()->setWeather(result);
|
mRendering->getSkyManager()->setWeather(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WeatherManager::setHour(const float hour)
|
||||||
|
{
|
||||||
|
mHour = hour;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeatherManager::setDate(const int day, const int month)
|
||||||
|
{
|
||||||
|
mDay = day;
|
||||||
|
mMonth = month;
|
||||||
|
}
|
||||||
|
@ -120,7 +120,14 @@ namespace MWWorld
|
|||||||
*/
|
*/
|
||||||
void update(float duration);
|
void update(float duration);
|
||||||
|
|
||||||
|
void setHour(const float hour);
|
||||||
|
|
||||||
|
void setDate(const int day, const int month);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
float mHour;
|
||||||
|
int mDay, mMonth;
|
||||||
|
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
||||||
std::map<Ogre::String, Weather> mWeatherSettings;
|
std::map<Ogre::String, Weather> mWeatherSettings;
|
||||||
@ -130,8 +137,8 @@ namespace MWWorld
|
|||||||
|
|
||||||
float mRemainingTransitionTime;
|
float mRemainingTransitionTime;
|
||||||
|
|
||||||
WeatherResult transition(const Weather& other, const float factor);
|
WeatherResult transition(const float factor);
|
||||||
WeatherResult getResult();
|
WeatherResult getResult(const Ogre::String& weather);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +374,8 @@ namespace MWWorld
|
|||||||
mGlobalVariables->setFloat ("gamehour", hour);
|
mGlobalVariables->setFloat ("gamehour", hour);
|
||||||
|
|
||||||
mRendering->skySetHour (hour);
|
mRendering->skySetHour (hour);
|
||||||
|
|
||||||
|
mWeatherManager->setHour (hour);
|
||||||
|
|
||||||
if (days>0)
|
if (days>0)
|
||||||
setDay (days + mGlobalVariables->getInt ("day"));
|
setDay (days + mGlobalVariables->getInt ("day"));
|
||||||
@ -409,6 +411,8 @@ namespace MWWorld
|
|||||||
mGlobalVariables->setInt ("month", month);
|
mGlobalVariables->setInt ("month", month);
|
||||||
|
|
||||||
mRendering->skySetDate (day, month);
|
mRendering->skySetDate (day, month);
|
||||||
|
|
||||||
|
mWeatherManager->setDate (day, month);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setMonth (int month)
|
void World::setMonth (int month)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user