Fixed incorrect scale decoding on compressed animations
This commit is contained in:
parent
420f483b56
commit
3a5b63c484
|
@ -23,7 +23,7 @@ void CBone::UpdateTransform(CBoneTransformData& rData, const SBoneTransformInfo&
|
||||||
TransformInfo.Position = CVector3f::skZero;
|
TransformInfo.Position = CVector3f::skZero;
|
||||||
|
|
||||||
// Apply parent transform
|
// 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;
|
TransformInfo.Rotation = rkParentTransform.Rotation * TransformInfo.Rotation;
|
||||||
|
|
||||||
// Calculate transform
|
// Calculate transform
|
||||||
|
|
|
@ -212,7 +212,7 @@ void CAnimationLoader::ReadCompressedANIM()
|
||||||
|
|
||||||
mRotationDivisor = mpInput->ReadLong();
|
mRotationDivisor = mpInput->ReadLong();
|
||||||
mTranslationMultiplier = mpInput->ReadFloat();
|
mTranslationMultiplier = mpInput->ReadFloat();
|
||||||
if (mGame == eEchoes) mpInput->Seek(0x4, SEEK_CUR);
|
if (mGame == eEchoes) mScaleMultiplier = mpInput->ReadFloat();
|
||||||
u32 NumBoneChannels = mpInput->ReadLong();
|
u32 NumBoneChannels = mpInput->ReadLong();
|
||||||
mpInput->Seek(0x4, SEEK_CUR); // Skip unknown value
|
mpInput->Seek(0x4, SEEK_CUR); // Skip unknown value
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ void CAnimationLoader::ReadCompressedAnimationData()
|
||||||
if (rChan.NumScaleKeys > 0)
|
if (rChan.NumScaleKeys > 0)
|
||||||
{
|
{
|
||||||
mpAnim->mScaleChannels[iChan].reserve(rChan.NumScaleKeys + 1);
|
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);
|
mpAnim->mScaleChannels[iChan].push_back(Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ void CAnimationLoader::ReadCompressedAnimationData()
|
||||||
rChan.Scale[2] += (s16) BitStream.ReadBits(rChan.ScaleBits[2]);
|
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);
|
mpAnim->mScaleChannels[iChan].push_back(Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class CAnimationLoader
|
||||||
std::vector<bool> mKeyFlags;
|
std::vector<bool> mKeyFlags;
|
||||||
float mTranslationMultiplier;
|
float mTranslationMultiplier;
|
||||||
u32 mRotationDivisor;
|
u32 mRotationDivisor;
|
||||||
|
float mScaleMultiplier;
|
||||||
|
|
||||||
struct SCompressedChannel
|
struct SCompressedChannel
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue