20template<std::
size_t N,
typename Item>
23template<std::
size_t N,
typename Item,
typename ItemToAABB>
27 static_assert(std::is_invocable_r_v<AABB3D, ItemToAABB, Item>);
29 inline static constexpr std::size_t MAX_SAH_BUCKETS = 64;
42 requires std::default_initializable<ItemToAABB>
47 ItemToAABB itemToAABB,
83 std::size_t numItems = 0;
94 template<EBvhNodeSplitMethod SPLIT_METHOD>
95 auto buildBvhInfoNodeRecursive(
99 bool binarySplitWithEqualItems(
101 std::size_t splitDimension,
105 bool binarySplitWithSahBuckets(
107 std::size_t splitDimension,
109 const AABB3D& itemsCentroidAABB,
113 bool splitWithEqualItems(
115 std::size_t splitDimension,
118 bool splitWithSahBuckets(
120 std::size_t splitDimension,
122 const AABB3D& itemsCentroidAABB,
125 void splitWithSahBucketsBacktracking(
126 std::size_t splitDimension,
129 std::size_t numSplits,
130 std::size_t splitBegin,
131 const std::array<std::size_t, N>& splitEnds,
134 std::array<std::size_t, N>* out_bestSplitEnds)
const;
136 std::vector<ItemInfoType> m_infoBuffer;
137 std::vector<InfoNodeType> m_infoNodes;
139 ItemToAABB m_itemToAABB;
Definition BvhParams.h:20
static TAABB3D makeEmpty()
Definition TAABB3D.ipp:15
Definition TBvhBuilder.h:25
auto buildInformativeBvh(TSpanView< Item > items) -> const InfoNodeType *
Build a BVH that contains additional information useful for many purposes. The built BVH has the foll...
Definition TBvhBuilder.ipp:36
void clearBuildData()
Definition TBvhBuilder.ipp:90
auto totalInfoNodes() const -> std::size_t
Definition TBvhBuilder.ipp:98
auto totalItems() const -> std::size_t
Definition TBvhBuilder.ipp:106
TBvhBuilder(BvhParams params=BvhParams{})
Definition TBvhBuilder.h:40
static std::size_t calcTotalItems(const InfoNodeType *node)
Definition TBvhBuilder.ipp:314
TBvhInfoNode< N, Item > InfoNodeType
Definition TBvhBuilder.h:32
static std::size_t calcTotalNodes(const InfoNodeType *node)
Definition TBvhBuilder.ipp:297
static std::size_t calcMaxDepth(const InfoNodeType *node)
Definition TBvhBuilder.ipp:331
General BVH node packed with additional information. This node type is typically used for building ot...
Definition TLinearDepthFirstWideBvh.h:21
Definition TBvhItemInfo.h:11
Math functions and utilities.
Definition TransformInfo.h:10
TAABB3D< real > AABB3D
Definition TAABB3D.h:21
std::span< const T, EXTENT > TSpanView
Same as TSpan, except that the objects are const-qualified. Note that for pointer types,...
Definition TSpan.h:19
std::span< T, EXTENT > TSpan
A contiguous sequence of objects of type T. Effectively the same as std::span.
Definition TSpan.h:12