Expand description
CPU BVH construction, query, traversal, and LBVH helpers.
Structs§
- Bvh
- A BVH tree built from a flat list of
BvhPrimitives.
Functions§
- build_
morton_ clusters - Compute clusters by grouping Morton-sorted
LbvhPrimitives into chunks ofcluster_sizeand returning aMortonClusterper group. - bvh_
closest_ hit - Traverse the BVH returning the closest hit (smallest positive t).
- compute_
bvh_ from_ sorted - Build a flat BVH from a pre-sorted (by Morton code) slice of
LbvhPrimitives using a radix-sort-inspired clustering strategy. - compute_
cluster_ radius - Compute the bounding sphere radius for a cluster of
LbvhPrimitives. - flatten
- Flatten a
Bvhinto aVec<FlatBvhNode>(DFS pre-order) together with a reordered primitive-index slice. - hlbvh_
split - Find the split index for a slice of Morton-code-sorted primitives using the highest differing bit (HLBVH strategy).
- lbvh_
build - Build an LBVH (Linear BVH) from a set of primitives using Morton-code sorting and a recursive binary splitting strategy.
- morton_
code - Compute a 30-bit Morton code for a 3D point normalised to [0, 1]^3.
- query_
flat - Iterative AABB query over a flat BVH.
- ray_
aabb_ intersect - Test whether a ray defined by
origin+ t * direction intersectsaabbwithin[0, max_t]. - refit
- Refit the bounding boxes of an existing BVH after primitives have moved.
- sah_
cost - Surface Area Heuristic cost:
C = (SA_left / SA_parent) * N_left + (SA_right / SA_parent) * N_right