]> git.tdb.fi Git - libs/gl.git/blobdiff - source/ambientocclusion.h
Allow setting uniform values using a Uniform object
[libs/gl.git] / source / ambientocclusion.h
index 4affd04987aef3f1b6ce6c5c71b99bf12a2a4b64..b6daa776d6af8804f5cf1186cb7974d1b5f3783d 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GL_AMBIENTOCCLUSION_H_
 #define MSP_GL_AMBIENTOCCLUSION_H_
 
@@ -13,6 +6,7 @@ Distributed under the LGPL
 #include "postprocessor.h"
 #include "program.h"
 #include "programdata.h"
+#include "rendertarget.h"
 #include "texture2d.h"
 #include "texturing.h"
 
@@ -27,24 +21,30 @@ http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
 class AmbientOcclusion: public PostProcessor
 {
 private:
-       Texture2D occlusion;
        Texture2D rotate_lookup;
-       Framebuffer fbo;
-       Texturing occlude_texturing;
+       RenderTarget occlude_target;
+       Texturing texturing;
        Program occlude_shader;
-       ProgramData occlude_shdata;
-       Texturing combine_texturing;
        Program combine_shader;
-       ProgramData combine_shdata;
-       Mesh quad;
+       mutable ProgramData shdata;
+       const Mesh &quad;
+
+public:
+       AmbientOcclusion(unsigned, unsigned, float = 1.0f);
+
+private:
+       static float random(unsigned &);
 
 public:
-       AmbientOcclusion(unsigned, unsigned, float);
+       void set_n_samples(unsigned);
+       void set_occlusion_radius(float);
 
+       // Deprecated
        void set_depth_ratio(float);
+
        void set_darkness(float);
 
-       virtual void render(const Texture2D &, const Texture2D &);
+       virtual void render(Renderer &, const Texture2D &, const Texture2D &);
 };
 
 } // namespace GL