Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Room.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 <memory>
  10. #include <vector>
  11. #include "Sprite.h"
  12. #include "RoomData.h"
  13. #include "RoomMesh.h"
  14. enum RoomFlags {
  15. RoomFlagUnderWater = (1 << 0)
  16. };
  17. class Room {
  18. public:
  19. Room(glm::vec3 _pos, BoundingBox* _bbox, RoomMesh* _mesh, unsigned int f,
  20. int a, int x, int z);
  21. void prepare() { mesh->prepare(); }
  22. void display(glm::mat4 VP);
  23. bool isWall(unsigned long sector);
  24. long getSector(float x, float z, float* floor, float* ceiling);
  25. long getSector(float x, float z);
  26. void getHeightAtPosition(float x, float* y, float z);
  27. int getAdjoiningRoom(float x, float y, float z,
  28. float x2, float y2, float z2);
  29. BoundingBox& getBoundingBox() { return *bbox; }
  30. RoomMesh& getMesh() { return *mesh; }
  31. unsigned int getNumXSectors() { return numXSectors; }
  32. unsigned int getNumZSectors() { return numZSectors; }
  33. unsigned int getFlags() { return flags; }
  34. unsigned long sizePortals();
  35. Portal& getPortal(unsigned long index);
  36. void addPortal(Portal* p);
  37. unsigned long sizeSectors();
  38. Sector& getSector(unsigned long index);
  39. void addSector(Sector* s);
  40. unsigned long sizeModels();
  41. StaticModel& getModel(unsigned long index);
  42. void addModel(StaticModel* s);
  43. unsigned long sizeLights();
  44. Light& getLight(unsigned long index);
  45. void addLight(Light* l);
  46. unsigned long sizeSprites();
  47. Sprite& getSprite(unsigned long index);
  48. void addSprite(Sprite* s);
  49. private:
  50. glm::vec3 pos;
  51. glm::mat4 model;
  52. std::unique_ptr<BoundingBox> bbox;
  53. std::unique_ptr<RoomMesh> mesh;
  54. unsigned int flags;
  55. int alternateRoom;
  56. int numXSectors;
  57. int numZSectors;
  58. std::vector<std::unique_ptr<Sprite>> sprites;
  59. std::vector<std::unique_ptr<StaticModel>> models;
  60. std::vector<std::unique_ptr<Portal>> portals;
  61. std::vector<std::unique_ptr<Sector>> sectors;
  62. std::vector<std::unique_ptr<Light>> lights;
  63. // Was used for "depth sorting" render list, but never assigned...?!
  64. //float dist; // Distance to near plane, move to room?
  65. };
  66. #endif