]> git.tdb.fi Git - libs/gl.git/blobdiff - source/technique.cpp
Make Tag directly comparable and use it as a key in relevant maps
[libs/gl.git] / source / technique.cpp
index 53c7a9ae76cacdc3ba68b05bd54db5000de452e2..c7bd25ed1a70e51f920a72436255f9070e29aa02 100644 (file)
@@ -26,18 +26,18 @@ Technique::Technique():
 
 Technique::~Technique()
 {
-       for(map<unsigned, ObjectPass>::iterator i=passes.begin(); i!=passes.end(); ++i)
+       for(PassMap::iterator i=passes.begin(); i!=passes.end(); ++i)
                delete i->second.shdata;
 }
 
 bool Technique::has_pass(const GL::Tag &tag) const
 {
-       return passes.count(tag.id);
+       return passes.count(tag);
 }
 
 const ObjectPass &Technique::get_pass(const GL::Tag &tag) const
 {
-       map<unsigned, ObjectPass>::const_iterator i=passes.find(tag.id);
+       PassMap::const_iterator i=passes.find(tag);
        if(i==passes.end())
                throw KeyError("Unknown pass");
        return i->second;
@@ -76,7 +76,7 @@ Technique::Loader::Loader(Technique &t, Collection &c):
 
 void Technique::Loader::finish()
 {
-       for(map<unsigned, ObjectPass>::iterator i=tech.passes.begin(); i!=tech.passes.end(); ++i)
+       for(PassMap::iterator i=tech.passes.begin(); i!=tech.passes.end(); ++i)
                if(i->second.shdata)
                {
                        for(unsigned j=0; j<tech.textures.size(); ++j)
@@ -97,12 +97,12 @@ void Technique::Loader::material_inline()
 
 void Technique::Loader::pass(const string &n)
 {
-       unsigned id=Tag(n).id;
-       if(tech.passes.count(id))
+       Tag tag(n);
+       if(tech.passes.count(tag))
                throw KeyError("Duplicate pass name", n);
        ObjectPass p;
        load_sub(p, coll);
-       tech.passes[id]=p;
+       tech.passes[tag]=p;
 }
 
 void Technique::Loader::shader(const string &n)