Add the missing two array uniform types.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 22 Nov 2015 13:34:56 +0000 (14:34 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 22 Nov 2015 13:34:56 +0000 (14:34 +0100)
effect.cpp
effect.h
effect_chain.cpp
version.h

index 060bf7d..9a30b93 100644 (file)
@@ -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<float> 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<float> 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<float> 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<float> uniform;
index ebbb672..fe76a75 100644 (file)
--- 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<Uniform<float> > uniforms_vec2;
        std::vector<Uniform<float> > uniforms_vec3;
        std::vector<Uniform<float> > uniforms_vec4;
+       std::vector<Uniform<float> > uniforms_float_array;
        std::vector<Uniform<float> > uniforms_vec2_array;
+       std::vector<Uniform<float> > uniforms_vec3_array;
        std::vector<Uniform<float> > uniforms_vec4_array;
        std::vector<Uniform<Eigen::Matrix3d> > uniforms_mat3;
        friend class EffectChain;
index 3905564..8a72e17 100644 (file)
@@ -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);
        }
index 87be640..d8b2239 100644 (file)
--- 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)