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 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : OpenRaider
  5. * Author : Terry 'Mongoose' Hendrix II
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object : SkeletalModel
  9. * License : No use w/o permission (C) 2003 Mongoose
  10. * Comments: This is the factored out skeletal model class
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- Test Defines -----------------------------------------------
  17. *
  18. * UNIT_TEST_SKELETALMODEL - Builds SkeletalModel class as a console unit test
  19. *
  20. *-- History ------------------------------------------------
  21. *
  22. * 2003.05.19:
  23. * Mongoose - Created
  24. ================================================================*/
  25. // TODO
  26. // Start cutting off old hacks by simple force use of method interface
  27. // Also move the publicly exposed attributes out =)
  28. // Better animation system in general - this is memory wasteful
  29. #ifndef GUARD__OPENRAIDER_MONGOOSE_SKELETALMODEL_H_
  30. #define GUARD__OPENRAIDER_MONGOOSE_SKELETALMODEL_H_
  31. #include "mstl/Vector.h"
  32. #include "hel/math.h"
  33. typedef struct bone_tag_s
  34. {
  35. int mesh;
  36. vec3_t off;
  37. vec3_t rot;
  38. char flag;
  39. } bone_tag_t;
  40. typedef struct bone_frame_s
  41. {
  42. Vector<bone_tag_t *> tag;
  43. vec3_t pos;
  44. float yaw;
  45. } bone_frame_t;
  46. typedef struct animation_frame_s
  47. {
  48. int id;
  49. char rate;
  50. Vector<bone_frame_t *> frame;
  51. } animation_frame_t;
  52. typedef struct skeletal_model_s
  53. {
  54. int id;
  55. bool tr4Overlay;
  56. bool pigtails;
  57. int ponytailId;
  58. vec3_t ponytail;
  59. int ponytailMeshId;
  60. unsigned int ponytailNumMeshes;
  61. float ponytailAngle;
  62. float ponyOff;
  63. float ponyOff2;
  64. Vector<animation_frame_t *> animation;
  65. } skeletal_model_t;
  66. class SkeletalModel
  67. {
  68. public:
  69. ////////////////////////////////////////////////////////////
  70. // Constructors
  71. ////////////////////////////////////////////////////////////
  72. SkeletalModel();
  73. /*------------------------------------------------------
  74. * Pre :
  75. * Post : Constructs an object of SkeletalModel
  76. *
  77. *-- History ------------------------------------------
  78. *
  79. * 2003.05.19:
  80. * Mongoose - Created
  81. ------------------------------------------------------*/
  82. ~SkeletalModel();
  83. /*------------------------------------------------------
  84. * Pre : SkeletalModel object is allocated
  85. * Post : Deconstructs an object of SkeletalModel
  86. *
  87. *-- History ------------------------------------------
  88. *
  89. * 2003.05.19:
  90. * Mongoose - Created
  91. ------------------------------------------------------*/
  92. ////////////////////////////////////////////////////////////
  93. // Public Accessors
  94. ////////////////////////////////////////////////////////////
  95. int getAnimation();
  96. int getFrame() ;
  97. int getIdleAnimation();
  98. ////////////////////////////////////////////////////////////
  99. // Public Mutators
  100. ////////////////////////////////////////////////////////////
  101. void setModel(skeletal_model_t *mdl);
  102. void setAnimation(int index);
  103. void setFrame(int index);
  104. void setIdleAnimation(int index);
  105. enum SkeletalModelFlag { fReserved = 1 };
  106. unsigned int flags;
  107. skeletal_model_t *model; /* World render model */
  108. float time; /* Interpolation use */
  109. float lastTime;
  110. float rate; // temp cache this here for old animation system use
  111. private:
  112. ////////////////////////////////////////////////////////////
  113. // Private Accessors
  114. ////////////////////////////////////////////////////////////
  115. ////////////////////////////////////////////////////////////
  116. // Private Mutators
  117. ////////////////////////////////////////////////////////////
  118. int mBoneFrame; /* Bone frame */
  119. int mAnimationFrame; /* Animation frame */
  120. int mIdleAnimation; /* Idle animation */
  121. };
  122. #endif