X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect.cpp;h=74bd939f3f1e811303519e4aaf5d5ed2dac615bb;hp=1bbb89f08417821b9ffbdd2759763cd4517d3a9a;hb=0de0202b22a6349d0f9c838947a96eef8155ac90;hpb=d3cf1194740dbecde06f5e721a7e1910437a7666 diff --git a/effect.cpp b/effect.cpp index 1bbb89f..74bd939 100644 --- a/effect.cpp +++ b/effect.cpp @@ -1,5 +1,3 @@ -#define GL_GLEXT_PROTOTYPES 1 - #include #include #include @@ -7,8 +5,7 @@ #include "effect_chain.h" #include "util.h" -#include -#include +#include "opengl.h" GLint get_uniform_location(GLuint glsl_program_num, const std::string &prefix, const std::string &key) { @@ -82,6 +79,24 @@ void set_uniform_vec4_array(GLuint glsl_program_num, const std::string &prefix, check_error(); } +void set_uniform_mat3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const Matrix3x3 matrix) +{ + GLint location = get_uniform_location(glsl_program_num, prefix, key); + if (location == -1) { + return; + } + check_error(); + + // Convert to float (GLSL has no double matrices). + float matrixf[9]; + for (unsigned i = 0; i < 9; ++i) { + matrixf[i] = matrix[i]; + } + + glUniformMatrix3fv(location, 1, GL_FALSE, matrixf); + check_error(); +} + bool Effect::set_int(const std::string &key, int value) { if (params_int.count(key) == 0) { @@ -170,11 +185,6 @@ void Effect::invalidate_1d_texture(const std::string &key) params_tex_1d[key].needs_update = true; } -void Effect::add_self_to_effect_chain(EffectChain *chain, const std::vector &inputs) -{ - chain->add_effect_raw(this, inputs); -} - // Output convenience uniforms for each parameter. // These will be filled in per-frame. std::string Effect::output_convenience_uniforms() const