]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/sky.cpp
Split the Light class into subclasses by light type
[libs/gl.git] / source / effects / sky.cpp
index d9c95b3bd79839fed84d1ad3f06235a4f5ac626e..fcb465b8bb71960fc480086ff263baeb73119fd7 100644 (file)
@@ -1,6 +1,6 @@
 #include <msp/geometry/hypersphere.h>
 #include <msp/geometry/ray.h>
-#include "light.h"
+#include "directionallight.h"
 #include "mesh.h"
 #include "renderer.h"
 #include "resources.h"
@@ -12,7 +12,7 @@ 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, (COLOR_ATTACHMENT,RGB16F)),
@@ -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);