Adding Textures

In order to add textures, we make use of the hierarchical nature of the file format and add an optional TextureFilename data object to the Material data objects. So, the Material objects now read as follows:

Material RedMaterial {

1.000000;0.000000;0.000000;1.000000;; // R = 1.0, G = 0.0, B = 0.0

0.000000;

0.000000;0.000000;0.000000;;

0.000000;0.000000;0.000000;;

TextureFilename {

"tex1.ppm";

}

}

Material GreenMaterial {

0.000000;1.000000;0.000000;1.000000;; // R = 0.0, G = 1.0, B = 0.0

0.000000;

0.000000;0.000000;0.000000;;

0.000000;0.000000;0.000000;;

TextureFilename {

"win95.ppm";

}

}