MobileRT
1.0
A multi platform C++ CPU progressive Ray Tracer.
|
#include <Sphere.hpp>
Public Member Functions | |
Sphere ()=delete | |
Sphere (const ::glm::vec3 ¢er, float radius, ::std::int32_t materialIndex) | |
Sphere (const Sphere &sphere)=default | |
Sphere (Sphere &&sphere) noexcept=default | |
~Sphere ()=default | |
Sphere & | operator= (const Sphere &sphere)=default |
Sphere & | operator= (Sphere &&sphere) noexcept=default |
Intersection | intersect (Intersection intersection) const |
AABB | getAABB () const |
bool | intersect (const AABB &box) const |
Private Member Functions | |
void | checkArguments () const |
Private Attributes | |
::glm::vec3 | center_ {} |
float | sqRadius_ {} |
::std::int32_t | materialIndex_ {-1} |
A class which represents a sphere in the scene.
|
explicitdelete |
|
explicit |
|
default |
|
defaultnoexcept |
|
default |
|
private |
Helper method which checks for invalid fields.
AABB Sphere::getAABB | ( | ) | const |
Calculates the bounding box of the sphere.
Intersection Sphere::intersect | ( | Intersection | intersection | ) | const |
Determines if a ray intersects this sphere or not and calculates the intersection point. The algorithm is based on this source .
intersection | The previous intersection of the ray in the scene. |
bool Sphere::intersect | ( | const AABB & | box | ) | const |
Checks if a bounding box intersects the sphere or not.
box | A bounding box. |
|
private |
|
private |
|
private |