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