3 #include "complex_modulate_effect.h"
4 #include "effect_chain.h"
5 #include "effect_util.h"
12 ComplexModulateEffect::ComplexModulateEffect()
13 : num_repeats_x(1), num_repeats_y(1)
15 register_int("num_repeats_x", &num_repeats_x);
16 register_int("num_repeats_y", &num_repeats_y);
17 register_vec2("num_repeats", uniform_num_repeats);
20 string ComplexModulateEffect::output_fragment_shader()
22 return read_file("complex_modulate_effect.frag");
25 void ComplexModulateEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
27 Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
29 uniform_num_repeats[0] = float(num_repeats_x);
30 uniform_num_repeats[1] = float(num_repeats_y);
32 // Set the secondary input to repeat (and nearest while we're at it).
33 Node *self = chain->find_node_for_effect(this);
34 glActiveTexture(chain->get_input_sampler(self, 1));
36 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
38 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
40 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
42 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
46 void ComplexModulateEffect::inform_input_size(unsigned input_num, unsigned width, unsigned height)
49 primary_input_width = width;
50 primary_input_height = height;
54 void ComplexModulateEffect::get_output_size(unsigned *width, unsigned *height,
55 unsigned *virtual_width, unsigned *virtual_height) const
57 *width = *virtual_width = primary_input_width;
58 *height = *virtual_height = primary_input_height;