fast-mesh-wasm 0.5.3 → 0.6.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.
Files changed (39) hide show
  1. package/README.md +2 -1
  2. package/dist/{client-f895H_yB.js → client-BrTp2eMp.js} +20 -1
  3. package/dist/{client-D7yfPOyU.d.ts → client-Ds09vLkN.d.ts} +13 -2
  4. package/dist/{engine-BcJ5W6kS.js → engine-DjdY3GxK.js} +7 -3
  5. package/dist/io.d.ts +19 -4
  6. package/dist/io.js +64 -9
  7. package/dist/{mesh-B3QP93wx.d.ts → mesh-BsqIofgT.d.ts} +5 -2
  8. package/dist/{mesh-hPWBQPaN.js → mesh-DIWD2F5-.js} +51 -2
  9. package/dist/node.d.ts +2 -2
  10. package/dist/node.js +1 -1
  11. package/dist/{protocol-Dt0zgang.d.ts → protocol-Cb23HelE.d.ts} +7 -1
  12. package/dist/r3f.d.ts +3 -3
  13. package/dist/r3f.js +2 -2
  14. package/dist/react.d.ts +2 -2
  15. package/dist/{scene-CXtM_bxV.js → scene-D0HNTwoo.js} +82 -6
  16. package/dist/{scene-like-Dq9_SaUL.d.ts → scene-like-CADk1vfb.d.ts} +118 -8
  17. package/dist/{store-CIW19oCh.d.ts → store-BfC6kkf5.d.ts} +2 -2
  18. package/dist/{store-C9h7GFFl.js → store-DIQmxF_s.js} +2 -2
  19. package/dist/store.d.ts +2 -2
  20. package/dist/store.js +1 -1
  21. package/dist/three.d.ts +2 -2
  22. package/dist/three.js +1 -1
  23. package/dist/{views-mp7Mf8CQ.js → views-B00kdV0R.js} +6 -1
  24. package/dist/wasm/fast_mesh_wasm.d.ts +14 -1
  25. package/dist/wasm/fast_mesh_wasm.js +29 -1
  26. package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
  27. package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +2 -0
  28. package/dist/wasm-threads/fast_mesh_wasm.d.ts +14 -1
  29. package/dist/wasm-threads/fast_mesh_wasm.js +29 -1
  30. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
  31. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +2 -0
  32. package/dist/web.d.ts +2 -2
  33. package/dist/web.js +1 -1
  34. package/dist/worker-engine.d.ts +5 -3
  35. package/dist/worker-engine.js +1 -1
  36. package/dist/worker-entry.js +1 -1
  37. package/dist/worker.d.ts +1 -1
  38. package/dist/worker.js +1 -1
  39. package/package.json +1 -1
@@ -541,7 +541,8 @@ export class WasmScene {
541
541
  * the same placement. Returns `[kept index, kept generation, added
542
542
  * index, added generation, kept triangles, removed triangles, cap
543
543
  * triangles]`. With `cap` (the usual case) both openings are closed
544
- * with flat, unfaired patches; without it both parts keep the open rim.
544
+ * with flat, unfaired patches, across UV seams on a mesh with UVs;
545
+ * without it both parts keep the open rim.
545
546
  * The cut undoes in one step; the added mesh stays, like the removed
546
547
  * source of [`WasmScene::join`].
547
548
  * @param {number} index
@@ -965,6 +966,22 @@ export class WasmScene {
965
966
  }
966
967
  return ret[0] >>> 0;
967
968
  }
969
+ /**
970
+ * The mesh's origin: its stored positions are relative to it, and
971
+ * `setPositions` takes positions with it added back.
972
+ * @param {number} index
973
+ * @param {number} generation
974
+ * @returns {Float64Array}
975
+ */
976
+ origin(index, generation) {
977
+ const ret = wasm.wasmscene_origin(this.__wbg_ptr, index, generation);
978
+ if (ret[3]) {
979
+ throw takeFromExternrefTable0(ret[2]);
980
+ }
981
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
982
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
983
+ return v1;
984
+ }
968
985
  /**
969
986
  * The placement: the row-major rotation (9 values), then the
970
987
  * translation (3 values), then the scale (3 values).
@@ -1211,6 +1228,17 @@ export class WasmScene {
1211
1228
  set_defer_fields(on) {
1212
1229
  wasm.wasmscene_set_defer_fields(this.__wbg_ptr, on);
1213
1230
  }
1231
+ /**
1232
+ * Starts (a budget of `points`) or ends (`undefined`) an interaction; see
1233
+ * [`Scene::set_field_interaction`].
1234
+ * @param {number | null} [points]
1235
+ */
1236
+ set_field_interaction(points) {
1237
+ const ret = wasm.wasmscene_set_field_interaction(this.__wbg_ptr, isLikeNone(points) ? Number.MAX_SAFE_INTEGER : (points) >>> 0);
1238
+ if (ret[1]) {
1239
+ throw takeFromExternrefTable0(ret[0]);
1240
+ }
1241
+ }
1214
1242
  /**
1215
1243
  * Sets when the mesh's BVH, normals, fields and sections follow its
1216
1244
  * edits: 0 (Eager), 1 (Lazy) or 2 (Manual).
@@ -63,6 +63,7 @@ export const wasmscene_mode: (a: number, b: number, c: number) => [number, numbe
63
63
  export const wasmscene_new: () => number;
64
64
  export const wasmscene_normals_len: (a: number, b: number, c: number) => [number, number, number];
65
65
  export const wasmscene_normals_ptr: (a: number, b: number, c: number) => [number, number, number];
66
+ export const wasmscene_origin: (a: number, b: number, c: number) => [number, number, number, number];
66
67
  export const wasmscene_placement: (a: number, b: number, c: number) => [number, number, number, number];
67
68
  export const wasmscene_positions_len: (a: number, b: number, c: number) => [number, number, number];
68
69
  export const wasmscene_positions_ptr: (a: number, b: number, c: number) => [number, number, number];
@@ -78,6 +79,7 @@ export const wasmscene_section_desc_plane: (a: number, b: number) => [number, nu
78
79
  export const wasmscene_section_gap: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
79
80
  export const wasmscene_set_coloring: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
80
81
  export const wasmscene_set_defer_fields: (a: number, b: number) => void;
82
+ export const wasmscene_set_field_interaction: (a: number, b: number) => [number, number];
81
83
  export const wasmscene_set_mode: (a: number, b: number, c: number, d: number) => [number, number];
82
84
  export const wasmscene_set_placement: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
83
85
  export const wasmscene_set_section_fill: (a: number, b: number, c: number) => [number, number];
package/dist/web.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as RepairReportOf, A as InflateReport, At as Mat3, B as OutOfRange, C as EditRef, Ct as SceneMeshViews, D as FilledLoop, Dt as Bounds, E as FillReport, Et as SectionHandle, F as MeshChange, Ft as Quat, G as RegisterOptions, H as RaycastOptions, I as MeshComponent, It as UpdateMode, J as RelaxReport, K as RegisterResult, L as MeshDistance, Lt as Vec3, M as JoinReport, Mt as PlacementInput, N as LoopId, Nt as Positions, O as FindContactsOptions, Ot as Indices, P as MeasureResult, Pt as Positions64, Q as RepairReport, R as OffsetReport, Rt as computeBounds, S as EditOp, St as MeshViews, T as FieldStatus, Tt as MeshHandle, U as RegisterMotion, V as RayHit, W as RegisterNotApplied, X as RemoveReport, Y as RemeshReport, Z as RepairOp, _ as CutReport, _t as IsolateReport, a as AutoRepairReport, at as SectionGap, b as DragOptions, bt as VertexSelection, c as BoundaryLoop, ct as ShellReport, d as ClosestPointOptions, dt as SmoothReport, et as Rgba, f as ColorRule, ft as SubdivideReport, g as CutOptions, gt as ComponentSelect, h as CurvatureFieldDesc, ht as BrushSelect, i as AnalyzeOptions, it as SectionDesc, j as JoinOptions, jt as Placement, k as GrabReport, kt as InitInput, l as BridgeReport, lt as SignMode, m as Contact, mt as WeldReport, n as AddMeshOptions, nt as SceneOptions, o as AutoRepairRequest, ot as SectionPlane, p as Colormap, pt as ThicknessFieldDesc, q as RegisterStatus, r as Analysis, rt as SectionContour, s as BooleanOp, st as SectionResult, t as SceneLike, tt as Scene, u as ClosestHit, ut as SimplifyReport, v as DegenerateReport, vt as LassoSelect, w as EditResult, wt as FieldHandle, x as DragSession, xt as Range, y as DistanceFieldDesc, yt as SelectSpec, z as OrientReport, zt as computeVertexNormals } from "./scene-like-Dq9_SaUL.js";
1
+ import { $ as RepairReport, A as GrabReport, At as Bounds, B as OrientReport, Bt as Vec3, C as EditOp, Ct as VertexSelection, D as FillReport, Dt as FieldHandle, E as FieldStatus, Et as SceneMeshViews, F as MeasureResult, Ft as PlacementInput, G as RegisterNotApplied, H as RayHit, Ht as computeVertexNormals, I as MeshChange, It as Positions, J as RegisterStatus, K as RegisterOptions, L as MeshComponent, Lt as Positions64, M as JoinOptions, Mt as InitInput, N as JoinReport, Nt as Mat3, O as FilledLoop, Ot as MeshHandle, P as LoopId, Pt as Placement, Q as RepairOp, R as MeshDistance, Rt as Quat, S as DragSession, St as SelectSpec, T as EditResult, Tt as MeshViews, U as RaycastOptions, V as OutOfRange, Vt as computeBounds, W as RegisterMotion, X as RemeshReport, Y as RelaxReport, Z as RemoveReport, _ as CutOptions, _t as WeldReport, a as AutoRepairReport, at as SectionDesc, b as DistanceFieldDesc, bt as IsolateReport, c as BoundaryLoop, ct as SectionResult, d as ClosestHit, dt as SimplifyReport, et as RepairReportOf, f as ClosestPointOptions, ft as SmoothReport, g as CurvatureFieldDesc, gt as VertexProtection, h as Contact, ht as ThicknessFieldDesc, i as AnalyzeOptions, it as SectionContour, j as InflateReport, jt as Indices, k as FindContactsOptions, kt as SectionHandle, l as BridgeReport, lt as ShellReport, m as Colormap, mt as SubdivideReport, n as AddMeshOptions, nt as Scene, o as AutoRepairRequest, ot as SectionGap, p as ColorRule, pt as StretchReport, q as RegisterResult, r as Analysis, rt as SceneOptions, s as BooleanOp, st as SectionPlane, t as SceneLike, tt as Rgba, u as CaptureRestReport, ut as SignMode, v as CutReport, vt as BrushSelect, w as EditRef, wt as Range, x as DragOptions, xt as LassoSelect, y as DegenerateReport, yt as ComponentSelect, z as OffsetReport, zt as UpdateMode } from "./scene-like-CADk1vfb.js";
2
2
  import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
3
3
  /**
4
4
  * Loads the WebAssembly module. Await this once before calling any other function.
@@ -8,4 +8,4 @@ import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
8
8
  * Leave empty to load the file shipped with this package.
9
9
  */
10
10
  export declare function init(input?: InitInput | Promise<InitInput>): Promise<void>;
11
- export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterMotion, type RegisterNotApplied, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
11
+ export { type AddMeshOptions, type Analysis, type AnalyzeOptions, type AutoRepairReport, type AutoRepairRequest, type BooleanOp, type BoundaryLoop, type Bounds, type BridgeReport, type BrushSelect, type CaptureRestReport, type ClosestHit, type ClosestPointOptions, type ColorRule, type Colormap, type ComponentSelect, type Contact, type CurvatureFieldDesc, type CutOptions, type CutReport, type DegenerateReport, type DistanceFieldDesc, type DragOptions, type DragSession, type EditOp, type EditRef, type EditResult, FastMeshError, type FastMeshErrorCode, type FieldHandle, type FieldStatus, type FillReport, type FilledLoop, type FindContactsOptions, type GrabReport, type Indices, type InflateReport, type InitInput, type IsolateReport, type JoinOptions, type JoinReport, type LassoSelect, type LoopId, type Mat3, type MeasureResult, type MeshChange, type MeshComponent, type MeshDistance, type MeshHandle, type MeshViews, type OffsetReport, type OrientReport, type OutOfRange, type Placement, type PlacementInput, type Positions, type Positions64, type Quat, type Range, type RayHit, type RaycastOptions, type RegisterMotion, type RegisterNotApplied, type RegisterOptions, type RegisterResult, type RegisterStatus, type RelaxReport, type RemeshReport, type RemoveReport, type RepairOp, type RepairReport, type RepairReportOf, type Rgba, Scene, type SceneLike, type SceneMeshViews, type SceneOptions, type SectionContour, type SectionDesc, type SectionGap, type SectionHandle, type SectionPlane, type SectionResult, type SelectSpec, type ShellReport, type SignMode, type SimplifyReport, type SmoothReport, type StretchReport, type SubdivideReport, type ThicknessFieldDesc, type UpdateMode, type Vec3, type VertexProtection, type VertexSelection, type WeldReport, computeBounds, computeVertexNormals };
package/dist/web.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as computeVertexNormals, r as markInitialized, t as computeBounds } from "./api-4kz45-Mq.js";
2
2
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
3
- import { t as Scene } from "./scene-CXtM_bxV.js";
3
+ import { t as Scene } from "./scene-D0HNTwoo.js";
4
4
  import wasmInit from "./wasm/fast_mesh_wasm.js";
5
5
  // src/web.ts
6
6
  let ready;
@@ -1,4 +1,4 @@
1
- import { a as WorkerMessage, i as Result, n as InitMessage, r as Request, t as ClientId } from "./protocol-Dt0zgang.js";
1
+ import { a as WorkerMessage, i as Result, n as InitMessage, r as Request, t as ClientId } from "./protocol-Cb23HelE.js";
2
2
  import { WasmScene } from "./wasm/fast_mesh_wasm.js";
3
3
  /** What the engine needs of a wasm-bindgen glue module. */
4
4
  interface Glue {
@@ -158,7 +158,9 @@ export interface EngineOptions {
158
158
  * completed, a queued drag move no longer abandons the unit: it completes
159
159
  * and is published, and the newest pose follows. So a sustained drag whose
160
160
  * recompute outlasts the gaps between moves still updates its colours
161
- * about every guard plus one recompute, each update exactly one pose.
161
+ * about every guard plus one recompute, each update exactly one pose. At
162
+ * the default of 0 a move never abandons a unit: every recompute that
163
+ * starts is shown, so its time alone sets the update rate.
162
164
  * Edits, repairs, compactions, removals, placements, undo, redo and drag
163
165
  * cancels always abandon, and so do drag moves once the drag's `end` is
164
166
  * queued (the final pose then follows within one recompute; a pointer
@@ -203,7 +205,7 @@ export interface EngineOptions {
203
205
  /** The default {@link EngineOptions.yieldMs}. */
204
206
  export declare const YIELD_MS = 4;
205
207
  /** The default {@link EngineOptions.staleGuardMs}. */
206
- export declare const STALE_GUARD_MS = 200;
208
+ export declare const STALE_GUARD_MS = 0;
207
209
  /** The default {@link EngineOptions.stepPoints}. */
208
210
  export declare const STEP_POINTS = 4096;
209
211
  /**
@@ -1 +1 @@
1
- export { t as ADD_STEP_WORK, n as BACKGROUND_ADD_TRIANGLES, r as STALE_GUARD_MS, i as STEP_POINTS, a as YIELD_MS, c as loadEngine, u as probeSharedGrowth, o as runEngine, s as serveEngine, l as startEngine } from "./engine-BcJ5W6kS.js";
1
+ export { t as ADD_STEP_WORK, n as BACKGROUND_ADD_TRIANGLES, r as STALE_GUARD_MS, i as STEP_POINTS, a as YIELD_MS, c as loadEngine, u as probeSharedGrowth, o as runEngine, s as serveEngine, l as startEngine } from "./engine-DjdY3GxK.js";
@@ -1,4 +1,4 @@
1
- import { l as startEngine, s as serveEngine } from "./engine-BcJ5W6kS.js";
1
+ import { l as startEngine, s as serveEngine } from "./engine-DjdY3GxK.js";
2
2
  // src/worker/entry.ts
3
3
  const scope = globalThis;
4
4
  serveEngine({
package/dist/worker.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as WorkerSceneOptions, i as WorkerScene, n as MAX_THREADS, o as createWorkerScene, r as WorkerLike, t as KeyStatus } from "./client-D7yfPOyU.js";
1
+ import { a as WorkerSceneOptions, i as WorkerScene, n as MAX_THREADS, o as createWorkerScene, r as WorkerLike, t as KeyStatus } from "./client-Ds09vLkN.js";
2
2
  export { type KeyStatus, MAX_THREADS, type WorkerLike, WorkerScene, type WorkerSceneOptions, createWorkerScene };
package/dist/worker.js CHANGED
@@ -1 +1 @@
1
- export { t as MAX_THREADS, n as WorkerScene, i as createWorkerScene } from "./client-f895H_yB.js";
1
+ export { t as MAX_THREADS, n as WorkerScene, i as createWorkerScene } from "./client-BrTp2eMp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-mesh-wasm",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Fast triangle mesh utilities for JavaScript, written in Rust and compiled to WebAssembly",
5
5
  "keywords": [
6
6
  "mesh",