Resources::Loader::Loader(Resources &r):
DerivedObjectLoader<Resources, Collection::Loader>(r)
{
- add("scene", &Loader::scene);
+ add("light", &Loader::generic<Light>);
+ add("material", &Loader::generic<Material>);
+ add("scene", &Loader::generic<Scene>);
}
-void Resources::Loader::scene(const string &name)
+template<typename T>
+void Resources::Loader::generic(const string &name)
{
- Scene::GenericLoader ldr(obj);
+ typename T::GenericLoader ldr(obj);
load_sub_with(ldr);
- obj.add(name, ldr.get_object());
+ ldr.store_object(obj, name);
}
} // namespace GL