X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=glow_effect.cpp;fp=glow_effect.cpp;h=e4c9a421eef06cbec6a3d125e4b9cb5d92fbaa5e;hp=0000000000000000000000000000000000000000;hb=ef7665d0d3854b3464800d8d7fef9a90f14d9a9f;hpb=1e2d23133575fc1cfeb14652e4b383883bf24512 diff --git a/glow_effect.cpp b/glow_effect.cpp new file mode 100644 index 0000000..e4c9a42 --- /dev/null +++ b/glow_effect.cpp @@ -0,0 +1,33 @@ +#include +#include + +#include "glow_effect.h" +#include "blur_effect.h" +#include "mix_effect.h" +#include "effect_chain.h" +#include "util.h" + +GlowEffect::GlowEffect() + : blur(new BlurEffect), + mix(new MixEffect) +{ + mix->set_float("strength_first", 1.0f); + mix->set_float("strength_second", 0.3f); +} + +void GlowEffect::add_self_to_effect_chain(EffectChain *chain, const std::vector &inputs) { + assert(inputs.size() == 1); + blur->add_self_to_effect_chain(chain, inputs); + + std::vector mix_inputs; + mix_inputs.push_back(inputs[0]); + mix_inputs.push_back(chain->last_added_effect()); // FIXME + mix->add_self_to_effect_chain(chain, mix_inputs); +} + +bool GlowEffect::set_float(const std::string &key, float value) { + if (key == "blurred_mix_amount") { + return mix->set_float("strength_second", value); + } + return blur->set_float(key, value); +}