1 #ifndef MSP_GL_AMBIENTOCCLUSION_H_
2 #define MSP_GL_AMBIENTOCCLUSION_H_
4 #include "postprocessor.h"
5 #include "programdata.h"
6 #include "rendertarget.h"
14 Implements screen-space ambient occlusion.
16 http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
18 class AmbientOcclusion: public PostProcessor
21 struct Template: PostProcessor::Template
23 class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
30 float occlusion_radius;
32 float edge_depth_threshold;
36 virtual AmbientOcclusion *create(unsigned, unsigned) const;
40 const Texture2D &rotate_lookup;
41 RenderTarget occlude_target;
42 const Program &occlude_shader;
43 const Program &combine_shader;
44 mutable ProgramData shdata;
46 const Sampler &linear_sampler;
47 const Sampler &nearest_clamp_sampler;
48 const Sampler &nearest_sampler;
51 AmbientOcclusion(unsigned, unsigned, float = 1.0f);
54 static const Texture2D &get_or_create_rotate_lookup();
55 static float radical_inverse(unsigned);
58 void set_n_samples(unsigned);
59 void set_occlusion_radius(float);
60 void set_edge_depth_threshold(float);
62 void set_darkness(float);
64 virtual void render(Renderer &, const Texture2D &, const Texture2D &);
66 virtual void set_debug_name(const std::string &);