]> git.tdb.fi Git - libs/gl.git/commitdiff
Use a dummy transmittance lookup texture to render the lookup in Sky
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Jan 2022 17:56:39 +0000 (19:56 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Jan 2022 17:56:39 +0000 (19:56 +0200)
Ideally the compiler should optimize the shader so the texture isn't
used, but that'll take some extra effort to implement.

source/effects/sky.cpp
source/effects/sky.h

index eef6a58c4ccdedb622541fb828e2f925a3c17145..2732b7adb86d50834772d59f050de27b79700200 100644 (file)
@@ -25,6 +25,7 @@ Sky::Sky(Renderable &c, DirectionalLight &s):
        backdrop_shprog(Resources::get_global().get<Program>("_sky_backdrop.glsl.shader")),
        sampler(Resources::get_global().get<Sampler>("_linear_clamp.samp")),
        wrap_sampler(Resources::get_global().get<Sampler>("_linear_clamp_v.samp")),
+       dummy_texture(Resources::get_global().get<Texture>("_placeholder.png")),
        rendered(false)
 {
        shdata.uniform("n_steps", 50);
@@ -112,6 +113,7 @@ void Sky::setup_frame(Renderer &renderer)
                        renderer.set_pipeline_key(this);
                        renderer.set_framebuffer(&transmittance_lookup.get_framebuffer());
                        renderer.set_shader_program(&transmittance_shprog);
+                       renderer.set_texture("transmittance_lookup", &dummy_texture, &sampler);
                        fullscreen_mesh.draw(renderer);
                }
 
index 7d8933d4a65f4a6facbb7799fbb99f59293bc6bb..cb8403e77709ff0eb8ab81e9f306c3a4fa422e2b 100644 (file)
@@ -74,6 +74,7 @@ private:
        const Program &backdrop_shprog;
        const Sampler &sampler;
        const Sampler &wrap_sampler;
+       const Texture &dummy_texture;
        mutable ProgramData shdata;
        float view_height;
        bool rendered;