Open Source Tomb Raider Engine
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Room.h 2.0KB

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