1 #include "unlitmaterial.h"
8 UnlitMaterial::UnlitMaterial():
12 set_tint(Color(1.0f));
15 string UnlitMaterial::create_program_source() const
17 string source = "import unlit;\n";
19 source += "const bool use_texture = true;\n";
21 source += "const bool use_vertex_color = true;\n";
25 void UnlitMaterial::attach_textures_to(Texturing &texturing, ProgramData &tex_shdata) const
27 attach_texture_to(texture, texturing, tex_shdata, "texture");
30 void UnlitMaterial::set_texture(const Texture *tex)
35 void UnlitMaterial::set_tint(const Color &t)
38 shdata.uniform("tint", tint);
41 void UnlitMaterial::set_vertex_color(bool vc)
47 DataFile::Loader::ActionMap UnlitMaterial::Loader::shared_actions;
49 UnlitMaterial::Loader::Loader(UnlitMaterial &m):
50 DerivedObjectLoader<UnlitMaterial, Material::PropertyLoader<UnlitMaterial> >(m)
52 set_actions(shared_actions);
55 UnlitMaterial::Loader::Loader(UnlitMaterial &m, Collection &c):
56 DerivedObjectLoader<UnlitMaterial, Material::PropertyLoader<UnlitMaterial> >(m, c)
58 set_actions(shared_actions);
61 void UnlitMaterial::Loader::init_actions()
63 Material::PropertyLoader<UnlitMaterial>::init_actions();
64 add("texture", &Loader::property_texture, &UnlitMaterial::set_texture);
65 add_property("tint", &UnlitMaterial::set_tint, 0, true);
66 add("vertex_color", &UnlitMaterial::vertex_color);