X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Flighting.cpp;h=91bc4d064b5afaef528057a2a654f2e8a11f7197;hb=e9a898f;hp=3bbc01a3fa8e4bd4d51fd0fafc924b95651b492d;hpb=b9d8d358aab136fb1d1242360fe4f3c3711bde11;p=libs%2Fgl.git diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index 3bbc01a3..91bc4d06 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "error.h" #include "light.h" #include "lighting.h" @@ -21,12 +22,6 @@ Lighting::Lighting(): set_fog_density(0.0f); } -Lighting::~Lighting() -{ - for(vector::iterator i=owned_data.begin(); i!=owned_data.end(); ++i) - delete *i; -} - void Lighting::set_ambient(const Color &a) { ambient = a; @@ -79,7 +74,7 @@ void Lighting::attach(const Light &l) void Lighting::detach(const Light &l) { - vector::iterator i = find_member(lights, &l, &AttachedLight::light); + auto i = find_member(lights, &l, &AttachedLight::light); if(i!=lights.end()) lights.erase(i); } @@ -200,8 +195,8 @@ void Lighting::Loader::light_inline() { RefPtr lgt = new Light; load_sub(*lgt); - obj.attach(*lgt); - obj.owned_data.push_back(lgt.release()); + get_collection().add(format("%s/%d.light", FS::basename(get_source()), obj.lights.size()), lgt.get()); + obj.attach(*lgt.release()); } void Lighting::Loader::light_inline_index(unsigned)