#ifndef ANIMATION_H #define ANIMATION_H #include #include "render_shared.h" #define INVALID_ANIMATION_HANDLE -1 // Animation types typedef /*int16_t*/ int AnimationId_t; class Model; /* Joint */ struct Joint { char name[64]; int parentId; glm::vec3 origin; glm::quat orient; }; /* Animation */ struct Animation { char name[64]; uint32_t numPoses; uint32_t numFrames; float framerate; std::vector< glm::vec3 > origin; std::vector< glm::quat > orient; }; /* Skeleton */ class SkeletonInstance { public: Model* m_model; std::vector m_joints; std::vector m_jointMatrices; std::vector m_finalMatrices; AnimationId_t m_animation; float m_time; float m_speed; bool m_looped; public: SkeletonInstance(); ~SkeletonInstance(); bool IsValid(); void LoadAnimation(const char* filename); AnimationId_t FindAnimation(const char* name); uint32_t GetNumAnimations(); float GetAnimationTime(AnimationId_t id); void PlayAnimation(AnimationId_t id, bool looped); void StopAnimation(); void SetAnimationSpeed(float speed); AnimationId_t GetCurrentAnimation(); float GetCurrentTime(); }; #endif // !ANIMATION_H