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.0KB

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