Open Source Tomb Raider Engine
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

RoomData.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 Sector {
  75. public:
  76. Sector(float f, float c, bool w) : floor(f), ceiling(c), wall(w) { }
  77. Sector(TombRaider& tr, unsigned int room, unsigned int index);
  78. float getFloor();
  79. float getCeiling();
  80. bool isWall();
  81. private:
  82. float floor;
  83. float ceiling;
  84. bool wall;
  85. };
  86. #endif