NTrace
GPU ray tracing framework
|
Class that builds a BVH using SAH. More...
#include <SAHBVHBuilder.hpp>
Classes | |
struct | NodeSpec |
Structure holding specifications of a BVH's node. More... | |
struct | ObjectSplit |
Structure holding info about a split of the BVH node. More... | |
struct | Reference |
Structure holding triangle's index together with its bounding box. More... | |
Public Member Functions | |
SAHBVHBuilder (BVH &bvh, const BVH::BuildParams ¶ms) | |
Constructor. More... | |
virtual | ~SAHBVHBuilder (void) |
Destructor. More... | |
virtual BVHNode * | run (void) |
Performs the actual build. More... | |
Protected Types | |
enum | { MaxDepth = 64 } |
Maximum depth of the BVH. More... | |
Protected Member Functions | |
BVHNode * | buildNode (const NodeSpec &spec, int level, F32 progressStart, F32 progressEnd) |
Builds a BVH node. The built node may be an inner node as well as a leaf node. More... | |
BVHNode * | buildNode (const NodeSpec &spec, int start, int end, int level, F32 progressStart, F32 progressEnd) |
Builds a node. The built node may be an inner node as well as leaf node. Processes specific part of the reference stack. More... | |
BVHNode * | createLeaf (const NodeSpec &spec) |
Builds a leaf node. More... | |
BVHNode * | createLeaf (const NodeSpec &spec, int start, int end) |
Builds a leaf node. Processes specific part of the reference stack. More... | |
ObjectSplit | findObjectSplit (const NodeSpec &spec, F32 nodeSAH) |
Finds the best object split of the node. More... | |
ObjectSplit | findObjectSplit (int start, int end, F32 nodeSAH) |
Finds the best object split of the node. More... | |
void | performObjectSplit (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, const ObjectSplit &split) |
Performs the split operation. More... | |
void | performObjectSplit (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, int start, int end, const ObjectSplit &split) |
Performs the split operation. More... | |
Static Protected Member Functions | |
static bool | sortCompare (void *data, int idxA, int idxB) |
Sort comparator. Sorts references according to their position in descending order. For details see framework/base.Sort.hpp. More... | |
static void | sortSwap (void *data, int idxA, int idxB) |
Sort swap function. Swaps two references placed in the reference stack. For details see framework/base.Sort.hpp. More... | |
Protected Attributes | |
BVH & | m_bvh |
BVH being built. More... | |
const Platform & | m_platform |
Platform settings. More... | |
const BVH::BuildParams & | m_params |
Build parameters. More... | |
Array< Reference > | m_refStack |
Reference stack. More... | |
Array< AABB > | m_rightBounds |
Bounding boxes of all the possible right children. More... | |
S32 | m_sortDim |
Sort dimension. Used by the sort method. More... | |
Timer | m_progressTimer |
Progress timer. More... | |
S32 | m_numDuplicates |
Number of duplicated references. More... | |
Class that builds a BVH using SAH.
Definition at line 38 of file SAHBVHBuilder.hpp.
|
protected |
SAHBVHBuilder::SAHBVHBuilder | ( | BVH & | bvh, |
const BVH::BuildParams & | params | ||
) |
Constructor.
[out] | bvh | BVH to be built. |
[in] | params | Build parameters. |
Definition at line 24 of file SAHBVHBuilder.cpp.
|
virtual |
Destructor.
Definition at line 34 of file SAHBVHBuilder.cpp.
|
protected |
Builds a BVH node. The built node may be an inner node as well as a leaf node.
[in] | spec | Specifications of the node. |
[in] | level | Level of the node in the tree. |
[in] | proggressStart | Percentage of already built subtree. |
[in] | progressEnd | Percentage of already built subtree including node's subtree. |
Definition at line 133 of file SAHBVHBuilder.cpp.
|
protected |
Builds a node. The built node may be an inner node as well as leaf node. Processes specific part of the reference stack.
[in] | spec | Specifications of the node. |
[in] | start | Processes reference stack section starting from this position. |
[in] | end | Processes reference stack section ending in this position. |
[in] | level | Level of the node in the tree. |
[in] | proggressStart | Percentage of already built subtree. |
[in] | progressEnd | Percentage of already built subtree including node's subtree. |
Definition at line 184 of file SAHBVHBuilder.cpp.
Builds a leaf node.
[in] | spec | Specification of the node. |
Definition at line 236 of file SAHBVHBuilder.cpp.
Builds a leaf node. Processes specific part of the reference stack.
[in] | spec | Specifications of the node. |
[in] | start | Processes reference stack section starting from this position. |
[in] | end | Processes reference stack section ending in this position. |
Definition at line 246 of file SAHBVHBuilder.cpp.
|
protected |
Finds the best object split of the node.
[in] | spec | Specifications of the node. |
[in] | nodeSAH | Cost of the split without the cost of the triangles. |
Definition at line 257 of file SAHBVHBuilder.cpp.
|
protected |
Finds the best object split of the node.
[in] | start | Processes reference stack section starting from this position. |
[in] | end | Processes reference stack section ending in this position. |
[in] | nodeSAH | Cost of the split without the cost of the triangles. |
Definition at line 300 of file SAHBVHBuilder.cpp.
|
protected |
Performs the split operation.
[out] | left | Left child node specification. |
[out] | right | Right child node specification. |
[in] | spec | Specification of the node being split. |
[in] | split | Split information. |
Definition at line 344 of file SAHBVHBuilder.cpp.
|
protected |
Performs the split operation.
[out] | left | Left child node specification. |
[out] | right | Right child node specification. |
[in] | start | Processes reference stack section starting from this position. |
[in] | end | Processes reference stack section ending in this position. |
[in] | split | Split information. |
Definition at line 357 of file SAHBVHBuilder.cpp.
Performs the actual build.
Definition at line 40 of file SAHBVHBuilder.cpp.
|
staticprotected |
Sort comparator. Sorts references according to their position in descending order. For details see framework/base.Sort.hpp.
WARNING - new version might not work!!!
Definition at line 112 of file SAHBVHBuilder.cpp.
Sort swap function. Swaps two references placed in the reference stack. For details see framework/base.Sort.hpp.
Definition at line 125 of file SAHBVHBuilder.cpp.
|
protected |
BVH being built.
Definition at line 207 of file SAHBVHBuilder.hpp.
|
protected |
Number of duplicated references.
Definition at line 216 of file SAHBVHBuilder.hpp.
|
protected |
Build parameters.
Definition at line 209 of file SAHBVHBuilder.hpp.
|
protected |
Platform settings.
Definition at line 208 of file SAHBVHBuilder.hpp.
|
protected |
Progress timer.
Definition at line 215 of file SAHBVHBuilder.hpp.
Reference stack.
Definition at line 211 of file SAHBVHBuilder.hpp.
Bounding boxes of all the possible right children.
Definition at line 212 of file SAHBVHBuilder.hpp.
|
protected |
Sort dimension. Used by the sort method.
Definition at line 213 of file SAHBVHBuilder.hpp.