Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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(TombRaider& tr, unsigned int room, unsigned int index, Matrix& transform);
  66. void getVertices(float vert[4][3]);
  67. int getAdjoiningRoom();
  68. private:
  69. float vertices[4][3];
  70. float normal[3];
  71. int adjoiningRoom;
  72. };
  73. class Box {
  74. public:
  75. Box(TombRaider& tr, unsigned int room, unsigned int index);
  76. private:
  77. float a[3], b[3], c[3], d[3];
  78. };
  79. class Sector {
  80. public:
  81. Sector(TombRaider& tr, unsigned int room, unsigned int index);
  82. float getFloor();
  83. float getCeiling();
  84. bool isWall();
  85. private:
  86. float floor;
  87. float ceiling;
  88. bool wall;
  89. };
  90. #endif