@threenative/terrain 0.1.11 → 0.1.12

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.
Files changed (218) hide show
  1. package/README.md +1 -0
  2. package/dist/bake-DJ5cxg0C.d.ts +82 -0
  3. package/dist/editor/index.d.ts +4 -4
  4. package/dist/editor/index.js +1 -1
  5. package/dist/editor/server.d.ts +2 -2
  6. package/dist/editor/worker.d.ts +1 -1
  7. package/dist/editor/worker.js +1 -1
  8. package/dist/export.d.ts +1 -1
  9. package/dist/index.d.ts +51 -222
  10. package/dist/index.js +111 -2
  11. package/dist/kit-world.d.ts +107 -0
  12. package/dist/kit-world.js +5134 -0
  13. package/dist/kit.d.ts +21 -4
  14. package/dist/kit.js +19 -4
  15. package/dist/mcp/cook-child.js +9 -6
  16. package/dist/mcp/server.js +14 -4
  17. package/dist/prop-package-Dwz0EWoB.d.ts +141 -0
  18. package/dist/{server-B5RdvEAC.d.ts → server-LnFwY8sr.d.ts} +1 -1
  19. package/dist/starter.d.ts +1141 -6
  20. package/dist/starter.js +1999 -17
  21. package/dist/{terrain-CAEaW0mQ.d.ts → terrain-DYCyAOCJ.d.ts} +1 -1
  22. package/dist/three.d.ts +1 -1
  23. package/dist/{types-BpH00qsx.d.ts → types-kpI0C4hW.d.ts} +1 -1
  24. package/dist/{world-package-B8QgHjAQ.d.ts → world-package-DqJC3-Nn.d.ts} +2 -2
  25. package/docs/authoring/new-environment.md +97 -0
  26. package/package.json +8 -8
  27. package/starter/alpine/README.md +22 -14
  28. package/starter/alpine/bake.mjs +14 -1
  29. package/starter/alpine/biome.data.json +187 -25
  30. package/starter/alpine/heightmap.r16 +0 -0
  31. package/starter/alpine/playerRig.ts +89 -0
  32. package/starter/alpine/recipe.json +169 -15
  33. package/starter/alpine/render/bakedFile.ts +17 -0
  34. package/starter/alpine/render/benchmark.ts +77 -0
  35. package/starter/alpine/render/biomeData.ts +14 -0
  36. package/starter/alpine/render/biomes.ts +687 -0
  37. package/starter/alpine/render/ground/cover.ts +565 -0
  38. package/starter/alpine/render/ground/horizon.ts +219 -0
  39. package/starter/alpine/render/ground/palette.d.ts +1 -0
  40. package/starter/alpine/render/ground/palette.js +11 -0
  41. package/starter/alpine/render/ground/scatter.ts +104 -0
  42. package/starter/alpine/render/ground/terrain.ts +1860 -0
  43. package/starter/alpine/render/kitAssets.ts +28 -0
  44. package/starter/alpine/render/loading.ts +354 -0
  45. package/starter/alpine/render/lookKnobs.ts +37 -0
  46. package/starter/alpine/render/orbitCamera.ts +155 -0
  47. package/starter/alpine/render/props/farForest.ts +94 -0
  48. package/starter/alpine/render/props/pack.ts +1114 -0
  49. package/starter/alpine/render/props/prepared.ts +225 -0
  50. package/starter/alpine/render/props/propMaterials.ts +1239 -0
  51. package/starter/alpine/render/props/propProgress.ts +2 -0
  52. package/starter/alpine/render/props/propWorld.ts +105 -0
  53. package/starter/alpine/render/props/props.ts +633 -0
  54. package/starter/alpine/render/props/spruce.ts +440 -0
  55. package/starter/alpine/render/sky/atmosphere.ts +329 -0
  56. package/starter/alpine/render/sky/sky.ts +382 -0
  57. package/starter/alpine/render/texturePreparation.ts +135 -0
  58. package/starter/alpine/render/water/river.ts +1132 -0
  59. package/starter/alpine/render/worldNames.ts +6 -0
  60. package/starter/alpine/scene.ts +715 -0
  61. package/starter/alpine/sceneProps.ts +561 -0
  62. package/starter/alpine/sceneState.ts +33 -0
  63. package/starter/alpine/world/terrainAssets.ts +145 -0
  64. package/starter/alpine/world/walkBand.ts +47 -0
  65. package/starter/alpine/world/water.ts +74 -0
  66. package/starter/alpine/worlds.ts +13 -0
  67. package/starter/coastal/README.md +26 -27
  68. package/starter/coastal/assets.json +10 -0
  69. package/starter/coastal/bake.mjs +14 -1
  70. package/starter/coastal/biome.data.json +18 -3
  71. package/starter/coastal/playerRig.ts +89 -0
  72. package/starter/coastal/recipe.json +220 -18
  73. package/starter/coastal/render/bakedFile.ts +17 -0
  74. package/starter/coastal/render/benchmark.ts +81 -0
  75. package/starter/coastal/render/biomeData.ts +14 -0
  76. package/starter/coastal/render/biomes.ts +678 -0
  77. package/starter/coastal/render/ground/cover.ts +565 -0
  78. package/starter/coastal/render/ground/horizon.ts +219 -0
  79. package/starter/coastal/render/ground/palette.d.ts +1 -0
  80. package/starter/coastal/render/ground/palette.js +11 -0
  81. package/starter/coastal/render/ground/scatter.ts +104 -0
  82. package/starter/coastal/render/ground/terrain.ts +1829 -0
  83. package/starter/coastal/render/kitAssets.ts +28 -0
  84. package/starter/coastal/render/loading.ts +354 -0
  85. package/starter/coastal/render/lookKnobs.ts +37 -0
  86. package/starter/coastal/render/orbitCamera.ts +155 -0
  87. package/starter/coastal/render/props/farForest.ts +94 -0
  88. package/starter/coastal/render/props/pack.ts +1109 -0
  89. package/starter/coastal/render/props/prepared.ts +225 -0
  90. package/starter/coastal/render/props/propMaterials.ts +1239 -0
  91. package/starter/coastal/render/props/propProgress.ts +2 -0
  92. package/starter/coastal/render/props/propWorld.ts +105 -0
  93. package/starter/coastal/render/props/props.ts +633 -0
  94. package/starter/coastal/render/props/spruce.ts +440 -0
  95. package/starter/coastal/render/sky/atmosphere.ts +329 -0
  96. package/starter/coastal/render/sky/sky.ts +382 -0
  97. package/starter/coastal/render/texturePreparation.ts +135 -0
  98. package/starter/coastal/render/water/ocean.ts +284 -0
  99. package/starter/coastal/render/water/river.ts +1132 -0
  100. package/starter/coastal/render/worldNames.ts +6 -0
  101. package/starter/coastal/scene.ts +740 -0
  102. package/starter/coastal/sceneProps.ts +559 -0
  103. package/starter/coastal/sceneState.ts +33 -0
  104. package/starter/coastal/world/terrainAssets.ts +151 -0
  105. package/starter/coastal/world/walkBand.ts +47 -0
  106. package/starter/coastal/world/water.ts +74 -0
  107. package/starter/coastal/worlds.ts +13 -0
  108. package/starter/desert/README.md +51 -25
  109. package/starter/desert/bake-flora.mjs +142 -0
  110. package/starter/desert/bake-rocks.mjs +291 -0
  111. package/starter/desert/bake.mjs +14 -1
  112. package/starter/desert/biome.data.json +24 -12
  113. package/starter/desert/playerRig.ts +89 -0
  114. package/starter/desert/recipe.json +63 -16
  115. package/starter/desert/render/bakedFile.ts +17 -0
  116. package/starter/desert/render/benchmark.ts +79 -0
  117. package/starter/desert/render/biomeData.ts +14 -0
  118. package/starter/desert/render/biomes.ts +660 -0
  119. package/starter/desert/render/ground/cover.ts +565 -0
  120. package/starter/desert/render/ground/debris.ts +136 -0
  121. package/starter/desert/render/ground/horizon.ts +219 -0
  122. package/starter/desert/render/ground/palette.d.ts +1 -0
  123. package/starter/desert/render/ground/palette.js +11 -0
  124. package/starter/desert/render/ground/scatter.ts +104 -0
  125. package/starter/desert/render/ground/terrain.ts +1854 -0
  126. package/starter/desert/render/kitAssets.ts +28 -0
  127. package/starter/desert/render/loading.ts +354 -0
  128. package/starter/desert/render/lookKnobs.ts +37 -0
  129. package/starter/desert/render/orbitCamera.ts +155 -0
  130. package/starter/desert/render/props/farForest.ts +96 -0
  131. package/starter/desert/render/props/formations.ts +630 -0
  132. package/starter/desert/render/props/pack.ts +1195 -0
  133. package/starter/desert/render/props/prepared.ts +225 -0
  134. package/starter/desert/render/props/propMaterials.ts +1255 -0
  135. package/starter/desert/render/props/propProgress.ts +2 -0
  136. package/starter/desert/render/props/propWorld.ts +105 -0
  137. package/starter/desert/render/props/props.ts +624 -0
  138. package/starter/desert/render/props/spruce.ts +440 -0
  139. package/starter/desert/render/sand.ts +581 -0
  140. package/starter/desert/render/sky/atmosphere.ts +329 -0
  141. package/starter/desert/render/sky/sky.ts +382 -0
  142. package/starter/desert/render/texturePreparation.ts +135 -0
  143. package/starter/desert/render/water/river.ts +1132 -0
  144. package/starter/desert/render/worldNames.ts +6 -0
  145. package/starter/desert/scene.ts +748 -0
  146. package/starter/desert/sceneProps.ts +562 -0
  147. package/starter/desert/sceneState.ts +33 -0
  148. package/starter/desert/world/terrainAssets.ts +162 -0
  149. package/starter/desert/world/walkBand.ts +47 -0
  150. package/starter/desert/world/water.ts +74 -0
  151. package/starter/desert/worlds.ts +13 -0
  152. package/starter/forest/README.md +8 -5
  153. package/starter/forest/bake.mjs +21 -413
  154. package/starter/forest/playerRig.ts +37 -171
  155. package/starter/forest/recipe.json +237 -47
  156. package/starter/forest/render/biomes.ts +2 -1
  157. package/starter/forest/render/ground/horizon.ts +4 -302
  158. package/starter/forest/render/ground/terrain.ts +14 -32
  159. package/starter/forest/render/kitAssets.ts +3 -2
  160. package/starter/forest/render/props/farForest.ts +2 -1
  161. package/starter/forest/render/props/pack.ts +4 -2
  162. package/starter/forest/render/props/prepared.ts +2 -1
  163. package/starter/forest/render/props/propProgress.ts +1 -11
  164. package/starter/forest/render/props/propWorld.ts +48 -662
  165. package/starter/forest/render/props/props.ts +64 -248
  166. package/starter/forest/render/sky/sky.ts +2 -1
  167. package/starter/forest/render/worldNames.ts +6 -2
  168. package/starter/forest/scene.ts +34 -25
  169. package/starter/forest/sceneProps.ts +2 -2
  170. package/starter/forest/sceneState.ts +5 -4
  171. package/starter/forest/surface.json +2 -2
  172. package/starter/forest/worlds.ts +3 -2
  173. package/starter/tundra/README.md +35 -16
  174. package/starter/tundra/bake.mjs +14 -1
  175. package/starter/tundra/biome.data.json +6 -6
  176. package/starter/tundra/playerRig.ts +89 -0
  177. package/starter/tundra/recipe.json +111 -110
  178. package/starter/tundra/render/bakedFile.ts +17 -0
  179. package/starter/tundra/render/benchmark.ts +79 -0
  180. package/starter/tundra/render/biomeData.ts +14 -0
  181. package/starter/tundra/render/biomes.ts +714 -0
  182. package/starter/tundra/render/ground/cover.ts +565 -0
  183. package/starter/tundra/render/ground/horizon.ts +219 -0
  184. package/starter/tundra/render/ground/palette.d.ts +1 -0
  185. package/starter/tundra/render/ground/palette.js +11 -0
  186. package/starter/tundra/render/ground/scatter.ts +104 -0
  187. package/starter/tundra/render/ground/terrain.ts +1874 -0
  188. package/starter/tundra/render/kitAssets.ts +28 -0
  189. package/starter/tundra/render/loading.ts +354 -0
  190. package/starter/tundra/render/lookKnobs.ts +37 -0
  191. package/starter/tundra/render/orbitCamera.ts +155 -0
  192. package/starter/tundra/render/props/farForest.ts +96 -0
  193. package/starter/tundra/render/props/pack.ts +1088 -0
  194. package/starter/tundra/render/props/prepared.ts +225 -0
  195. package/starter/tundra/render/props/propMaterials.ts +1247 -0
  196. package/starter/tundra/render/props/propProgress.ts +2 -0
  197. package/starter/tundra/render/props/propWorld.ts +105 -0
  198. package/starter/tundra/render/props/props.ts +624 -0
  199. package/starter/tundra/render/props/spruce.ts +440 -0
  200. package/starter/tundra/render/sky/atmosphere.ts +329 -0
  201. package/starter/tundra/render/sky/sky.ts +382 -0
  202. package/starter/tundra/render/texturePreparation.ts +135 -0
  203. package/starter/tundra/render/water/river.ts +1132 -0
  204. package/starter/tundra/render/worldNames.ts +6 -0
  205. package/starter/tundra/scene.ts +715 -0
  206. package/starter/tundra/sceneProps.ts +559 -0
  207. package/starter/tundra/sceneState.ts +33 -0
  208. package/starter/tundra/world/terrainAssets.ts +159 -0
  209. package/starter/tundra/world/walkBand.ts +47 -0
  210. package/starter/tundra/world/water.ts +74 -0
  211. package/starter/tundra/worlds.ts +13 -0
  212. package/starter-assets.json +4 -4
  213. package/starter-credits.json +613 -10
  214. package/starter/forest/diagnostics.ts +0 -1020
  215. package/starter/forest/render/sky/skyVisibility.ts +0 -121
  216. package/starter/forest/spawnGate.ts +0 -183
  217. package/starter/forest/viewStatistics.ts +0 -47
  218. package/starter/forest/world/streamedGround.ts +0 -139
package/dist/kit.d.ts CHANGED
@@ -1,7 +1,16 @@
1
- import { I as ITerrainState } from './types-BpH00qsx.js';
2
- import { I as IWorldPackageAsset, a as IWorldPackageManifest, b as bakeWorldPackage } from './world-package-B8QgHjAQ.js';
1
+ import { IKitWorldLook } from './kit-world.js';
2
+ export { IKitWorldRecipe } from './kit-world.js';
3
+ import { I as ITerrainState } from './types-kpI0C4hW.js';
4
+ import { b as IWorldPackageAsset, I as IWorldPackageManifest, c as bakeWorldPackage } from './world-package-DqJC3-Nn.js';
5
+ import './bake-DJ5cxg0C.js';
6
+ import './terrain-DYCyAOCJ.js';
3
7
  import '@threenative/core/world';
4
8
 
9
+ /**
10
+ * The sky HDRI a cook copies into a world's `sky.hdr`, and the file a kit's credits must record.
11
+ * One name, so the cook and the scaffolder cannot credit two different skies.
12
+ */
13
+ declare const DEFAULT_SKY_HDRI = "hdri/kloofendal_48d_partly_cloudy_1k.hdr";
5
14
  /**
6
15
  * Resolve shared starter assets locally, or download the package's pinned archive on demand.
7
16
  * @situation resolve terrain kit models and textures for offline baking
@@ -37,6 +46,7 @@ interface IKitCookInput {
37
46
  }
38
47
  interface IBakeKitOptions {
39
48
  readonly sky: string;
49
+ readonly look?: undefined;
40
50
  /** Supplied by the kit; terrain does not depend on the optional asset cook. */
41
51
  readonly cookTerrainWorld?: (input: IKitCookInput) => Promise<{
42
52
  manifest: IWorldPackageManifest;
@@ -45,6 +55,13 @@ interface IBakeKitOptions {
45
55
  worldPackage?: ReturnType<typeof bakeWorldPackage>;
46
56
  }>;
47
57
  }
58
+ /**
59
+ * A streamed world: `recipe.json`'s `world` row names what bakes beyond the terrain, and the kit's
60
+ * look and prop policy come from its own source. `--out` defaults to `assets/terrain/<name>`.
61
+ */
62
+ interface IBakeKitWorldOptions {
63
+ readonly look: IKitWorldLook;
64
+ }
48
65
  /**
49
66
  * Bake a copied kit, optionally using the caller's installed world cook.
50
67
  * @situation bake a copied terrain starter kit into its offline world package
@@ -52,6 +69,6 @@ interface IBakeKitOptions {
52
69
  * @requires npm i -D @threenative/terrain
53
70
  * @example await bakeKit(import.meta.url, { sky: "hdri/game-sky.hdr" });
54
71
  */
55
- declare function bakeKit(url: string, { sky, cookTerrainWorld }: IBakeKitOptions): Promise<void>;
72
+ declare function bakeKit(url: string, options: IBakeKitOptions | IBakeKitWorldOptions): Promise<void>;
56
73
 
57
- export { type IBakeKitOptions, bakeKit, starterAssetsDir };
74
+ export { DEFAULT_SKY_HDRI, type IBakeKitOptions, type IBakeKitWorldOptions, IKitWorldLook, bakeKit, starterAssetsDir };
package/dist/kit.js CHANGED
@@ -241,6 +241,7 @@ async function extract(archive, target) {
241
241
  }
242
242
  fail("END");
243
243
  }
244
+ var DEFAULT_SKY_HDRI = "hdri/kloofendal_48d_partly_cloudy_1k.hdr";
244
245
  async function starterAssetsDir() {
245
246
  const root = dirname(fileURLToPath(import.meta.resolve("@threenative/terrain/package.json")));
246
247
  const local = join(root, "starter-assets");
@@ -290,7 +291,7 @@ async function starterAssetsDir() {
290
291
  }
291
292
  return cache;
292
293
  }
293
- var PACKAGE = "@threenative/procedural-vegetation";
294
+ var PACKAGE = "@threenative/procedural-environment";
294
295
  var SPECIES = /^arbor:([a-z0-9]+)(?:@(\d{1,9}))?$/u;
295
296
  var LODS = [1, 2];
296
297
  function parseArborSpecies(species) {
@@ -2680,11 +2681,10 @@ function flag(name, fallback) {
2680
2681
  }
2681
2682
  return resolve(value);
2682
2683
  }
2683
- async function bakeKit(url, { sky, cookTerrainWorld }) {
2684
+ async function bakeKit(url, options) {
2684
2685
  assertDistFresh();
2685
2686
  const here = dirname(fileURLToPath(url));
2686
2687
  const assetsDir = process.argv.includes("--assets") ? flag("assets", "") : await starterAssetsDir();
2687
- const outDir = flag("out", join(here, "world"));
2688
2688
  const recipe = JSON.parse(await readFile(join(here, "recipe.json"), "utf8"));
2689
2689
  for (const layer of recipe.recipe.layers) {
2690
2690
  const data = layer.params?.data;
@@ -2692,6 +2692,21 @@ async function bakeKit(url, { sky, cookTerrainWorld }) {
2692
2692
  const raw = await readFile(join(here, data.raw16));
2693
2693
  data.values = Array.from(decodeRAW16(raw, data).values, (value) => Math.round(value * 10) / 10);
2694
2694
  }
2695
+ if (options.look !== void 0) {
2696
+ if (typeof recipe.world?.name !== "string")
2697
+ throw new Error("bake: a kit that passes `look` needs a `world` row in recipe.json");
2698
+ const { bakeStreamedWorld } = await import(new URL("./kit-world.js", import.meta.url).href);
2699
+ await bakeStreamedWorld({
2700
+ kitDir: here,
2701
+ assetsDir,
2702
+ out: flag("out", resolve("assets/terrain", recipe.world.name)),
2703
+ recipe,
2704
+ look: options.look
2705
+ });
2706
+ return;
2707
+ }
2708
+ const { sky, cookTerrainWorld } = options;
2709
+ const outDir = flag("out", join(here, "world"));
2695
2710
  const assetTable = JSON.parse(await readFile(join(here, "assets.json"), "utf8"));
2696
2711
  const arborScratch = await mkdtemp(join(tmpdir(), "tn-kit-arbor-"));
2697
2712
  await growArborRows(assetTable, here, arborScratch, assetsDir);
@@ -2814,4 +2829,4 @@ async function bakeKit(url, { sky, cookTerrainWorld }) {
2814
2829
  }
2815
2830
  }
2816
2831
 
2817
- export { bakeKit, starterAssetsDir };
2832
+ export { DEFAULT_SKY_HDRI, bakeKit, starterAssetsDir };
@@ -3998,7 +3998,12 @@ async function stitch(survey, z) {
3998
3998
  );
3999
3999
  }
4000
4000
  }
4001
- await Promise.all(tiles);
4001
+ try {
4002
+ await Promise.all(tiles);
4003
+ } catch (error) {
4004
+ await Promise.allSettled(tiles);
4005
+ throw error;
4006
+ }
4002
4007
  if (missing) return void 0;
4003
4008
  return {
4004
4009
  stitched,
@@ -4545,6 +4550,7 @@ async function extract(archive, target) {
4545
4550
  }
4546
4551
  fail3("END");
4547
4552
  }
4553
+ var DEFAULT_SKY_HDRI = "hdri/kloofendal_48d_partly_cloudy_1k.hdr";
4548
4554
  async function starterAssetsDir() {
4549
4555
  const root = dirname(fileURLToPath(import.meta.resolve("@threenative/terrain/package.json")));
4550
4556
  const local = join$1(root, "starter-assets");
@@ -4597,7 +4603,7 @@ async function starterAssetsDir() {
4597
4603
 
4598
4604
  // src/biome/kits.ts
4599
4605
  var TERRAIN_KITS = ["forest", "coastal", "alpine", "desert", "tundra"];
4600
- var PACKAGE = "@threenative/procedural-vegetation";
4606
+ var PACKAGE = "@threenative/procedural-environment";
4601
4607
  var SPECIES = /^arbor:([a-z0-9]+)(?:@(\d{1,9}))?$/u;
4602
4608
  var LODS = [1, 2];
4603
4609
  function parseArborSpecies(species2) {
@@ -5735,10 +5741,7 @@ ${farRingResult.decision.attribution}
5735
5741
  `${JSON.stringify({ ...surface, splat, textures: "textures" }, null, 2)}
5736
5742
  `
5737
5743
  );
5738
- await copyFile(
5739
- join$1(assetsDir, "hdri", "kloofendal_48d_partly_cloudy_1k.hdr"),
5740
- join$1(request2.out, "sky.hdr")
5741
- );
5744
+ await copyFile(join$1(assetsDir, DEFAULT_SKY_HDRI), join$1(request2.out, "sky.hdr"));
5742
5745
  await writeFile(join$1(request2.out, "recipe.json"), JSON.stringify(recipe.recipe));
5743
5746
  return worldReply({
5744
5747
  request: request2,
@@ -7,6 +7,7 @@ import { resolve, relative, join, sep, isAbsolute, basename, dirname } from 'pat
7
7
  import { createInterface } from 'readline';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { spawn } from 'child_process';
10
+ import 'os';
10
11
 
11
12
  function childExecArgv(execArgv) {
12
13
  const out = [];
@@ -3350,7 +3351,7 @@ var WATER_WORD_ROWS = [
3350
3351
  [{ kind: "river", width: 5.32 }, ["creek", "creeks", "river", "rivers", "stream", "streams"]],
3351
3352
  [{ kind: "lake", radius: 105 }, ["lake", "lakes", "pond", "ponds"]],
3352
3353
  [
3353
- { kind: "ocean", level: 1.5 },
3354
+ { kind: "ocean", level: 0 },
3354
3355
  ["fjord", "fjords", "island", "islands", "ocean", "oceans", "sea", "seas"]
3355
3356
  ]
3356
3357
  ];
@@ -3394,7 +3395,16 @@ var SIZE_WORD_ROWS = [
3394
3395
  ];
3395
3396
  var BIOME_OWN = {
3396
3397
  alpine: { landform: "alpine", sizeMeters: 512, water: [] },
3397
- coastal: { landform: "coastalCliffs", sizeMeters: 512, water: [{ kind: "ocean", level: 1.5 }] },
3398
+ // The coast stands at its real sea level (0 m, Sand Beach, Acadia) and the survey's flattened
3399
+ // lagoon behind the beach is a lake over a lowered bed, as `starter/coastal/biome.data.json` says.
3400
+ coastal: {
3401
+ landform: "coastalCliffs",
3402
+ sizeMeters: 512,
3403
+ water: [
3404
+ { kind: "ocean", level: 0 },
3405
+ { kind: "lake", radius: 150 }
3406
+ ]
3407
+ },
3398
3408
  desert: { landform: "desertMesa", sizeMeters: 512, water: [] },
3399
3409
  forest: {
3400
3410
  landform: "temperateMountains",
@@ -3749,7 +3759,7 @@ var ARBOR_TREE_IDS = [
3749
3759
  ];
3750
3760
 
3751
3761
  // src/mcp/tools.ts
3752
- var ARBOR_SPECIES_NOTE = `A species named \`arbor:<preset>[@seed]\` (for example arbor:oak@7) is a procedural Arbor tree the cook bakes and scatters; needs npm i -D @threenative/procedural-vegetation; set the row's far.impostor beyond 190 m, past the tree's last LOD. Presets: ${ARBOR_TREE_IDS.join(", ")}.`;
3762
+ var ARBOR_SPECIES_NOTE = `A species named \`arbor:<preset>[@seed]\` (for example arbor:oak@7) is a procedural Arbor tree the cook bakes and scatters; needs npm i -D @threenative/procedural-environment; set the row's far.impostor beyond 190 m, past the tree's last LOD. Presets: ${ARBOR_TREE_IDS.join(", ")}.`;
3753
3763
  var ECOREGION_NOTE = `A region word (${ECOREGION_ROWS.map((row) => row.words[0]).join(", ")}) cooks that region's own world: the row's real survey as the ground, its plant community as the canopy (several species, each baked at more than one seed), and the starter's own surface, understorey and water, reported as \`decided.region\`.`;
3754
3764
  var PATCH_OPS = ["upsert", "update", "remove", "move", "toggle"];
3755
3765
  var GROUND_SCHEMA = {
@@ -4088,7 +4098,7 @@ async function cookCached(request, out) {
4088
4098
  try {
4089
4099
  return [
4090
4100
  createRequire(join(projectRoot, "package.json")).resolve(
4091
- "@threenative/procedural-vegetation/package.json"
4101
+ "@threenative/procedural-environment/package.json"
4092
4102
  )
4093
4103
  ];
4094
4104
  } catch {
@@ -0,0 +1,141 @@
1
+ import { h as IPlacement } from './types-kpI0C4hW.js';
2
+ import { I as IWorldPackageManifest, a as IWorldPackageRun } from './world-package-DqJC3-Nn.js';
3
+
4
+ /**
5
+ * The streamed prop worlds one bake writes, and what each one holds.
6
+ *
7
+ * A prop package is the same container as a world package (`world-package.ts`): eight float32 per
8
+ * placement, cells of a fixed size, and one run per asset inside a cell. What it adds is the split
9
+ * into streamed worlds. The game draws its placements in more than one `WorldCells` because reach
10
+ * and shadow policy differ between a horizon-canopy tree and a shadowless blade of grass, and the
11
+ * far field and the vista meadow answer a query flag. This module turns labelled placements into
12
+ * those worlds, so the bake writes them and the game loads them, and neither side owns the grouping.
13
+ */
14
+ /** Which streamed world a record draws in, for a loader that answers a query flag before it loads. */
15
+ type IPropBucketKind = "local" | "far" | "meadow";
16
+ /** One placement, the streamed world it belongs to, and how far it may draw. */
17
+ interface IPropBucketEntry {
18
+ readonly placement: IPlacement;
19
+ /** The streamed world's name, e.g. `local:true`. Two entries of one name share every container field. */
20
+ readonly bucket: string;
21
+ /** Metres at which the record may be culled; `Number.POSITIVE_INFINITY` keeps every cell resident. */
22
+ readonly reach: number;
23
+ /**
24
+ * The model the record draws, when it is not the placement's asset alone: the game's
25
+ * `asset:variant` key, with a shape suffix when one scale cannot carry the placement. The run a
26
+ * record sits in names it, and the loader's asset table is keyed by it.
27
+ */
28
+ readonly key?: string;
29
+ /** Defaults to `local`. A bucket that names two kinds fails the compile. */
30
+ readonly kind?: IPropBucketKind;
31
+ }
32
+ /** One streamed prop world: its container, its per-record reach, and its per-record placement ID. */
33
+ interface IPropBucketPackage {
34
+ readonly bucket: string;
35
+ readonly kind: IPropBucketKind;
36
+ readonly extent: IWorldPackageManifest["extent"];
37
+ readonly cells: readonly {
38
+ readonly x: number;
39
+ readonly z: number;
40
+ readonly runs: readonly IWorldPackageRun[];
41
+ }[];
42
+ /** Eight float32 per record: position, quaternion, uniform scale. */
43
+ readonly placements: Uint8Array;
44
+ /** One float32 per record, in record order. */
45
+ readonly reach: Float32Array;
46
+ /** One placement ID per record, in record order. The game's `variantFor` hashes it. */
47
+ readonly ids: readonly string[];
48
+ }
49
+ interface IPropPackage {
50
+ readonly cellSize: number;
51
+ readonly buckets: readonly IPropBucketPackage[];
52
+ }
53
+ interface ICompilePropBucketsOptions {
54
+ /** Metres per streamed cell. Defaults to 128. */
55
+ readonly cellSize?: number;
56
+ /**
57
+ * The extent every bucket includes before its own placements widen it, e.g. the world square.
58
+ * Without it a bucket spans exactly its own placements.
59
+ */
60
+ readonly bounds?: IWorldPackageManifest["extent"];
61
+ }
62
+ /** The cell size the game streams props in: 128 m, coarse enough that admission jobs stay bounded. */
63
+ declare const PROP_CELL_SIZE = 128;
64
+ /**
65
+ * Group placements into their streamed worlds and write each world's cells and records.
66
+ *
67
+ * The order is the streamed one: cells sorted by `x` then `z`, assets sorted by name inside a cell,
68
+ * and records in the order the entries arrived inside a run. Same-cell, same-asset placements keep
69
+ * their input order, so a re-run of a seeded bake reproduces the buffer byte for byte.
70
+ *
71
+ * @requires npm i -D @threenative/terrain
72
+ * @situation bake the prop worlds a game streams, once, instead of compiling them at load
73
+ * @constraint headless; the caller decides every placement, its streamed world, its reach and its pose
74
+ * @example const pkg = compilePropBuckets(entries, { bounds });
75
+ * @override cellSize and the base extent; the bucket, reach and kind of every entry
76
+ */
77
+ declare function compilePropBuckets(entries: readonly IPropBucketEntry[], options?: ICompilePropBucketsOptions): IPropPackage;
78
+ /**
79
+ * The asset a package run names.
80
+ *
81
+ * A prop run names the model it draws, `asset:variant[@shape]`; a container written by
82
+ * `bakeWorldPackage` names the asset alone. Both reduce to the asset here, which is what a count, a
83
+ * material or a placement's own `asset` field holds.
84
+ *
85
+ * @requires npm i -D @threenative/terrain
86
+ * @situation count one species across a world's prop buckets, or name the asset a run draws
87
+ * @example const asset = propAssetOf("spruce:2"); // "spruce"
88
+ */
89
+ declare function propAssetOf(modelKey: string): string;
90
+ /** One record of a compiled prop bucket, in record order. */
91
+ interface IPropBucketRecord {
92
+ readonly id: string;
93
+ /** The model the record draws, as its run names it (`spruce:2`, or with a shape suffix). */
94
+ readonly key: string;
95
+ /** The asset alone, `propAssetOf(key)`. */
96
+ readonly asset: string;
97
+ readonly position: readonly [number, number, number];
98
+ readonly quaternion: readonly [number, number, number, number];
99
+ readonly scale: number;
100
+ readonly reach: number;
101
+ }
102
+ /**
103
+ * The records of one compiled prop bucket, read back in record order: the inverse of
104
+ * `compilePropBuckets`, so a loader that fetched a bake's files gets each record's ID, model,
105
+ * pose and reach without re-deriving the container layout.
106
+ *
107
+ * @requires npm i -D @threenative/terrain
108
+ * @situation read a baked prop bucket back into placements to ground them on this machine's terrain
109
+ * @constraint throws `TN_PROP_BUCKET_INVALID` when the record buffer, the IDs and the runs disagree
110
+ * @example for (const record of decodePropBucket(bucket)) pose(record.key, record.position, record.quaternion);
111
+ */
112
+ declare function decodePropBucket(bucket: IPropBucketPackage): IPropBucketRecord[];
113
+ /** The files one bake writes for a world's prop package: its bucket list and each bucket's three files. */
114
+ interface IPropPackageFiles {
115
+ readonly manifest: Uint8Array;
116
+ readonly files: Readonly<Record<string, Uint8Array>>;
117
+ }
118
+ /**
119
+ * A path under `world/` that no bucket name can break: `local:true` becomes `local-true`.
120
+ *
121
+ * The bucket's own name is kept in the manifest, so this rename is only a file-system concern.
122
+ *
123
+ * @requires npm i -D @threenative/terrain
124
+ * @situation name one of a bucket's three files without a bucket key that breaks a path
125
+ * @example const file = propPackageFile("forest", "local:true", "props.bin"); // "forest.local-true.props.bin"
126
+ */
127
+ declare function propPackageFile(world: string, bucket: string, suffix: string): string;
128
+ /**
129
+ * Write a compiled package as the manifest the game fetches and one set of files per bucket.
130
+ *
131
+ * The manifest names the files rather than embedding them, so a loader fetches only the buckets its
132
+ * query flags keep (`?farForest=on` keeps the far field, `?meadow=off` drops the vista cover).
133
+ *
134
+ * @requires npm i -D @threenative/terrain
135
+ * @situation write a compiled package to disk: one manifest and three files per streamed world
136
+ * @constraint the manifest names the files; nothing here touches a file system
137
+ * @example const { manifest, files } = propPackageFiles(pkg, "forest");
138
+ */
139
+ declare function propPackageFiles(pkg: IPropPackage, world: string): IPropPackageFiles;
140
+
141
+ export { type IPropBucketKind as I, PROP_CELL_SIZE as P, type IPropPackage as a, type IPropBucketPackage as b, type ICompilePropBucketsOptions as c, type IPropBucketEntry as d, type IPropBucketRecord as e, type IPropPackageFiles as f, compilePropBuckets as g, decodePropBucket as h, propPackageFile as i, propPackageFiles as j, propAssetOf as p };
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
- import { I as ITerrainState, b as ITerrainDocument, i as IPlacementOverride } from './types-BpH00qsx.js';
2
+ import { I as ITerrainState, b as ITerrainDocument, m as IPlacementOverride } from './types-kpI0C4hW.js';
3
3
 
4
4
  type IAssetKind = "model" | "image" | "environment";
5
5
  interface IAssetBounds {