- if(i>=lights.size())
- return;
-
- detach(*lights[i].light);
-}
-
-const Light *Lighting::get_attached_light(unsigned i) const
-{
- return i<lights.size() ? lights[i].light : 0;
-}
-
-void Lighting::update_shader_data(ProgramData &sd, const Matrix &) const
-{
- sd.uniform("ambient_color", ambient);
- sd.uniform("sky_color", sky_color);
- sd.uniform("world_zenith_dir", zenith_direction);
- sd.uniform("horizon_limit", horizon_angle.radians());
- sd.uniform("fog_color", fog_color);
- sd.uniform("fog_density", fog_density);
-
- for(unsigned i=0; i<lights.size(); ++i)
- if(lights[i].light)
- lights[i].light->update_shader_data(sd, i);
+ auto i = find_member(lights, &l, &AttachedLight::light);
+ return (i!=lights.end() ? i-lights.begin() : -1);