In XNA 4.0, a vertex format has a description about how the data stored in the vertex allows the system to easily locate the specified data. The XNA framework provides some built-in vertex formats, such as VertexPositionColor
and VertexPositionNormalTexture
format. Sometimes, these built-in vertex formats are limited for special effects such as particles with life limitation. At that moment, you will need to define a custom vertex format. In this recipe, you will learn how to define the custom vertex format.
Now let's begin to program our sample application:
1. Create a Windows Phone Game project named
CustomVertexFormat
, changeGame1.cs
toCustomVertexFormatGame.cs
. Add a new class fileCustomVertexPositionColor.cs
to the project.2. Define the
CustomVertexPositionColor
class in theCustomVertexPositionColor.cs
file:// Define the CustomVertexPositionColor class public struct CustomVertexPositionColor : IVertexType { public Vector3 Position; public...