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);
52 void Material::unbind()
58 Material::Loader::Loader(Material &m):
59 DataFile::ObjectLoader<Material>(m)
61 add("ambient", &Loader::ambient);
62 add("diffuse", &Loader::diffuse);
63 add("specular", &Loader::specular);
64 add("emission", &Loader::emission);
65 add("shininess", &Material::shininess);
68 void Material::Loader::ambient(float r, float g, float b, float a)
70 obj.ambient = GL::Color(r, g, b, a);
73 void Material::Loader::diffuse(float r, float g, float b, float a)
75 obj.diffuse = GL::Color(r, g, b, a);
78 void Material::Loader::specular(float r, float g, float b, float a)
80 obj.specular = GL::Color(r, g, b, a);
83 void Material::Loader::emission(float r, float g, float b, float a)
85 obj.emission = GL::Color(r, g, b, a);