Open Source Tomb Raider Engine
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Room.h 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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, 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 addLight(Light* l) { lights.emplace_back(l); }
  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. static void setShowBoundingBox(bool s) { showBoundingBox = s; }
  44. static bool getShowBoundingBox() { return showBoundingBox; }
  45. static void setShowRoomModels(bool s) { showRoomModels = s; }
  46. static bool getShowRoomModels() { return showRoomModels; }
  47. static void setShowRoomSprites(bool s) { showRoomSprites = s; }
  48. static bool getShowRoomSprites() { return showRoomSprites; }
  49. static void setShowRoomGeometry(bool s) { showRoomGeometry = s; }
  50. static bool getShowRoomGeometry() { return showRoomGeometry; }
  51. private:
  52. glm::vec3 pos;
  53. glm::mat4 model;
  54. std::unique_ptr<BoundingBox> bbox;
  55. std::unique_ptr<RoomMesh> mesh;
  56. unsigned int flags;
  57. int alternateRoom;
  58. int numXSectors;
  59. int numZSectors;
  60. int roomIndex;
  61. std::vector<std::unique_ptr<RoomSprite>> sprites;
  62. std::vector<std::unique_ptr<StaticModel>> models;
  63. std::vector<std::unique_ptr<Portal>> portals;
  64. std::vector<std::unique_ptr<Sector>> sectors;
  65. std::vector<std::unique_ptr<Light>> lights;
  66. static bool showBoundingBox;
  67. static bool showRoomModels;
  68. static bool showRoomSprites;
  69. static bool showRoomGeometry;
  70. };
  71. #endif