#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"
bool replaced = false;
for(PassMap::iterator i=passes.begin(); i!=passes.end(); ++i)
{
- int index = i->second.get_texture_index(slot);
- if(index>=0)
+ Tag tag = i->second.get_texture_tag(slot);
+ if(tag.id)
{
- i->second.set_texture(index, &tex);
+ i->second.set_texture(tag, &tex);
replaced = true;
}
}
return false;
}
+void Technique::set_debug_name(const std::string &name)
+{
+#ifdef DEBUG
+ for(map<Tag, RenderPass>::iterator i=passes.begin(); i!=passes.end(); ++i)
+ i->second.set_debug_name(format("%s [pass:%s]", name, i->first.str()));
+#else
+ (void)name;
+#endif
+}
+
+
+DataFile::Loader::ActionMap Technique::Loader::shared_actions;
Technique::Loader::Loader(Technique &t):
DataFile::CollectionObjectLoader<Technique>(t, 0)
{
- init();
+ set_actions(shared_actions);
}
Technique::Loader::Loader(Technique &t, Collection &c):
DataFile::CollectionObjectLoader<Technique>(t, &c)
{
- init();
+ set_actions(shared_actions);
}
-void Technique::Loader::init()
+void Technique::Loader::init_actions()
{
add("inherit", &Loader::inherit);
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();
{
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);