Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SkeletalModel.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*!
  2. * \file include/SkeletalModel.h
  3. * \brief This is the factored out skeletal model class
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _SKELETALMODEL_H_
  9. #define _SKELETALMODEL_H_
  10. #include <vector>
  11. class BoneTag {
  12. public:
  13. BoneTag(int m, glm::vec3 o, glm::vec3 r, char f) : mesh(m), off(o), rot(r), flag(f) { }
  14. void display(glm::mat4 MVP);
  15. glm::vec3 getOffset() { return off; }
  16. glm::vec3 getRotation() { return rot; }
  17. char getFlag() { return flag; }
  18. private:
  19. int mesh;
  20. glm::vec3 off, rot;
  21. char flag;
  22. };
  23. class BoneFrame {
  24. public:
  25. BoneFrame(glm::vec3 p) : pos(p) { }
  26. ~BoneFrame();
  27. glm::vec3 getPosition() { return pos; }
  28. unsigned long size();
  29. BoneTag& get(unsigned long i);
  30. void add(BoneTag* t);
  31. private:
  32. glm::vec3 pos;
  33. std::vector<BoneTag*> tag;
  34. };
  35. class AnimationFrame {
  36. public:
  37. AnimationFrame(char r) : rate(r) { }
  38. ~AnimationFrame();
  39. unsigned long size();
  40. BoneFrame& get(unsigned long i);
  41. void add(BoneFrame* f);
  42. private:
  43. char rate;
  44. std::vector<BoneFrame*> frame;
  45. };
  46. class SkeletalModel {
  47. public:
  48. SkeletalModel(int i) : id(i) { }
  49. ~SkeletalModel();
  50. void display(glm::mat4 MVP, int aframe, int bframe);
  51. int getID() { return id; }
  52. unsigned long size();
  53. AnimationFrame& get(unsigned long i);
  54. void add(AnimationFrame* f);
  55. private:
  56. int id;
  57. std::vector<AnimationFrame*> animation;
  58. };
  59. #endif