What is the best way to create a VertexDeclaration, that makes it able to render a Shape consisting of vertices and also be able to store a color for the shape (in case the texture can't be rendered - or in case we want color instead of a texture) - instead of having both a VertexPositionNormalTexture and a VertexPositionColor struct in the same class/struct.
I'm trying this approach:
public interface IShape : IVertexType { }
public struct ShapeFace
{
public int Count { get; set; }
public Color Color { get; set; }
public Vector3 Position { get; set; }
public Vector2 TextureCoordinates { get; set; }
public Vector3 Normal { get; set; }
public Vector3[] Vertices { get; set; }
// Perhaps I need this?
// public int[] Indexs { get; set; }
}
public struct Shape : IShape
{
public ShapeFace[] Faces { get; set; }
/* Need to implement VertexDeclaration here */
}
How do I implement the VertexDeclaration to understand what I want to do?
A shape contains faces, each face can have it's own texture OR color, normal mapping, texture coordinates, etc.
Example A cube has 6 faces, each face needs 2 triangles, each triangle has 3 points. 6 * 2 * 3 = 36 vertices. This way I can create a cube with 6 faces instead of 36 vertices, and render it in color or with a texture.
I really want to simplify it so that I can create some kind of struct that works this way.