2012-01-14 23:34:14 +00:00
|
|
|
#ifndef GAME_MWRENDER_WATER_H
|
|
|
|
#define GAME_MWRENDER_WATER_H
|
|
|
|
|
|
|
|
#include <Ogre.h>
|
2012-01-22 01:05:08 +00:00
|
|
|
#include <components/esm/loadcell.hpp>
|
2012-01-14 23:34:14 +00:00
|
|
|
|
|
|
|
namespace MWRender {
|
|
|
|
|
|
|
|
/// Water rendering
|
|
|
|
class Water : Ogre::RenderTargetListener, Ogre::Camera::Listener {
|
2012-01-22 01:05:08 +00:00
|
|
|
static const int CELL_SIZE = 8192;
|
2012-01-14 23:34:14 +00:00
|
|
|
Ogre::Camera *mCamera;
|
|
|
|
Ogre::SceneManager *mSceneManager;
|
|
|
|
Ogre::Viewport *mViewport;
|
|
|
|
|
|
|
|
Ogre::RenderTarget *mRefractionTarget;
|
|
|
|
Ogre::RenderTarget *mReflectionTarget;
|
|
|
|
|
|
|
|
Ogre::Plane mWaterPlane;
|
|
|
|
Ogre::SceneNode *mWaterNode;
|
|
|
|
Ogre::Entity *mWater;
|
|
|
|
|
|
|
|
Ogre::Vector3 mOldCameraPos;
|
|
|
|
bool mIsUnderwater;
|
2012-01-20 22:59:56 +00:00
|
|
|
int mTop;
|
2012-01-14 23:34:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void preRenderTargetUpdate(const Ogre::RenderTargetEvent&);
|
|
|
|
void postRenderTargetUpdate(const Ogre::RenderTargetEvent&);
|
|
|
|
|
|
|
|
void cameraPreRenderScene(Ogre::Camera *cam);
|
|
|
|
void cameraPostRenderScene(Ogre::Camera *cam);
|
|
|
|
void cameraDestroyed(Ogre::Camera *cam);
|
2012-01-22 01:05:08 +00:00
|
|
|
Ogre::Vector3 getSceneNodeCoordinates(int gridX, int gridY);
|
2012-01-14 23:34:14 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-01-22 01:05:08 +00:00
|
|
|
Water (Ogre::Camera *camera, const ESM::Cell* cell);
|
2012-01-14 23:34:14 +00:00
|
|
|
~Water();
|
|
|
|
|
2012-01-20 22:59:56 +00:00
|
|
|
void checkUnderwater(float y);
|
2012-01-22 01:05:08 +00:00
|
|
|
void changeCell(float x, float y);
|
2012-01-14 23:34:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|