MobileRT
1.0
A multi platform C++ CPU progressive Ray Tracer.
|
#include <Triangle.hpp>
Classes | |
class | Builder |
Public Member Functions | |
Triangle ()=delete | |
Triangle (const Triangle &triangle)=default | |
Triangle (Triangle &&triangle) noexcept=default | |
~Triangle ()=default | |
Triangle & | operator= (const Triangle &triangle)=default |
Triangle & | operator= (Triangle &&triangle) noexcept=default |
Intersection | intersect (Intersection intersection) const |
AABB | getAABB () const |
bool | intersect (const AABB &box) const |
::glm::vec3 | getAC () const |
::glm::vec3 | getAB () const |
::glm::vec3 | getA () const |
::glm::vec3 | getNormalA () const |
::glm::vec3 | getNormalB () const |
::glm::vec3 | getNormalC () const |
::glm::vec2 | getTexCoordA () const |
::glm::vec2 | getTexCoordB () const |
::glm::vec2 | getTexCoordC () const |
::std::int32_t | getMaterialIndex () const |
Private Member Functions | |
Triangle (const Triangle::Builder &builder) noexcept | |
void | checkArguments () const |
Static Private Member Functions | |
static bool | isNearFarInvalid (float near, float far) |
Private Attributes | |
::glm::vec3 | AC_ {} |
::glm::vec3 | AB_ {} |
::glm::vec3 | pointA_ {} |
::glm::vec3 | normalA_ {} |
::glm::vec3 | normalB_ {} |
::glm::vec3 | normalC_ {} |
::glm::vec2 | texCoordA_ {-1} |
::glm::vec2 | texCoordB_ {-1} |
::glm::vec2 | texCoordC_ {-1} |
::std::int32_t | materialIndex_ {-1} |
Friends | |
::std::ostream & | operator<< (::std::ostream &os, const Triangle &triangle) |
A class which represents a triangle in the scene.
|
explicitprivatenoexcept |
|
explicitdelete |
|
default |
|
defaultnoexcept |
|
default |
|
private |
Helper method which checks for invalid fields.
glm::vec3 Triangle::getA | ( | ) | const |
Gets the point A of this triangle.
AABB Triangle::getAABB | ( | ) | const |
Calculates the bounding box of the triangle.
glm::vec3 Triangle::getAB | ( | ) | const |
Gets the AB vector of this triangle.
glm::vec3 Triangle::getAC | ( | ) | const |
Gets the AC vector of this triangle.
std::int32_t Triangle::getMaterialIndex | ( | ) | const |
Gets the material index of this plane.
glm::vec3 Triangle::getNormalA | ( | ) | const |
Gets the normal of vertex A of this triangle.
glm::vec3 Triangle::getNormalB | ( | ) | const |
Gets the normal of vertex B of this triangle.
glm::vec3 Triangle::getNormalC | ( | ) | const |
Gets the normal of vertex C of this triangle.
glm::vec2 Triangle::getTexCoordA | ( | ) | const |
Gets the texture coordinate of vertex A of this triangle.
glm::vec2 Triangle::getTexCoordB | ( | ) | const |
Gets the texture coordinate of vertex B of this triangle.
glm::vec2 Triangle::getTexCoordC | ( | ) | const |
Gets the texture coordinate of vertex C of this triangle.
Intersection Triangle::intersect | ( | Intersection | intersection | ) | const |
Determines if a ray intersects this triangle or not and calculates the intersection point.
intersection | The previous intersection of the ray in the scene. |
bool Triangle::intersect | ( | const AABB & | box | ) | const |
Checks if a bounding box intersects the triangle or not.
box | A bounding box. |
|
staticprivate |
Checks if near and far are valid.
near | The distance of near. |
far | The distance of far. |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |