MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
Intersection.hpp
Go to the documentation of this file.
1 #ifndef MOBILERT_INTERSECTION_HPP
2 #define MOBILERT_INTERSECTION_HPP
3 
4 #include "MobileRT/Material.hpp"
5 #include "MobileRT/Ray.hpp"
8 #include <glm/glm.hpp>
9 
10 namespace MobileRT {
14  class Intersection final {
15  public:
16  ::glm::vec3 point_ {0.0F, 0.0F, 0.0F};
17  ::glm::vec3 normal_ {0.0F, 1.0F, 0.0F};
18  Material *material_ {nullptr};
20  const void *primitive_ {nullptr};
21  ::std::int32_t materialIndex_ {-1};
22  ::glm::vec2 texCoords_ {-1.0F, -1.0F};
23 
27  Ray ray_ {::glm::vec3 {}, ::glm::vec3 {}, 0, false};
28 
29  private:
30  void checkArguments() const;
31 
32  public:
33  explicit Intersection() = delete;
34 
35  explicit Intersection(Ray &&ray, float dist = RayLengthMax);
36 
37  explicit Intersection(
38  Ray &&ray,
39  const ::glm::vec3 &intPoint,
40  float dist,
41  const ::glm::vec3 &normal,
42  const void *primitive,
43  ::std::int32_t materialIndex,
44  const ::glm::vec2 &texCoords = ::glm::vec2 {-1});
45 
46  Intersection(const Intersection &intersection) = default;
47 
48  Intersection(Intersection &&intersection) noexcept = default;
49 
50  ~Intersection() = default;
51 
52  Intersection &operator=(const Intersection &intersection) = delete;
53 
54  Intersection &operator=(Intersection &&intersection) noexcept = default;
55  };
56 }//namespace MobileRT
57 
58 #endif //MOBILERT_INTERSECTION_HPP
Definition: Material.hpp:13
const float RayLengthMax
Definition: Constants.hpp:33
const void * primitive_
Definition: Intersection.hpp:20
Ray ray_
Definition: Intersection.hpp:27
::std::int32_t materialIndex_
Definition: Intersection.hpp:21
::glm::vec2 texCoords_
Definition: Intersection.hpp:22
float length_
Definition: Intersection.hpp:19
Definition: Intersection.hpp:14
Intersection & operator=(const Intersection &intersection)=delete
::glm::vec3 normal_
Definition: Intersection.hpp:17
void checkArguments() const
Definition: Intersection.cpp:50
Material * material_
Definition: Intersection.hpp:18
Definition: Ray.hpp:13
::glm::vec3 point_
Definition: Intersection.hpp:16
Definition: AABB.cpp:105