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

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 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. unsigned long sizePortals();
  38. Portal &getPortal(unsigned long index);
  39. unsigned long sizeSectors();
  40. Sector &getSector(unsigned long index);
  41. unsigned long sizeBox();
  42. Box &getBox(unsigned long index);
  43. unsigned long sizeModels();
  44. StaticModel &getModel(unsigned long index);
  45. unsigned long sizeLights();
  46. Light &getLight(unsigned long index);
  47. unsigned long sizeSprites();
  48. Sprite &getSprite(unsigned long 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<long> 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