+void Object::render(Renderer &renderer, const ObjectInstance &inst, const Tag &tag) const
+{
+ unsigned lod = min<unsigned>(inst.get_level_of_detail(renderer), lods.size()-1);
+ const RenderPass *pass = get_pass(tag, lod);
+ if(!pass)
+ return;
+
+ const Mesh *mesh = lods[lod].mesh.get();
+ if (!mesh)
+ throw logic_error("no mesh");
+
+ Renderer::Push push(renderer);
+ pass->apply(renderer);
+
+ setup_render(renderer, tag);
+ inst.setup_render(renderer, tag);
+ mesh->draw(renderer);
+ inst.finish_render(renderer, tag);
+ finish_render(renderer, tag);