20 #ifndef ANTKEEPER_GEOM_BVH_HPP
21 #define ANTKEEPER_GEOM_BVH_HPP
48 explicit bvh(std::span<const bvh_primitive> primitives);
58 constexpr
bvh() noexcept = default;
92 [[nodiscard]]
inline constexpr
const std::vector<bvh_node>&
nodes() const noexcept
98 void update_bounds(
bvh_node& node,
const std::span<const bvh_primitive>& primitives);
106 void subdivide(
bvh_node& node,
const std::span<const bvh_primitive>& primitives);
109 std::vector<std::uint32_t> m_primitive_indices;
110 std::vector<bvh_node> m_nodes;
111 std::uint32_t m_node_count{};
Boundary representation (B-rep) of a mesh.
Bounding volume hierarchy (BVH).
void clear()
Clears the BVH.
constexpr const std::vector< bvh_node > & nodes() const noexcept
Returns the BVH nodes.
void build(std::span< const bvh_primitive > primitives)
Constructs a BVH from a set of primitives.
constexpr bvh() noexcept=default
Constructs an empty BVH.
void visit(const geom::ray< float, 3 > &ray, const visitor_type &f) const
Visits the primitive indices of all BVH nodes that intersect a ray.
std::function< void(std::uint32_t)> visitor_type
Single node in a bounding volume hierarchy.
Half of a line proceeding from an initial point.