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.1KB

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