1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/openmw/mwrender/water.hpp

66 lines
1.4 KiB
C++
Raw Normal View History

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
2012-04-03 13:13:47 +00:00
#include "renderconst.hpp"
2012-01-14 23:34:14 +00:00
namespace MWRender {
2012-04-03 19:16:43 +00:00
class SkyManager;
2012-01-14 23:34:14 +00:00
/// Water rendering
class Water : public Ogre::RenderTargetListener
{
static const int CELL_SIZE = 8192;
Ogre::Camera *mCamera;
Ogre::SceneManager *mSceneManager;
Ogre::Viewport *mViewport;
2012-01-14 23:34:14 +00:00
Ogre::Plane mWaterPlane;
Ogre::SceneNode *mWaterNode;
Ogre::Entity *mWater;
2012-01-14 23:34:14 +00:00
bool mIsUnderwater;
2012-04-03 13:13:47 +00:00
bool mActive;
int mTop;
2012-01-14 23:34:14 +00:00
Ogre::Vector3 getSceneNodeCoordinates(int gridX, int gridY);
2012-01-14 23:34:14 +00:00
protected:
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
2012-04-03 19:16:43 +00:00
SkyManager* mSky;
std::string mCompositorName;
2012-04-06 13:51:57 +00:00
void createMaterial();
Ogre::MaterialPtr mMaterial;
Ogre::RenderTarget* mReflectionTarget;
bool mUnderwaterEffect;
2012-04-03 13:13:47 +00:00
int mVisibilityFlags;
public:
2012-04-03 19:16:43 +00:00
Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell);
~Water();
2012-01-14 23:34:14 +00:00
2012-04-03 13:13:47 +00:00
void setActive(bool active);
void toggle();
2012-01-14 23:34:14 +00:00
2012-04-05 13:30:55 +00:00
void setViewportBackground(const Ogre::ColourValue& bg);
void checkUnderwater(float y);
void changeCell(const ESM::Cell* cell);
void setHeight(const float height);
2012-01-14 23:34:14 +00:00
};
2012-01-14 23:34:14 +00:00
}
#endif