X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fambientocclusion.cpp;h=350c6423dd4ac21c5335f91402cd08eeb7d23494;hb=92ad161ed948637c235e198510136f0dace2ca3e;hp=d8470077f03ca3e453f36510777880fb2c04dbe7;hpb=6065f6622cc275dc0b20baaf7c267e71169d18f3;p=libs%2Fgl.git diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index d8470077..350c6423 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -2,15 +2,17 @@ #include "ambientocclusion.h" #include "blend.h" #include "camera.h" +#include "mesh.h" #include "renderer.h" #include "resources.h" +#include "texture2d.h" using namespace std; namespace Msp { namespace GL { -AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float): +AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h): rotate_lookup(get_or_create_rotate_lookup()), occlude_target(w, h, (COLOR_ATTACHMENT,R8)), occlude_shader(Resources::get_global().get("_ambientocclusion_occlude.glsl.shader")), @@ -30,7 +32,7 @@ const Texture2D &AmbientOcclusion::get_or_create_rotate_lookup() { Resources &resources = Resources::get_global(); - static const string name = "_ambientocclusion_rotate.tex2d"; + static const string name = "_ambientocclusion_rotate.tex"; Texture2D *rotate_lookup = resources.find(name); if(rotate_lookup) return *rotate_lookup; @@ -108,9 +110,11 @@ void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const renderer.set_shader_program(&occlude_shader, &shdata); renderer.set_framebuffer(&occlude_target.get_framebuffer()); + renderer.clear(0); quad.draw(renderer); renderer.set_framebuffer(out_fbo); + renderer.clear(0); renderer.set_shader_program(&combine_shader); quad.draw(renderer); } @@ -126,13 +130,6 @@ void AmbientOcclusion::set_debug_name(const string &name) } -AmbientOcclusion::Template::Template(): - n_samples(16), - occlusion_radius(0.5f), - darkness(1.0f), - edge_depth_threshold(0.1f) -{ } - AmbientOcclusion *AmbientOcclusion::Template::create(unsigned width, unsigned height) const { RefPtr ao = new AmbientOcclusion(width/size_divisor, height/size_divisor);