X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Feffects%2Fsky.cpp;fp=source%2Feffects%2Fsky.cpp;h=a11a76a971bad75f2c6b82f9933af39ddf0db193;hp=fc6d49fd37385e908ca57e4480b1ec61f6190e8f;hb=a9e3cf282bd9c5c43e767552b73068e7a56765e2;hpb=29d5fcb1674903600af6911f019641afcde1c72f diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index fc6d49fd..a11a76a9 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -101,21 +101,25 @@ void Sky::setup_frame(Renderer &renderer) shdata.uniform("light_dir", -sun.get_direction()); sun.set_transmittance(get_transmittance(-sun.get_direction())); - Renderer::Push push(renderer); - - if(transmittance_lookup_dirty) { - transmittance_lookup_dirty = false; - renderer.set_framebuffer(&transmittance_lookup.get_framebuffer()); - renderer.set_shader_program(&transmittance_shprog, &shdata); + Renderer::Push push(renderer); + + renderer.add_shader_data(shdata); + + if(transmittance_lookup_dirty) + { + transmittance_lookup_dirty = false; + renderer.set_framebuffer(&transmittance_lookup.get_framebuffer()); + renderer.set_shader_program(&transmittance_shprog); + fullscreen_mesh.draw(renderer); + } + + renderer.set_framebuffer(&distant.get_framebuffer()); + renderer.set_shader_program(&distant_shprog); + renderer.set_texture("transmittance_lookup", &transmittance_lookup.get_target_texture(0), &sampler); fullscreen_mesh.draw(renderer); } - renderer.set_framebuffer(&distant.get_framebuffer()); - renderer.set_shader_program(&distant_shprog, &shdata); - renderer.set_texture("transmittance_lookup", &transmittance_lookup.get_target_texture(0), &sampler); - fullscreen_mesh.draw(renderer); - content.setup_frame(renderer); }