From 3787ba0acb816e99eb7fa113e04760560bfcae39 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 3 Nov 2012 15:32:42 +0200 Subject: [PATCH] Add setup/finish_render hooks to Object --- source/object.cpp | 4 ++++ source/object.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/object.cpp b/source/object.cpp index bd899961..ab7afc14 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -81,7 +81,9 @@ void Object::render(Renderer &renderer, const Tag &tag) const renderer.set_material(pass->get_material()); renderer.set_texturing(pass->get_texturing()); + setup_render(renderer, tag); meshes.front()->draw(renderer); + finish_render(renderer, tag); } void Object::render(Renderer &renderer, const ObjectInstance &inst, const Tag &tag) const @@ -95,10 +97,12 @@ void Object::render(Renderer &renderer, const ObjectInstance &inst, const Tag &t renderer.set_material(pass->get_material()); renderer.set_texturing(pass->get_texturing()); + setup_render(renderer, tag); inst.setup_render(renderer, tag); unsigned lod = min(inst.get_level_of_detail(renderer), meshes.size()-1); meshes[lod]->draw(renderer); inst.finish_render(renderer, tag); + finish_render(renderer, tag); } const RenderPass *Object::get_pass(const Tag &tag) const diff --git a/source/object.h b/source/object.h index 8a707665..7820d29c 100644 --- a/source/object.h +++ b/source/object.h @@ -66,6 +66,10 @@ public: called before and after drawing the mesh. */ virtual void render(Renderer &, const ObjectInstance &, const Tag & = Tag()) const; +protected: + virtual void setup_render(Renderer &, const Tag &) const { } + virtual void finish_render(Renderer &, const Tag &) const { } + private: const RenderPass *get_pass(const Tag &) const; }; -- 2.45.2