]> git.sesse.net Git - movit/blob - vignette_effect.h
Reduce the amount of duplication between overloads in test_util.h, by using a few...
[movit] / vignette_effect.h
1 #ifndef _MOVIT_VIGNETTE_EFFECT_H
2 #define _MOVIT_VIGNETTE_EFFECT_H 1
3
4 // A circular vignette, falling off as cosĀ² of the distance from the center
5 // (the classic formula for approximating a real lens).
6
7 #include <epoxy/gl.h>
8 #include <string>
9
10 #include "effect.h"
11
12 namespace movit {
13
14 class VignetteEffect : public Effect {
15 public:
16         VignetteEffect();
17         std::string effect_type_id() const override { return "VignetteEffect"; }
18         std::string output_fragment_shader() override;
19
20         bool needs_srgb_primaries() const override { return false; }
21         AlphaHandling alpha_handling() const override { return DONT_CARE_ALPHA_TYPE; }
22         bool strong_one_to_one_sampling() const override { return true; }
23
24         void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
25         void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
26
27 private:
28         Point2D center;
29         Point2D uniform_aspect_correction, uniform_flipped_center;
30         float radius, inner_radius;
31         float uniform_pihalf_div_radius;
32 };
33
34 }  // namespace movit
35
36 #endif // !defined(_MOVIT_VIGNETTE_EFFECT_H)