]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/renderpass.cpp
Access builtin resources through a global instance
[libs/gl.git] / source / materials / renderpass.cpp
index dde1fdb4f9847b39178cc412f8c6cdcde3576a6e..74b734128ba5d30710aedbc12ce30f505ea8ca3c 100644 (file)
@@ -33,7 +33,7 @@ void RenderPass::set_material_textures()
                set_texture(*tag, material->get_texture(*tag), material->get_sampler());
 }
 
-void RenderPass::maybe_create_material_shader(DataFile::Collection *coll)
+void RenderPass::maybe_create_material_shader()
 {
        if(shprog && !shprog_from_material)
                return;
@@ -42,13 +42,7 @@ void RenderPass::maybe_create_material_shader(DataFile::Collection *coll)
        if(receive_shadows)
                extra_spec["use_shadow_map"] = true;
 
-       if(coll)
-       {
-               shprog = material->create_compatible_shader(*coll, extra_spec);
-               shprog.keep();
-       }
-       else
-               throw invalid_operation("RenderPass::maybe_create_material_shader");
+       shprog = material->create_compatible_shader(extra_spec);
 
        if(shdata)
                shdata = new ProgramData(*shdata, shprog.get());
@@ -72,11 +66,11 @@ Tag RenderPass::get_slotted_uniform_tag(Tag slot) const
        return i->second;
 }
 
-void RenderPass::set_material(const Material *mat, DataFile::Collection *coll)
+void RenderPass::set_material(const Material *mat)
 {
        material = mat;
        material.keep();
-       maybe_create_material_shader(coll);
+       maybe_create_material_shader();
        set_material_textures();
 }
 
@@ -196,7 +190,7 @@ void RenderPass::Loader::init_actions()
 void RenderPass::Loader::finish()
 {
        if(obj.material)
-               obj.maybe_create_material_shader(coll);
+               obj.maybe_create_material_shader();
 }
 
 // Temporary compatibility feature