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>GXSetVtxDesc</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetVtxDesc</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 GXSetVtxDesc( <A href="../Enumerated_Types/GXAttr.html">GXAttr</A> <EM>attr</EM>, <A href="../Enumerated_Types/GXAttrType.html">GXAttrType</A> <EM>type</EM> );</CODE></PRE>
18</DL>
19<H2><A name="Arguments">Arguments</A></H2>
20<TABLE border="1" cellpadding="3" cellspacing="0.1">
21  <TBODY>
22    <TR>
23<TD width="120" valign="top" bgcolor="#ffffe8"><A name="attr"><EM><STRONG><CODE>attr</CODE></STRONG></EM></A></TD>
24<TD width="520">specifies the attribute name <BR>Specifiable attribute data must be sent in ascending order as shown below:
25      <TABLE border="1" width="500" cellspacing="0.1">
26        <TBODY>
27          <TR>
28<TD width="150" bgcolor="#C0C0C0">Attribute</TD>
29<TD width="150" bgcolor="#C0C0C0">Ascending Vertex Order</TD>
30<TD width="200" bgcolor="#C0C0C0">Description</TD>
31          </TR>
32          <TR>
33<TD width="150"><CODE>GX_VA_PNMTXIDX</CODE></TD>
34            <TD width="150">0</TD>
35<TD width="200">position coordinate/normal line matrix index</TD>
36          </TR>
37          <TR>
38<TD width="150"><CODE>GX_VA_TEX0MTXIDX</CODE></TD>
39            <TD width="150">1</TD>
40<TD width="200">The <CODE>GX_TEXCOORD0</CODE> matrix index.</TD>
41          </TR>
42          <TR>
43<TD width="150"><CODE>GX_VA_TEX1MTXIDX</CODE></TD>
44            <TD width="150">2</TD>
45<TD width="200">The <CODE>GX_TEXCOORD1</CODE> matrix index.</TD>
46          </TR>
47          <TR>
48<TD width="150"><CODE>GX_VA_TEX2MTXIDX</CODE></TD>
49            <TD width="150">3</TD>
50<TD width="200">The <CODE>GX_TEXCOORD2</CODE> matrix index.</TD>
51          </TR>
52          <TR>
53<TD width="150"><CODE>GX_VA_TEX3MTXIDX</CODE></TD>
54            <TD width="150">4</TD>
55<TD width="200">The <CODE>GX_TEXCOORD3</CODE> matrix index.</TD>
56          </TR>
57          <TR>
58<TD width="150"><CODE>GX_VA_TEX4MTXIDX</CODE></TD>
59            <TD width="150">5</TD>
60<TD width="200">The <CODE>GX_TEXCOORD4</CODE> matrix index.</TD>
61          </TR>
62          <TR>
63<TD width="150"><CODE>GX_VA_TEX5MTXIDX</CODE></TD>
64            <TD width="150">6</TD>
65<TD width="200">The <CODE>GX_TEXCOORD5</CODE> matrix index.</TD>
66          </TR>
67          <TR>
68<TD width="150"><CODE>GX_VA_TEX6MTXIDX</CODE></TD>
69            <TD width="150">7</TD>
70<TD width="200">The <CODE>GX_TEXCOORD6</CODE> matrix index.</TD>
71          </TR>
72          <TR>
73<TD width="150"><CODE>GX_VA_TEX7MTXIDX</CODE></TD>
74            <TD width="150">8</TD>
75<TD width="200">The <CODE>GX_TEXCOORD7</CODE> matrix index.</TD>
76          </TR>
77          <TR>
78<TD width="150"><CODE>GX_VA_POS</CODE></TD>
79            <TD width="150">9</TD>
80<TD width="200">the position coordinate</TD>
81          </TR>
82          <TR>
83<TD width="150"><CODE>GX_VA_NRM</CODE> or<BR><CODE>GX_VA_NBT</CODE></TD>
84            <TD width="150">10</TD>
85<TD width="200">the normal or NBT (normal/binormal/tangent)</TD>
86          </TR>
87          <TR>
88<TD width="150"><CODE>GX_VA_CLR0</CODE></TD>
89            <TD width="150">11</TD>
90<TD width="200">color 0</TD>
91          </TR>
92          <TR>
93<TD width="150"><CODE>GX_VA_CLR1</CODE></TD>
94            <TD width="150">12</TD>
95<TD width="200">color 1</TD>
96          </TR>
97          <TR>
98<TD width="150"><CODE>GX_VA_TEX0</CODE></TD>
99            <TD width="150">13</TD>
100<TD width="200">texture coordinate 0</TD>
101          </TR>
102          <TR>
103<TD width="150"><CODE>GX_VA_TEX1</CODE></TD>
104            <TD width="150">14</TD>
105<TD width="200">texture coordinate 1</TD>
106          </TR>
107          <TR>
108<TD width="150"><CODE>GX_VA_TEX2</CODE></TD>
109            <TD width="150">15</TD>
110<TD width="200">texture coordinate 2</TD>
111          </TR>
112          <TR>
113<TD width="150"><CODE>GX_VA_TEX3</CODE></TD>
114            <TD width="150">16</TD>
115<TD width="200">texture coordinate 3</TD>
116          </TR>
117          <TR>
118<TD width="150"><CODE>GX_VA_TEX4</CODE></TD>
119            <TD width="150">17</TD>
120<TD width="200">texture coordinate 4</TD>
121          </TR>
122          <TR>
123<TD width="150"><CODE>GX_VA_TEX5</CODE></TD>
124            <TD width="150">18</TD>
125<TD width="200">texture coordinate 5</TD>
126          </TR>
127          <TR>
128<TD width="150"><CODE>GX_VA_TEX6</CODE></TD>
129            <TD width="150">19</TD>
130<TD width="200">texture coordinate 6</TD>
131          </TR>
132          <TR>
133<TD width="150"><CODE>GX_VA_TEX7</CODE></TD>
134            <TD width="150">20</TD>
135<TD width="200">texture coordinate 7</TD>
136          </TR>
137        </TBODY>
138      </TABLE>
139      </TD>
140    </TR>
141    <TR>
142<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>type</CODE></STRONG></EM></TD>
143<TD width="520">specifies the method used to reference the attribute <BR>Accepted values are:<BR>
144      <TABLE border="1" width="500" cellspacing="0.1">
145
146          <tr>
147<TD width="150" bgcolor="#C0C0C0">Name</TD>
148<TD width="350" bgcolor="#C0C0C0">Description</TD>
149          </tr>
150          <tr>
151<TD width="150"> <code>GX_NONE</code></TD>
152<TD width="350">no data for this attribute</TD>
153          </tr>
154          <tr>
155<TD width="150"><code>GX_DIRECT</code></TD>
156<TD width="350">the direct reference data</TD>
157          </tr>
158          <tr>
159<TD width="150"><code>GX_INDEX8</code></TD>
160<TD width="350">the eight-bit index reference</TD>
161          </tr>
162          <tr>
163<TD width="150"><code>GX_INDEX16</code></TD>
164<TD width="350">the sixteen-bit index reference</TD>
165          </tr>
166
167      </TABLE>
168Only <code>GX_NONE</code> and <code>GX_DIRECT</code> can be applied with <code>GX_VA_PNMTXIDX</code> and <code>GX_VA_TEX*MTXIDX</code>.</TD>
169    </TR>
170  </TBODY>
171</TABLE>
172<H2>Return Values</H2>
173<P>None.</P>
174<H2>Description</H2>
175<P>This function sets the <code>type</code> of a single attribute (<code>attr</code>) in the current vertex descriptor.&nbsp;The current vertex descriptor defines which attributes are present in a vertex and how each attribute is referenced.&nbsp;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.</P>
176<H3>Attributes</H3>
177<H4><CODE>GX_VA_POSMTXIDX</CODE></H4>
178<P>The <code>attr</code> argument names the attribute. The <code>GX_VA_POSMTXIDX</code> attribute is used to specify a matrix index (8 bits) per vertex. This index is used to index position (and normal, when <a href="../toc.html#Lighting">lighting</a> is used)&nbsp;matrices in matrix memory.&nbsp;Providing a matrix index per vertex allows character skinning.</P>
179<H4><CODE>GX_VA_TEX0MTXIDX-GX_VA_TEX7MTXIDX</CODE></H4>
180<P>You may also specify a texture matrix index per vertex, using <code>GX_VA_TEX0MTXIDX</code> through <code>GX_VA_TEX7MTXIDX</code>. Each matrix index is an eight-bit value that is the row address of the texture matrix in matrix memory.&nbsp;The matrix index number corresponds to the generated texture coordinate used in <a href="../TexCoordGen/GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a>. For example, <code>GX_VA_TEX3MTXIDX</code> indicates the matrix used when generating <code>GX_TEXCOORD3</code>.&nbsp;You must provide texture matrix indices in sequential order, but it is possible to skip matrix indices.&nbsp;For example, you can assign <code>GX_VA_TEX0MTXIDX</code> and <code>GX_VA_TEX2MTXIDX</code>.&nbsp;The texture coordinate <code>GX_TEXCOORD1</code> will use the matrix specified in <a href="../TexCoordGen/GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a>.&nbsp;In other words, the default texture matrix index provided by <a href="../TexCoordGen/GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a> will be overridden by a per-vertex matrix index if one is provided.&nbsp;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.</P>
181<H4><CODE>GX_VA_POS</CODE></H4>
182<P>The <code>GX_VA_POS</code> attribute is used for position.&nbsp;Position is the only attribute required for each vertex.&nbsp;</P>
183<H4><CODE>GX_VA_NRM, GX_VA_NBT</CODE></H4>
184<P>The <code>GX_VA_NRM</code> attribute is used for the normals of three elements.&nbsp;<code>GX_VA_NBT</code> is enabled when the tri-norm vectors (normal, binormal, and tangent) are required, such as for bump mapping.&nbsp;<code>GX_VA_NRM</code> and <code>GX_VA_NBT</code> should not be enabled at the same time.&nbsp;<code>GX_VA_NRM</code> and <code>GX_VA_NBT</code> will share the same format in the vertex attribute format. See the <a href="GXSetVtxAttrFmt.html"><code>GXSetVtxAttrFmt</code></a> function.</P>
185<H3>Attribute Order within a Vertex</H3>
186<P>The attribute data is specified in a particular order for each vertex.&nbsp;The required order is specified in the <strong>Arguments</strong> section for <code>attr</code>. Be aware that any attributes can be enabled for a vertex, but when drawing a primitive (see <a href="GXBegin.html"><code>GXBegin</code></a>), the enabled attributes must be specified in the ascending order shown in the table above.(See also <a href="GXMatrixIndex.html"><code>GXMatrixIndex</code></a>, <a href="GXPosition.html"><code>GXPosition</code></a>, <a href="GXColor.html"><code>GXColor</code></a>, <a href="GXNormal.html"><code>GXNormal</code></a> and <a href="GXTexCoord.html"><code>GXTexCoord</code></a>.)</P>
187<P>Texture coordinates must be enabled consecutively from <code>GX_VA_TEX0</code>.</P>
188<P>If <code>GX_VA_CLR1</code> is enabled, <code>GX_VA_CLR0</code> cannot also be enabled. The vertex color will be interpreted as <code>GX_COLOR0A0</code> for lighting. See the <a href="../Lighting/GXSetChanCtrl.html"><code>GXSetChanCtrl</code></a> function.</P>
189<H3>Attribute Types</H3>
190<P>The attribute type <code>GX_NONE</code> indicates that no data or index is sent for this attribute.&nbsp;The attribute <code>GX_DIRECT</code> indicates that the data for this attribute will be passed directly in the graphics command stream (as opposed to being indexed).</P>
191<P>The attribute type <code>GX_INDEX8</code> indicates that an eight-bit index will be sent in the command stream.&nbsp;The eight-bit index <strong>0xff</strong> is a reserved value.&nbsp;It's used to disable the vertex in the graphics processor.&nbsp;You can use this to disable certain triangles in a display list, without having to regenerate a new display list.&nbsp;The graphics processor will use the index, along with the attribute's array base pointer and stride (see <a href="GXSetArray.html"><code>GXSetArray</code></a>), to look up the attribute's data.&nbsp;The <code>GX_INDEX16</code> attribute indicates a 16-bit index is present in the vertex data.&nbsp;The 16-bit index <strong>0xffff</strong> is a reserved value used to disable the vertex in the graphics processor.</P>
192<P><a href="../Management/GXInit.html"><code>GXInit</code></a> clears the current vertex descriptor using <a href="../Management/GXInit.html"><code>GXClearVtxDesc</code></a>.</P>
193<H2>See Also</H2>
194<P><A href="GXClearVtxDesc.html"><CODE>GXClearVtxDesc</CODE></A>, <A href="GXSetVtxDescv.html"><CODE>GXSetVtxDescv</CODE></A>, <A href="GXSetVtxAttrFmt.html"><CODE>GXSetVtxAttrFmt</CODE></A>, <A href="GXSetVtxAttrFmtv.html"><CODE>GXSetVtxAttrFmtv</CODE></A>, <A href="GXSetArray.html"><CODE>GXSetArray</CODE></A>, <A href="GXBegin.html"><CODE>GXBegin</CODE></A></P>
195<H2>Revision History</H2>
196<P>03/01/2006 Initial version.</P>
197</BODY>
198</HTML>