Texture coordinates determine which texel in the texture map is assigned to a given vertex. Texture coordinates are interpolated between vertices, similarly to how colors are interpolated between two vertices of lines and polygons.
Texture coordinates consist of two, three or four coordinates. These coordinates are referred to as the S, T, R, and Q coordinates. 2D textures use the S and T coordinates. 3D textures use the S, T and R coordinates. The Q coordinate, similar to the w coordinate of the (x, y, z, w) object coordinates, is used to create homogeneous coordinates.
Rather than the programmer having to explicitly assign texture coordinates, Java 3D can automatically generate the texture coordinates to achieve texture mapping onto contours. The TexCoordGeneration attributes specify the functions for automatically generating texture coordinates. The texture attributes that can be defined are:
g = p1xo + p2yo + p3zo + p4wo
where
g
is the value computed for the coordinate.p1
, p2
, p3
, and p4
are the plane equation coefficients (described below).
g = p1'xe + p2'ye + p3'ze + p4'we
where
xe
, ye
, ze
, and we are the eye coordinates of the vertex.p1'
, p2'
, p3'
, and p4'
are the plane equation coefficients transformed into eye coordinates.
The equation coefficients are set by the setPlaneS
, setPlaneT
, setPlaneR
, and setPlaneQ
methods for each of the S, T, R, and Q coordinate functions, respectively. By default the equation coefficients are set as follows:
setEnable
method. When enabled, the specified texture coordinate is computed according to the generating function associated with the coordinate. When disabled, subsequent vertices take the specified texture coordinate from the current set of texture coordinates.@see Canvas3D#queryProperties
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|