8 #include <GLFW/glfw3.h> 10 #include <glm/gtc/type_ptr.hpp> 12 #include "../shader.h" 13 #include "../texture.hpp" 30 int reflectionResolutionX;
31 int reflectionResolutionY;
32 int refractionResolutionX;
33 int refractionResolutionY;
35 GLuint fboReflection, reflectionColorTexture, reflectionDepthBuffer;
36 GLuint fboRefraction, refractionColorTexture, refractionDepthTexture;
38 Shader *waterShader =
nullptr;
39 Texture *waterDistortionDuDvMap =
nullptr;
40 float waveAmplitude, waveSpeed, waveTimeBasedShift;
42 int windowWidth, windowHeight;
48 WaterEffect(
int windowWidth,
int windowHeight,
float reflectionResolutionFactor,
float refractionResolutionFactor,
49 const std::string& waterDistortionDuDvMapPath,
float waveAmplitude,
float waveSpeed);
52 inline void bindReflectionFrameBuffer() { bindFrameBuffer(fboReflection, reflectionResolutionX, reflectionResolutionY); }
53 inline void bindRefractionFrameBuffer() { bindFrameBuffer(fboRefraction, refractionResolutionX, refractionResolutionY); }
55 void bindFrameBuffer(GLuint frameBuffer,
int width,
int height);
56 void bindDefaultFrameBuffer();
58 Shader *setupWaterShader();
60 void updateWaves(
float deltaT);
66 GLuint createFrameBuffer();
69 GLuint createColorTextureAttachment(
int width,
int height);
73 GLuint createDepthTextureAttachment(
int width,
int height);
78 GLuint createDepthRenderbufferAttachment(
int width,
int height);
WaterEffect This is used to create a real-time reflecting and refracting horizontal water surface wit...
Definition: water_effect.h:24
Texture class.
Definition: texture.hpp:13
Shader class.
Definition: shader.h:15
WaterEffect(int windowWidth, int windowHeight, float reflectionResolutionFactor, float refractionResolutionFactor, const std::string &waterDistortionDuDvMapPath, float waveAmplitude, float waveSpeed)
reflectionResolutionFactor and refractionResolutionFactor will be used to determine size of reflectio...
Definition: water_effect.cpp:3