7 : diffuse(1.0f, 1.0f, 1.0f)
11 memset(stdtex, 0, sizeof stdtex);
14 void Material::setup() const
16 float kd[] = {diffuse.x, diffuse.y, diffuse.z, alpha};
17 float ks[] = {specular.x, specular.y, specular.z, 1.0f};
19 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, kd);
20 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, ks);
21 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
23 int ntex = std::min((int)textures.size(), 8); // TODO: use max texture units
24 for(int i=0; i<ntex; i++) {
25 bind_texture(textures[i], i);
29 void Material::add_texture(Texture *tex, int type)
31 textures.push_back(tex);
33 if(type != MTL_TEX_UNKNOWN) {