Skip to content

[SOLID] [M6] Extract LpvGridBuilder from world.zig facade #789

Description

@MichaelFisher1997

Part of #776 — SOLID architecture debt umbrella.
Phase: P1 · Finding: M6

Problem

modules/world-runtime/src/world.zig:717-831 embeds ~115 lines of dense triple-nested voxel iteration (lpvCollectLights, lpvBuildOcclusionGrid) directly in the World facade. A lighting subsystem does not belong in the facade.

Evidence

(Full evidence and file:line citations are in the umbrella #776.)

Fix

Extract into an LpvGridBuilder collaborator (e.g. modules/engine-lighting/src/lpv_grid_builder.zig or a new world-runtime module). World holds/invokes it.

Verification

  • nix develop --command zig build test (includes shader validation)
  • If rendering-touching: capture headless screenshot baseline before/after (-Dskip-present)
  • If behavior-preserving refactor: golden-output test must stay green

Constraints

  • Small reviewable PR targeting dev; conventional commit (refactor: / feat:)
  • Preserve current behavior unless this issue explicitly changes it
  • Keep worker-thread RHI isolation intact (no RHI calls off main thread)

Notes

World is otherwise a clean facade (delegates to WorldStreamer/Renderer/Mutation/LOD/Save). This is the main SRP leak.

Tracking: #776

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or requestworld

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions