4 #include "blur_effect.h"
5 #include "diffusion_effect.h"
6 #include "effect_chain.h"
9 DiffusionEffect::DiffusionEffect()
10 : blur(new BlurEffect),
11 overlay_matte(new OverlayMatteEffect)
15 void DiffusionEffect::rewrite_graph(EffectChain *graph, Node *self)
17 assert(self->incoming_links.size() == 1);
18 Node *input = self->incoming_links[0];
20 Node *blur_node = graph->add_node(blur);
21 Node *overlay_matte_node = graph->add_node(overlay_matte);
22 graph->replace_receiver(self, overlay_matte_node);
23 graph->connect_nodes(input, blur_node);
24 graph->connect_nodes(blur_node, overlay_matte_node);
25 graph->replace_sender(self, overlay_matte_node);
27 self->disabled = true;
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");