Open Source Tomb Raider Engine
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Room.h 2.2KB

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