public AvatarBoneAnimation(AvatarSkeleton skeleton, BoneAnimationClip animationClip) : base(skeleton, new AvatarAnimationController(skeleton.Renderer, animationClip)) { Skeleton = skeleton; animationBoneTransforms = new Matrix[AvatarRenderer.BoneCount]; readOnlyAnimationBoneTransforms = new ReadOnlyCollection <Matrix>(animationBoneTransforms); }
/// <summary> /// Initializes a new instance of the <see cref="BoneAnimationController"/> class. /// </summary> public BoneAnimationController(BoneAnimationClip animationClip) { if (animationClip == null) { throw new ArgumentNullException("animationClip"); } this.AnimationClip = animationClip; this.Ending = animationClip.PreferredEnding; this.InterpolationEnabled = false; this.FramesPerSecond = animationClip.FramesPerSecond; this.TotalFrames = animationClip.TotalFrames; }
public AvatarAnimationController(AvatarRenderer renderer, BoneAnimationClip clip) { if (clip.Transforms.Length != AvatarRenderer.BoneCount) { throw new ArgumentException("The input animation clip is not a valid avatar animation."); } Renderer = renderer; Loop = true; boneAnimationController = new BoneAnimationController(clip); boneAnimationController.Completed += (sender, e) => { OnCompleted(); Stop(); }; boneAnimationController.Play(); }
/// <summary> /// Initializes a new instance of the <see cref="BoneAnimationController"/> class. /// </summary> public BoneAnimationController(BoneAnimationClip animationClip, int beginFrame, int count) : this(animationClip) { base.BeginFrame = beginFrame; base.EndFrame = beginFrame + count; }
/// <summary> /// Initializes a new instance of the <see cref="BoneAnimation"/> class. /// </summary> public BoneAnimation(Skeleton skeleton, BoneAnimationClip animation) : this(skeleton, new BoneAnimationController(animation)) { }