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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. ~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. 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 long sizeAdjacentRooms();
  36. long getAdjacentRoom(unsigned long index);
  37. void addAdjacentRoom(long r);
  38. unsigned long sizePortals();
  39. Portal& getPortal(unsigned long index);
  40. void addPortal(Portal* p);
  41. unsigned long sizeSectors();
  42. Sector& getSector(unsigned long index);
  43. void addSector(Sector* s);
  44. unsigned long sizeBox();
  45. Box& getBox(unsigned long index);
  46. void addBox(Box* b);
  47. unsigned long sizeModels();
  48. StaticModel& getModel(unsigned long index);
  49. void addModel(StaticModel* s);
  50. unsigned long sizeLights();
  51. Light& getLight(unsigned long index);
  52. void addLight(Light* l);
  53. unsigned long sizeSprites();
  54. Sprite& getSprite(unsigned long index);
  55. void addSprite(Sprite* s);
  56. private:
  57. void sortModels();
  58. unsigned int flags;
  59. unsigned int numXSectors;
  60. unsigned int numZSectors;
  61. float pos[3];
  62. BoundingBox bbox;
  63. Mesh mesh;
  64. std::vector<long> adjacentRooms;
  65. std::vector<Sprite*> sprites;
  66. std::vector<StaticModel*> models;
  67. std::vector<Portal*> portals;
  68. std::vector<Box*> boxes;
  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