2
0

SkinningData.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #endregion
  13. namespace SkinnedModel
  14. {
  15. /// <summary>
  16. /// Combines all the data needed to render and animate a skinned object.
  17. /// This is typically stored in the Tag property of the Model being animated.
  18. /// </summary>
  19. public class SkinningData
  20. {
  21. #region Fields
  22. IDictionary<string, AnimationClip> animationClipsValue;
  23. IList<Matrix> bindPoseValue;
  24. IList<Matrix> inverseBindPoseValue;
  25. IList<int> skeletonHierarchyValue;
  26. #endregion
  27. /// <summary>
  28. /// Constructs a new skinning data object.
  29. /// </summary>
  30. public SkinningData(IDictionary<string, AnimationClip> animationClips,
  31. IList<Matrix> bindPose, IList<Matrix> inverseBindPose,
  32. IList<int> skeletonHierarchy)
  33. {
  34. animationClipsValue = animationClips;
  35. bindPoseValue = bindPose;
  36. inverseBindPoseValue = inverseBindPose;
  37. skeletonHierarchyValue = skeletonHierarchy;
  38. }
  39. /// <summary>
  40. /// Gets a collection of animation clips. These are stored by name in a
  41. /// dictionary, so there could for instance be clips for "Walk", "Run",
  42. /// "JumpReallyHigh", etc.
  43. /// </summary>
  44. public IDictionary<string, AnimationClip> AnimationClips
  45. {
  46. get { return animationClipsValue; }
  47. }
  48. /// <summary>
  49. /// Bindpose matrices for each bone in the skeleton,
  50. /// relative to the parent bone.
  51. /// </summary>
  52. public IList<Matrix> BindPose
  53. {
  54. get { return bindPoseValue; }
  55. }
  56. /// <summary>
  57. /// Vertex to bonespace transforms for each bone in the skeleton.
  58. /// </summary>
  59. public IList<Matrix> InverseBindPose
  60. {
  61. get { return inverseBindPoseValue; }
  62. }
  63. /// <summary>
  64. /// For each bone in the skeleton, stores the index of the parent bone.
  65. /// </summary>
  66. public IList<int> SkeletonHierarchy
  67. {
  68. get { return skeletonHierarchyValue; }
  69. }
  70. }
  71. }