SkinningData.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // SkinningData.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.Collections.Generic;
  11. using Microsoft.Xna.Framework;
  12. using Microsoft.Xna.Framework.Content;
  13. #endregion
  14. namespace SkinnedModel
  15. {
  16. /// <summary>
  17. /// Combines all the data needed to render and animate a skinned object.
  18. /// This is typically stored in the Tag property of the Model being animated.
  19. /// </summary>
  20. public class SkinningData
  21. {
  22. /// <summary>
  23. /// Constructs a new skinning data object.
  24. /// </summary>
  25. public SkinningData(Dictionary<string, AnimationClip> animationClips,
  26. List<Matrix> bindPose, List<Matrix> inverseBindPose,
  27. List<int> skeletonHierarchy)
  28. {
  29. AnimationClips = animationClips;
  30. BindPose = bindPose;
  31. InverseBindPose = inverseBindPose;
  32. SkeletonHierarchy = skeletonHierarchy;
  33. }
  34. /// <summary>
  35. /// Private constructor for use by the XNB deserializer.
  36. /// </summary>
  37. private SkinningData()
  38. {
  39. }
  40. /// <summary>
  41. /// Gets a collection of animation clips. These are stored by name in a
  42. /// dictionary, so there could for instance be clips for "Walk", "Run",
  43. /// "JumpReallyHigh", etc.
  44. /// </summary>
  45. [ContentSerializer]
  46. public Dictionary<string, AnimationClip> AnimationClips { get; private set; }
  47. /// <summary>
  48. /// Bindpose matrices for each bone in the skeleton,
  49. /// relative to the parent bone.
  50. /// </summary>
  51. [ContentSerializer]
  52. public List<Matrix> BindPose { get; private set; }
  53. /// <summary>
  54. /// Vertex to bonespace transforms for each bone in the skeleton.
  55. /// </summary>
  56. [ContentSerializer]
  57. public List<Matrix> InverseBindPose { get; private set; }
  58. /// <summary>
  59. /// For each bone in the skeleton, stores the index of the parent bone.
  60. /// </summary>
  61. [ContentSerializer]
  62. public List<int> SkeletonHierarchy { get; private set; }
  63. }
  64. }