Skip to content

ReorderIB

Chuck Walbourn edited this page Jan 21, 2022 · 5 revisions
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

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Windows 7 Service Pack 1
  • Xbox One
  • Xbox Series X|S
  • Windows Subsystem for Linux

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v16
  • GCC 9.4, 11.3
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXTex

DirectXMath

Tools

Test Suite

Content Exporter

DxCapsViewer

See also

DirectX Landing Page

Clone this wiki locally