From: Mikko Rasa Date: Mon, 5 Dec 2016 16:10:52 +0000 (+0200) Subject: Remove the Renderer-less overload of Renderable::render X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=dafd3a42a2f06bfd8e88f9240fc2f4bd3d401541;p=libs%2Fgl.git Remove the Renderer-less overload of Renderable::render It's been sort-of deprecated for a long time even though it wasn't marked as such. None of my code code uses it with anything else than Pipeline (and that code path is being replaced with View). --- diff --git a/source/object.cpp b/source/object.cpp index a27553a6..4a2e5df1 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -130,21 +130,6 @@ const Technique *Object::get_technique(unsigned i) const return lods[i].technique.get(); } -void Object::render(const Tag &tag) const -{ - const RenderPass *pass = get_pass(tag, 0); - if(!pass) - return; - - Bind bind_shader(pass->get_shader_program()); - if(pass->get_shader_data()) - pass->get_shader_data()->apply(); - Bind bind_material(pass->get_material()); - Bind bind_texturing(pass->get_texturing()); - - lods.front().mesh->draw(); -} - void Object::render(Renderer &renderer, const Tag &tag) const { const RenderPass *pass = get_pass(tag, 0); diff --git a/source/object.h b/source/object.h index 3d0415c6..88a5d9e9 100644 --- a/source/object.h +++ b/source/object.h @@ -107,8 +107,6 @@ public: virtual const Geometry::BoundingSphere *get_bounding_sphere() const { return &bounding_sphere; } - virtual void render(const Tag &tag = Tag()) const; - virtual void render(Renderer &, const Tag & = Tag()) const; /** Renders an instance of the object. The instance's hook functions are diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 4c400723..0469cb77 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -154,14 +154,11 @@ void Pipeline::finish_frame() const i->renderable->finish_frame(); } -void Pipeline::render(const Tag &tag) const +void Pipeline::render() const { - if(tag.id) - return; - Renderer renderer(camera); setup_frame(); - render(renderer, tag); + render(renderer); finish_frame(); } diff --git a/source/pipeline.h b/source/pipeline.h index 9272f587..f6a4ab33 100644 --- a/source/pipeline.h +++ b/source/pipeline.h @@ -107,7 +107,7 @@ public: virtual void setup_frame() const; virtual void finish_frame() const; - virtual void render(const Tag &tag = Tag()) const; + void render() const; virtual void render(Renderer &, const Tag &tag = Tag()) const; private: diff --git a/source/renderable.cpp b/source/renderable.cpp deleted file mode 100644 index 568df05b..00000000 --- a/source/renderable.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "error.h" -#include "renderable.h" -#include "renderer.h" - -namespace Msp { -namespace GL { - -void Renderable::render(const Tag &) const -{ - throw invalid_operation("Renderable::render"); -} - -} // namespace Msp -} // namespace GL diff --git a/source/renderable.h b/source/renderable.h index 9a534e90..18319cb4 100644 --- a/source/renderable.h +++ b/source/renderable.h @@ -12,8 +12,8 @@ class Matrix; class Renderer; /** -Base class for renderable objects. All Renderables must support rendering with -a Renderer, and may optionally provide support for standalone rendering. +Base class for renderable objects. Rendering is performed with the help of a +Renderer object. The render methods take a Tag to identify a render pass. It is most commonly used together with Techniques and Pipelines to implement multipass rendering. @@ -50,11 +50,6 @@ public: /** Called when a complete frame has been rendered. */ virtual void finish_frame() const { } - /** Renders the Renderable without a renderer. This can be convenient in - some simple cases, but most renderables don't need to implement this - method. */ - virtual void render(const Tag & = Tag()) const; - /** Renders the Renderable. Implementors should take care to return the renderer to the state it was in, for example by using Renderer::Push. */ virtual void render(Renderer &, const Tag & = Tag()) const = 0; diff --git a/source/scene.cpp b/source/scene.cpp index b8a74b59..3933599b 100644 --- a/source/scene.cpp +++ b/source/scene.cpp @@ -15,12 +15,6 @@ Scene::~Scene() delete *i; } -void Scene::render(const Tag &tag) const -{ - Renderer renderer(0); - render(renderer, tag); -} - bool Scene::setup_frustum(const Renderer &renderer) const { const Camera *camera = renderer.get_camera(); diff --git a/source/scene.h b/source/scene.h index a04fbc01..9e2da3df 100644 --- a/source/scene.h +++ b/source/scene.h @@ -42,9 +42,6 @@ public: virtual void add(const Renderable &) = 0; virtual void remove(const Renderable &) = 0; - using Renderable::render; - virtual void render(const Tag & = Tag()) const; - protected: bool setup_frustum(const Renderer &) const; bool frustum_cull(const Renderable &) const;