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

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

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

HRESULT ReorderIBAndAdjacency(
   uint16_t* ib, size_t nFaces, uint32_t* adj,
   const uint32_t* faceRemap );
HRESULT ReorderIBAndAdjacency(
   const uint32_t* ibin, size_t nFaces, const uint32_t* adjin,
   const uint32_t* faceRemap,
   uint32_t* ibout, uint32_t* adjout );

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

This version is used to maintain the adjacency array after a face remap. If the adjacency is not needed, use ReorderIB instead.