@threenative/terrain 0.1.9 → 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 (243) hide show
  1. package/README.md +40 -59
  2. package/THIRD_PARTY_NOTICES.md +2 -1
  3. package/dist/bake-DJ5cxg0C.d.ts +82 -0
  4. package/dist/editor/index.d.ts +4 -4
  5. package/dist/editor/index.js +130 -128
  6. package/dist/editor/server.d.ts +2 -2
  7. package/dist/editor/server.js +38 -35
  8. package/dist/editor/worker.d.ts +1 -1
  9. package/dist/editor/worker.js +101 -101
  10. package/dist/export.d.ts +1 -1
  11. package/dist/index.d.ts +156 -273
  12. package/dist/index.js +562 -378
  13. package/dist/kit-world.d.ts +107 -0
  14. package/dist/kit-world.js +5134 -0
  15. package/dist/kit.d.ts +21 -4
  16. package/dist/kit.js +337 -223
  17. package/dist/mcp/cook-child.js +1963 -1543
  18. package/dist/mcp/server.js +716 -429
  19. package/dist/prop-package-Dwz0EWoB.d.ts +141 -0
  20. package/dist/{server-B5RdvEAC.d.ts → server-LnFwY8sr.d.ts} +1 -1
  21. package/dist/starter.d.ts +1142 -7
  22. package/dist/starter.js +2102 -120
  23. package/dist/{terrain-CAEaW0mQ.d.ts → terrain-DYCyAOCJ.d.ts} +1 -1
  24. package/dist/three.d.ts +1 -1
  25. package/dist/three.js +1 -1
  26. package/dist/{types-BpH00qsx.d.ts → types-kpI0C4hW.d.ts} +1 -1
  27. package/dist/{world-package-B8QgHjAQ.d.ts → world-package-DqJC3-Nn.d.ts} +2 -2
  28. package/docs/authoring/editor.md +73 -0
  29. package/docs/authoring/new-environment.md +97 -0
  30. package/docs/authoring/recipes.md +97 -0
  31. package/docs/authoring/world-export.md +66 -0
  32. package/package.json +24 -8
  33. package/starter/alpine/README.md +22 -12
  34. package/starter/alpine/bake.mjs +14 -1
  35. package/starter/alpine/biome.data.json +187 -25
  36. package/starter/alpine/heightmap.r16 +0 -0
  37. package/starter/alpine/playerRig.ts +89 -0
  38. package/starter/alpine/recipe.json +169 -15
  39. package/starter/alpine/render/bakedFile.ts +17 -0
  40. package/starter/alpine/render/benchmark.ts +77 -0
  41. package/starter/alpine/render/biomeData.ts +14 -0
  42. package/starter/alpine/render/biomes.ts +687 -0
  43. package/starter/alpine/render/ground/cover.ts +565 -0
  44. package/starter/alpine/render/ground/horizon.ts +219 -0
  45. package/starter/alpine/render/ground/palette.d.ts +1 -0
  46. package/starter/alpine/render/ground/palette.js +11 -0
  47. package/starter/alpine/render/ground/scatter.ts +104 -0
  48. package/starter/alpine/render/ground/terrain.ts +1860 -0
  49. package/starter/alpine/render/kitAssets.ts +28 -0
  50. package/starter/alpine/render/loading.ts +354 -0
  51. package/starter/alpine/render/lookKnobs.ts +37 -0
  52. package/starter/alpine/render/orbitCamera.ts +155 -0
  53. package/starter/alpine/render/props/farForest.ts +94 -0
  54. package/starter/alpine/render/props/pack.ts +1114 -0
  55. package/starter/alpine/render/props/prepared.ts +225 -0
  56. package/starter/alpine/render/props/propMaterials.ts +1239 -0
  57. package/starter/alpine/render/props/propProgress.ts +2 -0
  58. package/starter/alpine/render/props/propWorld.ts +105 -0
  59. package/starter/alpine/render/props/props.ts +633 -0
  60. package/starter/alpine/render/props/spruce.ts +440 -0
  61. package/starter/alpine/render/sky/atmosphere.ts +329 -0
  62. package/starter/alpine/render/sky/sky.ts +382 -0
  63. package/starter/alpine/render/texturePreparation.ts +135 -0
  64. package/starter/alpine/render/water/river.ts +1132 -0
  65. package/starter/alpine/render/worldNames.ts +6 -0
  66. package/starter/alpine/scene.ts +715 -0
  67. package/starter/alpine/sceneProps.ts +561 -0
  68. package/starter/alpine/sceneState.ts +33 -0
  69. package/starter/alpine/world/terrainAssets.ts +145 -0
  70. package/starter/alpine/world/walkBand.ts +47 -0
  71. package/starter/alpine/world/water.ts +74 -0
  72. package/starter/alpine/worlds.ts +13 -0
  73. package/starter/arbor/wind.ts +84 -0
  74. package/starter/coastal/README.md +26 -25
  75. package/starter/coastal/assets.json +10 -0
  76. package/starter/coastal/bake.mjs +14 -1
  77. package/starter/coastal/biome.data.json +18 -3
  78. package/starter/coastal/playerRig.ts +89 -0
  79. package/starter/coastal/recipe.json +220 -18
  80. package/starter/coastal/render/bakedFile.ts +17 -0
  81. package/starter/coastal/render/benchmark.ts +81 -0
  82. package/starter/coastal/render/biomeData.ts +14 -0
  83. package/starter/coastal/render/biomes.ts +678 -0
  84. package/starter/coastal/render/ground/cover.ts +565 -0
  85. package/starter/coastal/render/ground/horizon.ts +219 -0
  86. package/starter/coastal/render/ground/palette.d.ts +1 -0
  87. package/starter/coastal/render/ground/palette.js +11 -0
  88. package/starter/coastal/render/ground/scatter.ts +104 -0
  89. package/starter/coastal/render/ground/terrain.ts +1829 -0
  90. package/starter/coastal/render/kitAssets.ts +28 -0
  91. package/starter/coastal/render/loading.ts +354 -0
  92. package/starter/coastal/render/lookKnobs.ts +37 -0
  93. package/starter/coastal/render/orbitCamera.ts +155 -0
  94. package/starter/coastal/render/props/farForest.ts +94 -0
  95. package/starter/coastal/render/props/pack.ts +1109 -0
  96. package/starter/coastal/render/props/prepared.ts +225 -0
  97. package/starter/coastal/render/props/propMaterials.ts +1239 -0
  98. package/starter/coastal/render/props/propProgress.ts +2 -0
  99. package/starter/coastal/render/props/propWorld.ts +105 -0
  100. package/starter/coastal/render/props/props.ts +633 -0
  101. package/starter/coastal/render/props/spruce.ts +440 -0
  102. package/starter/coastal/render/sky/atmosphere.ts +329 -0
  103. package/starter/coastal/render/sky/sky.ts +382 -0
  104. package/starter/coastal/render/texturePreparation.ts +135 -0
  105. package/starter/coastal/render/water/ocean.ts +284 -0
  106. package/starter/coastal/render/water/river.ts +1132 -0
  107. package/starter/coastal/render/worldNames.ts +6 -0
  108. package/starter/coastal/scene.ts +740 -0
  109. package/starter/coastal/sceneProps.ts +559 -0
  110. package/starter/coastal/sceneState.ts +33 -0
  111. package/starter/coastal/world/terrainAssets.ts +151 -0
  112. package/starter/coastal/world/walkBand.ts +47 -0
  113. package/starter/coastal/world/water.ts +74 -0
  114. package/starter/coastal/worlds.ts +13 -0
  115. package/starter/desert/README.md +51 -23
  116. package/starter/desert/bake-flora.mjs +142 -0
  117. package/starter/desert/bake-rocks.mjs +291 -0
  118. package/starter/desert/bake.mjs +14 -1
  119. package/starter/desert/biome.data.json +24 -12
  120. package/starter/desert/playerRig.ts +89 -0
  121. package/starter/desert/recipe.json +63 -16
  122. package/starter/desert/render/bakedFile.ts +17 -0
  123. package/starter/desert/render/benchmark.ts +79 -0
  124. package/starter/desert/render/biomeData.ts +14 -0
  125. package/starter/desert/render/biomes.ts +660 -0
  126. package/starter/desert/render/ground/cover.ts +565 -0
  127. package/starter/desert/render/ground/debris.ts +136 -0
  128. package/starter/desert/render/ground/horizon.ts +219 -0
  129. package/starter/desert/render/ground/palette.d.ts +1 -0
  130. package/starter/desert/render/ground/palette.js +11 -0
  131. package/starter/desert/render/ground/scatter.ts +104 -0
  132. package/starter/desert/render/ground/terrain.ts +1854 -0
  133. package/starter/desert/render/kitAssets.ts +28 -0
  134. package/starter/desert/render/loading.ts +354 -0
  135. package/starter/desert/render/lookKnobs.ts +37 -0
  136. package/starter/desert/render/orbitCamera.ts +155 -0
  137. package/starter/desert/render/props/farForest.ts +96 -0
  138. package/starter/desert/render/props/formations.ts +630 -0
  139. package/starter/desert/render/props/pack.ts +1195 -0
  140. package/starter/desert/render/props/prepared.ts +225 -0
  141. package/starter/desert/render/props/propMaterials.ts +1255 -0
  142. package/starter/desert/render/props/propProgress.ts +2 -0
  143. package/starter/desert/render/props/propWorld.ts +105 -0
  144. package/starter/desert/render/props/props.ts +624 -0
  145. package/starter/desert/render/props/spruce.ts +440 -0
  146. package/starter/desert/render/sand.ts +581 -0
  147. package/starter/desert/render/sky/atmosphere.ts +329 -0
  148. package/starter/desert/render/sky/sky.ts +382 -0
  149. package/starter/desert/render/texturePreparation.ts +135 -0
  150. package/starter/desert/render/water/river.ts +1132 -0
  151. package/starter/desert/render/worldNames.ts +6 -0
  152. package/starter/desert/scene.ts +748 -0
  153. package/starter/desert/sceneProps.ts +562 -0
  154. package/starter/desert/sceneState.ts +33 -0
  155. package/starter/desert/world/terrainAssets.ts +162 -0
  156. package/starter/desert/world/walkBand.ts +47 -0
  157. package/starter/desert/world/water.ts +74 -0
  158. package/starter/desert/worlds.ts +13 -0
  159. package/starter/forest/README.md +59 -116
  160. package/starter/forest/assets.json +14 -14
  161. package/starter/forest/bake.mjs +26 -4
  162. package/starter/forest/playerRig.ts +89 -0
  163. package/starter/forest/recipe.json +233 -43
  164. package/starter/forest/render/bakedFile.ts +17 -0
  165. package/starter/forest/render/benchmark.ts +77 -0
  166. package/starter/forest/render/biomeData.ts +14 -0
  167. package/starter/forest/render/biomes.ts +637 -0
  168. package/starter/forest/render/ground/cover.ts +565 -0
  169. package/starter/forest/render/ground/horizon.ts +219 -0
  170. package/starter/forest/render/ground/palette.d.ts +1 -0
  171. package/starter/forest/render/ground/palette.js +11 -0
  172. package/starter/forest/render/ground/scatter.ts +104 -0
  173. package/starter/forest/render/ground/terrain.ts +1796 -0
  174. package/starter/forest/render/kitAssets.ts +28 -0
  175. package/starter/forest/render/loading.ts +354 -0
  176. package/starter/forest/render/lookKnobs.ts +37 -0
  177. package/starter/forest/render/orbitCamera.ts +155 -0
  178. package/starter/forest/render/props/farForest.ts +94 -0
  179. package/starter/forest/render/props/pack.ts +1078 -0
  180. package/starter/forest/render/props/prepared.ts +226 -0
  181. package/starter/forest/render/props/propMaterials.ts +1247 -0
  182. package/starter/forest/render/props/propProgress.ts +2 -0
  183. package/starter/forest/render/props/propWorld.ts +105 -0
  184. package/starter/forest/render/props/props.ts +624 -0
  185. package/starter/forest/render/props/spruce.ts +440 -0
  186. package/starter/forest/render/sky/atmosphere.ts +329 -0
  187. package/starter/forest/render/sky/sky.ts +382 -0
  188. package/starter/forest/render/texturePreparation.ts +135 -0
  189. package/starter/forest/render/water/river.ts +1132 -0
  190. package/starter/forest/render/worldNames.ts +6 -0
  191. package/starter/forest/scene.ts +715 -0
  192. package/starter/forest/sceneProps.ts +559 -0
  193. package/starter/forest/sceneState.ts +33 -0
  194. package/starter/forest/surface.json +2 -2
  195. package/starter/forest/world/terrainAssets.ts +158 -0
  196. package/starter/forest/world/walkBand.ts +47 -0
  197. package/starter/forest/world/water.ts +74 -0
  198. package/starter/forest/worlds.ts +13 -0
  199. package/starter/tundra/README.md +35 -14
  200. package/starter/tundra/bake.mjs +14 -1
  201. package/starter/tundra/biome.data.json +6 -6
  202. package/starter/tundra/playerRig.ts +89 -0
  203. package/starter/tundra/recipe.json +111 -110
  204. package/starter/tundra/render/bakedFile.ts +17 -0
  205. package/starter/tundra/render/benchmark.ts +79 -0
  206. package/starter/tundra/render/biomeData.ts +14 -0
  207. package/starter/tundra/render/biomes.ts +714 -0
  208. package/starter/tundra/render/ground/cover.ts +565 -0
  209. package/starter/tundra/render/ground/horizon.ts +219 -0
  210. package/starter/tundra/render/ground/palette.d.ts +1 -0
  211. package/starter/tundra/render/ground/palette.js +11 -0
  212. package/starter/tundra/render/ground/scatter.ts +104 -0
  213. package/starter/tundra/render/ground/terrain.ts +1874 -0
  214. package/starter/tundra/render/kitAssets.ts +28 -0
  215. package/starter/tundra/render/loading.ts +354 -0
  216. package/starter/tundra/render/lookKnobs.ts +37 -0
  217. package/starter/tundra/render/orbitCamera.ts +155 -0
  218. package/starter/tundra/render/props/farForest.ts +96 -0
  219. package/starter/tundra/render/props/pack.ts +1088 -0
  220. package/starter/tundra/render/props/prepared.ts +225 -0
  221. package/starter/tundra/render/props/propMaterials.ts +1247 -0
  222. package/starter/tundra/render/props/propProgress.ts +2 -0
  223. package/starter/tundra/render/props/propWorld.ts +105 -0
  224. package/starter/tundra/render/props/props.ts +624 -0
  225. package/starter/tundra/render/props/spruce.ts +440 -0
  226. package/starter/tundra/render/sky/atmosphere.ts +329 -0
  227. package/starter/tundra/render/sky/sky.ts +382 -0
  228. package/starter/tundra/render/texturePreparation.ts +135 -0
  229. package/starter/tundra/render/water/river.ts +1132 -0
  230. package/starter/tundra/render/worldNames.ts +6 -0
  231. package/starter/tundra/scene.ts +715 -0
  232. package/starter/tundra/sceneProps.ts +559 -0
  233. package/starter/tundra/sceneState.ts +33 -0
  234. package/starter/tundra/world/terrainAssets.ts +159 -0
  235. package/starter/tundra/world/walkBand.ts +47 -0
  236. package/starter/tundra/world/water.ts +74 -0
  237. package/starter/tundra/worlds.ts +13 -0
  238. package/starter-assets.json +4 -4
  239. package/starter-credits.json +901 -15
  240. package/AGENT_GUIDE.md +0 -209
  241. package/starter/forest/sky.ts +0 -38
  242. package/starter/forest/water.ts +0 -257
  243. package/starter/forest/world.ts +0 -182
@@ -72,8 +72,28 @@
72
72
  "mask": {
73
73
  "type": "height",
74
74
  "min": -1000,
75
- "max": 6,
76
- "fade": 4
75
+ "max": 3.5,
76
+ "fade": 1.5
77
+ }
78
+ },
79
+ {
80
+ "material": "rock",
81
+ "mask": {
82
+ "type": "and",
83
+ "masks": [
84
+ {
85
+ "type": "height",
86
+ "min": -1000,
87
+ "max": 9,
88
+ "fade": 2
89
+ },
90
+ {
91
+ "type": "slope",
92
+ "min": 8,
93
+ "max": 90,
94
+ "fade": 4
95
+ }
96
+ ]
77
97
  }
78
98
  }
79
99
  ]
@@ -82,32 +102,214 @@
82
102
  {
83
103
  "enabled": true,
84
104
  "opacity": 1,
85
- "id": "ocean",
105
+ "id": "shore-stones",
106
+ "type": "scatter",
107
+ "params": {
108
+ "asset": "boulder",
109
+ "count": 90,
110
+ "minDistance": 6,
111
+ "minSlope": 15,
112
+ "maxSlope": 45,
113
+ "scale": [
114
+ 0.6,
115
+ 1.6
116
+ ]
117
+ }
118
+ },
119
+ {
120
+ "enabled": true,
121
+ "opacity": 1,
122
+ "id": "lagoon-bed",
123
+ "type": "flatten",
124
+ "params": {
125
+ "at": [110, -60],
126
+ "radius": 150,
127
+ "height": 1,
128
+ "falloff": 0.1
129
+ },
130
+ "mask": {
131
+ "type": "height",
132
+ "min": 2.0,
133
+ "max": 2.25,
134
+ "fade": 0.1
135
+ }
136
+ },
137
+ {
138
+ "enabled": true,
139
+ "opacity": 1,
140
+ "id": "lagoon",
86
141
  "type": "water",
87
142
  "params": {
88
- "kind": "ocean",
89
- "level": 1.5,
90
- "radius": 512
143
+ "kind": "lake",
144
+ "at": [110, -60],
145
+ "radius": 150,
146
+ "level": 2.25
91
147
  }
92
148
  },
93
149
  {
94
150
  "enabled": true,
95
151
  "opacity": 1,
96
- "id": "stand",
97
- "type": "scatter",
152
+ "id": "ocean",
153
+ "type": "water",
98
154
  "params": {
99
- "asset": "fir",
100
- "count": 80,
101
- "minDistance": 8,
102
- "minHeight": 4,
103
- "maxSlope": 35,
104
- "avoidWater": true,
105
- "scale": [
106
- 0.9,
107
- 1.4
108
- ]
155
+ "kind": "ocean",
156
+ "level": 0,
157
+ "radius": 512
109
158
  }
110
159
  }
111
160
  ]
161
+ },
162
+ "world": {
163
+ "name": "coastal",
164
+ "ground": {
165
+ "base": "grass",
166
+ "layers": ["dirt", "moss", "sand", "rock", "snow"],
167
+ "roughness": 0.95
168
+ },
169
+ "art": [
170
+ "boulder_01",
171
+ "rock_face",
172
+ "rock_boulder_dry",
173
+ "rocks",
174
+ "river_small_rocks",
175
+ "cliff_side",
176
+ "snow_02",
177
+ "grass_medium",
178
+ "leafy_grass",
179
+ "lichen_rock",
180
+ "mossy_rock",
181
+ "shrub_02",
182
+ "hdri/kloofendal_48d_partly_cloudy_1k.hdr",
183
+ "mannequin-swim.glb",
184
+ "bark_brown_02",
185
+ "celandine_01",
186
+ "dandelion_01",
187
+ "dead_tree_trunk",
188
+ "dry_branches_medium_01",
189
+ "fern_02",
190
+ "forest_ground_04",
191
+ "moss_01",
192
+ "nettle_plant",
193
+ "periwinkle_plant",
194
+ "sand_01",
195
+ "shrub_04",
196
+ "tree_stump_01",
197
+ "weed_plant_02",
198
+ "needle-atlas.png",
199
+ "needle-surface.png",
200
+ "hdri/kloofendal_48d_partly_cloudy_2k.hdr"
201
+ ],
202
+ "farRing": {
203
+ "survey": "coastal-horizon",
204
+ "datum": 0,
205
+ "seed": 1,
206
+ "layers": []
207
+ },
208
+ "arbor": {
209
+ "alpine_flora/spruce-a": {
210
+ "preset": "spruce",
211
+ "seed": 1,
212
+ "lods": {
213
+ "1": "-near",
214
+ "2": "-mid"
215
+ },
216
+ "form": {
217
+ "levels": [
218
+ {
219
+ "kids": 104
220
+ },
221
+ {
222
+ "len": 0.25
223
+ }
224
+ ],
225
+ "leaves": [
226
+ {
227
+ "count": 56,
228
+ "size": [0.62, 0.38]
229
+ }
230
+ ]
231
+ }
232
+ },
233
+ "alpine_flora/spruce-b": {
234
+ "preset": "spruce",
235
+ "seed": 2,
236
+ "lods": {
237
+ "1": "-near",
238
+ "2": "-mid"
239
+ },
240
+ "form": {
241
+ "levels": [
242
+ {
243
+ "kids": 104
244
+ },
245
+ {
246
+ "len": 0.25
247
+ }
248
+ ],
249
+ "leaves": [
250
+ {
251
+ "count": 56,
252
+ "size": [0.62, 0.38]
253
+ }
254
+ ]
255
+ }
256
+ },
257
+ "alpine_flora/spruce-c": {
258
+ "preset": "spruce",
259
+ "seed": 3,
260
+ "lods": {
261
+ "1": "-near",
262
+ "2": "-mid"
263
+ },
264
+ "form": {
265
+ "levels": [
266
+ {
267
+ "kids": 104
268
+ },
269
+ {
270
+ "len": 0.25
271
+ }
272
+ ],
273
+ "leaves": [
274
+ {
275
+ "count": 56,
276
+ "size": [0.62, 0.38]
277
+ }
278
+ ]
279
+ }
280
+ },
281
+ "alpine_flora/blackspruce-a": {
282
+ "preset": "blackspruce",
283
+ "seed": 1,
284
+ "lods": {
285
+ "1": "-near",
286
+ "2": "-mid"
287
+ },
288
+ "form": {
289
+ "leaves": [
290
+ {
291
+ "count": 22,
292
+ "size": [0.46, 0.33]
293
+ }
294
+ ]
295
+ }
296
+ },
297
+ "alpine_flora/blackspruce-b": {
298
+ "preset": "blackspruce",
299
+ "seed": 2,
300
+ "lods": {
301
+ "1": "-near",
302
+ "2": "-mid"
303
+ },
304
+ "form": {
305
+ "leaves": [
306
+ {
307
+ "count": 22,
308
+ "size": [0.46, 0.33]
309
+ }
310
+ ]
311
+ }
312
+ }
313
+ }
112
314
  }
113
315
  }
@@ -0,0 +1,17 @@
1
+ import { type IAssetLoader, fetchAsset } from "@threenative/core";
2
+
3
+ /**
4
+ * One baked file under `world/`, from the first root the asset loader resolves that serves it
5
+ * (core `fetchAsset`). A miss on every root fails closed, naming the file the world is missing.
6
+ */
7
+ export async function fetchBakedFile(
8
+ assets: Pick<IAssetLoader, "resolve">,
9
+ path: string,
10
+ what = "world file",
11
+ ): Promise<Response> {
12
+ try {
13
+ return await fetchAsset(assets, path);
14
+ } catch (error) {
15
+ throw new Error(`Missing baked ${what}: ${path}`, { cause: error });
16
+ }
17
+ }
@@ -0,0 +1,81 @@
1
+ import type { WorldName } from "./biomes.js";
2
+
3
+ /**
4
+ * The fixed benchmark framings, in world metres, per world.
5
+ *
6
+ * Fixed rather than relative to the player so a capture at seed 73 is the same picture on every
7
+ * machine, and so the rubric's "close ground/vegetation view" and "landscape overview" are two
8
+ * numbers rather than two moods. `eye` is the height above the terrain under the camera, which is
9
+ * what makes "eye height ~1.7 m" true on a slope instead of true only on a flat.
10
+ *
11
+ * The meadow focus is where the ground is grass with spruces on it and a slope to look along, and
12
+ * it is also where the dense grass goes: ground cover is placed around this point, not around the
13
+ * origin, because a meadow is a place rather than a texture.
14
+ */
15
+
16
+ /** Every framing the `V` key can hold, whether or not the current world has one for it. */
17
+ export type ViewName = "meadow-close" | "overview" | "player" | "river" | "vista";
18
+
19
+ interface IBenchmarkPose {
20
+ /** World x and z of the eye, and the height above the terrain under it. */
21
+ readonly at: readonly [number, number];
22
+ readonly eye: number;
23
+ /** Absolute elevation for an overview over surveyed scenery beyond the playable collider. */
24
+ readonly eyeY?: number;
25
+ /** World x and z to look at, and the height above the terrain under *that*. */
26
+ readonly look: readonly [number, number];
27
+ readonly lookUp: number;
28
+ /**
29
+ * An absolute world height to look at instead, for a target with no ground under it: a sea
30
+ * horizon is a direction, and thirty metres below the surface three hundred metres out is how a
31
+ * hillside tips its view down far enough for the water to be a band rather than a line.
32
+ */
33
+ readonly lookY?: number;
34
+ }
35
+
36
+ interface IBenchmark {
37
+ /**
38
+ * The playable square the poses frame, in metres. A cooked world of another size
39
+ * (`STRATA_WORLD`, "a huge spruce forest") scales them, so the vista still stands past its edge.
40
+ */
41
+ readonly size?: number;
42
+ /** Where this world's ground cover is placed. */
43
+ readonly focus: { readonly x: number; readonly z: number };
44
+ readonly poses: Readonly<Record<string, IBenchmarkPose>>;
45
+ /** The order the `V` key walks, and the framings the playtest screenshots. */
46
+ readonly views: readonly ViewName[];
47
+ }
48
+
49
+ export const BENCHMARK: Record<WorldName, IBenchmark> = {
50
+ coastal: {
51
+ size: 512,
52
+ focus: { x: 80, z: 5 },
53
+ poses: {
54
+ // From the wooded slope above the cove: ground cover in front, the beach and the sea past it.
55
+ "meadow-close": { at: [30, 100], eye: 1.7, look: [100, 150], lookUp: 1.2 },
56
+ // From the high north-west corner, over the spruce, the lagoon and the beach to Great Head.
57
+ overview: { at: [-180, -180], eye: 65, look: [200, 200], lookUp: 0 },
58
+ // On the wet sand below the berm's beach grass, across the cove to the Great Head granite
59
+ // (about 600 m east).
60
+ river: { at: [80, 155], eye: 1.7, look: [500, 300], lookUp: 0, lookY: 4 },
61
+ // From the open water south of the cove (Great Head off the right edge), back over the beach and
62
+ // the lagoon to the Champlain and Dorr ridges of the real ring.
63
+ vista: { at: [250, 600], eye: 0, eyeY: 60, look: [-1000, -1500], lookUp: 0, lookY: 120 },
64
+ },
65
+ views: ["player", "meadow-close", "overview", "river", "vista"],
66
+ },
67
+ };
68
+
69
+ /** A world's poses for a square of `size` metres: x and z scale with it, heights do not. */
70
+ export function posesFor(world: WorldName, size: number): Readonly<Record<string, IBenchmarkPose>> {
71
+ const { poses, size: framed } = BENCHMARK[world];
72
+ const k = framed === undefined ? 1 : size / framed;
73
+ if (k === 1) return poses;
74
+ const scaled = ([x, z]: readonly [number, number]) => [x * k, z * k] as const;
75
+ return Object.fromEntries(
76
+ Object.entries(poses).map(([name, pose]) => [
77
+ name,
78
+ { ...pose, at: scaled(pose.at), look: scaled(pose.look) },
79
+ ]),
80
+ );
81
+ }
@@ -0,0 +1,14 @@
1
+ import type { IBiomeSpec } from "@threenative/terrain";
2
+ import forest from "../biome.data.json";
3
+ import type { WorldName } from "./biomes.js";
4
+
5
+ /**
6
+ * The forest's biome file (`biome.data.json`): the rules it grows by. The bake validates it with
7
+ * `validateBiome` before it places anything, so the game reads it as data and ships no validator.
8
+ */
9
+ const COASTAL_SPEC = forest as unknown as IBiomeSpec;
10
+
11
+ /** The world's rules. */
12
+ export function biomeSpec(_world?: WorldName): IBiomeSpec {
13
+ return COASTAL_SPEC;
14
+ }