mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
BVH frustum culling over instances
Re-wires the BVH acceleration structure on top of the new instanced renderer. Per model, build a BVH over per-instance world AABBs at finalize (and on sidecar apply). Each frame, traverse the BVH against the camera frustum to produce a visible-instance index list, bucket by mesh_id, and upload to a per-model SSBO at binding=1. The main and pick vertex shaders do a double-indirection `instances[visible[u_offset + gl_InstanceID]]` so draws only touch instances that passed the frustum test. Models with fewer than BVH_MIN_OBJECTS instances skip the BVH build and fall back to a linear per-instance frustum test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,4 +63,8 @@ struct BvhSet {
|
||||
// vector — callers providing a single model's items will see 0..N-1.
|
||||
std::shared_ptr<BvhSet> buildBvhSet(const std::vector<BvhItem>& items);
|
||||
|
||||
// Build a single-model BVH over `items`. model_id is stored on the result
|
||||
// for identification; item_indices will be 0..items.size()-1.
|
||||
ModelBvh buildModelBvhOne(const std::vector<BvhItem>& items, uint32_t model_id);
|
||||
|
||||
#endif // BVHACCEL_H
|
||||
|
||||
Reference in New Issue
Block a user