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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. private:
  56. int index;
  57. float yaw;
  58. float pos[3];
  59. // ?
  60. //float bbox[2][3];
  61. };
  62. class Portal {
  63. public:
  64. Portal(TombRaider &tr, unsigned int room, unsigned int index, Matrix &transform);
  65. void getVertices(float vert[4][3]);
  66. int getAdjoiningRoom();
  67. private:
  68. float vertices[4][3];
  69. float normal[3];
  70. int adjoiningRoom;
  71. };
  72. class Box {
  73. public:
  74. Box(TombRaider &tr, unsigned int room, unsigned int index);
  75. private:
  76. float a[3], b[3], c[3], d[3];
  77. };
  78. class Sector {
  79. public:
  80. Sector(TombRaider &tr, unsigned int room, unsigned int index);
  81. float getFloor();
  82. float getCeiling();
  83. bool isWall();
  84. private:
  85. float floor;
  86. float ceiling;
  87. bool wall;
  88. };
  89. #endif