Check invalid vertex id for bone weight

pull/3288/head
Kota Iguchi 2020-06-20 15:27:28 +09:00
parent c2a732938e
commit 6acaaee80f
1 changed files with 4 additions and 0 deletions

View File

@ -114,6 +114,10 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
for (unsigned int w = 0; w < bone->mNumWeights; ++w) for (unsigned int w = 0; w < bone->mNumWeights; ++w)
{ {
const aiVertexWeight& vw = bone->mWeights[w]; const aiVertexWeight& vw = bone->mWeights[w];
if (vertexWeights.size() <= vw.mVertexId)
continue;
vertexWeights[vw.mVertexId].push_back(Weight(b, vw.mWeight)); vertexWeights[vw.mVertexId].push_back(Weight(b, vw.mWeight));
maxVertexWeights = std::max(maxVertexWeights, vertexWeights[vw.mVertexId].size()); maxVertexWeights = std::max(maxVertexWeights, vertexWeights[vw.mVertexId].size());
} }