shader auto reload

This commit is contained in:
2019-02-21 20:20:43 +01:00
parent eaab9c79e5
commit 78ca0ee6ad
7 changed files with 77 additions and 15 deletions

View File

@@ -505,6 +505,7 @@ void App::update(float dt)
{
static std::mutex mutex;
static float rec_timer = 0.f;
static float reload_timer = 0.f;
// avoid multiple threads to update the scene
std::lock_guard<std::mutex> lock(mutex);
@@ -524,17 +525,18 @@ void App::update(float dt)
//glClear(GL_COLOR_BUFFER_BIT);
//if (!canvas->m_mouse_captured)
#if _DEBUG && (_WIN32 || __OSX__)
reload_timer += dt;
if (reload_timer > 1.0)
{
#if _WIN32 || __OSX__
reload_timer = 0;
ShaderManager::reload();
layout.reload();
#endif
if (auto* main = layout[main_id])
{
main->update(width, height, zoom);
//stroke->update_controls();
}
}
#endif
{
static glm::vec4 color_button_normal{ .1, .1, .1, 1 };
static glm::vec4 color_button_hlight{ 1, .0, .0, 1 };