From: Mikko Rasa Date: Thu, 7 Oct 2021 12:58:53 +0000 (+0300) Subject: Add keywords for light and material to Resources::Loader X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6880f2eceaab2cec7882b0791dd982fe9d9c5068;p=libs%2Fgl.git Add keywords for light and material to Resources::Loader Since they're loaded with a generic loader now, the standard keyword mechanism can't handle them. --- diff --git a/source/resources/resources.cpp b/source/resources/resources.cpp index ec5f431d..12448a90 100644 --- a/source/resources/resources.cpp +++ b/source/resources/resources.cpp @@ -277,14 +277,17 @@ void Resources::set_debug_name(const string &name, T &item) Resources::Loader::Loader(Resources &r): DerivedObjectLoader(r) { - add("scene", &Loader::scene); + add("light", &Loader::generic); + add("material", &Loader::generic); + add("scene", &Loader::generic); } -void Resources::Loader::scene(const string &name) +template +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 diff --git a/source/resources/resources.h b/source/resources/resources.h index 0633f3c7..f830faaa 100644 --- a/source/resources/resources.h +++ b/source/resources/resources.h @@ -28,7 +28,8 @@ public: Loader(Resources &); private: - void scene(const std::string &); + template + void generic(const std::string &); }; private: