X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fsky.cpp;h=fcb465b8bb71960fc480086ff263baeb73119fd7;hb=c8520aa336e92f2eaf9a38c3430c608520a90324;hp=23819db36c006cb1f8cb8d53f67cb922686810f1;hpb=cd5f37b066352119cf92d53d0001af7ff99be437;p=libs%2Fgl.git diff --git a/source/effects/sky.cpp b/source/effects/sky.cpp index 23819db3..fcb465b8 100644 --- a/source/effects/sky.cpp +++ b/source/effects/sky.cpp @@ -1,6 +1,6 @@ #include #include -#include "light.h" +#include "directionallight.h" #include "mesh.h" #include "renderer.h" #include "resources.h" @@ -12,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")), @@ -97,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);