Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*!
  2. * \file include/RoomData.h
  3. * \brief World Room Mesh
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _ROOM_DATA_H_
  8. #define _ROOM_DATA_H_
  9. #include <memory>
  10. #include <vector>
  11. #include <glm/vec3.hpp>
  12. class BoundingBox {
  13. public:
  14. BoundingBox(glm::vec3 min, glm::vec3 max) : a(min), b(max) { }
  15. bool inBox(float x, float y, float z) { return ((y > a.y) && (y < b.y) && inBoxPlane(x, z)); }
  16. bool inBoxPlane(float x, float z) { return ((x > a.x) && (x < b.x) && (z > a.z) && (z < b.z)); }
  17. private:
  18. glm::vec3 a, b;
  19. };
  20. // --------------------------------------
  21. class StaticModel {
  22. public:
  23. StaticModel(glm::vec3 p, float a, int i) : pos(p), angle(a), id(i), cache(-1) { }
  24. void display(glm::mat4 view, glm::mat4 projection);
  25. private:
  26. glm::vec3 pos;
  27. float angle;
  28. int id;
  29. int cache;
  30. };
  31. // --------------------------------------
  32. class Light {
  33. public:
  34. /*!
  35. * \brief Type a light can be of
  36. */
  37. typedef enum {
  38. typePoint = 1, //!< Point light
  39. typeSpot = 2, //!< Spot light
  40. typeDirectional = 3 //!< Directional light
  41. } LightType;
  42. void getPos(float p[4]);
  43. void getDir(float d[3]);
  44. float getAtt();
  45. void getColor(float c[4]);
  46. float getCutoff();
  47. LightType getType();
  48. private:
  49. float pos[4]; //! Light position in 3 space
  50. float dir[3]; //! Light direction
  51. float att;
  52. float color[4]; //! Color of light
  53. float cutoff; //! Fade out distance
  54. LightType type; //! Type of light
  55. };
  56. // --------------------------------------
  57. class Portal {
  58. public:
  59. Portal(glm::vec3 vert[4], float norm[3], int adj);
  60. void getVertices(float vert[4][3]);
  61. int getAdjoiningRoom();
  62. private:
  63. float vertices[4][3];
  64. float normal[3];
  65. int adjoiningRoom;
  66. };
  67. // --------------------------------------
  68. class Sector {
  69. public:
  70. Sector(float f, float c, bool w) : floor(f), ceiling(c), wall(w) { }
  71. float getFloor();
  72. float getCeiling();
  73. bool isWall();
  74. private:
  75. float floor;
  76. float ceiling;
  77. bool wall;
  78. };
  79. #endif