X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flighting.cpp;h=a927d622fade9b0c81a916f51ef31bce079bf825;hb=89d3d10b75a42f86b224feb00b20283af66c0b01;hp=2ba1edc5560e00889ecd31fa01592f121a68a993;hpb=70663ae97d5b70a6b468e07dd7e73475a175dc9b;p=libs%2Fgl.git diff --git a/source/lighting.cpp b/source/lighting.cpp index 2ba1edc5..a927d622 100644 --- a/source/lighting.cpp +++ b/source/lighting.cpp @@ -1,4 +1,6 @@ #include +#include +#include "error.h" #include "light.h" #include "lighting.h" #include "lightunit.h" @@ -38,9 +40,6 @@ void Lighting::set_horizon_angle(const Geometry::Angle &a) void Lighting::attach(unsigned i, const Light &l) { - if(i>=LightUnit::get_n_units()) - throw out_of_range("Lighting::attach"); - if(i>=lights.size()) lights.resize(i+1); @@ -59,11 +58,16 @@ void Lighting::detach(unsigned i) Light::unbind_from(i); } +const Light *Lighting::get_attached_light(unsigned i) const +{ + return i(0, 0)*sky_direction); shdata.uniform("horizon_limit", horizon_angle.radians()); for(unsigned i=0; iLightUnit::get_n_units()) + throw invalid_operation("Lighting::bind"); + if(!set_current(this)) return;