Skeleton.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef ANKI_RESOURCE_SKELETON_H
  2. #define ANKI_RESOURCE_SKELETON_H
  3. #include "anki/Math.h"
  4. #include "anki/util/Vector.h"
  5. namespace anki {
  6. /// Skeleton bone
  7. struct Bone
  8. {
  9. friend class Skeleton; ///< For loading
  10. public:
  11. /// @name Accessors
  12. /// @{
  13. const std::string& getName() const
  14. {
  15. return name;
  16. }
  17. const Mat4& getTransform() const
  18. {
  19. return transform;
  20. }
  21. /// @}
  22. private:
  23. std::string name; ///< The name of the bone
  24. static const U32 MAX_CHILDS_PER_BONE = 4; ///< Please dont change this
  25. // see the class notes
  26. Mat4 transform;
  27. };
  28. /// It contains the bones with their position and hierarchy
  29. ///
  30. /// XML file format:
  31. ///
  32. /// @code
  33. /// <skeleton>
  34. /// <bones>
  35. /// <bone>
  36. /// <name>X</name>
  37. /// <transform></transform>
  38. /// <bone>
  39. /// ...
  40. /// </bones>
  41. /// </skeleton>
  42. /// @endcode
  43. class Skeleton
  44. {
  45. public:
  46. /// Load file
  47. void load(const char* filename);
  48. /// @name Accessors
  49. /// @{
  50. const Vector<Bone>& getBones() const
  51. {
  52. return bones;
  53. }
  54. /// @}
  55. private:
  56. Vector<Bone> bones;
  57. };
  58. } // end namespace
  59. #endif