From 71240e5c5ef7165313664ee9fe81df95c0eff10b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 May 2019 22:24:43 +0300 Subject: [PATCH] Remember the camera given to Renderer constructor And reapply it in end(). It may be necessary to call end() during setup_frame in order to render nested content, but the camera must remain. --- source/renderer.cpp | 5 +++++ source/renderer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/source/renderer.cpp b/source/renderer.cpp index 50acd8e7..19811146 100644 --- a/source/renderer.cpp +++ b/source/renderer.cpp @@ -22,6 +22,7 @@ namespace Msp { namespace GL { Renderer::Renderer(const Camera *c): + default_camera(c), changed(0), matrices_loaded(false), state_stack(1) @@ -206,6 +207,10 @@ void Renderer::end() throw invalid_operation("Renderer::end"); *state = State(); + if(default_camera) + set_camera(*default_camera); + else + standard_shdata.uniform("projection_matrix", Matrix()); shdata_stack.clear(); excluded.clear(); diff --git a/source/renderer.h b/source/renderer.h index af4bd65b..3bdf5341 100644 --- a/source/renderer.h +++ b/source/renderer.h @@ -96,6 +96,7 @@ private: LEGACY_PROJECTION = 128 }; + const Camera *default_camera; unsigned char changed; bool matrices_loaded; std::vector state_stack; -- 2.45.2