NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FW::BVHNode Class Referenceabstract

BVH virtual node. Parent class of both a leaf node and an inner node. More...

#include <BVHNode.hpp>

Inherited by FW::InnerNode, and FW::LeafNode.

Public Member Functions

 BVHNode ()
 Constructor. More...
 
virtual bool isLeaf () const =0
 
virtual S32 getNumChildNodes () const =0
 
virtual BVHNodegetChildNode (S32 i) const =0
 Returns one of the node's child nodes. More...
 
virtual S32 getNumTriangles () const
 
float getArea () const
 
int getSubtreeSize (BVH_STAT stat=BVH_STAT_NODE_COUNT) const
 Calculates various information about the node's subtree. More...
 
void computeSubtreeProbabilities (const Platform &p, float parentProbability, float &sah)
 Calculates node's subtree probabilities and also sah price. More...
 
float computeSubtreeSAHCost (const Platform &p) const
 Calculates subtree SAH cost. Requires calculated probabilities. More...
 
void deleteSubtree ()
 Deletes node's subtree. More...
 
void assignIndicesDepthFirst (S32 index=0, bool includeLeafNodes=true)
 Assigns node's sbutree indices in depth first order. More...
 
void assignIndicesBreadthFirst (S32 index=0, bool includeLeafNodes=true)
 Assigns node's subtree indices in breadth first order. More...
 

Public Attributes

AABB m_bounds
 Bounding box of the node. More...
 
float m_probability
 Probability of coming here (widebvh uses this). More...
 
float m_parentProbability
 Probability of coming to parent (widebvh uses this). More...
 
int m_treelet
 For queuing tests (qmachine uses this). More...
 
int m_index
 in linearized tree (qmachine uses this). More...
 

Detailed Description

BVH virtual node. Parent class of both a leaf node and an inner node.

Definition at line 136 of file BVHNode.hpp.

Constructor & Destructor Documentation

FW::BVHNode::BVHNode ( )
inline

Constructor.

Definition at line 143 of file BVHNode.hpp.

Member Function Documentation

void FW::BVHNode::assignIndicesBreadthFirst ( S32  index = 0,
bool  includeLeafNodes = true 
)

Assigns node's subtree indices in breadth first order.

Parameters
[in]indexIndex to be assigned to the this node.
[in]includeLeafNodesFlag whether to assign indices to leaf nodes as well.

Definition at line 116 of file BVHNode.cpp.

void FW::BVHNode::assignIndicesDepthFirst ( S32  index = 0,
bool  includeLeafNodes = true 
)

Assigns node's sbutree indices in depth first order.

Parameters
[in]indexIndex to be assigned to this node. [in] includeLeafNodes Flag whether to assign indices to leaf nodes as well.

Definition at line 109 of file BVHNode.cpp.

void FW::BVHNode::computeSubtreeProbabilities ( const Platform p,
float  parentProbability,
float &  sah 
)

Calculates node's subtree probabilities and also sah price.

Parameters
[in]pPlatform settings.
[in]parentProbabilityParent node probability.
[out]sahCalculated SAH cost.

Definition at line 68 of file BVHNode.cpp.

float FW::BVHNode::computeSubtreeSAHCost ( const Platform p) const

Calculates subtree SAH cost. Requires calculated probabilities.

Parameters
[in]pPlatform settings.
Returns
SAH cost of the node's subtree..

Definition at line 87 of file BVHNode.cpp.

void FW::BVHNode::deleteSubtree ( )

Deletes node's subtree.

Definition at line 59 of file BVHNode.cpp.

float FW::BVHNode::getArea ( ) const
inline
Returns
Surface area of the node.

Definition at line 170 of file BVHNode.hpp.

virtual BVHNode* FW::BVHNode::getChildNode ( S32  i) const
pure virtual

Returns one of the node's child nodes.

Parameters
[in]iIndex of the child node.
Returns
Selected child node.

Implemented in FW::LeafNode, and FW::InnerNode.

virtual S32 FW::BVHNode::getNumChildNodes ( ) const
pure virtual
Returns
Number of the node's child nodes.

Implemented in FW::LeafNode, and FW::InnerNode.

virtual S32 FW::BVHNode::getNumTriangles ( ) const
inlinevirtual
Returns
Number of node's triangles.

Reimplemented in FW::LeafNode.

Definition at line 165 of file BVHNode.hpp.

int FW::BVHNode::getSubtreeSize ( BVH_STAT  stat = BVH_STAT_NODE_COUNT) const

Calculates various information about the node's subtree.

Parameters
[in]statDesired information.
Returns
Calculated information.

Definition at line 36 of file BVHNode.cpp.

virtual bool FW::BVHNode::isLeaf ( ) const
pure virtual
Returns
Whether the node is a leaf node.

Implemented in FW::LeafNode, and FW::InnerNode.

Member Data Documentation

AABB FW::BVHNode::m_bounds

Bounding box of the node.

Definition at line 172 of file BVHNode.hpp.

int FW::BVHNode::m_index

in linearized tree (qmachine uses this).

Definition at line 179 of file BVHNode.hpp.

float FW::BVHNode::m_parentProbability

Probability of coming to parent (widebvh uses this).

Definition at line 176 of file BVHNode.hpp.

float FW::BVHNode::m_probability

Probability of coming here (widebvh uses this).

Definition at line 175 of file BVHNode.hpp.

int FW::BVHNode::m_treelet

For queuing tests (qmachine uses this).

Definition at line 178 of file BVHNode.hpp.


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