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.

Room.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*!
  2. * \file include/Room.h
  3. * \brief World Room Mesh
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _ROOM_H_
  8. #define _ROOM_H_
  9. #include <vector>
  10. #include <memory>
  11. #include "math/math.h"
  12. #include "math/Matrix.h"
  13. #include "Mesh.h"
  14. #include "Sprite.h"
  15. #include "TombRaider.h"
  16. #include "RoomData.h"
  17. typedef enum {
  18. RoomFlagUnderWater = (1 << 0)
  19. } RoomFlags;
  20. class Room {
  21. public:
  22. Room(TombRaider &tr, unsigned int index);
  23. ~Room();
  24. void setFlags(unsigned int f);
  25. unsigned int getFlags();
  26. unsigned int getNumXSectors();
  27. unsigned int getNumZSectors();
  28. void getPos(vec3_t p);
  29. void getBoundingBox(vec3_t box[2]);
  30. bool inBox(vec_t x, vec_t y, vec_t z);
  31. bool inBoxPlane(vec_t x, vec_t z);
  32. unsigned int sizeAdjacentRooms();
  33. int getAdjacentRoom(unsigned int index);
  34. unsigned int sizePortals();
  35. Portal &getPortal(unsigned int index);
  36. unsigned int sizeSectors();
  37. Sector &getSector(unsigned int index);
  38. unsigned int sizeBox();
  39. Box &getBox(unsigned int index);
  40. unsigned int sizeModels();
  41. StaticModel &getModel(unsigned int index);
  42. void sortModels();
  43. unsigned int sizeLights();
  44. Light &getLight(unsigned int index);
  45. unsigned int sizeSprites();
  46. Sprite &getSprite(unsigned int index);
  47. Mesh &getMesh();
  48. private:
  49. unsigned int flags;
  50. unsigned int numXSectors;
  51. unsigned int numZSectors;
  52. vec3_t pos;
  53. vec3_t bbox[2];
  54. Mesh mesh;
  55. std::vector<int> adjacentRooms;
  56. std::vector<Sprite *> sprites;
  57. std::vector<StaticModel *> models;
  58. std::vector<Portal *> portals;
  59. std::vector<Box *> boxes;
  60. std::vector<Sector *> sectors;
  61. std::vector<Light *> lights;
  62. // Was used for "depth sorting" render list, but never assigned...?!
  63. //vec_t dist; // Distance to near plane, move to room?
  64. };
  65. #endif