Exemple #1
0
        static NumMatrix4x4 GetTransformForFrame(NodeAnimationChannel Ch, int Frame)
        {
            VectorKey PosKey = Ch.PositionKeys[Ch.PositionKeys.Count - 1];

            if (Frame < Ch.PositionKeys.Count)
            {
                PosKey = Ch.PositionKeys[Frame];
            }

            QuaternionKey RotKey = Ch.RotationKeys[Ch.RotationKeys.Count - 1];

            if (Frame < Ch.RotationKeys.Count)
            {
                RotKey = Ch.RotationKeys[Frame];
            }

            VectorKey SclKey = Ch.ScalingKeys[Ch.ScalingKeys.Count - 1];

            if (Frame < Ch.ScalingKeys.Count)
            {
                SclKey = Ch.ScalingKeys[Frame];
            }


            NumMatrix4x4 Rot = NumMatrix4x4.CreateFromQuaternion(ConvertQuat(RotKey.Value));
            NumMatrix4x4 Pos = NumMatrix4x4.CreateTranslation(ConvertVec(PosKey.Value));
            NumMatrix4x4 Scl = NumMatrix4x4.CreateScale(ConvertVec(SclKey.Value));

            //return Pos * Rot * Scl;
            return(Scl * Rot * Pos);
        }