Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

SkeletalModel.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*!
  2. * \file include/SkeletalModel.h
  3. * \brief This is the factored out skeletal model class
  4. *
  5. * Defining UNIT_TEST_SKELETALMODEL builds SkeletalModel class as a console unit test
  6. *
  7. * \author Mongoose
  8. *
  9. * \todo Start cutting off old hacks by simple force use of method interface.
  10. * Also move the publicly exposed attributes out =)
  11. * Better animation system in general - this is memory wasteful
  12. */
  13. #ifndef _SKELETALMODEL_H_
  14. #define _SKELETALMODEL_H_
  15. #include <Vector.h>
  16. #include <MatMath.h>
  17. typedef struct bone_tag_s
  18. {
  19. int mesh;
  20. vec3_t off;
  21. vec3_t rot;
  22. char flag;
  23. } bone_tag_t;
  24. typedef struct bone_frame_s
  25. {
  26. Vector<bone_tag_t *> tag;
  27. vec3_t pos;
  28. float yaw;
  29. } bone_frame_t;
  30. typedef struct animation_frame_s
  31. {
  32. int id;
  33. char rate;
  34. Vector<bone_frame_t *> frame;
  35. } animation_frame_t;
  36. typedef struct skeletal_model_s
  37. {
  38. int id;
  39. bool tr4Overlay;
  40. bool pigtails;
  41. int ponytailId;
  42. vec3_t ponytail;
  43. int ponytailMeshId;
  44. unsigned int ponytailNumMeshes;
  45. float ponytailAngle;
  46. float ponyOff;
  47. float ponyOff2;
  48. Vector<animation_frame_t *> animation;
  49. } skeletal_model_t;
  50. class SkeletalModel
  51. {
  52. public:
  53. ////////////////////////////////////////////////////////////
  54. // Constructors
  55. ////////////////////////////////////////////////////////////
  56. SkeletalModel();
  57. /*------------------------------------------------------
  58. * Pre :
  59. * Post : Constructs an object of SkeletalModel
  60. *
  61. *-- History ------------------------------------------
  62. *
  63. * 2003.05.19:
  64. * Mongoose - Created
  65. ------------------------------------------------------*/
  66. ~SkeletalModel();
  67. /*------------------------------------------------------
  68. * Pre : SkeletalModel object is allocated
  69. * Post : Deconstructs an object of SkeletalModel
  70. *
  71. *-- History ------------------------------------------
  72. *
  73. * 2003.05.19:
  74. * Mongoose - Created
  75. ------------------------------------------------------*/
  76. ////////////////////////////////////////////////////////////
  77. // Public Accessors
  78. ////////////////////////////////////////////////////////////
  79. int getAnimation();
  80. int getFrame() ;
  81. int getIdleAnimation();
  82. ////////////////////////////////////////////////////////////
  83. // Public Mutators
  84. ////////////////////////////////////////////////////////////
  85. void setModel(skeletal_model_t *mdl);
  86. void setAnimation(int index);
  87. void setFrame(int index);
  88. void setIdleAnimation(int index);
  89. enum SkeletalModelFlag { fReserved = 1 };
  90. unsigned int flags;
  91. skeletal_model_t *model; /* World render model */
  92. float time; /* Interpolation use */
  93. float lastTime;
  94. float rate; // temp cache this here for old animation system use
  95. private:
  96. ////////////////////////////////////////////////////////////
  97. // Private Accessors
  98. ////////////////////////////////////////////////////////////
  99. ////////////////////////////////////////////////////////////
  100. // Private Mutators
  101. ////////////////////////////////////////////////////////////
  102. int mBoneFrame; /* Bone frame */
  103. int mAnimationFrame; /* Animation frame */
  104. int mIdleAnimation; /* Idle animation */
  105. };
  106. #endif