X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=diffusion_effect.h;h=77625ae439568b8fb6f043b5da796ddad067490d;hp=4223d22aa8c0f1cf2f74b8ea2b42c2dba1bce7b7;hb=6f1efa8348a90a393187c12d70fd10d81bbd2c99;hpb=e0911a55394fd2b2dac393017950a39fa3e688c8 diff --git a/diffusion_effect.h b/diffusion_effect.h index 4223d22..77625ae 100644 --- a/diffusion_effect.h +++ b/diffusion_effect.h @@ -1,5 +1,5 @@ -#ifndef _DIFFUSION_EFFECT_H -#define _DIFFUSION_EFFECT_H 1 +#ifndef _MOVIT_DIFFUSION_EFFECT_H +#define _MOVIT_DIFFUSION_EFFECT_H 1 // There are many different effects that go under the name of "diffusion", // seemingly all of the inspired by the effect you get when you put a @@ -12,22 +12,39 @@ // where we first blur the picture, and then overlay it on the original // using the original as a matte. +#include +#include +#include + #include "effect.h" +namespace movit { + class BlurEffect; +class EffectChain; +class Node; class OverlayMatteEffect; class DiffusionEffect : public Effect { public: DiffusionEffect(); - std::string output_fragment_shader(); + ~DiffusionEffect(); + virtual std::string effect_type_id() const { return "DiffusionEffect"; } - virtual void add_self_to_effect_chain(EffectChain *chain, const std::vector &input); + virtual void rewrite_graph(EffectChain *graph, Node *self); virtual bool set_float(const std::string &key, float value); + + virtual std::string output_fragment_shader() { + assert(false); + } + virtual void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) { + assert(false); + } private: BlurEffect *blur; OverlayMatteEffect *overlay_matte; + bool owns_overlay_matte; }; // Used internally by DiffusionEffect; combines the blurred and the original @@ -35,13 +52,17 @@ private: class OverlayMatteEffect : public Effect { public: OverlayMatteEffect(); + virtual std::string effect_type_id() const { return "OverlayMatteEffect"; } std::string output_fragment_shader(); + virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; } unsigned num_inputs() const { return 2; } + virtual bool one_to_one_sampling() const { return true; } private: float blurred_mix_amount; }; +} // namespace movit -#endif // !defined(_DIFFUSION_EFFECT_H) +#endif // !defined(_MOVIT_DIFFUSION_EFFECT_H)