]> git.sesse.net Git - movit/blobdiff - glow_effect.h
Fix an issue where a (cached) shader program could be used from multiple
[movit] / glow_effect.h
index 04b48f9aa165e55ab7ba139dba36c883fb492f9b..02520d7bd9ad8f87f38dd9c4365f63be9e85851f 100644 (file)
@@ -1,12 +1,22 @@
-#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 <epoxy/gl.h>
+#include <assert.h>
+#include <string>
 
 #include "effect.h"
 
+namespace movit {
+
 class BlurEffect;
+class EffectChain;
+class HighlightCutoffEffect;
 class MixEffect;
+class Node;
 
 class GlowEffect : public Effect {
 public:
@@ -27,7 +37,27 @@ 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; }
+       virtual bool one_to_one_sampling() const { return true; }
+
+private:
+       float cutoff;
+};
+
+}  // namespace movit
+
+#endif // !defined(_MOVIT_GLOW_EFFECT_H)