1 #ifndef MSP_GL_POSTPROCESSOR_H_
2 #define MSP_GL_POSTPROCESSOR_H_
4 #include <msp/datafile/objectloader.h>
16 Base class for post-processing effects. Post-processors receive the contents
17 of the entire framebuffer as a texture and render it back, altering it in the
25 class Loader: public Msp::DataFile::ObjectLoader<Template>
31 unsigned size_divisor;
34 virtual ~Template() { }
36 virtual PostProcessor *create(unsigned, unsigned) const = 0;
40 static WeakPtr<Mesh> fullscreen_quad;
41 static WeakPtr<Sampler> nearest_sampler;
42 static WeakPtr<Sampler> linear_sampler;
47 virtual ~PostProcessor() { }
49 /// Renders the effect.
50 virtual void render(const Texture2D &, const Texture2D &) { }
52 virtual void render(Renderer &, const Texture2D &, const Texture2D &);
55 /** Returns a mesh consisting of a single quad, covering the entire screen.
56 The vertices are in normalized device coordinates. */
57 static RefPtr<Mesh> get_fullscreen_quad();
59 static RefPtr<Sampler> get_nearest_sampler();
60 static RefPtr<Sampler> get_linear_sampler();