]> git.tdb.fi Git - libs/demoscene.git/blob - source/vignette.h
Add a vignette postprocessor
[libs/demoscene.git] / source / vignette.h
1 #ifndef MSP_DEMOSCENE_VIGNETTE_H_
2 #define MSP_DEMOSCENE_VIGNETTE_H_
3
4 #include <msp/gl/postprocessor.h>
5 #include <msp/gl/program.h>
6 #include <msp/gl/programdata.h>
7
8 namespace Msp {
9 namespace DemoScene {
10
11 class Vignette: public Msp::GL::PostProcessor
12 {
13 public:
14         struct Template: PostProcessor::Template
15         {
16                 class Loader: public Msp::DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
17                 {
18                 public:
19                         Loader(Template &);
20                 };
21
22                 float pupil;
23                 float aperture;
24                 float radius;
25                 float darkening;
26
27                 Template();
28
29                 virtual Vignette *create(unsigned, unsigned) const;
30         };
31
32 private:
33         const Msp::GL::Mesh &mesh;
34         const Msp::GL::Program &shprog;
35         Msp::GL::ProgramData shdata;
36
37 public:
38         Vignette(float);
39
40         void set_optical(float, float);
41         void set_natural(float, float);
42 private:
43         void update_shdata();
44
45 public:
46         virtual void render(Msp::GL::Renderer &, const Msp::GL::Texture2D &, const Msp::GL::Texture2D &);
47 };
48
49 } // namespace DemoScene
50 } // namespace Msp
51
52 #endif