+ if(current()==this)
+ 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", view_matrix.block<3, 3>(0, 0)*sky_direction);
+ shdata.uniform("horizon_limit", horizon_angle.radians());
+
+ for(unsigned i=0; i<lights.size(); ++i)
+ if(lights[i])
+ lights[i]->update_shader_data(shdata, view_matrix, i);