feat: add scene graph with spatial indexing and object placement#96
Merged
ViTeXFTW merged 3 commits intofeat/terrain-renderingfrom Feb 23, 2026
Merged
Conversation
Adds SceneNode/Quadtree/SceneGraph spatial indexing infrastructure and ObjectNode/ObjectResolver/ObjectPlacementUtils for placing W3D models at map object positions with correct coordinate-system conversion. - SceneNode: base class with position/rotationY/scale transforms, local and world bounding boxes, visibility flag, and worldTransform() matrix - Quadtree: 2D spatial index in X/Z plane with frustum and rect queries; center-based single-child insertion avoids duplicate query results; subdivide() accesses nodes by index (not reference) to avoid UB from vector reallocation during push_back - SceneGraph: owns SceneNodes, maintains Quadtree, provides queryVisible() for frustum-culled queries and queryAll() for full iteration - ObjectNode: SceneNode subclass wrapping HLodModel* with templated draw() composing worldTransform with per-bone transforms; fromMapObject() factory - ObjectPlacementUtils: Vulkan-free static utilities (templateNameToW3DName, mapPositionToVulkan Z-up->Y-up, isRoadPoint, isBridgePoint, shouldRender) - ObjectResolver: caches loaded HLodModels by template name; resolve() looks up W3D path via AssetRegistry, extracts from BIG archive, parses and caches - 47 new tests (scene_tests + object_resolver_tests); 100% pass rate https://claude.ai/code/session_01JKxTAtdKkNECTCaiVV5Ywz
Owner
Author
Greptile SummaryImplemented scene graph system with spatial indexing for efficient object placement and rendering queries. The PR adds a quadtree-based SceneGraph with SceneNode base class, ObjectNode for W3D models, and ObjectResolver for template-to-model caching. Major Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: d741f30 |
…Render inconsistency - Fix critical bug in Quadtree::subdivide() where depth was hardcoded to 1 when re-inserting entries after subdivision, causing incorrect depth tracking for multi-level trees. Pass depth through to subdivide() and use it when calling insertInto() to preserve correct tree depth. - Fix MapObject::shouldRender() to exclude road/bridge points, aligning it with ObjectPlacementUtils::shouldRender(). Road/bridge points are placement markers, not renderable models, so both call sites now agree. - Add regression test SubdivisionDepthIsTrackedCorrectly to verify that multi-level subdivision respects maxDepth limits. https://claude.ai/code/session_01JKxTAtdKkNECTCaiVV5Ywz
Owner
Author
Greptile SummaryThis PR implements a complete scene graph system with spatial indexing for efficient object management in the map viewer. The implementation addresses previous review feedback and maintains consistency across the codebase.
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: f20af65 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a complete scene graph system with spatial indexing capabilities, along with utilities for object placement and resolution. The implementation provides efficient spatial queries for rendering and includes comprehensive test coverage.
Key Changes
Scene Graph Infrastructure
Object Placement & Resolution
Testing
Implementation Details
https://claude.ai/code/session_01JKxTAtdKkNECTCaiVV5Ywz