This project has moved and is read-only. For the latest updates, please go here.
Finishes mesh optimization by reordering vertices and/or adding duplicated vertices for the vertex buffer.

HRESULT FinalizeVB(
   _In_reads_bytes_(nVerts*stride) const void* vbin, _In_ size_t stride,
   _In_ size_t nVerts,
   _In_reads_opt_(nDupVerts) const uint32_t* dupVerts, _In_ size_t nDupVerts,
   _In_reads_opt_(nVerts+nDupVerts) const uint32_t* vertexRemap, 
   _Out_writes_bytes_((nVerts+nDupVerts)*stride) void* vbout );

HRESULT FinalizeVB(
   _Inout_updates_bytes_all_(nVerts*stride) void* vb, _In_ size_t stride,
   _In_ size_t nVerts,
   _In_reads_(nVerts) const uint32_t* vertexRemap );

Parameters

A vertexRemap is an array with nVerts elements that describes how to reorder the vertices of the original mesh. This maps the original vertex location to the optimized location. See OptimizeVertices.

dupVerts contains nDupVerts elements indicating vertices that need duplicating. Each entry indicates the index of the original vbin vertex buffer to duplicate. The vertexRemap array also indicates reorder information for the duplicated vertices.

Remarks

This is the pseudo-code for applying a vertex remap to a vertex buffer:

for each j in nVerts
   newIndex = vertexRemap[ j ]
   if ( newIndex != -1 )
       memcpy( newVB + newIndex * stride,
               oldVB + j * stride,
               stride )

for each j in nDupVerts
   newIndex = vertexRemap[ j + nVerts ]
   if ( newIndex != -1 )
       memcpy( newVB + newIndex * stride,
               oldVB + dup[ j ] * stride,
               stride )

Last edited Oct 31, 2014 at 1:52 AM by walbourn, version 21