Add a inverse flag to LumaMixEffect.
[movit] / luma_mix_effect.cpp
1 #include "luma_mix_effect.h"
2 #include "effect_util.h"
3 #include "util.h"
4
5 using namespace std;
6
7 namespace movit {
8
9 LumaMixEffect::LumaMixEffect()
10         : transition_width(1.0f), progress(0.5f), inverse(0)
11 {
12         register_float("transition_width", &transition_width);
13         register_float("progress", &progress);
14         register_int("inverse", &inverse);
15 }
16
17 string LumaMixEffect::output_fragment_shader()
18 {
19         return read_file("luma_mix_effect.frag");
20 }
21
22 void LumaMixEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
23 {
24         Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
25         set_uniform_float(glsl_program_num, prefix, "progress_mul_w_plus_one", progress * (transition_width + 1.0));
26         set_uniform_int(glsl_program_num, prefix, "inverse", inverse);
27 }
28
29 }  // namespace movit