16 #ifndef BVHACCELERATOR_H
17 #define BVHACCELERATOR_H
39 unsigned int maxProf = 8,
const string& sm =
"sah");
87 unsigned int end,
unsigned int* totalNodes,
88 std::vector<Shape*>& orderedPrims);
Base class for accelerators.
Definition of a bounding box which is aligned along the axis (BBox AABB).
A Bounding Volume Hierarchy (BVH) Accelerator.
virtual decimal traverse(Ray *r, std::list< Intersection > &result) const
Run this accelerator.
BVHBuildNode * recursiveBuild(std::vector< BVHPrimitiveInfo > &buildData, unsigned int start, unsigned int end, unsigned int *totalNodes, std::vector< Shape * > &orderedPrims)
std::vector< Shape * > primitives
Pointer to all the shapes (different from initialMesh) as it is reordered.
virtual bool build()
Build this accelerator.
SplitMethod splitMethod
Split method.
virtual ~BvhAccelerator()
Destructor.
BBox globalBox
Global bounding box.
void setMaxPrimPerLeaf(int _maxPrimPerLeaf)
Set maximal primitives per leaf.
std::vector< BBox > tableBox
Bounding boxes vector.
void print()
Print not implemented:
unsigned int maxPrimsInNode
Maximal primitives in node.
int getMaxProfondeur()
Get maximal depth.
unsigned int flattenBVHTree(BVHBuildNode *node, unsigned int *offset)
int getMaxPrimPerLeaf()
Get maximal primitives per leaf.
std::vector< BBox > & getBBox()
Get the vector of bounding boxes.
BvhAccelerator(std::vector< Shape * > *_initialMesh=NULL, BBox _globalBox=BBox(), unsigned int maxProf=8, const string &sm="sah")
Default constructor.
LinearBVHNode * nodes
Nodes list.
int maxPrimPerLeaf
Maximal primitives per leaf.
int realMaxProfondeur
Real maximal depth.
int maxProfondeur
Maximal depth.
void setMaxProfondeur(int _maxProfondeur)
Set maximal depth.
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...