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 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. unsigned long sizePortals();
  35. Portal& getPortal(unsigned long index);
  36. void addPortal(Portal* p);
  37. unsigned long sizeSectors();
  38. Sector& getSector(unsigned long index);
  39. void addSector(Sector* s);
  40. unsigned long sizeModels();
  41. StaticModel& getModel(unsigned long index);
  42. void addModel(StaticModel* s);
  43. unsigned long sizeLights();
  44. Light& getLight(unsigned long index);
  45. void addLight(Light* l);
  46. unsigned long sizeSprites();
  47. Sprite& getSprite(unsigned long index);
  48. void addSprite(Sprite* s);
  49. static void setShowBoundingBox(bool s) { showBoundingBox = s; }
  50. static bool getShowBoundingBox() { return showBoundingBox; }
  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. std::vector<std::unique_ptr<Sprite>> 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. std::vector<std::unique_ptr<Light>> lights;
  65. static bool showBoundingBox;
  66. };
  67. #endif