scena3d 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -8
- package/dist/index.cjs +786 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +280 -3
- package/dist/index.d.ts +280 -3
- package/dist/index.js +774 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -54,15 +54,16 @@ game.onUpdate(() => { // ← SC
|
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Neither library imports the other — the obstacle shape (`{ center, radius }`) is structural. Run the full demo (`npm run dev
|
|
57
|
+
Neither library imports the other — the obstacle shape (`{ center, radius }`) is structural. Run the full demo (`npm run dev` — gama3d comes from npm): a day-night cycle over terrain, lakes, a windblown forest, a seeded hamlet whose windows ignite at dusk, and a dirt road whose single authored curve is at once the visual ribbon, the scatter keep-out, and the wardens' patrol route. Append `?t=0.85` to freeze the time of day.
|
|
58
58
|
|
|
59
59
|
## API
|
|
60
60
|
|
|
61
61
|
| Area | Exports |
|
|
62
62
|
|---|---|
|
|
63
|
-
| Props | `createTree`, `createRock`, `createCrate`, `createFence`, `createLamp` — each returns `{ object, obstacleRadius }` |
|
|
64
|
-
| Environment | `createTerrain` (with `heightAt(x, z)`), `createSky`, `createLightingRig(
|
|
63
|
+
| Props | `createTree`, `createRock`, `createCrate`, `createFence`, `createLamp`, `createBush`, `createGrassTuft`, `createHouse`, `createTower`, `createWell`, `createRuin` — each returns `{ object, obstacleRadius }` |
|
|
64
|
+
| Environment | `createTerrain` (with `heightAt(x, z)` and `waterLevel` sand bands), `createSky`, `createLightingRig(...)`, `applyFog(...)`, `createWater` + `aboveWater` mask, `createDayCycle` (one `timeOfDay` drives sun/sky/fog/lamps), `applyWind` (vegetation sway), `createPath` (ribbon + patrol route + keep-out from one curve) |
|
|
65
65
|
| Scattering | `scatter({ seed, area, surface, density \| count, items, mask, minSpacing, keepOut })` → `{ group, placements, obstacles, count }` |
|
|
66
|
+
| Generators | `createVillage({ seed, center, radius, houses, surface, mask })` → `{ group, props, obstacles, lamps, keepOut }` — a hamlet whose windows and lamps hand straight to `createDayCycle`, buildings to `ObstacleAvoidance`, clearing to `scatter` |
|
|
66
67
|
| Core | `Rng` (seeded), `valueNoise2`/`fractalNoise2`, `PALETTES`, `collectObstacles` |
|
|
67
68
|
|
|
68
69
|
Scatter placement uses density noise for natural clumping and clearings, a spatial hash for minimum spacing, and per-item visual variants; rendering merges everything into `InstancedMesh`es (one draw call per prop part).
|
|
@@ -72,11 +73,16 @@ Scatter placement uses density noise for natural clumping and clearings, a spati
|
|
|
72
73
|
- [x] Seeded props with obstacle metadata (tree, rock, crate, fence, lamp)
|
|
73
74
|
- [x] Instanced `scatter()` with masks, keep-out, spacing and clumping
|
|
74
75
|
- [x] Noise terrain with exact `heightAt` and height/slope color bands
|
|
75
|
-
- [x] Sky dome, lighting rigs, fog presets,
|
|
76
|
+
- [x] Sky dome, lighting rigs, fog presets, four theme palettes (incl. `winter`)
|
|
77
|
+
- [x] Water with shoreline masks; terrain sand bands
|
|
78
|
+
- [x] Day-night cycle: one `timeOfDay` drives sun, sky, fog and lamps igniting at dusk
|
|
79
|
+
- [x] Wind sway on scattered vegetation (per-instance phase)
|
|
80
|
+
- [x] Paths: one curve = visual ribbon + scatter keep-out + GAMA patrol route
|
|
81
|
+
- [x] Seed-stability snapshot tests (output frozen within a minor version)
|
|
82
|
+
- [x] Buildings (house, watchtower, well) and ruins; `createVillage` hamlet generator with the full gameplay handshake
|
|
76
83
|
- [ ] Kits: dungeon/village pieces with shared snap dimensions
|
|
77
84
|
- [ ] Declarative scene manifests (JSON → scene), Blender marker conventions (`spawn_*`, `route_*`, `nav_*`)
|
|
78
|
-
- [ ]
|
|
79
|
-
- [ ] Buildings/ruins generators; LOD tiers for scatter
|
|
85
|
+
- [ ] LOD tiers for scatter
|
|
80
86
|
- [ ] CC0 asset-pack adapters (Kenney/Quaternius) and a KTX2/Draco pipeline
|
|
81
87
|
- [ ] Docs site with live playground (reusing GAMA's runner)
|
|
82
88
|
|
|
@@ -84,10 +90,10 @@ Scatter placement uses density noise for natural clumping and clearings, a spati
|
|
|
84
90
|
|
|
85
91
|
```bash
|
|
86
92
|
npm install
|
|
87
|
-
npm test #
|
|
93
|
+
npm test # 49 vitest unit tests (determinism, metadata, scatter rules, snapshots)
|
|
88
94
|
npm run typecheck
|
|
89
95
|
npm run build # tsup → dist (ESM + CJS + d.ts)
|
|
90
|
-
npm run dev # the SCENA × GAMA forest demo
|
|
96
|
+
npm run dev # the SCENA × GAMA living-forest demo
|
|
91
97
|
```
|
|
92
98
|
|
|
93
99
|
## License
|