Off-Importer: introduce unittest.
This commit is contained in:
@@ -294,7 +294,7 @@ void OFFImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
||||
|
||||
// load faces with their indices
|
||||
faces = mesh->mFaces;
|
||||
for (unsigned int i = 0; i < numFaces; ++i ) {
|
||||
for (unsigned int i = 0; i < numFaces; ) {
|
||||
if(!GetNextLine(buffer,line)) {
|
||||
ASSIMP_LOG_ERROR("OFF: The number of faces in the header is incorrect");
|
||||
break;
|
||||
|
||||
@@ -1024,20 +1024,26 @@ void glTF2Importer::ImportAnimations(glTF2::Asset& r)
|
||||
}
|
||||
|
||||
// Use the latest keyframe for the duration of the animation
|
||||
unsigned int maxDuration = 0;
|
||||
double maxDuration = 0;
|
||||
for (unsigned int j = 0; j < ai_anim->mNumChannels; ++j) {
|
||||
auto chan = ai_anim->mChannels[j];
|
||||
if (chan->mNumPositionKeys) {
|
||||
auto lastPosKey = chan->mPositionKeys[chan->mNumPositionKeys - 1];
|
||||
if (lastPosKey.mTime > maxDuration) maxDuration = lastPosKey.mTime;
|
||||
if (lastPosKey.mTime > maxDuration) {
|
||||
maxDuration = lastPosKey.mTime;
|
||||
}
|
||||
}
|
||||
if (chan->mNumRotationKeys) {
|
||||
auto lastRotKey = chan->mRotationKeys[chan->mNumRotationKeys - 1];
|
||||
if (lastRotKey.mTime > maxDuration) maxDuration = lastRotKey.mTime;
|
||||
if (lastRotKey.mTime > maxDuration) {
|
||||
maxDuration = lastRotKey.mTime;
|
||||
}
|
||||
}
|
||||
if (chan->mNumScalingKeys) {
|
||||
auto lastScaleKey = chan->mScalingKeys[chan->mNumScalingKeys - 1];
|
||||
if (lastScaleKey.mTime > maxDuration) maxDuration = lastScaleKey.mTime;
|
||||
if (lastScaleKey.mTime > maxDuration) {
|
||||
maxDuration = lastScaleKey.mTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
ai_anim->mDuration = maxDuration;
|
||||
|
||||
Reference in New Issue
Block a user