Fix smd animation mess
aiMatrix4x4t<TReal>::FromEulerAnglesXYZ modified to row orderpull/2249/head
parent
ef151b4610
commit
8c2e975508
|
@ -181,8 +181,7 @@ void MS3DImporter :: CollectChildJoints(const std::vector<TempJoint>& joints,
|
|||
ch->mParent = nd;
|
||||
|
||||
ch->mTransformation = aiMatrix4x4::Translation(joints[i].position,aiMatrix4x4()=aiMatrix4x4())*
|
||||
// XXX actually, I don't *know* why we need the inverse here. Probably column vs. row order?
|
||||
aiMatrix4x4().FromEulerAnglesXYZ(joints[i].rotation).Transpose();
|
||||
aiMatrix4x4().FromEulerAnglesXYZ(joints[i].rotation);
|
||||
|
||||
const aiMatrix4x4 abs = absTrafo*ch->mTransformation;
|
||||
for(unsigned int a = 0; a < mScene->mNumMeshes; ++a) {
|
||||
|
@ -639,11 +638,8 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
|
|||
aiQuatKey& q = nd->mRotationKeys[nd->mNumRotationKeys++];
|
||||
|
||||
q.mTime = (*rot).time*animfps;
|
||||
|
||||
// XXX it seems our matrix&quaternion code has faults in its conversion routines --
|
||||
// aiQuaternion(x,y,z) seems to besomething different as quat(matrix.fromeuler(x,y,z)).
|
||||
q.mValue = aiQuaternion(aiMatrix3x3(aiMatrix4x4().FromEulerAnglesXYZ((*rot).value)*
|
||||
aiMatrix4x4().FromEulerAnglesXYZ((*it).rotation)).Transpose());
|
||||
q.mValue = aiQuaternion(aiMatrix3x3(aiMatrix4x4().FromEulerAnglesXYZ((*it).rotation)*
|
||||
aiMatrix4x4().FromEulerAnglesXYZ((*rot).value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -558,7 +558,8 @@ void SMDImporter::CreateOutputAnimations()
|
|||
pRotKeys->mTime = pVecKeys->mTime = (*qq).dTime;
|
||||
|
||||
// compute the rotation quaternion from the euler angles
|
||||
pRotKeys->mValue = aiQuaternion( (*qq).vRot.x, (*qq).vRot.y, (*qq).vRot.z );
|
||||
// aiQuaternion: The order of the parameters is yzx?
|
||||
pRotKeys->mValue = aiQuaternion( (*qq).vRot.y, (*qq).vRot.z, (*qq).vRot.x );
|
||||
pVecKeys->mValue = (*qq).vPos;
|
||||
|
||||
++pVecKeys; ++pRotKeys;
|
||||
|
@ -987,7 +988,7 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent,
|
|||
mTemp.a4 = vPos.x;
|
||||
mTemp.b4 = vPos.y;
|
||||
mTemp.c4 = vPos.z;
|
||||
key.matrix = key.matrix * mTemp;
|
||||
key.matrix = mTemp * key.matrix;
|
||||
}
|
||||
key.vPos = vPos;
|
||||
key.vRot = vRot;
|
||||
|
|
|
@ -527,27 +527,25 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromEulerAnglesXYZ(TReal x, TRe
|
|||
{
|
||||
aiMatrix4x4t<TReal>& _this = *this;
|
||||
|
||||
TReal cr = std::cos( x );
|
||||
TReal sr = std::sin( x );
|
||||
TReal cp = std::cos( y );
|
||||
TReal sp = std::sin( y );
|
||||
TReal cy = std::cos( z );
|
||||
TReal sy = std::sin( z );
|
||||
TReal cx = std::cos(x);
|
||||
TReal sx = std::sin(x);
|
||||
TReal cy = std::cos(y);
|
||||
TReal sy = std::sin(y);
|
||||
TReal cz = std::cos(z);
|
||||
TReal sz = std::sin(z);
|
||||
|
||||
_this.a1 = cp*cy ;
|
||||
_this.a2 = cp*sy;
|
||||
_this.a3 = -sp ;
|
||||
// mz*my*mx
|
||||
_this.a1 = cz * cy;
|
||||
_this.a2 = cz * sy * sx - sz * cx;
|
||||
_this.a3 = sz * sx + cz * sy * cx;
|
||||
|
||||
TReal srsp = sr*sp;
|
||||
TReal crsp = cr*sp;
|
||||
_this.b1 = sz * cy;
|
||||
_this.b2 = cz * cx + sz * sy * sx;
|
||||
_this.b3 = sz * sy * cx - cz * sx;
|
||||
|
||||
_this.b1 = srsp*cy-cr*sy ;
|
||||
_this.b2 = srsp*sy+cr*cy ;
|
||||
_this.b3 = sr*cp ;
|
||||
|
||||
_this.c1 = crsp*cy+sr*sy ;
|
||||
_this.c2 = crsp*sy-sr*cy ;
|
||||
_this.c3 = cr*cp ;
|
||||
_this.c1 = -sy;
|
||||
_this.c2 = cy * sx;
|
||||
_this.c3 = cy * cx;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue