store bone rotations as quats; more common than HPR, and we don't
have to convert constantly
This commit is contained in:
@@ -676,22 +676,18 @@ void Model::SetBones( const msAnimation* pAnimation, float fFrame, vector<myBone
|
|||||||
{
|
{
|
||||||
const float s = SCALE( fFrame, pLastRotationKey->fTime, pThisRotationKey->fTime, 0, 1 );
|
const float s = SCALE( fFrame, pLastRotationKey->fTime, pThisRotationKey->fTime, 0, 1 );
|
||||||
|
|
||||||
RageVector4 q1, q2, q;
|
RageVector4 q;
|
||||||
RageQuatFromHPR( &q1, pLastRotationKey->Rotation );
|
RageQuatSlerp( &q, pLastRotationKey->Rotation, pThisRotationKey->Rotation, s );
|
||||||
RageQuatFromHPR( &q2, pThisRotationKey->Rotation );
|
|
||||||
RageQuatSlerp( &q, q1, q2, s );
|
|
||||||
|
|
||||||
RageMatrixFromQuat( &m, q );
|
RageMatrixFromQuat( &m, q );
|
||||||
}
|
}
|
||||||
else if( pLastRotationKey == 0 )
|
else if( pLastRotationKey == 0 )
|
||||||
{
|
{
|
||||||
vRot = pThisRotationKey->Rotation;
|
RageMatrixFromQuat( &m, pThisRotationKey->Rotation );
|
||||||
RageMatrixAngles( &m, vRot );
|
|
||||||
}
|
}
|
||||||
else if( pThisRotationKey == 0 )
|
else if( pThisRotationKey == 0 )
|
||||||
{
|
{
|
||||||
vRot = pLastRotationKey->Rotation;
|
RageMatrixFromQuat( &m, pLastRotationKey->Rotation );
|
||||||
RageMatrixAngles( &m, vRot );
|
|
||||||
}
|
}
|
||||||
m.m[3][0] = vPos[0];
|
m.m[3][0] = vPos[0];
|
||||||
m.m[3][1] = vPos[1];
|
m.m[3][1] = vPos[1];
|
||||||
|
|||||||
@@ -340,7 +340,8 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
|
|||||||
|
|
||||||
msRotationKey key;
|
msRotationKey key;
|
||||||
key.fTime = fTime;
|
key.fTime = fTime;
|
||||||
key.Rotation = RageVector3( Rotation[0], Rotation[1], Rotation[2] );
|
RageVector3 Rotation = RageVector3( Rotation[0], Rotation[1], Rotation[2] );
|
||||||
|
RageQuatFromHPR( &key.Rotation, Rotation );
|
||||||
Bone.RotationKeys[j] = key;
|
Bone.RotationKeys[j] = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ struct msPositionKey
|
|||||||
struct msRotationKey
|
struct msRotationKey
|
||||||
{
|
{
|
||||||
float fTime;
|
float fTime;
|
||||||
RageVector3 Rotation;
|
RageVector4 Rotation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msBone
|
struct msBone
|
||||||
|
|||||||
Reference in New Issue
Block a user