Exemplo n.º 1
0
        public void Transform(TPONode node)
        {
            for (int i = 0; i < tmo.frames.Length; i++)
            {
                TMOMat mat = tmo.GetTMOMat(node.name, i);

                Matrix  m       = mat.m;
                Vector3 scaling = Vector3.Empty;
                Vector3 t       = TMOMat.DecomposeMatrix(ref m, out scaling);

                scaling.X *= (float)Math.Pow(node.Scaling.X, ratio);
                scaling.Y *= (float)Math.Pow(node.Scaling.Y, ratio);
                scaling.Z *= (float)Math.Pow(node.Scaling.Z, ratio);
                m         *= node.RotationMatrix(m, ratio);
                t         += node.Translation * ratio;

                mat.m = Matrix.Scaling(scaling) * m * Matrix.Translation(t);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 指定番号のフレームに含まれるモーション行列値を変形します。
        /// </summary>
        /// <param name="frame_index">フレーム番号</param>
        public void Transform(int frame_index)
        {
            if (ratio == 0)
            {
                return;
            }

            if (tmo.frames == null)
            {
                return;
            }

            TMOFrame frame = tmo.frames[frame_index];

            Debug.Assert(frame.matrices.Length == nodes.Length);
            for (int j = 0; j < frame.matrices.Length; j++)
            {
                TPONode node = nodes[j];
                TMOMat  mat  = frame.matrices[j];
                node.Transform(mat, ratio);
            }
        }