From 2108712bcde8b5c4573ca4d602d5f8948b810d72 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 15 Apr 2021 20:57:51 +0300 Subject: [PATCH] Make Scenes loadable from collection files too --- source/resources/resources.cpp | 14 ++++++++++++++ source/resources/resources.h | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/source/resources/resources.cpp b/source/resources/resources.cpp index e83f33eb..b5093932 100644 --- a/source/resources/resources.cpp +++ b/source/resources/resources.cpp @@ -229,5 +229,19 @@ Program *Resources::create_program(const string &name) return 0; } + +Resources::Loader::Loader(Resources &r): + DerivedObjectLoader(r) +{ + add("scene", &Loader::scene); +} + +void Resources::Loader::scene(const string &name) +{ + Scene::GenericLoader ldr(obj); + load_sub_with(ldr); + obj.add(name, ldr.get_scene()); +} + } // namespace GL } // namespace Msp diff --git a/source/resources/resources.h b/source/resources/resources.h index abda5cde..5861bbfb 100644 --- a/source/resources/resources.h +++ b/source/resources/resources.h @@ -21,6 +21,16 @@ application-specific collection. */ class Resources: virtual public DataFile::Collection { +public: + class Loader: public DataFile::DerivedObjectLoader + { + public: + Loader(Resources &); + + private: + void scene(const std::string &); + }; + private: TextureFilter default_tex_filter; float default_tex_anisotropy; -- 2.45.2