X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect.cpp;h=805138f019458320db49ab62a7f746812cdd7bd8;hp=3446b42c05baab5553ae83f71c69d6ef8467774f;hb=8cd14c3d54e817f9ad83966409dd672bcbfb7555;hpb=0c821b2eb013de712041d2b337612b9a6297695f diff --git a/effect.cpp b/effect.cpp index 3446b42..805138f 100644 --- a/effect.cpp +++ b/effect.cpp @@ -21,6 +21,15 @@ bool Effect::set_int(const string &key, int value) return true; } +bool Effect::set_ivec2(const string &key, const int *values) +{ + if (params_ivec2.count(key) == 0) { + return false; + } + memcpy(params_ivec2[key], values, sizeof(int) * 2); + return true; +} + bool Effect::set_float(const string &key, float value) { if (params_float.count(key) == 0) { @@ -64,6 +73,13 @@ void Effect::register_int(const string &key, int *value) register_uniform_int(key, value); } +void Effect::register_ivec2(const string &key, int *values) +{ + assert(params_ivec2.count(key) == 0); + params_ivec2[key] = values; + register_uniform_ivec2(key, values); +} + void Effect::register_float(const string &key, float *value) { assert(params_float.count(key) == 0); @@ -126,6 +142,16 @@ void Effect::register_uniform_int(const std::string &key, const int *value) uniforms_int.push_back(uniform); } +void Effect::register_uniform_ivec2(const std::string &key, const int *values) +{ + Uniform uniform; + uniform.name = key; + uniform.value = values; + uniform.num_values = 1; + uniform.location = -1; + uniforms_ivec2.push_back(uniform); +} + void Effect::register_uniform_float(const std::string &key, const float *value) { Uniform uniform;