Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

RoomData.h 2.2KB

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