Revert "fix(rendering): remap M2 vertex bone indices through bone lookup table"

This reverts commit 04ad88330f.
This commit is contained in:
Kelsi 2026-04-03 22:26:14 -07:00
parent 04ad88330f
commit 634bac6c7a
2 changed files with 5 additions and 19 deletions

View file

@ -1486,17 +1486,7 @@ void CharacterRenderer::setupModelBuffers(M2ModelGPU& gpuModel) {
auto& dst = gpuVerts[i];
dst.position = src.position;
std::memcpy(dst.boneWeights, src.boneWeights, 4);
// Remap bone indices through the bone lookup table.
// M2 vertex bone indices are lookup table indices, not direct bone indices.
for (int j = 0; j < 4; j++) {
uint8_t idx = src.boneIndices[j];
if (idx < model.boneLookupTable.size()) {
dst.boneIndices[j] = static_cast<uint8_t>(
std::min<uint16_t>(model.boneLookupTable[idx], 255));
} else {
dst.boneIndices[j] = 0;
}
}
std::memcpy(dst.boneIndices, src.boneIndices, 4);
dst.normal = src.normal;
dst.texCoords = src.texCoords[0]; // Use first UV set
dst.tangent = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f); // default