Open Source Tomb Raider Engine
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Room.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 <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);
  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 getNumXSectors() { return numXSectors; }
  32. unsigned int getNumZSectors() { return numZSectors; }
  33. unsigned int getFlags() { return flags; }
  34. void addSprite(RoomSprite* s) { sprites.emplace_back(s); }
  35. void addModel(StaticModel* s) { models.emplace_back(s); }
  36. void addSector(Sector* s) { sectors.emplace_back(s); }
  37. void addLight(Light* l) { lights.emplace_back(l); }
  38. void addPortal(Portal* p) { portals.emplace_back(p); }
  39. unsigned long sizePortals() { return portals.size(); }
  40. Portal& getPortal(unsigned long index) { return *portals.at(index); }
  41. static void setShowBoundingBox(bool s) { showBoundingBox = s; }
  42. static bool getShowBoundingBox() { return showBoundingBox; }
  43. static void setShowRoomModels(bool s) { showRoomModels = s; }
  44. static bool getShowRoomModels() { return showRoomModels; }
  45. static void setShowRoomSprites(bool s) { showRoomSprites = s; }
  46. static bool getShowRoomSprites() { return showRoomSprites; }
  47. static void setShowRoomGeometry(bool s) { showRoomGeometry = s; }
  48. static bool getShowRoomGeometry() { return showRoomGeometry; }
  49. private:
  50. glm::vec3 pos;
  51. glm::mat4 model;
  52. std::unique_ptr<BoundingBox> bbox;
  53. std::unique_ptr<RoomMesh> mesh;
  54. unsigned int flags;
  55. int alternateRoom;
  56. int numXSectors;
  57. int numZSectors;
  58. std::vector<std::unique_ptr<RoomSprite>> sprites;
  59. std::vector<std::unique_ptr<StaticModel>> models;
  60. std::vector<std::unique_ptr<Portal>> portals;
  61. std::vector<std::unique_ptr<Sector>> sectors;
  62. std::vector<std::unique_ptr<Light>> lights;
  63. static bool showBoundingBox;
  64. static bool showRoomModels;
  65. static bool showRoomSprites;
  66. static bool showRoomGeometry;
  67. };
  68. #endif