X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftechnique.cpp;fp=source%2Ftechnique.cpp;h=1e8f8fccea433d4e63625e453bab7992beaa1439;hp=15406a931e10e8a6249434d91a9d7002180efeea;hb=88a5d6707be2f62e81d46fb6d4781c75742749b8;hpb=d8234c16eea3631c1b6e2c10f391ec86d9b97bfa diff --git a/source/technique.cpp b/source/technique.cpp index 15406a93..1e8f8fcc 100644 --- a/source/technique.cpp +++ b/source/technique.cpp @@ -28,6 +28,17 @@ const RenderPass &Technique::get_pass(const GL::Tag &tag) const return get_item(passes, tag); } +void Technique::replace_texture(const string &slot, const Texture &tex) +{ + for(PassMap::iterator i=passes.begin(); i!=passes.end(); ++i) + { + int index = i->second.get_texture_index(slot); + if(index<0) + continue; + i->second.set_texture(index, &tex); + } +} + bool Technique::has_shaders() const { for(PassMap::const_iterator i=passes.begin(); i!=passes.end(); ++i) @@ -97,14 +108,7 @@ void Technique::InheritLoader::material(const string &pass_tag, const string &na void Technique::InheritLoader::texture(const string &slot, const string &name) { - Texture &tex = get_collection().get(name); - for(PassMap::iterator i=obj.passes.begin(); i!=obj.passes.end(); ++i) - { - int index = i->second.get_texture_index(slot); - if(index<0) - continue; - i->second.set_texture(index, &tex); - } + obj.replace_texture(slot, get_collection().get(name)); } } // namespace GL