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

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