1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-20 17:31:44 +02:00
openrw/rwengine/include/render/WaterRenderer.hpp
Daniel Evans 6851c5e011 Improve graphics performance
+ Add Framebuffer rendering to store data
+ Re-implement water using projected grid aproach
2015-04-03 03:07:07 +01:00

49 lines
1.1 KiB
C++

#pragma once
#include <engine/RWTypes.hpp>
#include <render/OpenGLRenderer.hpp>
class GameRenderer;
class GameWorld;
/**
* Implements the rendering routines for drawing the sea water.
*/
class WaterRenderer
{
public:
WaterRenderer(GameRenderer* renderer);
~WaterRenderer();
/**
* Creates the required data for rendering the water. Accepts
* two arrays. waterHeights stores the real world heights which
* are indexed into by the array tiles for each water tile.
*
* This data is used to create the internal stencil mask for clipping
* the water rendering.
*/
void setWaterTable(float* waterHeights, unsigned int nHeights, uint8_t* tiles, unsigned int nTiles);
void setDataTexture(GLuint fbBinding, GLuint dataTexture);
/**
* Render the water using the currently active render state
*/
void render(GameRenderer* renderer, GameWorld* world);
private:
Renderer::ShaderProgram* waterProg;
Renderer::ShaderProgram* maskProg;
DrawBuffer maskDraw;
GeometryBuffer maskGeom;
std::vector<int> maskSizes;
DrawBuffer gridDraw;
GeometryBuffer gridGeom;
GLuint fbOutput;
GLuint dataTexture;
};