3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
21 void Material::set_ambient(const Color &a)
26 void Material::set_diffuse(const Color &d)
31 void Material::set_specular(const Color &s)
36 void Material::set_emission(const Color &e)
41 void Material::set_shininess(float s)
46 void Material::apply() const
48 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
49 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
50 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
51 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
52 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
56 Material::Loader::Loader(Material &m):
59 add("ambient", &Loader::ambient);
60 add("diffuse", &Loader::diffuse);
61 add("specular", &Loader::specular);
62 add("emission", &Loader::emission);
63 add("shininess", &Material::shininess);
66 void Material::Loader::ambient(float r, float g, float b, float a)
68 mat.ambient=GL::Color(r, g, b, a);
71 void Material::Loader::diffuse(float r, float g, float b, float a)
73 mat.diffuse=GL::Color(r, g, b, a);
76 void Material::Loader::specular(float r, float g, float b, float a)
78 mat.specular=GL::Color(r, g, b, a);
81 void Material::Loader::emission(float r, float g, float b, float a)
83 mat.emission=GL::Color(r, g, b, a);