} else if (material.getLightingEnable()) {
writer.write("illum 1\n");
} else {
writer.write("illum 0\n");
}
Color3f color = new Color3f();
material.getAmbientColor(color);
writer.write("Ka " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
material.getDiffuseColor(color);
writer.write("Kd " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
material.getSpecularColor(color);
writer.write("Ks " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
writer.write("Ns " + format(material.getShininess()) + "\n");
if (material instanceof OBJMaterial) {
OBJMaterial objMaterial = (OBJMaterial)material;
if (objMaterial.isOpticalDensitySet()) {
writer.write("Ni " + format(objMaterial.getOpticalDensity()) + "\n");
}
if (objMaterial.isSharpnessSet()) {
writer.write("sharpness " + format(objMaterial.getSharpness()) + "\n");
}
}
} else {
ColoringAttributes coloringAttributes = appearance.getColoringAttributes();
if (coloringAttributes != null) {
writer.write("illum 0\n");
Color3f color = new Color3f();
coloringAttributes.getColor(color);
writer.write("Ka " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
writer.write("Kd " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
writer.write("Ks " + format(color.x) + " " + format(color.y) + " " + format(color.z) + "\n");
}