コード例 #1
0
ファイル: AnimatedModel.cs プロジェクト: Keilerr/csat
        /// <summary>
        /// laske luurangolle asento.
        /// </summary>
        void InterpolateSkeletons(ref MD5Joint[,] skel, int curFrame, int nextFrame, int num_joints, float interp)
        {
            for (int i = 0; i < num_joints; ++i)
            {
                /* Copy parent index */
                skeleton[i].parent = skel[curFrame, i].parent;

                /* Linear interpolation for Position */
                skeleton[i].pos.X = skel[curFrame, i].pos.X + interp * (skel[nextFrame, i].pos.X - skel[curFrame, i].pos.X);
                skeleton[i].pos.Y = skel[curFrame, i].pos.Y + interp * (skel[nextFrame, i].pos.Y - skel[curFrame, i].pos.Y);
                skeleton[i].pos.Z = skel[curFrame, i].pos.Z + interp * (skel[nextFrame, i].pos.Z - skel[curFrame, i].pos.Z);

                /* Spherical linear interpolation for orientation */
                skeleton[i].orient = QuaternionExt.Slerp(skel[curFrame, i].orient, skel[nextFrame, i].orient, interp);
            }
        }