Move to 'using namespace std;' in all .cpp files.
[movit] / lift_gamma_gain_effect.cpp
1 #include <GL/glew.h>
2 #include <math.h>
3
4 #include "effect_util.h"
5 #include "lift_gamma_gain_effect.h"
6 #include "util.h"
7
8 using namespace std;
9
10 LiftGammaGainEffect::LiftGammaGainEffect()
11         : lift(0.0f, 0.0f, 0.0f),
12           gamma(1.0f, 1.0f, 1.0f),
13           gain(1.0f, 1.0f, 1.0f)
14 {
15         register_vec3("lift", (float *)&lift);
16         register_vec3("gamma", (float *)&gamma);
17         register_vec3("gain", (float *)&gain);
18 }
19
20 string LiftGammaGainEffect::output_fragment_shader()
21 {
22         return read_file("lift_gamma_gain_effect.frag");
23 }
24
25 void LiftGammaGainEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
26 {
27         Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
28
29         RGBTriplet gain_pow_inv_gamma(
30                 pow(gain.r, 1.0f / gamma.r),
31                 pow(gain.g, 1.0f / gamma.g),
32                 pow(gain.b, 1.0f / gamma.b));
33         set_uniform_vec3(glsl_program_num, prefix, "gain_pow_inv_gamma", (float *)&gain_pow_inv_gamma);
34
35         RGBTriplet inv_gamma_22(
36                 2.2f / gamma.r,
37                 2.2f / gamma.g,
38                 2.2f / gamma.b);
39         set_uniform_vec3(glsl_program_num, prefix, "inv_gamma_22", (float *)&inv_gamma_22);
40 }