From: Mikko Rasa Date: Thu, 14 Oct 2021 09:02:37 +0000 (+0300) Subject: Support inline scenes within other scenes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=00dc5da40385d41c3a50c34c75353b257e814035;p=libs%2Fgl.git Support inline scenes within other scenes This is useful for creating scenes where transparent objects are rendered after opaque ones, without the entire scene being Z-sorted. --- diff --git a/source/render/scene.cpp b/source/render/scene.cpp index 4b7aee1a..0f773722 100644 --- a/source/render/scene.cpp +++ b/source/render/scene.cpp @@ -98,6 +98,7 @@ Scene::Loader::Loader(Scene &s, Collection &c, ContentMap *m): add("object", &Loader::object); add("object", &Loader::object_tagged); add("scene", &Loader::scene); + add("scene", &Loader::scene_inline); } void Scene::Loader::object(const string &n) @@ -120,5 +121,13 @@ void Scene::Loader::scene(const string &n) obj.add(get_collection().get(n)); } +void Scene::Loader::scene_inline() +{ + GenericLoader ldr(get_collection()); + load_sub_with(ldr); + Scene *scene = ldr.store_object(get_collection(), format("_scene_%d.scene", ++inline_counter)); + obj.add(*scene); +} + } // namespace GL } // namespace Msp diff --git a/source/render/scene.h b/source/render/scene.h index 96ecee97..f89f10da 100644 --- a/source/render/scene.h +++ b/source/render/scene.h @@ -37,6 +37,7 @@ protected: void object(const std::string &); void object_tagged(const std::string &, const std::string &); void scene(const std::string &); + void scene_inline(); }; public: