Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
BvhAccelerator Class Reference

A Bounding Volume Hierarchy (BVH) Accelerator. More...

#include <BvhAccelerator.h>

Inheritance diagram for BvhAccelerator:
Inheritance graph
[legend]
Collaboration diagram for BvhAccelerator:
Collaboration graph
[legend]

Public Member Functions

 BvhAccelerator (std::vector< Shape *> *_initialMesh=NULL, BBox _globalBox=BBox(), unsigned int maxProf=8, const string &sm="sah")
 Default constructor. More...
 
virtual ~BvhAccelerator ()
 Destructor. More...
 
virtual bool build ()
 Build this accelerator. More...
 
virtual decimal traverse (Ray *r, std::list< Intersection > &result) const
 Run this accelerator. More...
 
void setMaxProfondeur (int _maxProfondeur)
 Set maximal depth. More...
 
int getMaxProfondeur ()
 Get maximal depth. More...
 
void setMaxPrimPerLeaf (int _maxPrimPerLeaf)
 Set maximal primitives per leaf. More...
 
int getMaxPrimPerLeaf ()
 Get maximal primitives per leaf. More...
 
std::vector< BBox > & getBBox ()
 Get the vector of bounding boxes. More...
 
void print ()
 Print not implemented: More...
 
- Public Member Functions inherited from Accelerator
 Accelerator ()
 Constructors. More...
 
 Accelerator (std::vector< Shape *> *_shapes, BBox &_globalBox)
 
 Accelerator (const Accelerator &other)
 Copy constructor. More...
 
virtual ~Accelerator ()
 Destructor. More...
 
leafTreatment::treatment getIntersectionChoice ()
 Get/Set the Intersection choice. More...
 
void setIntersectionChoice (leafTreatment::treatment _intersectionChoice=leafTreatment::FIRST)
 

Protected Types

enum  SplitMethod { SPLIT_MIDDLE, SPLIT_EQUAL_COUNTS, SPLIT_SAH }
 

Protected Member Functions

BVHBuildNoderecursiveBuild (std::vector< BVHPrimitiveInfo > &buildData, unsigned int start, unsigned int end, unsigned int *totalNodes, std::vector< Shape * > &orderedPrims)
 
unsigned int flattenBVHTree (BVHBuildNode *node, unsigned int *offset)
 
- Protected Member Functions inherited from Accelerator
void defineLeafFunction ()
 To define leaf function. More...
 

Protected Attributes

unsigned int maxPrimsInNode
 Maximal primitives in node. More...
 
SplitMethod splitMethod
 Split method. More...
 
LinearBVHNodenodes
 Nodes list. More...
 
std::vector< Shape * > primitives
 Pointer to all the shapes (different from initialMesh) as it is reordered. More...
 
BBox globalBox
 Global bounding box. More...
 
std::vector< BBoxtableBox
 Bounding boxes vector. More...
 
int maxProfondeur
 Maximal depth. More...
 
int maxPrimPerLeaf
 Maximal primitives per leaf. More...
 
int realMaxProfondeur
 Real maximal depth. More...
 
- Protected Attributes inherited from Accelerator
decimal(* pLeafTreatmentFunction )(std::list< Intersection > &, decimal)
 Pointer to the treatment function of leaf. More...
 
leafTreatment::treatment intersectionChoice
 Intersection choice. More...
 
std::vector< Shape * > * shapes
 Vector of pointers to shapes. More...
 
BBox globalBox
 Global bounding box. More...
 

Detailed Description

A Bounding Volume Hierarchy (BVH) Accelerator.

Definition at line 33 of file BvhAccelerator.h.

Member Enumeration Documentation

◆ SplitMethod

Enumerator
SPLIT_MIDDLE 
SPLIT_EQUAL_COUNTS 
SPLIT_SAH 

Definition at line 73 of file BvhAccelerator.h.

Constructor & Destructor Documentation

◆ BvhAccelerator()

BvhAccelerator::BvhAccelerator ( std::vector< Shape *> *  _initialMesh = NULL,
BBox  _globalBox = BBox(),
unsigned int  maxProf = 8,
const string &  sm = "sah" 
)

Default constructor.

Definition at line 152 of file BvhAccelerator.cpp.

◆ ~BvhAccelerator()

virtual BvhAccelerator::~BvhAccelerator ( )
inlinevirtual

Destructor.

Definition at line 40 of file BvhAccelerator.h.

Here is the call graph for this function:

Member Function Documentation

◆ build()

bool BvhAccelerator::build ( )
virtual

Build this accelerator.

Reimplemented from Accelerator.

Definition at line 439 of file BvhAccelerator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flattenBVHTree()

uint32_t BvhAccelerator::flattenBVHTree ( BVHBuildNode node,
unsigned int *  offset 
)
protected

Definition at line 350 of file BvhAccelerator.cpp.

Here is the caller graph for this function:

◆ getBBox()

std::vector<BBox>& BvhAccelerator::getBBox ( )
inline

Get the vector of bounding boxes.

Definition at line 55 of file BvhAccelerator.h.

Here is the call graph for this function:

◆ getMaxPrimPerLeaf()

int BvhAccelerator::getMaxPrimPerLeaf ( )
inline

Get maximal primitives per leaf.

Definition at line 53 of file BvhAccelerator.h.

◆ getMaxProfondeur()

int BvhAccelerator::getMaxProfondeur ( )
inline

Get maximal depth.

Definition at line 49 of file BvhAccelerator.h.

◆ print()

void BvhAccelerator::print ( )

Print not implemented:

Here is the caller graph for this function:

◆ recursiveBuild()

BVHBuildNode * BvhAccelerator::recursiveBuild ( std::vector< BVHPrimitiveInfo > &  buildData,
unsigned int  start,
unsigned int  end,
unsigned int *  totalNodes,
std::vector< Shape * > &  orderedPrims 
)
protected

Definition at line 172 of file BvhAccelerator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxPrimPerLeaf()

void BvhAccelerator::setMaxPrimPerLeaf ( int  _maxPrimPerLeaf)
inline

Set maximal primitives per leaf.

Definition at line 51 of file BvhAccelerator.h.

◆ setMaxProfondeur()

void BvhAccelerator::setMaxProfondeur ( int  _maxProfondeur)
inline

Set maximal depth.

Definition at line 47 of file BvhAccelerator.h.

◆ traverse()

decimal BvhAccelerator::traverse ( Ray r,
std::list< Intersection > &  result 
) const
virtual

Run this accelerator.

Reimplemented from Accelerator.

Definition at line 372 of file BvhAccelerator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ globalBox

BBox BvhAccelerator::globalBox
protected

Global bounding box.

Definition at line 78 of file BvhAccelerator.h.

◆ maxPrimPerLeaf

int BvhAccelerator::maxPrimPerLeaf
protected

Maximal primitives per leaf.

Definition at line 83 of file BvhAccelerator.h.

◆ maxPrimsInNode

unsigned int BvhAccelerator::maxPrimsInNode
protected

Maximal primitives in node.

Definition at line 72 of file BvhAccelerator.h.

◆ maxProfondeur

int BvhAccelerator::maxProfondeur
protected

Maximal depth.

Definition at line 82 of file BvhAccelerator.h.

◆ nodes

LinearBVHNode* BvhAccelerator::nodes
protected

Nodes list.

Definition at line 75 of file BvhAccelerator.h.

◆ primitives

std::vector<Shape*> BvhAccelerator::primitives
protected

Pointer to all the shapes (different from initialMesh) as it is reordered.

Definition at line 77 of file BvhAccelerator.h.

◆ realMaxProfondeur

int BvhAccelerator::realMaxProfondeur
protected

Real maximal depth.

Definition at line 85 of file BvhAccelerator.h.

◆ splitMethod

SplitMethod BvhAccelerator::splitMethod
protected

Split method.

Definition at line 74 of file BvhAccelerator.h.

◆ tableBox

std::vector<BBox> BvhAccelerator::tableBox
protected

Bounding boxes vector.

Definition at line 80 of file BvhAccelerator.h.


The documentation for this class was generated from the following files: