Fixed incorrect scale decoding on compressed animations

This commit is contained in:
parax0 2016-04-29 19:08:32 -06:00
parent 420f483b56
commit 3a5b63c484
3 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,7 @@ void CBone::UpdateTransform(CBoneTransformData& rData, const SBoneTransformInfo&
TransformInfo.Position = CVector3f::skZero;
// Apply parent transform
TransformInfo.Position = rkParentTransform.Position + (rkParentTransform.Rotation * TransformInfo.Position);
TransformInfo.Position = rkParentTransform.Position + (rkParentTransform.Rotation * (rkParentTransform.Scale * TransformInfo.Position));
TransformInfo.Rotation = rkParentTransform.Rotation * TransformInfo.Rotation;
// Calculate transform

View File

@ -212,7 +212,7 @@ void CAnimationLoader::ReadCompressedANIM()
mRotationDivisor = mpInput->ReadLong();
mTranslationMultiplier = mpInput->ReadFloat();
if (mGame == eEchoes) mpInput->Seek(0x4, SEEK_CUR);
if (mGame == eEchoes) mScaleMultiplier = mpInput->ReadFloat();
u32 NumBoneChannels = mpInput->ReadLong();
mpInput->Seek(0x4, SEEK_CUR); // Skip unknown value
@ -321,7 +321,7 @@ void CAnimationLoader::ReadCompressedAnimationData()
if (rChan.NumScaleKeys > 0)
{
mpAnim->mScaleChannels[iChan].reserve(rChan.NumScaleKeys + 1);
CVector3f Scale = CVector3f(rChan.Scale[0], rChan.Scale[1], rChan.Scale[2]) / (float) mRotationDivisor;
CVector3f Scale = CVector3f(rChan.Scale[0], rChan.Scale[1], rChan.Scale[2]) * mScaleMultiplier;
mpAnim->mScaleChannels[iChan].push_back(Scale);
}
}
@ -377,7 +377,7 @@ void CAnimationLoader::ReadCompressedAnimationData()
rChan.Scale[2] += (s16) BitStream.ReadBits(rChan.ScaleBits[2]);
}
CVector3f Scale = CVector3f(rChan.Scale[0], rChan.Scale[1], rChan.Scale[2]) / (float) mRotationDivisor;
CVector3f Scale = CVector3f(rChan.Scale[0], rChan.Scale[1], rChan.Scale[2]) * mScaleMultiplier;
mpAnim->mScaleChannels[iChan].push_back(Scale);
}
}

View File

@ -15,6 +15,7 @@ class CAnimationLoader
std::vector<bool> mKeyFlags;
float mTranslationMultiplier;
u32 mRotationDivisor;
float mScaleMultiplier;
struct SCompressedChannel
{