From: Mikko Rasa Date: Sat, 8 May 2021 15:36:40 +0000 (+0300) Subject: Use correct sampler for the ambient occlusion rotate lookup X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9489e2fe00469212c42a38fd8c77a15a8ad9e465;p=libs%2Fgl.git Use correct sampler for the ambient occlusion rotate lookup --- diff --git a/builtin_data/_nearest.samp b/builtin_data/_nearest.samp new file mode 100644 index 00000000..c29e7b54 --- /dev/null +++ b/builtin_data/_nearest.samp @@ -0,0 +1,2 @@ +filter NEAREST; +wrap REPEAT; diff --git a/source/effects/ambientocclusion.cpp b/source/effects/ambientocclusion.cpp index a10fa838..bbff1f25 100644 --- a/source/effects/ambientocclusion.cpp +++ b/source/effects/ambientocclusion.cpp @@ -18,7 +18,8 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float): combine_shader(Resources::get_global().get("_ambientocclusion_combine.glsl.shader")), quad(Resources::get_global().get("_fullscreen_quad.mesh")), linear_sampler(Resources::get_global().get("_linear_clamp.samp")), - nearest_sampler(Resources::get_global().get("_nearest_clamp.samp")) + nearest_clamp_sampler(Resources::get_global().get("_nearest_clamp.samp")), + nearest_sampler(Resources::get_global().get("_nearest.samp")) { unsigned seed = 1; rotate_lookup.storage(RGBA8, 4, 4, 1); @@ -83,8 +84,8 @@ void AmbientOcclusion::set_edge_depth_threshold(float edt) void AmbientOcclusion::render(Renderer &renderer, const Texture2D &color, const Texture2D &depth) { Renderer::Push push(renderer); - renderer.set_texture("source", &color, &nearest_sampler); - renderer.set_texture("depth", &depth, &nearest_sampler); + renderer.set_texture("source", &color, &nearest_clamp_sampler); + renderer.set_texture("depth", &depth, &nearest_clamp_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); diff --git a/source/effects/ambientocclusion.h b/source/effects/ambientocclusion.h index b0030c59..71a92703 100644 --- a/source/effects/ambientocclusion.h +++ b/source/effects/ambientocclusion.h @@ -46,6 +46,7 @@ private: mutable ProgramData shdata; const Mesh &quad; const Sampler &linear_sampler; + const Sampler &nearest_clamp_sampler; const Sampler &nearest_sampler; public: