MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
Sphere.hpp
Go to the documentation of this file.
1 #ifndef MOBILERT_SHAPES_SPHERE_HPP
2 #define MOBILERT_SHAPES_SPHERE_HPP
3 
6 #include "MobileRT/Ray.hpp"
7 #include <glm/glm.hpp>
8 
9 namespace MobileRT {
13  class Sphere final {
14  private:
15  ::glm::vec3 center_ {};
16  float sqRadius_ {};
17  ::std::int32_t materialIndex_ {-1};
18 
19  private:
20  void checkArguments() const;
21 
22  public:
23  explicit Sphere () = delete;
24 
25  explicit Sphere(const ::glm::vec3 &center, float radius, ::std::int32_t materialIndex);
26 
27  Sphere(const Sphere &sphere) = default;
28 
29  Sphere(Sphere &&sphere) noexcept = default;
30 
31  ~Sphere() = default;
32 
33  Sphere &operator=(const Sphere &sphere) = default;
34 
35  Sphere &operator=(Sphere &&sphere) noexcept = default;
36 
37  Intersection intersect(Intersection intersection) const;
38 
39  AABB getAABB() const;
40 
41  bool intersect(const AABB &box) const;
42  };
43 }//namespace MobileRT
44 
45 #endif //MOBILERT_SHAPES_SPHERE_HPP
~Sphere()=default
void checkArguments() const
Definition: Sphere.cpp:25
Intersection intersect(Intersection intersection) const
Definition: Sphere.cpp:42
Definition: Intersection.hpp:14
::glm::vec3 center_
Definition: Sphere.hpp:15
AABB getAABB() const
Definition: Sphere.cpp:88
Definition: Sphere.hpp:13
float sqRadius_
Definition: Sphere.hpp:16
Definition: AABB.hpp:18
::std::int32_t materialIndex_
Definition: Sphere.hpp:17
Sphere & operator=(const Sphere &sphere)=default
const AABB box
Definition: TestPlane.cpp:26
Definition: AABB.cpp:105