#ifndef __canim_bi__
#define __canim_bi__

' Defines the data structures in which the imported animations

#include once "ctypes.bi"


' A time-value pair specifying a certain 3D vector for the given time.
type aiVectorKey
  ' The time of this key
  as double mTime
  ' The value of this key
  as aiVector3D mValue
end type


' A time-value pair specifying a rotation for the given time. 
' Rotations are expressed with quaternions.
type aiQuatKey
  ' The time of this key
  as double mTime
  ' The value of this key
  as aiQuaternion mValue
end type

' Binds a anim mesh to a specific point in time.
type aiMeshKey
  ' The time of this key
  as double mTime
  ' Index into the aiMesh::mAnimMeshes array of the mesh coresponding to the aiMeshAnim 
  ' hosting this key frame. The referenced anim mesh is evaluated  according to the 
  ' rules defined in the docs for #aiAnimMesh.*/
  as ulong mValue
end type

' Defines how an animation channel behaves outside the defined time range.
' This corresponds to aiNodeAnim::mPreState and aiNodeAnim::mPostState.
enum aiAnimBehaviour
  ' The value from the default node transformation is taken*/
  aiAnimBehaviour_DEFAULT =0
  ' The nearest key value is used without interpolation
  aiAnimBehaviour_CONSTANT
  ' The value of the nearest two keys is linearly extrapolated for the current time value.
  aiAnimBehaviour_LINEAR
  ' The animation is repeated.
  ' If the animation key go from n to m and the current time is t, use the value at (t-n) % (|m-n|).
  aiAnimBehaviour_REPEAT
end enum

' Describes the animation of a single node. 
' The name specifies the bone/node which is affected by this animation channel.
' The keyframes are given in three separate series of values, 
' one each for position, rotation and scaling. 
' The transformation matrix computed from these values replaces 
' the node's original transformation matrix at a specific time.
' This means all keys are absolute and not relative to the bone default pose.
' The order in which the transformations are applied is - as usual - scaling, rotation, translation.
' @note All keys are returned in their correct, chronological order.
' Duplicate keys don't pass the validation step.
' Most likely there  will be no negative time values, but they are not forbidden also 
' ( so implementations need to cope with them! )
type aiNodeAnim
  ' The name of the node affected by this animation.
  ' The node  must exist and it must be unique.
  as aiString mNodeName
  ' The number of position keys
  as ulong mNumPositionKeys
  ' The position keys of this animation channel.
  ' Positions are specified as 3D vector. The array is mNumPositionKeys in size.
  ' If there are position keys, there will also be at least one scaling and one rotation key.
  as aiVectorKey ptr mPositionKeys
  ' The number of rotation keys
  as ulong mNumRotationKeys
  ' The rotation keys of this animation channel.
  ' Rotations are given as quaternions, which are 4D vectors.
  ' The array is mNumRotationKeys in size.
  ' If there are rotation keys, there will also be at least one scaling and one position key.
  as aiQuatKey ptr mRotationKeys
  ' The number of scaling keys
  as ulong mNumScalingKeys
  ' The scaling keys of this animation channel.
  ' Scalings are specified as 3D vector. The array is mNumScalingKeys in size.
  ' If there are scaling keys, there will also be at least one position and one rotation key.
  as aiVectorKey ptr mScalingKeys
  ' Defines how the animation behaves before the first key is encountered.
  ' The default value is aiAnimBehaviour_DEFAULT (the original transformation matrix of the affected node is used).
  as aiAnimBehaviour mPreState
  ' Defines how the animation behaves after the last key was processed.
  ' The default value is aiAnimBehaviour_DEFAULT (the original transformation matrix of the affected node is taken).
  as aiAnimBehaviour mPostState
end type

' Describes vertex-based animations for a single mesh or a group of  meshes. 
' Meshes carry the animation data for each frame in their aiMesh::mAnimMeshes array. 
' The purpose of aiMeshAnim is to define keyframes linking each mesh attachment to a particular point in time.
type aiMeshAnim
  ' Name of the mesh to be animated.
  ' An empty string is not allowed, animated meshes need to be named
  ' (not necessarily uniquely, the name can basically serve as wildcard 
  ' to select a group  of meshes with similar animation setup)
  as aiString mName
  ' Size of the mKeys array. Must be 1, at least.
  as ulong mNumKeys
  ' Key frames of the animation. May not be NULL.
  as aiMeshKey ptr mKeys
end type

' An animation consists of keyframe data for a number of nodes.
' For each node affected by the animation a separate series of data is given.
type aiAnimation
  ' The name of the animation. 
  ' If the modeling package this data was exported from does support only a single 
  ' animation channel, this name is usually empty (length is zero).
  as aiString mName
  ' Duration of the animation in ticks.
  as double mDuration
  ' Ticks per second. 0 if not specified in the imported file
  as double mTicksPerSecond
  '  The number of bone animation channels. 
  ' Each channel affects  a single node.
  as ulong mNumChannels
  ' The node animation channels. Each channel affects a single node. 
  ' The array is mNumChannels in size.
  as aiNodeAnim ptr ptr mChannels
  ' The number of mesh animation channels. 
  ' Each channel affects a single mesh and defines vertex-based animation.
  as ulong mNumMeshChannels
  ' The mesh animation channels. Each channel affects a single mesh. 
  ' The array is mNumMeshChannels in size.
  as aiMeshAnim ptr ptr mMeshChannels
end type

#endif ' __canim_bi__
