mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +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:
@@ -119,6 +119,12 @@ ModelBvh buildModelBvh(const std::vector<BvhItem>& items,
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
ModelBvh buildModelBvhOne(const std::vector<BvhItem>& items, uint32_t model_id) {
|
||||
std::vector<uint32_t> idxs(items.size());
|
||||
for (uint32_t i = 0; i < items.size(); ++i) idxs[i] = i;
|
||||
return buildModelBvh(items, idxs, model_id);
|
||||
}
|
||||
|
||||
std::shared_ptr<BvhSet> buildBvhSet(const std::vector<BvhItem>& items) {
|
||||
auto bvh_set = std::make_shared<BvhSet>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user