16 void Lighting::set_ambient(const Color &a)
21 void Lighting::attach(unsigned i, const Light &l)
23 if(i>=LightUnit::get_n_units())
24 throw out_of_range("Lighting::attach");
34 void Lighting::detach(unsigned i)
41 Light::unbind_from(i);
44 void Lighting::bind() const
46 if(!set_current(this))
50 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &ambient.r);
51 for(unsigned i=0; i<lights.size(); ++i)
53 lights[i]->bind_to(i);
56 void Lighting::unbind()
58 const Lighting *old = current();
62 for(unsigned i=0; i<old->lights.size(); ++i)
64 Light::unbind_from(i);