mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
fog
This commit is contained in:
parent
528cff5a59
commit
f79bf1f300
5 changed files with 28 additions and 9 deletions
|
@ -204,14 +204,22 @@ void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
|
|||
Ogre::ColourValue color;
|
||||
color.setAsABGR (mCell.cell->ambi.fog);
|
||||
|
||||
float high = /*4500 + 9000 * */(1-mCell.cell->ambi.fogDensity);
|
||||
float low = 200;
|
||||
|
||||
mRendering.getScene()->setFog (FOG_LINEAR, color, 0, low, high);
|
||||
mRendering.getCamera()->setFarClipDistance (high + 10);
|
||||
mRendering.getViewport()->setBackgroundColour (color);
|
||||
configureFog(mCell.cell->ambi.fogDensity, color);
|
||||
}
|
||||
|
||||
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
||||
{
|
||||
/// \todo make the viewing distance and fog start/end configurable
|
||||
float low = 3000 / density;
|
||||
float high = 6200 / density;
|
||||
|
||||
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
||||
|
||||
mRendering.getCamera()->setFarClipDistance ( high );
|
||||
mRendering.getViewport()->setBackgroundColour (colour);
|
||||
}
|
||||
|
||||
|
||||
void RenderingManager::setAmbientMode()
|
||||
{
|
||||
switch (mAmbientMode)
|
||||
|
|
|
@ -102,9 +102,13 @@ class RenderingManager: private RenderingInterface {
|
|||
int skyGetSecundaPhase() const;
|
||||
void skySetMoonColour (bool red);
|
||||
void configureAmbient(ESMS::CellStore<MWWorld::RefData> &mCell);
|
||||
|
||||
/// configure fog according to cell
|
||||
void configureFog(ESMS::CellStore<MWWorld::RefData> &mCell);
|
||||
|
||||
|
||||
/// configure fog manually
|
||||
void configureFog(const float density, const Ogre::ColourValue& colour);
|
||||
|
||||
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
|
||||
int number = 1);
|
||||
///< Run animation for a MW-reference. Calls to this function for references that are currently not
|
||||
|
|
|
@ -623,8 +623,6 @@ void SkyManager::setWeather(const MWWorld::WeatherResult& weather)
|
|||
}
|
||||
|
||||
mAtmosphereNight->setVisible(weather.mNight && mEnabled);
|
||||
|
||||
mViewport->setBackgroundColour(weather.mFogColor);
|
||||
}
|
||||
|
||||
void SkyManager::setGlare(bool glare)
|
||||
|
|
|
@ -235,6 +235,9 @@ namespace MWWorld
|
|||
// adjust player
|
||||
mCurrentCell = cell;
|
||||
playerCellChange (cell, position);
|
||||
|
||||
// adjust fog
|
||||
mRendering.configureFog(*cell);
|
||||
|
||||
// Sky system
|
||||
mWorld->adjustSky();
|
||||
|
|
|
@ -354,6 +354,8 @@ WeatherResult WeatherManager::getResult(const String& weather)
|
|||
|
||||
result.mNight = (mHour < 6.f+fade_duration || mHour > 20.f-fade_duration);
|
||||
|
||||
result.mFogDepth = result.mNight ? current.mLandFogNightDepth : current.mLandFogDayDepth;
|
||||
|
||||
// night
|
||||
if (mHour <= (WeatherGlobals::mSunriseTime-WeatherGlobals::mSunriseDuration)
|
||||
|| mHour >= (WeatherGlobals::mSunsetTime+WeatherGlobals::mSunsetDuration))
|
||||
|
@ -569,6 +571,8 @@ void WeatherManager::update(float duration)
|
|||
else
|
||||
result = getResult(mCurrentWeather);
|
||||
|
||||
mRendering->configureFog(result.mFogDepth, result.mFogColor);
|
||||
|
||||
// disable sun during night
|
||||
if (mHour >= WeatherGlobals::mSunsetTime+WeatherGlobals::mSunsetDuration
|
||||
|| mHour <= WeatherGlobals::mSunriseTime-WeatherGlobals::mSunriseDuration)
|
||||
|
@ -699,6 +703,8 @@ void WeatherManager::update(float duration)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
mRendering->getSkyManager()->setThunder(0.f);
|
||||
|
||||
mRendering->setAmbientColour(result.mAmbientColor);
|
||||
mRendering->sunEnable();
|
||||
|
|
Loading…
Reference in a new issue