]> git.tdb.fi Git - libs/gl.git/blob - source/effects/postprocessor.h
Update and improve documentation
[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.
16
17 PostProcessors can be added to a Sequence.  They receive the contents of the
18 entire framebuffer as a texture and render it back, altering it in the process.
19 */
20 class PostProcessor
21 {
22 public:
23         /**
24         Holds the parameters for a PostProcessor.  Used with SequenceTemplate.
25         */
26         struct Template
27         {
28                 class Loader: public Msp::DataFile::ObjectLoader<Template>
29                 {
30                 public:
31                         Loader(Template &);
32                 };
33
34                 unsigned size_divisor = 1;
35
36                 virtual ~Template() = default;
37
38                 virtual PostProcessor *create(unsigned, unsigned) const = 0;
39         };
40
41 protected:
42         PostProcessor() { }
43 public:
44         virtual ~PostProcessor() { }
45
46         virtual void render(Renderer &, const Texture2D &, const Texture2D &) = 0;
47
48         virtual void set_debug_name(const std::string &) = 0;
49 };
50
51 } // namespace GL
52 } // namespace Msp
53
54 #endif