7#include <Common/primitive_type.h>
8#include <Common/utility.h>
9#include <Common/compiler.h>
10#include <Common/memory.h>
24template<std::
size_t N,
typename Index>
27 static_assert(N >= 2);
28 static_assert(std::is_unsigned_v<Index>);
30 inline static constexpr std::size_t NUM_ITEMS_BITS = 5;
32 inline static constexpr uint8 X_AXIS_FLAG = 0b00;
33 inline static constexpr uint8 Y_AXIS_FLAG = 0b01;
34 inline static constexpr uint8 Z_AXIS_FLAG = 0b10;
35 inline static constexpr uint8 NO_AXIS_FLAG = 0b11;
43 inline static constexpr std::size_t
MAX_NODE_ITEMS = (std::size_t(1) << NUM_ITEMS_BITS) - 1;
49 N * 4, std::size_t(16), std::size_t(64));
56 bool isLeaf(std::size_t childIdx)
const;
80 std::size_t
numItems(std::size_t childIdx)
const;
85 std::size_t childOffset,
86 std::size_t splitAxis);
91 std::size_t itemOffset,
92 std::size_t splitAxis,
97 std::size_t splitAxis);
102 uint8 isLeaf : 1 =
true;
103 uint8 splitAxis : 2 = NO_AXIS_FLAG;
104 uint8 numItems : NUM_ITEMS_BITS = 0;
107 static_assert(
sizeof(ChildData) ==
sizeof(uint8));
119 std::array<Index, N> m_offsets;
128 std::array<ChildData, N> m_childrenData;
Definition TWideBvhNode.h:26
TWideBvhNode()
Creates a node that contains N empty leaves.
Definition TWideBvhNode.ipp:10
static constexpr std::size_t MAX_NODE_ITEMS
Definition TWideBvhNode.h:43
bool isInternal(std::size_t childIdx) const
Definition TWideBvhNode.ipp:70
std::size_t getSplitAxis(std::size_t childIdx) const
Definition TWideBvhNode.ipp:87
bool isLeaf(std::size_t childIdx) const
Definition TWideBvhNode.ipp:61
TWideBvhNode & setLeaf(std::size_t childIdx, const AABB3D &childAABB, std::size_t itemOffset, std::size_t splitAxis, std::size_t numItems)
Definition TWideBvhNode.ipp:142
std::size_t getChildOffset(std::size_t childIdx) const
Definition TWideBvhNode.ipp:77
TSpanView< real, N > getMaxVerticesOnAxis(std::size_t axis) const
Definition TWideBvhNode.ipp:51
TWideBvhNode & setInternal(std::size_t childIdx, const AABB3D &childAABB, std::size_t childOffset, std::size_t splitAxis)
Definition TWideBvhNode.ipp:115
std::size_t getItemOffset(std::size_t childIdx) const
Definition TWideBvhNode.ipp:95
TSpanView< real, N > getMinVerticesOnAxis(std::size_t axis) const
Obtain a view to min. and max. vertices of the child AABBs in SoA layout.
Definition TWideBvhNode.ipp:41
std::size_t numItems(std::size_t childIdx) const
Definition TWideBvhNode.ipp:105
AABB3D getAABB(std::size_t childIdx) const
Definition TWideBvhNode.ipp:29
TWideBvhNode & setEmptyLeaf(std::size_t childIdx, std::size_t splitAxis)
Definition TWideBvhNode.ipp:171
static constexpr std::size_t SOA_VIEW_ALIGNMENT
Definition TWideBvhNode.h:48
constexpr std::size_t Y_AXIS
Definition constant.h:91
constexpr std::size_t Z_AXIS
Definition constant.h:92
constexpr std::size_t X_AXIS
Definition constant.h:90
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