]> git.tdb.fi Git - libs/gl.git/blobdiff - source/lighting.cpp
Provide a getter for the number of active animations
[libs/gl.git] / source / lighting.cpp
index d1fd9a70ffc0febe50bd9335b753c87418e32549..a927d622fade9b0c81a916f51ef31bce079bf825 100644 (file)
@@ -58,11 +58,16 @@ void Lighting::detach(unsigned i)
                Light::unbind_from(i);
 }
 
+const Light *Lighting::get_attached_light(unsigned i) const
+{
+       return i<lights.size() ? lights[i] : 0;
+}
+
 void Lighting::update_shader_data(ProgramData &shdata, const Matrix &view_matrix) const
 {
        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)