X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fbasicmaterial.cpp;h=5ad694b685803e892032b24a0d199cda86befca7;hb=da85eb77172dbd62f764a63b45c79fc059af563b;hp=33dced53d7fb65c68fce1251893f14b202c144c3;hpb=842c817bb679a5a0abc05e8149e2e6e0ae1a0412;p=libs%2Fgl.git diff --git a/source/materials/basicmaterial.cpp b/source/materials/basicmaterial.cpp index 33dced53..5ad694b6 100644 --- a/source/materials/basicmaterial.cpp +++ b/source/materials/basicmaterial.cpp @@ -5,6 +5,17 @@ using namespace std; namespace Msp { namespace GL { +const Tag BasicMaterial::texture_tags[] = +{ + Tag("diffuse_map"), + Tag("specular_map"), + Tag("shininess_map"), + Tag("normal_map"), + Tag("emission_map"), + Tag("reflectivity_map"), + Tag() +}; + BasicMaterial::BasicMaterial(): receive_shadows(false) { @@ -32,6 +43,8 @@ void BasicMaterial::fill_program_info(string &module_name, map &spe spec_values["use_shadow_map"] = receive_shadows; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void BasicMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shdata) const { attach_texture_to(diffuse.texture, texturing, tex_shdata, "diffuse_map"); @@ -41,6 +54,25 @@ void BasicMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_sh attach_texture_to(shininess.texture, texturing, tex_shdata, "shininess_map"); attach_texture_to(reflectivity.texture, texturing, tex_shdata, "reflectivity_map"); } +#pragma GCC diagnostic pop + +const Texture *BasicMaterial::get_texture(Tag tag) const +{ + if(tag==texture_tags[0]) + return diffuse.texture; + else if(tag==texture_tags[1]) + return specular.texture; + else if(tag==texture_tags[2]) + return shininess.texture; + else if(tag==texture_tags[3]) + return normal.texture; + else if(tag==texture_tags[4]) + return emission.texture; + else if(tag==texture_tags[5]) + return reflectivity.texture; + else + return 0; +} void BasicMaterial::set_diffuse(const Color &color) {