X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterials%2Flighting.cpp;h=d8e5400626ae43eb26221ebd92bd748bb8043972;hp=c1b2e2aaf0a02619fb17f9a1e06f456bc27fdd1a;hb=HEAD;hpb=ae45c0397e2cb8f0a01f2f31d01c95ff3870271e diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index c1b2e2aa..d8e54006 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -18,12 +18,13 @@ Lighting::Lighting() set_fog_color(Color(0.0f, 0.0f, 0.0f, 0.0f)); set_fog_density(0.0f); - for(unsigned i=0; i<8; ++i) + for(unsigned i=0; i<6; ++i) { 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); + shdata.uniform(base+".attenuation", 1.0f, 0.0f, 0.0f); } } @@ -142,10 +143,10 @@ void Lighting::Loader::light(const string &name) void Lighting::Loader::light_inline() { - RefPtr lgt = new Light; - load_sub(*lgt); - get_collection().add(format("%s/%d.light", FS::basename(get_source()), obj.lights.size()), lgt.get()); - obj.attach(*lgt.release()); + Light::GenericLoader ldr(get_collection()); + load_sub_with(ldr); + Light *lgt = ldr.store_object(get_collection(), format("%s/%d.light", FS::basename(get_source()), obj.lights.size())); + obj.attach(*lgt); } } // namespace GL