]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/renderpass.cpp
Use Tag to identify uniforms in Program and ProgramData
[libs/gl.git] / source / materials / renderpass.cpp
index 561eab6a7045f9f5448701398737cf370b4c1af6..7431a4461d9977fe6ef601019a12a5705bc63d98 100644 (file)
@@ -77,7 +77,7 @@ void RenderPass::maybe_create_material_shader(DataFile::Collection *coll)
                shprog.keep();
        }
        else
-               shprog = material->create_compatible_shader();
+               throw invalid_operation("no collection");
 
        if(shdata)
                shdata = new ProgramData(*shdata, shprog.get());
@@ -106,30 +106,27 @@ void RenderPass::set_shader_program(const Program *prog, const ProgramData *data
                finalize_material(0);
 }
 
-const string &RenderPass::get_slotted_uniform_name(const string &slot) const
+Tag RenderPass::get_slotted_uniform_tag(Tag slot) const
 {
-       map<string, string>::const_iterator i = uniform_slots.find(slot);
+       map<Tag, Tag>::const_iterator i = uniform_slots.find(slot);
        if(i==uniform_slots.end())
-       {
-               static string empty;
-               return empty;
-       }
+               return Tag();
        return i->second;
 }
 
-void RenderPass::set_material(const Material *mat)
+void RenderPass::set_material(const Material *mat, DataFile::Collection *coll)
 {
        material = mat;
        material.keep();
-       finalize_material(0);
+       finalize_material(coll);
 }
 
-void RenderPass::set_texture(unsigned index, const Texture *tex)
+void RenderPass::set_texture(unsigned index, const Texture *tex, const Sampler *samp)
 {
        if(!texturing)
                texturing = new Texturing;
 
-       texturing->attach(index, *tex, texturing->get_attached_sampler(index));
+       texturing->attach(index, *tex, (samp ? samp : texturing->get_attached_sampler(index)));
 }
 
 int RenderPass::get_texture_index(const string &n) const