예제 #1
0
 private void QueueBones(SBBone Bone, List <SBBone> Bones)
 {
     Bones.Add(Bone);
     foreach (var child in Bone.Children)
     {
         QueueBones(child, Bones);
     }
 }
예제 #2
0
 /// <summary>
 /// Removes a child node from the skeleton
 /// </summary>
 /// <param name="child"></param>
 public void RemoveChild(SBBone child)
 {
     if (_children.Contains(child))
     {
         child.Parent = null;
         _children.Remove(child);
     }
 }
예제 #3
0
        public int IndexOfBone(SBBone bone)
        {
            int index = 0;

            foreach (var b in Bones)
            {
                if (b == bone)
                {
                    return(index);
                }
                index++;
            }
            return(-1);
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="skeleton"></param>
        /// <returns></returns>
        public static SBSkeleton FromIOSkeleton(IOSkeleton ioskel)
        {
            SBSkeleton skel = new SBSkeleton();

            Dictionary <IOBone, SBBone> iotosb = new Dictionary <IOBone, SBBone>();

            foreach (var iobone in ioskel.BreathFirstOrder())
            {
                SBConsole.WriteLine(iobone.Name + " " + iobone.Scale + " " + iobone.Rotation + " " + iobone.Translation);
                SBBone bone = new SBBone()
                {
                    Name = iobone.Name,
                    SX   = iobone.ScaleX,
                    SY   = iobone.ScaleY,
                    SZ   = iobone.ScaleZ,
                    RX   = iobone.RotationEuler.X,
                    RY   = iobone.RotationEuler.Y,
                    RZ   = iobone.RotationEuler.Z,
                    X    = iobone.TranslationX,
                    Y    = iobone.TranslationY,
                    Z    = iobone.TranslationZ,
                };

                SBConsole.WriteLine(bone.Name + " " + bone.Translation.ToString() + " " + bone.Scale.ToString() + " " + bone.RotationQuaternion.ToString());

                iotosb.Add(iobone, bone);

                if (iobone.Parent == null)
                {
                    skel.AddRoot(bone);
                }
                else
                {
                    bone.Parent = iotosb[iobone.Parent];
                }
            }

            return(skel);
        }
예제 #5
0
 public void AddRoot(SBBone bone)
 {
     RootBones.Add(bone);
 }
예제 #6
0
 /// <summary>
 /// Adds a child node to the skeleton
 /// </summary>
 /// <param name="child"></param>
 public void AddChild(SBBone child)
 {
     _children.Add(child);
 }