]> git.sesse.net Git - movit/commitdiff
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 060bf7dd35fca361c4c160c6b71cf242104019f8..9a30b93d2dc2ac03364f03107915aa5aec143fe2 100644 (file)
@@ -165,6 +165,16 @@ void Effect::register_uniform_vec4(const std::string &key, const float *values)
        uniforms_vec4.push_back(uniform);
 }
 
        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;
 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);
 }
 
        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;
 void Effect::register_uniform_vec4_array(const std::string &key, const float *values, size_t num_values)
 {
        Uniform<float> uniform;
index ebbb6726104051caaba9b4e58df21279682dc1f3..fe76a7569976b80b690a8e3c2ed87f0078ab8a2d 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_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_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);
 
        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_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_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;
        std::vector<Uniform<float> > uniforms_vec4_array;
        std::vector<Uniform<Eigen::Matrix3d> > uniforms_mat3;
        friend class EffectChain;
index 39055649a4135c11e47e1b80c0284e598a7948c3..8a72e1756dd90a98502de0944ffc00225a676227 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_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_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);
        }
                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 87be6406e67bebedf2be83aecc19bc206f410816..d8b22392b8ca185f48039654c8fc55e1d6dacdaa 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.
 
 // 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)
 
 #endif // !defined(_MOVIT_VERSION_H)