GXSetVtxAttrFmt

C Specification

#include <revolution/gx.h>
void GXSetVtxAttrFmt(
GXVtxFmt        vtxfmt, 
GXAttr          attr, 
GXCompCnt       cnt, 
GXCompType      type, 
u8              frac)

Arguments

vtxfmt Specifies the vertex format number
attr Specifies the attribute name. Specifiable values are: GX_VA_POS, GX_VA_NRM, GX_VA_NBT, GX_VA_CLR0, GX_VA_CLR1, GX_VA_TEX0, GX_VA_TEX1, GX_VA_TEX2, GX_VA_TEX3, GX_VA_TEX4, GX_VA_TEX5, GX_VA_TEX6, GX_VA_TEX7.
cnt
attribute Values that can be specified for cnt
GX_VA_POS GX_POS_XYZ, GX_POS_XY
GX_VA_NRM GX_NRM_XYZ
GX_VA_NBT GX_NRM_NBT, GX_NRM_NBT3
GX_VA_CLR0-1 GX_CLR_RGB, GX_CLR_RGBA
GX_VA_TEX0-7 GX_TEX_ST, GX_TEX_S
type
attribute Values that can be specified for type
GX_VA_POS, GX_VA_TEX0-7 GX_U8, GX_S8, GX_U16, GX_S16, GX_F32
GX_VA_NRM, GX_VA_NBT GX_S8, GX_S16, GX_F32
GX_VA_CLR0-1 GX_RGB565, GX_RGB8, GX_RGBX8, GX_RGBA4, GX_RGBA6, GX_RGBA8
frac
Attr type frac, accepted values
GX_VA_POS, GX_VA_TEX0-7 GX_U8 0-31 (only 0 for HW1)
GX_S8 0-31 (only 0 for HW1)
GX_U16 0-31
GX_S16 0-31
GX_VA_NRM or GX_VA_NBT GX_S8 implied, 6
GX_S16 implied, 14

Number of fractional bits of a fixed point number. Range is 0 <= frac <= 31. frac is ignored when a floating point number or color is used.

Return Values

None.

Description

This function sets the attribute format (attr) for a single attribute in the vertex attribute format table (VAT). Each attribute format describes the data type, number of elements (cnt), and fixed point format (frac), if required. There are eight vertex formats available in the VAT. The vertex format describes the format of all attributes in a vertex. The application can pre-program all eight vertex formats, and then select one of them during the actual drawing of geometry (See GXBegin).

Note: All vertices used to draw a particular graphics primitive will have the same format. The vertex format set using GXSetVtxAttrFmt, along with the current vertex descriptor set using GXSetVtxDesc, completely define the vertex data format.

The vertex format allows data to be sent to the graphics processor in its most quantized format. The graphics hardware will inverse-quantize the data (into floating point format) before it's used. The vertex attribute format is used to communicate the data quantization format to the hardware.

Note: The GX_VA_NRM and GX_VA_NBT attributes share the same type. Also, the frac for these attributes is fixed according to the type. The component count, cnt, for GX_VA_NRM must be set to GX_NRM_XYZ. The component count for GX_VA_NBT must be set to GX_NRM_NBT.

See Also

GXSetVtxAttrFmtv
GXGetVtxAttrFmtv
GXSetVtxDescv
GXGetVtxDescv
GXSetVtxDesc
GXBegin

Revision History

03/01/2006 Initial version.