Expand description
Top-down median-split bounding volume hierarchy over a set of AABBs.
The renderer builds one BVH at GraphicsSystem init time from every cullable DrawObject (objects without a finite AABB go into a separate fallback list). Each frame the main pass traverses the BVH with the camera’s frustum and optional distance cutoff, producing a list of DrawObject indices to render.
The BVH is static after construction: it does not refit when leaf AABBs change. Props that move at runtime (held items, animated transforms) must opt out of culling by setting a non-finite AABB (UNCULLED_BB in draw_list).
Construction is O(N log N) (sort + recurse); query is O(log N + V) where V is the number of visible leaves. Single-item scenes degenerate to a leaf at the root; an empty scene produces no nodes and trivially answers “no visible objects”.
Structs§
- Bvh
- A bounding-volume hierarchy over cullable draw records.
Functions§
- partition_
draw_ objects - Partition the draw list into cullable leaves (suitable for BVH insertion) and an always-drawn fallback list. Objects that opt out of culling (skybox, rooms, held props) keep their original draw order via the returned index list; the BVH owns everything else.