Ejemplo n.º 1
0
        private static PrettySkeletonPose CombineSkeletonPoses([NotNull, ItemNotNull] IEnumerable <PrettySkeletonPose> poses, [NotNull, ItemNotNull] IEnumerable <PrettySkeleton> skeletons)
        {
            var transformList = new List <RawTransform>();

            foreach (var(pose, skeleton) in EnumerableUtils.Zip(poses, skeletons))
            {
                var transforms = pose.Transforms;
                var ids        = skeleton.NodeIDs;

                Debug.Assert(transforms.Length == ids.Length);

                var len = transforms.Length;

                for (var i = 0; i < len; ++i)
                {
                    if (ids[i] == 0)
                    {
                        if (transformList.Count == 0)
                        {
                            transformList.Add(transforms[i]);
                        }
                    }
                    else
                    {
                        transformList.Add(transforms[i]);
                    }
                }
            }

            var result = new PrettySkeletonPose(transformList.ToArray());

            return(result);
        }
Ejemplo n.º 2
0
        public AvatarWrapper([NotNull] Avatar avatar)
        {
            Name               = avatar.m_Name;
            AvatarSkeleton     = new PrettySkeleton(avatar.m_Avatar.m_AvatarSkeleton);
            AvatarSkeletonPose = new PrettySkeletonPose(avatar.m_Avatar.m_AvatarSkeletonPose);

            {
                var map = new Dictionary <uint, string>();
                var tos = avatar.m_TOS;

                foreach (var kv in tos)
                {
                    map.Add(kv.Key, kv.Value);
                }

                BoneNamesMap = map;
            }
        }