#include <revolution/gx.h>
void GXSetTevOrder(
GXTevStageID stage,
GXTexCoordID coord,
GXTexMapID map,
GXChannelID color
);
stage |
the TEV stage ID Accepted values are: GX_TEVSTAGE0, GX_TEVSTAGE1, GX_TEVSTAGE2, through GX_TEVSTAGE15. |
||||||||||||||
coord |
the texture coordinates ID Applicable values are GX_TEXCOORD_NULL, GX_TEXCOORD0, GX_TEXCOORD1, GX_TEXCOORD2 through GX_TEXCOORD7. |
||||||||||||||
map |
the texture map ID Applicable values are GX_TEXCOORD_NULL, GX_TEXCOORD0, GX_TEXCOORD1, GX_TEXCOORD2, through GX_TEXCOORD7. The bitwise OR for GX_TEX_DISABLE and GX_TEXMAP* are permitted to perform coordinate scaling without a texture lookup. |
||||||||||||||
color |
the color channel Accepted values are:
GX_ALPHA_BUMP nor GX_ALPHA_BUMPN can be used with GX_TEVSTAGE0. |
None.
This function specifies the texture and rasterized color that will be available as inputs to this TEV stage. The texture coordinate coord is generated from input attributes using the GXSetTexCoordGen function, and is used to look up the texture map, previously loaded by GXLoadTexObj.
Be aware that this function does not make TEV stages available. Use the GXSetNumTevStages function to make available the series of TEV stages beginning with stage GX_TEVSTAGE0.
The processes for each TEV stage are independent. Color processing is controlled by the GXSetTevColorIn and GXSetTevColorOp functions. Alpha processing is controlled by the GXSetTevAlphaIn and GXSetTevColorOp functions.
The number of texture coordinates that can be used in all active TEV stages is set using the GXSetNumTexGens function. The number of color channels that can be used with all active TEV stages is set using the GXSetNumChans function. Active TEV stages should not reference more texture coordinates and colors than were generated.
Using the GXSetTevOrder function, it is possible to broadcast a single texture coordinate to multiple textures as long as they are the same size:
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD0, GX_TEXMAP1, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD0, GX_TEXMAP2, GX_COLOR1A1);
GXSetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD0, GX_TEXMAP3, GX_COLOR0A0);
Any TEV stage can use any generated texture coordinates.
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD3, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD2, GX_TEXMAP1, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP2, GX_COLOR1A1);
GXSetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD0, GX_TEXMAP3, GX_COLOR0A0);
If textures are not to be used in the TEV stage, set coord and map to NULL.
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD2, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP2, GX_COLOR1A1);
GXSetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD0, GX_TEXMAP3, GX_COLOR0A0);
If colors are not to be used in the TEV stage, set color to NULL.
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD3, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD2, GX_TEXMAP1, GX_COLOR_NULL);
GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP2, GX_COLOR1A1);
GXSetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD0, GX_TEXMAP3, GX_COLOR0A0);
The GXSetTevOrder function will, within its calls, scale the normalized texture coordinates generated in the GXSetTexCoordGen function according to the texture map size. For this reason, texture coordinates can only be broadcast to multiple texture maps only if those maps are the same size. In some cases, you may want to generate a texture coordinate at a certain scale but disable the texture lookup (this is an issue when generating texture coordinates for indirect bump mapping). To implement this, use the GX_TEXMAP_DISABLE flag.
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD0, GX_TEXMAP3 | GX_TEXMAP_DISABLE, GX_COLOR_NULL);
This uses GX_TEXMAP3 to scale GX_TEXCOORD0, but disables the lookup for GX_TEXMAP3.
There are several special settings for the argument color. Zero is always obtained as a rasterized color when GX_COLOR_ZERO is specified. When GX_ALPHA_BUMP or GX_ALPHA_BUMPN are specified, the bump alpha from the indirect texture unit can be used as a rasterized color (for more on settings for bump alphas, see the GXSetTevIndirect function). A bump alpha only has five bits of data, so GX_ALPHA_BUMP will shift the upper bits; the resulting range of values is from 0 to 248. GX_ALPHA_BUMPN, however, performs normalization, allowing for a range from 0 to 255.
The GXInit function describes the default TEV order.
TEV Setting Guide
GXSetNumTevStages
GXSetChanCtrl
GXLoadTexObj
GXSetTexCoordGen
03/01/2006 Initial version.