void ProcessAnimation(NodeAnim anim) { // position keys for (int a = 0; a < anim.PositionKeys.Length; a++) { anim.PositionKeys[a].Value.Z *= -1.0f; } // rotation keys for (int a = 0; a < anim.RotationKeys.Length; a++) { /* That's the safe version, but the float errors add up. So we try the short version instead aiMatrix3x3 rotmat = pAnim->mRotationKeys[a].mValue.GetMatrix(); rotmat.a3 = -rotmat.a3; rotmat.b3 = -rotmat.b3; rotmat.c1 = -rotmat.c1; rotmat.c2 = -rotmat.c2; aiQuaternion rotquat( rotmat); pAnim->mRotationKeys[a].mValue = rotquat; */ anim.RotationKeys[a].Value.X *= -1.0f; anim.RotationKeys[a].Value.Y *= -1.0f; } }
void TestAnimationChannel(NodeAnimationChannel netChannel, NodeAnim sharpChannel) { Assert.AreEqual(netChannel.NodeName, sharpChannel.NodeName); Assert.AreEqual(netChannel.PositionKeyCount, sharpChannel.PositionKeys.Length); for(int i=0; i<netChannel.PositionKeyCount; i++) { Assert.AreEqual(netChannel.PositionKeys[i].Time, sharpChannel.PositionKeys[i].Time); MathAssert.AreEqual(netChannel.PositionKeys[i].Value, sharpChannel.PositionKeys[i].Value); } Assert.AreEqual(netChannel.RotationKeyCount, sharpChannel.RotationKeys.Length); for (int i = 0; i < netChannel.RotationKeyCount; i++) { Assert.AreEqual(netChannel.RotationKeys[i].Time, sharpChannel.RotationKeys[i].Time); MathAssert.AreEqual(netChannel.RotationKeys[i].Value, sharpChannel.RotationKeys[i].Value); } Assert.AreEqual(netChannel.ScalingKeyCount, sharpChannel.ScalingKeys.Length); for (int i = 0; i < netChannel.ScalingKeyCount; i++) { Assert.AreEqual(netChannel.ScalingKeys[i].Time, sharpChannel.ScalingKeys[i].Time); MathAssert.AreEqual(netChannel.ScalingKeys[i].Value, sharpChannel.ScalingKeys[i].Value); } }