2012-01-14 23:34:14 +00:00
|
|
|
#ifndef GAME_MWRENDER_WATER_H
|
|
|
|
#define GAME_MWRENDER_WATER_H
|
|
|
|
|
2012-07-03 13:32:38 +00:00
|
|
|
#include <OgrePlane.h>
|
|
|
|
#include <OgreRenderQueue.h>
|
|
|
|
#include <OgreRenderQueueListener.h>
|
|
|
|
#include <OgreRenderTargetListener.h>
|
|
|
|
#include <OgreMaterial.h>
|
|
|
|
#include <OgreTexture.h>
|
|
|
|
|
2012-01-22 01:05:08 +00:00
|
|
|
#include <components/esm/loadcell.hpp>
|
2012-05-29 04:45:44 +00:00
|
|
|
#include <components/settings/settings.hpp>
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-04-03 13:13:47 +00:00
|
|
|
#include "renderconst.hpp"
|
|
|
|
|
2012-07-20 12:45:42 +00:00
|
|
|
#include <extern/shiny/Main/MaterialInstance.hpp>
|
|
|
|
|
2012-07-03 13:32:38 +00:00
|
|
|
namespace Ogre
|
|
|
|
{
|
|
|
|
class Camera;
|
|
|
|
class SceneManager;
|
|
|
|
class SceneNode;
|
|
|
|
class Entity;
|
|
|
|
class Vector3;
|
|
|
|
struct RenderTargetEvent;
|
|
|
|
};
|
2012-05-29 04:45:44 +00:00
|
|
|
|
2012-01-14 23:34:14 +00:00
|
|
|
namespace MWRender {
|
|
|
|
|
2012-04-03 19:16:43 +00:00
|
|
|
class SkyManager;
|
2012-04-29 01:33:10 +00:00
|
|
|
class RenderingManager;
|
2012-04-03 19:16:43 +00:00
|
|
|
|
2012-07-03 13:32:38 +00:00
|
|
|
/// Water rendering
|
2012-07-20 12:45:42 +00:00
|
|
|
class Water : public Ogre::RenderTargetListener, public Ogre::RenderQueueListener, public sh::MaterialInstanceListener
|
2012-03-29 16:33:08 +00:00
|
|
|
{
|
|
|
|
static const int CELL_SIZE = 8192;
|
|
|
|
Ogre::Camera *mCamera;
|
|
|
|
Ogre::SceneManager *mSceneManager;
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
Ogre::Plane mWaterPlane;
|
2012-07-19 20:23:07 +00:00
|
|
|
Ogre::Plane mErrorPlane;
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
Ogre::SceneNode *mWaterNode;
|
|
|
|
Ogre::Entity *mWater;
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-07-23 11:47:51 +00:00
|
|
|
//Ogre::SceneNode* mUnderwaterDome;
|
2012-07-19 14:23:30 +00:00
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
bool mIsUnderwater;
|
2012-04-03 13:13:47 +00:00
|
|
|
bool mActive;
|
2012-04-12 14:46:56 +00:00
|
|
|
bool mToggled;
|
2012-03-29 16:33:08 +00:00
|
|
|
int mTop;
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-07-19 14:23:30 +00:00
|
|
|
int mOldFarClip;
|
2012-07-19 20:23:07 +00:00
|
|
|
int mOldFarClip2;
|
2012-07-19 14:23:30 +00:00
|
|
|
|
|
|
|
float mWaterTimer;
|
|
|
|
|
2012-04-18 23:08:26 +00:00
|
|
|
bool mReflectionRenderActive;
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
Ogre::Vector3 getSceneNodeCoordinates(int gridX, int gridY);
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-04-03 12:23:23 +00:00
|
|
|
protected:
|
|
|
|
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
|
|
|
|
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
|
2012-04-18 23:08:26 +00:00
|
|
|
|
|
|
|
void renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation);
|
|
|
|
void renderQueueEnded (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &repeatThisInvocation);
|
|
|
|
|
2012-05-29 04:45:44 +00:00
|
|
|
void applyRTT();
|
|
|
|
void applyVisibilityMask();
|
|
|
|
|
2012-04-12 14:46:56 +00:00
|
|
|
void updateVisible();
|
2012-04-03 12:23:23 +00:00
|
|
|
|
2012-04-29 01:33:10 +00:00
|
|
|
RenderingManager* mRendering;
|
2012-04-03 19:16:43 +00:00
|
|
|
SkyManager* mSky;
|
|
|
|
|
2012-04-06 16:22:37 +00:00
|
|
|
std::string mCompositorName;
|
|
|
|
|
2012-04-06 13:51:57 +00:00
|
|
|
Ogre::MaterialPtr mMaterial;
|
2012-04-03 14:37:54 +00:00
|
|
|
|
2012-04-11 16:53:13 +00:00
|
|
|
Ogre::Camera* mReflectionCamera;
|
|
|
|
|
2012-05-29 04:45:44 +00:00
|
|
|
Ogre::TexturePtr mReflectionTexture;
|
2012-04-03 12:23:23 +00:00
|
|
|
Ogre::RenderTarget* mReflectionTarget;
|
|
|
|
|
2012-04-08 15:44:00 +00:00
|
|
|
bool mUnderwaterEffect;
|
2012-04-03 13:13:47 +00:00
|
|
|
int mVisibilityFlags;
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
public:
|
2012-04-29 01:33:10 +00:00
|
|
|
Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cell);
|
2012-03-29 16:33:08 +00:00
|
|
|
~Water();
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-04-03 13:13:47 +00:00
|
|
|
void setActive(bool active);
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
void toggle();
|
2012-07-19 14:23:30 +00:00
|
|
|
void update(float dt);
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-05-27 19:39:18 +00:00
|
|
|
void assignTextures();
|
|
|
|
|
2012-04-05 13:30:55 +00:00
|
|
|
void setViewportBackground(const Ogre::ColourValue& bg);
|
|
|
|
|
2012-05-29 04:45:44 +00:00
|
|
|
void processChangedSettings(const Settings::CategorySettingVector& settings);
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
void checkUnderwater(float y);
|
|
|
|
void changeCell(const ESM::Cell* cell);
|
|
|
|
void setHeight(const float height);
|
2012-01-14 23:34:14 +00:00
|
|
|
|
2012-07-20 12:45:42 +00:00
|
|
|
virtual void requestedConfiguration (sh::MaterialInstance* m, const std::string& configuration);
|
|
|
|
virtual void createdConfiguration (sh::MaterialInstance* m, const std::string& configuration);
|
|
|
|
|
2012-03-29 16:33:08 +00:00
|
|
|
};
|
2012-01-14 23:34:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|