X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Funlitmaterial.cpp;h=38dbd3a3bdfc9104295fb87983839b9d19cdff29;hb=da85eb77172dbd62f764a63b45c79fc059af563b;hp=9aded2522972250cc76b1efcc3b0a745916b4461;hpb=842c817bb679a5a0abc05e8149e2e6e0ae1a0412;p=libs%2Fgl.git diff --git a/source/materials/unlitmaterial.cpp b/source/materials/unlitmaterial.cpp index 9aded252..38dbd3a3 100644 --- a/source/materials/unlitmaterial.cpp +++ b/source/materials/unlitmaterial.cpp @@ -5,11 +5,17 @@ using namespace std; namespace Msp { namespace GL { +const Tag UnlitMaterial::texture_tags[] = +{ + Tag("color_tex"), + Tag() +}; + UnlitMaterial::UnlitMaterial(): texture(0), vertex_color(false) { - set_tint(Color(1.0f)); + set_color(Color(1.0f)); } void UnlitMaterial::fill_program_info(string &module_name, map &spec_values) const @@ -19,9 +25,20 @@ void UnlitMaterial::fill_program_info(string &module_name, map &spe spec_values["use_vertex_color"] = vertex_color; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void UnlitMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shdata) const { - attach_texture_to(texture, texturing, tex_shdata, "texture"); + attach_texture_to(texture, texturing, tex_shdata, "color_tex"); +} +#pragma GCC diagnostic pop + +const Texture *UnlitMaterial::get_texture(Tag tag) const +{ + if(tag==texture_tags[0]) + return texture; + else + return 0; } void UnlitMaterial::set_texture(const Texture *tex) @@ -29,10 +46,10 @@ void UnlitMaterial::set_texture(const Texture *tex) texture = tex; } -void UnlitMaterial::set_tint(const Color &t) +void UnlitMaterial::set_color(const Color &c) { - tint = t; - shdata.uniform("tint", tint); + color = c; + shdata.uniform("unlit_material.color", color); } void UnlitMaterial::set_vertex_color(bool vc) @@ -59,7 +76,7 @@ void UnlitMaterial::Loader::init_actions() { Material::PropertyLoader::init_actions(); add("texture", &Loader::property_texture, &UnlitMaterial::set_texture); - add_property("tint", &UnlitMaterial::set_tint, 0, true); + add_property("color", &UnlitMaterial::set_color, 0, true); add("vertex_color", &UnlitMaterial::vertex_color); }