NTrace
GPU ray tracing framework
|
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 BVHNode * | getChildNode (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... | |
BVH virtual node. Parent class of both a leaf node and an inner node.
Definition at line 136 of file BVHNode.hpp.
|
inline |
Constructor.
Definition at line 143 of file BVHNode.hpp.
Assigns node's subtree indices in breadth first order.
[in] | index | Index to be assigned to the this node. |
[in] | includeLeafNodes | Flag whether to assign indices to leaf nodes as well. |
Definition at line 116 of file BVHNode.cpp.
Assigns node's sbutree indices in depth first order.
[in] | index | Index 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.
[in] | p | Platform settings. |
[in] | parentProbability | Parent node probability. |
[out] | sah | Calculated 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.
[in] | p | Platform settings. |
Definition at line 87 of file BVHNode.cpp.
void FW::BVHNode::deleteSubtree | ( | ) |
Deletes node's subtree.
Definition at line 59 of file BVHNode.cpp.
|
inline |
Definition at line 170 of file BVHNode.hpp.
Returns one of the node's child nodes.
[in] | i | Index of the child node. |
Implemented in FW::LeafNode, and FW::InnerNode.
|
pure virtual |
Implemented in FW::LeafNode, and FW::InnerNode.
|
inlinevirtual |
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.
[in] | stat | Desired information. |
Definition at line 36 of file BVHNode.cpp.
|
pure virtual |
Implemented in FW::LeafNode, and FW::InnerNode.
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.