Update Assimp from 5.2.3 to 5.2.5

This commit is contained in:
Bloodknight 2022-10-02 19:02:49 +01:00
parent ea7ca63301
commit 16f3710058
379 changed files with 14469 additions and 47175 deletions

View file

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -97,13 +96,14 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
const aiMatrix4x4 &childTransform = pNode->mChildren[a]->mTransformation;
aiVector3D childpos(childTransform.a4, childTransform.b4, childTransform.c4);
ai_real distanceToChild = childpos.Length();
if (distanceToChild < 0.0001)
if (distanceToChild < ai_epsilon) {
continue;
}
aiVector3D up = aiVector3D(childpos).Normalize();
aiVector3D orth(1.0, 0.0, 0.0);
if (std::fabs(orth * up) > 0.99)
if (std::fabs(orth * up) > 0.99) {
orth.Set(0.0, 1.0, 0.0);
}
aiVector3D front = (up ^ orth).Normalize();
aiVector3D side = (front ^ up).Normalize();
@ -122,50 +122,50 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
mVertices.push_back(childpos);
mVertices.push_back(-front * distanceToChild * (ai_real)0.1);
mFaces.push_back(Face(localVertexStart + 0, localVertexStart + 1, localVertexStart + 2));
mFaces.push_back(Face(localVertexStart + 3, localVertexStart + 4, localVertexStart + 5));
mFaces.push_back(Face(localVertexStart + 6, localVertexStart + 7, localVertexStart + 8));
mFaces.push_back(Face(localVertexStart + 9, localVertexStart + 10, localVertexStart + 11));
mFaces.emplace_back(localVertexStart + 0, localVertexStart + 1, localVertexStart + 2);
mFaces.emplace_back(localVertexStart + 3, localVertexStart + 4, localVertexStart + 5);
mFaces.emplace_back(localVertexStart + 6, localVertexStart + 7, localVertexStart + 8);
mFaces.emplace_back(localVertexStart + 9, localVertexStart + 10, localVertexStart + 11);
}
} else {
// if the node has no children, it's an end node. Put a little knob there instead
aiVector3D ownpos(pNode->mTransformation.a4, pNode->mTransformation.b4, pNode->mTransformation.c4);
ai_real sizeEstimate = ownpos.Length() * ai_real(0.18);
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, -sizeEstimate));
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, -sizeEstimate);
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(sizeEstimate, 0.0, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, -sizeEstimate, 0.0));
mVertices.push_back(aiVector3D(0.0, 0.0, sizeEstimate));
mVertices.push_back(aiVector3D(-sizeEstimate, 0.0, 0.0));
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(sizeEstimate, 0.0, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, -sizeEstimate, 0.0);
mVertices.emplace_back(0.0, 0.0, sizeEstimate);
mVertices.emplace_back(-sizeEstimate, 0.0, 0.0);
mFaces.push_back(Face(vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2));
mFaces.push_back(Face(vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5));
mFaces.push_back(Face(vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8));
mFaces.push_back(Face(vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11));
mFaces.push_back(Face(vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14));
mFaces.push_back(Face(vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17));
mFaces.push_back(Face(vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20));
mFaces.push_back(Face(vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23));
mFaces.emplace_back(vertexStartIndex + 0, vertexStartIndex + 1, vertexStartIndex + 2);
mFaces.emplace_back(vertexStartIndex + 3, vertexStartIndex + 4, vertexStartIndex + 5);
mFaces.emplace_back(vertexStartIndex + 6, vertexStartIndex + 7, vertexStartIndex + 8);
mFaces.emplace_back(vertexStartIndex + 9, vertexStartIndex + 10, vertexStartIndex + 11);
mFaces.emplace_back(vertexStartIndex + 12, vertexStartIndex + 13, vertexStartIndex + 14);
mFaces.emplace_back(vertexStartIndex + 15, vertexStartIndex + 16, vertexStartIndex + 17);
mFaces.emplace_back(vertexStartIndex + 18, vertexStartIndex + 19, vertexStartIndex + 20);
mFaces.emplace_back(vertexStartIndex + 21, vertexStartIndex + 22, vertexStartIndex + 23);
}
unsigned int numVertices = static_cast<unsigned int>(mVertices.size() - vertexStartIndex);
@ -183,8 +183,9 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
// add all the vertices to the bone's influences
bone->mNumWeights = numVertices;
bone->mWeights = new aiVertexWeight[numVertices];
for (unsigned int a = 0; a < numVertices; a++)
for (unsigned int a = 0; a < numVertices; ++a) {
bone->mWeights[a] = aiVertexWeight(vertexStartIndex + a, 1.0);
}
// HACK: (thom) transform all vertices to the bone's local space. Should be done before adding
// them to the array, but I'm tired now and I'm annoyed.
@ -194,8 +195,9 @@ void SkeletonMeshBuilder::CreateGeometry(const aiNode *pNode) {
}
// and finally recurse into the children list
for (unsigned int a = 0; a < pNode->mNumChildren; a++)
for (unsigned int a = 0; a < pNode->mNumChildren; ++a) {
CreateGeometry(pNode->mChildren[a]);
}
}
// ------------------------------------------------------------------------------------------------