Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
bvh::v2::BinnedSahBuilder< Node, BinCount > Class Template Reference

template<typename Node, size_t BinCount = 8>
class bvh::v2::BinnedSahBuilder< Node, BinCount >

Single-threaded top-down builder that partitions primitives based on a binned approximation of the Surface Area Heuristic (SAH).

This builder is inspired by "On Fast Construction of SAH-based Bounding Volume Hierarchies", by I. Wald.

Definition at line 19 of file binned_sah_builder.h.

Classes

struct  Bin
struct  Split

Static Public Member Functions

static BVH_ALWAYS_INLINE Bvh< Nodebuild (std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config={})

Protected Types

using BBox = bvh::v2::BBox<Scalar, Node::dimension>
using Bins = std::array<Bin, BinCount>
using PerAxisBins = std::array<Bins, Node::dimension>
using Scalar = typename Node::Scalar
using Vec = bvh::v2::Vec<Scalar, Node::dimension>

Protected Member Functions

BVH_ALWAYS_INLINE BinnedSahBuilder (std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config)
Bvh< Nodebuild ()
BVH_ALWAYS_INLINE BBox compute_bbox (size_t begin, size_t end) const
size_t fallback_split (size_t axis, size_t begin, size_t end)
BVH_ALWAYS_INLINE void fill_bins (PerAxisBins &per_axis_bins, const BBox &bbox, size_t begin, size_t end)
void find_best_split (size_t axis, const Bins &bins, Split &best_split)
std::vector< size_t > & get_prim_ids () override
BVH_ALWAYS_INLINE const std::vector< size_t > & get_prim_ids () const
std::optional< size_t > try_split (const BBox &bbox, size_t begin, size_t end) override

Protected Attributes

std::span< const BBoxbboxes_
std::span< const Veccenters_
const Configconfig_
std::vector< size_t > prim_ids_

#include <bvh/v2/binned_sah_builder.h>

Inheritance diagram for bvh::v2::BinnedSahBuilder< Node, BinCount >:
bvh::v2::TopDownSahBuilder< Node >

Member Typedef Documentation

◆ BBox

template<typename Node>
using bvh::v2::TopDownSahBuilder< Node >::BBox = bvh::v2::BBox<Scalar, Node::dimension>
protectedinherited

Definition at line 28 of file top_down_sah_builder.h.

◆ Bins

template<typename Node, size_t BinCount = 8>
using bvh::v2::BinnedSahBuilder< Node, BinCount >::Bins = std::array<Bin, BinCount>
protected

Definition at line 65 of file binned_sah_builder.h.

◆ PerAxisBins

template<typename Node, size_t BinCount = 8>
using bvh::v2::BinnedSahBuilder< Node, BinCount >::PerAxisBins = std::array<Bins, Node::dimension>
protected

Definition at line 66 of file binned_sah_builder.h.

◆ Scalar

template<typename Node>
using bvh::v2::TopDownSahBuilder< Node >::Scalar = typename Node::Scalar
protectedinherited

Definition at line 26 of file top_down_sah_builder.h.

◆ Vec

template<typename Node>
using bvh::v2::TopDownSahBuilder< Node >::Vec = bvh::v2::Vec<Scalar, Node::dimension>
protectedinherited

Definition at line 27 of file top_down_sah_builder.h.

Constructor & Destructor Documentation

◆ BinnedSahBuilder()

template<typename Node, size_t BinCount = 8>
BVH_ALWAYS_INLINE bvh::v2::BinnedSahBuilder< Node, BinCount >::BinnedSahBuilder ( std::span< const BBox > bboxes,
std::span< const Vec > centers,
const Config & config )
inlineprotected

Definition at line 70 of file binned_sah_builder.h.

Member Function Documentation

◆ build() [1/2]

template<typename Node, size_t BinCount = 8>
BVH_ALWAYS_INLINE Bvh< Node > bvh::v2::BinnedSahBuilder< Node, BinCount >::build ( std::span< const BBox > bboxes,
std::span< const Vec > centers,
const Config & config = {} )
inlinestatic

Definition at line 32 of file binned_sah_builder.h.

◆ build() [2/2]

template<typename Node>
Bvh< Node > bvh::v2::TopDownSahBuilder< Node >::build ( )
inlineprotectedinherited

Definition at line 78 of file top_down_sah_builder.h.

◆ compute_bbox()

template<typename Node>
BVH_ALWAYS_INLINE BBox bvh::v2::TopDownSahBuilder< Node >::compute_bbox ( size_t begin,
size_t end ) const
inlineprotectedinherited

Definition at line 137 of file top_down_sah_builder.h.

◆ fallback_split()

template<typename Node, size_t BinCount = 8>
size_t bvh::v2::BinnedSahBuilder< Node, BinCount >::fallback_split ( size_t axis,
size_t begin,
size_t end )
inlineprotected

Definition at line 118 of file binned_sah_builder.h.

◆ fill_bins()

template<typename Node, size_t BinCount = 8>
BVH_ALWAYS_INLINE void bvh::v2::BinnedSahBuilder< Node, BinCount >::fill_bins ( PerAxisBins & per_axis_bins,
const BBox & bbox,
size_t begin,
size_t end )
inlineprotected

Definition at line 82 of file binned_sah_builder.h.

◆ find_best_split()

template<typename Node, size_t BinCount = 8>
void bvh::v2::BinnedSahBuilder< Node, BinCount >::find_best_split ( size_t axis,
const Bins & bins,
Split & best_split )
inlineprotected

Definition at line 101 of file binned_sah_builder.h.

◆ get_prim_ids() [1/2]

template<typename Node, size_t BinCount = 8>
std::vector< size_t > & bvh::v2::BinnedSahBuilder< Node, BinCount >::get_prim_ids ( )
inlineoverrideprotectedvirtual

Implements bvh::v2::TopDownSahBuilder< Node >.

Definition at line 80 of file binned_sah_builder.h.

◆ get_prim_ids() [2/2]

template<typename Node>
BVH_ALWAYS_INLINE const std::vector< size_t > & bvh::v2::TopDownSahBuilder< Node >::get_prim_ids ( ) const
inlineprotectedinherited

Definition at line 74 of file top_down_sah_builder.h.

◆ try_split()

template<typename Node, size_t BinCount = 8>
std::optional< size_t > bvh::v2::BinnedSahBuilder< Node, BinCount >::try_split ( const BBox & bbox,
size_t begin,
size_t end )
inlineoverrideprotectedvirtual

Implements bvh::v2::TopDownSahBuilder< Node >.

Definition at line 128 of file binned_sah_builder.h.

Member Data Documentation

◆ bboxes_

template<typename Node>
std::span<const BBox> bvh::v2::TopDownSahBuilder< Node >::bboxes_
protectedinherited

Definition at line 55 of file top_down_sah_builder.h.

◆ centers_

template<typename Node>
std::span<const Vec> bvh::v2::TopDownSahBuilder< Node >::centers_
protectedinherited

Definition at line 56 of file top_down_sah_builder.h.

◆ config_

template<typename Node>
const Config& bvh::v2::TopDownSahBuilder< Node >::config_
protectedinherited

Definition at line 57 of file top_down_sah_builder.h.

◆ prim_ids_

template<typename Node, size_t BinCount = 8>
std::vector<size_t> bvh::v2::BinnedSahBuilder< Node, BinCount >::prim_ids_
protected

Definition at line 68 of file binned_sah_builder.h.


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