microsoft / DirectXMesh

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

Remap functions used vertexRemap incorrectly #24

Closed walbourn closed 6 years ago

walbourn commented 6 years ago

The legacy D3DXOptimizeVertices and D3DXWeldVertices define the vertexRemap as:

The value stored in pVertexRemap for a given element is the source vertex location in the new vertex ordering.

Which would be oldLoc = remap[newLoc]

The DirectXMesh versions are returning this data, but the Remap functions are treating the vertexRemap as the inverse: newLoc = remap[oldLoc]

I think the confusion here stems from the fact that the various ID3DXMesh class operations internally use remaps that are newLoc = remap[oldLoc], but the D3DXOptimizeVertices and D3DXWeldVertices functions explicitly inverse it to oldLoc = remap[newLoc]

walbourn commented 6 years ago

Fixed in this PR