Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Room.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. Mesh& getMesh() { return mesh; }
  31. unsigned int getNumXSectors();
  32. unsigned int getNumZSectors();
  33. void getPos(float p[3]);
  34. void setFlags(unsigned int f);
  35. unsigned int getFlags();
  36. unsigned long sizeAdjacentRooms();
  37. long getAdjacentRoom(unsigned long index);
  38. void addAdjacentRoom(long r);
  39. unsigned long sizePortals();
  40. Portal& getPortal(unsigned long index);
  41. void addPortal(Portal* p);
  42. unsigned long sizeSectors();
  43. Sector& getSector(unsigned long index);
  44. void addSector(Sector* s);
  45. unsigned long sizeBox();
  46. Box& getBox(unsigned long index);
  47. void addBox(Box* b);
  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<Box*> boxes;
  70. std::vector<Sector*> sectors;
  71. std::vector<Light*> lights;
  72. // Was used for "depth sorting" render list, but never assigned...?!
  73. //float dist; // Distance to near plane, move to room?
  74. };
  75. #endif