1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 11:23:51 +00:00

added (incomplete) WeatherManager, created by World

This commit is contained in:
scrawl 2012-02-21 20:22:46 +01:00
parent 83753dc384
commit c1fb5ce769
4 changed files with 108 additions and 1 deletions

View file

@ -44,7 +44,7 @@ add_openmw_dir (mwsound
add_openmw_dir (mwworld add_openmw_dir (mwworld
refdata world physicssystem scene environment globals class action nullaction actionteleport refdata world physicssystem scene environment globals class action nullaction actionteleport
containerstore actiontalk actiontake containerstore manualref containerutil player cellfunctors containerstore actiontalk actiontake containerstore manualref containerutil player cellfunctors
cells localscripts customdata cells localscripts customdata weather
) )
add_openmw_dir (mwclass add_openmw_dir (mwclass

View file

@ -0,0 +1,99 @@
#ifndef GAME_MWWORLD_WEATHER_H
#define GAME_MWWORLD_WEATHER_H
#include <OgreString.h>
#include <OgreColourValue.h>
namespace MWRender
{
class RenderingManager;
}
namespace MWWorld
{
/// Defines a single weather setting
struct Weather
{
Ogre::String mCloudTexture;
// Sky (atmosphere) colors
Ogre::ColourValue mSkySunriseColor;
Ogre::ColourValue mSkyDayColor;
Ogre::ColourValue mSkySunsetColor;
Ogre::ColourValue mSkyNightColor;
// Fog colors
Ogre::ColourValue mFogSunriseColor;
Ogre::ColourValue mFogDayColor;
Ogre::ColourValue mFogSunsetColor;
Ogre::ColourValue mFogNightColor;
// Ambient lighting colors
Ogre::ColourValue mAmbientSunriseColor;
Ogre::ColourValue mAmbientDayColor;
Ogre::ColourValue mAmbientSunsetColor;
Ogre::ColourValue mAmbientNightColor;
// Sun (directional) lighting colors
Ogre::ColourValue mSunSunriseColor;
Ogre::ColourValue mSunDayColor;
Ogre::ColourValue mSunSunsetColor;
Ogre::ColourValue mSunNightColor;
// Fog depth/density
float mLandFogDayDepth;
float mLandFogNightDepth;
// Color modulation for the sun itself during sunset (not completely sure)
Ogre::ColourValue mSunDiscSunsetColour;
// Duration of weather transition
// the INI value is 0.015, so I suppose this is measured in Morrowind-days? (0.015 days = 36 minutes in Morrowind)
float mTransitionDelta;
// No idea what this one is used for?
float mWindSpeed;
// Cloud animation speed multiplier
float mCloudSpeed;
// Multiplier for clouds transparency?
float mCloudsMaximumPercent;
// Value between 0 and 1, defines the strength of the sun glare effect
float mGlareView;
// Sound effect
// This is used for Blight, Ashstorm and Blizzard (Bloodmoon)
Ogre::String mAmbientLoopSoundID;
};
///
/// Interface for weather settings
///
class WeatherManager
{
public:
WeatherManager(MWRender::RenderingManager*);
/**
* Change the weather setting
* @param weather
* new weather setting to use
* @param instant
* if true, the weather changes instantly. if false, it slowly starts transitioning.
*/
void setWeather(const Weather& weather, bool instant=false);
/**
* Per-frame update
* @param duration
*/
void update(float duration);
private:
MWRender::RenderingManager* mRendering;
};
}
#endif // GAME_MWWORLD_WEATHER_H

View file

@ -13,10 +13,12 @@
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "environment.hpp" #include "environment.hpp"
#include "class.hpp" #include "class.hpp"
#include "player.hpp" #include "player.hpp"
#include "weather.hpp"
#include "refdata.hpp" #include "refdata.hpp"
#include "globals.hpp" #include "globals.hpp"
@ -155,6 +157,8 @@ namespace MWWorld
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment); mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
mWeatherManager = new MWWorld::WeatherManager();
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master)); boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
std::cout << "Loading ESM " << masterPath.string() << "\n"; std::cout << "Loading ESM " << masterPath.string() << "\n";
@ -184,6 +188,7 @@ namespace MWWorld
World::~World() World::~World()
{ {
delete mWeatherManager;
delete mWorldScene; delete mWorldScene;
delete mGlobalVariables; delete mGlobalVariables;
delete mRendering; delete mRendering;

View file

@ -50,6 +50,7 @@ namespace MWRender
namespace MWWorld namespace MWWorld
{ {
class WeatherManager;
class Environment; class Environment;
class Player; class Player;
@ -69,6 +70,8 @@ namespace MWWorld
MWRender::RenderingManager* mRendering; MWRender::RenderingManager* mRendering;
MWWorld::WeatherManager* mWeatherManager;
MWWorld::Scene *mWorldScene; MWWorld::Scene *mWorldScene;
MWWorld::Player *mPlayer; MWWorld::Player *mPlayer;
ESM::ESMReader mEsm; ESM::ESMReader mEsm;