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

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