aiAnim.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /** @file Defines the data structures in which the imported animations are returned. */
  2. #ifndef AI_ANIM_H_INC
  3. #define AI_ANIM_H_INC
  4. #include "aiTypes.h"
  5. #include "aiQuaternion.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. /** A time-value pair specifying a certain 3D vector for the given time. */
  10. struct aiVectorKey
  11. {
  12. double mTime; ///< The time of this key
  13. aiVector3D_t mValue; ///< The value of this key
  14. };
  15. /** A time-value pair specifying a rotation for the given time. For joint animations
  16. * the rotation is usually expressed using a quaternion.
  17. */
  18. struct aiQuatKey
  19. {
  20. double mTime; ///< The time of this key
  21. aiQuaternion_t mValue; ///< The value of this key
  22. };
  23. /** Describes the animation of a single bone. The name specifies the bone which is affected by this
  24. * animation channel. The keyframes are given in three separate series of values, one each for
  25. * position, rotation and scaling.
  26. */
  27. struct aiBoneAnim
  28. {
  29. /** The name of the bone affected by this animation. */
  30. aiString mBoneName;
  31. /** The number of position keys */
  32. unsigned int mNumPositionKeys;
  33. /** The position keys of this animation channel. Positions are specified as 3D vector.
  34. * The array is mNumPositionKeys in size.
  35. */
  36. aiVectorKey* mPositionKeys;
  37. /** The number of rotation keys */
  38. unsigned int mNumRotationKeys;
  39. /** The rotation keys of this animation channel. Rotations are given as quaternions,
  40. * which are 4D vectors. The array is mNumRotationKeys in size.
  41. */
  42. aiQuatKey* mRotationKeys;
  43. /** The number of scaling keys */
  44. unsigned int mNumScalingKeys;
  45. /** The scaling keys of this animation channel. Scalings are specified as 3D vector.
  46. * The array is mNumScalingKeys in size.
  47. */
  48. aiVectorKey* mScalingKeys;
  49. #ifdef __cplusplus
  50. aiBoneAnim()
  51. {
  52. mNumPositionKeys = 0; mPositionKeys = NULL;
  53. mNumRotationKeys= 0; mRotationKeys = NULL;
  54. mNumScalingKeys = 0; mScalingKeys = NULL;
  55. }
  56. ~aiBoneAnim()
  57. {
  58. delete [] mPositionKeys;
  59. delete [] mRotationKeys;
  60. delete [] mScalingKeys;
  61. }
  62. #endif // __cplusplus
  63. };
  64. /** An animation consists of keyframe data for a number of bones. For each bone affected by the animation
  65. * a separate series of data is given.
  66. */
  67. struct aiAnimation
  68. {
  69. /** The name of the animation. If the modelling package this data was exported from does support
  70. * only a single animation channel, this name is usually empty (length is zero).
  71. */
  72. aiString mName;
  73. /** Duration of the animation in ticks. */
  74. double mDuration;
  75. /** Ticks per second. 0 if not specified in the imported file */
  76. double mTicksPerSecond;
  77. /** The number of bone animation channels. Each channel affects a single bone. */
  78. unsigned int mNumBones;
  79. /** The bone animation channels. Each channel affects a single bone. The array
  80. * is mNumBones in size.
  81. */
  82. aiBoneAnim** mBones;
  83. #ifdef __cplusplus
  84. aiAnimation()
  85. {
  86. mDuration = 0;
  87. mTicksPerSecond = 0;
  88. mNumBones = 0; mBones = NULL;
  89. }
  90. ~aiAnimation()
  91. {
  92. for( unsigned int a = 0; a < mNumBones; a++)
  93. delete mBones[a];
  94. delete [] mBones;
  95. }
  96. #endif // __cplusplus
  97. };
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif // AI_ANIM_H_INC