From dd0838b3023d78d53cc19b290dd36803aa4b9ad1 Mon Sep 17 00:00:00 2001 From: gradient Date: Sun, 10 Sep 2017 21:44:32 -0500 Subject: [PATCH] Project: add dedicated reload_shaders method --- src/gui.cpp | 2 +- src/project.cpp | 6 +++++- src/project.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 664da35..5834911 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -90,7 +90,7 @@ void Gui::render_mmb_debug() { if (state->current_project != nullptr) { if (state->current_project->scene_loaded) { std::cout << "=== reloading shaders ===\n"; - state->current_project->shader_bundle->recompile().link(); + state->current_project->reload_shaders(); } } } diff --git a/src/project.cpp b/src/project.cpp index a8dc39e..6370808 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -46,4 +46,8 @@ std::unique_ptr Project::fromToml(std::shared_ptr manif void Project::load_scene(std::shared_ptr scene) { this->current_scene = scene; this->scene_loaded = true; -} \ No newline at end of file +} + +void Project::reload_shaders() { + this->shader_bundle->recompile().link(); +} diff --git a/src/project.h b/src/project.h index 1d9dc69..f015175 100644 --- a/src/project.h +++ b/src/project.h @@ -28,6 +28,7 @@ public: static std::unique_ptr fromToml(std::shared_ptr manifest, filesystem::path basepath); void load_scene(std::shared_ptr scene); + void reload_shaders(); std::vector> scenes; @@ -36,4 +37,4 @@ public: std::string name; std::shared_ptr shader_bundle; -}; \ No newline at end of file +};