Skip to content

Add volume management system for spatial acceleration of scene traversal and culling#63

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/design-volume-management-system
Draft

Add volume management system for spatial acceleration of scene traversal and culling#63
Copilot wants to merge 5 commits intomainfrom
copilot/design-volume-management-system

Conversation

Copy link

Copilot AI commented Feb 16, 2026

Introduces octree-backed spatial volume management to replace linear primitive iteration during frustum culling and spatial queries.

Core geometry additions

  • Sphere intersections (Shapes.h/.cpp): Sphere-Plane, Sphere-AABB, Sphere-Frustum
  • AABB helpers (AABB.h): GetCenter(), GetExtent(), IsValid(), Contains()
  • BoundingVolume (BoundingVolume.h): Type-erased wrapper over AABB/Sphere with frustum/AABB intersection dispatch

OctTree extension

  • Added ForeachWithNodeTest — generic traversal with a caller-supplied node-level predicate, enabling early subtree rejection (e.g. frustum vs node AABB)

VolumeManager (VolumeManager.h)

  • unordered_map<VolumeID, VolumeEntry> for O(1) lookup with pointer stability
  • Octree<VolumeEntry*> for spatial partitioning — pointers into the map, so octree IndexChanged callbacks update the canonical entry directly
  • FrustumCull: octree-accelerated traversal that skips entire subtrees outside the frustum, then refines per-element
  • QueryByAABB: delegates to existing octree bound test
  • AddVolume / RemoveVolume / UpdateVolume (remove + re-insert)

Render pipeline integration

  • RenderScene owns a VolumeManager; AddPrimitive/RemovePrimitive auto-register volumes
  • RenderPrimitive carries a volumeId for tracking
  • MeshRenderer::UpdateTransform syncs world bounds into the volume manager
// Frustum culling now uses octree acceleration
volumeManager.FrustumCull(frustum, [](const VolumeEntry &entry) {
    auto *prim = static_cast<RenderPrimitive*>(entry.userData);
    // primitive is visible
});

// Spatial queries (e.g. overlap tests, proximity)
volumeManager.QueryByAABB(queryBox, [](const VolumeEntry &entry) {
    // entry intersects queryBox
});

Tests

test/core/VolumeTest.cpp covers AABB helpers, all new intersection functions, BoundingVolume dispatch, and VolumeManager operations (add/remove/update/frustum cull/AABB query/user data).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 16, 2026 01:32
…tion

- Add AABB helper methods (GetCenter, GetExtent, IsValid, Contains)
- Add Sphere intersection functions (Sphere-Plane, Sphere-AABB, Sphere-Frustum)
- Create BoundingVolume abstraction unifying AABB and Sphere bounds
- Create VolumeManager using OctTree for spatial partitioning
- Integrate VolumeManager into RenderScene for primitive tracking
- Update MeshRenderer to sync volume bounds on transform changes
- Add comprehensive unit tests

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
…d frustum culling

- Use unordered_map for entries to ensure stable pointers
- Store pointers in octree to avoid stale index issues
- Add ForeachWithNodeTest to OctTree for custom node-level culling
- FrustumCull now skips entire octree subtrees outside the frustum

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot AI changed the title [WIP] Design volume management for scene traversal and culling Add volume management system for spatial acceleration of scene traversal and culling Feb 16, 2026
Copilot AI requested a review from bluesky013 February 16, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants