microsoft / DirectXMesh

DirectXMesh geometry processing library
https://walbourn.github.io/directxmesh/
MIT License
787 stars 151 forks source link

Weld vertices in mesh #4

Closed walbourn closed 6 years ago

walbourn commented 9 years ago

Welds vertices that share attributes based on a epsilon threshold.

HRESULT D3DXWeldVertices(
  _In_     LPD3DXMESH pMesh,
  _In_     DWORD Flags,
  _In_     const D3DXWeldEpsilons *pEpsilons,
  _In_     const DWORD *pAdjacencyIn,
  _Inout_  DWORD *pAdjacencyOut,
  _Out_    DWORD *pFaceRemap,
  _Out_    LPD3DXBUFFER *ppVertexRemap
);  

Ericson, C. "Real Time Collision Detection", Chapter 12.1, Morgan Kaufmann Publishers, 2005

walbourn commented 6 years ago

Fixed in this pull request

The WeldVertices function takes a std::function to perform the evaluation instead of a "weld-epsilons" fixed-function structure. The D3DX function also performed a vertex optimization to remove unused vertices which can be done with the existing OptimizeVertices method and the new CompactVB helper.