Beispiel #1
0
 public BVHContent(string filecontent, Skeleton skl, RootMovement rootMovement)
     : this(new BVHContentString(filecontent, skl == null), skl,
            new List <RootMovement>()
 {
     rootMovement
 })
 {
 }
Beispiel #2
0
        /// <summary>
        /// Initialize BVH Content.
        /// </summary>
        /// <param name="bvh">A semi-processed BVHContent</param>
        public BVHContent(BVHContentString bvh, Skeleton skeleton, List <RootMovement> rootMovement)
        {
            #region Initialize skeleton.
            if (skeleton == null)
            {
                Skeleton      = new Skeleton();
                Skeleton.Root = new BVHNode(bvh.Root, this, -1);
            }
            else
            {
                this.Skeleton = skeleton;
            }
            #endregion

            #region Clean and set FrameTime
            this.FrameTime = float.Parse(StringProccesing.CleanUp(bvh.FrameTime));
            #endregion

            #region Organize bones ID by level
            organize_bones_id_by_level();
            #endregion

            #region Clean frames and insert to list of float arrays
            List <float[]> fFrames = string_to_fFloat(bvh.Frames);
            #endregion

            #region Delete root movement
            for (int i = 0; i < rootMovement.Count; i++)
            {
                RootMovement rm = rootMovement[i];

                if (rm == RootMovement.Delete)
                {
                    delete_root_movement(fFrames, false);
                }
                else if (rm == RootMovement.KeepOnlyY)
                {
                    delete_root_movement(fFrames, true);
                }
                else if (rm == RootMovement.ZeroRootXZ)
                {
                    center_by_root_xyz(fFrames);
                }
                else if (rm == RootMovement.SetYOfRootAsFirstFrame)
                {
                    set_y_of_root_as_first_frame(fFrames);
                }
            }
            #endregion

            #region Calculate matrices and their indices.
            MXI = new MatrixIndexer(fFrames, this);
            #endregion
        }