15 void Material::set_ambient(const Color &a)
20 void Material::set_diffuse(const Color &d)
25 void Material::set_specular(const Color &s)
30 void Material::set_emission(const Color &e)
35 void Material::set_shininess(float s)
40 void Material::bind() const
44 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
45 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
46 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
47 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
48 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
53 Material::Loader::Loader(Material &m):
54 DataFile::ObjectLoader<Material>(m)
56 add("ambient", &Loader::ambient);
57 add("diffuse", &Loader::diffuse);
58 add("specular", &Loader::specular);
59 add("emission", &Loader::emission);
60 add("shininess", &Material::shininess);
63 void Material::Loader::ambient(float r, float g, float b, float a)
65 obj.ambient = GL::Color(r, g, b, a);
68 void Material::Loader::diffuse(float r, float g, float b, float a)
70 obj.diffuse = GL::Color(r, g, b, a);
73 void Material::Loader::specular(float r, float g, float b, float a)
75 obj.specular = GL::Color(r, g, b, a);
78 void Material::Loader::emission(float r, float g, float b, float a)
80 obj.emission = GL::Color(r, g, b, a);