X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Feffects%2Fsky.cpp;h=fcb465b8bb71960fc480086ff263baeb73119fd7;hp=a210efc94f578e35c7593fab4277d3150ac4575e;hb=adc26a2e141a2853b6c5025130c46a46cece4b84;hpb=ce3658993ce2f6b7527a04a36a5e1af349c6f2e9 diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index a210efc9..fcb465b8 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -1,9 +1,10 @@ #include #include -#include "light.h" +#include "directionallight.h" #include "mesh.h" #include "renderer.h" #include "resources.h" +#include "texture2d.h" #include "sky.h" using namespace std; @@ -11,13 +12,13 @@ using namespace std; namespace Msp { namespace GL { -Sky::Sky(Renderable &r, Light &s): +Sky::Sky(Renderable &r, DirectionalLight &s): Effect(r), sun(s), - transmittance_lookup(128, 64, (RENDER_COLOR, RGB16F)), + transmittance_lookup(128, 64, (COLOR_ATTACHMENT,RGB16F)), transmittance_shprog(Resources::get_global().get("_sky_transmittance.glsl.shader")), transmittance_lookup_dirty(true), - distant(256, 128, (RENDER_COLOR, RGB16F)), + distant(256, 128, (COLOR_ATTACHMENT,RGB16F)), distant_shprog(Resources::get_global().get("_sky_distant.glsl.shader")), fullscreen_mesh(Resources::get_global().get("_fullscreen_quad.mesh")), backdrop_shprog(Resources::get_global().get("_sky_backdrop.glsl.shader")), @@ -96,8 +97,8 @@ void Sky::setup_frame(Renderer &renderer) rendered = true; shdata.uniform("light_color", sun.get_color()); - shdata.uniform("light_dir", sun.get_position().slice<3>(0)); - sun.set_transmittance(get_transmittance(normalize(sun.get_position().slice<3>(0)))); + shdata.uniform("light_dir", -sun.get_direction()); + sun.set_transmittance(get_transmittance(-sun.get_direction())); Renderer::Push push(renderer);