From 0bdf0d7be74940dd60274608d577e58d86f76496 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 7 Nov 2021 10:23:56 +0200 Subject: [PATCH] Use asynchronous resource loading in desertpillars --- demos/desertpillars/source/desertpillars.cpp | 6 +++++- demos/desertpillars/source/desertpillars.h | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/demos/desertpillars/source/desertpillars.cpp b/demos/desertpillars/source/desertpillars.cpp index 542ade3b..53f0a86c 100644 --- a/demos/desertpillars/source/desertpillars.cpp +++ b/demos/desertpillars/source/desertpillars.cpp @@ -25,6 +25,7 @@ DesertPillars::DesertPillars(int, char **): window(display, opts.wnd_opts), gl_ctx(window, opts.gl_opts), keyboard(window), + resources(&res_mgr), view(window, gl_ctx), camera(resources.get("Camera.camera")), lighting(resources.get("Desert.lightn")), @@ -123,6 +124,7 @@ void DesertPillars::tick() flare.set_matrix(GL::Matrix::translation(p)); display.tick(); + res_mgr.tick(); view.render(); } @@ -139,13 +141,15 @@ void DesertPillars::key_press(unsigned key) } -DesertPillars::Resources::Resources() +DesertPillars::Resources::Resources(GL::ResourceManager *rm) { FS::Path base_dir = FS::get_sys_data_dir()/"demos"/"desertpillars"/"data"; source.add_directory(base_dir); source.add_directory(base_dir/"textures"); source.add_directory(base_dir/"exported"); add_source(source); + + set_resource_manager(rm); } diff --git a/demos/desertpillars/source/desertpillars.h b/demos/desertpillars/source/desertpillars.h index 0a3f2f2e..4e478099 100644 --- a/demos/desertpillars/source/desertpillars.h +++ b/demos/desertpillars/source/desertpillars.h @@ -36,9 +36,10 @@ private: { private: Msp::DataFile::DirectorySource source; + Msp::GL::ResourceManager res_mgr; public: - Resources(); + Resources(Msp::GL::ResourceManager *); }; class MorphSphere: public Msp::GL::ObjectInstance @@ -70,6 +71,7 @@ private: Msp::Graphics::Window window; Msp::Graphics::GLContext gl_ctx; Msp::Input::Keyboard keyboard; + Msp::GL::ResourceManager res_mgr; Resources resources; Msp::GL::WindowView view; -- 2.45.2