2 #define _BLUR_EFFECT_H 1
4 // A separable 2D blur implemented by a combination of mipmap filtering
5 // and convolution (essentially giving a convolution with a piecewise linear
6 // approximation to the true impulse response).
8 // Works in two passes; first horizontal, then vertical (BlurEffect,
9 // which is what the user is intended to use, instantiates two copies of
10 // SingleBlurPassEffect behind the scenes).
14 class SingleBlurPassEffect;
16 class BlurEffect : public Effect {
20 virtual std::string output_fragment_shader() {
23 virtual void set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) {
27 virtual bool needs_many_samples() const { return true; }
28 virtual bool needs_mipmaps() const { return true; }
29 virtual void add_self_to_effect_chain(std::vector<Effect *> *chain);
30 virtual bool set_float(const std::string &key, float value);
33 SingleBlurPassEffect *hpass, *vpass;
36 class SingleBlurPassEffect : public Effect {
38 SingleBlurPassEffect();
39 std::string output_fragment_shader();
41 virtual bool needs_many_samples() const { return true; }
42 virtual bool needs_mipmaps() const { return true; }
44 void set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
46 enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
53 #endif // !defined(_BLUR_EFFECT_H)