GXSetTexCoordGen2

C Specification

#include <revolution/gx.h>
void GXSetTexCoordGen2(
	GXTexCoordID   dst_coord,
	GXTexGenType   func, 
	GXTexGenSrc    src_param,
	u32            mtx,
	GXBool         normalize,
	u32            postmtx );

Arguments

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:
Name Type of Texture Coordinate Generation
GX_TG_MTX2x4 source attributes are converted into a 2x4 matrix
GX_TG_MTX3x4 source attributes are converted into a 3x4 matrix
GX_TG_BUMP0-7 embossed-style bump texture coordinates
GX_TG_SRTG R (red)/G (green) components from color channel output
src_param the name of source attributes used to generate texture coordinates
Functions Specifiable values for src_param are:
GX_TG_MTX3x4
GX_TG_MTX2x4
GX_TG_POS (position coordinate)
GX_TG_NRM (normal)
GX_TG_BINRM (binormal)
GX_TG_TANGENT (tangential)
GX_TG_TEX0-7 (input texture coordinates)
GX_TG_BUMP0-7 GX_TG_TEXCOORD0-6
GX_TG_SRTG GX_TG_COLOR0
GX_TG_COLOR1
mtx
Functions Specifiable values for mtx are:
GX_TG_MTX2x4
GX_TG_MTX3x4
GX_TEXMTX0-9, GX_IDENTITY
GX_TG_BUMP0-7 not used
GX_TG_SRTG not used
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, GX_PTIDENTITY

Return Values

None.

Description

This function is an expanded version of GXSetTexCoordGen which can specify options for generating texture coordinates.

The first four arguments are identical to those for GXSetTexCoordGen and function in the same way. Only the new arguments are reviewed here. All other requirements specified in GXSetTexCoordGen still apply for GXSetTexCoordGen2.

The new options apply only for ordinary texture coordinate generation, where the texgen 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 texcoord to be normalized after the multiplication 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 texcoord is then multiplied by the 3x4 matrix, postmtx. This matrix is referred to as the post-transform matrix (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.

See Also

GXSetNumTexGens
GXSetTexCoordGen
GXSetVtxDesc
GXSetTevOrder

Revision History

03/01/2006 Initial version.