RootAnimationPlayer.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // RootAnimationPlayer.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using Microsoft.Xna.Framework;
  13. #endregion
  14. namespace CustomModelAnimation
  15. {
  16. /// <summary>
  17. /// The animation player contains a single transformation that is used to move/position/scale
  18. /// something.
  19. /// </summary>
  20. public class RootAnimationPlayer : ModelAnimationPlayerBase
  21. {
  22. Matrix currentTransform;
  23. /// <summary>
  24. /// Initializes the transformation to the identity
  25. /// </summary>
  26. protected override void InitClip()
  27. {
  28. this.currentTransform = Matrix.Identity;
  29. }
  30. /// <summary>
  31. /// Sets the key frame by storing the current transform
  32. /// </summary>
  33. /// <param name="keyframe"></param>
  34. protected override void SetKeyframe(ModelKeyframe keyframe)
  35. {
  36. this.currentTransform = keyframe.Transform;
  37. }
  38. /// <summary>
  39. /// Gets the current transformation being applied
  40. /// </summary>
  41. /// <returns>Transformation matrix</returns>
  42. public Matrix GetCurrentTransform()
  43. {
  44. return this.currentTransform;
  45. }
  46. }
  47. }