MobileRT
1.0
A multi platform C++ CPU progressive Ray Tracer.
|
#include <BVH.hpp>
Classes | |
struct | BuildNode |
struct | BVHNode |
struct | lessthan |
struct | rightshift |
Public Member Functions | |
BVH ()=default | |
BVH (::std::vector< T > &&primitives) | |
BVH (const BVH &bvh)=delete | |
BVH (BVH &&bvh) noexcept=default | |
~BVH () | |
BVH & | operator= (const BVH &bvh)=delete |
BVH & | operator= (BVH &&bvh) noexcept=default |
Intersection | trace (Intersection intersection) |
Intersection | shadowTrace (Intersection intersection) |
const ::std::vector< T > & | getPrimitives () const |
template<typename Iterator > | |
::std::int32_t | getSplitIndexSah (const Iterator itBegin, const Iterator itEnd) |
Private Member Functions | |
void | build (::std::vector< T > &&primitives) |
Intersection | intersect (Intersection intersection) |
template<typename Iterator > | |
::std::int32_t | getSplitIndexSah (Iterator itBegin, Iterator itEnd) |
template<typename Iterator > | |
AABB | getSurroundingBox (Iterator itBegin, Iterator itEnd) |
Private Attributes | |
::std::vector< BVHNode > | boxes_ {} |
::std::vector< T > | primitives_ {} |
A class which represents the Bounding Volume Hierarchy acceleration structure.
T | The type of the primitives. |
|
explicitdefault |
|
explicit |
The constructor.
T | The type of the primitives. |
primitives | The vector containing all the primitives to store in the BVH. |
|
delete |
|
defaultnoexcept |
MobileRT::BVH< T >::~BVH | ( | ) |
The destructor.
T | The type of the primitives. |
|
private |
const ::std::vector< T > & MobileRT::BVH< T >::getPrimitives | ( | ) | const |
Gets the primitives.
T | The type of the primitives. |
|
private |
::std::int32_t MobileRT::BVH< T >::getSplitIndexSah | ( | const Iterator | itBegin, |
const Iterator | itEnd | ||
) |
Gets the index to where the vector of boxes should be split.
The algorithm used is the Surface Area Heuristic.
Iterator | The type of the iterator of the AABBs. |
itBegin | The iterator of the first box in the vector. |
itEnd | The iterator of the last box in the vector. |
|
private |
Calculates a surrounding box of all the build nodes vector received via arguments.
Iterator | The type of the iterator of the BuildNodes. |
itBegin | The iterator of the first node in the vector. |
itEnd | The iterator of the last node in the vector. |
|
private |
Helper method which calculates the intersection point from the origin of the ray.
This method supports two modes:
T | The type of the primitives. |
intersection | The previous intersection point of the ray (used to update its data in case it is found a nearest intersection point. |
|
delete |
|
defaultnoexcept |
Intersection MobileRT::BVH< T >::shadowTrace | ( | Intersection | intersection | ) |
This method casts a ray into the geometry and calculates a random intersection point. The intersection point itself is not important, the important is to determine if the ray intersects some primitive in the scene or not.
T | The type of the primitives. |
intersection | The current intersection of the ray with previous primitives. |
Intersection MobileRT::BVH< T >::trace | ( | Intersection | intersection | ) |
This method casts a ray into the geometry and calculates the nearest intersection point from the origin of the ray.
T | The type of the primitives. |
intersection | The current intersection of the ray with previous primitives. |
|
private |
|
private |