]> git.sesse.net Git - movit/blob - blur_effect.h
ee890c25543fa41599e67d3e9284bfd68d8ee196
[movit] / blur_effect.h
1 #ifndef _BLUR_EFFECT_H
2 #define _BLUR_EFFECT_H 1
3
4 #include "effect.h"
5
6 class SingleBlurPassEffect;
7
8 class BlurEffect : public Effect {
9 public:
10         BlurEffect();
11
12         virtual std::string output_fragment_shader() {
13                 assert(false);
14         }
15         virtual void set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) {
16                 assert(false);
17         }
18
19         virtual bool needs_many_samples() const { return true; }
20         virtual bool needs_mipmaps() const { return true; }
21         virtual void add_self_to_effect_chain(std::vector<Effect *> *chain);
22         virtual bool set_float(const std::string &key, float value);
23         
24 private:
25         SingleBlurPassEffect *hpass, *vpass;
26 };
27
28 class SingleBlurPassEffect : public Effect {
29 public:
30         SingleBlurPassEffect();
31         std::string output_fragment_shader();
32
33         virtual bool needs_many_samples() const { return true; }
34         virtual bool needs_mipmaps() const { return true; }
35
36         void set_uniforms(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
37         
38         enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
39
40 private:
41         float radius;
42         Direction direction;
43 };
44
45 #endif // !defined(_BLUR_EFFECT_H)