]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/ambientocclusion.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / effects / ambientocclusion.h
index 6c2c5d7eea938daa6be0e6e5ce2387dd2a361660..d055c6851e1aa362c4aaab1ea2fb8a3c91ef5662 100644 (file)
@@ -1,20 +1,17 @@
 #ifndef MSP_GL_AMBIENTOCCLUSION_H_
 #define MSP_GL_AMBIENTOCCLUSION_H_
 
-#include "framebuffer.h"
-#include "mesh.h"
 #include "postprocessor.h"
-#include "program.h"
 #include "programdata.h"
 #include "rendertarget.h"
-#include "texture2d.h"
-#include "texturing.h"
 
 namespace Msp {
 namespace GL {
 
+class Program;
+
 /**
-Implements screen-space ambient occlusion.
+Darkens recessed areas of the scene to simulate the occlusion of ambient light.
 
 http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
 */
@@ -29,32 +26,31 @@ public:
                        Loader(Template &);
                };
 
-               unsigned n_samples;
-               float occlusion_radius;
-               float darkness;
-               float edge_depth_threshold;
-
-               Template();
+               unsigned n_samples = 16;
+               float occlusion_radius = 0.5f;
+               float darkness = 1.0f;
+               float edge_depth_threshold = 0.1f;
 
                virtual AmbientOcclusion *create(unsigned, unsigned) const;
        };
 
 private:
-       Texture2D rotate_lookup;
+       const Texture2D &rotate_lookup;
        RenderTarget occlude_target;
-       Texturing texturing;
-       Program occlude_shader;
-       Program combine_shader;
+       const Program &occlude_shader;
+       const Program &combine_shader;
        mutable ProgramData shdata;
-       RefPtr<Mesh> quad;
-       RefPtr<Sampler> linear_sampler;
-       RefPtr<Sampler> nearest_sampler;
+       const Mesh &quad;
+       const Sampler &linear_sampler;
+       const Sampler &nearest_clamp_sampler;
+       const Sampler &nearest_sampler;
 
 public:
-       AmbientOcclusion(unsigned, unsigned, float = 1.0f);
+       AmbientOcclusion(unsigned, unsigned);
 
 private:
-       static float random(unsigned &);
+       static const Texture2D &get_or_create_rotate_lookup();
+       static float radical_inverse(unsigned);
 
 public:
        void set_n_samples(unsigned);
@@ -64,6 +60,8 @@ public:
        void set_darkness(float);
 
        virtual void render(Renderer &, const Texture2D &, const Texture2D &);
+
+       virtual void set_debug_name(const std::string &);
 };
 
 } // namespace GL