The VertexTypes.h header defines these commonly used vertex data structures:
Each type also provides a D3D11_INPUT_ELEMENT_DESC array which can be used to create a matching input layout, for example:
Normal is required for any Effect that supports lighting computations.
Note that Position, Normal, and Color are XMFLOAT3 (DXGI_R32G32B32_FLOAT).
Texture is XMFLOAT2 (DXGI_FORMAT_R32G32_FLOAT).
- VertexPositionColor
- VertexPositionTexture
- VertexPositionNormal
- VertexPositionColorTexture
- VertexPositionNormalColor
- VertexPositionNormalTexture
- VertexPositionNormalColorTexture
Each type also provides a D3D11_INPUT_ELEMENT_DESC array which can be used to create a matching input layout, for example:
device->CreateInputLayout(VertexPositionColorTexture::InputElements,
VertexPositionColorTexture::InputElementCount,
vertexShaderCode, vertexShaderCodeSize,
&inputLayout);Usage
Position (which uses the semantic "SV_Position" is required for all rendering.Normal is required for any Effect that supports lighting computations.
Note that Position, Normal, and Color are XMFLOAT3 (DXGI_R32G32B32_FLOAT).
Texture is XMFLOAT2 (DXGI_FORMAT_R32G32_FLOAT).