fast-mesh-wasm 0.5.0 → 0.5.2
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 +91 -3
- package/dist/{api-BUy7FRx7.js → api-4kz45-Mq.js} +2 -3
- package/dist/{client-CE6RvmvB.js → client-BIPPznBZ.js} +108 -24
- package/dist/{client-pv0Fwvl4.d.ts → client-Uo7hHvD8.d.ts} +25 -11
- package/dist/{colormap-DxGMYVfs.js → colormap-Dr5V3bvs.js} +1 -2
- package/dist/{core-Cke_kZ2e.js → core-4OcWKu3r.js} +2 -2
- package/dist/{core-D2X9GPfK.d.ts → core-CJ9D6U5A.d.ts} +1 -3
- package/dist/{engine-DLQAL9GT.js → engine-BS8i5U8J.js} +41 -11
- package/dist/io.d.ts +306 -0
- package/dist/io.js +1479 -0
- package/dist/{mesh-RtPVmPQy.d.ts → mesh-CqAIuOxU.d.ts} +15 -6
- package/dist/{mesh-zj7-wJBw.js → mesh-hPWBQPaN.js} +31 -8
- package/dist/node.d.ts +3 -5
- package/dist/node.js +4 -5
- package/dist/{protocol-z-jeCUGO.d.ts → protocol-BHAI0xiA.d.ts} +25 -7
- package/dist/{protocol-DkhGNP0h.js → protocol-Ci9LLiwO.js} +1 -2
- package/dist/r3f.d.ts +22 -6
- package/dist/r3f.js +28 -19
- package/dist/{react-CTADh3NN.js → react-DzrtrzZy.js} +4 -6
- package/dist/react.d.ts +4 -6
- package/dist/react.js +1 -1
- package/dist/{scene-like-YcY08oii.d.ts → scene-like-CavrKbpQ.d.ts} +590 -47
- package/dist/{scene-DyYdEQdy.js → scene-rsfM06St.js} +711 -21
- package/dist/{snapshot-Cf6NgDl7.js → snapshot-BkbGPspK.js} +1 -2
- package/dist/{store-C5nzCpxy.d.ts → store-CZwml1K3.d.ts} +5 -10
- package/dist/{store-Z6A2HPih.js → store-m9l0Al-m.js} +9 -12
- package/dist/store.d.ts +2 -4
- package/dist/store.js +4 -5
- package/dist/three.d.ts +2 -6
- package/dist/three.js +4 -6
- package/dist/{views-Dh3aWc2q.js → views-CdOArjcB.js} +6 -8
- package/dist/wasm/fast_mesh_wasm.d.ts +113 -8
- package/dist/wasm/fast_mesh_wasm.js +267 -8
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +13 -1
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +113 -8
- package/dist/wasm-threads/fast_mesh_wasm.js +268 -9
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +13 -1
- package/dist/web.d.ts +3 -5
- package/dist/web.js +4 -5
- package/dist/worker-engine.d.ts +1 -7
- package/dist/worker-engine.js +1 -1
- package/dist/worker-entry.js +2 -3
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +1 -1
- package/package.json +16 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/store/snapshot.ts
|
|
2
2
|
/** A plain-data value deep-copied and deep-frozen; handles and other class instances are kept as they are. */
|
|
3
3
|
function frozenCopy(value) {
|
|
4
4
|
if (typeof value !== "object" || value === null) return value;
|
|
@@ -100,5 +100,4 @@ function combine(parts) {
|
|
|
100
100
|
} : { status: p.status };
|
|
101
101
|
return out;
|
|
102
102
|
}
|
|
103
|
-
//#endregion
|
|
104
103
|
export { combine as a, sameData as c, REMOVED_SECTION_STATE as i, sectionState as l, EMPTY_SNAPSHOT as n, frozenCopy as o, REMOVED_MESH_STATE as r, meshState as s, DEFAULT_DISPLAY as t };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/store/host.d.ts
|
|
1
|
+
import { $ as Scene, At as PlacementInput, B as OutOfRange, Ct as MeshHandle, Et as Indices, F as MeshChange, Mt as Positions64, Q as Rgba, S as EditOp, X as RepairReport, Y as RepairOp, a as AutoRepairReport, it as SectionPlane, n as AddMeshOptions, nt as SectionDesc, o as AutoRepairRequest, p as Colormap, st as SignMode, t as SceneLike, w as EditResult, wt as SectionHandle, x as DragSession } from "./scene-like-CavrKbpQ.js";
|
|
2
|
+
import { i as WorkerScene } from "./client-Uo7hHvD8.js";
|
|
3
|
+
import { t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
5
4
|
/** Options of `SceneStore.addMesh`: those both scenes take (a store mesh is always eager). */
|
|
6
|
-
type StoreAddMeshOptions = Pick<AddMeshOptions, "origin" | "normals">;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/store/snapshot.d.ts
|
|
5
|
+
type StoreAddMeshOptions = Pick<AddMeshOptions, "origin" | "normals" | "uvs">;
|
|
9
6
|
/**
|
|
10
7
|
* The state of a mesh's or section's work: `"computing"` while it, or a
|
|
11
8
|
* result it depends on, is pending; `"ready"` once applied; `"error"` when
|
|
@@ -118,8 +115,6 @@ declare function meshState(snap: SceneSnapshot, mesh: MeshHandle): MeshState;
|
|
|
118
115
|
declare const REMOVED_SECTION_STATE: SectionState;
|
|
119
116
|
/** A section's state in `snap`, or {@link REMOVED_SECTION_STATE} when it is not there. */
|
|
120
117
|
declare function sectionState(snap: SceneSnapshot, section: SectionHandle): SectionState;
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/store/store.d.ts
|
|
123
118
|
/** A change to a section's declarative parts. */
|
|
124
119
|
type SectionPatch = Partial<SectionParts>;
|
|
125
120
|
/**
|
|
@@ -175,6 +170,7 @@ declare class SceneStore {
|
|
|
175
170
|
edit(mesh: MeshHandle, ops: readonly EditOp[]): Promise<EditResult>;
|
|
176
171
|
/** Repairs a mesh (one undo step). */
|
|
177
172
|
repair(mesh: MeshHandle, op: RepairOp | readonly RepairOp[]): Promise<RepairReport | RepairReport[]>;
|
|
173
|
+
repair(mesh: MeshHandle, request: AutoRepairRequest): Promise<AutoRepairReport>;
|
|
178
174
|
/** Undoes the latest step. */
|
|
179
175
|
undo(): void;
|
|
180
176
|
/** Redoes the latest undone step. */
|
|
@@ -281,5 +277,4 @@ declare class SceneStore {
|
|
|
281
277
|
}
|
|
282
278
|
/** A store over `scene` (a `Scene` or a `WorkerScene`). */
|
|
283
279
|
declare function createSceneStore(scene: Scene | WorkerScene): SceneStore;
|
|
284
|
-
//#endregion
|
|
285
280
|
export { StoreAddMeshOptions as _, DisplayState as a, MeshState as c, SceneSnapshot as d, SectionParts as f, sectionState as g, meshState as h, ContactGroup as i, REMOVED_MESH_STATE as l, Status as m, SectionPatch as n, DistanceColoring as o, SectionState as p, createSceneStore as r, EMPTY_SNAPSHOT as s, SceneStore as t, REMOVED_SECTION_STATE as u };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as reportListenerError, t as FastMeshError } from "./core-
|
|
2
|
-
import { l as targetsOf } from "./views-
|
|
3
|
-
import { i as sectionAspects } from "./protocol-
|
|
4
|
-
import {
|
|
5
|
-
import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-
|
|
6
|
-
|
|
1
|
+
import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { l as targetsOf } from "./views-CdOArjcB.js";
|
|
3
|
+
import { i as sectionAspects } from "./protocol-Ci9LLiwO.js";
|
|
4
|
+
import { a as watchStatusKeys, r as addFieldKeyed } from "./client-BIPPznBZ.js";
|
|
5
|
+
import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-BkbGPspK.js";
|
|
6
|
+
// src/store/host.ts
|
|
7
7
|
/** Whether `scene` is a Worker scene (structurally: it reports key statuses). */
|
|
8
8
|
function isWorkerScene(scene) {
|
|
9
9
|
return "status" in scene;
|
|
@@ -61,7 +61,7 @@ function localHost(scene) {
|
|
|
61
61
|
removeMesh: (mesh) => scene.removeMesh(mesh),
|
|
62
62
|
setPlacement: (mesh, placement) => scene.setPlacement(mesh, placement),
|
|
63
63
|
edit: (mesh, ops) => promised(() => scene.edit(mesh, ops)),
|
|
64
|
-
repair: (mesh, op) => promised(() => scene.repair(mesh, op)),
|
|
64
|
+
repair: ((mesh, op) => promised(() => scene.repair(mesh, op))),
|
|
65
65
|
undo: () => {
|
|
66
66
|
scene.undo();
|
|
67
67
|
},
|
|
@@ -124,7 +124,7 @@ function workerHost(scene) {
|
|
|
124
124
|
removeMesh: (mesh) => scene.removeMesh(mesh),
|
|
125
125
|
setPlacement: (mesh, placement) => scene.setPlacement(mesh, placement),
|
|
126
126
|
edit: (mesh, ops) => scene.edit(mesh, ops),
|
|
127
|
-
repair: (mesh, op) => scene.repair(mesh, op),
|
|
127
|
+
repair: ((mesh, op) => scene.repair(mesh, op)),
|
|
128
128
|
undo: () => scene.undo(),
|
|
129
129
|
redo: () => scene.redo(),
|
|
130
130
|
canUndo: () => scene.canUndo,
|
|
@@ -164,8 +164,7 @@ function workerHost(scene) {
|
|
|
164
164
|
forgetErrors
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
//#region src/store/store.ts
|
|
167
|
+
// src/store/store.ts
|
|
169
168
|
/**
|
|
170
169
|
* `c` without `mesh` among its targets when it has others (the scene keeps
|
|
171
170
|
* such a field without the mesh); otherwise `c` itself.
|
|
@@ -561,7 +560,6 @@ var SceneStore = class {
|
|
|
561
560
|
this.#alive();
|
|
562
561
|
return this.#settled(this.#host.edit(mesh, ops));
|
|
563
562
|
}
|
|
564
|
-
/** Repairs a mesh (one undo step). */
|
|
565
563
|
repair(mesh, op) {
|
|
566
564
|
this.#alive();
|
|
567
565
|
return this.#settled(this.#host.repair(mesh, op));
|
|
@@ -1375,5 +1373,4 @@ function createSceneStore(scene) {
|
|
|
1375
1373
|
function setFrameLoop(store, on) {
|
|
1376
1374
|
setFrameLoopOf(store, on);
|
|
1377
1375
|
}
|
|
1378
|
-
//#endregion
|
|
1379
1376
|
export { createSceneStore as n, setFrameLoop as r, SceneStore as t };
|
package/dist/store.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as StoreAddMeshOptions, a as DisplayState, c as MeshState, d as SceneSnapshot, f as SectionParts, g as sectionState, h as meshState, i as ContactGroup, l as REMOVED_MESH_STATE, m as Status, n as SectionPatch, o as DistanceColoring, p as SectionState, r as createSceneStore, s as EMPTY_SNAPSHOT, t as SceneStore, u as REMOVED_SECTION_STATE } from "./store-
|
|
3
|
-
//#region src/store/heatmap.d.ts
|
|
1
|
+
import { Q as Rgba, st as SignMode } from "./scene-like-CavrKbpQ.js";
|
|
2
|
+
import { _ as StoreAddMeshOptions, a as DisplayState, c as MeshState, d as SceneSnapshot, f as SectionParts, g as sectionState, h as meshState, i as ContactGroup, l as REMOVED_MESH_STATE, m as Status, n as SectionPatch, o as DistanceColoring, p as SectionState, r as createSceneStore, s as EMPTY_SNAPSHOT, t as SceneStore, u as REMOVED_SECTION_STATE } from "./store-CZwml1K3.js";
|
|
4
3
|
/** Options of {@link contactHeatmap}. Distances are in the meshes' units. */
|
|
5
4
|
interface ContactHeatmapOptions {
|
|
6
5
|
/** The penetration depth shown darkest (`deep`); deeper clamps to it. `> 0`. */
|
|
@@ -57,5 +56,4 @@ interface ContactHeatmapOptions {
|
|
|
57
56
|
* `0 ≤ tolerance < min(depth, gap)` (`< depth` when `gap` is 0).
|
|
58
57
|
*/
|
|
59
58
|
export declare function contactHeatmap(options: ContactHeatmapOptions): Omit<DistanceColoring, "distanceTo">;
|
|
60
|
-
//#endregion
|
|
61
59
|
export { type ContactGroup, type ContactHeatmapOptions, type DisplayState, type DistanceColoring, EMPTY_SNAPSHOT, type MeshState, REMOVED_MESH_STATE, REMOVED_SECTION_STATE, type SceneSnapshot, SceneStore, type SectionParts, type SectionPatch, type SectionState, type Status, type StoreAddMeshOptions, createSceneStore, meshState, sectionState };
|
package/dist/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FastMeshError } from "./core-
|
|
2
|
-
import { i as REMOVED_SECTION_STATE, l as sectionState, n as EMPTY_SNAPSHOT, r as REMOVED_MESH_STATE, s as meshState } from "./snapshot-
|
|
3
|
-
import { n as createSceneStore, t as SceneStore } from "./store-
|
|
4
|
-
|
|
1
|
+
import { t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { i as REMOVED_SECTION_STATE, l as sectionState, n as EMPTY_SNAPSHOT, r as REMOVED_MESH_STATE, s as meshState } from "./snapshot-BkbGPspK.js";
|
|
3
|
+
import { n as createSceneStore, t as SceneStore } from "./store-m9l0Al-m.js";
|
|
4
|
+
// src/store/heatmap.ts
|
|
5
5
|
/** The default colours: `#7f0000`, `#ff6b6b`, `#ffffff`, `#4caf50`, `#1e3a8a`. */
|
|
6
6
|
const DEFAULT_COLORS = {
|
|
7
7
|
deep: [
|
|
@@ -101,5 +101,4 @@ function contactHeatmap(options) {
|
|
|
101
101
|
above: "base"
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
//#endregion
|
|
105
104
|
export { EMPTY_SNAPSHOT, REMOVED_MESH_STATE, REMOVED_SECTION_STATE, SceneStore, contactHeatmap, createSceneStore, meshState, sectionState };
|
package/dist/three.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-
|
|
1
|
+
import { t as SceneLike, wt as SectionHandle } from "./scene-like-CavrKbpQ.js";
|
|
2
|
+
import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-CqAIuOxU.js";
|
|
3
3
|
import * as THREE from "three";
|
|
4
|
-
//#region src/three/controls.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* What {@link attachTransformControls} needs of a TransformControls: its
|
|
7
6
|
* `dragging-changed` (`{ value: boolean }`) and `objectChange` events, the
|
|
@@ -57,8 +56,6 @@ interface AttachTransformControlsOptions {
|
|
|
57
56
|
* cannot start a drag (another drag is active) is ignored with a warning.
|
|
58
57
|
*/
|
|
59
58
|
export declare function attachTransformControls(controls: TransformControlsLike, scene: SceneLike, bound: MeshBinding, options?: AttachTransformControlsOptions): () => void;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/three/section.d.ts
|
|
62
59
|
/** Options of {@link bindSection}. */
|
|
63
60
|
interface BindSectionOptions {
|
|
64
61
|
/** The contour line colour. Defaults to black. */
|
|
@@ -115,5 +112,4 @@ interface BoundSection {
|
|
|
115
112
|
* `scene.commitFrame()` once per animation frame.
|
|
116
113
|
*/
|
|
117
114
|
export declare function bindSection(scene: SceneLike, section: SectionHandle, bound: readonly MeshBinding[], options?: BindSectionOptions): BoundSection;
|
|
118
|
-
//#endregion
|
|
119
115
|
export { type AttachTransformControlsOptions, type BindMeshOptions, type BindSectionOptions, type BoundMesh, type BoundSection, type MeshBinding, type SceneLike, type TransformControlsLike, bindMesh };
|
package/dist/three.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as FastMeshError } from "./core-
|
|
2
|
-
import { n as checkUntransformedParent, t as bindMesh } from "./mesh-
|
|
1
|
+
import { t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { n as checkUntransformedParent, t as bindMesh } from "./mesh-hPWBQPaN.js";
|
|
3
3
|
import * as THREE from "three";
|
|
4
|
-
|
|
4
|
+
// src/three/controls.ts
|
|
5
5
|
const defaultSchedule = (callback) => {
|
|
6
6
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => callback());
|
|
7
7
|
else setTimeout(callback, 16);
|
|
@@ -220,8 +220,7 @@ function attachTransformControls(controls, scene, bound, options = {}) {
|
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
//#region src/three/section.ts
|
|
223
|
+
// src/three/section.ts
|
|
225
224
|
const DEFAULT_LINE = 0;
|
|
226
225
|
const DEFAULT_FILL = 8947848;
|
|
227
226
|
/**
|
|
@@ -391,5 +390,4 @@ function bindSection(scene, section, bound, options = {}) {
|
|
|
391
390
|
}
|
|
392
391
|
};
|
|
393
392
|
}
|
|
394
|
-
//#endregion
|
|
395
393
|
export { attachTransformControls, bindMesh, bindSection };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as wasmMemory, n as call, t as FastMeshError } from "./core-
|
|
2
|
-
import { n as DEFAULT_NAN, t as DEFAULT_BASE } from "./colormap-
|
|
3
|
-
|
|
1
|
+
import { c as wasmMemory, n as call, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
+
import { n as DEFAULT_NAN, t as DEFAULT_BASE } from "./colormap-Dr5V3bvs.js";
|
|
3
|
+
// src/handles.ts
|
|
4
4
|
/**
|
|
5
5
|
* A mesh in a {@link Scene}. Opaque: pass it to the scene's methods. The same
|
|
6
6
|
* mesh always gives the same handle object, so handles compare with `===`.
|
|
@@ -51,8 +51,7 @@ function rotationMatrix(rotation) {
|
|
|
51
51
|
function targetsOf(to) {
|
|
52
52
|
return Array.isArray(to) ? to : [to];
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
//#region src/rule.ts
|
|
54
|
+
// src/rule.ts
|
|
56
55
|
const MAPS = {
|
|
57
56
|
turbo: 0,
|
|
58
57
|
viridis: 1,
|
|
@@ -120,8 +119,7 @@ function copyRule(rule) {
|
|
|
120
119
|
if (Array.isArray(stops)) copy.map = Object.freeze({ stops: Object.freeze(stops.map((stop) => Array.isArray(stop) ? Object.freeze(stop.map(frozen)) : stop)) });
|
|
121
120
|
return Object.freeze(copy);
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
//#region src/views.ts
|
|
122
|
+
// src/views.ts
|
|
125
123
|
/**
|
|
126
124
|
* Debug-mode check of kept views. The scene bumps the epoch on every call
|
|
127
125
|
* that may allocate or move buffers; a guarded view is a `Proxy` over the
|
|
@@ -182,8 +180,8 @@ function meshViews(scene, index, generation, guard) {
|
|
|
182
180
|
normals: () => build(f32, (s) => s.normals_ptr(index, generation), (s) => s.normals_len(index, generation)),
|
|
183
181
|
colors: () => build(u8, (s) => s.colors_ptr(index, generation), (s) => s.colors_len(index, generation)),
|
|
184
182
|
values: () => build(f32, (s) => s.values_ptr(index, generation), (s) => s.values_len(index, generation)),
|
|
183
|
+
uvs: () => build(f32, (s) => s.uvs_ptr(index, generation), (s) => s.uvs_len(index, generation)),
|
|
185
184
|
indices: () => build(u32, (s) => s.indices_ptr(index, generation), (s) => s.indices_len(index, generation))
|
|
186
185
|
};
|
|
187
186
|
}
|
|
188
|
-
//#endregion
|
|
189
187
|
export { FieldHandle as a, rotationMatrix as c, encodeRule as i, targetsOf as l, meshViews as n, MeshHandle as o, copyRule as r, SectionHandle as s, ViewGuard as t };
|
|
@@ -11,6 +11,20 @@ export class WasmScene {
|
|
|
11
11
|
* Drops the open step unit, if any; see [`Scene::abandon_field_step`].
|
|
12
12
|
*/
|
|
13
13
|
abandon_field_step(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a per-vertex curvature field on the mesh given as a flat pair
|
|
16
|
+
* `[index, generation]`, and returns its raw id: the signed mean
|
|
17
|
+
* curvature at each vertex, in 1/world-units (positive on domes, about
|
|
18
|
+
* `1 / r` on a sphere of radius `r`; negative in bowls; zero on flats).
|
|
19
|
+
* Dead slots and unused vertices read NaN.
|
|
20
|
+
*/
|
|
21
|
+
add_curvature_field(name: string, on: Uint32Array): number;
|
|
22
|
+
/**
|
|
23
|
+
* [`WasmScene::add_curvature_field`] computing nothing yet: the field
|
|
24
|
+
* is due until stepped or updated; see
|
|
25
|
+
* [`Scene::add_curvature_field_deferred`].
|
|
26
|
+
*/
|
|
27
|
+
add_curvature_field_deferred(name: string, on: Uint32Array): number;
|
|
14
28
|
/**
|
|
15
29
|
* Adds a signed distance field on mesh `on` to one or more target
|
|
16
30
|
* meshes, given as flat pairs `[on index, on generation, to index, to
|
|
@@ -53,6 +67,12 @@ export class WasmScene {
|
|
|
53
67
|
* being added; the chunks must add up to its declared vertices.
|
|
54
68
|
*/
|
|
55
69
|
add_mesh_push_positions(build: number, chunk: Float64Array): void;
|
|
70
|
+
/**
|
|
71
|
+
* Appends a chunk of flat `[u, v, ...]` UVs to a mesh being added. The
|
|
72
|
+
* chunks must add up to 2 per vertex; the build checks them when its
|
|
73
|
+
* store is done and fails like [`WasmScene::add_mesh_with_uvs`].
|
|
74
|
+
*/
|
|
75
|
+
add_mesh_push_uvs(build: number, chunk: Float32Array): void;
|
|
56
76
|
/**
|
|
57
77
|
* Builds about `budget` more units of a mesh being added: first its
|
|
58
78
|
* store (vertices or triangles a unit), then its BVH (see
|
|
@@ -60,11 +80,30 @@ export class WasmScene {
|
|
|
60
80
|
* complete first. A failed build is dropped.
|
|
61
81
|
*/
|
|
62
82
|
add_mesh_step(build: number, budget: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* [`WasmScene::add_mesh`] with UVs: 2 finite `f32`s per vertex
|
|
85
|
+
* (`Mesh::add_uvs`). Nothing is added on error.
|
|
86
|
+
*/
|
|
87
|
+
add_mesh_with_uvs(positions: Float64Array, indices: Uint32Array, uvs: Float32Array, origin: Float64Array | null | undefined, mode: number, normals: boolean): Uint32Array;
|
|
63
88
|
/**
|
|
64
89
|
* Adds a section cutting `meshes` (flat pairs) with the world plane
|
|
65
90
|
* `[origin xyz, normal xyz]`, and returns its raw id.
|
|
66
91
|
*/
|
|
67
92
|
add_section(plane: Float64Array, meshes: Uint32Array, fill: boolean): number;
|
|
93
|
+
/**
|
|
94
|
+
* Adds a per-vertex wall-thickness field on the mesh given as a flat
|
|
95
|
+
* pair `[index, generation]`, and returns its raw id: the distance to
|
|
96
|
+
* the opposite surface along each vertex's smooth normal, in world
|
|
97
|
+
* units. Open sheets and rims read NaN; hits beyond `max_distance`
|
|
98
|
+
* read `Infinity`.
|
|
99
|
+
*/
|
|
100
|
+
add_thickness_field(name: string, on: Uint32Array, max_distance: number): number;
|
|
101
|
+
/**
|
|
102
|
+
* [`WasmScene::add_thickness_field`] computing nothing yet: the field
|
|
103
|
+
* is due until stepped or updated; see
|
|
104
|
+
* [`Scene::add_thickness_field_deferred`].
|
|
105
|
+
*/
|
|
106
|
+
add_thickness_field_deferred(name: string, on: Uint32Array, max_distance: number): number;
|
|
68
107
|
/**
|
|
69
108
|
* A read-only report of the mesh's defects, laid out as in
|
|
70
109
|
* [`crate::edit::encode_analysis`]. `weld_tolerance` (local units,
|
|
@@ -89,6 +128,16 @@ export class WasmScene {
|
|
|
89
128
|
* Opens a history step, or one more nesting level of the open one.
|
|
90
129
|
*/
|
|
91
130
|
begin_step(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Combines mesh B into mesh A in the world and returns `[index,
|
|
133
|
+
* generation, kept triangles, triangles added]` of A (the result
|
|
134
|
+
* replaces A with A's placement; B is unchanged). `op` is 0 (union),
|
|
135
|
+
* 1 (subtract) or 2 (intersect). The boolean undoes in one step;
|
|
136
|
+
* combining a mesh with itself is a no-op for union and intersect,
|
|
137
|
+
* and clears it for subtract. Only positions and triangles cross
|
|
138
|
+
* over; the new vertices take channel defaults.
|
|
139
|
+
*/
|
|
140
|
+
boolean(a_index: number, a_generation: number, b_index: number, b_generation: number, op: number): Uint32Array;
|
|
92
141
|
/**
|
|
93
142
|
* The box around the vertices the live triangles use, in the mesh's
|
|
94
143
|
* stored local coordinates: `[min xyz, max xyz]`. Empty without live
|
|
@@ -145,6 +194,17 @@ export class WasmScene {
|
|
|
145
194
|
* whenever the mesh's positions, triangles or normals change.
|
|
146
195
|
*/
|
|
147
196
|
content_stamp(index: number, generation: number): number;
|
|
197
|
+
/**
|
|
198
|
+
* Cuts a mesh with a world plane `[origin xyz, normal xyz]`: the `+`
|
|
199
|
+
* side stays on the mesh and the `-` side is added as a new mesh with
|
|
200
|
+
* the same placement. Returns `[kept index, kept generation, added
|
|
201
|
+
* index, added generation, kept triangles, removed triangles, cap
|
|
202
|
+
* triangles]`. With `cap` (the usual case) both openings are closed
|
|
203
|
+
* with flat, unfaired patches; without it both parts keep the open rim.
|
|
204
|
+
* The cut undoes in one step; the added mesh stays, like the removed
|
|
205
|
+
* source of [`WasmScene::join`].
|
|
206
|
+
*/
|
|
207
|
+
cut_by_plane(index: number, generation: number, plane: Float64Array, cap: boolean): Uint32Array;
|
|
148
208
|
/**
|
|
149
209
|
* Drops a mesh being added in steps (nothing was added).
|
|
150
210
|
*/
|
|
@@ -154,10 +214,10 @@ export class WasmScene {
|
|
|
154
214
|
* nothing changes when an op fails. `ops` and `values` are laid out as
|
|
155
215
|
* in [`crate::edit`]: `ops` is a `u32` sequence of op codes (0 set
|
|
156
216
|
* positions, 1 add vertices, 2 add triangles, 3 remove triangles, 4
|
|
157
|
-
* remove vertices) with their id lists, whose refs name ids added by
|
|
217
|
+
* remove vertices, 5 set UVs) with their id lists, whose refs name ids added by
|
|
158
218
|
* earlier ops of the list; `values` holds the world positions, mapped
|
|
159
219
|
* to local with the placement inverse and the origin in `f64`, then
|
|
160
|
-
* stored as `f32
|
|
220
|
+
* stored as `f32`, and the UVs of op 5. Returns `[n, id × n]` per op: the new vertex or
|
|
161
221
|
* triangle ids, none for the other ops. The list is decoded and every
|
|
162
222
|
* ref checked before the mesh is touched.
|
|
163
223
|
*/
|
|
@@ -260,9 +320,23 @@ export class WasmScene {
|
|
|
260
320
|
join(a_index: number, a_generation: number, b_index: number, b_generation: number, loops: Uint32Array, max_edges: number): Float64Array;
|
|
261
321
|
/**
|
|
262
322
|
* The world matrix of the local render coordinates,
|
|
263
|
-
* `placement · translate(origin)`, column-major (16 values)
|
|
323
|
+
* `placement · translate(origin)`, column-major (16 values): the
|
|
324
|
+
* rotation columns are scaled, and the last column is
|
|
325
|
+
* `rotation · (scale · origin) + translation`.
|
|
264
326
|
*/
|
|
265
327
|
matrix4(index: number, generation: number): Float64Array;
|
|
328
|
+
/**
|
|
329
|
+
* Scalar measurements of a mesh in world coordinates (its placement
|
|
330
|
+
* applied, so scaled meshes measure scaled): `[area, volume (NaN when
|
|
331
|
+
* the mesh is not watertight), closed (0/1), volume reason (0 closed,
|
|
332
|
+
* 1 open, 2 non-manifold), boundary loops, non-manifold edges,
|
|
333
|
+
* orientation conflicts]`. Area is always defined; volume is `None`
|
|
334
|
+
* with its reason unless the mesh has no boundary and no
|
|
335
|
+
* non-manifold edge. The volume is the absolute signed sum, so
|
|
336
|
+
* inconsistent winding only flags `orientation conflicts` without
|
|
337
|
+
* failing.
|
|
338
|
+
*/
|
|
339
|
+
measure(index: number, generation: number): Float64Array;
|
|
266
340
|
/**
|
|
267
341
|
* The distance between two meshes' surfaces as placed. Empty when it
|
|
268
342
|
* exceeds `max_distance` or a mesh has no triangle, else `[distance,
|
|
@@ -291,7 +365,7 @@ export class WasmScene {
|
|
|
291
365
|
normals_ptr(index: number, generation: number): number;
|
|
292
366
|
/**
|
|
293
367
|
* The placement: the row-major rotation (9 values), then the
|
|
294
|
-
* translation (3 values).
|
|
368
|
+
* translation (3 values), then the scale (3 values).
|
|
295
369
|
*/
|
|
296
370
|
placement(index: number, generation: number): Float64Array;
|
|
297
371
|
/**
|
|
@@ -313,6 +387,15 @@ export class WasmScene {
|
|
|
313
387
|
* Redoes the latest undone step; false when there is nothing to redo.
|
|
314
388
|
*/
|
|
315
389
|
redo(): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Aligns the moving mesh to the fixed one by ICP from their current
|
|
392
|
+
* placements; see [`Scene::register`]. The numeric options are NaN for
|
|
393
|
+
* their defaults. Returns `[rotation (9, row-major), translation (3),
|
|
394
|
+
* scale (3), rmse, iterations, status, applied, samples, inliers,
|
|
395
|
+
* conditioning]`, with status 0 converged, 1 out of iterations, 2
|
|
396
|
+
* underconstrained, 3 too few correspondences, 4 diverged.
|
|
397
|
+
*/
|
|
398
|
+
register(moving_index: number, moving_generation: number, fixed_index: number, fixed_generation: number, max_iterations: number, tolerance: number, overlap: number, max_distance: number, max_samples: number, apply: boolean): Float64Array;
|
|
316
399
|
/**
|
|
317
400
|
* Removes a field (and a colouring by it).
|
|
318
401
|
*/
|
|
@@ -368,10 +451,11 @@ export class WasmScene {
|
|
|
368
451
|
*/
|
|
369
452
|
set_mode(index: number, generation: number, mode: number): void;
|
|
370
453
|
/**
|
|
371
|
-
* Sets the placement from a row-major rotation (9 values)
|
|
372
|
-
* translation (3 values)
|
|
454
|
+
* Sets the placement from a row-major rotation (9 values), a
|
|
455
|
+
* translation (3 values) and a scale (3 values, each positive; `None`
|
|
456
|
+
* for `[1, 1, 1]`). The rotation must be a proper rotation.
|
|
373
457
|
*/
|
|
374
|
-
set_placement(index: number, generation: number, rotation: Float64Array, translation: Float64Array): void;
|
|
458
|
+
set_placement(index: number, generation: number, rotation: Float64Array, translation: Float64Array, scale?: Float64Array | null): void;
|
|
375
459
|
/**
|
|
376
460
|
* Turns a section's fill on or off.
|
|
377
461
|
*/
|
|
@@ -409,6 +493,15 @@ export class WasmScene {
|
|
|
409
493
|
* Computes every stale section entry.
|
|
410
494
|
*/
|
|
411
495
|
update_sections(): void;
|
|
496
|
+
/**
|
|
497
|
+
* Length of the UVs in `f32`s, 0 for a mesh without them.
|
|
498
|
+
*/
|
|
499
|
+
uvs_len(index: number, generation: number): number;
|
|
500
|
+
/**
|
|
501
|
+
* Address of the UVs (`f32`, 2 per vertex slot), 0 for a mesh without
|
|
502
|
+
* them.
|
|
503
|
+
*/
|
|
504
|
+
uvs_ptr(index: number, generation: number): number;
|
|
412
505
|
/**
|
|
413
506
|
* Length of the colour values in `f32`s, 0 when the mesh has no
|
|
414
507
|
* colouring.
|
|
@@ -456,17 +549,24 @@ export interface InitOutput {
|
|
|
456
549
|
readonly computeBounds: (a: number, b: number) => [number, number, number, number];
|
|
457
550
|
readonly computeVertexNormals: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
458
551
|
readonly wasmscene_abandon_field_step: (a: number) => void;
|
|
552
|
+
readonly wasmscene_add_curvature_field: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
553
|
+
readonly wasmscene_add_curvature_field_deferred: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
459
554
|
readonly wasmscene_add_distance_field: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
460
555
|
readonly wasmscene_add_distance_field_deferred: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
461
556
|
readonly wasmscene_add_mesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
462
557
|
readonly wasmscene_add_mesh_buffers: (a: number, b: number) => [number, number, number, number];
|
|
463
558
|
readonly wasmscene_add_mesh_push_indices: (a: number, b: number, c: number, d: number) => [number, number];
|
|
464
559
|
readonly wasmscene_add_mesh_push_positions: (a: number, b: number, c: number, d: number) => [number, number];
|
|
560
|
+
readonly wasmscene_add_mesh_push_uvs: (a: number, b: number, c: number, d: number) => [number, number];
|
|
465
561
|
readonly wasmscene_add_mesh_step: (a: number, b: number, c: number) => [number, number, number];
|
|
562
|
+
readonly wasmscene_add_mesh_with_uvs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
|
|
466
563
|
readonly wasmscene_add_section: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
564
|
+
readonly wasmscene_add_thickness_field: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
565
|
+
readonly wasmscene_add_thickness_field_deferred: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
467
566
|
readonly wasmscene_analyze: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
468
567
|
readonly wasmscene_begin_add_mesh_upload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
469
568
|
readonly wasmscene_begin_step: (a: number) => void;
|
|
569
|
+
readonly wasmscene_boolean: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
470
570
|
readonly wasmscene_bounds: (a: number, b: number, c: number) => [number, number, number, number];
|
|
471
571
|
readonly wasmscene_can_redo: (a: number) => number;
|
|
472
572
|
readonly wasmscene_can_undo: (a: number) => number;
|
|
@@ -479,6 +579,7 @@ export interface InitOutput {
|
|
|
479
579
|
readonly wasmscene_colors_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
480
580
|
readonly wasmscene_compact: (a: number, b: number, c: number) => [number, number];
|
|
481
581
|
readonly wasmscene_content_stamp: (a: number, b: number, c: number) => [number, number, number];
|
|
582
|
+
readonly wasmscene_cut_by_plane: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
482
583
|
readonly wasmscene_drop_add_mesh: (a: number, b: number) => void;
|
|
483
584
|
readonly wasmscene_edit: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
484
585
|
readonly wasmscene_end_step: (a: number) => [number, number];
|
|
@@ -499,6 +600,7 @@ export interface InitOutput {
|
|
|
499
600
|
readonly wasmscene_intersects: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
500
601
|
readonly wasmscene_join: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
501
602
|
readonly wasmscene_matrix4: (a: number, b: number, c: number) => [number, number, number, number];
|
|
603
|
+
readonly wasmscene_measure: (a: number, b: number, c: number) => [number, number, number, number];
|
|
502
604
|
readonly wasmscene_mesh_distance: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
503
605
|
readonly wasmscene_mode: (a: number, b: number, c: number) => [number, number, number];
|
|
504
606
|
readonly wasmscene_new: () => number;
|
|
@@ -509,6 +611,7 @@ export interface InitOutput {
|
|
|
509
611
|
readonly wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
510
612
|
readonly wasmscene_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
511
613
|
readonly wasmscene_redo: (a: number) => [number, number, number];
|
|
614
|
+
readonly wasmscene_register: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number, number];
|
|
512
615
|
readonly wasmscene_remove_field: (a: number, b: number) => [number, number];
|
|
513
616
|
readonly wasmscene_remove_mesh: (a: number, b: number, c: number) => [number, number];
|
|
514
617
|
readonly wasmscene_remove_section: (a: number, b: number) => [number, number];
|
|
@@ -519,7 +622,7 @@ export interface InitOutput {
|
|
|
519
622
|
readonly wasmscene_set_coloring: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
520
623
|
readonly wasmscene_set_defer_fields: (a: number, b: number) => void;
|
|
521
624
|
readonly wasmscene_set_mode: (a: number, b: number, c: number, d: number) => [number, number];
|
|
522
|
-
readonly wasmscene_set_placement: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
625
|
+
readonly wasmscene_set_placement: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
523
626
|
readonly wasmscene_set_section_fill: (a: number, b: number, c: number) => [number, number];
|
|
524
627
|
readonly wasmscene_set_section_meshes: (a: number, b: number, c: number, d: number) => [number, number];
|
|
525
628
|
readonly wasmscene_set_section_plane: (a: number, b: number, c: number, d: number) => [number, number];
|
|
@@ -529,6 +632,8 @@ export interface InitOutput {
|
|
|
529
632
|
readonly wasmscene_undo: (a: number) => [number, number, number];
|
|
530
633
|
readonly wasmscene_update: (a: number, b: number, c: number) => [number, number];
|
|
531
634
|
readonly wasmscene_update_sections: (a: number) => [number, number];
|
|
635
|
+
readonly wasmscene_uvs_len: (a: number, b: number, c: number) => [number, number, number];
|
|
636
|
+
readonly wasmscene_uvs_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
532
637
|
readonly wasmscene_values_len: (a: number, b: number, c: number) => [number, number, number];
|
|
533
638
|
readonly wasmscene_values_ptr: (a: number, b: number, c: number) => [number, number, number];
|
|
534
639
|
readonly wasmscene_vertex_count: (a: number, b: number, c: number) => [number, number, number];
|