6#include <Common/assertion.h>
7#include <Common/utility.h>
12template<std::
size_t N,
typename Item>
13inline auto TBvhInfoNode<N, Item>
15 const std::array<const TBvhInfoNode*, N>& children,
16 const std::size_t singleSplitAxis)
19 PH_ASSERT_LT(singleSplitAxis, NO_AXIS_FLAG);
21 const auto splitAxis = lossless_cast<uint8>(singleSplitAxis);
24 internalNode.m_children = children;
25 internalNode.m_singleSplitAxis = splitAxis;
26 internalNode.m_isLeaf =
false;
28 for(std::size_t ci = 0; ci < children.size(); ++ci)
32 internalNode.m_aabb.unionWith(children[ci]->getAABB());
35 internalNode.m_perChildFlags[ci].splitAxis = splitAxis;
41template<std::
size_t N,
typename Item>
49 leafNode.m_items = leafItems;
50 leafNode.m_aabb = leafAabb;
51 leafNode.m_isLeaf =
true;
56template<std::
size_t N,
typename Item>
60 return numChildren() == 2;
63template<std::
size_t N,
typename Item>
71template<std::
size_t N,
typename Item>
79template<std::
size_t N,
typename Item>
83 , m_aabb(
AABB3D::makeEmpty())
85 , m_singleSplitAxis(NO_AXIS_FLAG)
89template<std::
size_t N,
typename Item>
92 if constexpr(!isBinary())
100template<std::
size_t N,
typename Item>
104 if constexpr(!isBinary())
112template<std::
size_t N,
typename Item>
118template<std::
size_t N,
typename Item>
125template<std::
size_t N,
typename Item>
130 PH_ASSERT_LT(childIdx, m_children.size());
132 return m_children[childIdx];
135template<std::
size_t N,
typename Item>
143template<std::
size_t N,
typename Item>
151template<std::
size_t N,
typename Item>
156 PH_ASSERT(isInternal());
157 PH_ASSERT(isSingleSplitAxis());
159 return m_singleSplitAxis;
162template<std::
size_t N,
typename Item>
167 PH_ASSERT(isInternal());
168 PH_ASSERT_LT(childIdx, m_perChildFlags.size());
170 return m_perChildFlags[childIdx].splitAxis;
173template<std::
size_t N,
typename Item>
177 PH_ASSERT(isInternal());
179 return m_singleSplitAxis != NO_AXIS_FLAG;
General BVH node packed with additional information. This node type is typically used for building ot...
Definition TLinearDepthFirstWideBvh.h:21
bool isBinaryLeaf() const
Definition TBvhInfoNode.ipp:90
TBvhInfoNode()
Definition TBvhInfoNode.ipp:80
bool isLeaf() const
Definition TBvhInfoNode.ipp:113
Definition TBvhItemInfo.h:11
Miscellaneous math utilities.
Math functions and utilities.
Definition TransformInfo.h:10
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