1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>GXSetVtxAttrFmt</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetVtxAttrFmt</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15<PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17<PRE><CODE>void GXSetVtxAttrFmt(
18<A href="../Enumerated_Types/GXVtxFmt.html">GXVtxFmt</A> <EM>       vtxfmt</EM>,
19<A href="../Enumerated_Types/GXAttr.html">GXAttr</A> <EM>         attr</EM>,
20<A href="../Enumerated_Types/GXCompCnt.html">GXCompCnt</A> <EM>      cnt</EM>,
21<A href="../Enumerated_Types/GXCompType.html">GXCompType</A> <EM>     type</EM>,
22u8 <EM>             frac</EM>)</CODE></PRE>
23</DL>
24<H2>Arguments</H2>
25<TABLE border="1" cellspacing="0.1" cellpadding="3">
26  <TBODY>
27    <TR>
28<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>vtxfmt</FONT></STRONG></EM></TD>
29<TD width="520">Specifies the vertex format <a href="../Enumerated_Types/GXVtxFmt.html">number</a></TD>
30    </TR>
31    <TR>
32<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>attr</FONT></STRONG></EM></TD>
33<TD width="520">Specifies the attribute name.&nbsp;Specifiable values are: <CODE>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.</CODE></TD>
34    </TR>
35    <TR>
36<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>cnt</FONT></STRONG></EM></TD>
37      <TD width="520">
38      <TABLE border="1" width="500" cellspacing="0.1">
39        <TBODY>
40          <TR>
41<TD width="150" bgcolor="#C0C0C0">attribute</TD>
42<TD width="350" bgcolor="#C0C0C0">Values that can be specified for <EM>cnt</EM></TD>
43          </TR>
44          <TR>
45<TD width="150"><CODE>GX_VA_POS</CODE></TD>
46<TD width="350"><CODE>GX_POS_XYZ, GX_POS_XY</CODE></TD>
47          </TR>
48          <TR>
49<TD width="150"><CODE>GX_VA_NRM</CODE></TD>
50<TD width="350"><CODE>GX_NRM_XYZ</CODE></TD>
51          </TR>
52          <TR>
53<TD width="150"><CODE>GX_VA_NBT</CODE></TD>
54<TD width="350"><CODE>GX_NRM_NBT,</CODE> <CODE>GX_NRM_NBT3</CODE></TD>
55          </TR>
56          <TR>
57<TD width="150"><CODE>GX_VA_CLR0-1</CODE></TD>
58<TD width="350"><CODE>GX_CLR_RGB, GX_CLR_RGBA</CODE></TD>
59          </TR>
60          <TR>
61<TD width="150"><CODE>GX_VA_TEX0-7</CODE></TD>
62<TD width="350"><CODE>GX_TEX_ST, GX_TEX_S</CODE></TD>
63          </TR>
64        </TBODY>
65      </TABLE>
66      </TD>
67    </TR>
68    <TR>
69<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>type</CODE></STRONG></EM></TD>
70      <TD width="520">
71      <TABLE border="1" width="500" cellspacing="0.1">
72        <TBODY>
73          <TR>
74<TD width="150" bgcolor="#C0C0C0">attribute</TD>
75<TD width="350" bgcolor="#C0C0C0">Values that can be specified for <EM>type</EM></TD>
76          </TR>
77          <TR>
78<TD width="150"><CODE>GX_VA_POS, GX_VA_TEX0-7</CODE></TD>
79<TD width="350"><CODE>GX_U8, GX_S8, GX_U16, GX_S16, GX_F32</CODE></TD>
80          </TR>
81          <TR>
82<TD width="150"><CODE>GX_VA_NRM, GX_VA_NBT</CODE></TD>
83<TD width="350"><CODE>GX_S8, GX_S16, GX_F32</CODE></TD>
84          </TR>
85          <TR>
86<TD width="150"><CODE>GX_VA_CLR0-1</CODE></TD>
87<TD width="350"><CODE>GX_RGB565, GX_RGB8, GX_RGBX8, GX_RGBA4, GX_RGBA6, GX_RGBA8</CODE></TD>
88          </TR>
89        </TBODY>
90      </TABLE>
91      </TD>
92    </TR>
93    <TR>
94<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>frac</CODE></STRONG></EM></TD>
95      <TD width="520">
96      <TABLE border="1" width="500" cellspacing="0.1">
97        <TBODY>
98          <TR>
99<TD width="33%" bgcolor="#C0C0C0"><EM>Attr</EM></TD>
100<TD width="33%" bgcolor="#C0C0C0"><EM>type</EM></TD>
101<TD width="34%" bgcolor="#C0C0C0"><EM>frac</EM>, accepted values</TD>
102          </TR>
103          <TR>
104<TD width="33%" rowspan="4"><CODE>GX_VA_POS, GX_VA_TEX0-7</CODE></TD>
105<TD width="33%"><CODE>GX_U8</CODE></TD>
106<TD width="34%"><CODE>0-31 (only 0 for HW1)</CODE></TD>
107          </TR>
108          <TR>
109<TD width="33%"><CODE>GX_S8</CODE></TD>
110<TD width="34%"><CODE>0-31 (only 0 for HW1)</CODE></TD>
111          </TR>
112          <TR>
113<TD width="33%"><CODE>GX_U16</CODE></TD>
114            <TD width="34%"><CODE>0-31</CODE></TD>
115          </TR>
116          <TR>
117<TD width="33%"><CODE>GX_S16</CODE></TD>
118            <TD width="34%"><CODE>0-31</CODE></TD>
119          </TR>
120          <TR>
121<TD width="33%" rowspan="2"><CODE>GX_VA_NRM or GX_VA_NBT</CODE></TD>
122<TD width="33%"><CODE>GX_S8</CODE></TD>
123<TD width="34%"><CODE>implied, 6</CODE></TD>
124          </TR>
125          <TR>
126<TD width="33%"><CODE>GX_S16</CODE></TD>
127<TD width="34%"><CODE>implied, 14</CODE></TD>
128          </TR>
129        </TBODY>
130      </TABLE>
131<P>Number of fractional bits of a fixed point number. Range is 0 &lt;= <STRONG><EM>frac</EM></STRONG> &lt;= 31. <STRONG><EM>frac</EM></STRONG> is ignored when a floating point number or color is used.</P>
132      </TD>
133    </TR>
134  </TBODY>
135</TABLE>
136<H2>Return Values</H2>
137<P>None.</P>
138<H2>Description</H2>
139<P>This function sets the <em>attribute format</em> (<code><strong><em>attr</em></strong></code>) for a single attribute in the vertex attribute format table (VAT).&nbsp;Each attribute format describes the data <code><em><strong>type</strong></em></code>, number of elements (<code><em><strong>cnt</strong></em></code>), and fixed point format (<code><em><strong>frac</strong></em></code>), if required. There are eight <em>vertex formats</em> available in the VAT. The vertex format describes the format of all attributes in a vertex.&nbsp;The application can pre-program all eight vertex formats, and then select one of them during the actual drawing of geometry (See <a href="GXBegin.html"><code>GXBegin</code></a>). <BR><BR><B>Note:</B> All vertices used to draw a particular graphics primitive will have the same format.&nbsp;The vertex format set using <a href="GXSetVtxAttrFmt.html"><code>GXSetVtxAttrFmt</code></a>, along with the current vertex descriptor set using <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a>, completely define the vertex data format.</P>
140<P>The vertex format allows data to be sent to the graphics processor in its most <em>quantized</em> format.&nbsp;The graphics hardware will <em>inverse-quantize</em> the data (into floating point format) before it's used.&nbsp;The vertex attribute format is used to communicate the data quantization format to the hardware.</P>
141<P><B>Note:</B> The <code>GX_VA_NRM</code> and <code>GX_VA_NBT</code> attributes share the same <code><em><strong>type</strong></em></code>. Also, the <em><strong><code>frac</code></strong></em> for these attributes is fixed according to the type. The component count, <code><em><strong>cnt</strong></em></code>, for <code>GX_VA_NRM</code> must be set to <code>GX_NRM_XYZ</code>.&nbsp;The component count for <code>GX_VA_NBT</code> must be set to <code>GX_NRM_NBT</code>. </P>
142<H2>See Also</H2>
143<P><a href="GXSetVtxAttrFmtv.html">GXSetVtxAttrFmtv</a><br> <a href="GXGetVtxAttrFmtv.html">GXGetVtxAttrFmtv</a><br> <a href="GXSetVtxDescv.html">GXSetVtxDescv</a><br> <a href="GXGetVtxDescv.html">GXGetVtxDescv</a><br> <a href="GXSetVtxDesc.html">GXSetVtxDesc</a><br> <a href="GXBegin.html">GXBegin</a></P>
144<H2>Revision History</H2>
145<P>03/01/2006 Initial version.</P>
146</BODY>
147</HTML>