From fa43a20e8274638b84c26e052dd8f7cc8993edd9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 16 Sep 2016 11:21:35 +0300 Subject: [PATCH] No longer inherit StereoView from GL::Renderable There really is no point in using it inside GL::Pipelines or other containers. --- source/stereoview.cpp | 26 +++++++------------------- source/stereoview.h | 13 ++++++------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/source/stereoview.cpp b/source/stereoview.cpp index 95eb847..5b8dbbb 100644 --- a/source/stereoview.cpp +++ b/source/stereoview.cpp @@ -58,28 +58,16 @@ void StereoView::setup_frame() const left.setup_frame(base_camera, offset_axis*-eye_spacing, frustum_skew, params); right.setup_frame(base_camera, offset_axis*eye_spacing, -frustum_skew, params); - - renderable.setup_frame(); -} - -void StereoView::finish_frame() const -{ - renderable.finish_frame(); } -void StereoView::render(const GL::Tag &tag) const +void StereoView::render() const { setup_frame(); - left.render(renderable, tag); - right.render(renderable, tag); + renderable.setup_frame(); + left.render(renderable); + right.render(renderable); + renderable.finish_frame(); combiner->render(left.target->color, right.target->color); - finish_frame(); -} - -void StereoView::render(GL::Renderer &renderer, const GL::Tag &tag) const -{ - renderer.escape(); - return render(tag); } @@ -117,12 +105,12 @@ void StereoView::Eye::setup_frame(const GL::Camera &base_camera, const GL::Vecto camera.set_frustum_axis(frustum_skew, 0); } -void StereoView::Eye::render(const GL::Renderable &renderable, const GL::Tag &tag) const +void StereoView::Eye::render(const GL::Renderable &renderable) const { GL::Bind bind_fbo(target->fbo); target->fbo.clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT); GL::Renderer renderer(&camera); - renderable.render(renderer, tag); + renderable.render(renderer); } } // namespace VR diff --git a/source/stereoview.h b/source/stereoview.h index b1e0473..842636e 100644 --- a/source/stereoview.h +++ b/source/stereoview.h @@ -13,7 +13,7 @@ namespace VR { class StereoCombiner; -class StereoView: public GL::Renderable +class StereoView { private: struct RenderTarget @@ -42,7 +42,7 @@ private: void create_target(unsigned, unsigned); void setup_frame(const GL::Camera &, const GL::Vector3 &, float, const EyeParams &) const; - void render(const GL::Renderable &, const GL::Tag &) const; + void render(const GL::Renderable &) const; }; unsigned width; @@ -63,11 +63,10 @@ public: void set_eye_spacing(float); void set_strabismus(const Geometry::Angle &); - virtual void setup_frame() const; - virtual void finish_frame() const; - - virtual void render(const GL::Tag & = GL::Tag()) const; - virtual void render(GL::Renderer &, const GL::Tag & = GL::Tag()) const; +private: + void setup_frame() const; +public: + void render() const; }; } // namespace VR -- 2.45.2