Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualeppo

Posted 29 January 2013 - 03:03 AM

1. Yes. You can combine multiple meshes into a single vertex buffer. Use the BaseVertexLocation argument to Draw...() to offset into the buffer.
2. Yes. As long as all vertex-elements have the same byte size (the pStrides argument you pass to IASetVertexBuffers()).

(float3)POSITION + (float2)UV1 + (float2)UV2 = (3 * 4 bytes) + (2 * 4 bytes) + (2 * 4 bytes)
(float3)POSITION + (float4)TANGENT = (3 * 4 bytes) + (4 * 4 bytes)

If vertices in two combined streams have a different size, it's possible to pad the first stream so the second's stride lines up with its first vertex correctly.

You bind an input layout to describe the data layout (the 'type') of a vertex.

#1eppo

Posted 29 January 2013 - 02:54 AM

1. Yes. You can combine multiple meshes into a single vertex buffer. Use the BaseVertexLocation argument to Draw...() to offset into the buffer.

2. Yes. As long as all vertex-elements have the same byte size (the pStrides argument you pass to IASetVertexBuffers()). 

 

(float3)POSITION + (float2)UV1 + (float2)UV2 = (3 * 4 bytes) + (2 * 4 bytes) + (2 * 4 bytes)

 

(float3)POSITION + (float4)TANGENT = (3 * 4 bytes) + (4 * 4 bytes)

 

If two vertex types have a different size, it's possible to pad the smaller one. That would increase the size of the buffer, but save you a call to IASetVertexBuffers.

 

You bind an input layout to describe the data layout (the 'type') of a vertex.


PARTNERS