2010-06-27 23:44:15 +00:00
|
|
|
#ifndef _GAME_RENDER_SKY_H
|
|
|
|
#define _GAME_RENDER_SKY_H
|
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
#include <OgreString.h>
|
|
|
|
#include <OgreMaterial.h>
|
|
|
|
#include <OgreColourValue.h>
|
|
|
|
#include <OgreHighLevelGpuProgram.h>
|
|
|
|
|
|
|
|
#include "sky.hpp"
|
2012-02-22 18:17:37 +00:00
|
|
|
#include "../mwworld/weather.hpp"
|
2011-01-04 00:34:55 +00:00
|
|
|
|
2010-06-27 23:44:15 +00:00
|
|
|
namespace Ogre
|
|
|
|
{
|
|
|
|
class RenderWindow;
|
2012-02-19 22:09:14 +00:00
|
|
|
class SceneNode;
|
2012-02-21 15:15:38 +00:00
|
|
|
class Camera;
|
|
|
|
class Viewport;
|
|
|
|
class SceneManager;
|
|
|
|
class Entity;
|
2012-02-23 20:44:56 +00:00
|
|
|
class BillboardSet;
|
2010-06-27 23:44:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
2012-02-23 20:44:56 +00:00
|
|
|
class BillboardObject
|
2012-02-21 15:15:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-02-23 20:44:56 +00:00
|
|
|
BillboardObject( const Ogre::String& textureName,
|
|
|
|
const unsigned int size,
|
|
|
|
const Ogre::Vector3& position,
|
|
|
|
Ogre::SceneNode* rootNode
|
2012-02-21 15:15:38 +00:00
|
|
|
);
|
2012-02-23 20:44:56 +00:00
|
|
|
BillboardObject();
|
2012-02-22 18:17:37 +00:00
|
|
|
|
|
|
|
void setColour(const Ogre::ColourValue& pColour);
|
2012-02-21 15:15:38 +00:00
|
|
|
void setPosition(const Ogre::Vector3& pPosition);
|
|
|
|
void setVisible(const bool visible);
|
2012-02-23 20:44:56 +00:00
|
|
|
void setRenderQueue(unsigned int id);
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-24 15:12:43 +00:00
|
|
|
Ogre::SceneNode* getNode();
|
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
protected:
|
2012-02-23 20:44:56 +00:00
|
|
|
virtual void init(const Ogre::String& textureName,
|
|
|
|
const unsigned int size,
|
|
|
|
const Ogre::Vector3& position,
|
|
|
|
Ogre::SceneNode* rootNode);
|
2012-02-21 15:15:38 +00:00
|
|
|
|
|
|
|
Ogre::SceneNode* mNode;
|
|
|
|
Ogre::MaterialPtr mMaterial;
|
2012-02-23 20:44:56 +00:00
|
|
|
Ogre::BillboardSet* mBBSet;
|
2012-02-21 15:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The moons need a seperate class because of their shader (which allows them to be partially transparent)
|
|
|
|
*/
|
2012-02-23 20:44:56 +00:00
|
|
|
class Moon : public BillboardObject
|
2012-02-21 15:15:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-02-23 20:44:56 +00:00
|
|
|
Moon( const Ogre::String& textureName,
|
|
|
|
const unsigned int size,
|
|
|
|
const Ogre::Vector3& position,
|
|
|
|
Ogre::SceneNode* rootNode
|
2012-02-21 15:15:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
void setVisibility(const float pVisibility);
|
|
|
|
///< set the transparency factor for this moon
|
2012-02-22 18:17:37 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
enum Phase
|
|
|
|
{
|
|
|
|
Phase_New = 0,
|
|
|
|
Phase_WaxingCrescent,
|
|
|
|
Phase_WaxingHalf,
|
|
|
|
Phase_WaxingGibbous,
|
|
|
|
Phase_WaningCrescent,
|
|
|
|
Phase_WaningHalf,
|
|
|
|
Phase_WaningGibbous,
|
|
|
|
Phase_Full
|
|
|
|
};
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
Type_Masser = 0,
|
|
|
|
Type_Secunda
|
|
|
|
};
|
|
|
|
|
|
|
|
void setPhase(const Phase& phase);
|
|
|
|
void setType(const Type& type);
|
|
|
|
|
|
|
|
Phase getPhase() const;
|
|
|
|
unsigned int getPhaseInt() const;
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
private:
|
|
|
|
Type mType;
|
|
|
|
Phase mPhase;
|
|
|
|
};
|
|
|
|
|
2010-06-27 23:44:15 +00:00
|
|
|
class SkyManager
|
|
|
|
{
|
|
|
|
public:
|
2012-02-21 15:15:38 +00:00
|
|
|
SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera);
|
2012-02-21 16:38:15 +00:00
|
|
|
~SkyManager();
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void update(float duration);
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void enable();
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void disable();
|
2012-02-21 15:15:38 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void setHour (double hour) {}
|
2012-02-21 15:15:38 +00:00
|
|
|
///< will be called even when sky is disabled.
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void setDate (int day, int month) {}
|
2012-02-21 15:15:38 +00:00
|
|
|
///< will be called even when sky is disabled.
|
2012-02-19 22:09:14 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
int getMasserPhase() const;
|
2012-02-21 15:15:38 +00:00
|
|
|
///< 0 new moon, 1 waxing or waning cresecent, 2 waxing or waning half,
|
|
|
|
/// 3 waxing or waning gibbous, 4 full moon
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
int getSecundaPhase() const;
|
2012-02-21 15:15:38 +00:00
|
|
|
///< 0 new moon, 1 waxing or waning cresecent, 2 waxing or waning half,
|
|
|
|
/// 3 waxing or waning gibbous, 4 full moon
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 16:38:15 +00:00
|
|
|
void setMoonColour (bool red);
|
2012-02-21 15:15:38 +00:00
|
|
|
///< change Secunda colour to red
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 21:11:41 +00:00
|
|
|
void setCloudsOpacity(float opacity);
|
|
|
|
///< change opacity of the clouds
|
|
|
|
|
2012-02-22 18:17:37 +00:00
|
|
|
void setWeather(const MWWorld::WeatherResult& weather);
|
|
|
|
|
2012-02-24 17:30:16 +00:00
|
|
|
void sunEnable();
|
|
|
|
|
|
|
|
void sunDisable();
|
|
|
|
|
|
|
|
void setSunDirection(const Ogre::Vector3& direction);
|
|
|
|
|
2012-02-24 15:12:43 +00:00
|
|
|
void setGlare(bool glare);
|
|
|
|
Ogre::Vector3 getRealSunPos();
|
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
private:
|
2012-02-23 20:44:56 +00:00
|
|
|
BillboardObject* mSun;
|
|
|
|
BillboardObject* mSunGlare;
|
2012-02-21 15:15:38 +00:00
|
|
|
Moon* mMasser;
|
|
|
|
Moon* mSecunda;
|
|
|
|
|
|
|
|
Ogre::Viewport* mViewport;
|
|
|
|
Ogre::SceneNode* mRootNode;
|
|
|
|
Ogre::SceneManager* mSceneMgr;
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
Ogre::MaterialPtr mCloudMaterial;
|
|
|
|
Ogre::MaterialPtr mAtmosphereMaterial;
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
Ogre::HighLevelGpuProgramPtr mCloudFragmentShader;
|
2010-07-18 17:48:02 +00:00
|
|
|
|
2012-02-22 18:17:37 +00:00
|
|
|
// remember the cloud texture names used right now, so we don't have to set the texture names if they didnt change
|
|
|
|
Ogre::String mClouds;
|
|
|
|
Ogre::String mNextClouds;
|
|
|
|
float mCloudBlendFactor;
|
|
|
|
float mCloudOpacity;
|
2012-02-23 19:33:34 +00:00
|
|
|
float mCloudSpeed;
|
2012-02-22 18:17:37 +00:00
|
|
|
|
2012-02-23 18:49:56 +00:00
|
|
|
Ogre::ColourValue mCloudColour;
|
|
|
|
Ogre::ColourValue mSkyColour;
|
2012-02-23 19:33:34 +00:00
|
|
|
|
2012-02-22 18:17:37 +00:00
|
|
|
float mRemainingTransitionTime;
|
|
|
|
|
2012-02-21 15:15:38 +00:00
|
|
|
void ModVertexAlpha(Ogre::Entity* ent, unsigned int meshType);
|
2012-02-24 15:12:43 +00:00
|
|
|
|
|
|
|
bool mEnabled;
|
2012-02-24 17:30:16 +00:00
|
|
|
bool mGlareEnabled;
|
|
|
|
bool mSunEnabled;
|
2010-06-27 23:44:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _GAME_RENDER_SKY_H
|