]> git.tdb.fi Git - libs/gl.git/commitdiff
Remember the camera given to Renderer constructor
authorMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 19:24:43 +0000 (22:24 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 19:24:43 +0000 (22:24 +0300)
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
source/renderer.h

index 50acd8e728c60e9531fd7b23dccc8a28cfb4a7c1..19811146235ec6622c0917a1536190490597bff8 100644 (file)
@@ -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();
 
index af4bd65b594beb85c53bf76905e47698fb577f07..3bdf5341e96b9bd6b1122329ffc522b71834233d 100644 (file)
@@ -96,6 +96,7 @@ private:
                LEGACY_PROJECTION = 128
        };
 
+       const Camera *default_camera;
        unsigned char changed;
        bool matrices_loaded;
        std::vector<State> state_stack;