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

103 lines
2.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 <OgrePlane.h>
#include <OgreRenderQueue.h>
#include <OgreRenderQueueListener.h>
#include <OgreRenderTargetListener.h>
#include <OgreMaterial.h>
#include <OgreTexture.h>
2012-01-21 20:05:08 -05:00
#include <components/esm/loadcell.hpp>
2012-05-29 06:45:44 +02:00
#include <components/settings/settings.hpp>
2012-01-14 18:34:14 -05:00
2012-04-03 15:13:47 +02:00
#include "renderconst.hpp"
namespace Ogre
{
class Camera;
class SceneManager;
class SceneNode;
class Entity;
class Vector3;
struct RenderTargetEvent;
};
2012-05-29 06:45:44 +02:00
2012-01-14 18:34:14 -05:00
namespace MWRender {
2012-04-03 21:16:43 +02:00
class SkyManager;
class RenderingManager;
2012-04-03 21:16:43 +02:00
/// Water rendering
2012-04-19 01:08:26 +02:00
class Water : public Ogre::RenderTargetListener, public Ogre::RenderQueueListener
{
static const int CELL_SIZE = 8192;
Ogre::Camera *mCamera;
Ogre::SceneManager *mSceneManager;
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
2012-04-19 01:08:26 +02:00
bool mReflectionRenderActive;
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-19 01:08:26 +02: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 06:45:44 +02:00
void applyRTT();
void applyVisibilityMask();
2012-04-12 16:46:56 +02:00
void updateVisible();
RenderingManager* mRendering;
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;
2012-05-29 06:45:44 +02:00
Ogre::TexturePtr mReflectionTexture;
Ogre::RenderTarget* mReflectionTarget;
bool mUnderwaterEffect;
2012-04-03 15:13:47 +02:00
int mVisibilityFlags;
public:
Water (Ogre::Camera *camera, RenderingManager* rend, 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-04-19 01:08:26 +02:00
void update();
2012-01-14 18:34:14 -05:00
void assignTextures();
2012-04-05 15:30:55 +02:00
void setViewportBackground(const Ogre::ColourValue& bg);
2012-05-29 06:45:44 +02:00
void processChangedSettings(const Settings::CategorySettingVector& settings);
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