]> git.tdb.fi Git - libs/gl.git/blobdiff - source/lighting.cpp
Adapt to the new vector/matrix slicing API in mspmath
[libs/gl.git] / source / lighting.cpp
index 7f662c72d9ccf55bdb0e5e8831706b9781709360..239bdc19d0d03fdb9d0bcfaf58902d4c12abf4f6 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdexcept>
+#include <msp/gl/extensions/msp_legacy_features.h>
 #include "error.h"
 #include "light.h"
 #include "lighting.h"
@@ -61,7 +62,7 @@ void Lighting::update_shader_data(ProgramData &shdata, const Matrix &view_matrix
 {
        shdata.uniform("ambient_color", ambient);
        shdata.uniform("sky_color", sky_color);
-       shdata.uniform("eye_sky_dir", Vector3(view_matrix*Vector4(sky_direction, 0.0f)));
+       shdata.uniform("eye_sky_dir", view_matrix.block<3, 3>(0, 0)*sky_direction);
        shdata.uniform("horizon_limit", horizon_angle.radians());
 
        for(unsigned i=0; i<lights.size(); ++i)
@@ -71,6 +72,7 @@ void Lighting::update_shader_data(ProgramData &shdata, const Matrix &view_matrix
 
 void Lighting::bind() const
 {
+       static Require _req(MSP_legacy_features);
        if(lights.size()>LightUnit::get_n_units())
                throw invalid_operation("Lighting::bind");