I have a vertex structure:
public struct VertexMultitextured
{
public Vector3 Position;
public Vector3 Normal;
public Vector4 TextureCoordinate;
public Vector4 TexWeights;
public static int SizeInBytes = (3 + 3 + 4 + 4) * sizeof(float);
public static VertexElement[] VertexElements = new VertexElement[]
{
new VertexElement( 0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0 ),
new VertexElement( sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0 ),
new VertexElement( sizeof(float) * 6, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 0 ),
new VertexElement( sizeof(float) * 10, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 1 ),
};
}
and I would like to create a VertexBuffer
that uses it. If I use this line:
terrainVertexBuffer = new VertexBuffer(device, typeof(VertexMultitextured),
vertices.Length, BufferUsage.WriteOnly);
I get an error that my structure "does not implement the IVertexType interface," so how do I go about implementing that? Or is there just an easier way to use this custom struct?
Thanks!