2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-12 21:31:43 +00:00

chore: only allocate 3 floats per bone for applicable games

This commit is contained in:
Jan Laupetin
2026-05-03 17:19:48 +02:00
parent 875e1fb360
commit 92e236b1fe
@@ -323,8 +323,12 @@ namespace
{ {
xmodel.parentList = m_memory.Alloc<unsigned char>(xmodel.numBones - xmodel.numRootBones); xmodel.parentList = m_memory.Alloc<unsigned char>(xmodel.numBones - xmodel.numRootBones);
// For some reason Treyarch games allocate for a vec4 here. it is treated as a vec3 though? #if defined(FEATURE_IW3) || defined(FEATURE_T5) || defined(FEATURE_T6)
// For some reason some games allocate for a vec4 here. it is treated as a vec3 though?
xmodel.trans = m_memory.Alloc<float>((xmodel.numBones - xmodel.numRootBones) * 4u); xmodel.trans = m_memory.Alloc<float>((xmodel.numBones - xmodel.numRootBones) * 4u);
#else
xmodel.trans = m_memory.Alloc<float>((xmodel.numBones - xmodel.numRootBones) * 3u);
#endif
xmodel.quats = m_memory.Alloc<XModelQuat>(xmodel.numBones - xmodel.numRootBones); xmodel.quats = m_memory.Alloc<XModelQuat>(xmodel.numBones - xmodel.numRootBones);
} }
else else
@@ -373,7 +377,11 @@ namespace
// Viewhands seem to have nulled trans for some reason? // Viewhands seem to have nulled trans for some reason?
if (jXModel.type.value_or(JsonXModelType::RIGID) == JsonXModelType::VIEWHANDS) if (jXModel.type.value_or(JsonXModelType::RIGID) == JsonXModelType::VIEWHANDS)
{ {
#if defined(FEATURE_IW3) || defined(FEATURE_T5) || defined(FEATURE_T6)
memset(xmodel.trans, 0, sizeof(float) * 4 * (xmodel.numBones - xmodel.numRootBones)); memset(xmodel.trans, 0, sizeof(float) * 4 * (xmodel.numBones - xmodel.numRootBones));
#else
memset(xmodel.trans, 0, sizeof(float) * 3 * (xmodel.numBones - xmodel.numRootBones));
#endif
} }
return true; return true;