]> git.tdb.fi Git - libs/gl.git/blob - source/effects/postprocessor.h
ee169e79470eedded9a31436581437183e04fcd1
[libs/gl.git] / source / effects / postprocessor.h
1 #ifndef MSP_GL_POSTPROCESSOR_H_
2 #define MSP_GL_POSTPROCESSOR_H_
3
4 #include <msp/datafile/objectloader.h>
5
6 namespace Msp {
7 namespace GL {
8
9 class Mesh;
10 class Renderer;
11 class Sampler;
12 class Texture2D;
13
14 /**
15 Base class for post-processing effects.  Post-processors receive the contents
16 of the entire framebuffer as a texture and render it back, altering it in the
17 process.
18 */
19 class PostProcessor
20 {
21 public:
22         struct Template
23         {
24                 class Loader: public Msp::DataFile::ObjectLoader<Template>
25                 {
26                 public:
27                         Loader(Template &);
28                 };
29
30                 unsigned size_divisor;
31
32                 Template();
33                 virtual ~Template() { }
34
35                 virtual PostProcessor *create(unsigned, unsigned) const = 0;
36         };
37
38 protected:
39         PostProcessor() { }
40 public:
41         virtual ~PostProcessor() { }
42
43         /// Renders the effect.
44         virtual void render(Renderer &, const Texture2D &, const Texture2D &) = 0;
45
46         virtual void set_debug_name(const std::string &) = 0;
47 };
48
49 } // namespace GL
50 } // namespace Msp
51
52 #endif