]> git.sesse.net Git - movit/blob - glow_effect.h
Use autoconf defaults for CXX and CXXFLAGS.
[movit] / glow_effect.h
1 #ifndef _MOVIT_GLOW_EFFECT_H
2 #define _MOVIT_GLOW_EFFECT_H 1
3
4 // Glow: Cut out the highlights of the image (everything above a certain threshold),
5 // blur them, and overlay them onto the original image.
6
7 #include <GL/glew.h>
8 #include <assert.h>
9 #include <string>
10
11 #include "effect.h"
12
13 class BlurEffect;
14 class EffectChain;
15 class HighlightCutoffEffect;
16 class MixEffect;
17 class Node;
18
19 class GlowEffect : public Effect {
20 public:
21         GlowEffect();
22         virtual std::string effect_type_id() const { return "GlowEffect"; }
23
24         virtual bool needs_srgb_primaries() const { return false; }
25
26         virtual void rewrite_graph(EffectChain *graph, Node *self);
27         virtual bool set_float(const std::string &key, float value);
28
29         virtual std::string output_fragment_shader() {
30                 assert(false);
31         }
32         virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) {
33                 assert(false);
34         }
35
36 private:
37         BlurEffect *blur;
38         HighlightCutoffEffect *cutoff;
39         MixEffect *mix;
40 };
41
42 // An effect that cuts out only the highlights of an image;
43 // anything at the cutoff or below is set to 0.0, and then all other pixels
44 // get the cutoff subtracted. Used only as part of GlowEffect.
45
46 class HighlightCutoffEffect : public Effect {
47 public:
48         HighlightCutoffEffect();
49         virtual std::string effect_type_id() const { return "HighlightCutoffEffect"; }
50         std::string output_fragment_shader();
51         
52         virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; }
53
54 private:
55         float cutoff;
56 };
57
58 #endif // !defined(_MOVIT_GLOW_EFFECT_H)