X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fambientocclusion.h;h=efaa2f378b2be66282648d2855f602fcc1a59071;hb=84e0e55710123e54617d342df852007f8b60af24;hp=71a9270337a0d8517ab848ad2a9dd11dad22d548;hpb=9489e2fe00469212c42a38fd8c77a15a8ad9e465;p=libs%2Fgl.git diff --git a/source/effects/ambientocclusion.h b/source/effects/ambientocclusion.h index 71a92703..efaa2f37 100644 --- a/source/effects/ambientocclusion.h +++ b/source/effects/ambientocclusion.h @@ -1,17 +1,15 @@ #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" namespace Msp { namespace GL { +class Program; + /** Implements screen-space ambient occlusion. @@ -28,18 +26,16 @@ 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; const Program &occlude_shader; const Program &combine_shader; @@ -53,7 +49,8 @@ public: AmbientOcclusion(unsigned, unsigned, float = 1.0f); private: - static float random(unsigned &); + static const Texture2D &get_or_create_rotate_lookup(); + static float radical_inverse(unsigned); public: void set_n_samples(unsigned); @@ -63,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