fast-mesh-wasm 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -3
- package/dist/client-CJWOKQMM.d.ts +664 -0
- package/dist/{client-DFgvktkT.js → client-DQADH6KL.js} +1753 -123
- package/dist/{engine-BL5_sWAf.js → engine-D2124Vml.js} +983 -51
- package/dist/io.d.ts +7 -2
- package/dist/io.js +6 -6
- package/dist/{mesh-DIWD2F5-.js → mesh-BtWBMRMO.js} +2 -1
- package/dist/{mesh-BHTFxsXc.d.ts → mesh-DTm2Fnqa.d.ts} +3 -2
- package/dist/node.d.ts +4 -2
- package/dist/node.js +4 -4
- package/dist/primitives-6T0eQiSm.d.ts +157 -0
- package/dist/{scene-DUsj6uJD.js → primitives-wasm-C30Bk4ut.js} +1359 -64
- package/dist/primitives-wasm-d9m2vikb.d.ts +43 -0
- package/dist/{protocol-Ci9LLiwO.js → protocol-Bvjmvlb3.js} +38 -3
- package/dist/{protocol-DFR0JDAS.d.ts → protocol-Da0kmXuF.d.ts} +417 -3
- package/dist/r3f.d.ts +3 -3
- package/dist/r3f.js +3 -3
- package/dist/{react-DzrtrzZy.js → react-DIuy5dyR.js} +12 -3
- package/dist/react.d.ts +6 -3
- package/dist/react.js +1 -1
- package/dist/scene-like-Bx7lZKif.d.ts +4808 -0
- package/dist/{store-BAzHRRkt.js → store-BxzcXy9y.js} +415 -65
- package/dist/{store-8HWG90Jg.d.ts → store-LM3iU8E4.d.ts} +98 -10
- package/dist/store.d.ts +3 -3
- package/dist/store.js +1 -1
- package/dist/three.d.ts +13 -11
- package/dist/three.js +63 -18
- package/dist/views-DPMbo0Sl.js +3147 -0
- package/dist/wasm/fast_mesh_wasm.d.ts +541 -8
- package/dist/wasm/fast_mesh_wasm.js +2083 -93
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +94 -0
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +541 -8
- package/dist/wasm-threads/fast_mesh_wasm.js +2084 -94
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +94 -0
- package/dist/wave6-wasm-Bt4vTlKz.js +146 -0
- package/dist/web.d.ts +4 -2
- package/dist/web.js +4 -4
- package/dist/worker-engine.d.ts +20 -2
- package/dist/worker-engine.js +1 -1
- package/dist/worker-entry.js +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/api-4kz45-Mq.js +0 -63
- package/dist/client-nvmbhtn-.d.ts +0 -398
- package/dist/scene-like-CR_Dpohm.d.ts +0 -2511
- package/dist/views-BSy-Qeg8.js +0 -584
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Ya as Heightfield } from "./scene-like-Bx7lZKif.js";
|
|
2
|
+
import { l as PrimitiveMesh, u as PrimitiveShape } from "./primitives-6T0eQiSm.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generates the relief of a grid of heights: a closed, welded, outward-wound
|
|
5
|
+
* solid from a flat base up to the heights, with a vertex per sample at
|
|
6
|
+
* exactly its height. `x` runs along the rows, `y` against them (the first
|
|
7
|
+
* row is at the top, as in an image) and `z` is the height; it is centred on
|
|
8
|
+
* the origin in `x` and `y`, height 0 is `z = 0` and the base is `z = -base`.
|
|
9
|
+
* Each cell is split along its flatter diagonal.
|
|
10
|
+
*
|
|
11
|
+
* `scene.addHeightfield` adds the same relief to a scene without its buffers
|
|
12
|
+
* leaving the engine, and on a `WorkerScene`, `scene.generateHeightfield(field)`
|
|
13
|
+
* runs this generator in its Worker, so the main thread needs no wasm.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { positions, indices } = generateHeightfield({ heights, width: 256, height: 256, pixelSize: 0.1, base: 2 });
|
|
18
|
+
* ```
|
|
19
|
+
* @throws `INVALID_ARGUMENT` for fewer than 2 samples on a side, a wrong
|
|
20
|
+
* number of heights, or a height that is infinite or not above `-base`;
|
|
21
|
+
* `OUT_OF_MEMORY` when the buffers cannot be allocated.
|
|
22
|
+
*/
|
|
23
|
+
declare function generateHeightfield(field: Heightfield): PrimitiveMesh;
|
|
24
|
+
/**
|
|
25
|
+
* Generates a primitive shape: a box, cylinder, cone, UV sphere,
|
|
26
|
+
* icosphere, torus, arrow, n-gon prism or plane, centred on the origin,
|
|
27
|
+
* welded, closed (except the plane) and wound outward; see
|
|
28
|
+
* {@link PrimitiveShape} for each shape's options and defaults.
|
|
29
|
+
*
|
|
30
|
+
* Add it to a scene with `scene.addMesh(mesh.positions, mesh.indices)`
|
|
31
|
+
* (translate the positions or set a placement to move it), or upload it as
|
|
32
|
+
* a vertex and index buffer. On a `WorkerScene`, `scene.generatePrimitive(shape)`
|
|
33
|
+
* runs the same generator in its Worker, so the main thread needs no wasm.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { positions, indices } = generatePrimitive({ kind: "cylinder", radius: 2, height: 5, segments: 64 });
|
|
38
|
+
* ```
|
|
39
|
+
* @throws `INVALID_ARGUMENT` for an unknown kind or a parameter out of
|
|
40
|
+
* range; `OUT_OF_MEMORY` when the buffers cannot be allocated.
|
|
41
|
+
*/
|
|
42
|
+
declare function generatePrimitive(shape: PrimitiveShape): PrimitiveMesh;
|
|
43
|
+
export { generateHeightfield as n, generatePrimitive as t };
|
|
@@ -18,11 +18,46 @@ function keyOf(req) {
|
|
|
18
18
|
case "removeMesh": return `mesh:${req.id}`;
|
|
19
19
|
case "compact":
|
|
20
20
|
case "edit":
|
|
21
|
-
case "repair":
|
|
22
|
-
case "
|
|
21
|
+
case "repair":
|
|
22
|
+
case "cutByPlane":
|
|
23
|
+
case "trimByCurve":
|
|
24
|
+
case "fillHoleContinuity":
|
|
25
|
+
case "fillAllHolesContinuity":
|
|
26
|
+
case "bridgePartialArcs":
|
|
27
|
+
case "applyDyntopo":
|
|
28
|
+
case "dyntopoDab":
|
|
29
|
+
case "deleteSelectedFaces":
|
|
30
|
+
case "extrudeFaces":
|
|
31
|
+
case "extrudeBase":
|
|
32
|
+
case "splitSelectedFaces":
|
|
33
|
+
case "applyFfd":
|
|
34
|
+
case "applyArap":
|
|
35
|
+
case "applyKelvinlet":
|
|
36
|
+
case "applyXpbd":
|
|
37
|
+
case "hollowMesh":
|
|
38
|
+
case "latticeFill":
|
|
39
|
+
case "denoise":
|
|
40
|
+
case "delaunayFlips":
|
|
41
|
+
case "punchDrainHole": return `edit:${req.id}`;
|
|
42
|
+
case "join":
|
|
43
|
+
case "boolean": return `edit:${req.target}`;
|
|
44
|
+
case "booleanBatch":
|
|
45
|
+
case "extractSelectedFaces":
|
|
46
|
+
case "reconstructPointCloud":
|
|
47
|
+
case "addHeightfield":
|
|
48
|
+
case "convexHull":
|
|
49
|
+
case "convexHullPoints":
|
|
50
|
+
case "wrap": return `mesh:${req.addedId}`;
|
|
51
|
+
case "placeMesh": return req.addedId !== void 0 ? `mesh:${req.addedId}` : `edit:${req.target}`;
|
|
52
|
+
case "alignToFittedPrimitive":
|
|
53
|
+
case "moveWithCollision":
|
|
54
|
+
case "commitCollisionInteraction": return `placement:${req.id}`;
|
|
55
|
+
case "alignByLandmarks":
|
|
56
|
+
case "registerMultistage": return `placement:${req.moving}`;
|
|
23
57
|
case "undo":
|
|
24
58
|
case "redo":
|
|
25
|
-
case "clearHistory":
|
|
59
|
+
case "clearHistory":
|
|
60
|
+
case "historyBudget": return "history";
|
|
26
61
|
case "field": return `field:${req.field}`;
|
|
27
62
|
case "section": return req.op === "set" ? `section:${req.section}:${sectionAspects(req.desc).join("+") || "none"}` : `section:${req.section}`;
|
|
28
63
|
default: return;
|
|
@@ -1,6 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $a as ExtrudeBaseOptions, An as LandmarkPair, Ca as PlaceMeshOptions, Fi as ArapOptions, Ga as CheckedHeightfieldPlacement, Hi as CollisionRule, Jt as CsgNode, La as SurfaceReconstructOptions, Mt as BooleanOp, So as Vec3, Tt as AddMeshOptions, Wa as CheckedHeightfield, Wt as ColorRule, Xi as DrainHoleOptions, _a as KelvinletOptions, _o as PlacementInput, aa as FfdOptions, an as DyntopoMode, br as SectionResult, ca as FittedPrimitive, er as RegistrationOptions, fn as FillContinuity, fo as Bounds, fr as SculptBrushOp, io as DelaunayFlipOptions, jt as BooleanMethod, ma as HollowOptions, mi as Range, no as ExtrudeFacesOptions, oo as DenoiseOptions, pi as PermanentStep, tn as DistanceFieldDesc, ui as EntryEvent, vi as WrapOptions, wi as LatticeOptions, yr as SectionPlane, za as XpbdOptions } from "./scene-like-Bx7lZKif.js";
|
|
2
|
+
import "./primitives-6T0eQiSm.js";
|
|
3
|
+
interface NormalizedBooleanOptions {
|
|
4
|
+
op: BooleanOp;
|
|
5
|
+
method: BooleanMethod;
|
|
6
|
+
coplanarTolerance?: number;
|
|
7
|
+
snapSlivers: boolean;
|
|
8
|
+
voxelPitch?: number;
|
|
9
|
+
maxTriangles?: number;
|
|
10
|
+
}
|
|
11
|
+
interface NormalizedFillHolesContinuityOptions {
|
|
12
|
+
continuity: FillContinuity;
|
|
13
|
+
maxHolePerimeter?: number;
|
|
14
|
+
maxHoleVertices?: number;
|
|
15
|
+
refinePatch: boolean;
|
|
16
|
+
smoothIterations?: number;
|
|
17
|
+
detectIslands: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NormalizedPartialBridgeOptions {
|
|
20
|
+
loopAIndex: number;
|
|
21
|
+
arcARange: [number, number];
|
|
22
|
+
loopBIndex: number;
|
|
23
|
+
arcBRange: [number, number];
|
|
24
|
+
twistOffset: number;
|
|
25
|
+
subdivisions?: number;
|
|
26
|
+
}
|
|
27
|
+
interface NormalizedDyntopoOptions {
|
|
28
|
+
mode: DyntopoMode;
|
|
29
|
+
detailSize?: number;
|
|
30
|
+
minDetailRatio?: number;
|
|
31
|
+
maxDetailRatio?: number;
|
|
32
|
+
equalizeValence: boolean;
|
|
33
|
+
smoothTangent: boolean;
|
|
34
|
+
}
|
|
2
35
|
/** A mesh, field or section id allocated on the main side. Unique per kind. */
|
|
3
36
|
type ClientId = number;
|
|
37
|
+
/** A {@link PermanentStep} naming its meshes by client id. */
|
|
38
|
+
type PermanentStepWire = Omit<PermanentStep, "meshes" | "gone"> & {
|
|
39
|
+
meshes: ClientId[];
|
|
40
|
+
gone: ClientId[];
|
|
41
|
+
};
|
|
4
42
|
/** A {@link ColorRule} naming its field by client id. */
|
|
5
43
|
type ColorRuleWire = Omit<ColorRule, "field"> & {
|
|
6
44
|
field: ClientId;
|
|
@@ -44,12 +82,20 @@ type Request = {
|
|
|
44
82
|
/**
|
|
45
83
|
* Add in place, in the batch's own result (a restart's replay), never
|
|
46
84
|
* in the background: by default a large mesh is built in the
|
|
47
|
-
* background and lands with a later result or `update` message.
|
|
85
|
+
* background and lands with a later result or `update` message. An
|
|
86
|
+
* `undoable` add is always in place, so that it lands in its step.
|
|
48
87
|
*/
|
|
49
88
|
inline?: boolean;
|
|
50
89
|
key?: string;
|
|
51
90
|
} | {
|
|
52
|
-
kind: "removeMesh"
|
|
91
|
+
kind: "removeMesh";
|
|
92
|
+
rev: number;
|
|
93
|
+
id: ClientId;
|
|
94
|
+
/** Remove it as an undo step (see `RemoveMeshOptions`). */
|
|
95
|
+
undoable?: boolean;
|
|
96
|
+
key?: string;
|
|
97
|
+
} | {
|
|
98
|
+
kind: "compact";
|
|
53
99
|
rev: number;
|
|
54
100
|
id: ClientId;
|
|
55
101
|
key?: string;
|
|
@@ -112,6 +158,127 @@ type Request = {
|
|
|
112
158
|
kind: "clearHistory";
|
|
113
159
|
rev: number;
|
|
114
160
|
key?: string;
|
|
161
|
+
} |
|
|
162
|
+
/**
|
|
163
|
+
* `Scene.recordEntry`: the main side keeps the entry under `id`, and hears
|
|
164
|
+
* what becomes of it through `Result.entries`.
|
|
165
|
+
*/
|
|
166
|
+
{
|
|
167
|
+
kind: "entry";
|
|
168
|
+
rev: number;
|
|
169
|
+
id: number;
|
|
170
|
+
bytes: number;
|
|
171
|
+
coalesce?: string;
|
|
172
|
+
} |
|
|
173
|
+
/** `Scene.setHistoryBudget`, with a checked budget. */
|
|
174
|
+
{
|
|
175
|
+
kind: "historyBudget";
|
|
176
|
+
rev: number;
|
|
177
|
+
bytes: number;
|
|
178
|
+
key?: string;
|
|
179
|
+
} |
|
|
180
|
+
/** Opens, closes, or cancels a history step matching `Scene.beginStep`/`endStep`/`cancelStep`. */
|
|
181
|
+
{
|
|
182
|
+
kind: "step";
|
|
183
|
+
rev: number;
|
|
184
|
+
phase: "begin" | "end" | "cancel";
|
|
185
|
+
} | {
|
|
186
|
+
kind: "boolean";
|
|
187
|
+
rev: number;
|
|
188
|
+
target: ClientId;
|
|
189
|
+
source: ClientId;
|
|
190
|
+
payload: NormalizedBooleanOptions;
|
|
191
|
+
qid: number;
|
|
192
|
+
key?: string;
|
|
193
|
+
} | {
|
|
194
|
+
kind: "booleanBatch";
|
|
195
|
+
rev: number;
|
|
196
|
+
meshes: ClientId[];
|
|
197
|
+
tree: CsgNode;
|
|
198
|
+
options: NormalizedBooleanOptions;
|
|
199
|
+
addedId: ClientId;
|
|
200
|
+
qid: number;
|
|
201
|
+
key?: string;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "cutByPlane";
|
|
204
|
+
rev: number;
|
|
205
|
+
id: ClientId;
|
|
206
|
+
addedId: ClientId;
|
|
207
|
+
plane: SectionPlane;
|
|
208
|
+
cap: boolean;
|
|
209
|
+
qid: number;
|
|
210
|
+
key?: string;
|
|
211
|
+
} | {
|
|
212
|
+
kind: "trimByCurve";
|
|
213
|
+
rev: number;
|
|
214
|
+
id: ClientId;
|
|
215
|
+
payload: {
|
|
216
|
+
points: Vec3[];
|
|
217
|
+
closed: boolean;
|
|
218
|
+
deleteInside: boolean;
|
|
219
|
+
snapTolerance?: number;
|
|
220
|
+
};
|
|
221
|
+
qid: number;
|
|
222
|
+
key?: string;
|
|
223
|
+
} | {
|
|
224
|
+
kind: "fillHoleContinuity";
|
|
225
|
+
rev: number;
|
|
226
|
+
id: ClientId;
|
|
227
|
+
loopIndex: number;
|
|
228
|
+
options: NormalizedFillHolesContinuityOptions;
|
|
229
|
+
qid: number;
|
|
230
|
+
key?: string;
|
|
231
|
+
} | {
|
|
232
|
+
kind: "fillAllHolesContinuity";
|
|
233
|
+
rev: number;
|
|
234
|
+
id: ClientId;
|
|
235
|
+
options: NormalizedFillHolesContinuityOptions;
|
|
236
|
+
qid: number;
|
|
237
|
+
key?: string;
|
|
238
|
+
} | {
|
|
239
|
+
kind: "bridgePartialArcs";
|
|
240
|
+
rev: number;
|
|
241
|
+
id: ClientId;
|
|
242
|
+
loopA: number[];
|
|
243
|
+
loopB: number[];
|
|
244
|
+
options: NormalizedPartialBridgeOptions;
|
|
245
|
+
qid: number;
|
|
246
|
+
key?: string;
|
|
247
|
+
} | {
|
|
248
|
+
kind: "applyDyntopo";
|
|
249
|
+
rev: number;
|
|
250
|
+
id: ClientId;
|
|
251
|
+
center: Vec3;
|
|
252
|
+
radius: number;
|
|
253
|
+
options: NormalizedDyntopoOptions;
|
|
254
|
+
pinned: number[];
|
|
255
|
+
qid: number;
|
|
256
|
+
key?: string;
|
|
257
|
+
} | {
|
|
258
|
+
kind: "dyntopoDab";
|
|
259
|
+
rev: number;
|
|
260
|
+
id: ClientId;
|
|
261
|
+
dab: SculptBrushOp;
|
|
262
|
+
options: NormalizedDyntopoOptions;
|
|
263
|
+
qid: number;
|
|
264
|
+
key?: string;
|
|
265
|
+
} | {
|
|
266
|
+
kind: "alignByLandmarks";
|
|
267
|
+
rev: number;
|
|
268
|
+
moving: ClientId;
|
|
269
|
+
fixed: ClientId;
|
|
270
|
+
pairs: LandmarkPair[];
|
|
271
|
+
allowScaling: boolean;
|
|
272
|
+
qid: number;
|
|
273
|
+
key?: string;
|
|
274
|
+
} | {
|
|
275
|
+
kind: "registerMultistage";
|
|
276
|
+
rev: number;
|
|
277
|
+
moving: ClientId;
|
|
278
|
+
fixed: ClientId;
|
|
279
|
+
payload: RegistrationOptions;
|
|
280
|
+
qid: number;
|
|
281
|
+
key?: string;
|
|
115
282
|
} | {
|
|
116
283
|
kind: "coloring";
|
|
117
284
|
rev: number;
|
|
@@ -155,12 +322,211 @@ type Request = {
|
|
|
155
322
|
kind: "fieldInteraction";
|
|
156
323
|
rev: number;
|
|
157
324
|
points: number | null;
|
|
325
|
+
} | {
|
|
326
|
+
kind: "deleteSelectedFaces";
|
|
327
|
+
rev: number;
|
|
328
|
+
id: ClientId;
|
|
329
|
+
selectedTris: Uint32Array;
|
|
330
|
+
qid: number;
|
|
331
|
+
} |
|
|
332
|
+
/** `Scene.extrudeFaces`; replies with its result. */
|
|
333
|
+
{
|
|
334
|
+
kind: "extrudeFaces";
|
|
335
|
+
rev: number;
|
|
336
|
+
id: ClientId;
|
|
337
|
+
triangles: Uint32Array;
|
|
338
|
+
options: ExtrudeFacesOptions;
|
|
339
|
+
qid: number;
|
|
340
|
+
} |
|
|
341
|
+
/** `Scene.extrudeBase`; replies with its result. */
|
|
342
|
+
{
|
|
343
|
+
kind: "extrudeBase";
|
|
344
|
+
rev: number;
|
|
345
|
+
id: ClientId;
|
|
346
|
+
options: ExtrudeBaseOptions;
|
|
347
|
+
qid: number;
|
|
348
|
+
} | {
|
|
349
|
+
kind: "extractSelectedFaces";
|
|
350
|
+
rev: number;
|
|
351
|
+
id: ClientId;
|
|
352
|
+
addedId: ClientId;
|
|
353
|
+
selectedTris: Uint32Array;
|
|
354
|
+
normals: boolean;
|
|
355
|
+
qid: number;
|
|
356
|
+
} | {
|
|
357
|
+
kind: "splitSelectedFaces";
|
|
358
|
+
rev: number;
|
|
359
|
+
id: ClientId;
|
|
360
|
+
addedId: ClientId;
|
|
361
|
+
selectedTris: Uint32Array;
|
|
362
|
+
normals: boolean;
|
|
363
|
+
qid: number;
|
|
364
|
+
} | {
|
|
365
|
+
kind: "applyFfd";
|
|
366
|
+
rev: number;
|
|
367
|
+
id: ClientId;
|
|
368
|
+
options: FfdOptions;
|
|
369
|
+
qid: number;
|
|
370
|
+
} | {
|
|
371
|
+
kind: "applyArap";
|
|
372
|
+
rev: number;
|
|
373
|
+
id: ClientId;
|
|
374
|
+
options: ArapOptions;
|
|
375
|
+
qid: number;
|
|
376
|
+
} | {
|
|
377
|
+
kind: "applyKelvinlet";
|
|
378
|
+
rev: number;
|
|
379
|
+
id: ClientId;
|
|
380
|
+
options: KelvinletOptions;
|
|
381
|
+
qid: number;
|
|
382
|
+
} | {
|
|
383
|
+
kind: "applyXpbd";
|
|
384
|
+
rev: number;
|
|
385
|
+
id: ClientId;
|
|
386
|
+
options: XpbdOptions;
|
|
387
|
+
qid: number;
|
|
388
|
+
} | {
|
|
389
|
+
kind: "setDefaultCollisionRule";
|
|
390
|
+
rev: number;
|
|
391
|
+
rule: CollisionRule;
|
|
392
|
+
} | {
|
|
393
|
+
kind: "setCollisionRule";
|
|
394
|
+
rev: number;
|
|
395
|
+
a: ClientId;
|
|
396
|
+
b: ClientId;
|
|
397
|
+
rule: CollisionRule;
|
|
398
|
+
} | {
|
|
399
|
+
kind: "clearCollisionRule";
|
|
400
|
+
rev: number;
|
|
401
|
+
a: ClientId;
|
|
402
|
+
b: ClientId;
|
|
403
|
+
} | {
|
|
404
|
+
kind: "moveWithCollision";
|
|
405
|
+
rev: number;
|
|
406
|
+
id: ClientId;
|
|
407
|
+
placement: PlacementInput;
|
|
408
|
+
isRelease: boolean;
|
|
409
|
+
qid: number;
|
|
410
|
+
} | {
|
|
411
|
+
kind: "commitCollisionInteraction";
|
|
412
|
+
rev: number;
|
|
413
|
+
id: ClientId;
|
|
414
|
+
qid: number;
|
|
415
|
+
} | {
|
|
416
|
+
kind: "alignToFittedPrimitive";
|
|
417
|
+
rev: number;
|
|
418
|
+
id: ClientId;
|
|
419
|
+
primitive: FittedPrimitive;
|
|
420
|
+
targetAxis: Vec3;
|
|
421
|
+
targetOrigin: Vec3;
|
|
422
|
+
qid: number;
|
|
423
|
+
} |
|
|
424
|
+
/** `Scene.reconstructPointCloud` of a cloud's buffer, around its `origin` if it has one. */
|
|
425
|
+
{
|
|
426
|
+
kind: "reconstructPointCloud";
|
|
427
|
+
rev: number;
|
|
428
|
+
addedId: ClientId;
|
|
429
|
+
cloud: Float32Array;
|
|
430
|
+
origin?: Vec3;
|
|
431
|
+
options: SurfaceReconstructOptions;
|
|
432
|
+
qid: number;
|
|
433
|
+
} |
|
|
434
|
+
/** `Scene.addHeightfield` of heights that are transferred; replies with the relief's counts. */
|
|
435
|
+
{
|
|
436
|
+
kind: "addHeightfield";
|
|
437
|
+
rev: number;
|
|
438
|
+
addedId: ClientId;
|
|
439
|
+
field: CheckedHeightfield;
|
|
440
|
+
placement: CheckedHeightfieldPlacement;
|
|
441
|
+
qid: number;
|
|
442
|
+
} |
|
|
443
|
+
/** `Scene.convexHull`; replies with the hull's counts. */
|
|
444
|
+
{
|
|
445
|
+
kind: "convexHull";
|
|
446
|
+
rev: number;
|
|
447
|
+
addedId: ClientId;
|
|
448
|
+
meshes: ClientId[];
|
|
449
|
+
normals: boolean;
|
|
450
|
+
qid: number;
|
|
451
|
+
} |
|
|
452
|
+
/** `Scene.convexHullOfPoints` on flat world positions; replies with the hull's counts. */
|
|
453
|
+
{
|
|
454
|
+
kind: "convexHullPoints";
|
|
455
|
+
rev: number;
|
|
456
|
+
addedId: ClientId;
|
|
457
|
+
points: Float64Array;
|
|
458
|
+
normals: boolean;
|
|
459
|
+
qid: number;
|
|
460
|
+
} |
|
|
461
|
+
/** `Scene.wrap`; replies with the wrap's counts and grid. */
|
|
462
|
+
{
|
|
463
|
+
kind: "wrap";
|
|
464
|
+
rev: number;
|
|
465
|
+
addedId: ClientId;
|
|
466
|
+
meshes: ClientId[];
|
|
467
|
+
options: WrapOptions;
|
|
468
|
+
qid: number;
|
|
469
|
+
} | {
|
|
470
|
+
kind: "hollowMesh";
|
|
471
|
+
rev: number;
|
|
472
|
+
id: ClientId;
|
|
473
|
+
options: HollowOptions;
|
|
474
|
+
qid: number;
|
|
475
|
+
} |
|
|
476
|
+
/** `Scene.latticeFill`; replies with its report. */
|
|
477
|
+
{
|
|
478
|
+
kind: "latticeFill";
|
|
479
|
+
rev: number;
|
|
480
|
+
id: ClientId;
|
|
481
|
+
options: LatticeOptions;
|
|
482
|
+
qid: number;
|
|
483
|
+
} |
|
|
484
|
+
/** `Scene.denoise`; replies with its report. */
|
|
485
|
+
{
|
|
486
|
+
kind: "denoise";
|
|
487
|
+
rev: number;
|
|
488
|
+
id: ClientId;
|
|
489
|
+
options: DenoiseOptions;
|
|
490
|
+
qid: number;
|
|
491
|
+
} |
|
|
492
|
+
/** `Scene.delaunayFlips`; replies with its report. */
|
|
493
|
+
{
|
|
494
|
+
kind: "delaunayFlips";
|
|
495
|
+
rev: number;
|
|
496
|
+
id: ClientId;
|
|
497
|
+
options: DelaunayFlipOptions;
|
|
498
|
+
qid: number;
|
|
499
|
+
} | {
|
|
500
|
+
kind: "punchDrainHole";
|
|
501
|
+
rev: number;
|
|
502
|
+
id: ClientId;
|
|
503
|
+
plugId?: ClientId;
|
|
504
|
+
options: DrainHoleOptions;
|
|
505
|
+
qid: number;
|
|
506
|
+
} | {
|
|
507
|
+
kind: "placeMesh";
|
|
508
|
+
rev: number;
|
|
509
|
+
target: ClientId;
|
|
510
|
+
stamp: ClientId;
|
|
511
|
+
addedId?: ClientId;
|
|
512
|
+
options: PlaceMeshOptions;
|
|
513
|
+
qid: number;
|
|
158
514
|
} | {
|
|
159
515
|
kind: "query";
|
|
160
516
|
rev: number;
|
|
161
517
|
qid: number;
|
|
162
518
|
name: string;
|
|
163
519
|
args: unknown;
|
|
520
|
+
} |
|
|
521
|
+
/**
|
|
522
|
+
* Drops the query `qid` when it has not started, or at its next step when
|
|
523
|
+
* it runs in steps (`geodesicDistances`, `shortestSurfacePath`): its reply
|
|
524
|
+
* is then a `CANCELLED` error. Anything else is left alone.
|
|
525
|
+
*/
|
|
526
|
+
{
|
|
527
|
+
kind: "cancel";
|
|
528
|
+
rev: number;
|
|
529
|
+
qid: number;
|
|
164
530
|
} | {
|
|
165
531
|
kind: "fetchFieldValues";
|
|
166
532
|
rev: number;
|
|
@@ -183,6 +549,8 @@ interface MeshChangeWire {
|
|
|
183
549
|
id: ClientId;
|
|
184
550
|
added: boolean;
|
|
185
551
|
removed: boolean;
|
|
552
|
+
/** Only on a removal: undo or redo can bring the mesh back (see `MeshChange`). */
|
|
553
|
+
restorable?: true;
|
|
186
554
|
placementChanged: boolean;
|
|
187
555
|
capacityChanged: boolean;
|
|
188
556
|
positions: Range[] | "all";
|
|
@@ -195,6 +563,8 @@ interface MeshChangeWire {
|
|
|
195
563
|
/** Slot counts after the change; 0 for a removed mesh. */
|
|
196
564
|
vertexSlots: number;
|
|
197
565
|
triangleSlots: number;
|
|
566
|
+
/** World origin when `added` is true (so Worker-created meshes mirror `origin()`). */
|
|
567
|
+
origin?: Vec3;
|
|
198
568
|
/** Local-render bounds after a geometry change; omitted when geometry is unchanged. */
|
|
199
569
|
bounds?: Bounds | null;
|
|
200
570
|
bytes: {
|
|
@@ -227,6 +597,7 @@ interface Result {
|
|
|
227
597
|
translation: number[];
|
|
228
598
|
scale: number[];
|
|
229
599
|
matrix4: number[];
|
|
600
|
+
authoritative?: boolean;
|
|
230
601
|
}[];
|
|
231
602
|
/**
|
|
232
603
|
* Every changed section entry. `result` is `null` once the entry is gone:
|
|
@@ -242,6 +613,47 @@ interface Result {
|
|
|
242
613
|
canUndo: boolean;
|
|
243
614
|
canRedo: boolean;
|
|
244
615
|
};
|
|
616
|
+
/** The bytes the history holds. Omitted by poisoned results. */
|
|
617
|
+
historyBytes?: number;
|
|
618
|
+
/**
|
|
619
|
+
* What happened to the application's entries in this batch, in order: each
|
|
620
|
+
* was undone, redone or dropped, by the request of revision `rev`. Omitted
|
|
621
|
+
* when there is none.
|
|
622
|
+
*/
|
|
623
|
+
entries?: {
|
|
624
|
+
id: number;
|
|
625
|
+
what: EntryEvent;
|
|
626
|
+
rev: number;
|
|
627
|
+
}[];
|
|
628
|
+
/**
|
|
629
|
+
* The steps of this batch the history could not keep (`Scene.onPermanent`),
|
|
630
|
+
* in order. Omitted when there is none.
|
|
631
|
+
*/
|
|
632
|
+
permanent?: PermanentStepWire[];
|
|
633
|
+
/**
|
|
634
|
+
* Where each mesh that an undoable add or removal, or its undo or redo,
|
|
635
|
+
* moved in this batch now is: in the scene (`"live"`), out of it but kept
|
|
636
|
+
* by the history (`"parked"`), or out of it for good (`"gone"`: the history
|
|
637
|
+
* dropped a parked mesh). Omitted when there is none.
|
|
638
|
+
*/
|
|
639
|
+
presence?: {
|
|
640
|
+
id: ClientId;
|
|
641
|
+
state: "live" | "parked" | "gone";
|
|
642
|
+
}[];
|
|
643
|
+
/**
|
|
644
|
+
* The fields that lost targets to such a move, with the targets left, or
|
|
645
|
+
* `null` for a field that went (it was measured to nothing else, or on a
|
|
646
|
+
* mesh now gone for good). Omitted when there is none.
|
|
647
|
+
*/
|
|
648
|
+
fieldTargets?: {
|
|
649
|
+
field: ClientId;
|
|
650
|
+
to: ClientId[] | null;
|
|
651
|
+
}[];
|
|
652
|
+
/** The sections that lost meshes to such a move, with the meshes left. Omitted when there is none. */
|
|
653
|
+
sectionMeshes?: {
|
|
654
|
+
section: ClientId;
|
|
655
|
+
meshes: ClientId[];
|
|
656
|
+
}[];
|
|
245
657
|
/**
|
|
246
658
|
* The outcome of every keyed request run in this batch, in order (a
|
|
247
659
|
* request dropped as superseded, or an abandoned field build, has none).
|
|
@@ -292,6 +704,8 @@ interface InitMessage {
|
|
|
292
704
|
crashChannel?: string;
|
|
293
705
|
/** `WorkerSceneOptions.backgroundAddTriangles`, when set. */
|
|
294
706
|
backgroundAddTriangles?: number;
|
|
707
|
+
/** The history budget, when it is not the default. */
|
|
708
|
+
historyBudget?: number;
|
|
295
709
|
}
|
|
296
710
|
/**
|
|
297
711
|
* What a Worker posts: a {@link Result} per batch, after `{ kind: "ready" }`
|
package/dist/r3f.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as SceneStore } from "./store-
|
|
3
|
-
import { n as BoundMesh, t as BindMeshOptions } from "./mesh-
|
|
1
|
+
import { uo as MeshHandle } from "./scene-like-Bx7lZKif.js";
|
|
2
|
+
import { t as SceneStore } from "./store-LM3iU8E4.js";
|
|
3
|
+
import { n as BoundMesh, t as BindMeshOptions } from "./mesh-DTm2Fnqa.js";
|
|
4
4
|
import * as THREE from "three";
|
|
5
5
|
import { JSX } from "react";
|
|
6
6
|
import { EventHandlers } from "@react-three/fiber";
|
package/dist/r3f.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
-
import { c as useStoreSelector, i as useScene, l as StoreContext, t as SceneProvider } from "./react-
|
|
2
|
+
import { c as useStoreSelector, i as useScene, l as StoreContext, t as SceneProvider } from "./react-DIuy5dyR.js";
|
|
3
3
|
import { s as meshState } from "./snapshot-BkbGPspK.js";
|
|
4
|
-
import { r as setFrameLoop } from "./store-
|
|
5
|
-
import { t as bindMesh } from "./mesh-
|
|
4
|
+
import { r as setFrameLoop } from "./store-BxzcXy9y.js";
|
|
5
|
+
import { t as bindMesh } from "./mesh-BtWBMRMO.js";
|
|
6
6
|
import * as THREE from "three";
|
|
7
7
|
import { createElement, useCallback, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
8
8
|
import { useFrame, useThree } from "@react-three/fiber";
|
|
@@ -77,21 +77,30 @@ function useMeshDisplay(mesh) {
|
|
|
77
77
|
return [useStoreSelector(useCallback((s) => mergeDisplay(meshState(s, mesh)), [mesh])), useCallback((patch) => store.setDisplay(mesh, patch), [store, mesh])];
|
|
78
78
|
}
|
|
79
79
|
const selectHistory = (s) => s.history;
|
|
80
|
-
/** Undo
|
|
80
|
+
/** Undo, redo, and step transaction controls, with availability flags. The actions are stable per store. */
|
|
81
81
|
function useHistory() {
|
|
82
82
|
const store = useScene();
|
|
83
83
|
const history = useStoreSelector(selectHistory);
|
|
84
84
|
const undo = useCallback(() => store.undo(), [store]);
|
|
85
85
|
const redo = useCallback(() => store.redo(), [store]);
|
|
86
|
+
const beginStep = useCallback(() => store.beginStep(), [store]);
|
|
87
|
+
const endStep = useCallback(() => store.endStep(), [store]);
|
|
88
|
+
const cancelStep = useCallback(() => store.cancelStep(), [store]);
|
|
86
89
|
return useMemo(() => ({
|
|
87
90
|
canUndo: history.canUndo,
|
|
88
91
|
canRedo: history.canRedo,
|
|
89
92
|
undo,
|
|
90
|
-
redo
|
|
93
|
+
redo,
|
|
94
|
+
beginStep,
|
|
95
|
+
endStep,
|
|
96
|
+
cancelStep
|
|
91
97
|
}), [
|
|
92
98
|
history,
|
|
93
99
|
undo,
|
|
94
|
-
redo
|
|
100
|
+
redo,
|
|
101
|
+
beginStep,
|
|
102
|
+
endStep,
|
|
103
|
+
cancelStep
|
|
95
104
|
]);
|
|
96
105
|
}
|
|
97
106
|
/**
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { do as SectionHandle, uo as MeshHandle } from "./scene-like-Bx7lZKif.js";
|
|
3
|
+
import { f as SceneSnapshot, l as MeshState, m as SectionState, o as DisplayState, r as SectionPatch, t as SceneStore } from "./store-LM3iU8E4.js";
|
|
4
4
|
import { ReactElement, ReactNode } from "react";
|
|
5
5
|
/** Provides `store` to the hooks below it. */
|
|
6
6
|
export declare function SceneProvider(props: {
|
|
@@ -40,8 +40,11 @@ export interface HistoryControls {
|
|
|
40
40
|
canRedo: boolean;
|
|
41
41
|
undo(): void;
|
|
42
42
|
redo(): void;
|
|
43
|
+
beginStep(): void;
|
|
44
|
+
endStep(): void;
|
|
45
|
+
cancelStep(): void;
|
|
43
46
|
}
|
|
44
|
-
/** Undo
|
|
47
|
+
/** Undo, redo, and step transaction controls, with availability flags. The actions are stable per store. */
|
|
45
48
|
export declare function useHistory(): HistoryControls;
|
|
46
49
|
/** A change to a section: its plane, meshes or fill. */
|
|
47
50
|
export type SectionUpdate = SectionPatch;
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as SceneProvider, n as useHistory, r as useMeshDisplay, i as useScene, a as useSceneStatus, o as useSection, s as useSelection, c as useStoreSelector } from "./react-
|
|
1
|
+
export { t as SceneProvider, n as useHistory, r as useMeshDisplay, i as useScene, a as useSceneStatus, o as useSection, s as useSelection, c as useStoreSelector } from "./react-DIuy5dyR.js";
|