@threenative/terrain 0.1.7 → 0.1.8
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/AGENT_GUIDE.md +19 -4
- package/dist/editor/index.d.ts +160 -5
- package/dist/editor/index.js +3783 -1406
- package/dist/editor/server.d.ts +2 -2
- package/dist/editor/server.js +555 -121
- package/dist/editor/worker.d.ts +33 -1
- package/dist/editor/worker.js +444 -110
- package/dist/export.d.ts +11 -9
- package/dist/export.js +22 -34
- package/dist/index.d.ts +727 -73
- package/dist/index.js +2434 -553
- package/dist/kit.d.ts +56 -0
- package/dist/kit.js +2524 -0
- package/dist/mcp/cook-child.d.ts +2 -0
- package/dist/mcp/cook-child.js +3705 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +3279 -0
- package/dist/{server-ByM2hmYJ.d.ts → server-C8Ydr_IM.d.ts} +3 -2
- package/dist/starter.d.ts +143 -0
- package/dist/starter.js +1030 -0
- package/dist/{terrain-gPnkCU6S.d.ts → terrain-B3DkduPw.d.ts} +3 -2
- package/dist/three.d.ts +1 -1
- package/dist/{types-Ant8-Axc.d.ts → types-CPYAc9vo.d.ts} +13 -4
- package/dist/world-package-B7KGYIou.d.ts +94 -0
- package/package.json +28 -6
- package/starter/alpine/README.md +77 -1
- package/starter/alpine/bake.mjs +4 -116
- package/starter/alpine/biome.data.json +114 -0
- package/starter/alpine/heightmap.r16 +0 -0
- package/starter/alpine/recipe.json +3 -66051
- package/starter/alpine/world.ts +45 -293
- package/starter/coastal/README.md +77 -1
- package/starter/coastal/bake.mjs +4 -116
- package/starter/coastal/biome.data.json +135 -0
- package/starter/coastal/heightmap.r16 +0 -0
- package/starter/coastal/recipe.json +3 -66051
- package/starter/coastal/sea.ts +49 -16
- package/starter/coastal/world.ts +53 -318
- package/starter/desert/README.md +77 -1
- package/starter/desert/bake.mjs +4 -116
- package/starter/desert/biome.data.json +114 -0
- package/starter/desert/heightmap.r16 +0 -0
- package/starter/desert/recipe.json +3 -66051
- package/starter/desert/world.ts +45 -293
- package/starter/forest/README.md +84 -4
- package/starter/forest/assets.json +32 -0
- package/starter/forest/bake.mjs +6 -116
- package/starter/forest/biome.data.json +150 -0
- package/starter/forest/heightmap.r16 +0 -0
- package/starter/forest/recipe.json +192 -4428
- package/starter/forest/sky.ts +11 -0
- package/starter/forest/water.ts +30 -20
- package/starter/forest/world.ts +86 -322
- package/starter/tundra/README.md +77 -1
- package/starter/tundra/bake.mjs +4 -116
- package/starter/tundra/biome.data.json +131 -0
- package/starter/tundra/heightmap.r16 +0 -0
- package/starter/tundra/recipe.json +18 -66066
- package/starter/tundra/world.ts +65 -319
- package/starter-assets.json +6 -0
- package/{starter-assets/credits.json → starter-credits.json} +12 -105
- package/starter-assets/bark_brown_02/bark_brown_02_diff_1k.jpg +0 -0
- package/starter-assets/bark_brown_02/bark_brown_02_nor_gl_1k.jpg +0 -0
- package/starter-assets/bark_brown_02/bark_brown_02_rough_1k.jpg +0 -0
- package/starter-assets/boulder_01/boulder-mid.glb +0 -0
- package/starter-assets/boulder_01/boulder-near.glb +0 -0
- package/starter-assets/cliff_side/cliff_side_ao_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_diff_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_nor_gl_1k.jpg +0 -0
- package/starter-assets/cliff_side/cliff_side_rough_1k.jpg +0 -0
- package/starter-assets/fern_02/fern_02_alpha_512.png +0 -0
- package/starter-assets/fern_02/fern_02_diff_512.jpg +0 -0
- package/starter-assets/fern_02/fern_02_nor_gl_512.jpg +0 -0
- package/starter-assets/fir_tree_01/fir-b-lod1.glb +0 -0
- package/starter-assets/fir_tree_01/fir-b-lod2.glb +0 -0
- package/starter-assets/fir_tree_01/fir-c-lod1.glb +0 -0
- package/starter-assets/fir_tree_01/fir-c-lod2.glb +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_arm_1k.jpg +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_diff_1k.jpg +0 -0
- package/starter-assets/fir_tree_01/fir_tree_01_twig_nor_gl_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_ao_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_diff_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_nor_gl_1k.jpg +0 -0
- package/starter-assets/forest_ground_04/forest_ground_04_rough_1k.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_arm_512.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_diff_512.jpg +0 -0
- package/starter-assets/forest_leaves_02/forest_leaves_02_nor_gl_512.jpg +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_alpha_512.png +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_diff_512.jpg +0 -0
- package/starter-assets/grass_medium_02/grass_medium_02_nor_gl_512.jpg +0 -0
- package/starter-assets/hdri/kloofendal_48d_partly_cloudy_1k.hdr +0 -0
- package/starter-assets/leafy_grass/leafy_grass_ao_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_diff_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_nor_gl_1k.jpg +0 -0
- package/starter-assets/leafy_grass/leafy_grass_rough_1k.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_arm_512.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_diff_512.jpg +0 -0
- package/starter-assets/lichen_rock/lichen_rock_nor_gl_512.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_ao_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_diff_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_nor_gl_1k.jpg +0 -0
- package/starter-assets/mossy_rock/mossy_rock_rough_1k.jpg +0 -0
- package/starter-assets/needle-atlas.png +0 -0
- package/starter-assets/needle-surface.png +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_arm_512.jpg +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_diff_512.jpg +0 -0
- package/starter-assets/river_small_rocks/river_small_rocks_nor_gl_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_arm_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_diff_512.jpg +0 -0
- package/starter-assets/rock_boulder_dry/rock_boulder_dry_nor_gl_512.jpg +0 -0
- package/starter-assets/rocks/boulder-mid.glb +0 -0
- package/starter-assets/rocks/boulder-near.glb +0 -0
- package/starter-assets/rocks/boulder-prep.json +0 -37
- package/starter-assets/rocks/rock01-mid.glb +0 -0
- package/starter-assets/rocks/rock01-near.glb +0 -0
- package/starter-assets/rocks/rock01-prep.json +0 -37
- package/starter-assets/rocks/rock04-mid.glb +0 -0
- package/starter-assets/rocks/rock04-near.glb +0 -0
- package/starter-assets/rocks/rock04-prep.json +0 -37
- package/starter-assets/sand_01/sand_01_ao_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_diff_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_nor_gl_1k.jpg +0 -0
- package/starter-assets/sand_01/sand_01_rough_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_ao_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_diff_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_nor_gl_1k.jpg +0 -0
- package/starter-assets/snow_02/snow_02_rough_1k.jpg +0 -0
package/AGENT_GUIDE.md
CHANGED
|
@@ -79,6 +79,18 @@ t.materials({ id: 'surfaces', base: 'grass', rules: [
|
|
|
79
79
|
t.paint({ id: 'camp-dirt', at: [-70,50], radius: 27, material: 'dirt', strength: .9 });
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
## Realistic mountains and environments
|
|
83
|
+
|
|
84
|
+
Start from a kind, not from noise. `landform(kind, { size, resolution, seed, relief })` returns an ordinary `Terrain` with a calibrated recipe: `alpine`, `temperateMountains`, `rollingHills`, `desertMesa`, `coastalCliffs`, `tundra`, `volcanic`. `LANDFORMS[kind]` names the real reference landscape and the measured targets. It decides shape only, never material or colour. Calibrated at size 5000, resolution 513; other sizes keep slopes and scale relief with `size`. `relief` (metres, highest minus lowest) defaults to the kind's real ratio times `size`.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { landform, terrainStats } from '@threenative/terrain';
|
|
88
|
+
const state = landform('alpine', { seed: 4 }).evaluate(); // build script, about 1.5 s at 513
|
|
89
|
+
terrainStats(state.height, state.resolution, state.size); // relief, slopes, hypsometry, curvature kurtosis
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`erode({ method: 'fluvial' })` is the engine behind it: stream-power incision with uplift (Braun & Willett 2013, Cordonnier et al. 2016). The earlier layers are the uplift envelope; it cuts dendritic valleys and sharp divides that droplet erosion at game resolution does not. Params: `iterations` (default 40), `uplift` m/yr, `erodibility` K, `timeStep` yr, `talus` landslide threshold, `relief` metres. Follow it with a short `thermal` pass and `smooth` to remove the 8-neighbour grain. Bake a backdrop: `node packages/terrain/scripts/bake-horizon.mjs alpine --seed 4 --out alpine-horizon.json`.
|
|
93
|
+
|
|
82
94
|
## Roads, rivers and water
|
|
83
95
|
|
|
84
96
|
A road, river or ramp **grades itself to the ground it crosses** when a control point leaves its elevation out (`null`, or `NaN` in code) or when it sets `followTerrain: true`. The elevation is sampled along the centreline, low-passed along arc length, then held inside `maxGrade` (default 0.12) and `maxCut`/`maxFill` (default 2.5 m / 1.5 m); the shoulder widens into a batter with the cut or fill, so a corridor never stands on a retaining step. Leaving the ground is the hard limit: where the ground itself is steeper than `maxGrade`, the road is steep too. Absolute elevations are still honoured exactly, so existing documents keep their meaning. Horizontal spline interpolation is Catmull–Rom; vertical interpolation is linear between controls to avoid vertical overshoot. Use `smooth:false` for a polyline.
|
|
@@ -169,11 +181,11 @@ panel that calls the same code. A write names `baseRevision`; a stale one is a 4
|
|
|
169
181
|
|
|
170
182
|
## Resolved static-world GLB
|
|
171
183
|
|
|
172
|
-
Import `
|
|
184
|
+
Import `prepareWorldGLTF` from `@threenative/terrain/export` in browser authoring source. Its import is DOM-free; scene preparation requires FileReader and canvas. Root and `/three` remain headless. This entry uses the installed Three.js GLTFExporter to prepare glTF JSON; the Node assets cook owns GLB encoding.
|
|
173
185
|
|
|
174
186
|
```ts
|
|
175
|
-
import {
|
|
176
|
-
const
|
|
187
|
+
import { prepareWorldGLTF } from '@threenative/terrain/export';
|
|
188
|
+
const prepared = await prepareWorldGLTF({
|
|
177
189
|
revision, // accepted document's 64-character content hash
|
|
178
190
|
snapshotTime, // finite seconds, pinned across all baked deformations
|
|
179
191
|
state, // evaluated committed recipe with applied override records
|
|
@@ -182,7 +194,10 @@ const output = await exportWorldGLB({
|
|
|
182
194
|
transforms, // Map<placementId, Matrix4>: actual final grounded root matrices
|
|
183
195
|
water, // [{ id, object, time: snapshotTime, staleFrames: 0 }]
|
|
184
196
|
});
|
|
185
|
-
//
|
|
197
|
+
// Send prepared.json to your Node authoring process, then:
|
|
198
|
+
// import { cookTerrainWorld } from '@threenative/assets';
|
|
199
|
+
// const { worldGlb } = await cookTerrainWorld({ preparedWorld: prepared.json });
|
|
200
|
+
// worldGlb is the self-contained world.glb; persist only after success.
|
|
186
201
|
```
|
|
187
202
|
|
|
188
203
|
Game source owns all geometry, materials and images. The terrain needs albedo `map`, `normalMap`, `roughnessMap` and `aoMap`; vertex colours alone are insufficient. MeshStandardMaterial metallic/roughness surfaces are supported. Colour/emissive images are sRGB, data maps are NoColorSpace. Supply decoded byte images (at most 16 megapixels); DataTexture images need complete RGBA bytes. Bake alpha into the colour image. Bake displacement, bump/light maps, node shaders, skinning/morphing and wind into the supplied static geometry/material first. Use tangent-space normal maps with equal X/Y scale magnitudes; bake object-space/anisotropic maps first. MeshPhysicalMaterial extensions are outside this bounded encoder's contract.
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { P as PatchCommand } from '../terrain-
|
|
2
|
-
import { I as ITerrainState } from '../types-
|
|
3
|
-
import { I as
|
|
4
|
-
export { p as IAssetAdjust, q as IAssetBounds, r as IAssetKind, s as IAssetLimits, t as ICameraPose, u as ICameraSet, v as IFocusFraming, w as IFocusResolver, x as IFocusTarget, y as IHexColour, z as IPointObservation, A as IProfileObservation, B as IProfileSample, C as IProjectAsset, D as IReferenceObservation, E as ISavedSpatialReference, F as ISpatialControlPoint, G as ISpatialReference, H as ISurfaceMapping, J as ISurfaceMappings, K as ISurfaceReading, L as checkEnvironmentAssets, M as focusCamera, N as inspectSpatial, O as probeTerrain, P as runCameraOperation, Q as runEnvironmentOperation, R as sniff, S as surfaceSpace, T as validateAsset, U as validateAssets, V as validateCamera, W as validateCameras, X as validateEnvironment, Y as validateSpatialReference, Z as validateSurfaces } from '../server-
|
|
1
|
+
import { P as PatchCommand } from '../terrain-B3DkduPw.js';
|
|
2
|
+
import { L as Layer, i as IPlacementOverride, I as ITerrainState } from '../types-CPYAc9vo.js';
|
|
3
|
+
import { I as IEditorSnapshot, a as IAuthoringDocument, b as ISavedCamera, c as IFocusRequest, d as IFocusOutcome, e as IFocusBounds, f as IEnvironment, g as IEditorActivation, h as ISpatialQuery, i as ISpatialObservation, j as ICameraOperation, k as ICameraResult, l as IEnvironmentOperation, m as IEnvironmentResult, n as IAssetOperation, o as IAssetResult } from '../server-C8Ydr_IM.js';
|
|
4
|
+
export { p as IAssetAdjust, q as IAssetBounds, r as IAssetKind, s as IAssetLimits, t as ICameraPose, u as ICameraSet, v as IFocusFraming, w as IFocusResolver, x as IFocusTarget, y as IHexColour, z as IPointObservation, A as IProfileObservation, B as IProfileSample, C as IProjectAsset, D as IReferenceObservation, E as ISavedSpatialReference, F as ISpatialControlPoint, G as ISpatialReference, H as ISurfaceMapping, J as ISurfaceMappings, K as ISurfaceReading, L as checkEnvironmentAssets, M as focusCamera, N as inspectSpatial, O as probeTerrain, P as runCameraOperation, Q as runEnvironmentOperation, R as sniff, S as surfaceSpace, T as validateAsset, U as validateAssets, V as validateCamera, W as validateCameras, X as validateEnvironment, Y as validateSpatialReference, Z as validateSurfaces } from '../server-C8Ydr_IM.js';
|
|
5
|
+
import * as three from 'three';
|
|
6
|
+
import { Quaternion, Vector3, Camera, Vector2, Object3D, Intersection, Mesh, Matrix4 } from 'three';
|
|
7
|
+
import { TransformControls } from 'three/addons/controls/TransformControls.js';
|
|
5
8
|
import 'vite';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -51,6 +54,156 @@ declare function inspectImage(bytes: Uint8Array, format: string, limits: {
|
|
|
51
54
|
maxDimension: number;
|
|
52
55
|
}): IImageReport;
|
|
53
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Recipe footprints are heights over X/Z, never independently transformed solids.
|
|
59
|
+
* @requires npm i -D @threenative/terrain
|
|
60
|
+
* @situation derive a terrain-editor gizmo pose from a landform layer
|
|
61
|
+
* @constraint the caller supplies world and default footprint sizes; unsupported layers return undefined
|
|
62
|
+
* @example const pose = landformPose(layer, terrain.size, footprintSize);
|
|
63
|
+
*/
|
|
64
|
+
declare function landformPose(layer: Layer, worldSize: number, defaultSize: number): {
|
|
65
|
+
position: [number, number, number];
|
|
66
|
+
quaternion: Quaternion;
|
|
67
|
+
scale: [number, number, number];
|
|
68
|
+
rectangular: boolean;
|
|
69
|
+
} | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Convert a terrain-editor gizmo pose into a heightfield landform footprint.
|
|
72
|
+
* @requires npm i -D @threenative/terrain
|
|
73
|
+
* @situation apply a terrain-editor gizmo transform to a landform layer
|
|
74
|
+
* @constraint finite coordinates and positive scales are required; X/Z rotations that overhang throw
|
|
75
|
+
* @example const next = transformedLandform(layer, position, quaternion, scale, surfaceHeight);
|
|
76
|
+
*/
|
|
77
|
+
declare function transformedLandform(layer: Layer, position: Vector3, quaternion: Quaternion, scale: Vector3, anchor: number): Layer;
|
|
78
|
+
|
|
79
|
+
type EditorRaycast = (options: {
|
|
80
|
+
screen?: Vector2;
|
|
81
|
+
origin?: Vector3;
|
|
82
|
+
direction?: Vector3;
|
|
83
|
+
targets: readonly Object3D[];
|
|
84
|
+
}) => Intersection | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Convert viewport client coordinates once; the installed picker owns ray intersection.
|
|
87
|
+
* @requires npm i -D @threenative/terrain
|
|
88
|
+
* @situation pick a terrain-editor surface from viewport client coordinates
|
|
89
|
+
* @constraint the caller supplies the raycast implementation and ordered targets
|
|
90
|
+
* @example const hit = pickEditorSurface(ctx, [terrainMesh], event.clientX, event.clientY);
|
|
91
|
+
*/
|
|
92
|
+
declare function pickEditorSurface(ctx: {
|
|
93
|
+
renderer: {
|
|
94
|
+
domElement: {
|
|
95
|
+
getBoundingClientRect(): {
|
|
96
|
+
left: number;
|
|
97
|
+
top: number;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
raycast: EditorRaycast;
|
|
102
|
+
}, targets: readonly Object3D[], clientX: number, clientY: number): Intersection<Object3D<three.Object3DEventMap>> | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Query the rendered heightfield, including its triangulation rather than an interpolated bake.
|
|
105
|
+
* @requires npm i -D @threenative/terrain
|
|
106
|
+
* @situation query terrain-editor surface elevation at world X/Z coordinates
|
|
107
|
+
* @constraint the supplied mesh and raycast determine the surface; missing intersections return undefined
|
|
108
|
+
* @example const height = editorSurfaceHeight(ctx, terrainMesh, x, z);
|
|
109
|
+
*/
|
|
110
|
+
declare function editorSurfaceHeight(ctx: {
|
|
111
|
+
raycast: EditorRaycast;
|
|
112
|
+
}, mesh: Mesh, x: number, z: number, originHeight?: number): number | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* A foreground terrain hit occludes placements; matching uses the evaluated world position.
|
|
115
|
+
* @requires npm i -D @threenative/terrain
|
|
116
|
+
* @situation pick a placed instance in the terrain editor from viewport client coordinates
|
|
117
|
+
* @constraint the caller supplies the raycast context, terrain mesh, instanced meshes and evaluated placements
|
|
118
|
+
* @example const id = pickEditorPlacement(ctx, terrainMesh, meshes, placements, event.clientX, event.clientY);
|
|
119
|
+
*/
|
|
120
|
+
declare function pickEditorPlacement(ctx: Parameters<typeof pickEditorSurface>[0], terrain: Mesh, meshes: readonly Object3D[], placements: Iterable<{
|
|
121
|
+
pose: Matrix4;
|
|
122
|
+
placement: {
|
|
123
|
+
id: string;
|
|
124
|
+
};
|
|
125
|
+
}>, clientX: number, clientY: number): string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Project an injected world point to client pixels in the caller's viewport.
|
|
128
|
+
* @requires npm i -D @threenative/terrain
|
|
129
|
+
* @situation convert a terrain-editor world point to viewport client pixels
|
|
130
|
+
* @constraint the point is projected in place; pass a clone to keep the original
|
|
131
|
+
* @example const [x, y] = editorPointToClient(point.clone(), camera, canvas.getBoundingClientRect());
|
|
132
|
+
*/
|
|
133
|
+
declare function editorPointToClient(point: Vector3, camera: Camera, box: {
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
left: number;
|
|
137
|
+
top: number;
|
|
138
|
+
}): [number, number];
|
|
139
|
+
/**
|
|
140
|
+
* Transform the caller's measured geometry centre into the evaluated placement's world space.
|
|
141
|
+
* @requires npm i -D @threenative/terrain
|
|
142
|
+
* @situation find the world-space centre of a placed terrain-editor instance
|
|
143
|
+
* @constraint the point is multiplied in place; the pose needs finite position, quaternion and scale
|
|
144
|
+
* @example const centre = editorPlacementCenter(localCentre.clone(), placement);
|
|
145
|
+
*/
|
|
146
|
+
declare function editorPlacementCenter(point: Vector3, pose: IPlacementOverride): Vector3;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Gesture and transaction mechanics; the caller owns the controls, proxy and all rendering.
|
|
150
|
+
* @requires npm i -D @threenative/terrain
|
|
151
|
+
* @situation drive terrain-editor selection, gizmo drags, undo and saved transactions
|
|
152
|
+
* @constraint the caller supplies the TransformControls, proxy, controller and every drawing callback
|
|
153
|
+
* @example const selection = createEditorSelection({ gizmo, proxy, controller, grounding, surface, defaultFootprintSize, refreshPose, drawFootprint, restorePlacement, previewPlacement, setSaving, selectedChanged, setNavigation, message });
|
|
154
|
+
*/
|
|
155
|
+
declare function createEditorSelection({ gizmo, proxy, controller, grounding, surface, defaultFootprintSize, refreshPose, drawFootprint, restorePlacement, previewPlacement, setSaving, selectedChanged, setNavigation, message, }: {
|
|
156
|
+
gizmo: TransformControls;
|
|
157
|
+
proxy: Object3D;
|
|
158
|
+
controller: Pick<TerrainEditorController, "commit" | "snapshot">;
|
|
159
|
+
grounding(): boolean;
|
|
160
|
+
surface(x: number, z: number): number | undefined;
|
|
161
|
+
defaultFootprintSize: number;
|
|
162
|
+
refreshPose(): void;
|
|
163
|
+
drawFootprint(layer: Layer): void;
|
|
164
|
+
restorePlacement(id: string, value: IPlacementOverride | undefined): void;
|
|
165
|
+
previewPlacement(id: string, value: IPlacementOverride): void;
|
|
166
|
+
setSaving(value: boolean): void;
|
|
167
|
+
selectedChanged(id: string | undefined, isLayer: boolean): void;
|
|
168
|
+
setNavigation(value: boolean): void;
|
|
169
|
+
message(text: string): void;
|
|
170
|
+
}): {
|
|
171
|
+
readonly snapshot: IEditorSnapshot | undefined;
|
|
172
|
+
readonly selected: string | undefined;
|
|
173
|
+
readonly selectedLayer: string | undefined;
|
|
174
|
+
readonly anchor: number;
|
|
175
|
+
readonly layerDraft: Layer | undefined;
|
|
176
|
+
readonly active: boolean;
|
|
177
|
+
readonly drag: {
|
|
178
|
+
id: string;
|
|
179
|
+
base: IEditorSnapshot;
|
|
180
|
+
grounding: boolean;
|
|
181
|
+
layer?: Layer;
|
|
182
|
+
anchor: number;
|
|
183
|
+
} | undefined;
|
|
184
|
+
readonly saving: boolean;
|
|
185
|
+
readonly draft: {
|
|
186
|
+
id: string;
|
|
187
|
+
transform: IPlacementOverride;
|
|
188
|
+
} | undefined;
|
|
189
|
+
applyPose: (layer?: Layer, placement?: IPlacementOverride) => number[] | undefined;
|
|
190
|
+
save: (id: string, value: IPlacementOverride | undefined, base?: IEditorSnapshot | undefined, remember?: boolean) => Promise<void>;
|
|
191
|
+
select: (id: string | undefined, isLayer?: boolean) => void;
|
|
192
|
+
undo: () => Promise<void>;
|
|
193
|
+
applyFields: (values: number[], grounded: boolean) => void;
|
|
194
|
+
reassign(id: string): Promise<void>;
|
|
195
|
+
clearDrafts(): void;
|
|
196
|
+
cancel(): void;
|
|
197
|
+
canPick(event: {
|
|
198
|
+
button: number;
|
|
199
|
+
altKey: boolean;
|
|
200
|
+
}): boolean;
|
|
201
|
+
dispose(): void;
|
|
202
|
+
selectLayer(id: string): void;
|
|
203
|
+
setActive(enabled: boolean): void;
|
|
204
|
+
sync(next: IEditorSnapshot, matchesPreview: boolean): void;
|
|
205
|
+
};
|
|
206
|
+
|
|
54
207
|
/** The live view's own camera surface, shared by the GUI list and a controller. */
|
|
55
208
|
interface IViewCamera {
|
|
56
209
|
/** The actual current viewer pose, not the last saved bookmark. */
|
|
@@ -205,6 +358,8 @@ declare class TerrainEditorController {
|
|
|
205
358
|
baseRevision: string;
|
|
206
359
|
commands: readonly PatchCommand[];
|
|
207
360
|
}): Promise<IEditorSnapshot>;
|
|
361
|
+
reload(): Promise<IEditorSnapshot>;
|
|
362
|
+
restoreLastValid(): Promise<IEditorSnapshot>;
|
|
208
363
|
subscribe(listener: (snapshot: IEditorSnapshot) => void, onError: () => void): () => void;
|
|
209
364
|
}
|
|
210
365
|
/**
|
|
@@ -228,4 +383,4 @@ declare function mountTerrainEditor(options: {
|
|
|
228
383
|
dispose(): void;
|
|
229
384
|
}>;
|
|
230
385
|
|
|
231
|
-
export { IAssetOperation, IAssetResult, ICameraOperation, ICameraResult, type IEditorView, IEnvironment, IEnvironmentOperation, IEnvironmentResult, IFocusBounds, IFocusOutcome, IFocusRequest, type IImageReport, ISavedCamera, ISpatialObservation, ISpatialQuery, type ISurfaceChannel, type IViewCamera, type IViewEnvironment, type IViewerPose, SURFACE_CHANNELS, TerrainEditorController, inspectImage, mountTerrainEditor };
|
|
386
|
+
export { IAssetOperation, IAssetResult, ICameraOperation, ICameraResult, type IEditorView, IEnvironment, IEnvironmentOperation, IEnvironmentResult, IFocusBounds, IFocusOutcome, IFocusRequest, type IImageReport, ISavedCamera, ISpatialObservation, ISpatialQuery, type ISurfaceChannel, type IViewCamera, type IViewEnvironment, type IViewerPose, SURFACE_CHANNELS, TerrainEditorController, createEditorSelection, editorPlacementCenter, editorPointToClient, editorSurfaceHeight, inspectImage, landformPose, mountTerrainEditor, pickEditorPlacement, pickEditorSurface, transformedLandform };
|