Exemple #1
0
        public IRenderable GetRenderableNode()
        {
            if (skel == null)
            {
                return(null);
            }

            if (skeleton == null)
            {
                skeleton = new RSkeleton();

                for (int i = 0; i < skel.BoneEntries.Length; i++)
                {
                    RBone bone = new RBone
                    {
                        Name              = skel.BoneEntries[i].Name,
                        Id                = skel.BoneEntries[i].Id,
                        ParentId          = skel.BoneEntries[i].ParentId,
                        Transform         = SkelToTkMatrix(skel.Transform[i]),
                        InvTransform      = SkelToTkMatrix(skel.InvTransform[i]),
                        WorldTransform    = SkelToTkMatrix(skel.WorldTransform[i]),
                        InvWorldTransform = SkelToTkMatrix(skel.InvWorldTransform[i])
                    };
                    skeleton.Bones.Add(bone);
                }
            }

            skeleton.Reset();

            return(skeleton);
        }
Exemple #2
0
        public IRenderable GetRenderableNode()
        {
            if (_skel == null)
            {
                return(null);
            }

            if (Skeleton == null)
            {
                Skeleton = new RSkeleton();

                for (int i = 0; i < _skel.BoneEntries.Length; i++)
                {
                    RBone Bone = new RBone();
                    Bone.Name              = _skel.BoneEntries[i].Name;
                    Bone.ID                = _skel.BoneEntries[i].ID;
                    Bone.ParentID          = _skel.BoneEntries[i].ParentID;
                    Bone.Transform         = Skel_to_TKMatrix(_skel.Transform[i]);
                    Bone.InvTransform      = Skel_to_TKMatrix(_skel.InvTransform[i]);
                    Bone.WorldTransform    = Skel_to_TKMatrix(_skel.WorldTransform[i]);
                    Bone.InvWorldTransform = Skel_to_TKMatrix(_skel.InvWorldTransform[i]);
                    Skeleton.Bones.Add(Bone);
                }
            }

            Skeleton.Reset();

            return(Skeleton);
        }
        public static RSkeleton CreateRSkeleton(Skel skel)
        {
            if (skel == null)
            {
                return(null);
            }

            var skeleton = new RSkeleton();

            for (int i = 0; i < skel.BoneEntries.Length; i++)
            {
                RBone bone = new RBone
                {
                    Name              = skel.BoneEntries[i].Name,
                    Id                = skel.BoneEntries[i].Id,
                    ParentId          = skel.BoneEntries[i].ParentId,
                    Transform         = skel.Transform[i].ToOpenTK(),
                    InvTransform      = skel.InvTransform[i].ToOpenTK(),
                    WorldTransform    = skel.WorldTransform[i].ToOpenTK(),
                    InvWorldTransform = skel.InvWorldTransform[i].ToOpenTK()
                };
                skeleton.Bones.Add(bone);
            }

            skeleton.Reset();

            return(skeleton);
        }
Exemple #4
0
 public static void QueueBones(RBone b, Queue <RBone> q, RSkeleton Skeleton)
 {
     q.Enqueue(b);
     foreach (RBone c in GetChildren(b, Skeleton))
     {
         QueueBones(c, q, Skeleton);
     }
 }
Exemple #5
0
        public static List <RBone> GetChildren(RBone bone, RSkeleton Skeleton)
        {
            List <RBone> children = new List <RBone>();

            foreach (RBone b in Skeleton.Bones)
            {
                if (b.ParentID == bone.ID)
                {
                    children.Add(b);
                }
            }
            return(children);
        }