- if(c<Geometry::Angle<float>::zero() || (c>Geometry::Angle<float>::right() && c!=Geometry::Angle<float>::straight()))
- throw invalid_argument("Light::set_spot_cutoff");
-
- spot_cutoff = c;
-}
-
-void Light::disable_spot_cutoff()
-{
- set_spot_cutoff(Geometry::Angle<float>::straight());
-}
-
-void Light::set_attenuation(float c, float l, float q)
-{
- attenuation[0] = c;
- attenuation[1] = l;
- attenuation[2] = q;
-}
-
-void Light::update_shader_data(ProgramData &shdata, const Matrix &view_matrix, unsigned i) const
-{
- string base = format("light_sources[%d]", i);
- shdata.uniform(base+".position", view_matrix*position);
- shdata.uniform(base+".color", color.r*transmittance.r, color.g*transmittance.g, color.b*transmittance.b);
+ static GenericLoader::TypeRegistry registry;
+ static bool initialized = false;
+ if(!initialized)
+ {
+ initialized = true;
+ registry.register_type<DirectionalLight>("directional");
+ registry.register_type<PointLight>("point");
+ }
+ return registry;