@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.
- package/README.md +40 -59
- package/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/bake-DJ5cxg0C.d.ts +82 -0
- package/dist/editor/index.d.ts +4 -4
- package/dist/editor/index.js +130 -128
- package/dist/editor/server.d.ts +2 -2
- package/dist/editor/server.js +38 -35
- package/dist/editor/worker.d.ts +1 -1
- package/dist/editor/worker.js +101 -101
- package/dist/export.d.ts +1 -1
- package/dist/index.d.ts +156 -273
- package/dist/index.js +562 -378
- package/dist/kit-world.d.ts +107 -0
- package/dist/kit-world.js +5134 -0
- package/dist/kit.d.ts +21 -4
- package/dist/kit.js +337 -223
- package/dist/mcp/cook-child.js +1963 -1543
- package/dist/mcp/server.js +716 -429
- package/dist/prop-package-Dwz0EWoB.d.ts +141 -0
- package/dist/{server-B5RdvEAC.d.ts → server-LnFwY8sr.d.ts} +1 -1
- package/dist/starter.d.ts +1142 -7
- package/dist/starter.js +2102 -120
- package/dist/{terrain-CAEaW0mQ.d.ts → terrain-DYCyAOCJ.d.ts} +1 -1
- package/dist/three.d.ts +1 -1
- package/dist/three.js +1 -1
- package/dist/{types-BpH00qsx.d.ts → types-kpI0C4hW.d.ts} +1 -1
- package/dist/{world-package-B8QgHjAQ.d.ts → world-package-DqJC3-Nn.d.ts} +2 -2
- package/docs/authoring/editor.md +73 -0
- package/docs/authoring/new-environment.md +97 -0
- package/docs/authoring/recipes.md +97 -0
- package/docs/authoring/world-export.md +66 -0
- package/package.json +24 -8
- package/starter/alpine/README.md +22 -12
- package/starter/alpine/bake.mjs +14 -1
- package/starter/alpine/biome.data.json +187 -25
- package/starter/alpine/heightmap.r16 +0 -0
- package/starter/alpine/playerRig.ts +89 -0
- package/starter/alpine/recipe.json +169 -15
- package/starter/alpine/render/bakedFile.ts +17 -0
- package/starter/alpine/render/benchmark.ts +77 -0
- package/starter/alpine/render/biomeData.ts +14 -0
- package/starter/alpine/render/biomes.ts +687 -0
- package/starter/alpine/render/ground/cover.ts +565 -0
- package/starter/alpine/render/ground/horizon.ts +219 -0
- package/starter/alpine/render/ground/palette.d.ts +1 -0
- package/starter/alpine/render/ground/palette.js +11 -0
- package/starter/alpine/render/ground/scatter.ts +104 -0
- package/starter/alpine/render/ground/terrain.ts +1860 -0
- package/starter/alpine/render/kitAssets.ts +28 -0
- package/starter/alpine/render/loading.ts +354 -0
- package/starter/alpine/render/lookKnobs.ts +37 -0
- package/starter/alpine/render/orbitCamera.ts +155 -0
- package/starter/alpine/render/props/farForest.ts +94 -0
- package/starter/alpine/render/props/pack.ts +1114 -0
- package/starter/alpine/render/props/prepared.ts +225 -0
- package/starter/alpine/render/props/propMaterials.ts +1239 -0
- package/starter/alpine/render/props/propProgress.ts +2 -0
- package/starter/alpine/render/props/propWorld.ts +105 -0
- package/starter/alpine/render/props/props.ts +633 -0
- package/starter/alpine/render/props/spruce.ts +440 -0
- package/starter/alpine/render/sky/atmosphere.ts +329 -0
- package/starter/alpine/render/sky/sky.ts +382 -0
- package/starter/alpine/render/texturePreparation.ts +135 -0
- package/starter/alpine/render/water/river.ts +1132 -0
- package/starter/alpine/render/worldNames.ts +6 -0
- package/starter/alpine/scene.ts +715 -0
- package/starter/alpine/sceneProps.ts +561 -0
- package/starter/alpine/sceneState.ts +33 -0
- package/starter/alpine/world/terrainAssets.ts +145 -0
- package/starter/alpine/world/walkBand.ts +47 -0
- package/starter/alpine/world/water.ts +74 -0
- package/starter/alpine/worlds.ts +13 -0
- package/starter/arbor/wind.ts +84 -0
- package/starter/coastal/README.md +26 -25
- package/starter/coastal/assets.json +10 -0
- package/starter/coastal/bake.mjs +14 -1
- package/starter/coastal/biome.data.json +18 -3
- package/starter/coastal/playerRig.ts +89 -0
- package/starter/coastal/recipe.json +220 -18
- package/starter/coastal/render/bakedFile.ts +17 -0
- package/starter/coastal/render/benchmark.ts +81 -0
- package/starter/coastal/render/biomeData.ts +14 -0
- package/starter/coastal/render/biomes.ts +678 -0
- package/starter/coastal/render/ground/cover.ts +565 -0
- package/starter/coastal/render/ground/horizon.ts +219 -0
- package/starter/coastal/render/ground/palette.d.ts +1 -0
- package/starter/coastal/render/ground/palette.js +11 -0
- package/starter/coastal/render/ground/scatter.ts +104 -0
- package/starter/coastal/render/ground/terrain.ts +1829 -0
- package/starter/coastal/render/kitAssets.ts +28 -0
- package/starter/coastal/render/loading.ts +354 -0
- package/starter/coastal/render/lookKnobs.ts +37 -0
- package/starter/coastal/render/orbitCamera.ts +155 -0
- package/starter/coastal/render/props/farForest.ts +94 -0
- package/starter/coastal/render/props/pack.ts +1109 -0
- package/starter/coastal/render/props/prepared.ts +225 -0
- package/starter/coastal/render/props/propMaterials.ts +1239 -0
- package/starter/coastal/render/props/propProgress.ts +2 -0
- package/starter/coastal/render/props/propWorld.ts +105 -0
- package/starter/coastal/render/props/props.ts +633 -0
- package/starter/coastal/render/props/spruce.ts +440 -0
- package/starter/coastal/render/sky/atmosphere.ts +329 -0
- package/starter/coastal/render/sky/sky.ts +382 -0
- package/starter/coastal/render/texturePreparation.ts +135 -0
- package/starter/coastal/render/water/ocean.ts +284 -0
- package/starter/coastal/render/water/river.ts +1132 -0
- package/starter/coastal/render/worldNames.ts +6 -0
- package/starter/coastal/scene.ts +740 -0
- package/starter/coastal/sceneProps.ts +559 -0
- package/starter/coastal/sceneState.ts +33 -0
- package/starter/coastal/world/terrainAssets.ts +151 -0
- package/starter/coastal/world/walkBand.ts +47 -0
- package/starter/coastal/world/water.ts +74 -0
- package/starter/coastal/worlds.ts +13 -0
- package/starter/desert/README.md +51 -23
- package/starter/desert/bake-flora.mjs +142 -0
- package/starter/desert/bake-rocks.mjs +291 -0
- package/starter/desert/bake.mjs +14 -1
- package/starter/desert/biome.data.json +24 -12
- package/starter/desert/playerRig.ts +89 -0
- package/starter/desert/recipe.json +63 -16
- package/starter/desert/render/bakedFile.ts +17 -0
- package/starter/desert/render/benchmark.ts +79 -0
- package/starter/desert/render/biomeData.ts +14 -0
- package/starter/desert/render/biomes.ts +660 -0
- package/starter/desert/render/ground/cover.ts +565 -0
- package/starter/desert/render/ground/debris.ts +136 -0
- package/starter/desert/render/ground/horizon.ts +219 -0
- package/starter/desert/render/ground/palette.d.ts +1 -0
- package/starter/desert/render/ground/palette.js +11 -0
- package/starter/desert/render/ground/scatter.ts +104 -0
- package/starter/desert/render/ground/terrain.ts +1854 -0
- package/starter/desert/render/kitAssets.ts +28 -0
- package/starter/desert/render/loading.ts +354 -0
- package/starter/desert/render/lookKnobs.ts +37 -0
- package/starter/desert/render/orbitCamera.ts +155 -0
- package/starter/desert/render/props/farForest.ts +96 -0
- package/starter/desert/render/props/formations.ts +630 -0
- package/starter/desert/render/props/pack.ts +1195 -0
- package/starter/desert/render/props/prepared.ts +225 -0
- package/starter/desert/render/props/propMaterials.ts +1255 -0
- package/starter/desert/render/props/propProgress.ts +2 -0
- package/starter/desert/render/props/propWorld.ts +105 -0
- package/starter/desert/render/props/props.ts +624 -0
- package/starter/desert/render/props/spruce.ts +440 -0
- package/starter/desert/render/sand.ts +581 -0
- package/starter/desert/render/sky/atmosphere.ts +329 -0
- package/starter/desert/render/sky/sky.ts +382 -0
- package/starter/desert/render/texturePreparation.ts +135 -0
- package/starter/desert/render/water/river.ts +1132 -0
- package/starter/desert/render/worldNames.ts +6 -0
- package/starter/desert/scene.ts +748 -0
- package/starter/desert/sceneProps.ts +562 -0
- package/starter/desert/sceneState.ts +33 -0
- package/starter/desert/world/terrainAssets.ts +162 -0
- package/starter/desert/world/walkBand.ts +47 -0
- package/starter/desert/world/water.ts +74 -0
- package/starter/desert/worlds.ts +13 -0
- package/starter/forest/README.md +59 -116
- package/starter/forest/assets.json +14 -14
- package/starter/forest/bake.mjs +26 -4
- package/starter/forest/playerRig.ts +89 -0
- package/starter/forest/recipe.json +233 -43
- package/starter/forest/render/bakedFile.ts +17 -0
- package/starter/forest/render/benchmark.ts +77 -0
- package/starter/forest/render/biomeData.ts +14 -0
- package/starter/forest/render/biomes.ts +637 -0
- package/starter/forest/render/ground/cover.ts +565 -0
- package/starter/forest/render/ground/horizon.ts +219 -0
- package/starter/forest/render/ground/palette.d.ts +1 -0
- package/starter/forest/render/ground/palette.js +11 -0
- package/starter/forest/render/ground/scatter.ts +104 -0
- package/starter/forest/render/ground/terrain.ts +1796 -0
- package/starter/forest/render/kitAssets.ts +28 -0
- package/starter/forest/render/loading.ts +354 -0
- package/starter/forest/render/lookKnobs.ts +37 -0
- package/starter/forest/render/orbitCamera.ts +155 -0
- package/starter/forest/render/props/farForest.ts +94 -0
- package/starter/forest/render/props/pack.ts +1078 -0
- package/starter/forest/render/props/prepared.ts +226 -0
- package/starter/forest/render/props/propMaterials.ts +1247 -0
- package/starter/forest/render/props/propProgress.ts +2 -0
- package/starter/forest/render/props/propWorld.ts +105 -0
- package/starter/forest/render/props/props.ts +624 -0
- package/starter/forest/render/props/spruce.ts +440 -0
- package/starter/forest/render/sky/atmosphere.ts +329 -0
- package/starter/forest/render/sky/sky.ts +382 -0
- package/starter/forest/render/texturePreparation.ts +135 -0
- package/starter/forest/render/water/river.ts +1132 -0
- package/starter/forest/render/worldNames.ts +6 -0
- package/starter/forest/scene.ts +715 -0
- package/starter/forest/sceneProps.ts +559 -0
- package/starter/forest/sceneState.ts +33 -0
- package/starter/forest/surface.json +2 -2
- package/starter/forest/world/terrainAssets.ts +158 -0
- package/starter/forest/world/walkBand.ts +47 -0
- package/starter/forest/world/water.ts +74 -0
- package/starter/forest/worlds.ts +13 -0
- package/starter/tundra/README.md +35 -14
- package/starter/tundra/bake.mjs +14 -1
- package/starter/tundra/biome.data.json +6 -6
- package/starter/tundra/playerRig.ts +89 -0
- package/starter/tundra/recipe.json +111 -110
- package/starter/tundra/render/bakedFile.ts +17 -0
- package/starter/tundra/render/benchmark.ts +79 -0
- package/starter/tundra/render/biomeData.ts +14 -0
- package/starter/tundra/render/biomes.ts +714 -0
- package/starter/tundra/render/ground/cover.ts +565 -0
- package/starter/tundra/render/ground/horizon.ts +219 -0
- package/starter/tundra/render/ground/palette.d.ts +1 -0
- package/starter/tundra/render/ground/palette.js +11 -0
- package/starter/tundra/render/ground/scatter.ts +104 -0
- package/starter/tundra/render/ground/terrain.ts +1874 -0
- package/starter/tundra/render/kitAssets.ts +28 -0
- package/starter/tundra/render/loading.ts +354 -0
- package/starter/tundra/render/lookKnobs.ts +37 -0
- package/starter/tundra/render/orbitCamera.ts +155 -0
- package/starter/tundra/render/props/farForest.ts +96 -0
- package/starter/tundra/render/props/pack.ts +1088 -0
- package/starter/tundra/render/props/prepared.ts +225 -0
- package/starter/tundra/render/props/propMaterials.ts +1247 -0
- package/starter/tundra/render/props/propProgress.ts +2 -0
- package/starter/tundra/render/props/propWorld.ts +105 -0
- package/starter/tundra/render/props/props.ts +624 -0
- package/starter/tundra/render/props/spruce.ts +440 -0
- package/starter/tundra/render/sky/atmosphere.ts +329 -0
- package/starter/tundra/render/sky/sky.ts +382 -0
- package/starter/tundra/render/texturePreparation.ts +135 -0
- package/starter/tundra/render/water/river.ts +1132 -0
- package/starter/tundra/render/worldNames.ts +6 -0
- package/starter/tundra/scene.ts +715 -0
- package/starter/tundra/sceneProps.ts +559 -0
- package/starter/tundra/sceneState.ts +33 -0
- package/starter/tundra/world/terrainAssets.ts +159 -0
- package/starter/tundra/world/walkBand.ts +47 -0
- package/starter/tundra/world/water.ts +74 -0
- package/starter/tundra/worlds.ts +13 -0
- package/starter-assets.json +4 -4
- package/starter-credits.json +901 -15
- package/AGENT_GUIDE.md +0 -209
- package/starter/forest/sky.ts +0 -38
- package/starter/forest/water.ts +0 -257
- package/starter/forest/world.ts +0 -182
package/dist/index.d.ts
CHANGED
|
@@ -1,70 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { c as IMask, h as IPlacement, n as IErosionMaps, I as ITerrainState, M as MaterialId, o as ISampledGrid, O as OperationType, b as ITerrainDocument, m as IPlacementOverride, p as IDecodeHeightPngOptions, q as IDecodeRaw16Options, i as IBakedMesh, r as IHeightRange, s as IRaw16Options, t as IExportFile, a as IExportArchive, E as ExportKind } from './types-kpI0C4hW.js';
|
|
2
|
+
export { j as IBakeMeshOptions, k as IBakeTerrainOptions, l as IBakedTerrain, u as IBiomeParams, v as IBrushParams, w as IClearParams, g as ICopyRegionOptions, x as IDecodedHeightPng, y as IErodeParams, f as IEvaluateOptions, z as IFlattenParams, A as IGradeParams, B as IGrid, C as IHeightData, D as IHeightPngMetadata, F as IHeightmapParams, G as ILayer, H as IMaterialRule, J as IMaterialsParams, K as INoiseParams, N as IPaintParams, P as IPasteParams, Q as IRampParams, R as IRiver, S as IRiverParams, T as IRoadParams, U as IScatterClear, V as IScatterParams, W as IScatterRule, X as ISculptParams, Y as ISmoothParams, Z as ISplatPng, _ as IStampParams, $ as ITerraceParams, e as ITerrainConfig, a0 as ITerrainInspection, a1 as IWaterBody, a2 as IWaterParams, a3 as IWaterRule, L as Layer, d as LayerParams, a4 as MaskSampler, a5 as MaskType, a6 as SplinePoint } from './types-kpI0C4hW.js';
|
|
3
|
+
import { L as LandformKind } from './bake-DJ5cxg0C.js';
|
|
4
|
+
export { I as IBackdropOptions, a as ILandformBackdrop, c as ILandformInfo, d as ILandformOptions, e as LANDFORMS, b as bakeMesh, f as bakeTerrain, l as landform, g as landformBackdrop } from './bake-DJ5cxg0C.js';
|
|
5
|
+
import { d as IBakeWorldPackageOptions, b as IWorldPackageAsset, e as IBakedWorldPackage } from './world-package-DqJC3-Nn.js';
|
|
6
|
+
export { c as bakeWorldPackage } from './world-package-DqJC3-Nn.js';
|
|
5
7
|
import { Heightfield, HeightfieldCollar } from '@threenative/core/world';
|
|
6
|
-
import { c as IBakeWorldPackageOptions, I as IWorldPackageAsset, d as IBakedWorldPackage, a as IWorldPackageManifest, e as IWorldPackageRun } from './world-package-B8QgHjAQ.js';
|
|
7
|
-
export { b as bakeWorldPackage } from './world-package-B8QgHjAQ.js';
|
|
8
8
|
import { BufferAttribute } from 'three';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/** Highest minus lowest height in metres. Defaults to the kind's real ratio times `size`. */
|
|
13
|
-
relief?: number;
|
|
14
|
-
}
|
|
15
|
-
interface ILandformInfo {
|
|
16
|
-
readonly summary: string;
|
|
17
|
-
/** Default relief as a fraction of the world size. */
|
|
18
|
-
readonly reliefRatio: number;
|
|
19
|
-
/** Where the shape comes from: a public-domain DEM the repo carries, or a cited landscape. */
|
|
20
|
-
readonly reference: string;
|
|
21
|
-
/** Measured DEM statistics (5 km, 513 samples), when the repo carries that DEM; `terrainStats` fields. */
|
|
22
|
-
readonly target?: {
|
|
23
|
-
readonly slopeP50: number;
|
|
24
|
-
readonly slopeP90: number;
|
|
25
|
-
readonly hypsometricIntegral: number;
|
|
26
|
-
readonly curvatureKurtosis: number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Shape-only presets. Each names its reference landscape so a calibration can be repeated; no
|
|
31
|
-
* material, colour or texture is chosen here. Targets were measured with `terrainStats` on the
|
|
32
|
-
* 1/3 arc-second USGS 3DEP crops in `examples/strata-terrain-preview/scripts/dem` (public domain).
|
|
33
|
-
*/
|
|
34
|
-
declare const LANDFORMS: Readonly<Record<LandformKind, ILandformInfo>>;
|
|
35
|
-
/**
|
|
36
|
-
* One call, one landscape: a calibrated layer recipe for a kind of environment.
|
|
37
|
-
* @requires npm i @threenative/terrain
|
|
38
|
-
* @situation start an open world, a distant backdrop or a mountain level from a kind of place
|
|
39
|
-
* @constraint returns an ordinary `Terrain`: add roads, rivers, scatter or more layers, then `evaluate()` in a build script
|
|
40
|
-
* @constraint shape only; materials, colours and textures belong to the game
|
|
41
|
-
* @constraint calibrated at size 5000, resolution 513; other sizes keep the same slopes and scale the relief with `size`
|
|
42
|
-
* @example const terrain = landform("alpine", { size: 5000, resolution: 513, seed: 4 }); const state = terrain.evaluate();
|
|
43
|
-
* @override `relief` is the highest-minus-lowest height in metres before the finishing passes shave a few percent; `size`, `resolution` and `seed` as in `Terrain`
|
|
44
|
-
*/
|
|
45
|
-
declare function landform(kind: LandformKind, options?: ILandformOptions): Terrain;
|
|
46
|
-
interface ILandformBackdrop {
|
|
47
|
-
readonly size: number;
|
|
48
|
-
readonly resolution: number;
|
|
49
|
-
/** Row-major metres, centre sample at `centerHeight`. */
|
|
50
|
-
readonly heights: Float32Array;
|
|
51
|
-
}
|
|
52
|
-
interface IBackdropOptions extends Partial<ITerrainConfig> {
|
|
53
|
-
/** Highest minus lowest height of the returned window, metres. Defaults to the kind's ratio times `size`. */
|
|
54
|
-
relief?: number;
|
|
55
|
-
/** Elevation of the centre sample, metres: the game's own ground height where the backdrop meets it. */
|
|
56
|
-
centerHeight?: number;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Distant mountains around a playable area: a landform window with a valley floor at its centre.
|
|
60
|
-
* @requires npm i @threenative/terrain
|
|
61
|
-
* @situation add a mountain backdrop around a playable area that the game's detail terrain covers
|
|
62
|
-
* @constraint resolution up to 513: the window is cut from a world twice as wide at the same spacing; build script only
|
|
63
|
-
* @constraint shape only; the game places, colours and fades it
|
|
64
|
-
* @example const { size, resolution, heights } = landformBackdrop("temperateMountains", { seed: 7, centerHeight: 13 });
|
|
65
|
-
* @override `relief` and `centerHeight` in metres; `size`, `resolution` and `seed` as in `landform`
|
|
66
|
-
*/
|
|
67
|
-
declare function landformBackdrop(kind: LandformKind, options?: IBackdropOptions): ILandformBackdrop;
|
|
9
|
+
import { T as Terrain } from './terrain-DYCyAOCJ.js';
|
|
10
|
+
export { L as LayerPatch, O as OperationOptions, P as PatchCommand, a as TerrainEvaluator } from './terrain-DYCyAOCJ.js';
|
|
11
|
+
export { c as ICompilePropBucketsOptions, d as IPropBucketEntry, I as IPropBucketKind, b as IPropBucketPackage, e as IPropBucketRecord, a as IPropPackage, f as IPropPackageFiles, P as PROP_CELL_SIZE, g as compilePropBuckets, h as decodePropBucket, p as propAssetOf, i as propPackageFile, j as propPackageFiles } from './prop-package-Dwz0EWoB.js';
|
|
68
12
|
|
|
69
13
|
/**
|
|
70
14
|
* A biome as a data file: the rules one world grows by, and no appearance at all.
|
|
@@ -121,6 +65,16 @@ interface IFoliageType {
|
|
|
121
65
|
/** The least stand-field weight, 0..1, a spot must carry for this species to stand on it. */
|
|
122
66
|
readonly standThreshold: number;
|
|
123
67
|
readonly far: IFarFieldRule | null;
|
|
68
|
+
/**
|
|
69
|
+
* The placement scale range, `[min, max]`. Absent, the scatter's own `[0.8, 1.3]`: an Arbor tree
|
|
70
|
+
* baked at its full height then stands a third taller than the kit tree it replaces.
|
|
71
|
+
*/
|
|
72
|
+
readonly scale?: readonly [number, number];
|
|
73
|
+
/**
|
|
74
|
+
* Where the row may stand, as a recipe mask: a `noise` mask grows the row in stands with clearings
|
|
75
|
+
* between them, as a kit recipe's tree layers do. Absent, the row covers its slope and height band.
|
|
76
|
+
*/
|
|
77
|
+
readonly mask?: IMask;
|
|
124
78
|
}
|
|
125
79
|
/** One ground-cover species and the ground it accepts, on a grid of `spacing` metres. */
|
|
126
80
|
interface IGrassType {
|
|
@@ -295,36 +249,6 @@ interface IBiomeSpec {
|
|
|
295
249
|
*/
|
|
296
250
|
declare function validateBiome(spec: unknown, name: string): IBiomeSpec;
|
|
297
251
|
|
|
298
|
-
/**
|
|
299
|
-
* A biome's band rows resolved once against the world they are about.
|
|
300
|
-
*
|
|
301
|
-
* The values in `biome.data.json` are fractions of the measured height range: the same numbers make
|
|
302
|
-
* a 40 m valley and a 900 m massif, and a world with a different crop of the same landform reads the
|
|
303
|
-
* same bands. Resolving them here keeps one owner of the numbers (the biome file) and one owner of
|
|
304
|
-
* the measurement (this function), so a game reads bands instead of repeating the arithmetic.
|
|
305
|
-
*/
|
|
306
|
-
interface IMeasuredBands {
|
|
307
|
-
/** Lowest and highest sample, metres. Equal when the field is flat; the bands then collapse onto it. */
|
|
308
|
-
readonly elevationRange: readonly [number, number];
|
|
309
|
-
/** Each ground layer's band in metres, keyed by its row, in the order the file lists it. */
|
|
310
|
-
readonly bands: Readonly<Record<string, readonly [number, number]>>;
|
|
311
|
-
/** The `snow` row's band, when the biome has one. */
|
|
312
|
-
readonly snowBand: readonly [number, number] | null;
|
|
313
|
-
/**
|
|
314
|
-
* The `snow` row's slope interval, in degrees: snow starts to shed at the first and is gone by the
|
|
315
|
-
* second. `null` when the row has no shed rule.
|
|
316
|
-
*/
|
|
317
|
-
readonly snowShed: readonly [number, number] | null;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Resolve a biome's fraction bands against this world's own height samples.
|
|
321
|
-
* @requires npm i -D @threenative/terrain
|
|
322
|
-
* @situation turn a biome file's height fractions into the metres a world actually measured
|
|
323
|
-
* @constraint samples are finite and at least one; a flat field resolves every band onto its one height
|
|
324
|
-
* @example const bands = measureBands(spec.layers, state.height);
|
|
325
|
-
*/
|
|
326
|
-
declare function measureBands(layers: readonly ILayerInfo[], heights: ArrayLike<number>): IMeasuredBands;
|
|
327
|
-
|
|
328
252
|
/**
|
|
329
253
|
* A value-noise field, 0..1, as the numbers that shape it.
|
|
330
254
|
*
|
|
@@ -364,26 +288,7 @@ declare const STAND_FIELD: ICoverField;
|
|
|
364
288
|
/** The mat field a mat plain is measured by: lichen mats, thicker and finer than a stand's patches. */
|
|
365
289
|
declare const MATS_FIELD: ICoverField;
|
|
366
290
|
|
|
367
|
-
/**
|
|
368
|
-
* The ordered scatter: one stream of draws, in one fixed order, for a biome whose rules are code.
|
|
369
|
-
*
|
|
370
|
-
* A biome that says `"stream": "ordered"` does not place one rule at a time from a seed per rule. It
|
|
371
|
-
* runs fifteen generators — a stand loop, an understorey, clumped ground cover, three grids, a tide
|
|
372
|
-
* line, a river walk, a detail disc and a cobbled bed — and draws every candidate from one
|
|
373
|
-
* `createRandom` stream in that order. The order IS the rule: change one draw and every later
|
|
374
|
-
* placement moves. So this file is the generator, copied line for line from the game that graded it
|
|
375
|
-
* (Strata's `examples/strata-terrain-preview/src/render/scatter.ts` at `5afb42b1c`), and its look and
|
|
376
|
-
* tuning numbers are read from the biome's rows instead of from the game's look.
|
|
377
|
-
*
|
|
378
|
-
* What stays in code is the algorithm's own structure: the cell of the spacing grid, the understorey
|
|
379
|
-
* loop's count, the candidate budget of each grid, the detail disc's two radii. A number here is the
|
|
380
|
-
* shape of the rule, not the look of a biome; a number in a row is the look.
|
|
381
|
-
*
|
|
382
|
-
* The four stages the PRD names are these generators' four jobs, in order: `surfaceSample` draws a
|
|
383
|
-
* candidate, `densityFilter` refuses it on slope, water, height, meadow weight and the stand field,
|
|
384
|
-
* `selfPrune` keeps its spacing against the accepted ones, and `meshSpawn` stamps the asset with its
|
|
385
|
-
* yaw, scale and normal.
|
|
386
|
-
*/
|
|
291
|
+
/** The ordered scatter's rules: every number one biome's generators read, from its biome rows. */
|
|
387
292
|
/** The cover drift a biome's blades grow on, read from its grass row. */
|
|
388
293
|
interface ICoverFieldDrift {
|
|
389
294
|
/** The value-noise field the drift is measured on. */
|
|
@@ -472,6 +377,27 @@ interface IOrderedScatterRules {
|
|
|
472
377
|
* @example const rules = orderedScatterRules(spec);
|
|
473
378
|
*/
|
|
474
379
|
declare function orderedScatterRules(spec: IBiomeSpec): IOrderedScatterRules;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The ordered scatter: one stream of draws, in one fixed order, for a biome whose rules are code.
|
|
383
|
+
*
|
|
384
|
+
* A biome that says `"stream": "ordered"` does not place one rule at a time from a seed per rule. It
|
|
385
|
+
* runs fifteen generators — a stand loop, an understorey, clumped ground cover, three grids, a tide
|
|
386
|
+
* line, a river walk, a detail disc and a cobbled bed — and draws every candidate from one
|
|
387
|
+
* `createRandom` stream in that order. The order IS the rule: change one draw and every later
|
|
388
|
+
* placement moves. So this file is the generator, copied line for line from the game that graded it
|
|
389
|
+
* (Strata's `examples/strata-terrain-preview/src/render/scatter.ts` at `5afb42b1c`), and its look and
|
|
390
|
+
* tuning numbers are read from the biome's rows instead of from the game's look.
|
|
391
|
+
*
|
|
392
|
+
* What stays in code is the algorithm's own structure: the cell of the spacing grid, the understorey
|
|
393
|
+
* loop's count, the candidate budget of each grid, the detail disc's two radii. A number here is the
|
|
394
|
+
* shape of the rule, not the look of a biome; a number in a row is the look.
|
|
395
|
+
*
|
|
396
|
+
* The four stages the PRD names are these generators' four jobs, in order: `surfaceSample` draws a
|
|
397
|
+
* candidate, `densityFilter` refuses it on slope, water, height, meadow weight and the stand field,
|
|
398
|
+
* `selfPrune` keeps its spacing against the accepted ones, and `meshSpawn` stamps the asset with its
|
|
399
|
+
* yaw, scale and normal.
|
|
400
|
+
*/
|
|
475
401
|
/** A field the placement rule reads: the world's baked transport and sampled geometry. */
|
|
476
402
|
interface IOrderedScatterField {
|
|
477
403
|
readonly erosion?: IErosionMaps;
|
|
@@ -510,7 +436,40 @@ interface IOrderedScatter {
|
|
|
510
436
|
declare function scatterProps(data: IOrderedScatterField, focus: {
|
|
511
437
|
x: number;
|
|
512
438
|
z: number;
|
|
513
|
-
}, clearings?: readonly (readonly [number, number, number])[]
|
|
439
|
+
}, clearings?: readonly (readonly [number, number, number])[], spawn?: {
|
|
440
|
+
x: number;
|
|
441
|
+
z: number;
|
|
442
|
+
}): IOrderedScatter;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* A biome's band rows resolved once against the world they are about.
|
|
446
|
+
*
|
|
447
|
+
* The values in `biome.data.json` are fractions of the measured height range: the same numbers make
|
|
448
|
+
* a 40 m valley and a 900 m massif, and a world with a different crop of the same landform reads the
|
|
449
|
+
* same bands. Resolving them here keeps one owner of the numbers (the biome file) and one owner of
|
|
450
|
+
* the measurement (this function), so a game reads bands instead of repeating the arithmetic.
|
|
451
|
+
*/
|
|
452
|
+
interface IMeasuredBands {
|
|
453
|
+
/** Lowest and highest sample, metres. Equal when the field is flat; the bands then collapse onto it. */
|
|
454
|
+
readonly elevationRange: readonly [number, number];
|
|
455
|
+
/** Each ground layer's band in metres, keyed by its row, in the order the file lists it. */
|
|
456
|
+
readonly bands: Readonly<Record<string, readonly [number, number]>>;
|
|
457
|
+
/** The `snow` row's band, when the biome has one. */
|
|
458
|
+
readonly snowBand: readonly [number, number] | null;
|
|
459
|
+
/**
|
|
460
|
+
* The `snow` row's slope interval, in degrees: snow starts to shed at the first and is gone by the
|
|
461
|
+
* second. `null` when the row has no shed rule.
|
|
462
|
+
*/
|
|
463
|
+
readonly snowShed: readonly [number, number] | null;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Resolve a biome's fraction bands against this world's own height samples.
|
|
467
|
+
* @requires npm i -D @threenative/terrain
|
|
468
|
+
* @situation turn a biome file's height fractions into the metres a world actually measured
|
|
469
|
+
* @constraint samples are finite and at least one; a flat field resolves every band onto its one height
|
|
470
|
+
* @example const bands = measureBands(spec.layers, state.height);
|
|
471
|
+
*/
|
|
472
|
+
declare function measureBands(layers: readonly ILayerInfo[], heights: ArrayLike<number>): IMeasuredBands;
|
|
514
473
|
|
|
515
474
|
/**
|
|
516
475
|
* The four stages a scatter runs, named after the PCG elements that do each one
|
|
@@ -742,6 +701,47 @@ declare function placeMassif(terrain: Terrain, options: IPlaceMassifOptions): {
|
|
|
742
701
|
placement: IMassifPlacement;
|
|
743
702
|
};
|
|
744
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Paint each placed tree's crown into a per-vertex canopy grid, so the ground under a stand reads as
|
|
706
|
+
* forest floor rather than open turf. `values` is row-major Z then X, centred on the origin, at the
|
|
707
|
+
* heightfield's own spacing; each vertex keeps the strongest crown that reaches it (0 to 1).
|
|
708
|
+
* @situation shade the ground under a baked stand, at bake time or after a placement edit
|
|
709
|
+
* @constraint `crowns` is metres of crown radius per unit of placement scale, keyed by asset; other assets paint nothing
|
|
710
|
+
* @requires npm i -D @threenative/terrain
|
|
711
|
+
* @example paintCanopyCover(values, { size: 512, resolution: 257 }, placements, { spruce: 7 });
|
|
712
|
+
*/
|
|
713
|
+
declare function paintCanopyCover(values: Float32Array, world: {
|
|
714
|
+
readonly size: number;
|
|
715
|
+
readonly resolution: number;
|
|
716
|
+
}, placements: readonly {
|
|
717
|
+
readonly asset: string;
|
|
718
|
+
readonly position: readonly number[];
|
|
719
|
+
readonly scale: number;
|
|
720
|
+
}[], crowns: Readonly<Record<string, number>>): void;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* The share of the sky each heightfield vertex sees past the terrain around it: 1 on open ground,
|
|
724
|
+
* lower on a valley floor, at a cliff foot or in a crater.
|
|
725
|
+
*
|
|
726
|
+
* The logic follows TerraForge3D's horizon ambient pass (MIT, `heightfield/ambient/compute.glsl`):
|
|
727
|
+
* march outward along evenly spaced azimuths, keep the highest horizon each one meets, and integrate
|
|
728
|
+
* the cosine-weighted sky above it, which is `cos²` of the horizon angle per azimuth. Only ground
|
|
729
|
+
* that rises over both the vertex's tangent plane and the horizontal occludes, so a straight slope
|
|
730
|
+
* and a steep face over a flat floor stay open: the lighting already counts the slope's own tilt.
|
|
731
|
+
*
|
|
732
|
+
* Heights are row-major Z then X, centred on the origin, as the baked world stores them. Every node
|
|
733
|
+
* marches: a strided march filled bilinearly erred by 0.13 at p99 on the alpine survey's creases.
|
|
734
|
+
* About 0.4 s of CPU a world, so `bakeKit` runs it and the game loads `<world>.sky.bin`.
|
|
735
|
+
* @situation bake a heightfield's sky occlusion for the ground's ambient light
|
|
736
|
+
* @constraint offline: about 0.4 s of CPU for a 257² field; bake it, do not run it per frame
|
|
737
|
+
* @requires npm i -D @threenative/terrain
|
|
738
|
+
* @example const sky = skyVisibility(heights, 257, 512);
|
|
739
|
+
*/
|
|
740
|
+
declare function skyVisibility(heights: ArrayLike<number>, resolution: number, size: number, { azimuths, reach }?: {
|
|
741
|
+
azimuths?: number;
|
|
742
|
+
reach?: number;
|
|
743
|
+
}): Float32Array;
|
|
744
|
+
|
|
745
745
|
interface ITerrainStats {
|
|
746
746
|
/** Highest minus lowest height, metres. */
|
|
747
747
|
readonly relief: number;
|
|
@@ -764,6 +764,45 @@ interface ITerrainStats {
|
|
|
764
764
|
*/
|
|
765
765
|
declare function terrainStats(height: ArrayLike<number>, n: number, size: number): ITerrainStats;
|
|
766
766
|
|
|
767
|
+
/** The ground a biome's grass grows on: its height, and the sea it stays clear of. */
|
|
768
|
+
interface IGrassGround {
|
|
769
|
+
/** World height at (x, z), metres. */
|
|
770
|
+
heightAt(x: number, z: number): number;
|
|
771
|
+
/** The height a row's `height` band is measured from; 0 when absent. */
|
|
772
|
+
readonly floor?: number;
|
|
773
|
+
/** The water level a row keeps its `waterMargin` above; no water when absent or null. */
|
|
774
|
+
readonly waterLevel?: number | null;
|
|
775
|
+
}
|
|
776
|
+
/** The placement options `GrassField3D` takes, read from a biome's grass rows. */
|
|
777
|
+
interface IGrassFieldPlacement {
|
|
778
|
+
readonly getHeight: (x: number, z: number) => number;
|
|
779
|
+
readonly getDensity: (x: number, z: number, height: number, normalY: number) => number;
|
|
780
|
+
readonly maxSlope: number;
|
|
781
|
+
readonly slopeFade: number;
|
|
782
|
+
readonly minAltitude: number;
|
|
783
|
+
readonly maxAltitude: number;
|
|
784
|
+
readonly seed: number;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Turns a terrain biome's grass rows and its ground into `GrassField3D` placement options, so a
|
|
788
|
+
* generated or cooked world grows streamed grass with one call. Returns null when the biome has no
|
|
789
|
+
* grass rows: the game draws no field.
|
|
790
|
+
*
|
|
791
|
+
* Each row covers its own slope band (full to `slope[1]`, gone `slopeFalloff` degrees past it),
|
|
792
|
+
* its own height band above `ground.floor` (fading over `heightFalloff` below the ceiling) and
|
|
793
|
+
* stays `waterMargin` above `ground.waterLevel`; the field takes the strongest row at each spot.
|
|
794
|
+
*
|
|
795
|
+
* @requires npm i -D @threenative/terrain
|
|
796
|
+
* @situation grow streamed grass on a terrain world's biome grass rows
|
|
797
|
+
* @situation a Strata or terrain_generate world with a meadow that sways round the player
|
|
798
|
+
* @situation feed a cooked biome to GrassField3D
|
|
799
|
+
* @constraint the look stays the game's: pass the result with the kit's `render/grass.ts` blade and material
|
|
800
|
+
* @example
|
|
801
|
+
* const placement = grassFieldFromBiome(biome, { heightAt: (x, z) => field.heightAt(x, z), waterLevel: 0 });
|
|
802
|
+
* if (placement) ctx.add(new GrassField3D({ ...placement, blade: grassBlade(), material: grassMaterial }));
|
|
803
|
+
*/
|
|
804
|
+
declare function grassFieldFromBiome(biome: Pick<IBiomeSpec, "grass" | "seed">, ground: IGrassGround): IGrassFieldPlacement | null;
|
|
805
|
+
|
|
767
806
|
/** Bilinear world-space height query. It is not the rendered or collidable triangle surface. */
|
|
768
807
|
/**
|
|
769
808
|
* Bilinear query of canonical height samples; triangle sampling is a separate contract.
|
|
@@ -831,25 +870,6 @@ declare const PARAMS: Readonly<Record<OperationType, readonly string[]>>;
|
|
|
831
870
|
*/
|
|
832
871
|
declare function validateDocument(doc: ITerrainDocument): void;
|
|
833
872
|
|
|
834
|
-
/**
|
|
835
|
-
* Bakes the recovered indexed top surface and optional vertical skirts into caller-owned arrays.
|
|
836
|
-
* @requires npm i @threenative/terrain
|
|
837
|
-
* @situation bake an authored terrain into portable indexed mesh arrays
|
|
838
|
-
* @constraint no material is chosen; vertex colours exist only with a caller-supplied palette
|
|
839
|
-
* @example const mesh = bakeMesh(new Terrain({ resolution: 17 }).evaluate());
|
|
840
|
-
* @override step, chunk bounds, skirtDepth and palette belong to the caller
|
|
841
|
-
*/
|
|
842
|
-
declare function bakeMesh(state: ITerrainState, { step, x, z, cells, skirtDepth, palette, }?: IBakeMeshOptions): IBakedMesh;
|
|
843
|
-
/**
|
|
844
|
-
* Bakes finite LOD chunks, the same collision samples and resolved placements.
|
|
845
|
-
* @requires npm i @threenative/terrain
|
|
846
|
-
* @situation prepare terrain arrays and collision before a game starts
|
|
847
|
-
* @constraint collision origin is the southwest corner; engine Heightfield origin is its centre
|
|
848
|
-
* @example const baked = bakeTerrain(new Terrain({ resolution: 129 }).evaluate(), { chunkCells: 64 });
|
|
849
|
-
* @override chunkCells, lodSteps, skirtDepth and palette are explicit authoring choices
|
|
850
|
-
*/
|
|
851
|
-
declare function bakeTerrain(state: ITerrainState, { chunkCells, lodSteps, skirtDepth, palette, }?: IBakeTerrainOptions): IBakedTerrain;
|
|
852
|
-
|
|
853
873
|
/**
|
|
854
874
|
* Validate and clone stable-key placement transforms before saving or previewing them.
|
|
855
875
|
* @requires npm i -D @threenative/terrain
|
|
@@ -955,143 +975,6 @@ declare function encodeZIP(files: readonly IExportFile[]): Uint8Array<ArrayBuffe
|
|
|
955
975
|
declare function makeExport(state: ITerrainState | null, recipe: ITerrainDocument, kind: "project"): Promise<IExportArchive>;
|
|
956
976
|
declare function makeExport(state: ITerrainState, recipe: ITerrainDocument, kind: ExportKind): Promise<IExportArchive>;
|
|
957
977
|
|
|
958
|
-
/**
|
|
959
|
-
* The streamed prop worlds one bake writes, and what each one holds.
|
|
960
|
-
*
|
|
961
|
-
* A prop package is the same container as a world package (`world-package.ts`): eight float32 per
|
|
962
|
-
* placement, cells of a fixed size, and one run per asset inside a cell. What it adds is the split
|
|
963
|
-
* into streamed worlds. The game draws its placements in more than one `WorldCells` because reach
|
|
964
|
-
* and shadow policy differ between a horizon-canopy tree and a shadowless blade of grass, and the
|
|
965
|
-
* far field and the vista meadow answer a query flag. This module turns labelled placements into
|
|
966
|
-
* those worlds, so the bake writes them and the game loads them, and neither side owns the grouping.
|
|
967
|
-
*/
|
|
968
|
-
/** Which streamed world a record draws in, for a loader that answers a query flag before it loads. */
|
|
969
|
-
type IPropBucketKind = "local" | "far" | "meadow";
|
|
970
|
-
/** One placement, the streamed world it belongs to, and how far it may draw. */
|
|
971
|
-
interface IPropBucketEntry {
|
|
972
|
-
readonly placement: IPlacement;
|
|
973
|
-
/** The streamed world's name, e.g. `local:true`. Two entries of one name share every container field. */
|
|
974
|
-
readonly bucket: string;
|
|
975
|
-
/** Metres at which the record may be culled; `Number.POSITIVE_INFINITY` keeps every cell resident. */
|
|
976
|
-
readonly reach: number;
|
|
977
|
-
/**
|
|
978
|
-
* The model the record draws, when it is not the placement's asset alone: the game's
|
|
979
|
-
* `asset:variant` key, with a shape suffix when one scale cannot carry the placement. The run a
|
|
980
|
-
* record sits in names it, and the loader's asset table is keyed by it.
|
|
981
|
-
*/
|
|
982
|
-
readonly key?: string;
|
|
983
|
-
/** Defaults to `local`. A bucket that names two kinds fails the compile. */
|
|
984
|
-
readonly kind?: IPropBucketKind;
|
|
985
|
-
}
|
|
986
|
-
/** One streamed prop world: its container, its per-record reach, and its per-record placement ID. */
|
|
987
|
-
interface IPropBucketPackage {
|
|
988
|
-
readonly bucket: string;
|
|
989
|
-
readonly kind: IPropBucketKind;
|
|
990
|
-
readonly extent: IWorldPackageManifest["extent"];
|
|
991
|
-
readonly cells: readonly {
|
|
992
|
-
readonly x: number;
|
|
993
|
-
readonly z: number;
|
|
994
|
-
readonly runs: readonly IWorldPackageRun[];
|
|
995
|
-
}[];
|
|
996
|
-
/** Eight float32 per record: position, quaternion, uniform scale. */
|
|
997
|
-
readonly placements: Uint8Array;
|
|
998
|
-
/** One float32 per record, in record order. */
|
|
999
|
-
readonly reach: Float32Array;
|
|
1000
|
-
/** One placement ID per record, in record order. The game's `variantFor` hashes it. */
|
|
1001
|
-
readonly ids: readonly string[];
|
|
1002
|
-
}
|
|
1003
|
-
interface IPropPackage {
|
|
1004
|
-
readonly cellSize: number;
|
|
1005
|
-
readonly buckets: readonly IPropBucketPackage[];
|
|
1006
|
-
}
|
|
1007
|
-
interface ICompilePropBucketsOptions {
|
|
1008
|
-
/** Metres per streamed cell. Defaults to 128. */
|
|
1009
|
-
readonly cellSize?: number;
|
|
1010
|
-
/**
|
|
1011
|
-
* The extent every bucket includes before its own placements widen it, e.g. the world square.
|
|
1012
|
-
* Without it a bucket spans exactly its own placements.
|
|
1013
|
-
*/
|
|
1014
|
-
readonly bounds?: IWorldPackageManifest["extent"];
|
|
1015
|
-
}
|
|
1016
|
-
/** The cell size the game streams props in: 128 m, coarse enough that admission jobs stay bounded. */
|
|
1017
|
-
declare const PROP_CELL_SIZE = 128;
|
|
1018
|
-
/**
|
|
1019
|
-
* Group placements into their streamed worlds and write each world's cells and records.
|
|
1020
|
-
*
|
|
1021
|
-
* The order is the streamed one: cells sorted by `x` then `z`, assets sorted by name inside a cell,
|
|
1022
|
-
* and records in the order the entries arrived inside a run. Same-cell, same-asset placements keep
|
|
1023
|
-
* their input order, so a re-run of a seeded bake reproduces the buffer byte for byte.
|
|
1024
|
-
*
|
|
1025
|
-
* @requires npm i -D @threenative/terrain
|
|
1026
|
-
* @situation bake the prop worlds a game streams, once, instead of compiling them at load
|
|
1027
|
-
* @constraint headless; the caller decides every placement, its streamed world, its reach and its pose
|
|
1028
|
-
* @example const pkg = compilePropBuckets(entries, { bounds });
|
|
1029
|
-
* @override cellSize and the base extent; the bucket, reach and kind of every entry
|
|
1030
|
-
*/
|
|
1031
|
-
declare function compilePropBuckets(entries: readonly IPropBucketEntry[], options?: ICompilePropBucketsOptions): IPropPackage;
|
|
1032
|
-
/**
|
|
1033
|
-
* The asset a package run names.
|
|
1034
|
-
*
|
|
1035
|
-
* A prop run names the model it draws, `asset:variant[@shape]`; a container written by
|
|
1036
|
-
* `bakeWorldPackage` names the asset alone. Both reduce to the asset here, which is what a count, a
|
|
1037
|
-
* material or a placement's own `asset` field holds.
|
|
1038
|
-
*
|
|
1039
|
-
* @requires npm i -D @threenative/terrain
|
|
1040
|
-
* @situation count one species across a world's prop buckets, or name the asset a run draws
|
|
1041
|
-
* @example const asset = propAssetOf("spruce:2"); // "spruce"
|
|
1042
|
-
*/
|
|
1043
|
-
declare function propAssetOf(modelKey: string): string;
|
|
1044
|
-
/** One record of a compiled prop bucket, in record order. */
|
|
1045
|
-
interface IPropBucketRecord {
|
|
1046
|
-
readonly id: string;
|
|
1047
|
-
/** The model the record draws, as its run names it (`spruce:2`, or with a shape suffix). */
|
|
1048
|
-
readonly key: string;
|
|
1049
|
-
/** The asset alone, `propAssetOf(key)`. */
|
|
1050
|
-
readonly asset: string;
|
|
1051
|
-
readonly position: readonly [number, number, number];
|
|
1052
|
-
readonly quaternion: readonly [number, number, number, number];
|
|
1053
|
-
readonly scale: number;
|
|
1054
|
-
readonly reach: number;
|
|
1055
|
-
}
|
|
1056
|
-
/**
|
|
1057
|
-
* The records of one compiled prop bucket, read back in record order: the inverse of
|
|
1058
|
-
* `compilePropBuckets`, so a loader that fetched a bake's files gets each record's ID, model,
|
|
1059
|
-
* pose and reach without re-deriving the container layout.
|
|
1060
|
-
*
|
|
1061
|
-
* @requires npm i -D @threenative/terrain
|
|
1062
|
-
* @situation read a baked prop bucket back into placements to ground them on this machine's terrain
|
|
1063
|
-
* @constraint throws `TN_PROP_BUCKET_INVALID` when the record buffer, the IDs and the runs disagree
|
|
1064
|
-
* @example for (const record of decodePropBucket(bucket)) pose(record.key, record.position, record.quaternion);
|
|
1065
|
-
*/
|
|
1066
|
-
declare function decodePropBucket(bucket: IPropBucketPackage): IPropBucketRecord[];
|
|
1067
|
-
/** The files one bake writes for a world's prop package: its bucket list and each bucket's three files. */
|
|
1068
|
-
interface IPropPackageFiles {
|
|
1069
|
-
readonly manifest: Uint8Array;
|
|
1070
|
-
readonly files: Readonly<Record<string, Uint8Array>>;
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* A path under `world/` that no bucket name can break: `local:true` becomes `local-true`.
|
|
1074
|
-
*
|
|
1075
|
-
* The bucket's own name is kept in the manifest, so this rename is only a file-system concern.
|
|
1076
|
-
*
|
|
1077
|
-
* @requires npm i -D @threenative/terrain
|
|
1078
|
-
* @situation name one of a bucket's three files without a bucket key that breaks a path
|
|
1079
|
-
* @example const file = propPackageFile("forest", "local:true", "props.bin"); // "forest.local-true.props.bin"
|
|
1080
|
-
*/
|
|
1081
|
-
declare function propPackageFile(world: string, bucket: string, suffix: string): string;
|
|
1082
|
-
/**
|
|
1083
|
-
* Write a compiled package as the manifest the game fetches and one set of files per bucket.
|
|
1084
|
-
*
|
|
1085
|
-
* The manifest names the files rather than embedding them, so a loader fetches only the buckets its
|
|
1086
|
-
* query flags keep (`?farForest=on` keeps the far field, `?meadow=off` drops the vista cover).
|
|
1087
|
-
*
|
|
1088
|
-
* @requires npm i -D @threenative/terrain
|
|
1089
|
-
* @situation write a compiled package to disk: one manifest and three files per streamed world
|
|
1090
|
-
* @constraint the manifest names the files; nothing here touches a file system
|
|
1091
|
-
* @example const { manifest, files } = propPackageFiles(pkg, "forest");
|
|
1092
|
-
*/
|
|
1093
|
-
declare function propPackageFiles(pkg: IPropPackage, world: string): IPropPackageFiles;
|
|
1094
|
-
|
|
1095
978
|
/**
|
|
1096
979
|
* A spatial index for water proximity: river segments, river stations and lake shores.
|
|
1097
980
|
*
|
|
@@ -1125,4 +1008,4 @@ interface ISegmentIndex<T> {
|
|
|
1125
1008
|
*/
|
|
1126
1009
|
declare function createSegmentIndex<T>(segments: readonly IWaterSegment<T>[], cellSize: number): ISegmentIndex<T>;
|
|
1127
1010
|
|
|
1128
|
-
export { BAKE_BIOME_STAGES, type CoverFieldName, type CoverGround, ExportKind, type
|
|
1011
|
+
export { BAKE_BIOME_STAGES, type CoverFieldName, type CoverGround, ExportKind, type IBakeBiomeOptions, type IBakeBiomeStage, type IBakedBiome, IBakedMesh, type IBiomeSpec, type IBiomeWaterBody, type ICoverDriftRow, type ICoverField, type ICoverFieldDrift, type ICoverSpec, IDecodeHeightPngOptions, IDecodeRaw16Options, IErosionMaps, IExportArchive, IExportFile, type IFarFieldOptions, type IFarFieldRule, type IFoliageType, type IGrassFieldPlacement, type IGrassGround, type IGrassType, IHeightRange, type ILayerInfo, IMask, type IMassifPlacement, type IMassifTile, type IMeasuredBands, type IOrderedScatter, type IOrderedScatterField, type IOrderedScatterRules, type IPlaceMassifOptions, IPlacement, IPlacementOverride, IRaw16Options, ISampledGrid, type ISegmentIndex, type ISpawnSpec, ITerrainDocument, ITerrainState, type ITerrainStats, type IUnderstoreySpec, type IWaterSegment, LandformKind, MATERIAL_IDS, MATS_FIELD, Mask, MaterialId, OperationType, PARAMS, RESOLUTIONS, STAND_FIELD, Terrain, applyPlacementOverrides, bakeBiome, collarSampler, createSegmentIndex, decodeHeightPNG, decodeRAW16, encodeGLB, encodeHeightPNG, encodeRAW16, encodeSplatPNGs, encodeZIP, farForestPlacements, fieldWeight, gradientAt, grassFieldFromBiome, liftMassif, makeExport, measureBands, orderedScatterRules, paintCanopyCover, placeMassif, sampleHeight, scatterProps, skyVisibility, slopeAtIndex, slopeQuantile, splinePoints, terrainStats, validateBiome, validateDocument, validatePlacementOverrides };
|