public BVHActionPlayer(BVHAction defaultAction, Color color) { this.CurrentAction = this.DefaultAction = defaultAction; cylinder = new NCylinder(0.21f, 0.08f, 1, 6, color); bvh = S.bvhDic[CurrentAction.Bvhfile]; change_bvh(bvh, true); }
/// <summary> /// Load all bvh in the Content directory into bvh dictionary /// </summary> static BVHPlayer() { string[] dirs = Directory.GetDirectories(S.cm.RootDirectory + "\\Skeletons"); foreach (string d in dirs) { BVHContent b = load_all_bvh(d, null); if (b != null) { b.Skeleton.calc_cylinder_matrices(b); } } }
public void change_bvh(BVHContent content, bool runFrame) { if (bvh == null || absBoneMX == null || content.Skeleton != bvh.Skeleton) { absBoneMX = new Matrix[content.Skeleton.BoneCount]; } this.bvh = content; this.fFrame = 0; if (runFrame) { run_frame(); } }
/// <summary> /// Load all bvh from string array /// </summary> /// <param name="files">Files array.</param> /// <param name="skl">Skeleton to be used. (if null, a new one will be analyzed)</param> /// <returns>New Root value. (not changed unless Root was null)</returns> private static Skeleton load_bvh_from_array(string[] files, Skeleton skl) { #region Go over all files and analyze them. foreach (string f in files) { string newf = f.Replace("Content\\", string.Empty); if (newf.EndsWith(".bvh")) { List <RootMovement> rm; string key = newf.Substring(newf.LastIndexOf('\\') + 1).Replace(".bvh", string.Empty); if (ActionCollection.bvhToLoad.ContainsKey(key)) { rm = ActionCollection.bvhToLoad[key]; } else { rm = new List <RootMovement>(); rm.Add(RootMovement.KeepOnlyY); } BVHContent bvh; #region If Root is Null, analize new one and set it as Root. if (skl == null) { bvh = new BVHContent( StringProccesing.GetFileContents(newf), null, rm); skl = new Skeleton(bvh.Skeleton.Root, bvh.Skeleton.BoneChannels); } #endregion #region If Root is not Null, use it. else { bvh = new BVHContent( StringProccesing.GetFileContents(newf), skl, rm); } #endregion S.bvhDic.Add(key, bvh); } } #endregion return(skl); }
public BVHPlayer(BVHContent bvh, Color color) { cylinder = new NCylinder(0.21f, 0.08f, 1, 6, color); change_bvh(bvh, true); }