- if(obj.shprog)
- {
- if(!obj.shdata)
- obj.shdata=new ProgramData;
-
- for(unsigned i=0; i<obj.textures.size(); ++i)
- {
- unsigned loc=obj.shprog->get_uniform_location(obj.textures[i].name);
- obj.shdata->uniform(loc, static_cast<int>(i));
- }
- }
+ Material::GenericLoader ldr(coll);
+ load_sub_with(ldr);
+ obj.material = ldr.get_material();
+ obj.finalize_material(coll);
+}
+
+void RenderPass::Loader::material(const string &name)
+{
+ obj.material = &get_collection().get<Material>(name);
+ obj.material.keep();
+ obj.finalize_material(coll);
+}
+
+void RenderPass::Loader::shader(const string &n)
+{
+ obj.shprog = &get_collection().get<Program>(n);
+ obj.shprog.keep();
+ obj.shprog_from_material = false;
+ if(obj.shdata)
+ obj.shdata = new ProgramData(*obj.shdata, obj.shprog.get());
+ if(obj.material)
+ obj.finalize_material(coll);
+}
+
+void RenderPass::Loader::texunit(unsigned i)
+{
+ if(!obj.texturing)
+ obj.texturing = new Texturing;
+ TextureLoader ldr(*obj.texturing, i, coll);
+ load_sub_with(ldr);