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 bool needs_srgb_primaries() const { return false; }
22 virtual std::string output_fragment_shader() {
25 virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) {
29 virtual bool needs_texture_bounce() const { return true; }
30 virtual bool needs_mipmaps() const { return true; }
31 virtual void add_self_to_effect_chain(EffectChain *chain, const std::vector<Effect *> &input);
32 virtual bool set_float(const std::string &key, float value);
35 SingleBlurPassEffect *hpass, *vpass;
38 class SingleBlurPassEffect : public Effect {
40 SingleBlurPassEffect();
41 std::string output_fragment_shader();
43 virtual bool needs_srgb_primaries() const { return false; }
44 virtual bool needs_texture_bounce() const { return true; }
45 virtual bool needs_mipmaps() const { return true; }
47 void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
48 void clear_gl_state();
50 enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
57 #endif // !defined(_BLUR_EFFECT_H)