Code: Select all
void CSkinnedMesh::buildAll_LocalAnimatedMatrices()
{
for (u32 i=0; i<AllJoints.size(); ++i)
{
SJoint *joint = AllJoints[i];
//Could be faster:
if (joint->UseAnimationFrom &&
(joint->UseAnimationFrom->PositionKeys.size() ||
joint->UseAnimationFrom->ScaleKeys.size() ||
joint->UseAnimationFrom->RotationKeys.size() ))
{
joint->LocalAnimatedMatrix=joint->Animatedrotation.getMatrix();
// --- joint->LocalAnimatedMatrix *= joint->Animatedrotation.getMatrix() ---
f32 *m1 = joint->LocalAnimatedMatrix.pointer();
core::vector3df &Pos = joint->Animatedposition;
m1[0] += Pos.X*m1[3];
m1[1] += Pos.Y*m1[3];
m1[2] += Pos.Z*m1[3];
m1[4] += Pos.X*m1[7];
m1[5] += Pos.Y*m1[7];
m1[6] += Pos.Z*m1[7];
m1[8] += Pos.X*m1[11];
m1[9] += Pos.Y*m1[11];
m1[10] += Pos.Z*m1[11];
m1[12] += Pos.X*m1[15];
m1[13] += Pos.Y*m1[15];
m1[14] += Pos.Z*m1[15];
// -----------------------------------
joint->GlobalSkinningSpace=false;
if (joint->ScaleKeys.size())
{
/*
core::matrix4 scaleMatrix;
scaleMatrix.setScale(joint->Animatedscale);
joint->LocalAnimatedMatrix *= scaleMatrix;
*/
// -------- joint->LocalAnimatedMatrix *= scaleMatrix -----------------
f32 *m1 = joint->LocalAnimatedMatrix.pointer();
m1[0] *= joint->Animatedscale.X;
m1[1] *= joint->Animatedscale.X;
m1[2] *= joint->Animatedscale.X;
m1[3] *= joint->Animatedscale.X;
m1[4] *= joint->Animatedscale.Y;
m1[5] *= joint->Animatedscale.Y;
m1[6] *= joint->Animatedscale.Y;
m1[7] *= joint->Animatedscale.Y;
m1[8] *= joint->Animatedscale.Z;
m1[9] *= joint->Animatedscale.Z;
m1[10] *= joint->Animatedscale.Z;
m1[11] *= joint->Animatedscale.Z;
m1[12] *= joint->Animatedscale.X; <-----[b]-what is this????????????[/b]
// -----------------------------------
}
}
else
{
joint->LocalAnimatedMatrix=joint->LocalMatrix;
}
}
}
m1[12] *= joint->Animatedscale.X;
what is this??
it may cause wrong result?!?