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

WorldData.h 3.4KB

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