I am currently trying to make a custom vertex declaration.
One where a position, color and integer is passed to the Effect. I am having issues determining what enum for VertexElementUsage would be used for passing an integer and how does one determine the offset when declaring VertexElements as well?
public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration
{
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0),
new VertexElement(?, VertexElementFormat.Byte4, ?, 0)
};
(Note the ? in the last VertexElement)
it will be the size of Vector2 + the size of the color.
Basically think of it this way,
in a normal array, there are only one type of objects, so it’s known how much to jump to get to the next item.
This here is different, as they all have different sizes.
Using sizeof() is just fine, so it’ll be like:
or similar.
Otherwise you can find the size of a color object and add it to the size of the Vector3 object (and that will be the offset).