]> git.tdb.fi Git - libs/gl.git/blob - source/ambientocclusion.h
Use Renderer for rendering PostProcessors
[libs/gl.git] / source / ambientocclusion.h
1 #ifndef MSP_GL_AMBIENTOCCLUSION_H_
2 #define MSP_GL_AMBIENTOCCLUSION_H_
3
4 #include "framebuffer.h"
5 #include "mesh.h"
6 #include "postprocessor.h"
7 #include "program.h"
8 #include "programdata.h"
9 #include "texture2d.h"
10 #include "texturing.h"
11
12 namespace Msp {
13 namespace GL {
14
15 /**
16 Implements screen-space ambient occlusion.
17
18 http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
19 */
20 class AmbientOcclusion: public PostProcessor
21 {
22 private:
23         Texture2D occlusion;
24         Texture2D rotate_lookup;
25         Framebuffer fbo;
26         Texturing occlude_texturing;
27         Program occlude_shader;
28         ProgramData occlude_shdata;
29         Texturing combine_texturing;
30         Program combine_shader;
31         ProgramData combine_shdata;
32         const Mesh &quad;
33
34 public:
35         AmbientOcclusion(unsigned, unsigned, float);
36
37         void set_depth_ratio(float);
38         void set_darkness(float);
39
40         virtual void render(Renderer &, const Texture2D &, const Texture2D &);
41 };
42
43 } // namespace GL
44 } // namespace Msp
45
46 #endif