I have read many articles saying to interleave vertex attributes by putting the data in a structure
struct Vertex
{
XMFLOAT2A vertex;
XMFLOAT3A color;
.
.
.
}
This works fine for tutorials but for real world models loaded from obj,colladae files, etc. It is impossible to know how many attributes a mesh contains in advance and you can't write every possible structure containing all possible combinations of attributes.
The only solution is to read all attributes first and then merge them into one large array.
The problem is I tried this approach and it doesn't work.
So how do I interleave an unknown number of attributes known only at run time? What should be the alignbyteoffset in the INPUT_LAYOUT_DESC? How do I interleave the data OpenGL style?