X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=glow_effect.h;h=91106e03b08927ab3498d784f3611b05e36aafa8;hp=7ee164dceab630d2d1ab2f7573ce4f581bbb037a;hb=5c97329dd35909847e2120b0b368b2723ffe5a44;hpb=ef7665d0d3854b3464800d8d7fef9a90f14d9a9f diff --git a/glow_effect.h b/glow_effect.h index 7ee164d..91106e0 100644 --- a/glow_effect.h +++ b/glow_effect.h @@ -1,20 +1,29 @@ -#ifndef _GLOW_EFFECT_H -#define _GLOW_EFFECT_H 1 +#ifndef _MOVIT_GLOW_EFFECT_H +#define _MOVIT_GLOW_EFFECT_H 1 -// Glow: Simply add a blurred version of the image to itself. +// Glow: Cut out the highlights of the image (everything above a certain threshold), +// blur them, and overlay them onto the original image. + +#include +#include +#include #include "effect.h" class BlurEffect; +class EffectChain; +class HighlightCutoffEffect; class MixEffect; +class Node; class GlowEffect : public Effect { public: GlowEffect(); + virtual std::string effect_type_id() const { return "GlowEffect"; } virtual bool needs_srgb_primaries() const { return false; } - 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() { @@ -26,7 +35,24 @@ public: private: BlurEffect *blur; + HighlightCutoffEffect *cutoff; MixEffect *mix; }; -#endif // !defined(_GLOW_EFFECT_H) +// An effect that cuts out only the highlights of an image; +// anything at the cutoff or below is set to 0.0, and then all other pixels +// get the cutoff subtracted. Used only as part of GlowEffect. + +class HighlightCutoffEffect : public Effect { +public: + HighlightCutoffEffect(); + virtual std::string effect_type_id() const { return "HighlightCutoffEffect"; } + std::string output_fragment_shader(); + + virtual AlphaHandling alpha_handling() const { return INPUT_PREMULTIPLIED_ALPHA_KEEP_BLANK; } + +private: + float cutoff; +}; + +#endif // !defined(_MOVIT_GLOW_EFFECT_H)