5 #include "effect_util.h"
7 #include "vignette_effect.h"
13 VignetteEffect::VignetteEffect()
15 uniform_aspect_correction(1.0f, 1.0f),
16 uniform_flipped_center(0.5f, 0.5f),
20 register_vec2("center", (float *)¢er);
21 register_float("radius", (float *)&radius);
22 register_float("inner_radius", (float *)&inner_radius);
23 register_uniform_float("pihalf_div_radius", &uniform_pihalf_div_radius);
24 register_uniform_vec2("aspect_correction", (float *)&uniform_aspect_correction);
25 register_uniform_vec2("flipped_center", (float *)&uniform_flipped_center);
28 string VignetteEffect::output_fragment_shader()
30 return read_file("vignette_effect.frag");
33 void VignetteEffect::inform_input_size(unsigned input_num, unsigned width, unsigned height) {
34 assert(input_num == 0);
35 if (width >= height) {
36 uniform_aspect_correction = Point2D(float(width) / float(height), 1.0f);
38 uniform_aspect_correction = Point2D(1.0f, float(height) / float(width));
42 void VignetteEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
44 Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
46 uniform_pihalf_div_radius = 0.5 * M_PI / radius;
47 uniform_flipped_center = Point2D(center.x, 1.0f - center.y);