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.

WorldData.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*!
  2. * \file include/WorldData.h
  3. * \brief Structs and enums for the game world (model)
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _WORLDDATA_H_
  9. #define _WORLDDATA_H_
  10. #include "math/math.h"
  11. #include "SkeletalModel.h"
  12. // Mirrors TombRaider class' room flags really
  13. typedef enum {
  14. roomFlag_underWater = 0x0001
  15. } room_flags_t;
  16. typedef enum {
  17. worldMoveType_walkNoSwim = -1,
  18. worldMoveType_walk = 0,
  19. worldMoveType_noClipping = 1,
  20. worldMoveType_fly = 2,
  21. worldMoveType_swim = 3
  22. } worldMoveType;
  23. typedef struct {
  24. vec3_t pos;
  25. } vertex_t;
  26. typedef struct {
  27. vec2_t st;
  28. } texel_t;
  29. typedef struct {
  30. int num_verts; //!< 4 == Quad, 3 == Triangle, rendered as triangles
  31. vertex_t vertex[4];
  32. texel_t texel[4];
  33. float pos[3];
  34. float radius; //!< \fixme yeah, I know (I don't? --xythobuz)
  35. int texture;
  36. } sprite_t;
  37. typedef struct {
  38. int num_sprites;
  39. sprite_t *sprite;
  40. } sprite_seq_t;
  41. /*! \fixme For now shaders are textures on tex objects
  42. * and materials on color objects. If -1
  43. * then it doesn't have that information yet.
  44. */
  45. typedef struct {
  46. int index[3];
  47. vec_t st[6];
  48. int texture;
  49. unsigned short transparency;
  50. } texture_tri_t;
  51. typedef struct {
  52. std::vector<texture_tri_t *> texturedTriangles;
  53. std::vector<texture_tri_t *> coloredTriangles;
  54. std::vector<texture_tri_t *> texturedRectangles;
  55. std::vector<texture_tri_t *> coloredRectangles;
  56. vec3_t center;
  57. float radius;
  58. unsigned int vertexCount;
  59. vec_t *vertices;
  60. unsigned int colorCount;
  61. vec_t *colors;
  62. unsigned int normalCount;
  63. vec_t *normals;
  64. } model_mesh_t;
  65. typedef struct entity_s {
  66. int id; //!< Unique identifier
  67. float pos[3]; //!< World position
  68. float angles[3]; //!< Euler angles (pitch, yaw, roll)
  69. int type; //!< {(0x00, item), (0x01, ai), (0x02, player)}
  70. int room; //!< Current room entity is in
  71. worldMoveType moveType; //!< Type of motion/clipping
  72. bool moving; //!< In motion?
  73. struct entity_s *master; //!< Part of entity chain?
  74. int state; //!< State of the Player, AI, or object
  75. int objectId; //!< What kind of entity?
  76. int modelId; //!< Animation model
  77. SkeletalModel *tmpHook;
  78. bool animate;
  79. /*
  80. float time, lastTime;
  81. int state, lastState;
  82. int event, lastEvent;
  83. int goal;
  84. */
  85. } entity_t;
  86. typedef struct {
  87. int index; //!< model_mesh index
  88. float yaw; //!< angle of rotation on Y
  89. float pos[3]; //!< position
  90. //vec3_t bboxMax;
  91. //vec3_t bboxMin;
  92. } static_model_t;
  93. typedef struct {
  94. float vertices[4][3];
  95. float normal[3];
  96. int adjoining_room;
  97. } portal_t;
  98. typedef struct {
  99. vertex_t a;
  100. vertex_t b;
  101. vertex_t c;
  102. vertex_t d;
  103. } box_t;
  104. typedef struct {
  105. vec_t floor;
  106. vec_t ceiling;
  107. bool wall;
  108. } sector_t;
  109. //! \fixme No room mesh list or sprites and etc
  110. typedef struct {
  111. std::vector<int> adjacentRooms;
  112. std::vector<portal_t *> portals;
  113. std::vector<static_model_t *> models;
  114. std::vector<sprite_t *> sprites;
  115. std::vector<box_t *> boxes;
  116. std::vector<sector_t *> sectors;
  117. int id;
  118. unsigned int flags;
  119. unsigned int numXSectors;
  120. unsigned int numZSectors;
  121. float pos[3];
  122. vec3_t bbox_min;
  123. vec3_t bbox_max;
  124. } room_mesh_t;
  125. #endif