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

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