18 void Material::set_ambient(const Color &a)
21 shdata.uniform("material.ambient", ambient);
24 void Material::set_diffuse(const Color &d)
27 shdata.uniform("material.diffuse", diffuse);
30 void Material::set_specular(const Color &s)
33 shdata.uniform("material.specular", specular);
36 void Material::set_emission(const Color &e)
39 shdata.uniform("material.emission", emission);
42 void Material::set_shininess(float s)
45 shdata.uniform("material.shininess", shininess);
48 void Material::set_reflectivity(float r)
51 shdata.uniform("reflectivity", reflectivity);
55 Material::Loader::Loader(Material &m):
56 DataFile::CollectionObjectLoader<Material>(m, 0)
61 Material::Loader::Loader(Material &m, Collection &c):
62 DataFile::CollectionObjectLoader<Material>(m, &c)
67 void Material::Loader::init()
69 if(Resources *res = dynamic_cast<Resources *>(coll))
70 srgb = res->get_srgb_conversion();
74 add("ambient", &Loader::ambient);
75 add("diffuse", &Loader::diffuse);
76 add("specular", &Loader::specular);
77 add("emission", &Loader::emission);
78 add("shininess", &Loader::shininess);
79 add("reflectivity", &Loader::reflectivity);
82 Color Material::Loader::make_color(float r, float g, float b, float a)
90 void Material::Loader::ambient(float r, float g, float b, float a)
92 obj.set_ambient(make_color(r, g, b, a));
95 void Material::Loader::diffuse(float r, float g, float b, float a)
97 obj.set_diffuse(make_color(r, g, b, a));
100 void Material::Loader::specular(float r, float g, float b, float a)
102 obj.set_specular(make_color(r, g, b, a));
105 void Material::Loader::emission(float r, float g, float b, float a)
107 obj.set_emission(make_color(r, g, b, a));
110 void Material::Loader::shininess(float s)
112 obj.set_shininess(s);
115 void Material::Loader::reflectivity(float r)
117 obj.set_reflectivity(r);