   Need help with vertex declaration
  Hi,I've some problems understanding how to use the vertex declarations. How do I know what value I need for offset for my D3DVERTEXELEMENT9? I want to use position, normal, tangent, binormal and texcoord0. I've set everything up fine, but how can I calculate the offset?   
  If you have a position with 3 floats of 32 bits each, the size of that element is 3 * 4 bytes. A tex-coord with 2 floats would be 2 * 4 bytes. Normal is again 12 bytes. The offset is the number of bytes from the start of a vertex to the start of an element, that is the sum of the size of all elements before it.Example:struct Vertex {    D3DXVECTOR3 position;// 12 bytes from 0 to 11, offset is 0    D3DXVECTOR2 texCoord;// 8 bytes from 12 to 19, offset is 12    D3DXVECTOR3 normal;// 12 bytes from 20 to 31, offset is 20};// If you change the struct you get different offsetsstruct Vertex {    D3DXVECTOR3 position;// 12 bytes from 0 to 11, offset is 0    D3DXVECTOR3 normal;// 12 bytes from 12 to 23 , offset is 12    D3DXVECTOR2 texCoord;// 8 bytes from 24 to 31, offset is 24};;  Thanks a lot for explaining!   