+ Vec3 diffuse = metallic ? Vec3(0, 0, 0) : color;
+ float col[] = {diffuse.x, diffuse.y, diffuse.z, 1.0};
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, col);
+
+ Vec3 specular = (metallic ? color : Vec3(1, 1, 1)) * (1.0 - roughness);
+ float scol[] = {specular.x, specular.y, specular.z, 1.0};
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, scol);
+ glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 1.0 + (1.0 - roughness) * 60.0);
+