X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftechnique.cpp;h=15406a931e10e8a6249434d91a9d7002180efeea;hb=ec7e6f12a85a7dd65e57bf88b80c2d94601dd56f;hp=aa27d99cc7857118888fced1d59e1647347c2abf;hpb=7b671e6899949d095698425a9b33387e7eb13894;p=libs%2Fgl.git diff --git a/source/technique.cpp b/source/technique.cpp index aa27d99c..15406a93 100644 --- a/source/technique.cpp +++ b/source/technique.cpp @@ -77,10 +77,25 @@ void Technique::Loader::pass(const string &n) Technique::InheritLoader::InheritLoader(Technique &t, Collection &c): DataFile::CollectionObjectLoader(t, &c) { + add("material", &InheritLoader::material); add("texture", &InheritLoader::texture); } -void Technique::InheritLoader::texture(const std::string &slot, const string &name) +void Technique::InheritLoader::material(const string &pass_tag, const string &name) +{ + RenderPass &pass = get_item(obj.passes, pass_tag); + const Material &mat = get_collection().get(name); + if(const Material *base_mat = pass.get_material()) + { + for(PassMap::iterator i=obj.passes.begin(); i!=obj.passes.end(); ++i) + if(i->second.get_material()==base_mat) + i->second.set_material(&mat); + } + else + pass.set_material(&mat); +} + +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)