]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/lighting.cpp
Add inline data items to the collection
[libs/gl.git] / source / materials / lighting.cpp
index 3bbc01a3fa8e4bd4d51fd0fafc924b95651b492d..699aabc02c7daa8679d60b2ab6fd8eaf8d99723b 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdexcept>
 #include <cmath>
 #include <msp/core/algorithm.h>
 #include <stdexcept>
 #include <cmath>
 #include <msp/core/algorithm.h>
+#include <msp/fs/utils.h>
 #include "error.h"
 #include "light.h"
 #include "lighting.h"
 #include "error.h"
 #include "light.h"
 #include "lighting.h"
@@ -21,12 +22,6 @@ Lighting::Lighting():
        set_fog_density(0.0f);
 }
 
        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::set_ambient(const Color &a)
 {
        ambient = a;
@@ -200,8 +195,8 @@ void Lighting::Loader::light_inline()
 {
        RefPtr<Light> lgt = new Light;
        load_sub(*lgt);
 {
        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)
 }
 
 void Lighting::Loader::light_inline_index(unsigned)