1#ifndef BVH_V2_DEFAULT_BUILDER_H
2#define BVH_V2_DEFAULT_BUILDER_H
14template <
typename Node>
35 std::span<const BBox> bboxes,
36 std::span<const Vec> centers,
39 if (bboxes.size() < config.parallel_threshold)
40 return build(bboxes, centers, config);
50 std::span<const BBox> bboxes,
51 std::span<const Vec> centers,
72 return mini_tree_config;
This builder is only a wrapper around all the other builders, which selects the best builder dependin...
typename Node::Scalar Scalar
static BVH_ALWAYS_INLINE auto make_mini_tree_config(const Config &config)
static BVH_ALWAYS_INLINE Bvh< Node > build(std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config={})
Build a BVH in a single-thread.
static BVH_ALWAYS_INLINE Bvh< Node > build(ThreadPool &thread_pool, std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config={})
Build a BVH in parallel using the given thread pool.
static BVH_ALWAYS_INLINE Bvh< Node > build(ThreadPool &thread_pool, std::span< const BBox > bboxes, std::span< const Vec > centers, const Config &config={})
Starts building a BVH with the given primitive data.
static void optimize(ThreadPool &thread_pool, Bvh< Node > &bvh, const Config &config={})
Base class for all SAH-based, top-down builders.
Quality quality
The quality of the BVH produced by the builder.
size_t parallel_threshold
Threshold, in number of primitives, under which the builder operates in a single-thread.
Scalar pruning_area_ratio
Threshold on the area of a mini-tree node above which it is pruned, expressed in fraction of the area...
bool enable_pruning
Flag that turns on/off mini-tree pruning.
size_t parallel_threshold
Minimum number of primitives per parallel task.