commit
eb5b3bc347
|
@ -217,6 +217,7 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
|
|||
|
||||
// No rotation keys? Generate a dummy track
|
||||
if (!channel->mNumRotationKeys) {
|
||||
ai_assert(!channel->mRotationKeys);
|
||||
channel->mNumRotationKeys = 1;
|
||||
channel->mRotationKeys = new aiQuatKey[1];
|
||||
aiQuatKey& q = channel->mRotationKeys[0];
|
||||
|
@ -225,10 +226,13 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
|
|||
q.mValue = rotation;
|
||||
|
||||
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy rotation track has been generated");
|
||||
} else {
|
||||
ai_assert(channel->mRotationKeys);
|
||||
}
|
||||
|
||||
// No scaling keys? Generate a dummy track
|
||||
if (!channel->mNumScalingKeys) {
|
||||
ai_assert(!channel->mScalingKeys);
|
||||
channel->mNumScalingKeys = 1;
|
||||
channel->mScalingKeys = new aiVectorKey[1];
|
||||
aiVectorKey& q = channel->mScalingKeys[0];
|
||||
|
@ -237,10 +241,13 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
|
|||
q.mValue = scaling;
|
||||
|
||||
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy scaling track has been generated");
|
||||
} else {
|
||||
ai_assert(channel->mScalingKeys);
|
||||
}
|
||||
|
||||
// No position keys? Generate a dummy track
|
||||
if (!channel->mNumPositionKeys) {
|
||||
ai_assert(!channel->mPositionKeys);
|
||||
channel->mNumPositionKeys = 1;
|
||||
channel->mPositionKeys = new aiVectorKey[1];
|
||||
aiVectorKey& q = channel->mPositionKeys[0];
|
||||
|
@ -249,6 +256,8 @@ void ScenePreprocessor::ProcessAnimation (aiAnimation* anim)
|
|||
q.mValue = position;
|
||||
|
||||
ASSIMP_LOG_DEBUG("ScenePreprocessor: Dummy position track has been generated");
|
||||
} else {
|
||||
ai_assert(channel->mPositionKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,6 +513,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
|
|||
} else {
|
||||
// separate key sequences for position, rotation, scaling
|
||||
nbone->mNumPositionKeys = (unsigned int)bone->mPosKeys.size();
|
||||
if (nbone->mNumPositionKeys != 0) {
|
||||
nbone->mPositionKeys = new aiVectorKey[nbone->mNumPositionKeys];
|
||||
for( unsigned int c = 0; c < nbone->mNumPositionKeys; ++c ) {
|
||||
aiVector3D pos = bone->mPosKeys[c].mValue;
|
||||
|
@ -520,9 +521,11 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
|
|||
nbone->mPositionKeys[c].mTime = bone->mPosKeys[c].mTime;
|
||||
nbone->mPositionKeys[c].mValue = pos;
|
||||
}
|
||||
}
|
||||
|
||||
// rotation
|
||||
nbone->mNumRotationKeys = (unsigned int)bone->mRotKeys.size();
|
||||
if (nbone->mNumRotationKeys != 0) {
|
||||
nbone->mRotationKeys = new aiQuatKey[nbone->mNumRotationKeys];
|
||||
for( unsigned int c = 0; c < nbone->mNumRotationKeys; ++c ) {
|
||||
aiMatrix3x3 rotmat = bone->mRotKeys[c].mValue.GetMatrix();
|
||||
|
@ -531,12 +534,15 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
|
|||
nbone->mRotationKeys[c].mValue = aiQuaternion( rotmat);
|
||||
nbone->mRotationKeys[c].mValue.w *= -1.0f; // needs quat inversion
|
||||
}
|
||||
}
|
||||
|
||||
// scaling
|
||||
nbone->mNumScalingKeys = (unsigned int)bone->mScaleKeys.size();
|
||||
if (nbone->mNumScalingKeys != 0) {
|
||||
nbone->mScalingKeys = new aiVectorKey[nbone->mNumScalingKeys];
|
||||
for( unsigned int c = 0; c < nbone->mNumScalingKeys; c++)
|
||||
nbone->mScalingKeys[c] = bone->mScaleKeys[c];
|
||||
}
|
||||
|
||||
// longest lasting key sequence determines duration
|
||||
if( bone->mPosKeys.size() > 0)
|
||||
|
|
|
@ -132,15 +132,8 @@ TEST(utXImporter, TestFormatDetection) {
|
|||
}
|
||||
|
||||
|
||||
#if 0 // FIXME: disabled because it leaks memory
|
||||
|
||||
|
||||
TEST(utXImporter, importDwarf) {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/X/dwarf.x", aiProcess_ValidateDataStructure);
|
||||
ASSERT_NE(nullptr, scene);
|
||||
}
|
||||
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue