return replaced;
}
+bool Technique::replace_uniforms(const ProgramData &shdata)
+{
+ bool replaced = false;
+ const vector<string> &uniform_names = shdata.get_uniform_names();
+ for(PassMap::iterator i=passes.begin(); i!=passes.end(); ++i)
+ {
+ RefPtr<ProgramData> new_shdata;
+ for(vector<string>::const_iterator j=uniform_names.begin(); j!=uniform_names.end(); ++j)
+ {
+ const string &name = i->second.get_slotted_uniform_name(*j);
+ if(name.empty())
+ continue;
+
+ if(!new_shdata)
+ new_shdata = new ProgramData(*i->second.get_shader_data());
+
+ new_shdata->uniform(name, shdata.get_uniform(*j));
+ replaced = true;
+ }
+
+ if(new_shdata)
+ i->second.set_shader_program(i->second.get_shader_program(), new_shdata.get());
+ }
+
+ return replaced;
+}
+
bool Technique::has_shaders() const
{
for(PassMap::const_iterator i=passes.begin(); i!=passes.end(); ++i)
{
add("material", &InheritLoader::material);
add("texture", &InheritLoader::texture);
+ add("uniforms", &InheritLoader::uniforms);
}
void Technique::InheritLoader::material(const string &slot, const string &name)
throw key_error(slot);
}
+void Technique::InheritLoader::uniforms()
+{
+ ProgramData shdata;
+ load_sub(shdata);
+ obj.replace_uniforms(shdata);
+}
+
} // namespace GL
} // namespace Msp