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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*!
  2. * \file include/SkeletalModel.h
  3. * \brief Moveable Mesh Geometry
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _SKELETALMODEL_H_
  9. #define _SKELETALMODEL_H_
  10. #include <vector>
  11. #include "system/Shader.h"
  12. class BoneTag {
  13. public:
  14. BoneTag(int m, glm::vec3 o, glm::vec3 r, char f) : mesh(m), off(o), rot(r), flag(f) { }
  15. void display(glm::mat4 MVP, ShaderTexture* shaderTexture = nullptr);
  16. glm::vec3 getOffset() { return off; }
  17. glm::vec3 getRotation() { return rot; }
  18. char getFlag() { return flag; }
  19. private:
  20. int mesh;
  21. glm::vec3 off, rot;
  22. char flag;
  23. };
  24. class BoneFrame {
  25. public:
  26. explicit BoneFrame(glm::vec3 p) : pos(p) { }
  27. ~BoneFrame();
  28. glm::vec3 getPosition() { return pos; }
  29. unsigned long size();
  30. BoneTag& get(unsigned long i);
  31. void add(BoneTag* t);
  32. private:
  33. glm::vec3 pos;
  34. std::vector<BoneTag*> tag;
  35. };
  36. class AnimationFrame {
  37. public:
  38. explicit AnimationFrame(char r) : rate(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. explicit SkeletalModel(int i) : id(i) { }
  50. ~SkeletalModel();
  51. void display(glm::mat4 MVP, int aframe, int bframe, ShaderTexture* shaderTexture = nullptr);
  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