Skip to content

[SOLID] [M2] Extract LOD-coloring and tree-hints from overworld_generator.zig #791

Description

@MichaelFisher1997

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

Problem

modules/worldgen-overworld/src/overworld_generator.zig (1,107 LOC) delegates terrain/biome to collaborators but inlines LOD color computation (biomeGrassTint/biomeFoliageTint/biomeWaterTint, 662-725), tree-hint computation (computeChunkTreeHints/choosePlacedTree/placeTreeOccupancy, 492-621), and material layering (makeMaterialLayers/surfaceTypeForBlock, 884-931).

Evidence

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

Fix

Extract two collaborators:

  • lod_coloring.zig (biomeGrassTint, biomeFoliageTint, biomeWaterTint)
  • tree_hints.zig (computeChunkTreeHints, choosePlacedTree, placeTreeOccupancy)

Material layering can stay or move to surface_builder.zig.

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

v1 is otherwise well-decomposed (P6 strength) — this completes that decomposition.

Tracking: #776

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingenhancementNew feature or requestworld

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions