Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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