]> git.tdb.fi Git - libs/gl.git/blobdiff - source/technique.cpp
Support collectionless loading of Technique and RenderPass
[libs/gl.git] / source / technique.cpp
index 78060e01f9b89e80e28f7171fc40cea23188d327..d913f4d1aa490b0264c8f94600c9ed93d571f55d 100644 (file)
@@ -34,8 +34,19 @@ const RenderPass &Technique::get_pass(const GL::Tag &tag) const
 }
 
 
+Technique::Loader::Loader(Technique &t):
+       DataFile::CollectionObjectLoader<Technique>(t, 0)
+{
+       init();
+}
+
 Technique::Loader::Loader(Technique &t, Collection &c):
        DataFile::CollectionObjectLoader<Technique>(t, &c)
+{
+       init();
+}
+
+void Technique::Loader::init()
 {
        add("inherit", &Loader::inherit);
        add("pass", &Loader::pass);
@@ -55,7 +66,10 @@ void Technique::Loader::pass(const string &n)
                throw KeyError("Duplicate pass name", n);
 
        RenderPass p;
-       load_sub(p, *coll);
+       if(coll)
+               load_sub(p, get_collection());
+       else
+               load_sub(p);
        obj.passes.insert(PassMap::value_type(tag, p));
 }