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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 <vector>
  10. #include <memory>
  11. #include "math/Matrix.h"
  12. #include "TombRaider.h"
  13. class BoundingBox {
  14. public:
  15. BoundingBox();
  16. void getBoundingBox(float box[2][3]);
  17. void setBoundingBox(float min[3], float max[3]);
  18. void display(bool points, const unsigned char c1[4], const unsigned char c2[4]);
  19. bool inBox(float x, float y, float z);
  20. bool inBoxPlane(float x, float z);
  21. private:
  22. float a[3], b[3];
  23. };
  24. class Light {
  25. public:
  26. /*!
  27. * \brief Type a light can be of
  28. */
  29. typedef enum {
  30. typePoint = 1, //!< Point light
  31. typeSpot = 2, //!< Spot light
  32. typeDirectional = 3 //!< Directional light
  33. } LightType;
  34. Light(TombRaider& tr, unsigned int room, unsigned int index);
  35. void getPos(float p[4]);
  36. void getDir(float d[3]);
  37. float getAtt();
  38. void getColor(float c[4]);
  39. float getCutoff();
  40. LightType getType();
  41. private:
  42. float pos[4]; //! Light position in 3 space
  43. float dir[3]; //! Light direction
  44. float att;
  45. float color[4]; //! Color of light
  46. float cutoff; //! Fade out distance
  47. LightType type; //! Type of light
  48. };
  49. class StaticModel {
  50. public:
  51. StaticModel(TombRaider& tr, unsigned int room, unsigned int i);
  52. void display();
  53. // Compares distance to ViewVolume for depth sorting
  54. bool operator<(const StaticModel& other);
  55. static bool compare(StaticModel* a, StaticModel* b);
  56. private:
  57. int index;
  58. float yaw;
  59. float pos[3];
  60. // ?
  61. //float bbox[2][3];
  62. };
  63. class Portal {
  64. public:
  65. Portal(float vert[4][3], float norm[3], int adj);
  66. Portal(TombRaider& tr, unsigned int room, unsigned int index, Matrix& transform);
  67. void getVertices(float vert[4][3]);
  68. int getAdjoiningRoom();
  69. private:
  70. float vertices[4][3];
  71. float normal[3];
  72. int adjoiningRoom;
  73. };
  74. class Box {
  75. public:
  76. Box(TombRaider& tr, unsigned int room, unsigned int index);
  77. private:
  78. float a[3], b[3], c[3], d[3];
  79. };
  80. class Sector {
  81. public:
  82. Sector(TombRaider& tr, unsigned int room, unsigned int index);
  83. float getFloor();
  84. float getCeiling();
  85. bool isWall();
  86. private:
  87. float floor;
  88. float ceiling;
  89. bool wall;
  90. };
  91. #endif