4 #include "blur_effect.h"
5 #include "diffusion_effect.h"
6 #include "effect_chain.h"
13 DiffusionEffect::DiffusionEffect()
14 : blur(new BlurEffect),
15 overlay_matte(new OverlayMatteEffect)
19 void DiffusionEffect::rewrite_graph(EffectChain *graph, Node *self)
21 assert(self->incoming_links.size() == 1);
22 Node *input = self->incoming_links[0];
24 Node *blur_node = graph->add_node(blur);
25 Node *overlay_matte_node = graph->add_node(overlay_matte);
26 graph->replace_receiver(self, overlay_matte_node);
27 graph->connect_nodes(input, blur_node);
28 graph->connect_nodes(blur_node, overlay_matte_node);
29 graph->replace_sender(self, overlay_matte_node);
31 self->disabled = true;
34 bool DiffusionEffect::set_float(const string &key, float value) {
35 if (key == "blurred_mix_amount") {
36 return overlay_matte->set_float(key, value);
38 return blur->set_float(key, value);
41 OverlayMatteEffect::OverlayMatteEffect()
42 : blurred_mix_amount(0.3f)
44 register_float("blurred_mix_amount", &blurred_mix_amount);
47 string OverlayMatteEffect::output_fragment_shader()
49 return read_file("overlay_matte_effect.frag");