mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
extra fixes
Torque sees the seqEnd in appSequence as a time in seconds whereas in Assimp this is in frames. This is then converted to frames in generateSequences.
This commit is contained in:
parent
e2550ed525
commit
05960e4d25
4 changed files with 171 additions and 94 deletions
|
|
@ -260,22 +260,39 @@ void AssimpShapeLoader::processAnimations()
|
|||
ambientSeq->mName = "ambient";
|
||||
|
||||
Vector<aiNodeAnim*> ambientChannels;
|
||||
F32 duration = 0.0f;
|
||||
|
||||
for (U32 i = 0; i < mScene->mNumAnimations; ++i)
|
||||
{
|
||||
aiAnimation* anim = mScene->mAnimations[i];
|
||||
for (U32 j = 0; j < anim->mNumChannels; j++)
|
||||
{
|
||||
ambientChannels.push_back(anim->mChannels[j]);
|
||||
aiNodeAnim* nodeAnim = anim->mChannels[j];
|
||||
// Determine the maximum keyframe time for this animation
|
||||
F32 maxKeyTime = 0.0f;
|
||||
for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
|
||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
|
||||
}
|
||||
for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
|
||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
|
||||
}
|
||||
for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
|
||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
|
||||
}
|
||||
|
||||
ambientChannels.push_back(nodeAnim);
|
||||
|
||||
duration = getMax(duration, maxKeyTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ambientSeq->mNumChannels = ambientChannels.size();
|
||||
ambientSeq->mChannels = ambientChannels.address();
|
||||
ambientSeq->mDuration = duration;
|
||||
ambientSeq->mTicksPerSecond = 24.0;
|
||||
|
||||
AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
|
||||
appSequences.push_back(defaultAssimpSeq);
|
||||
|
||||
}
|
||||
|
||||
void AssimpShapeLoader::computeBounds(Box3F& bounds)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue