X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Frenderpass.cpp;h=fb092624b756c06ff463cdb34097b458cdd15158;hb=12342e01c014137b72546c1e3a54181063e69415;hp=835e78a672cd6203649cdd9cbba4345421fa41b8;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/materials/renderpass.cpp b/source/materials/renderpass.cpp index 835e78a6..fb092624 100644 --- a/source/materials/renderpass.cpp +++ b/source/materials/renderpass.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "error.h" #include "material.h" @@ -123,12 +124,12 @@ void RenderPass::set_material(const Material *mat) finalize_material(0); } -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 @@ -175,6 +176,17 @@ void RenderPass::Loader::init() add("uniform_slot", &Loader::uniform_slot2); } +// Temporary compatibility feature +string RenderPass::Loader::get_shader_name(const string &n) +{ + if(n.size()>=5 && !n.compare(n.size()-5, 5, ".glsl")) + { + IO::print(IO::cerr, "Warning: Loading module '%s' as shader is deprecated\n", n); + return n+".shader"; + } + return n; +} + void RenderPass::Loader::material_inline() { Material::GenericLoader ldr(coll); @@ -192,7 +204,7 @@ void RenderPass::Loader::material(const string &name) void RenderPass::Loader::shader(const string &n) { - obj.shprog = &get_collection().get(n); + obj.shprog = &get_collection().get(get_shader_name(n)); obj.shprog.keep(); obj.shprog_from_material = false; if(obj.shdata)