AnimationFile.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef ANIMATION_FILE_H
  2. #define ANIMATION_FILE_H
  3. #include <Ogre.h>
  4. #include "common/File.h"
  5. #include "BsxFile.h"
  6. struct BonePosition
  7. {
  8. float rotation_x;
  9. float rotation_y;
  10. float rotation_z;
  11. float translation_x;
  12. float translation_y;
  13. float translation_z;
  14. };
  15. struct Frame
  16. {
  17. std::vector<BonePosition> bone;
  18. };
  19. class AnimationFile : public File
  20. {
  21. public:
  22. explicit AnimationFile(const Ogre::String& file);
  23. explicit AnimationFile(File* pFile);
  24. AnimationFile(File* pFile, const u32 offset, const u32 length);
  25. AnimationFile(u8* pBuffer, const u32 offset, const u32 length);
  26. virtual ~AnimationFile();
  27. void GetData( std::vector< s16 >& skeleton_length, const Unit& unit, const int offset_to_animations, const int number_of_animation, const int start_animation, Ogre::SkeletonPtr skeleton );
  28. private:
  29. struct AnimationHeader
  30. {
  31. u16 number_of_frames; // 00-01
  32. u16 number_of_bones; // 02
  33. u16 number_of_frames_translation; // 03
  34. u16 number_of_static_translation; // 04
  35. u16 number_of_frames_rotation; // 05
  36. u16 offset_to_frames_translation_data; // 06-07
  37. u16 offset_to_static_translation_data; // 08-09
  38. u16 offset_to_frames_rotation_data; // 0A-0B
  39. u32 offset_to_animation_data; // 0C-0F
  40. };
  41. typedef std::vector<AnimationHeader> AnimationHeaders;
  42. AnimationHeaders m_AnimationHeaders;
  43. };
  44. #endif // ANIMATION_FILE_H