Skip to content

Commit 91cef9f

Browse files
committed
docs(CLAUDE): note TerrainMaterial/TerrainDebug split + timing observability
1 parent fc1dfe4 commit 91cef9f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

CLAUDE.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ SKILL.md and CLAUDE.md MUST update on every code change. SKILL.md = agent-facing
2929

3030
`createTerrainSystem(scene, args, sceneConfig)` in `client/TerrainSystem.js`. Infinite chunked FBM terrain generated in a Web Worker Blob URL. Auto-initialized in `client/app.js` `onWorldDef` from world config `terrain` field. Call `terrain.update(camera.position)` every animate frame.
3131

32-
- **TerrainSystem.js**: chunk lifecycle, Worker management, `window.__debug.terrain` observability
32+
- **TerrainSystem.js**: chunk lifecycle, Worker management
33+
- **TerrainMaterial.js**: `TERRAIN_DEFAULTS` + `createTerrainMaterial(sceneConfig)` ShaderMaterial factory
34+
- **TerrainDebug.js**: `attachTerrainDebug` / `detachTerrainDebug` — registers `window.__debug.terrain`
3335
- **TerrainShaders.js**: VERT_SHADER + FRAG_SHADER — biome blending, rock/grass/water/sand, simplex noise detail, fog
34-
- **TerrainWorkerSource.js**: self-contained worker JS — FBM noise, geometry + normal generation, transferable ArrayBuffer output
36+
- **TerrainWorkerSource.js**: self-contained worker JS — FBM noise, geometry + normal generation, transferable ArrayBuffer output. Echoes `t0` from postMessage so client can measure per-chunk build duration.
3537
- **TerrainNoise.js**: standalone `createFbmNoise` export for non-worker use
38+
- **TerrainBiomePalette.js**: `BIOME_KINDS` + `BIOME_PALETTE`. Worker reads only slots 0 (low) and 1 (high) per kind via `paletteColor(kind, slot)`
3639
- **Dependencies**: `simplex-noise` and `alea` npm packages
3740

3841
**World config integration**: add `terrain: { seed, octaves, frequency, amplitude, renderDistance, chunkSize, resolution, strength, ... }` to world config. `terrain: false` disables. Default values: `seed:0, octaves:10, frequency:0.07, amplitude:0.5, renderDistance:4, chunkSize:10, resolution:96, strength:2.8`. Defaults in `TERRAIN_DEFAULTS`.
3942

40-
**Debug API**: `window.__debug.terrain` exposes `{ chunks, pending, cfg }` where chunks = loaded cache, pending = generation queue, cfg = current config.
43+
**Debug API**: `window.__debug.terrain` exposes `{ chunks, pending, cfg, lodDist, timing, api }` where chunks = loaded cache size, pending = generation queue size, cfg = current config, lodDist = `{<resolution>: count}` map, timing = `{ samples, avg, p50, p95, max, workers }` rolling 60-chunk build duration in ms, api = direct system handle.
4144

4245
**Biomes**: desert (canyon-style with river cuts) blended with default (erosion, lakes, rivers) via low-frequency FBM. Blend controlled by `biome` vertex attribute passed to shader.
4346

0 commit comments

Comments
 (0)