#ifndef __GL_BLURSHADER_H #define __GL_BLURSHADER_H #include "gl_shaderprogram.h" #include class FGLRenderer; class FBlurShader { public: void BlurVertical(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height); void BlurHorizontal(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height); private: void Blur(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height, bool vertical); struct BlurSetup { BlurSetup(float blurAmount, int sampleCount) : blurAmount(blurAmount), sampleCount(sampleCount) { } float blurAmount; int sampleCount; std::shared_ptr VerticalShader; std::shared_ptr HorizontalShader; FBufferedUniform1f VerticalScaleX, VerticalScaleY; FBufferedUniform1f HorizontalScaleX, HorizontalScaleY; }; BlurSetup *GetSetup(float blurAmount, int sampleCount); FString VertexShaderCode(); FString FragmentShaderCode(float blurAmount, int sampleCount, bool vertical); float ComputeGaussian(float n, float theta); void ComputeBlurSamples(int sampleCount, float blurAmount, TArray &sample_weights, TArray &sample_offsets); TArray mBlurSetups; }; #endif