3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
22 void Material::set_ambient(const Color &a)
27 void Material::set_diffuse(const Color &d)
32 void Material::set_specular(const Color &s)
37 void Material::set_emission(const Color &e)
42 void Material::set_shininess(float s)
47 void Material::apply() const
49 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
50 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
51 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
52 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
53 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
57 Material::Loader::Loader(Material &m):
60 add("ambient", &Loader::ambient);
61 add("diffuse", &Loader::diffuse);
62 add("specular", &Loader::specular);
63 add("emission", &Loader::emission);
64 add("shininess", &Material::shininess);
67 void Material::Loader::ambient(float r, float g, float b, float a)
69 mat.ambient=GL::Color(r, g, b, a);
72 void Material::Loader::diffuse(float r, float g, float b, float a)
74 mat.diffuse=GL::Color(r, g, b, a);
77 void Material::Loader::specular(float r, float g, float b, float a)
79 mat.specular=GL::Color(r, g, b, a);
82 void Material::Loader::emission(float r, float g, float b, float a)
84 mat.emission=GL::Color(r, g, b, a);