/* --------------------------------------------------------------------------- */ /* MATERIALS */ #include "materials.h" material_td redPlastic = { {0.4, 0.0, 0.0, 1.0}, {0.6, 0.0, 0.0, 1.0}, {0.0, 0.0, 0.0, 1.0}, {32.0} }; material_td greenPlastic = { {0.0, 0.2, 0.0, 1.0}, {0.0, 0.3, 0.0, 1.0}, {0.0, 0.0, 0.0, 1.0}, {32.0} }; material_td bluePlastic = { {0.0, 0.0, 0.3, 1.0}, {0.0, 0.0, 0.6, 1.0}, {0.0, 0.0, 0.0, 1.0}, {32.0} }; material_td blueishPlastic = { {0.1, 0.1, 0.2, 1.0}, {0.0, 0.0, 0.3, 1.0}, {0.0, 0.0, 0.0, 1.0}, {32.0} }; material_td yellowPlastic = { {0.5, 0.5, 0.0, 1.0}, {0.6, 0.6, 0.0, 1.0}, {0.0, 0.0, 0.0, 1.0}, {32.0} }; material_td whiteShiny = { {0.3, 0.3, 0.3, 1.0}, {0.4, 0.4, 0.4, 1.0}, {0.0, 0.0, 0.0, 1.0}, {100.0} }; void set_material(char *name) { material_td *material; if (!strcmp(name,"redPlasticMaterial")) material = &redPlastic; else if (!strcmp(name,"greenPlasticMaterial")) material = &greenPlastic; else if (!strcmp(name,"bluePlasticMaterial")) material = &bluePlastic; else if (!strcmp(name,"yellowPlasticMaterial")) material = &yellowPlastic; else if (!strcmp(name,"whiteShinyMaterial")) material = &whiteShiny; else material = &redPlastic; glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,material->ambient); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,material->diffuse); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR,material->specular); glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, material->shininess); }