Open Source Tomb Raider Engine
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SkeletalModel.h 1.9KB

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