X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fambientocclusion.cpp;h=53b51e127d0993ce8e15093d1d1b1dc25c59c192;hb=3b159edbe4e80a2bc19c4c2fcd42cb996b9fbfe0;hp=bad204a98d848ba5a55dc3048a143314c1623c40;hpb=e55f79ccb21e8c1be3d86f127e3ec1583e58ce92;p=libs%2Fgl.git diff --git a/source/ambientocclusion.cpp b/source/ambientocclusion.cpp index bad204a9..53b51e12 100644 --- a/source/ambientocclusion.cpp +++ b/source/ambientocclusion.cpp @@ -2,6 +2,7 @@ #include #include "ambientocclusion.h" #include "blend.h" +#include "renderer.h" #include "shader.h" #include "tests.h" @@ -66,28 +67,25 @@ void AmbientOcclusion::set_darkness(float darkness) occlude_shdata.uniform("darkness", darkness); } -void AmbientOcclusion::render(const Texture2D &color, const Texture2D &depth) +void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const Texture2D &depth) { occlude_texturing.attach(0, depth); combine_texturing.attach(0, depth); combine_texturing.attach(1, color); - BindRestore unbind_dtest(static_cast(0)); - BindRestore unbind_blend(static_cast(0)); - Bind bind_mesh(quad); { + Renderer::Push push(renderer); BindRestore bind_fbo(fbo); - Bind bind_tex(occlude_texturing); - Bind bind_shader(occlude_shader); - occlude_shdata.apply(); - quad.draw(); + renderer.set_texturing(&occlude_texturing); + renderer.set_shader_program(&occlude_shader, &occlude_shdata); + quad.draw(renderer); } - Bind bind_tex(combine_texturing); - Bind bind_shader(combine_shader); - combine_shdata.apply(); - quad.draw(); + Renderer::Push push(renderer); + renderer.set_texturing(&combine_texturing); + renderer.set_shader_program(&combine_shader, &combine_shdata); + quad.draw(renderer); } } // namespace GL