Ejemplo n.º 1
0
        /// <summary>
        /// Try to get all root joints.
        /// </summary>
        public static List <SJoint> GetRootJoints(SkinnedMesh mesh)
        {
            List <SJoint> roots = new List <SJoint>();

            List <SJoint> allJoints = mesh.GetAllJoints();

            for (int i = 0; i < allJoints.Count; i++)
            {
                bool   isRoot      = true;
                SJoint testedJoint = allJoints[i];
                for (int j = 0; j < allJoints.Count; j++)
                {
                    SJoint testedJoint2 = allJoints[j];
                    for (int k = 0; k < testedJoint2.Children.Count; k++)
                    {
                        if (testedJoint.Equals(testedJoint2.Children[k]))
                        {
                            isRoot = false;
                        }
                    }
                }
                if (isRoot)
                {
                    roots.Add(testedJoint);
                }
            }

            return(roots);
        }