You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

240 lines
7.1 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2009, ASSIMP Development Team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the ASSIMP team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the ASSIMP Development Team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /**
  35. * The data structures which are used to store the imported animation data.
  36. */
  37. module assimp.animation;
  38. import assimp.math;
  39. import assimp.types;
  40. extern ( C ) {
  41. /**
  42. * A time-value pair specifying a certain 3D vector for the given time.
  43. */
  44. struct aiVectorKey {
  45. /**
  46. * The time of this key.
  47. */
  48. double mTime;
  49. /**
  50. * The value of this key.
  51. */
  52. aiVector3D mValue;
  53. }
  54. /**
  55. * A time-value pair specifying a rotation for the given time. For joint
  56. * animations, the rotation is usually expressed using a quaternion.
  57. */
  58. struct aiQuatKey {
  59. /**
  60. * The time of this key.
  61. */
  62. double mTime;
  63. /**
  64. * The value of this key.
  65. */
  66. aiQuaternion mValue;
  67. }
  68. /**
  69. * Defines how an animation channel behaves outside the defined time
  70. * range. This corresponds to <code>aiNodeAnim.mPreState</code> and
  71. * <code>aiNodeAnim.mPostState</code>.
  72. */
  73. enum aiAnimBehaviour : uint {
  74. /**
  75. * The value from the default node transformation is used.
  76. */
  77. DEFAULT = 0x0,
  78. /**
  79. * The nearest key value is used without interpolation.
  80. */
  81. CONSTANT = 0x1,
  82. /**
  83. * The value of the nearest two keys is linearly extrapolated for the
  84. * current time value.
  85. */
  86. LINEAR = 0x2,
  87. /**
  88. * The animation is repeated.
  89. *
  90. * If the animation key go from n to m and the current time is t, use the
  91. * value at (t-n) % (|m-n|).
  92. */
  93. REPEAT = 0x3
  94. }
  95. /**
  96. * Describes the animation of a single node.
  97. *
  98. * The name specifies the bone/node which is affected by this animation
  99. * channel. The keyframes are given in three separate series of values, one
  100. * each for position, rotation and scaling. The transformation matrix
  101. * computed from these values replaces the node's original transformation
  102. * matrix at a specific time. This means all keys are absolute and not
  103. * relative to the bone default pose.
  104. *
  105. * The order in which the transformations are applied is –
  106. * as usual – scaling, rotation, translation.
  107. *
  108. * Note: All keys are returned in their correct, chronological order.
  109. * Duplicate keys don't pass the validation step. Most likely there will
  110. * be no negative time values, but they are not forbidden (so
  111. * implementations need to cope with them!).
  112. */
  113. struct aiNodeAnim {
  114. /**
  115. * The name of the node affected by this animation. The node must exist
  116. * and it must be unique.
  117. */
  118. aiString mNodeName;
  119. /**
  120. * The number of position keys.
  121. */
  122. uint mNumPositionKeys;
  123. /**
  124. * The position keys of this animation channel. Positions are specified
  125. * as 3D vectors. The array is <code>mNumPositionKeys</code> in size.
  126. *
  127. * If there are position keys, there will also be at least one scaling
  128. * and one rotation key.
  129. */
  130. aiVectorKey* mPositionKeys;
  131. /**
  132. * The number of rotation keys.
  133. */
  134. uint mNumRotationKeys;
  135. /**
  136. * The rotation keys of this animation channel. Rotations are given as
  137. * quaternions. The array is <code>mNumRotationKeys</code> in size.
  138. *
  139. * If there are rotation keys, there will also be at least one scaling
  140. * and one position key.
  141. */
  142. aiQuatKey* mRotationKeys;
  143. /**
  144. * The number of scaling keys.
  145. */
  146. uint mNumScalingKeys;
  147. /**
  148. * The scaling keys of this animation channel. Scalings are specified as
  149. * 3D vectors. The array is <code>mNumScalingKeys</code> in size.
  150. *
  151. * If there are scaling keys, there will also be at least one position
  152. * and one rotation key.
  153. */
  154. aiVectorKey* mScalingKeys;
  155. /**
  156. * Defines how the animation behaves before the first key is encountered.
  157. *
  158. * The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
  159. * transformation matrix of the affected node is used).
  160. */
  161. aiAnimBehaviour mPreState;
  162. /**
  163. * Defines how the animation behaves after the last key was processed.
  164. *
  165. * The default value is <code>aiAnimBehaviour.DEFAULT</code> (the original
  166. * transformation matrix of the affected node is used).
  167. */
  168. aiAnimBehaviour mPostState;
  169. }
  170. /**
  171. * An animation consists of keyframe data for a number of nodes.
  172. *
  173. * For each node affected by the animation, a separate series of data is
  174. * given.
  175. */
  176. struct aiAnimation {
  177. /**
  178. * The name of the animation.
  179. *
  180. * If the modeling package this data was
  181. * exported from does support only a single animation channel, this
  182. * name is usually empty (length is zero).
  183. */
  184. aiString mName;
  185. /**
  186. * Duration of the animation in ticks.
  187. */
  188. double mDuration;
  189. /**
  190. * Ticks per second. 0 if not specified in the imported file.
  191. */
  192. double mTicksPerSecond;
  193. /**
  194. * The number of bone animation channels.
  195. *
  196. * Each channel affects a single node.
  197. */
  198. uint mNumChannels;
  199. /**
  200. * The node animation channels. The array is <code>mNumChannels</code>
  201. * in size.
  202. *
  203. * Each channel affects a single node.
  204. */
  205. aiNodeAnim** mChannels;
  206. }
  207. }