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),
16 owns_overlay_matte(true)
20 DiffusionEffect::~DiffusionEffect()
22 if (owns_overlay_matte) {
27 void DiffusionEffect::rewrite_graph(EffectChain *graph, Node *self)
29 assert(self->incoming_links.size() == 1);
30 Node *input = self->incoming_links[0];
32 Node *blur_node = graph->add_node(blur);
33 Node *overlay_matte_node = graph->add_node(overlay_matte);
34 owns_overlay_matte = false;
35 graph->replace_receiver(self, overlay_matte_node);
36 graph->connect_nodes(input, blur_node);
37 graph->connect_nodes(blur_node, overlay_matte_node);
38 graph->replace_sender(self, overlay_matte_node);
40 self->disabled = true;
43 bool DiffusionEffect::set_float(const string &key, float value) {
44 if (key == "blurred_mix_amount") {
45 return overlay_matte->set_float(key, value);
47 return blur->set_float(key, value);
50 OverlayMatteEffect::OverlayMatteEffect()
51 : blurred_mix_amount(0.3f)
53 register_float("blurred_mix_amount", &blurred_mix_amount);
56 string OverlayMatteEffect::output_fragment_shader()
58 return read_file("overlay_matte_effect.frag");