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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. * \todo Start cutting off old hacks by simple force use of method interface.
  9. * Also move the publicly exposed attributes out =)
  10. * Better animation system in general - this is memory wasteful
  11. */
  12. #ifndef _SKELETALMODEL_H_
  13. #define _SKELETALMODEL_H_
  14. #include <vector>
  15. #include "math/math.h"
  16. typedef struct {
  17. int mesh;
  18. vec3_t off;
  19. vec3_t rot;
  20. char flag;
  21. } bone_tag_t;
  22. typedef struct {
  23. std::vector<bone_tag_t *> tag;
  24. vec3_t pos;
  25. float yaw;
  26. } bone_frame_t;
  27. typedef struct {
  28. int id;
  29. char rate;
  30. std::vector<bone_frame_t *> frame;
  31. } animation_frame_t;
  32. typedef struct {
  33. int id;
  34. bool tr4Overlay;
  35. bool pigtails;
  36. int ponytailId;
  37. vec3_t ponytail;
  38. int ponytailMeshId;
  39. unsigned int ponytailNumMeshes;
  40. float ponytailAngle;
  41. float ponyOff;
  42. float ponyOff2;
  43. std::vector<animation_frame_t *> animation;
  44. } skeletal_model_t;
  45. /*!
  46. * \brief This is the factored out skeletal model class
  47. */
  48. class SkeletalModel {
  49. public:
  50. /*!
  51. * \brief Constructs an object of SkeletalModel
  52. */
  53. SkeletalModel();
  54. /*!
  55. * \brief Deconstructs an object of SkeletalModel
  56. */
  57. ~SkeletalModel();
  58. int getAnimation();
  59. int getFrame();
  60. int getIdleAnimation();
  61. void setModel(skeletal_model_t *mdl);
  62. void setAnimation(int index);
  63. void setFrame(int index);
  64. void setIdleAnimation(int index);
  65. unsigned int flags;
  66. skeletal_model_t *model; //!< World render model
  67. float time; //!< Interpolation use
  68. float lastTime;
  69. float rate; //!< \fixme temp cache this here for old animation system use
  70. private:
  71. int mBoneFrame; //!< Bone frame
  72. int mAnimationFrame; //!< Animation frame
  73. int mIdleAnimation; //!< Idle animation
  74. };
  75. #endif