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

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

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

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

HRESULT ReorderIBAndAdjacency(
   _Inout_updates_all_(nFaces*3) uint32_t* ib, _In_ size_t nFaces,
   _Inout_updates_all_(nFaces*3) uint32_t* adj,
   _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 ]
            newAdjacency[ j*3 + i ] = adjacency[ origFace*3 + i ]

Last edited Jun 20, 2015 at 7:52 AM by walbourn, version 4