X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterials%2Fbasicmaterial.cpp;h=5ad694b685803e892032b24a0d199cda86befca7;hp=33dced53d7fb65c68fce1251893f14b202c144c3;hb=6f39983060a27634c012f66c82fea0d09fea9774;hpb=3af09f06e9f69532e5adfe6bcd9a7b2d1aea6d5b 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) {