fix: not using lookup to common vertices when writing rigid bone data

no more pizza cheese problem
This commit is contained in:
Jan 2025-04-05 17:36:29 +02:00
parent a2c8129a13
commit cec70e783f
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -454,17 +454,17 @@ namespace
surface.partBits[partBitsIndex] |= 1 << shiftValue; surface.partBits[partBitsIndex] |= 1 << shiftValue;
} }
void CreateVertListData(XSurface& surface, const std::vector<size_t>& vertexIndices, const XModelCommon& common) const void CreateVertListData(XSurface& surface, const std::vector<size_t>& xmodelToCommonVertexIndexLookup, const XModelCommon& common) const
{ {
ReorderRigidTrisByBoneIndex(vertexIndices, surface, common); ReorderRigidTrisByBoneIndex(xmodelToCommonVertexIndexLookup, surface, common);
const auto rigidBoneIndexForTri = GetRigidBoneIndicesForTris(vertexIndices, surface, common); const auto rigidBoneIndexForTri = GetRigidBoneIndicesForTris(xmodelToCommonVertexIndexLookup, surface, common);
std::vector<XRigidVertList> vertLists; std::vector<XRigidVertList> vertLists;
auto currentVertexTail = 0u; auto currentVertexTail = 0u;
auto currentTriTail = 0u; auto currentTriTail = 0u;
const auto vertexCount = vertexIndices.size(); const auto vertexCount = xmodelToCommonVertexIndexLookup.size();
const auto triCount = static_cast<size_t>(surface.triCount); const auto triCount = static_cast<size_t>(surface.triCount);
const auto boneCount = common.m_bones.size(); const auto boneCount = common.m_bones.size();
for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++) for (auto boneIndex = 0u; boneIndex < boneCount; boneIndex++)
@ -473,7 +473,7 @@ namespace
boneVertList.boneOffset = static_cast<uint16_t>(boneIndex * sizeof(DObjSkelMat)); boneVertList.boneOffset = static_cast<uint16_t>(boneIndex * sizeof(DObjSkelMat));
auto currentVertexHead = currentVertexTail; auto currentVertexHead = currentVertexTail;
while (currentVertexHead < vertexCount && GetRigidBoneForVertex(currentVertexHead, common) == boneIndex) while (currentVertexHead < vertexCount && GetRigidBoneForVertex(xmodelToCommonVertexIndexLookup[currentVertexHead], common) == boneIndex)
currentVertexHead++; currentVertexHead++;
auto currentTriHead = currentTriTail; auto currentTriHead = currentTriTail;