#ifndef __BONE_ANIMATION_SEQUENCE_H__
#define __BONE_ANIMATION_SEQUENCE_H__

typedef struct BoneAnimationSequence BoneAnimationSequence;

#include <stdlib.h>

#include "3dmath/Quaternion.h"
#include "3dmath/Vector.h"
#include "utilities/Atom.h"

struct Skeleton;

struct BoneAnimationSequence_keyframe {
	float duration;
	size_t numberOfBones;
	struct BoneAnimationSequence_keyframe_boneTransform {
		Atom boneID;
		Quaternion orientation;
		Vector3 offset;
	} * boneTransforms;
};

#define BoneAnimationSequence_structContents \
	Atom name; \
	struct Skeleton * skeleton; \
	size_t numberOfKeyframes; \
	struct BoneAnimationSequence_keyframe * keyframes; \
	\
	void (* dispose)(void * self); \
	float (* getDuration)(void * self); \
	int (* keyframeIndexForTime)(void * self, float time); \
	float (* timeForKeyframeIndex)(void * self, unsigned int keyframeIndex);

struct BoneAnimationSequence {
	BoneAnimationSequence_structContents
};

BoneAnimationSequence * BoneAnimationSequence_create(Atom name, struct Skeleton * skeleton);
void BoneAnimationSequence_init(BoneAnimationSequence * self, Atom name, struct Skeleton * skeleton);

void BoneAnimationSequence_dispose(void * selfPtr);
float BoneAnimationSequence_getDuration(void * selfPtr);
int BoneAnimationSequence_keyframeIndexForTime(void * selfPtr, float time);
float BoneAnimationSequence_timeForKeyframeIndex(void * selfPtr, unsigned int keyframeIndex);

#endif
