1.9 KiB
1.9 KiB
Tasks: enterprise-gaming-r3f-terrain
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.
Phase 1 — Scaffold
- Create
gaming/scene/r3f-terrain/(@suaveplan/r3f-terrain,0.1.0,sideEffects: false)
Phase 2 — Error codes + types
src/error-codes.ts+src/types/common.ts+common.md
Phase 3 — Noise utility
src/utils/noise.ts— simplex 2D noise, octave FBM- Tests + docs
Phase 4 — Height sample utility
src/utils/height-sample.ts— world XZ → height value from active terrain- Tests + docs
Phase 5 — Chunk manager
- Camera-relative chunk loading/unloading, spatial hash for active set
- Tests + docs
Phase 6 — LOD controller
- Distance → subdivision level mapping, hysteresis band
- Tests + docs
Phase 7 — Terrain system
- Chunk generation with height + biome vertex color
- Tests + docs
Phase 8 — Components
TerrainChunk— single chunk meshTerrain— top-level system with chunk manager wiring- Tests + Storybook stories
Phase 9 — Integration + pre-publish gate
tests/integration.test.tsbunx turbo lint typecheck test --filter=@suaveplan/r3f-terraingreen- 100% coverage
- Publish:
bun scripts/publish.ts --package @suaveplan/r3f-terrain