#include <stdexcept>
#include <cmath>
#include <msp/core/algorithm.h>
+#include <msp/fs/utils.h>
#include "error.h"
#include "light.h"
#include "lighting.h"
set_fog_density(0.0f);
}
-Lighting::~Lighting()
-{
- for(vector<Light *>::iterator i=owned_data.begin(); i!=owned_data.end(); ++i)
- delete *i;
-}
-
void Lighting::set_ambient(const Color &a)
{
ambient = a;
void Lighting::detach(const Light &l)
{
- vector<AttachedLight>::iterator i = find_member(lights, &l, &AttachedLight::light);
+ auto i = find_member(lights, &l, &AttachedLight::light);
if(i!=lights.end())
lights.erase(i);
}
{
RefPtr<Light> 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)