]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/lighting.cpp
Split the Light class into subclasses by light type
[libs/gl.git] / source / materials / lighting.cpp
index 113735040ed22ccfa50ea3f71f2448249a857b16..3057d20d77baaccd1e00804ad37521868ff5c342 100644 (file)
@@ -23,7 +23,7 @@ Lighting::Lighting()
                string base = format("light_sources[%d]", i);
                shdata.uniform(base+".position", Vector4(0, 0, 1, 0));
                shdata.uniform(base+".color", 0.0f, 0.0f, 0.0f);
-               shdata.uniform(base+".enabled", 0);
+               shdata.uniform(base+".type", 0);
        }
 }
 
@@ -99,12 +99,6 @@ void Lighting::set_debug_name(const string &name)
 
 DataFile::Loader::ActionMap Lighting::Loader::shared_actions;
 
-Lighting::Loader::Loader(Lighting &l):
-       CollectionObjectLoader<Lighting>(l, 0)
-{
-       set_actions(shared_actions);
-}
-
 Lighting::Loader::Loader(Lighting &l, Collection &c):
        CollectionObjectLoader<Lighting>(l, &c)
 {
@@ -148,8 +142,9 @@ void Lighting::Loader::light(const string &name)
 
 void Lighting::Loader::light_inline()
 {
-       RefPtr<Light> lgt = new Light;
-       load_sub(*lgt);
+       Light::GenericLoader ldr(get_collection());
+       load_sub_with(ldr);
+       RefPtr<Light> lgt = ldr.get_object();
        get_collection().add(format("%s/%d.light", FS::basename(get_source()), obj.lights.size()), lgt.get());
        obj.attach(*lgt.release());
 }