+Material::Material()
+{
+ set_ambient(0.2);
+ set_diffuse(0.8);
+ set_specular(0);
+ set_emission(0);
+ set_shininess(0);
+ set_reflectivity(0);
+}
+
+void Material::update_parameter(int mask) const
+{
+ if(cur_obj!=this)
+ return;
+
+ if(mask&AMBIENT)
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r);
+ if(mask&DIFFUSE)
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r);
+ if(mask&SPECULAR)
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r);
+ if(mask&EMISSION)
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emission.r);
+ if(mask&SHININESS)
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
+}