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);
}
}
}
}
+int Lighting::find_light_index(const Light &l) const
+{
+ auto i = find_member(lights, &l, &AttachedLight::light);
+ return (i!=lights.end() ? i-lights.begin() : -1);
+}
+
const ProgramData &Lighting::get_shader_data() const
{
for(unsigned i=0; i<lights.size(); ++i)
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)
{
void Lighting::Loader::light_inline()
{
- RefPtr<Light> 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