X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Funlitmaterial.cpp;h=e81be8ae136c3b8a915ef3b440b4c6946ffd5cb0;hb=2bf5645d38492c5ef829478f3e04e78f31802fe6;hp=5eddd66997416438643003dd5efdc872a25ebbec;hpb=2f198e3210714c7abac53bbe1be4d41b1ef85c14;p=libs%2Fgl.git diff --git a/source/materials/unlitmaterial.cpp b/source/materials/unlitmaterial.cpp index 5eddd669..e81be8ae 100644 --- a/source/materials/unlitmaterial.cpp +++ b/source/materials/unlitmaterial.cpp @@ -9,22 +9,19 @@ UnlitMaterial::UnlitMaterial(): texture(0), vertex_color(false) { - set_tint(Color(1.0f)); + set_color(Color(1.0f)); } -string UnlitMaterial::create_program_source() const +void UnlitMaterial::fill_program_info(string &module_name, map &spec_values) const { - string source = "import unlit;\n"; - if(texture) - source += "const bool use_texture = true;\n"; - if(vertex_color) - source += "const bool use_vertex_color = true;\n"; - return source; + module_name = "unlit.glsl"; + spec_values["use_texture"] = (texture!=0); + spec_values["use_vertex_color"] = vertex_color; } 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"); } void UnlitMaterial::set_texture(const Texture *tex) @@ -32,10 +29,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) @@ -62,7 +59,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); }