NTrace
GPU ray tracing framework
|
Class performing SBVH build. More...
#include <SplitBVHBuilder.hpp>
Inherited by FW::OcclusionBVHBuilder.
Classes | |
struct | NodeSpec |
Structure holding specifications of the BVH's node. More... | |
struct | ObjectSplit |
Structure holding info about object split of a BVH node. More... | |
struct | Reference |
Structure holding triangle's index together with its bounding box. More... | |
struct | SpatialBin |
Structure holding info about a spatial bin. More... | |
struct | SpatialSplit |
Structure holding info about spatial split of a BVH node. More... | |
Public Member Functions | |
SplitBVHBuilder (BVH &bvh, const BVH::BuildParams ¶ms) | |
Constructor. More... | |
~SplitBVHBuilder (void) | |
Destructor. More... | |
BVHNode * | run (void) |
Performs the actual build. More... | |
void | splitReference (Reference &left, Reference &right, const Reference &ref, int dim, F32 pos) |
Splits the triangle's bounding box. More... | |
Static Public 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 Types | |
enum | { MaxDepth = 64, MaxSpatialDepth = 48, NumSpatialBins = 128 } |
Several tree build constrains. More... | |
Protected Member Functions | |
BVHNode * | buildNode (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 * | createLeaf (const NodeSpec &spec) |
Builds a leaf node. More... | |
ObjectSplit | findObjectSplit (const NodeSpec &spec, F32 nodeSAH) |
Finds best object split of the node. More... | |
void | performObjectSplit (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, const ObjectSplit &split) |
Performs the object split operation. More... | |
SpatialSplit | findSpatialSplit (const NodeSpec &spec, F32 nodeSAH) |
Finds the best spatial split of the node. More... | |
void | performSpatialSplit (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, const SpatialSplit &split) |
Performs the spatial split operation. 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... | |
F32 | m_minOverlap |
Minimum overlap of the left and right AABB of the object split needed to make spatial split worth finding. More... | |
Array< AABB > | m_rightBounds |
Bounding boxes of all the possible right children. More... | |
S32 | m_sortDim |
Sort dimension. Used by sort method. More... | |
SpatialBin | m_bins [3][NumSpatialBins] |
Spatial bins. More... | |
Timer | m_progressTimer |
Progress timer. More... | |
S32 | m_numDuplicates |
Number of duplicated references. More... | |
Class performing SBVH build.
Definition at line 44 of file SplitBVHBuilder.hpp.
|
protected |
Several tree build constrains.
Enumerator | |
---|---|
MaxDepth |
Maximum depth of the BVH tree. |
MaxSpatialDepth |
Maximum depth of the BVH where spatial split will still be used. |
NumSpatialBins |
Number of spatial bins per node in each axis. |
Definition at line 51 of file SplitBVHBuilder.hpp.
SplitBVHBuilder::SplitBVHBuilder | ( | BVH & | bvh, |
const BVH::BuildParams & | params | ||
) |
Constructor.
[out] | bvh | Emtpy BVH to be built. |
[in] | params | Build parameters. |
Definition at line 35 of file SplitBVHBuilder.cpp.
SplitBVHBuilder::~SplitBVHBuilder | ( | void | ) |
Destructor.
Definition at line 46 of file SplitBVHBuilder.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 114 of file SplitBVHBuilder.cpp.
Builds a leaf node.
[in] | spec | Specifications of the node. |
Definition at line 183 of file SplitBVHBuilder.cpp.
|
protected |
Finds 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 193 of file SplitBVHBuilder.cpp.
|
protected |
Finds the best spatial 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 251 of file SplitBVHBuilder.cpp.
|
protected |
Performs the object split operation.
[out] | left | Left child node specification. |
[out] | right | Right child node specification. |
[in] | spec | Specification of the node being split. |
[in] | split | Object split information. |
Definition at line 238 of file SplitBVHBuilder.cpp.
|
protected |
Performs the spatial split operation.
[out] | left | Left child node specification. |
[out] | right | Right child node specification. |
[in] | spec | Specification of the node being split. |
[in] | split | Spatial split information. |
Definition at line 334 of file SplitBVHBuilder.cpp.
Performs the actual build.
Definition at line 52 of file SplitBVHBuilder.cpp.
|
static |
Sort comparator. Sorts references according to their position in descending order. For details see framework/base.Sort.hpp.
Definition at line 93 of file SplitBVHBuilder.cpp.
Sort swap function. Swaps two references placed in the reference stack. For details see framework/base.Sort.hpp.
Definition at line 106 of file SplitBVHBuilder.cpp.
void SplitBVHBuilder::splitReference | ( | Reference & | left, |
Reference & | right, | ||
const Reference & | ref, | ||
int | dim, | ||
F32 | pos | ||
) |
Splits the triangle's bounding box.
[out] | left | Left reference. |
[out] | right | Right reference. |
[in] | ref | Reference being split. |
[in] | dim | Axis of the split. |
[in] | pos | Position of the split. |
Definition at line 430 of file SplitBVHBuilder.cpp.
|
protected |
Spatial bins.
Definition at line 236 of file SplitBVHBuilder.hpp.
|
protected |
BVH being built.
Definition at line 228 of file SplitBVHBuilder.hpp.
|
protected |
Minimum overlap of the left and right AABB of the object split needed to make spatial split worth finding.
Definition at line 233 of file SplitBVHBuilder.hpp.
|
protected |
Number of duplicated references.
Definition at line 239 of file SplitBVHBuilder.hpp.
|
protected |
Build parameters.
Definition at line 230 of file SplitBVHBuilder.hpp.
|
protected |
Platform settings.
Definition at line 229 of file SplitBVHBuilder.hpp.
|
protected |
Progress timer.
Definition at line 238 of file SplitBVHBuilder.hpp.
Reference stack.
Definition at line 232 of file SplitBVHBuilder.hpp.
Bounding boxes of all the possible right children.
Definition at line 234 of file SplitBVHBuilder.hpp.
|
protected |
Sort dimension. Used by sort method.
Definition at line 235 of file SplitBVHBuilder.hpp.