mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-16 15:21:02 +00:00
39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
|
#ifndef __GL_BLURSHADER_H
|
||
|
#define __GL_BLURSHADER_H
|
||
|
|
||
|
#include "gl_shaderprogram.h"
|
||
|
#include <memory>
|
||
|
|
||
|
class FFlatVertexBuffer;
|
||
|
|
||
|
class FBlurShader
|
||
|
{
|
||
|
public:
|
||
|
void BlurVertical(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||
|
void BlurHorizontal(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||
|
|
||
|
private:
|
||
|
void Blur(FFlatVertexBuffer *vbo, 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<FShaderProgram> VerticalShader;
|
||
|
std::shared_ptr<FShaderProgram> HorizontalShader;
|
||
|
};
|
||
|
|
||
|
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<float> &sample_weights, TArray<int> &sample_offsets);
|
||
|
|
||
|
TArray<BlurSetup> mBlurSetups;
|
||
|
};
|
||
|
|
||
|
#endif
|