]> git.tdb.fi Git - libs/demoscene.git/blobdiff - source/vignette.h
Add a vignette postprocessor
[libs/demoscene.git] / source / vignette.h
diff --git a/source/vignette.h b/source/vignette.h
new file mode 100644 (file)
index 0000000..0cad6bf
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef MSP_DEMOSCENE_VIGNETTE_H_
+#define MSP_DEMOSCENE_VIGNETTE_H_
+
+#include <msp/gl/postprocessor.h>
+#include <msp/gl/program.h>
+#include <msp/gl/programdata.h>
+
+namespace Msp {
+namespace DemoScene {
+
+class Vignette: public Msp::GL::PostProcessor
+{
+public:
+       struct Template: PostProcessor::Template
+       {
+               class Loader: public Msp::DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
+               {
+               public:
+                       Loader(Template &);
+               };
+
+               float pupil;
+               float aperture;
+               float radius;
+               float darkening;
+
+               Template();
+
+               virtual Vignette *create(unsigned, unsigned) const;
+       };
+
+private:
+       const Msp::GL::Mesh &mesh;
+       const Msp::GL::Program &shprog;
+       Msp::GL::ProgramData shdata;
+
+public:
+       Vignette(float);
+
+       void set_optical(float, float);
+       void set_natural(float, float);
+private:
+       void update_shdata();
+
+public:
+       virtual void render(Msp::GL::Renderer &, const Msp::GL::Texture2D &, const Msp::GL::Texture2D &);
+};
+
+} // namespace DemoScene
+} // namespace Msp
+
+#endif