X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fambientocclusion.cpp;h=d47d18aaa8a6f6992ffb800f29463ee70b87aea2;hb=55e3f2d494d939280a4ea48676fd17ca2342b457;hp=e5de04b4846eebf5fe5ff24569e637f1760ce4ee;hpb=9a63244c1342337915c4610401a24c09fa72cc3d;p=libs%2Fgl.git diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index e5de04b4..d47d18aa 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -14,14 +14,12 @@ namespace GL { AmbientOcclusion::AmbientOcclusion(Resources &resources, unsigned w, unsigned h, float): occlude_target(w, h, (RENDER_COLOR,R8)), - occlude_shader(resources.get("_ambientocclusion_occlude.glsl")), - combine_shader(resources.get("_ambientocclusion_combine.glsl")), + occlude_shader(resources.get("_ambientocclusion_occlude.glsl.shader")), + combine_shader(resources.get("_ambientocclusion_combine.glsl.shader")), quad(resources.get("_fullscreen_quad.mesh")), linear_sampler(resources.get("_linear_clamp.samp")), nearest_sampler(resources.get("_nearest_clamp.samp")) { - texturing.attach(2, occlude_target.get_target_texture(RENDER_COLOR), &linear_sampler); - unsigned seed = 1; rotate_lookup.storage(RGBA8, 4, 4, 1); unsigned char data[64]; @@ -37,12 +35,6 @@ AmbientOcclusion::AmbientOcclusion(Resources &resources, unsigned w, unsigned h, } rotate_lookup.image(0, data); - texturing.attach(3, rotate_lookup, &nearest_sampler); - - shdata.uniform("source", 0); - shdata.uniform("depth", 1); - shdata.uniform("occlusion", 2); - shdata.uniform("rotate", 3); shdata.uniform("inverse_projection", Matrix()); set_n_samples(16); @@ -92,14 +84,14 @@ void AmbientOcclusion::set_edge_depth_threshold(float edt) void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const Texture2D &depth) { - texturing.attach(0, color, &nearest_sampler); - texturing.attach(1, depth, &nearest_sampler); - if(renderer.get_camera()) shdata.uniform("inverse_projection", invert(renderer.get_camera()->get_projection_matrix())); Renderer::Push push(renderer); - renderer.set_texturing(&texturing); + renderer.set_texture("source", &color, &nearest_sampler); + renderer.set_texture("depth", &depth, &nearest_sampler); + renderer.set_texture("occlusion", &occlude_target.get_target_texture(RENDER_COLOR), &linear_sampler); + renderer.set_texture("rotate", &rotate_lookup, &nearest_sampler); renderer.set_shader_program(&occlude_shader, &shdata); {