Initial Commit
This commit is contained in:
57
openspec/changes/enterprise-gaming-r3f-terrain/proposal.md
Normal file
57
openspec/changes/enterprise-gaming-r3f-terrain/proposal.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-terrain
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-terrain
|
||||
- **Package**: `@suaveplan/r3f-terrain`
|
||||
- **Category**: gaming/scene
|
||||
- **Target path**: `gaming/scene/r3f-terrain`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/r3f-terrain.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-terrain` on the genesis branch from scratch at enterprise quality. The package provides procedural terrain with chunked LOD for React Three Fiber. A `TerrainSystem` divides world space into equal-size chunks; each chunk generates a height-mapped `PlaneGeometry` using a pluggable noise function (simplex, perlin, or caller-supplied); LOD is managed by camera distance — near chunks use high subdivision, far chunks use low. Biome tinting (grass/rock/snow) is applied via vertex color or shader. Genesis adds Zod chunk config schemas, structured errors, OTel chunk-load histogram, and 100% coverage.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, `@suaveplan/spatial-hash`, react, `@react-three/fiber`, `@react-three/drei`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface (key exports)
|
||||
|
||||
```ts
|
||||
function Terrain(props: TerrainProps): JSX.Element
|
||||
// - chunkSize, worldSize, maxLOD, heightScale, noiseFn, biomeMap
|
||||
|
||||
function useTerrainHeight(x: number, z: number): number // sample height at world position
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/scene/r3f-terrain/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts
|
||||
error-codes.ts
|
||||
constants/index.ts
|
||||
types/common.ts + md
|
||||
core/
|
||||
terrain-system/ (ts + md + types + test + index)
|
||||
chunk-manager/ (ts + md + types + test + index)
|
||||
lod-controller/ (ts + md + types + test + index)
|
||||
components/
|
||||
Terrain/ (tsx + md + test + stories + index)
|
||||
TerrainChunk/ (tsx + md + test + stories + index)
|
||||
utils/
|
||||
noise.ts + md + test
|
||||
height-sample.ts + md + test
|
||||
tests/integration.test.ts
|
||||
```
|
||||
Reference in New Issue
Block a user