#include <revolution/gx.h>
void GXSetTexCoordGen2(
GXTexCoordID dst_coord,
GXTexGenType func,
GXTexGenSrc src_param,
u32 mtx,
GXBool normalize,
u32 postmtx );
| dst_coord | Name of the texture coordinate to be generated. Accepted values are: GX_TEXCOORD0, GX_TEXCOORD1, GX_TEXCOORD2 through GX_TEXCOORD7. |
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
func |
Feature used to generate texture coordinates. Accepted values are:
|
||||||||||
| src_param | Name of source attributes used to generate texture coordinates.
|
||||||||||
| mtx |
|
||||||||||
| normalize | Specifies whether or not to normalize texture coordinates after conversion on the first path (GX_TG_MTX* only). |
||||||||||
| postmtx | Specifies the post conversion matrix for multiplying texture coordinates by (GX_TG_MTX* only).Specifiable values are GX_PTTEXMTX0-19 and GX_PTIDENTITY. |
None.
This function is an expanded version of the GXSetTexCoordGen function which can specify options for generating texture coordinates.
The first four arguments are identical to those for the GXSetTexCoordGen function and operate in the same way. Only the new arguments are reviewed here. All other requirements specified in the GXSetTexCoordGen function still apply for the GXSetTexCoordGen2 function.
The new options apply only for ordinary texture coordinate generation, where the type is either GX_TG_MTX2x4 or GX_TG_MTX3x4. They do not work for light-based texgens or emboss texgens.
The normalize argument allows the calculated texture coordinate to be normalized after being multiplied by mtx, the first-pass transformation. The following calculation is performed (where [Stn, Ttn, Qtn] is the texture coordinate after the first-pass transformation):

After the optional normalization step, the texture coordinate is then multiplied by the 3x4 matrix, postmtx. This matrix is referred to as the post-transform matrix (see PTMatrix, below).

There are certain limitations when a vertex contains only position and one texture coordinate and the texgen type is GX_TG_MTX2x4. In this special performance case, normalization is not performed (even when specified). In addition, the value of Qtn is assumed to be 1.0, and Qt'n is not calculated.
This step results in a texture coordinate for the texture lookup.
The post-transform matrices are separate from the first-pass matrices. They are stored in a separate memory area in the same format as the first-pass matrices except that all matrices have three rows.
When the texture coordinate generation type is GX_TG_MTX3x4, the actual 2D texture coordinate calculation is carried out by dividing S and T coordinates by Q after post-conversion multiplication has been performed.
GXSetNumTexGens, GXSetTexCoordGen, GXSetVtxDesc, GXSetTevOrder
2008/09/08 Added information about the method of calculating 2D coordinates when using GX_TG_MTX3x4.
2007/06/11 Added a link to GXPTTexMtx, the post-transform matrix enumerator. Corrected typos.
2006/03/01 Initial version.
CONFIDENTIAL