X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fpbrmaterial.cpp;h=92801204ee0ddb7764e543c271a916363591741a;hb=6f39983060a27634c012f66c82fea0d09fea9774;hp=16c287b4e40f6ad97987ac517ba57315646dc711;hpb=842c817bb679a5a0abc05e8149e2e6e0ae1a0412;p=libs%2Fgl.git diff --git a/source/materials/pbrmaterial.cpp b/source/materials/pbrmaterial.cpp index 16c287b4..92801204 100644 --- a/source/materials/pbrmaterial.cpp +++ b/source/materials/pbrmaterial.cpp @@ -5,6 +5,17 @@ using namespace std; namespace Msp { namespace GL { +const Tag PbrMaterial::texture_tags[] = +{ + Tag("base_color_map"), + Tag("normal_map"), + Tag("metalness_map"), + Tag("roughness_map"), + Tag("occlusion_map"), + Tag("emission_map"), + Tag() +}; + PbrMaterial::PbrMaterial(): receive_shadows(false) { @@ -28,6 +39,8 @@ void PbrMaterial::fill_program_info(string &module_name, map &spec_ spec_values["use_shadow_map"] = receive_shadows; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void PbrMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shdata) const { attach_texture_to(base_color.texture, texturing, tex_shdata, "base_color_map"); @@ -37,6 +50,25 @@ void PbrMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shda attach_texture_to(occlusion.texture, texturing, tex_shdata, "occlusion_map"); attach_texture_to(emission.texture, texturing, tex_shdata, "emission_map"); } +#pragma GCC diagnostic pop + +const Texture *PbrMaterial::get_texture(Tag tag) const +{ + if(tag==texture_tags[0]) + return base_color.texture; + else if(tag==texture_tags[1]) + return normal.texture; + else if(tag==texture_tags[2]) + return metalness.texture; + else if(tag==texture_tags[3]) + return roughness.texture; + else if(tag==texture_tags[4]) + return occlusion.texture; + else if(tag==texture_tags[5]) + return emission.texture; + else + return 0; +} void PbrMaterial::set_base_color(const Color &color) {