1 #include "unlitmaterial.h"
8 const Tag UnlitMaterial::texture_tags[] =
14 UnlitMaterial::UnlitMaterial():
18 set_color(Color(1.0f));
21 void UnlitMaterial::fill_program_info(string &module_name, map<string, int> &spec_values) const
23 module_name = "unlit.glsl";
24 spec_values["use_texture"] = (texture!=0);
25 spec_values["use_vertex_color"] = vertex_color;
28 #pragma GCC diagnostic push
29 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
30 void UnlitMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shdata) const
32 attach_texture_to(texture, texturing, tex_shdata, "color_tex");
34 #pragma GCC diagnostic pop
36 const Texture *UnlitMaterial::get_texture(Tag tag) const
38 if(tag==texture_tags[0])
44 void UnlitMaterial::set_texture(const Texture *tex)
49 void UnlitMaterial::set_color(const Color &c)
52 shdata.uniform("unlit_material.color", color);
55 void UnlitMaterial::set_vertex_color(bool vc)
61 DataFile::Loader::ActionMap UnlitMaterial::Loader::shared_actions;
63 UnlitMaterial::Loader::Loader(UnlitMaterial &m):
64 DerivedObjectLoader<UnlitMaterial, Material::PropertyLoader<UnlitMaterial> >(m)
66 set_actions(shared_actions);
69 UnlitMaterial::Loader::Loader(UnlitMaterial &m, Collection &c):
70 DerivedObjectLoader<UnlitMaterial, Material::PropertyLoader<UnlitMaterial> >(m, c)
72 set_actions(shared_actions);
75 void UnlitMaterial::Loader::init_actions()
77 Material::PropertyLoader<UnlitMaterial>::init_actions();
78 add("texture", &Loader::property_texture, &UnlitMaterial::set_texture);
79 add_property("color", &UnlitMaterial::set_color, 0, true);
80 add("vertex_color", &UnlitMaterial::vertex_color);