From 6acaaee80f51fa43e62f55a8728bdfb26d364be2 Mon Sep 17 00:00:00 2001 From: Kota Iguchi Date: Sat, 20 Jun 2020 15:27:28 +0900 Subject: [PATCH] Check invalid vertex id for bone weight --- code/PostProcessing/LimitBoneWeightsProcess.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/PostProcessing/LimitBoneWeightsProcess.cpp b/code/PostProcessing/LimitBoneWeightsProcess.cpp index 5b8934159..b4f0b48d8 100644 --- a/code/PostProcessing/LimitBoneWeightsProcess.cpp +++ b/code/PostProcessing/LimitBoneWeightsProcess.cpp @@ -114,6 +114,10 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) for (unsigned int w = 0; w < bone->mNumWeights; ++w) { const aiVertexWeight& vw = bone->mWeights[w]; + + if (vertexWeights.size() <= vw.mVertexId) + continue; + vertexWeights[vw.mVertexId].push_back(Weight(b, vw.mWeight)); maxVertexWeights = std::max(maxVertexWeights, vertexWeights[vw.mVertexId].size()); }