Skip to content

ReorderIBAndAdjacency

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

For Use

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

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • GCC 10.5, 11.4, 12.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