]> git.tdb.fi Git - libs/gl.git/commitdiff
Use correct sampler for the ambient occlusion rotate lookup
authorMikko Rasa <tdb@tdb.fi>
Sat, 8 May 2021 15:36:40 +0000 (18:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 9 May 2021 07:53:57 +0000 (10:53 +0300)
builtin_data/_nearest.samp [new file with mode: 0644]
source/effects/ambientocclusion.cpp
source/effects/ambientocclusion.h

diff --git a/builtin_data/_nearest.samp b/builtin_data/_nearest.samp
new file mode 100644 (file)
index 0000000..c29e7b5
--- /dev/null
@@ -0,0 +1,2 @@
+filter NEAREST;
+wrap REPEAT;
index a10fa838e7b3b1d0f2da41c1f4f3b029a97df92e..bbff1f25b45d5c7bad60768e96be28f8b0bbf427 100644 (file)
@@ -18,7 +18,8 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float):
        combine_shader(Resources::get_global().get<Program>("_ambientocclusion_combine.glsl.shader")),
        quad(Resources::get_global().get<Mesh>("_fullscreen_quad.mesh")),
        linear_sampler(Resources::get_global().get<Sampler>("_linear_clamp.samp")),
-       nearest_sampler(Resources::get_global().get<Sampler>("_nearest_clamp.samp"))
+       nearest_clamp_sampler(Resources::get_global().get<Sampler>("_nearest_clamp.samp")),
+       nearest_sampler(Resources::get_global().get<Sampler>("_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);
index b0030c5917d56e0c785600d336517448bf0cb805..71a9270337a0d8517ab848ad2a9dd11dad22d548 100644 (file)
@@ -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: