1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

70 lines
1.5 KiB
C++
Raw Normal View History

2012-01-14 18:34:14 -05:00
#ifndef GAME_MWRENDER_WATER_H
#define GAME_MWRENDER_WATER_H
#include <Ogre.h>
2012-01-21 20:05:08 -05:00
#include <components/esm/loadcell.hpp>
2012-01-14 18:34:14 -05:00
2012-04-03 15:13:47 +02:00
#include "renderconst.hpp"
2012-01-14 18:34:14 -05:00
namespace MWRender {
2012-04-03 21:16:43 +02:00
class SkyManager;
2012-01-14 18:34:14 -05: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 18:34:14 -05:00
Ogre::Plane mWaterPlane;
Ogre::SceneNode *mWaterNode;
Ogre::Entity *mWater;
2012-01-14 18:34:14 -05:00
bool mIsUnderwater;
2012-04-03 15:13:47 +02:00
bool mActive;
2012-04-12 16:46:56 +02:00
bool mToggled;
int mTop;
2012-01-14 18:34:14 -05:00
Ogre::Vector3 getSceneNodeCoordinates(int gridX, int gridY);
2012-01-14 18:34:14 -05:00
protected:
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
2012-04-12 16:46:56 +02:00
void updateVisible();
2012-04-03 21:16:43 +02:00
SkyManager* mSky;
std::string mCompositorName;
2012-04-06 15:51:57 +02:00
void createMaterial();
Ogre::MaterialPtr mMaterial;
2012-04-11 18:53:13 +02:00
Ogre::Camera* mReflectionCamera;
Ogre::RenderTarget* mReflectionTarget;
bool mUnderwaterEffect;
2012-04-03 15:13:47 +02:00
int mVisibilityFlags;
public:
2012-04-03 21:16:43 +02:00
Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell);
~Water();
2012-01-14 18:34:14 -05:00
2012-04-03 15:13:47 +02:00
void setActive(bool active);
void toggle();
2012-01-14 18:34:14 -05:00
2012-04-05 15:30:55 +02: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 18:34:14 -05:00
};
2012-01-14 18:34:14 -05:00
}
#endif