]> git.tdb.fi Git - libs/gl.git/commitdiff
Deprecated the Renderer constructor taking a Camera pointer
authorMikko Rasa <tdb@tdb.fi>
Sun, 3 Nov 2019 11:58:16 +0000 (13:58 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 3 Nov 2019 11:58:16 +0000 (13:58 +0200)
source/renderer.cpp
source/renderer.h

index d01a1f0c4156ba319ee8c6fadd0fc4ae3d58352d..d6090d7d2cd57db6fb7318f15df8d8752abcbe30 100644 (file)
@@ -21,22 +21,30 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
+Renderer::Renderer():
+       default_camera(0)
+{
+       init();
+}
+
 Renderer::Renderer(const Camera *c):
-       default_camera(c),
-       changed(0),
-       state_stack(1)
+       default_camera(c)
+{
+       init();
+
+       if(c)
+               set_camera(*c);
+}
+
+void Renderer::init()
 {
        state_stack.reserve(16);
+       state_stack.push_back(State());
        shdata_stack.reserve(32);
        state = &state_stack.back();
 
-       if(c)
-               set_camera(*c);
-       else
-       {
-               standard_shdata.uniform("projection_matrix", Matrix());
-               standard_shdata.uniform("eye_world_matrix", Matrix());
-       }
+       standard_shdata.uniform("projection_matrix", Matrix());
+       standard_shdata.uniform("eye_world_matrix", Matrix());
 }
 
 Renderer::~Renderer()
index 3533139bb394d38a59d105345374c095af5a5699..a1217c77833216266e51a014c4984e0f4a056a59 100644 (file)
@@ -102,7 +102,11 @@ private:
        std::set<const Renderable *> excluded;
 
 public:
-       Renderer(const Camera *);
+       Renderer();
+       DEPRECATED Renderer(const Camera *);
+private:
+       void init();
+public:
        ~Renderer();
 
        /** Sets the camera to render from.  The modelview matrix is reset to the