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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*!
  2. * \file include/Room.h
  3. * \brief Room in World
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _ROOM_H_
  8. #define _ROOM_H_
  9. #include <memory>
  10. #include <vector>
  11. #include "BoundingBox.h"
  12. #include "Sprite.h"
  13. #include "RoomData.h"
  14. #include "RoomMesh.h"
  15. enum RoomFlags {
  16. RoomFlagUnderWater = (1 << 0)
  17. };
  18. class Room {
  19. public:
  20. Room(glm::vec3 _pos, BoundingBox* _bbox, RoomMesh* _mesh, unsigned int f,
  21. int a, int x, int z, int i);
  22. void prepare() { mesh->prepare(); }
  23. void display(glm::mat4 VP);
  24. bool isWall(unsigned long sector);
  25. long getSector(float x, float z, float* floor, float* ceiling);
  26. long getSector(float x, float z);
  27. void getHeightAtPosition(float x, float* y, float z);
  28. int getAdjoiningRoom(float x, float y, float z,
  29. float x2, float y2, float z2);
  30. BoundingBox& getBoundingBox() { return *bbox; }
  31. RoomMesh& getMesh() { return *mesh; }
  32. unsigned int getFlags() { return flags; }
  33. int getAlternateRoom() { return alternateRoom; }
  34. int getNumXSectors() { return numXSectors; }
  35. int getNumZSectors() { return numZSectors; }
  36. int getIndex() { return roomIndex; }
  37. void addSprite(RoomSprite* s) { sprites.emplace_back(s); }
  38. void addModel(StaticModel* s) { models.emplace_back(s); }
  39. void addSector(Sector* s) { sectors.emplace_back(s); }
  40. void addPortal(Portal* p) { portals.emplace_back(p); }
  41. unsigned long sizePortals() { return portals.size(); }
  42. Portal& getPortal(unsigned long index) { return *portals.at(index); }
  43. void displayUI();
  44. static void setShowBoundingBox(bool s) { showBoundingBox = s; }
  45. static bool getShowBoundingBox() { return showBoundingBox; }
  46. static void setShowRoomModels(bool s) { showRoomModels = s; }
  47. static bool getShowRoomModels() { return showRoomModels; }
  48. static void setShowRoomSprites(bool s) { showRoomSprites = s; }
  49. static bool getShowRoomSprites() { return showRoomSprites; }
  50. static void setShowRoomGeometry(bool s) { showRoomGeometry = s; }
  51. static bool getShowRoomGeometry() { return showRoomGeometry; }
  52. private:
  53. glm::vec3 pos;
  54. glm::mat4 model;
  55. std::unique_ptr<BoundingBox> bbox;
  56. std::unique_ptr<RoomMesh> mesh;
  57. unsigned int flags;
  58. int alternateRoom;
  59. int numXSectors;
  60. int numZSectors;
  61. int roomIndex;
  62. std::vector<std::unique_ptr<RoomSprite>> sprites;
  63. std::vector<std::unique_ptr<StaticModel>> models;
  64. std::vector<std::unique_ptr<Portal>> portals;
  65. std::vector<std::unique_ptr<Sector>> sectors;
  66. static bool showBoundingBox;
  67. static bool showRoomModels;
  68. static bool showRoomSprites;
  69. static bool showRoomGeometry;
  70. };
  71. #endif