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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 <vector>
  10. #include "Mesh.h"
  11. #include "Sprite.h"
  12. #include "RoomData.h"
  13. typedef enum {
  14. RoomFlagUnderWater = (1 << 0)
  15. } RoomFlags;
  16. class Room {
  17. public:
  18. Room(float p[3] = nullptr, unsigned int f = 0, unsigned int x = 0, unsigned int z = 0);
  19. ~Room();
  20. BoundingBox& getBoundingBox();
  21. void display(bool alpha);
  22. bool isWall(unsigned long sector);
  23. long getSector(float x, float z, float* floor, float* ceiling);
  24. long getSector(float x, float z);
  25. void getHeightAtPosition(float x, float* y, float z);
  26. int getAdjoiningRoom(float x, float y, float z,
  27. float x2, float y2, float z2);
  28. Mesh& getMesh() { return mesh; }
  29. unsigned int getNumXSectors();
  30. unsigned int getNumZSectors();
  31. void getPos(float p[3]);
  32. void setNumXSectors(unsigned int n);
  33. void setNumZSectors(unsigned int n);
  34. void setPos(float p[3]);
  35. void setFlags(unsigned int f);
  36. unsigned int getFlags();
  37. unsigned long sizeAdjacentRooms();
  38. long getAdjacentRoom(unsigned long index);
  39. void addAdjacentRoom(long r);
  40. unsigned long sizePortals();
  41. Portal& getPortal(unsigned long index);
  42. void addPortal(Portal* p);
  43. unsigned long sizeSectors();
  44. Sector& getSector(unsigned long index);
  45. void addSector(Sector* s);
  46. unsigned long sizeModels();
  47. StaticModel& getModel(unsigned long index);
  48. void addModel(StaticModel* s);
  49. unsigned long sizeLights();
  50. Light& getLight(unsigned long index);
  51. void addLight(Light* l);
  52. unsigned long sizeSprites();
  53. Sprite& getSprite(unsigned long index);
  54. void addSprite(Sprite* s);
  55. private:
  56. unsigned int flags;
  57. unsigned int numXSectors;
  58. unsigned int numZSectors;
  59. float pos[3];
  60. BoundingBox bbox;
  61. Mesh mesh;
  62. std::vector<long> adjacentRooms;
  63. std::vector<Sprite*> sprites;
  64. std::vector<StaticModel*> models;
  65. std::vector<Portal*> portals;
  66. std::vector<Sector*> sectors;
  67. std::vector<Light*> lights;
  68. // Was used for "depth sorting" render list, but never assigned...?!
  69. //float dist; // Distance to near plane, move to room?
  70. };
  71. #endif