fast-mesh-wasm 0.6.0 → 0.7.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 (37) hide show
  1. package/dist/{client-BrTp2eMp.js → client-DFgvktkT.js} +164 -10
  2. package/dist/{client-Ds09vLkN.d.ts → client-nvmbhtn-.d.ts} +76 -14
  3. package/dist/{engine-DjdY3GxK.js → engine-BL5_sWAf.js} +15 -4
  4. package/dist/io.d.ts +200 -2
  5. package/dist/io.js +3057 -3
  6. package/dist/{mesh-BsqIofgT.d.ts → mesh-BHTFxsXc.d.ts} +1 -1
  7. package/dist/node.d.ts +2 -2
  8. package/dist/node.js +3 -2
  9. package/dist/{protocol-Cb23HelE.d.ts → protocol-DFR0JDAS.d.ts} +3 -1
  10. package/dist/r3f.d.ts +3 -3
  11. package/dist/r3f.js +1 -1
  12. package/dist/react.d.ts +2 -2
  13. package/dist/{scene-D0HNTwoo.js → scene-DUsj6uJD.js} +346 -30
  14. package/dist/{scene-like-CADk1vfb.d.ts → scene-like-CR_Dpohm.d.ts} +902 -146
  15. package/dist/{store-BfC6kkf5.d.ts → store-8HWG90Jg.d.ts} +14 -3
  16. package/dist/{store-DIQmxF_s.js → store-BAzHRRkt.js} +18 -2
  17. package/dist/store.d.ts +3 -3
  18. package/dist/store.js +1 -1
  19. package/dist/three.d.ts +2 -2
  20. package/dist/views-BSy-Qeg8.js +584 -0
  21. package/dist/wasm/fast_mesh_wasm.d.ts +7 -0
  22. package/dist/wasm/fast_mesh_wasm.js +21 -0
  23. package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
  24. package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +1 -0
  25. package/dist/wasm-threads/fast_mesh_wasm.d.ts +7 -0
  26. package/dist/wasm-threads/fast_mesh_wasm.js +21 -0
  27. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
  28. package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +1 -0
  29. package/dist/web.d.ts +2 -2
  30. package/dist/web.js +3 -2
  31. package/dist/worker-engine.d.ts +1 -1
  32. package/dist/worker-engine.js +1 -1
  33. package/dist/worker-entry.js +1 -1
  34. package/dist/worker.d.ts +1 -1
  35. package/dist/worker.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/views-B00kdV0R.js +0 -214
@@ -1,5 +1,5 @@
1
- import { $ as RepairReport, C as EditOp, Ft as PlacementInput, I as MeshChange, Lt as Positions64, Ot as MeshHandle, Q as RepairOp, S as DragSession, T as EditResult, V as OutOfRange, a as AutoRepairReport, at as SectionDesc, jt as Indices, kt as SectionHandle, m as Colormap, n as AddMeshOptions, nt as Scene, o as AutoRepairRequest, st as SectionPlane, t as SceneLike, tt as Rgba, ut as SignMode } from "./scene-like-CADk1vfb.js";
2
- import { i as WorkerScene } from "./client-Ds09vLkN.js";
1
+ import { An as RepairReport, Ar as Vec3, Dr as Positions64, Et as AutoRepairRequest, Fn as SculptOp, In as SculptReport, Kt as DragSession, Ln as SculptReportOf, Lt as Colormap, Mn as Rgba, Nn as Scene, Tr as PlacementInput, Tt as AutoRepairReport, Vn as SectionPlane, Yt as EditResult, fn as MeshChange, jn as RepairReportOf, kn as RepairOp, n as SceneLike, qn as SignMode, qt as EditOp, vn as OutOfRange, vr as MeshHandle, xr as Indices, xt as AddMeshOptions, yr as SectionHandle, zn as SectionDesc } from "./scene-like-CR_Dpohm.js";
2
+ import { i as WorkerScene } from "./client-nvmbhtn-.js";
3
3
  import { t as FastMeshError } from "./core-CJ9D6U5A.js";
4
4
  /** Options of `SceneStore.addMesh`: those both scenes take (a store mesh is always eager). */
5
5
  type StoreAddMeshOptions = Pick<AddMeshOptions, "origin" | "normals" | "uvs">;
@@ -169,8 +169,19 @@ declare class SceneStore {
169
169
  /** Edits a mesh's triangles (one undo step). */
170
170
  edit(mesh: MeshHandle, ops: readonly EditOp[]): Promise<EditResult>;
171
171
  /** Repairs a mesh (one undo step). */
172
- repair(mesh: MeshHandle, op: RepairOp | readonly RepairOp[]): Promise<RepairReport | RepairReport[]>;
173
172
  repair(mesh: MeshHandle, request: AutoRepairRequest): Promise<AutoRepairReport>;
173
+ repair<const O extends RepairOp>(mesh: MeshHandle, op: O): Promise<RepairReportOf<O>>;
174
+ repair<const O extends readonly RepairOp[]>(mesh: MeshHandle, ops: O): Promise<{ -readonly [K in keyof O]: RepairReportOf<O[K]>; }>;
175
+ repair(mesh: MeshHandle, op: RepairOp | readonly RepairOp[]): Promise<RepairReport | RepairReport[]>;
176
+ /** Sculpts a mesh (`Scene.sculpt`), updating the snapshot when it settles. */
177
+ sculpt<const O extends SculptOp>(mesh: MeshHandle, op: O): Promise<SculptReportOf<O>>;
178
+ sculpt<const O extends readonly SculptOp[]>(mesh: MeshHandle, ops: O): Promise<{ -readonly [K in keyof O]: SculptReportOf<O[K]>; }>;
179
+ sculpt(mesh: MeshHandle, op: SculptOp | readonly SculptOp[]): Promise<SculptReport | SculptReport[]>;
180
+ /**
181
+ * Live triangle-used vertex ids of `mesh` inside the closed local-space
182
+ * sphere `(center, radius)`, in ascending order; see `Scene.verticesInSphere`.
183
+ */
184
+ verticesInSphere(mesh: MeshHandle, center: Readonly<Vec3>, radius: number): Promise<Uint32Array>;
174
185
  /** Undoes the latest step. */
175
186
  undo(): void;
176
187
  /** Redoes the latest undone step. */
@@ -1,7 +1,7 @@
1
1
  import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
2
- import { u as targetsOf } from "./views-B00kdV0R.js";
2
+ import { u as targetsOf } from "./views-BSy-Qeg8.js";
3
3
  import { i as sectionAspects } from "./protocol-Ci9LLiwO.js";
4
- import { a as watchStatusKeys, r as addFieldKeyed } from "./client-BrTp2eMp.js";
4
+ import { a as watchStatusKeys, r as addFieldKeyed } from "./client-DFgvktkT.js";
5
5
  import { a as combine, c as sameData, n as EMPTY_SNAPSHOT, o as frozenCopy, t as DEFAULT_DISPLAY } from "./snapshot-BkbGPspK.js";
6
6
  // src/store/host.ts
7
7
  /** Whether `scene` is a Worker scene (structurally: it reports key statuses). */
@@ -62,6 +62,8 @@ function localHost(scene) {
62
62
  setPlacement: (mesh, placement) => scene.setPlacement(mesh, placement),
63
63
  edit: (mesh, ops) => promised(() => scene.edit(mesh, ops)),
64
64
  repair: ((mesh, op) => promised(() => scene.repair(mesh, op))),
65
+ sculpt: ((mesh, op) => promised(() => scene.sculpt(mesh, op))),
66
+ verticesInSphere: (mesh, center, radius) => promised(() => scene.verticesInSphere(mesh, center, radius)),
65
67
  undo: () => {
66
68
  scene.undo();
67
69
  },
@@ -125,6 +127,8 @@ function workerHost(scene) {
125
127
  setPlacement: (mesh, placement) => scene.setPlacement(mesh, placement),
126
128
  edit: (mesh, ops) => scene.edit(mesh, ops),
127
129
  repair: ((mesh, op) => scene.repair(mesh, op)),
130
+ sculpt: ((mesh, op) => scene.sculpt(mesh, op)),
131
+ verticesInSphere: (mesh, center, radius) => scene.verticesInSphere(mesh, center, radius),
128
132
  undo: () => scene.undo(),
129
133
  redo: () => scene.redo(),
130
134
  canUndo: () => scene.canUndo,
@@ -564,6 +568,18 @@ var SceneStore = class {
564
568
  this.#alive();
565
569
  return this.#settled(this.#host.repair(mesh, op));
566
570
  }
571
+ sculpt(mesh, op) {
572
+ this.#alive();
573
+ return this.#settled(this.#host.sculpt(mesh, op));
574
+ }
575
+ /**
576
+ * Live triangle-used vertex ids of `mesh` inside the closed local-space
577
+ * sphere `(center, radius)`, in ascending order; see `Scene.verticesInSphere`.
578
+ */
579
+ verticesInSphere(mesh, center, radius) {
580
+ if (this.#disposed) return Promise.reject(invalid("the store is disposed"));
581
+ return this.#host.verticesInSphere(mesh, center, radius);
582
+ }
567
583
  /** Refreshes now (a synchronous host has applied the call) and once the promise settles. */
568
584
  #settled(p) {
569
585
  this.#update();
package/dist/store.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { tt as Rgba, ut as SignMode } from "./scene-like-CADk1vfb.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-BfC6kkf5.js";
1
+ import { At as CaptureRestReport, Fn as SculptOp, In as SculptReport, Ln as SculptReportOf, Mn as Rgba, Mt as ClayProfile, Nt as ClayReport, Zn as SmoothMethod, ar as TwistReport, en as FlattenMode, in as InflateMethod, ir as TwistMethod, jn as RepairReportOf, jt as CaptureStrokeReport, nn as GrabMethod, nr as Symmetry, or as VertexProtection, qn as SignMode, tn as FlattenReport, tr as SurfaceFilter, zt as CreaseReport } from "./scene-like-CR_Dpohm.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-8HWG90Jg.js";
3
3
  /** Options of {@link contactHeatmap}. Distances are in the meshes' units. */
4
4
  interface ContactHeatmapOptions {
5
5
  /** The penetration depth shown darkest (`deep`); deeper clamps to it. `> 0`. */
@@ -56,4 +56,4 @@ interface ContactHeatmapOptions {
56
56
  * `0 ≤ tolerance < min(depth, gap)` (`< depth` when `gap` is 0).
57
57
  */
58
58
  export declare function contactHeatmap(options: ContactHeatmapOptions): Omit<DistanceColoring, "distanceTo">;
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 };
59
+ export { type CaptureRestReport, type CaptureStrokeReport, type ClayProfile, type ClayReport, type ContactGroup, type ContactHeatmapOptions, type CreaseReport, type DisplayState, type DistanceColoring, EMPTY_SNAPSHOT, type FlattenMode, type FlattenReport, type GrabMethod, type InflateMethod, type MeshState, REMOVED_MESH_STATE, REMOVED_SECTION_STATE, type RepairReportOf, type SceneSnapshot, SceneStore, type SculptOp, type SculptReport, type SculptReportOf, type SectionParts, type SectionPatch, type SectionState, type SmoothMethod, type Status, type StoreAddMeshOptions, type SurfaceFilter, type Symmetry, type TwistMethod, type TwistReport, type VertexProtection, createSceneStore, meshState, sectionState };
package/dist/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as FastMeshError } from "./core-4OcWKu3r.js";
2
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-DIQmxF_s.js";
3
+ import { n as createSceneStore, t as SceneStore } from "./store-BAzHRRkt.js";
4
4
  // src/store/heatmap.ts
5
5
  /** The default colours: `#7f0000`, `#ff6b6b`, `#ffffff`, `#4caf50`, `#1e3a8a`. */
6
6
  const DEFAULT_COLORS = {
package/dist/three.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { kt as SectionHandle, t as SceneLike } from "./scene-like-CADk1vfb.js";
2
- import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-BsqIofgT.js";
1
+ import { n as SceneLike, yr as SectionHandle } from "./scene-like-CR_Dpohm.js";
2
+ import { i as bindMesh, n as BoundMesh, r as MeshBinding, t as BindMeshOptions } from "./mesh-BHTFxsXc.js";
3
3
  import * as THREE from "three";
4
4
  /**
5
5
  * What {@link attachTransformControls} needs of a TransformControls: its