This function applies a vertex remap from UVAtlasCreate or UVAtlasPartition to a vertex buffer if data beyond the content of UVAtlasVertex is used.

The data from the uv texture coordinates in vMeshOutVertexBuffer must be merged into the final VB after applying the remap.

Note: This is the reverse definition of DirectXMesh's vertex remap arrays so this is not the same function as FinializeVB.

HRESULT UVAtlasApplyRemap(
    _In_reads_bytes_(nVerts*stride) const void* vbin,
    _In_ size_t stride, _In_ size_t nVerts, _In_ size_t nNewVerts,
    _In_reads_(nNewVerts) const uint32_t* vertexRemap,
    _Out_writes_bytes_(nNewVerts*stride) void* vbout );

Remark

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

for each j in nTotalVerts
   oldIndex = vertexRemap[ j ];
   if (oldIndex != -1)
       assert( oldIndex < nVerts );
       memcpy( newVB + j * stride,
               oldVB + oldIndex * stride,
               stride )

Last edited Oct 31, 2014 at 7:54 PM by walbourn, version 4