4 #include "diffusion_effect.h"
5 #include "blur_effect.h"
6 #include "effect_chain.h"
9 DiffusionEffect::DiffusionEffect()
10 : blur(new BlurEffect),
11 overlay_matte(new OverlayMatteEffect)
15 std::string DiffusionEffect::output_fragment_shader()
17 return read_file("sandbox_effect.frag");
20 void DiffusionEffect::add_self_to_effect_chain(EffectChain *chain, const std::vector<Effect *> &inputs) {
21 assert(inputs.size() == 1);
22 blur->add_self_to_effect_chain(chain, inputs);
24 std::vector<Effect *> overlay_matte_inputs;
25 overlay_matte_inputs.push_back(inputs[0]);
26 overlay_matte_inputs.push_back(chain->last_added_effect()); // FIXME
27 overlay_matte->add_self_to_effect_chain(chain, overlay_matte_inputs);
30 bool DiffusionEffect::set_float(const std::string &key, float value) {
31 if (key == "blurred_mix_amount") {
32 return overlay_matte->set_float(key, value);
34 return blur->set_float(key, value);
37 OverlayMatteEffect::OverlayMatteEffect()
38 : blurred_mix_amount(0.3f)
40 register_float("blurred_mix_amount", &blurred_mix_amount);
43 std::string OverlayMatteEffect::output_fragment_shader()
45 return read_file("overlay_matte_effect.frag");