X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterial.cpp;fp=source%2Fmaterial.cpp;h=a99f3c2cccc83f235b1da411f474288f386cffe7;hp=9109b786ecb4d414a3d455c57fe6421a06a7d314;hb=218b613dc4d3898996bfda8e3ce1db32f7e1f929;hpb=f5c631cecb6602ae31287b0eadd699002175cc74 diff --git a/source/material.cpp b/source/material.cpp index 9109b786..a99f3c2c 100644 --- a/source/material.cpp +++ b/source/material.cpp @@ -55,7 +55,7 @@ void Material::attach_texture_to(const Texture *tex, Texturing &texturing, Progr if(unit<0) throw runtime_error("no free texunit"); - texturing.attach(unit, *tex); + texturing.attach(unit, *tex, sampler); tex_shdata.uniform(name, unit); } @@ -72,6 +72,25 @@ Material::MaterialRegistry &Material::get_material_registry() } +Material::Loader::Loader(Material &m): + CollectionObjectLoader(m, 0) +{ } + +Material::Loader::Loader(Material &m, Collection &c): + CollectionObjectLoader(m, &c) +{ } + +void Material::Loader::init_actions() +{ + add("sampler", &Loader::sampler); +} + +void Material::Loader::sampler(const std::string &name) +{ + obj.sampler = &get_collection().get(name); +} + + DataFile::Loader::ActionMap Material::GenericLoader::shared_actions; Material::GenericLoader::GenericLoader(DataFile::Collection *c):