From: Mikko Rasa Date: Sun, 3 Nov 2019 11:58:16 +0000 (+0200) Subject: Deprecated the Renderer constructor taking a Camera pointer X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b5791c97adfa8477e92b26960889c9e5ad8dd917;p=libs%2Fgl.git Deprecated the Renderer constructor taking a Camera pointer --- diff --git a/source/renderer.cpp b/source/renderer.cpp index d01a1f0c..d6090d7d 100644 --- a/source/renderer.cpp +++ b/source/renderer.cpp @@ -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() diff --git a/source/renderer.h b/source/renderer.h index 3533139b..a1217c77 100644 --- a/source/renderer.h +++ b/source/renderer.h @@ -102,7 +102,11 @@ private: std::set 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