2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-25 02:51:43 +00:00

chore: set XSurface deformed property when applicable

This commit is contained in:
Jan Laupetin
2026-05-04 18:31:12 +02:00
parent 40e5a9de97
commit 8a791816ed
3 changed files with 27 additions and 3 deletions
@@ -752,9 +752,16 @@ namespace
// Since bone weights are sorted by weight count, the last must have the highest weight count
const auto maxWeightCount = common.m_vertex_bone_weights[xmodelToCommonVertexIndexLookup[xmodelToCommonVertexIndexLookup.size() - 1]].weightCount;
const auto modelIsRigid = maxWeightCount <= 1;
const auto surfaceIsRigid = maxWeightCount <= 1;
if (modelIsRigid)
#if defined(FEATURE_IW3) || defined(FEATURE_IW4)
surface.deformed = !surfaceIsRigid;
#else
if (!surfaceIsRigid)
surface.flags |= XSURFACE_FLAG_DEFORMED;
#endif
if (surfaceIsRigid)
{
constexpr auto maxVerticesForRigid = static_cast<size_t>(std::numeric_limits<decltype(XSurface::vertCount)>::max());
if (vertexOffset + xmodelToCommonVertexIndexLookup.size() > maxVerticesForRigid)
@@ -790,7 +797,7 @@ namespace
if (!common.m_bone_weight_data.weights.empty())
{
if (modelIsRigid)
if (surfaceIsRigid)
{
CreateVertListData(surface, xmodelToCommonVertexIndexLookup, common);
}