const Technique *tech = object.get_technique();
if(!tech)
throw logic_error("no technique");
- if(!tech->has_pass(tag))
+ const RenderPass *pass = tech->find_pass(tag);
+ if(!pass)
return;
- const RenderPass &pass = tech->get_pass(tag);
const Mesh *mesh = object.get_mesh();
mesh->get_vertices().refresh();
instance_data->refresh();
Renderer::Push push(renderer);
- pass.apply(renderer);
+ pass->apply(renderer);
mesh->draw_instanced(renderer, *vtx_setup, instances.size());
}
else
const Technique *tech = lods[lod].technique.get();
if(!tech)
throw logic_error("no technique");
- if(!tech->has_pass(tag))
- return 0;
- return &tech->get_pass(tag);
+ return tech->find_pass(tag);
}
void Object::resource_loaded(Resource &res)
return get_item(passes, tag);
}
+const RenderPass *Technique::find_pass(const Tag &tag) const
+{
+ PassMap::const_iterator i = passes.find(tag);
+ return (i!=passes.end() ? &i->second : 0);
+}
+
bool Technique::replace_texture(const string &slot, const Texture &tex)
{
bool replaced = false;
RenderPass &add_pass(const Tag &);
bool has_pass(const Tag &) const;
const RenderPass &get_pass(const Tag &) const;
+ const RenderPass *find_pass(const Tag &) const;
const PassMap &get_passes() const { return passes; }
bool replace_texture(const std::string &, const Texture &);
bool replace_material(const std::string &, const Material &);