48
Chapter 3: Specifying the Appearance of Geometries
Specifying Texture Coordinates
There are two ways to specify how a texture is applied to a geometry:
• Use the default. Cosmo 3D applies textures to geometries according to the
geometry.
• Use the texture coordinate function, setTexGen().
Using the Default
Cosmo 3D applies textures to geometries according to the geometry. For all geometries
subclassed from csGeometry, Cosmo 3D
• Computes the bounding box.
• Turns the texture so its longest side is in the horizontal (s) direction.
The horizontal (s) value ranges from 0.0 to 1.0 and the vertical component ranges from
0.0 to n, where n equals the ratio of the t dimension to the s dimension; this ratio
maintains the texture without distorting it.
Using the Texture Coordinate Function
The setTexGen() method generates texture coordinates by, in effect, projecting a texture
plane onto a geometry, as shown in Figure 3-5.
Figure 3-5 Texture Coordinate Function