5 ReorderIB
Chuck Walbourn редактировал(а) эту страницу 2022-01-20 17:34:24 -08:00
DirectXMesh

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

HRESULT ReorderIB(
   const uint16_t* ibin, size_t nFaces, const uint32_t* faceRemap,
   uint16_t* ibout );

HRESULT ReorderIB(
   uint16_t* ib, size_t nFaces, const uint32_t* faceRemap );
HRESULT ReorderIB(
   const uint32_t* ibin, size_t nFaces, const uint32_t* faceRemap,
   uint32_t* ibout );

HRESULT ReorderIB(
   uint32_t* ib, size_t 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 (i.e. oldLoc = faceRemap[newLoc]). 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 ]

After applying the face remap, the adjacency is invalid. To maintain the adjacency, use ReorderIBAndAdjacency