New User defined uniforms in Custom shaders

This commit is contained in:
Bruno Herbelin
2024-03-10 11:51:13 +01:00
parent f280d3b64c
commit d5f2b375a6
7 changed files with 164 additions and 27 deletions

View File

@@ -967,6 +967,27 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut
textsrc->contents()->setText(label);
}
}
/// e.g. '/vimix/current/uniform sf var 0.5'
else if (attribute.compare(OSC_SOURCE_UNIFORM) == 0) {
std::string uniform_name;
float uniform_value = NAN;
const char *str = nullptr;
arguments >> str;
uniform_name = std::string(str);
arguments >> uniform_value >> osc::EndMessage;
CloneSource *clonesrc = dynamic_cast<CloneSource *>(target);
if (clonesrc) {
ImageFilter *f = dynamic_cast<ImageFilter *>(clonesrc->filter());
if (f) {
f->setProgramParameter(uniform_name, uniform_value);
}
}
}
/// e.g. '/vimix/current/filter sf blur 0.5'
else if (attribute.compare(OSC_SOURCE_FILTER) == 0) {
std::string filter_name;