#ifndef POSTEFFECTMODULE_H #define POSTEFFECTMODULE_H #include "opengl.h" #include #include #include "module.h" #include class Shader; class FrameBuffer; class Texture; class TextureBlur; class ShaderSource; class TextureRedux; class PostEffectModule : public Module { // framebuffers enum { INPUT_FBO, LUMINANCE_FBO, BLOOM_FBO, NB_FBO }; FrameBuffer* frameBuffers; const FrameBuffer* outputFBO; // shaders enum { LUMINANCE_SHADER, BLOOM_SHADER, HDR_SHADER, REDUX_SHADER, NB_SHADERS }; static const std::string vertSource; Shader* shaders[NB_SHADERS]; // dimensions int width; int height; // geometry (one triangle) GLuint vao; GLuint vbo; static const GLfloat vertices[]; // post processing pipeline void luminanceStep(); void bloomStep(); void hdrStep(); TextureBlur* blur; ShaderSource* blurSource; TextureRedux* redux; // arguments float bloom_threshold; public: PostEffectModule(int width, int height); ~PostEffectModule(); virtual void renderGL(Camera* myCamera, Scene* scene); virtual void resize(int w, int h); /** * @brief setShaders must be called to set the 5 required fragment shaders */ void setShaders(const std::string &luminanceSource, const std::string &bloomSource, const std::string &hdrSource, const std::string &blurSource, const std::string &reduxSource); FrameBuffer* getInputFBO() {return frameBuffers;} void setRenderTarget(FrameBuffer* renderTarget) {outputFBO = renderTarget;} void setBloomThreshold(float threshold) {bloom_threshold = threshold;} glm::vec3 getObjectInfo(int x, int y); }; #endif // POSTEFFECTMODULE_H