Exemple #1
0
        /// <summary>
        /// bone行列を更新します。
        /// </summary>
        protected void UpdateBoneMatrices(TMONode tmo_node, TMOFrame tmo_frame)
        {
            matrixStack.Push();

            if (tmo_frame != null)
            {
                // tmo animation
                tmo_node.TransformationMatrix = tmo_frame.matrices[tmo_node.Id].m;
            }
            Matrix m = tmo_node.TransformationMatrix;

            if (slider_matrix != null)
            {
                bool chichi_p = re_chichi.IsMatch(tmo_node.Name);

                if (chichi_p)
                {
                    slider_matrix.ScaleChichi(tmo_node, ref m);

                    if (slider_matrix.Flat())
                    {
                        if (clothed)
                        {
                            slider_matrix.TransformChichiFlatClothed(tmo_node, ref m);
                        }
                        else
                        {
                            slider_matrix.TransformChichiFlat(tmo_node, ref m);
                        }
                    }
                }
                else
                {
                    slider_matrix.TransformFace(tmo_node, ref m);
                }

                matrixStack.MultiplyMatrixLocal(m);
                m = matrixStack.Top;

                if (!chichi_p)
                {
                    slider_matrix.Scale(tmo_node, ref m);
                }
            }
            else
            {
                matrixStack.MultiplyMatrixLocal(m);
                m = matrixStack.Top;
            }

            tmo_node.combined_matrix = m;

            foreach (TMONode child_node in tmo_node.children)
            {
                UpdateBoneMatrices(child_node, tmo_frame);
            }

            matrixStack.Pop();
        }
Exemple #2
0
        /// <summary>
        /// bone行列を更新します。
        /// </summary>
        protected void UpdateBoneMatrices(TMONode tmo_node, TMOFrame tmo_frame)
        {
            if (tmo_frame != null)
            {
                // TMO animation
                tmo_node.TransformationMatrix = tmo_frame.matrices[tmo_node.ID].m;
            }
            Matrix m = tmo_node.TransformationMatrix;

            bool chichi_p = re_chichi.IsMatch(tmo_node.Name);

            if (chichi_p)
            {
                if (slider_matrix.Flat())
                {
                    slider_matrix.TransformChichiFlat(tmo_node, ref m);
                }
                else
                {
                    slider_matrix.TranslateChichi(ref m);
                }
            }
            else
            {
                // todo: face_p
                slider_matrix.TransformFace(tmo_node, ref m);
            }

            matrixStack.Push(m * matrixStack.Peek());
            m = matrixStack.Peek();

            if (chichi_p)
            {
                if (!slider_matrix.Flat())
                {
                    slider_matrix.ScaleChichi(ref m);
                }
            }
            else
            {
                // todo: scale1map
                slider_matrix.Scale(tmo_node, ref m);
            }

            tmo_node.combined_matrix = m;

            foreach (TMONode child_node in tmo_node.children)
            {
                UpdateBoneMatrices(child_node, tmo_frame);
            }

            matrixStack.Pop();
        }