3 This file is part of libmspgl
4 Copyright © 2007-2008 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::bind() const
51 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
52 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
53 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
54 glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
55 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
59 void Material::unbind()
65 Material::Loader::Loader(Material &m):
66 DataFile::ObjectLoader<Material>(m)
68 add("ambient", &Loader::ambient);
69 add("diffuse", &Loader::diffuse);
70 add("specular", &Loader::specular);
71 add("emission", &Loader::emission);
72 add("shininess", &Material::shininess);
75 void Material::Loader::ambient(float r, float g, float b, float a)
77 obj.ambient = GL::Color(r, g, b, a);
80 void Material::Loader::diffuse(float r, float g, float b, float a)
82 obj.diffuse = GL::Color(r, g, b, a);
85 void Material::Loader::specular(float r, float g, float b, float a)
87 obj.specular = GL::Color(r, g, b, a);
90 void Material::Loader::emission(float r, float g, float b, float a)
92 obj.emission = GL::Color(r, g, b, a);