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.

RoomData.h 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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);
  15. void display(bool points, const unsigned char c1[4], const unsigned char c2[4]);
  16. bool inBox(float x, float y, float z);
  17. bool inBoxPlane(float x, float z);
  18. private:
  19. glm::vec3 a, b;
  20. };
  21. class Light {
  22. public:
  23. /*!
  24. * \brief Type a light can be of
  25. */
  26. typedef enum {
  27. typePoint = 1, //!< Point light
  28. typeSpot = 2, //!< Spot light
  29. typeDirectional = 3 //!< Directional light
  30. } LightType;
  31. void getPos(float p[4]);
  32. void getDir(float d[3]);
  33. float getAtt();
  34. void getColor(float c[4]);
  35. float getCutoff();
  36. LightType getType();
  37. private:
  38. float pos[4]; //! Light position in 3 space
  39. float dir[3]; //! Light direction
  40. float att;
  41. float color[4]; //! Color of light
  42. float cutoff; //! Fade out distance
  43. LightType type; //! Type of light
  44. };
  45. class StaticModel {
  46. public:
  47. void display();
  48. private:
  49. int index;
  50. float yaw;
  51. float pos[3];
  52. // ?
  53. //float bbox[2][3];
  54. };
  55. class Portal {
  56. public:
  57. Portal(glm::vec3 vert[4], float norm[3], int adj);
  58. void getVertices(float vert[4][3]);
  59. int getAdjoiningRoom();
  60. private:
  61. float vertices[4][3];
  62. float normal[3];
  63. int adjoiningRoom;
  64. };
  65. class Sector {
  66. public:
  67. Sector(float f, float c, bool w) : floor(f), ceiling(c), wall(w) { }
  68. float getFloor();
  69. float getCeiling();
  70. bool isWall();
  71. private:
  72. float floor;
  73. float ceiling;
  74. bool wall;
  75. };
  76. #endif