Reorders a 16-bit or 32-bit index buffer based on a face remap array.

HRESULT ReorderIB(
   _In_reads_(nFaces*3) const uint16_t* ibin, _In_ size_t nFaces,
   _In_reads_(nFaces) const uint32_t* faceRemap,
   _Out_writes_(nFaces*3) uint16_t* ibout );

HRESULT ReorderIB(
   _Inout_updates_all_(nFaces*3) uint16_t* ib, _In_ size_t nFaces,
   _In_reads_(nFaces) const uint32_t* faceRemap );

HRESULT ReorderIB(
   _In_reads_(nFaces*3) const uint32_t* ibin, _In_ size_t nFaces,
   _In_reads_(nFaces) const uint32_t* faceRemap,
   _Out_writes_(nFaces*3) uint32_t* ibout );

HRESULT ReorderIB(
   _Inout_updates_all_(nFaces*3) uint32_t* ib, _In_ size_t nFaces,
   _In_reads_(nFaces) const uint32_t* faceRemap );

Parameters

A faceRemap is an array with nFaces elements that describes how to reorder the faces of the original mesh. For each face in the optimized mesh, it provides the original location of that face. See AttributeSort and OptimizeFaces.

Remarks

This is the pseudo-code of how to apply a face remap.

for each j in nFaces
   origFace = faceRemap[ j ]
   if ( origFace != -1 )
       for each i in 0..2
            newIndices[ j*3 + i ] = indices[ origFace*3 + i ]

Last edited Oct 31, 2014 at 12:51 AM by walbourn, version 7