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.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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, float o[3], float r[3], char f);
  14. void display();
  15. void getOffset(float o[3]);
  16. void getRotation(float r[3]);
  17. char getFlag();
  18. private:
  19. int mesh;
  20. float off[3];
  21. float rot[3];
  22. char flag;
  23. };
  24. class BoneFrame {
  25. public:
  26. BoneFrame(float p[3]);
  27. ~BoneFrame();
  28. void getPosition(float p[3]);
  29. unsigned long size();
  30. BoneTag& get(unsigned long i);
  31. void add(BoneTag* t);
  32. private:
  33. float pos[3];
  34. std::vector<BoneTag*> tag;
  35. };
  36. class AnimationFrame {
  37. public:
  38. AnimationFrame(char r);
  39. ~AnimationFrame();
  40. unsigned long size();
  41. BoneFrame& get(unsigned long i);
  42. void add(BoneFrame* f);
  43. private:
  44. char rate;
  45. std::vector<BoneFrame*> frame;
  46. };
  47. class SkeletalModel {
  48. public:
  49. SkeletalModel(int i) : id(i) { }
  50. ~SkeletalModel();
  51. void display(glm::mat4 MVP, int aframe, int bframe);
  52. int getID() { return id; }
  53. unsigned long size();
  54. AnimationFrame& get(unsigned long i);
  55. void add(AnimationFrame* f);
  56. private:
  57. int id;
  58. std::vector<AnimationFrame*> animation;
  59. };
  60. #endif