#include <revolution/gx.h>
void GXSetVtxDesc( GXAttr attr, GXAttrType type );
attr |
specifies the attribute name Specifiable attribute data must be sent in ascending order as shown below:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
specifies the method used to reference the attribute Accepted values are:
GX_NONE and GX_DIRECT can be applied with GX_VA_PNMTXIDX and GX_VA_TEX*MTXIDX. |
None.
This function sets the type of a single attribute (attr) in the current vertex descriptor. The current vertex descriptor defines which attributes are present in a vertex and how each attribute is referenced. The current vertex descriptor is used by the graphics processor (GP) to interpret the graphics command stream produced by the GX API. In particular, the current vertex descriptor is used to parse vertex data present in the command stream.
GX_VA_POSMTXIDXThe attr argument names the attribute. The GX_VA_POSMTXIDX attribute is used to specify a matrix index (8 bits) per vertex. This index is used to index position (and normal, when lighting is used) matrices in matrix memory. Providing a matrix index per vertex allows character skinning.
GX_VA_TEX0MTXIDX-GX_VA_TEX7MTXIDXYou may also specify a texture matrix index per vertex, using GX_VA_TEX0MTXIDX through GX_VA_TEX7MTXIDX. Each matrix index is an eight-bit value that is the row address of the texture matrix in matrix memory. The matrix index number corresponds to the generated texture coordinate used in GXSetTexCoordGen. For example, GX_VA_TEX3MTXIDX indicates the matrix used when generating GX_TEXCOORD3. You must provide texture matrix indices in sequential order, but it is possible to skip matrix indices. For example, you can assign GX_VA_TEX0MTXIDX and GX_VA_TEX2MTXIDX. The texture coordinate GX_TEXCOORD1 will use the matrix specified in GXSetTexCoordGen. In other words, the default texture matrix index provided by GXSetTexCoordGen will be overridden by a per-vertex matrix index if one is provided. Providing texture matrix indices per vertex may be necessary when generating texture coordinates from a skinned (stitching) model, for example, when reflection-mapping a skinned model.
GX_VA_POSThe GX_VA_POS attribute is used for position. Position is the only attribute required for each vertex.
GX_VA_NRM, GX_VA_NBTThe GX_VA_NRM attribute is used for the normals of three elements. GX_VA_NBT is enabled when the tri-norm vectors (normal, binormal, and tangent) are required, such as for bump mapping. GX_VA_NRM and GX_VA_NBT should not be enabled at the same time. GX_VA_NRM and GX_VA_NBT will share the same format in the vertex attribute format. See the GXSetVtxAttrFmt function.
The attribute data is specified in a particular order for each vertex. The required order is specified in the Arguments section for attr. Be aware that any attributes can be enabled for a vertex, but when drawing a primitive (see GXBegin), the enabled attributes must be specified in the ascending order shown in the table above.(See also GXMatrixIndex, GXPosition, GXColor, GXNormal and GXTexCoord.)
Texture coordinates must be enabled consecutively from GX_VA_TEX0.
If GX_VA_CLR1 is enabled, GX_VA_CLR0 cannot also be enabled. The vertex color will be interpreted as GX_COLOR0A0 for lighting. See the GXSetChanCtrl function.
The attribute type GX_NONE indicates that no data or index is sent for this attribute. The attribute GX_DIRECT indicates that the data for this attribute will be passed directly in the graphics command stream (as opposed to being indexed).
The attribute type GX_INDEX8 indicates that an eight-bit index will be sent in the command stream. The eight-bit index 0xff is a reserved value. It's used to disable the vertex in the graphics processor. You can use this to disable certain triangles in a display list, without having to regenerate a new display list. The graphics processor will use the index, along with the attribute's array base pointer and stride (see GXSetArray), to look up the attribute's data. The GX_INDEX16 attribute indicates a 16-bit index is present in the vertex data. The 16-bit index 0xffff is a reserved value used to disable the vertex in the graphics processor.
GXInit clears the current vertex descriptor using GXClearVtxDesc.
GXClearVtxDesc, GXSetVtxDescv, GXSetVtxAttrFmt, GXSetVtxAttrFmtv, GXSetArray, GXBegin
2006/03/01 Initial version.
CONFIDENTIAL