]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/technique.cpp
Add inline data items to the collection
[libs/gl.git] / source / materials / technique.cpp
index b5ed6447c314c3e69be3bfe0fcb0c08be67cfc07..26a70a018dde6042ce7ddc5f8b21a2e942257ad5 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/core/refptr.h>
 #include <msp/datafile/collection.h>
+#include <msp/fs/utils.h>
 #include <msp/strings/format.h>
 #include "material.h"
 #include "program.h"
@@ -132,6 +133,11 @@ void Technique::Loader::init_actions()
        add("pass", &Loader::pass);
 }
 
+void Technique::Loader::set_inline_base_name(const string &n)
+{
+       inline_base_name = n;
+}
+
 void Technique::Loader::inherit(const string &n)
 {
        obj.passes = get_collection().get<Technique>(n).get_passes();
@@ -143,7 +149,11 @@ void Technique::Loader::pass(const string &n)
 {
        RenderPass p;
        if(coll)
-               load_sub(p, get_collection());
+       {
+               RenderPass::Loader ldr(p, get_collection());
+               ldr.set_inline_base_name(format("%s/%s.pass", (inline_base_name.empty() ? FS::basename(get_source()) : inline_base_name), n));
+               load_sub_with(ldr);
+       }
        else
                load_sub(p);