2015-04-14 15:55:56 +02:00
|
|
|
#ifndef OPENMW_MWRENDER_SKY_H
|
|
|
|
#define OPENMW_MWRENDER_SKY_H
|
2013-12-07 20:12:03 +01:00
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
#include <osg/ref_ptr>
|
2012-07-23 15:35:31 +02:00
|
|
|
|
2012-02-22 19:17:37 +01:00
|
|
|
#include "../mwworld/weather.hpp"
|
2011-01-04 01:34:55 +01:00
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Group;
|
|
|
|
class Node;
|
|
|
|
class Material;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Resource
|
2010-06-27 16:44:15 -07:00
|
|
|
{
|
2012-02-21 16:15:38 +01:00
|
|
|
class SceneManager;
|
2010-06-27 16:44:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
2015-04-14 15:55:56 +02:00
|
|
|
class AtmosphereUpdater;
|
2015-04-15 18:50:50 +02:00
|
|
|
class CloudUpdater;
|
|
|
|
class Sun;
|
|
|
|
class Moon;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2010-06-27 16:44:15 -07:00
|
|
|
class SkyManager
|
|
|
|
{
|
|
|
|
public:
|
2015-04-14 15:55:56 +02:00
|
|
|
SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneManager);
|
2012-02-21 17:38:15 +01:00
|
|
|
~SkyManager();
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-21 17:38:15 +01:00
|
|
|
void update(float duration);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
void setEnabled(bool enabled);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-25 21:06:03 +01:00
|
|
|
void setHour (double hour);
|
2012-02-21 16:15:38 +01:00
|
|
|
///< will be called even when sky is disabled.
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-25 21:06:03 +01:00
|
|
|
void setDate (int day, int month);
|
2012-02-21 16:15:38 +01:00
|
|
|
///< will be called even when sky is disabled.
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-21 17:38:15 +01:00
|
|
|
int getMasserPhase() const;
|
2012-02-21 16:15:38 +01:00
|
|
|
///< 0 new moon, 1 waxing or waning cresecent, 2 waxing or waning half,
|
|
|
|
/// 3 waxing or waning gibbous, 4 full moon
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-21 17:38:15 +01:00
|
|
|
int getSecundaPhase() const;
|
2012-02-21 16:15:38 +01:00
|
|
|
///< 0 new moon, 1 waxing or waning cresecent, 2 waxing or waning half,
|
|
|
|
/// 3 waxing or waning gibbous, 4 full moon
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-21 17:38:15 +01:00
|
|
|
void setMoonColour (bool red);
|
2012-02-21 16:15:38 +01:00
|
|
|
///< change Secunda colour to red
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-22 19:17:37 +01:00
|
|
|
void setWeather(const MWWorld::WeatherResult& weather);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-24 18:30:16 +01:00
|
|
|
void sunEnable();
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-24 18:30:16 +01:00
|
|
|
void sunDisable();
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2014-06-25 18:20:21 +02:00
|
|
|
void setRainSpeed(float speed);
|
|
|
|
|
2015-05-22 01:54:06 +02:00
|
|
|
void setStormDirection(const osg::Vec3f& direction);
|
2014-06-26 19:01:49 +02:00
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
void setSunDirection(const osg::Vec3f& direction);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2015-04-15 18:50:50 +02:00
|
|
|
void setMasserDirection(const osg::Vec3f& direction);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2015-04-15 18:50:50 +02:00
|
|
|
void setSecundaDirection(const osg::Vec3f& direction);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-25 16:36:45 +01:00
|
|
|
void setMasserFade(const float fade);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-25 16:36:45 +01:00
|
|
|
void setSecundaFade(const float fade);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-02-25 16:36:45 +01:00
|
|
|
void masserEnable();
|
|
|
|
void masserDisable();
|
|
|
|
|
|
|
|
void secundaEnable();
|
|
|
|
void secundaDisable();
|
2012-03-24 17:59:26 +01:00
|
|
|
|
2012-07-13 09:13:12 +02:00
|
|
|
void setLightningStrength(const float factor);
|
2012-03-24 17:59:26 +01:00
|
|
|
|
|
|
|
void setGlare(const float glare);
|
2012-07-19 22:23:07 +02:00
|
|
|
void setGlareEnabled(bool enabled);
|
2012-04-01 15:07:41 +02:00
|
|
|
|
2012-02-21 16:15:38 +01:00
|
|
|
private:
|
2013-05-07 17:38:24 +02:00
|
|
|
void create();
|
|
|
|
///< no need to call this, automatically done on first enable()
|
|
|
|
|
2014-06-25 18:20:21 +02:00
|
|
|
void updateRain(float dt);
|
|
|
|
void clearRain();
|
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
Resource::SceneManager* mSceneManager;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Group> mRootNode;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Node> mParticleEffect;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Node> mCloudNode;
|
|
|
|
|
2015-04-15 18:50:50 +02:00
|
|
|
osg::ref_ptr<CloudUpdater> mCloudUpdater;
|
|
|
|
|
2015-04-14 15:55:56 +02:00
|
|
|
osg::ref_ptr<osg::Node> mAtmosphereDay;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Node> mAtmosphereNight;
|
|
|
|
|
|
|
|
osg::ref_ptr<AtmosphereUpdater> mAtmosphereUpdater;
|
|
|
|
|
2015-04-15 18:50:50 +02:00
|
|
|
std::auto_ptr<Sun> mSun;
|
|
|
|
std::auto_ptr<Moon> mMasser;
|
|
|
|
std::auto_ptr<Moon> mSecunda;
|
2015-04-14 15:55:56 +02:00
|
|
|
|
2012-04-01 15:07:41 +02:00
|
|
|
bool mCreated;
|
|
|
|
|
2012-07-13 09:13:12 +02:00
|
|
|
bool mMoonRed;
|
|
|
|
|
2014-06-26 19:01:49 +02:00
|
|
|
bool mIsStorm;
|
|
|
|
|
2012-02-25 21:06:03 +01:00
|
|
|
float mHour;
|
|
|
|
int mDay;
|
|
|
|
int mMonth;
|
2012-03-15 19:49:15 +01:00
|
|
|
|
2012-07-11 09:08:55 +02:00
|
|
|
float mCloudAnimationTimer;
|
|
|
|
|
2014-06-25 18:20:21 +02:00
|
|
|
float mRainTimer;
|
|
|
|
|
2015-05-22 01:54:06 +02:00
|
|
|
osg::Vec3f mStormDirection;
|
2014-06-26 19:01:49 +02:00
|
|
|
|
2012-02-24 23:26:38 +01:00
|
|
|
// remember some settings so we don't have to apply them again if they didnt change
|
2015-05-22 01:54:06 +02:00
|
|
|
std::string mClouds;
|
|
|
|
std::string mNextClouds;
|
2012-02-22 19:17:37 +01:00
|
|
|
float mCloudBlendFactor;
|
|
|
|
float mCloudOpacity;
|
2012-02-23 20:33:34 +01:00
|
|
|
float mCloudSpeed;
|
2012-02-24 23:26:38 +01:00
|
|
|
float mStarsOpacity;
|
2015-04-14 15:55:56 +02:00
|
|
|
osg::Vec4f mCloudColour;
|
|
|
|
osg::Vec4f mSkyColour;
|
|
|
|
osg::Vec4f mFogColour;
|
2012-04-06 15:05:17 +02:00
|
|
|
|
2014-06-24 15:00:15 +02:00
|
|
|
std::string mCurrentParticleEffect;
|
|
|
|
|
2012-02-22 19:17:37 +01:00
|
|
|
float mRemainingTransitionTime;
|
2012-04-06 15:05:17 +02:00
|
|
|
|
2012-03-24 17:59:26 +01:00
|
|
|
float mGlare; // target
|
|
|
|
float mGlareFade; // actual
|
2012-04-06 15:05:17 +02:00
|
|
|
|
2014-06-25 18:20:21 +02:00
|
|
|
bool mRainEnabled;
|
|
|
|
std::string mRainEffect;
|
|
|
|
float mRainSpeed;
|
|
|
|
float mRainFrequency;
|
|
|
|
|
2012-02-24 16:12:43 +01:00
|
|
|
bool mEnabled;
|
2012-02-24 18:30:16 +01:00
|
|
|
bool mSunEnabled;
|
2010-06-27 16:44:15 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-05-07 17:38:24 +02:00
|
|
|
#endif // GAME_RENDER_SKY_H
|