From: Mikko Rasa Date: Fri, 24 May 2019 19:24:43 +0000 (+0300) Subject: Remember the camera given to Renderer constructor X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=71240e5c5ef7165313664ee9fe81df95c0eff10b;p=libs%2Fgl.git 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. --- 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;