In XNA, I have created a new VertexType, called it VertexPositionTextureLight which inherts the IVertexType Interface, but apparently I need to implement the member of VertexDeclartion which I cleary have:
struct VertexPositionTextureLight : IVertexType {
Vector3 position;
Vector2 textureCoordinates;
float light;
public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration(new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), new VertexElement(sizeof(float) * 5, VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 1));
public VertexPositionTextureLight(Vector3 position, Vector3 normal, Vector2 textureCoordinate, float light) {
// TODO: Use normal data
this.position = position;
this.textureCoordinates = textureCoordinate;
this.light = light;
}
}
I used to use this struct without inheriting the interface but since I need to call the device.DrawUserIndexedPrimitives that function wants the struct to inherit IVertexType.