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
renderer.set_material(pass->get_material());
renderer.set_texturing(pass->get_texturing());
+ setup_render(renderer, tag);
inst.setup_render(renderer, tag);
unsigned lod = min<unsigned>(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
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;
};