]> git.tdb.fi Git - libs/gl.git/blob - source/effects/postprocessor.h
Use default member initializers for simple types
[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 = 1;
31
32                 virtual ~Template() = default;
33
34                 virtual PostProcessor *create(unsigned, unsigned) const = 0;
35         };
36
37 protected:
38         PostProcessor() { }
39 public:
40         virtual ~PostProcessor() { }
41
42         /// Renders the effect.
43         virtual void render(Renderer &, const Texture2D &, const Texture2D &) = 0;
44
45         virtual void set_debug_name(const std::string &) = 0;
46 };
47
48 } // namespace GL
49 } // namespace Msp
50
51 #endif