From: Steinar H. Gunderson Date: Sun, 22 Nov 2015 13:34:56 +0000 (+0100) Subject: Add the missing two array uniform types. X-Git-Tag: 1.3.0~20 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=20c2ca726f0e6c194a1fddcb9908796de19430ac;ds=sidebyside Add the missing two array uniform types. --- diff --git a/effect.cpp b/effect.cpp index 060bf7d..9a30b93 100644 --- a/effect.cpp +++ b/effect.cpp @@ -165,6 +165,16 @@ void Effect::register_uniform_vec4(const std::string &key, const float *values) uniforms_vec4.push_back(uniform); } +void Effect::register_uniform_float_array(const std::string &key, const float *values, size_t num_values) +{ + Uniform uniform; + uniform.name = key; + uniform.value = values; + uniform.num_values = num_values; + uniform.location = -1; + uniforms_float_array.push_back(uniform); +} + void Effect::register_uniform_vec2_array(const std::string &key, const float *values, size_t num_values) { Uniform uniform; @@ -175,6 +185,16 @@ void Effect::register_uniform_vec2_array(const std::string &key, const float *va uniforms_vec2_array.push_back(uniform); } +void Effect::register_uniform_vec3_array(const std::string &key, const float *values, size_t num_values) +{ + Uniform uniform; + uniform.name = key; + uniform.value = values; + uniform.num_values = num_values; + uniform.location = -1; + uniforms_vec3_array.push_back(uniform); +} + void Effect::register_uniform_vec4_array(const std::string &key, const float *values, size_t num_values) { Uniform uniform; diff --git a/effect.h b/effect.h index ebbb672..fe76a75 100644 --- a/effect.h +++ b/effect.h @@ -353,7 +353,9 @@ protected: void register_uniform_vec2(const std::string &key, const float *values); void register_uniform_vec3(const std::string &key, const float *values); void register_uniform_vec4(const std::string &key, const float *values); + void register_uniform_float_array(const std::string &key, const float *values, size_t num_values); void register_uniform_vec2_array(const std::string &key, const float *values, size_t num_values); + void register_uniform_vec3_array(const std::string &key, const float *values, size_t num_values); void register_uniform_vec4_array(const std::string &key, const float *values, size_t num_values); void register_uniform_mat3(const std::string &key, const Eigen::Matrix3d *matrix); @@ -372,7 +374,9 @@ private: std::vector > uniforms_vec2; std::vector > uniforms_vec3; std::vector > uniforms_vec4; + std::vector > uniforms_float_array; std::vector > uniforms_vec2_array; + std::vector > uniforms_vec3_array; std::vector > uniforms_vec4_array; std::vector > uniforms_mat3; friend class EffectChain; diff --git a/effect_chain.cpp b/effect_chain.cpp index 3905564..8a72e17 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -418,7 +418,9 @@ void EffectChain::compile_glsl_program(Phase *phase) extract_uniform_declarations(effect->uniforms_vec2, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms); extract_uniform_declarations(effect->uniforms_vec3, "vec3", effect_id, &phase->uniforms_vec3, &frag_shader_uniforms); extract_uniform_declarations(effect->uniforms_vec4, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms); + extract_uniform_array_declarations(effect->uniforms_float_array, "float", effect_id, &phase->uniforms_float, &frag_shader_uniforms); extract_uniform_array_declarations(effect->uniforms_vec2_array, "vec2", effect_id, &phase->uniforms_vec2, &frag_shader_uniforms); + extract_uniform_array_declarations(effect->uniforms_vec3_array, "vec3", effect_id, &phase->uniforms_vec3, &frag_shader_uniforms); extract_uniform_array_declarations(effect->uniforms_vec4_array, "vec4", effect_id, &phase->uniforms_vec4, &frag_shader_uniforms); extract_uniform_declarations(effect->uniforms_mat3, "mat3", effect_id, &phase->uniforms_mat3, &frag_shader_uniforms); } diff --git a/version.h b/version.h index 87be640..d8b2239 100644 --- a/version.h +++ b/version.h @@ -5,6 +5,6 @@ // changes, even within git versions. There is no specific version // documentation outside the regular changelogs, though. -#define MOVIT_VERSION 12 +#define MOVIT_VERSION 13 #endif // !defined(_MOVIT_VERSION_H)