Game Development Reference
In-Depth Information
It begins with the semantic name, of which there are many different options. At the
very least you require a POSITION attribute and everything else is optional. The
most commonly used semantics are as follows:
POSITION
COLOR
NORMAL
TEXCOORD
TEXCOORD refers to the texture coordinate on the model, which is a float2 / vec-
tor2 attribute describing the UV coordinates at that vertex.
Note
UV coordinates refer to the part of the texture displayed at that point, and exist
as a value between zero and one.
Semantics do not require that they only exist once within a vertex structure. Some,
like the texture coordinate, can have multiple versions, referred to in HLSL using a
number at the end of the semantic ( TEXCOORD0 , TEXCOORD1 , and so on).
The second parameter in this structure lets you define which one this particular at-
tribute refers to. In most cases this can just remain at zero; however, if you need
multiple normal or texture coordinates, this would be the place to specify which index
it has.
The format defines the data type stored in that attribute. You need to ensure you
match the data type, and number of channels or parts to what it actually stores to
ensure it is read properly. Some commonly used formats are the following:
DXGI_FORMAT_R32G32B32_FLOAT
DXGI_FORMAT_R32G32_FLOAT
DXGI_FORMAT_R32_FLOAT
There are also variations of these for signed and unsigned integers (SINT and UINT,
respectively).
Search WWH ::




Custom Search