fast-mesh-wasm 0.5.2 → 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.
- package/README.md +7 -4
- package/dist/{client-BIPPznBZ.js → client-BrTp2eMp.js} +25 -1
- package/dist/{client-Uo7hHvD8.d.ts → client-Ds09vLkN.d.ts} +13 -2
- package/dist/{engine-BS8i5U8J.js → engine-DjdY3GxK.js} +7 -3
- package/dist/io.d.ts +19 -4
- package/dist/io.js +64 -9
- package/dist/{mesh-CqAIuOxU.d.ts → mesh-BsqIofgT.d.ts} +5 -2
- package/dist/{mesh-hPWBQPaN.js → mesh-DIWD2F5-.js} +51 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +1 -1
- package/dist/{protocol-BHAI0xiA.d.ts → protocol-Cb23HelE.d.ts} +7 -1
- package/dist/r3f.d.ts +3 -3
- package/dist/r3f.js +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{scene-rsfM06St.js → scene-D0HNTwoo.js} +121 -15
- package/dist/{scene-like-CavrKbpQ.d.ts → scene-like-CADk1vfb.d.ts} +185 -31
- package/dist/{store-CZwml1K3.d.ts → store-BfC6kkf5.d.ts} +2 -2
- package/dist/{store-m9l0Al-m.js → store-DIQmxF_s.js} +2 -2
- package/dist/store.d.ts +2 -2
- package/dist/store.js +1 -1
- package/dist/three.d.ts +2 -2
- package/dist/three.js +1 -1
- package/dist/{views-CdOArjcB.js → views-B00kdV0R.js} +28 -1
- package/dist/wasm/fast_mesh_wasm.d.ts +21 -5
- package/dist/wasm/fast_mesh_wasm.js +37 -5
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +3 -1
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +21 -5
- package/dist/wasm-threads/fast_mesh_wasm.js +37 -5
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +3 -1
- package/dist/web.d.ts +2 -2
- package/dist/web.js +1 -1
- package/dist/worker-engine.d.ts +5 -3
- 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/README.md
CHANGED
|
@@ -305,7 +305,8 @@ const values = await scene.fetchFieldValues(gap); // `fieldValues` on Scene
|
|
|
305
305
|
- **The frame loop.** `commitFrame()` sends everything queued since the last frame as one batch and returns the change records of the results received meanwhile (already applied to the mirrors, so `views`, `matrix4`, `placement`, `section` and `sectionPlane` read the new state). Results arrive between frames; nothing changes in the mirrors outside a message.
|
|
306
306
|
- **Requests run in order.** A newer colouring, section plane/meshes/fill or drag move drops the older one if it has not started yet, so fast toggling settles on the last state without doing the steps in between. Edits, repairs, `setPlacement`, adds, removals and undo/redo are never dropped. Each `setPlacement` is an undo step: for pointer-rate updates use a drag. Long work runs in steps: the Worker yields every few milliseconds during a field build, a field update or a large add, so newer batches are received (and coalesced) meanwhile.
|
|
307
307
|
- **Drags are optimistic.** `scene.drag(mesh).move(pose)` moves the placement mirror at once, so the object follows the pointer; colours and sections catch up when the Worker's result arrives. In 9a a key's status covers only requests made under that key: a drag, `setPlacement` or edit puts its own key (`placement:<id>`, `edit:<id>`) into `"computing"`, not the `display:<id>` or `section:<id>:*` keys of the state that catches up after it. `end()` and `cancel()` return at once; `cancel()` restores the start pose and records nothing.
|
|
308
|
-
- **Wide-range colouring during a drag.** After each batch the Worker recomputes the fields the batch made due in small steps, and drops the recompute when a newer move, `setPlacement`, edit, repair, compact, undo/redo or removal of either mesh is already queued; other requests wait for it. A pose's colours are applied all at once, never partly.
|
|
308
|
+
- **Wide-range colouring during a drag.** After each batch the Worker recomputes the fields the batch made due in small steps, and drops the recompute when a newer move, `setPlacement`, edit, repair, compact, undo/redo or removal of either mesh is already queued; other requests wait for it. A pose's colours are applied all at once, never partly. A drag move does not drop a recompute under way: it finishes and is shown, and the newest pose follows. During a sustained drag the colours therefore update about once per recompute, each update exactly one pose, and when the drag ends (`end()`) the last pose's colours arrive within about one recompute (measured before this default changed: one at 1M, but about 1.5 at 10M when most of the mesh is in range): the end drops a recompute kept for an older pose. A pointer that only pauses, without ending the drag, may wait up to two recomputes. Edits, undo/redo, removals and cancels always drop a stale recompute. `fetchFieldValues()` and `fieldStatus()` first bring every due field up to date in one go, which cannot be dropped, so do not poll them during a drag. To keep a field too wide for this live, see `setFieldInteraction` below. On two touching 1M-triangle meshes with `maxDistance` 8, a recompute takes from about 0.07 s to 0.7 s depending on how much of the mesh is in range, and about ten times that at 10M; the Worker is never blocked for long, since a recompute runs in steps: about 12 ms at a time at 1M, and 14 to 18 ms for field builds and edits at 10M (see [docs/benchmarks.md](docs/benchmarks.md)). These are single-threaded figures; on a cross-origin isolated page the threaded engine makes a recompute 1.4 to 4.5 times faster (see [Multithreading (COOP/COEP)](#multithreading-coopcoep)). A contact range (a small `maxDistance`) keeps up with the pointer.
|
|
309
|
+
- **Interactions.** `scene.setFieldInteraction(points)` starts a gesture and `setFieldInteraction(null)` ends it (on `Scene` too). During one, a field with more than `points` finite values updates about `points` vertices closest to the contact per update, those around an edit and a run of others; the rest keep their values and colours, out of date by up to how far the meshes moved. **During an interaction `fetchFieldValues()`, `fieldValues()`, `fieldNearest()` and the colours can hold those stale values, and `fieldStatus()` still says `current: true`:** bringing a field up to date means only the tier's update then. Read values you rely on after ending it: the end recomputes every vertex it left out of date, in steps on the Worker, and the values and colours are then those of an exact update. A gesture that changed nothing costs nothing.
|
|
309
310
|
- **Queries and anything that returns data** (`raycast`, `closestPoint`, `meshDistance`, `intersects`, `findContacts`, `analyze`, `measure`, `register`, `edit`, `repair`, `fetchFieldValues`, `fieldStatus`, `sectionGap`) return promises. Once a frame loop runs they go out with the next `commitFrame()` (or after 100 ms if no frame comes); before the first `commitFrame()` they are sent on a microtask. For latency-critical picking, keep a light picking copy in a main-thread `Scene`.
|
|
310
311
|
- **Errors.** A failed state change shows on its key (`status(key).error`, a `FastMeshError` with the same `code` as on `Scene`); a failed promise rejects with it. After a trap inside the Worker every call fails with `INSTANCE_POISONED`, also when it happens on one of the multithreaded engine's pool threads (a panic or a trap in work split across threads); a few kinds of pool-thread failure still cannot be detected (see [Multithreading (COOP/COEP)](#multithreading-coopcoep)). `await scene.restart()` starts a new Worker and replays the scene from the main thread's mirrors: meshes (compacted: slot ids change, handles do not), placements, fields, colourings and sections. History is cleared, and edits or queries that had not finished fail and must be re-issued.
|
|
311
312
|
- **Not in the Worker scene:** user-opened steps (`beginStep`/`endStep`/`cancelStep`), Lazy and Manual modes (it is always eager) and `takeChanges` (use `onChanges` or the return value of `commitFrame()`). `terminate()` stops the Worker.
|
|
@@ -631,16 +632,18 @@ Files are `.stl` (binary or ASCII), `.obj`, `.ply` (ASCII or binary little-endia
|
|
|
631
632
|
| Exit code | Meaning |
|
|
632
633
|
| --- | --- |
|
|
633
634
|
| `0` | Success. |
|
|
634
|
-
| `1` | The operation or a file failed: malformed or truncated input, I/O, inputs a boolean refuses, an empty result. |
|
|
635
|
+
| `1` | The operation or a file failed: malformed or truncated input, I/O, inputs a boolean refuses, an empty result, an invalid boolean result. |
|
|
635
636
|
| `2` | Usage error: bad arguments, an unsupported extension, or an output that names an input without `--force`. |
|
|
636
637
|
|
|
637
638
|
Reports go to stdout and diagnostics to stderr. With `--format json`, stdout holds one JSON object on success and nothing on failure, so a script can check the exit code and then parse. A hole `repair` leaves open is not a failure: it exits `0`, counts the hole in the report (`skipped`, `failed`) and warns on stderr.
|
|
638
639
|
|
|
639
640
|
The output appears whole or not at all: it is written beside the target and renamed over it when complete, so a failed run leaves any existing file untouched.
|
|
640
641
|
|
|
641
|
-
`boolean` refuses what the engine cannot resolve with `invalid input: boolean intersection too complex` (exit `1`); at present that includes many overlaps of curved surfaces, so check it on your data.
|
|
642
|
+
`boolean` refuses what the engine cannot resolve with `invalid input: boolean intersection too complex` (exit `1`); at present that includes many overlaps of curved surfaces, so check it on your data.
|
|
642
643
|
|
|
643
|
-
|
|
644
|
+
`boolean` also checks its result before writing. One that is open, non-manifold or has orientation conflicts fails with `the engine produced an invalid result` and its defect counts (exit `1`), leaving any existing output untouched, even with `--force`. Today's engine produces such results for some inputs, including overlapping cubes depending on how their faces are triangulated ([#165](https://github.com/YoonDongGeun/fast-mesh-wasm/issues/165)). The check is structural: it does not compare the result against the shape it should have.
|
|
645
|
+
|
|
646
|
+
Limits: a `.glb` becomes one mesh, with its node placements baked and its primitives merged. Draco and meshopt compression, GPU instancing, sparse accessors and buffers outside the GLB body are refused with an error, as is a file whose nodes reuse their meshes for more than 1,048,576 node-primitive pairs (or file size / 16, if larger). JSON `.gltf`, big-endian PLY and UVs are not supported. Other attributes (normals, colors, materials) are not carried across a conversion.
|
|
644
647
|
|
|
645
648
|
## Supported environments
|
|
646
649
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { c as SectionHandle, d as checkRegisterOptions, i as copyRule, l as rotationMatrix, o as FieldHandle, r as checkInteractionPoints, s as MeshHandle, t as ViewGuard, u as targetsOf } from "./views-B00kdV0R.js";
|
|
1
2
|
import { o as reportListenerError, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
-
import { a as FieldHandle, c as rotationMatrix, l as targetsOf, o as MeshHandle, r as copyRule, s as SectionHandle, t as ViewGuard } from "./views-CdOArjcB.js";
|
|
3
3
|
import { a as supersedes, n as isLastWins, r as keyOf } from "./protocol-Ci9LLiwO.js";
|
|
4
4
|
// src/worker/client.ts
|
|
5
5
|
/**
|
|
@@ -1134,6 +1134,11 @@ var WorkerScene = class WorkerScene {
|
|
|
1134
1134
|
register(moving, fixed, options = {}) {
|
|
1135
1135
|
const m = this.#live(moving);
|
|
1136
1136
|
const f = this.#live(fixed);
|
|
1137
|
+
try {
|
|
1138
|
+
checkRegisterOptions(m === f, options);
|
|
1139
|
+
} catch (e) {
|
|
1140
|
+
return Promise.reject(e);
|
|
1141
|
+
}
|
|
1137
1142
|
if (this.#drag?.mesh === m || this.#drag?.mesh === f) this.#drag.end();
|
|
1138
1143
|
const payload = copyInput(options, "options");
|
|
1139
1144
|
return this.#ask((rev, qid) => ({
|
|
@@ -1189,6 +1194,13 @@ var WorkerScene = class WorkerScene {
|
|
|
1189
1194
|
* getter returns the current mirror; a mirror is replaced when the slot
|
|
1190
1195
|
* count changes or a buffer turns on or off, so get views right before use.
|
|
1191
1196
|
*/
|
|
1197
|
+
/**
|
|
1198
|
+
* The mesh's origin. `views(mesh).positions()` are relative to it, while
|
|
1199
|
+
* `edit`'s `setPositions` and `addVertices` take positions with it added.
|
|
1200
|
+
*/
|
|
1201
|
+
origin(mesh) {
|
|
1202
|
+
return [...this.#live(mesh).origin];
|
|
1203
|
+
}
|
|
1192
1204
|
views(mesh) {
|
|
1193
1205
|
const st = this.#mirrored(mesh);
|
|
1194
1206
|
const guard = this.#guard;
|
|
@@ -1591,6 +1603,18 @@ var WorkerScene = class WorkerScene {
|
|
|
1591
1603
|
st.plane = normalised(p);
|
|
1592
1604
|
});
|
|
1593
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Starts (`points`) or ends (`null`) an interaction; see
|
|
1608
|
+
* {@link Scene.setFieldInteraction}. A recompute under way when it changes
|
|
1609
|
+
* is dropped and starts over under the new setting.
|
|
1610
|
+
*/
|
|
1611
|
+
setFieldInteraction(points) {
|
|
1612
|
+
this.#push({
|
|
1613
|
+
kind: "fieldInteraction",
|
|
1614
|
+
rev: ++this.#rev,
|
|
1615
|
+
points: checkInteractionPoints(points)
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1594
1618
|
/** Changes the meshes a section cuts. Last wins per frame. */
|
|
1595
1619
|
setSectionMeshes(section, meshes) {
|
|
1596
1620
|
const list = this.#meshList(meshes);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as Vec3, C as EditOp, Dt as FieldHandle, E as FieldStatus, Et as SceneMeshViews, F as MeasureResult, Ft as PlacementInput, H as RayHit, I as MeshChange, K as RegisterOptions, Lt as Positions64, M as JoinOptions, N as JoinReport, Ot as MeshHandle, Pt as Placement, Q as RepairOp, R as MeshDistance, S as DragSession, T as EditResult, U as RaycastOptions, a as AutoRepairReport, at as SectionDesc, b as DistanceFieldDesc, ct as SectionResult, d as ClosestHit, et as RepairReportOf, f as ClosestPointOptions, h as Contact, i as AnalyzeOptions, jt as Indices, k as FindContactsOptions, kt as SectionHandle, n as AddMeshOptions, o as AutoRepairRequest, ot as SectionGap, p as ColorRule, q as RegisterResult, r as Analysis, st as SectionPlane, t as SceneLike } from "./scene-like-CADk1vfb.js";
|
|
2
2
|
import { t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
3
|
-
import "./protocol-
|
|
3
|
+
import "./protocol-Cb23HelE.js";
|
|
4
4
|
/** What {@link WorkerScene} needs of a Worker; a browser `Worker` fits. */
|
|
5
5
|
interface WorkerLike {
|
|
6
6
|
postMessage(msg: unknown, transfer?: Transferable[]): void;
|
|
@@ -149,6 +149,11 @@ declare class WorkerScene implements SceneLike {
|
|
|
149
149
|
* getter returns the current mirror; a mirror is replaced when the slot
|
|
150
150
|
* count changes or a buffer turns on or off, so get views right before use.
|
|
151
151
|
*/
|
|
152
|
+
/**
|
|
153
|
+
* The mesh's origin. `views(mesh).positions()` are relative to it, while
|
|
154
|
+
* `edit`'s `setPositions` and `addVertices` take positions with it added.
|
|
155
|
+
*/
|
|
156
|
+
origin(mesh: MeshHandle): Vec3;
|
|
152
157
|
views(mesh: MeshHandle): SceneMeshViews;
|
|
153
158
|
/**
|
|
154
159
|
* The rule the mirrored colours and values are made by (a frozen copy of
|
|
@@ -219,6 +224,12 @@ declare class WorkerScene implements SceneLike {
|
|
|
219
224
|
addSection(desc: SectionDesc): SectionHandle;
|
|
220
225
|
/** Moves a section's plane; `sectionPlane()` returns it at once. Last wins per frame. */
|
|
221
226
|
setSectionPlane(section: SectionHandle, plane: SectionPlane): void;
|
|
227
|
+
/**
|
|
228
|
+
* Starts (`points`) or ends (`null`) an interaction; see
|
|
229
|
+
* {@link Scene.setFieldInteraction}. A recompute under way when it changes
|
|
230
|
+
* is dropped and starts over under the new setting.
|
|
231
|
+
*/
|
|
232
|
+
setFieldInteraction(points: number | null): void;
|
|
222
233
|
/** Changes the meshes a section cuts. Last wins per frame. */
|
|
223
234
|
setSectionMeshes(section: SectionHandle, meshes: readonly MeshHandle[]): void;
|
|
224
235
|
/** Turns a section's fill on or off. Last wins per frame. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as setMemory, t as FastMeshError } from "./core-4OcWKu3r.js";
|
|
2
|
-
import { i as useWasmScene, n as fieldSteps, r as meshAdds, t as Scene } from "./scene-
|
|
2
|
+
import { i as useWasmScene, n as fieldSteps, r as meshAdds, t as Scene } from "./scene-D0HNTwoo.js";
|
|
3
3
|
import { a as supersedes, n as isLastWins, r as keyOf, t as isInit } from "./protocol-Ci9LLiwO.js";
|
|
4
4
|
/**
|
|
5
5
|
* A module importing a shared memory `e.m` (1 page, at most 2), exporting
|
|
@@ -327,7 +327,7 @@ async function startEngine(init, loaders, isolated = globalThis.crossOriginIsola
|
|
|
327
327
|
/** The default {@link EngineOptions.yieldMs}. */
|
|
328
328
|
const YIELD_MS = 4;
|
|
329
329
|
/** The default {@link EngineOptions.staleGuardMs}. */
|
|
330
|
-
const STALE_GUARD_MS =
|
|
330
|
+
const STALE_GUARD_MS = 0;
|
|
331
331
|
/** The default {@link EngineOptions.stepPoints}. */
|
|
332
332
|
const STEP_POINTS = 4096;
|
|
333
333
|
/**
|
|
@@ -643,7 +643,7 @@ var Engine = class {
|
|
|
643
643
|
this.#yieldMs = options.yieldMs ?? 4;
|
|
644
644
|
const points = Math.floor(options.stepPoints ?? 4096);
|
|
645
645
|
this.#stepPoints = points >= 1 ? Math.min(points, ALL_POINTS) : 1;
|
|
646
|
-
this.#staleGuardMs = options.staleGuardMs ??
|
|
646
|
+
this.#staleGuardMs = options.staleGuardMs ?? 0;
|
|
647
647
|
const bg = options.backgroundAddTriangles;
|
|
648
648
|
this.#backgroundAdd = bg === void 0 || Number.isNaN(bg) ? BACKGROUND_ADD_TRIANGLES : Math.max(0, bg);
|
|
649
649
|
const work = Math.floor(options.addStepWork ?? 1e5);
|
|
@@ -1203,6 +1203,7 @@ var Engine = class {
|
|
|
1203
1203
|
#makesStale(req, meshes, moves) {
|
|
1204
1204
|
switch (req.kind) {
|
|
1205
1205
|
case "drag": return meshes.has(req.id) && (req.phase === "cancel" || moves && (req.phase === "move" || req.phase === "end" && req.rotation !== void 0));
|
|
1206
|
+
case "fieldInteraction": return true;
|
|
1206
1207
|
case "setPlacement":
|
|
1207
1208
|
case "edit":
|
|
1208
1209
|
case "repair":
|
|
@@ -1591,6 +1592,9 @@ var Engine = class {
|
|
|
1591
1592
|
});
|
|
1592
1593
|
return;
|
|
1593
1594
|
}
|
|
1595
|
+
case "fieldInteraction":
|
|
1596
|
+
s.setFieldInteraction(req.points);
|
|
1597
|
+
return;
|
|
1594
1598
|
case "compact":
|
|
1595
1599
|
s.compact(this.#mesh(req.id));
|
|
1596
1600
|
return;
|
package/dist/io.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ot as MeshHandle, t as SceneLike } from "./scene-like-CADk1vfb.js";
|
|
2
2
|
/** Shared by every exporter: whether local render coordinates are mapped to the world. */
|
|
3
3
|
export interface ExportOptions {
|
|
4
4
|
/**
|
|
@@ -116,8 +116,9 @@ export interface DracoQuantizationBits {
|
|
|
116
116
|
/** TEX_COORD bits, over the UVs' range. Defaults to `16`. */
|
|
117
117
|
uv?: number;
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
119
|
+
* The same as {@link DracoQuantizationBits.uv}, which wins when both are set.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Use `uv`.
|
|
121
122
|
*/
|
|
122
123
|
texCoord?: number;
|
|
123
124
|
}
|
|
@@ -189,7 +190,8 @@ export declare function encodeDraco(positions: ArrayLike<number>, indices: Array
|
|
|
189
190
|
*
|
|
190
191
|
* Only uncompressed buffers are read. `KHR_draco_mesh_compression`
|
|
191
192
|
* primitives throw (decode them with {@link importGLTFAsync}), as do sparse
|
|
192
|
-
* accessors
|
|
193
|
+
* accessors, except a sparse `TEXCOORD_0`, which is skipped like any other
|
|
194
|
+
* unsupported UVs: see {@link ImportedMesh.uvsSkipped}. External (non-embedded) `.bin` buffers load through
|
|
193
195
|
* {@link importGLTFAsync}'s `resolveBuffer`. Animations, skins, materials
|
|
194
196
|
* beyond per-vertex colors and `TEXCOORD_1` and up are skipped: the documented
|
|
195
197
|
* subset.
|
|
@@ -208,8 +210,21 @@ export interface ImportedMesh {
|
|
|
208
210
|
/**
|
|
209
211
|
* 2 floats per vertex from `TEXCOORD_0` (`scene.addMesh`'s `uvs`), or `null`
|
|
210
212
|
* without UVs. In glTF's convention: `v` points down from the image's top.
|
|
213
|
+
*
|
|
214
|
+
* Read as glTF defines it: float as stored, and normalized `u8`/`u16` mapped
|
|
215
|
+
* to `[0, 1]`. An asset declaring `KHR_mesh_quantization` may also use `i8`
|
|
216
|
+
* and `i16`, normalized to `[-1, 1]`, and any of the integer types without
|
|
217
|
+
* `normalized`, whose values stay as stored. Such values usually rely on a
|
|
218
|
+
* `KHR_texture_transform` on the material to scale them, which is not read.
|
|
211
219
|
*/
|
|
212
220
|
uvs: Float32Array | null;
|
|
221
|
+
/**
|
|
222
|
+
* Why a present `TEXCOORD_0` was left out, so `uvs` is `null` while the
|
|
223
|
+
* geometry still imports: a sparse accessor, or a component type glTF does
|
|
224
|
+
* not allow for it. Absent when nothing was skipped. Malformed UVs (a wrong
|
|
225
|
+
* count or accessor type, non-finite values) throw instead.
|
|
226
|
+
*/
|
|
227
|
+
uvsSkipped?: string;
|
|
213
228
|
}
|
|
214
229
|
/**
|
|
215
230
|
* Reads a glTF 2.0 asset: a binary `.glb`, or a `.gltf` JSON whose buffers
|
package/dist/io.js
CHANGED
|
@@ -613,14 +613,13 @@ async function exportGLTFDraco(scene, mesh, options) {
|
|
|
613
613
|
/** Validates the quantization/level/order options before the module loads. */
|
|
614
614
|
function encodeSettings(options) {
|
|
615
615
|
const bits = options?.quantizationBits;
|
|
616
|
-
checkedQuantizationBits(bits?.texCoord, "texCoord", 12);
|
|
617
616
|
const level = options?.compressionLevel ?? 5;
|
|
618
617
|
if (!Number.isInteger(level) || level < 0 || level > 10) throw new Error(`Draco: the compression level must be an integer from 0 to 10 (got ${options?.compressionLevel})`);
|
|
619
618
|
return {
|
|
620
619
|
positionBits: checkedQuantizationBits(bits?.position, "position", 14),
|
|
621
620
|
normalBits: checkedQuantizationBits(bits?.normal, "normal", 10),
|
|
622
621
|
colorBits: checkedQuantizationBits(bits?.color, "color", 8),
|
|
623
|
-
uvBits: checkedQuantizationBits(bits?.uv, "uv", 16),
|
|
622
|
+
uvBits: checkedQuantizationBits(bits?.uv, "uv", checkedQuantizationBits(bits?.texCoord, "texCoord", 16)),
|
|
624
623
|
level,
|
|
625
624
|
preserveFaceOrder: options?.preserveFaceOrder === true
|
|
626
625
|
};
|
|
@@ -1042,7 +1041,7 @@ async function readPrimitiveDraco(doc, buffers, spec, usedNames, decoderOfOption
|
|
|
1042
1041
|
const decoded = decodeDracoMesh(module, buffer.subarray(base, end), what, positionId, uvAttr === void 0 ? null : uvAttr);
|
|
1043
1042
|
const { positions, indices } = decoded;
|
|
1044
1043
|
const plainUvs = spec.primitive.attributes["TEXCOORD_0"];
|
|
1045
|
-
const uvs = decoded.uvs
|
|
1044
|
+
const uvs = decoded.uvs !== null ? { uvs: decoded.uvs } : typeof plainUvs === "number" && (doc.accessors?.[plainUvs]?.bufferView !== void 0 || doc.accessors?.[plainUvs]?.sparse !== void 0) ? readUvsUnlessSkipped(doc, buffers, plainUvs, positions.length / 3, name) : NO_UVS;
|
|
1046
1045
|
const world = spec.world;
|
|
1047
1046
|
for (let i = 0; i < positions.length; i += 3) {
|
|
1048
1047
|
const x = positions[i];
|
|
@@ -1058,7 +1057,7 @@ async function readPrimitiveDraco(doc, buffers, spec, usedNames, decoderOfOption
|
|
|
1058
1057
|
indices,
|
|
1059
1058
|
placement: world.slice(),
|
|
1060
1059
|
colors: null,
|
|
1061
|
-
uvs
|
|
1060
|
+
...uvs
|
|
1062
1061
|
};
|
|
1063
1062
|
}
|
|
1064
1063
|
/** The asset JSON, checked to be an object before the importers read it. */
|
|
@@ -1356,14 +1355,14 @@ function readPrimitive(doc, buffers, node, mesh, primitive, world, usedNames) {
|
|
|
1356
1355
|
positions[i + 2] = world[2] * x + world[6] * y + world[10] * z + world[14];
|
|
1357
1356
|
}
|
|
1358
1357
|
const colors = typeof primitive.attributes["COLOR_0"] === "number" ? readColors(doc, buffers, primitive.attributes["COLOR_0"], positions.length / 3, name) : null;
|
|
1359
|
-
const uvs = typeof primitive.attributes["TEXCOORD_0"] === "number" ?
|
|
1358
|
+
const uvs = typeof primitive.attributes["TEXCOORD_0"] === "number" ? readUvsUnlessSkipped(doc, buffers, primitive.attributes["TEXCOORD_0"], positions.length / 3, name) : NO_UVS;
|
|
1360
1359
|
return {
|
|
1361
1360
|
name,
|
|
1362
1361
|
positions,
|
|
1363
1362
|
indices,
|
|
1364
1363
|
placement: world.slice(),
|
|
1365
1364
|
colors,
|
|
1366
|
-
uvs
|
|
1365
|
+
...uvs
|
|
1367
1366
|
};
|
|
1368
1367
|
}
|
|
1369
1368
|
/** The deduplicated mesh name: the node name, else the mesh name, else `"mesh"`. */
|
|
@@ -1436,20 +1435,76 @@ function accessorCount(doc, primitive, name) {
|
|
|
1436
1435
|
if (accessor === void 0) throw new Error(`glTF: "${name}" has a primitive without POSITION`);
|
|
1437
1436
|
return accessor.count;
|
|
1438
1437
|
}
|
|
1438
|
+
/** The `uvs` and `uvsSkipped` fields of a primitive without `TEXCOORD_0`. */
|
|
1439
|
+
const NO_UVS = { uvs: null };
|
|
1440
|
+
/**
|
|
1441
|
+
* Why glTF's `TEXCOORD_0` accessor `index` cannot be read, or `null` when it
|
|
1442
|
+
* can. Core glTF 2.0 allows float and normalized `u8`/`u16`;
|
|
1443
|
+
* `KHR_mesh_quantization` adds `i8`/`i16` and the integer types without
|
|
1444
|
+
* `normalized`. A missing accessor, or one of the wrong shape, is malformed
|
|
1445
|
+
* rather than unsupported: {@link readUvs} throws on it.
|
|
1446
|
+
*/
|
|
1447
|
+
function uvSkipReason(doc, index) {
|
|
1448
|
+
const accessor = doc.accessors?.[index];
|
|
1449
|
+
if (accessor === void 0) return null;
|
|
1450
|
+
if (accessor.sparse !== void 0) return "TEXCOORD_0 is a sparse accessor, which is not supported";
|
|
1451
|
+
const { componentType: type, normalized } = accessor;
|
|
1452
|
+
if (type === 5126 || (type === 5121 || type === 5123) && normalized === true) return null;
|
|
1453
|
+
if (type !== 5120 && type !== 5121 && type !== 5122 && type !== 5123) return `TEXCOORD_0 has component type ${type}, which glTF does not allow for it`;
|
|
1454
|
+
if (doc.extensionsUsed?.includes(QUANTIZATION) || doc.extensionsRequired?.includes(QUANTIZATION)) return null;
|
|
1455
|
+
return `TEXCOORD_0 is ${`${normalized === true ? "normalized" : "non-normalized"} ${COMPONENT_NAME[type]}`}, which glTF allows only with ${QUANTIZATION}`;
|
|
1456
|
+
}
|
|
1457
|
+
const QUANTIZATION = "KHR_mesh_quantization";
|
|
1458
|
+
const COMPONENT_NAME = {
|
|
1459
|
+
5120: "i8",
|
|
1460
|
+
5121: "u8",
|
|
1461
|
+
5122: "i16",
|
|
1462
|
+
5123: "u16"
|
|
1463
|
+
};
|
|
1464
|
+
/** {@link readUvs}, or no UVs and the reason when the accessor is unsupported. */
|
|
1465
|
+
function readUvsUnlessSkipped(doc, buffers, index, vertices, name) {
|
|
1466
|
+
const uvsSkipped = uvSkipReason(doc, index);
|
|
1467
|
+
return uvsSkipped === null ? { uvs: readUvs(doc, buffers, index, vertices, name) } : {
|
|
1468
|
+
uvs: null,
|
|
1469
|
+
uvsSkipped
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1439
1472
|
function readUvs(doc, buffers, index, vertices, name) {
|
|
1440
1473
|
const data = accessorData(doc, buffers, index, "TEXCOORD_0");
|
|
1441
|
-
if (data.components !== 2
|
|
1474
|
+
if (data.components !== 2) throw new Error(`glTF: "${name}" has TEXCOORD_0 with ${data.components} ${data.size}-byte components (VEC2 expected)`);
|
|
1442
1475
|
if (data.count !== vertices) throw new Error(`glTF: "${name}" has ${data.count} UVs for ${vertices} vertices`);
|
|
1443
1476
|
const out = new Float32Array(2 * vertices);
|
|
1444
1477
|
if (data.buffer.length === 0) return out;
|
|
1478
|
+
const normalized = doc.accessors?.[index]?.normalized === true;
|
|
1445
1479
|
for (let i = 0; i < vertices; i++) for (let c = 0; c < 2; c++) {
|
|
1446
|
-
const
|
|
1447
|
-
const v = data.componentType === 5126 ? data.view.getFloat32(at, true) : data.componentType === 5121 ? data.view.getUint8(at) / 255 : data.view.getUint16(at, true) / 65535;
|
|
1480
|
+
const v = uvComponent(data, data.base + i * data.stride + c * data.size, normalized);
|
|
1448
1481
|
if (!Number.isFinite(v)) throw new Error(`glTF: "${name}" has a non-finite UV at vertex ${i}`);
|
|
1449
1482
|
out[2 * i + c] = v;
|
|
1450
1483
|
}
|
|
1451
1484
|
return out;
|
|
1452
1485
|
}
|
|
1486
|
+
/** One UV component at byte `at`, by glTF's accessor equations: float as stored, integers as stored or normalized. */
|
|
1487
|
+
function uvComponent(data, at, normalized) {
|
|
1488
|
+
switch (data.componentType) {
|
|
1489
|
+
case 5120: {
|
|
1490
|
+
const c = data.view.getInt8(at);
|
|
1491
|
+
return normalized ? Math.max(c / 127, -1) : c;
|
|
1492
|
+
}
|
|
1493
|
+
case 5121: {
|
|
1494
|
+
const c = data.view.getUint8(at);
|
|
1495
|
+
return normalized ? c / 255 : c;
|
|
1496
|
+
}
|
|
1497
|
+
case 5122: {
|
|
1498
|
+
const c = data.view.getInt16(at, true);
|
|
1499
|
+
return normalized ? Math.max(c / 32767, -1) : c;
|
|
1500
|
+
}
|
|
1501
|
+
case 5123: {
|
|
1502
|
+
const c = data.view.getUint16(at, true);
|
|
1503
|
+
return normalized ? c / 65535 : c;
|
|
1504
|
+
}
|
|
1505
|
+
default: return data.view.getFloat32(at, true);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1453
1508
|
function readColors(doc, buffers, index, vertices, name) {
|
|
1454
1509
|
const data = accessorData(doc, buffers, index, "COLOR_0");
|
|
1455
1510
|
if (data.components !== 3 && data.components !== 4 || data.componentType !== 5121 && data.componentType !== 5126) throw new Error(`glTF: "${name}" has COLOR_0 with ${data.components} ${data.size}-byte components (u8 or float VEC3/VEC4)`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ot as MeshHandle, t as SceneLike } from "./scene-like-CADk1vfb.js";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
/** Options of {@link bindMesh}. */
|
|
4
4
|
interface BindMeshOptions {
|
|
@@ -122,7 +122,10 @@ type MeshBinding = Pick<BoundMesh, "mesh" | "object">;
|
|
|
122
122
|
* Dead vertex slots keep stale positions, so the geometry's bounding box and
|
|
123
123
|
* sphere are computed from the vertices of live triangles only (a removed
|
|
124
124
|
* triangle reads `0, 0, 0` in the index). They are recomputed when positions
|
|
125
|
-
* or indices change, never on placement-only frames.
|
|
125
|
+
* or indices change, never on placement-only frames. On a mesh of 65,536 vertex
|
|
126
|
+
* slots or more, a change that only moves up to an eighth of them grows them
|
|
127
|
+
* instead, so they can be larger than the mesh until 250 ms after the last such
|
|
128
|
+
* change.
|
|
126
129
|
*
|
|
127
130
|
* With `shading: "fragment"` the colour attribute is replaced by the
|
|
128
131
|
* colouring's values (`fmValue`), coloured per fragment by a shader chunk the
|
|
@@ -61,6 +61,14 @@ const BUFFERS = {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
|
+
* From this many vertex slots, a change that moves few of them grows the bounds
|
|
65
|
+
* over what moved and leaves the exact ones for when the edits pause: walking
|
|
66
|
+
* every slot on every frame of a sculpt stroke was its largest single cost.
|
|
67
|
+
*/
|
|
68
|
+
const GROW_BOUNDS_MIN_SLOTS = 65536;
|
|
69
|
+
/** The bounds are made exact again this long after the last change that grew them. */
|
|
70
|
+
const SETTLE_BOUNDS_MS = 250;
|
|
71
|
+
/**
|
|
64
72
|
* Binds a scene mesh to a new THREE.Mesh and keeps it in sync on every
|
|
65
73
|
* {@link SceneLike.commitFrame}: dirty ranges are copied into the attributes'
|
|
66
74
|
* mirrors and marked with `addUpdateRange`, attributes are recreated when the
|
|
@@ -71,7 +79,10 @@ const BUFFERS = {
|
|
|
71
79
|
* Dead vertex slots keep stale positions, so the geometry's bounding box and
|
|
72
80
|
* sphere are computed from the vertices of live triangles only (a removed
|
|
73
81
|
* triangle reads `0, 0, 0` in the index). They are recomputed when positions
|
|
74
|
-
* or indices change, never on placement-only frames.
|
|
82
|
+
* or indices change, never on placement-only frames. On a mesh of 65,536 vertex
|
|
83
|
+
* slots or more, a change that only moves up to an eighth of them grows them
|
|
84
|
+
* instead, so they can be larger than the mesh until 250 ms after the last such
|
|
85
|
+
* change.
|
|
75
86
|
*
|
|
76
87
|
* With `shading: "fragment"` the colour attribute is replaced by the
|
|
77
88
|
* colouring's values (`fmValue`), coloured per fragment by a shader chunk the
|
|
@@ -238,6 +249,40 @@ function bindMesh(scene, mesh, options = {}) {
|
|
|
238
249
|
for (let k = 0; k < t.length; k += 3) if (live(k)) for (let c = 0; c < 3; c++) r2 = Math.max(r2, sphere.center.distanceToSquared(point.fromArray(p, 3 * t[k + c])));
|
|
239
250
|
sphere.radius = Math.sqrt(r2);
|
|
240
251
|
};
|
|
252
|
+
let settleBounds;
|
|
253
|
+
/**
|
|
254
|
+
* Grows the bounds over the positions `change` moved, when that is all it did
|
|
255
|
+
* and it moved few of a large mesh's slots; they stay conservative until the
|
|
256
|
+
* edits pause. Returns whether it did: if not, the caller computes them.
|
|
257
|
+
*/
|
|
258
|
+
const growBounds = (change) => {
|
|
259
|
+
const position = attributeOf("positions");
|
|
260
|
+
const box = geometry.boundingBox;
|
|
261
|
+
const sphere = geometry.boundingSphere;
|
|
262
|
+
const moved = change.positions;
|
|
263
|
+
if (position === void 0 || box === null || sphere === null || box.isEmpty() || moved === "all" || change.capacityChanged || change.indices === "all" || change.indices.length > 0 || vertexSlots < GROW_BOUNDS_MIN_SLOTS) return false;
|
|
264
|
+
let count = 0;
|
|
265
|
+
for (const [, n] of moved) count += n;
|
|
266
|
+
if (count * 8 > vertexSlots) return false;
|
|
267
|
+
const p = position.array;
|
|
268
|
+
for (const [start, n] of moved) for (let k = 3 * start; k < 3 * (start + n); k += 3) {
|
|
269
|
+
box.min.x = Math.min(box.min.x, p[k]);
|
|
270
|
+
box.min.y = Math.min(box.min.y, p[k + 1]);
|
|
271
|
+
box.min.z = Math.min(box.min.z, p[k + 2]);
|
|
272
|
+
box.max.x = Math.max(box.max.x, p[k]);
|
|
273
|
+
box.max.y = Math.max(box.max.y, p[k + 1]);
|
|
274
|
+
box.max.z = Math.max(box.max.z, p[k + 2]);
|
|
275
|
+
}
|
|
276
|
+
box.getCenter(sphere.center);
|
|
277
|
+
sphere.radius = box.min.distanceTo(box.max) / 2;
|
|
278
|
+
clearTimeout(settleBounds);
|
|
279
|
+
settleBounds = setTimeout(() => {
|
|
280
|
+
try {
|
|
281
|
+
computeBounds();
|
|
282
|
+
} catch {}
|
|
283
|
+
}, SETTLE_BOUNDS_MS);
|
|
284
|
+
return true;
|
|
285
|
+
};
|
|
241
286
|
const updateMatrix = () => {
|
|
242
287
|
object.matrix.fromArray(scene.matrix4(mesh));
|
|
243
288
|
object.matrixWorldNeedsUpdate = true;
|
|
@@ -311,6 +356,7 @@ function bindMesh(scene, mesh, options = {}) {
|
|
|
311
356
|
const detach = () => {
|
|
312
357
|
unsubscribe?.();
|
|
313
358
|
unsubscribe = void 0;
|
|
359
|
+
clearTimeout(settleBounds);
|
|
314
360
|
};
|
|
315
361
|
unsubscribe = scene.onChanges((changes) => {
|
|
316
362
|
checkUntransformedParent(object);
|
|
@@ -320,7 +366,10 @@ function bindMesh(scene, mesh, options = {}) {
|
|
|
320
366
|
detach();
|
|
321
367
|
return;
|
|
322
368
|
}
|
|
323
|
-
if (apply(c)
|
|
369
|
+
if (apply(c) && !growBounds(c)) {
|
|
370
|
+
clearTimeout(settleBounds);
|
|
371
|
+
computeBounds();
|
|
372
|
+
}
|
|
324
373
|
if (c.placementChanged) updateMatrix();
|
|
325
374
|
}
|
|
326
375
|
});
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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
|
* Resolves immediately: in Node.js and Bun the module is ready as soon as it is imported.
|
|
@@ -6,4 +6,4 @@ import { n as FastMeshErrorCode, t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
|
6
6
|
* the argument is ignored.
|
|
7
7
|
*/
|
|
8
8
|
export declare function init(_input?: InitInput | Promise<InitInput>): Promise<void>;
|
|
9
|
-
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 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 };
|
|
9
|
+
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/node.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-
|
|
3
|
+
import { t as Scene } from "./scene-D0HNTwoo.js";
|
|
4
4
|
import { initSync } from "./wasm/fast_mesh_wasm.js";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
// src/node.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as DistanceFieldDesc, ct as SectionResult, n as AddMeshOptions, p as ColorRule, st as SectionPlane, wt as Range } from "./scene-like-CADk1vfb.js";
|
|
2
2
|
/** A mesh, field or section id allocated on the main side. Unique per kind. */
|
|
3
3
|
type ClientId = number;
|
|
4
4
|
/** A {@link ColorRule} naming its field by client id. */
|
|
@@ -149,6 +149,12 @@ type Request = {
|
|
|
149
149
|
op: "add" | "set" | "remove";
|
|
150
150
|
desc?: SectionDescWire;
|
|
151
151
|
key?: string;
|
|
152
|
+
} |
|
|
153
|
+
/** `Scene.setFieldInteraction`. */
|
|
154
|
+
{
|
|
155
|
+
kind: "fieldInteraction";
|
|
156
|
+
rev: number;
|
|
157
|
+
points: number | null;
|
|
152
158
|
} | {
|
|
153
159
|
kind: "query";
|
|
154
160
|
rev: number;
|
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 { Ot as MeshHandle } from "./scene-like-CADk1vfb.js";
|
|
2
|
+
import { t as SceneStore } from "./store-BfC6kkf5.js";
|
|
3
|
+
import { n as BoundMesh, t as BindMeshOptions } from "./mesh-BsqIofgT.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
2
|
import { c as useStoreSelector, i as useScene, l as StoreContext, t as SceneProvider } from "./react-DzrtrzZy.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-DIQmxF_s.js";
|
|
5
|
+
import { t as bindMesh } from "./mesh-DIWD2F5-.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";
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as FastMeshError } from "./core-CJ9D6U5A.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as DisplayState, c as MeshState, d as SceneSnapshot, n as SectionPatch, p as SectionState, t as SceneStore } from "./store-
|
|
2
|
+
import { Ot as MeshHandle, kt as SectionHandle } from "./scene-like-CADk1vfb.js";
|
|
3
|
+
import { a as DisplayState, c as MeshState, d as SceneSnapshot, n as SectionPatch, p as SectionState, t as SceneStore } from "./store-BfC6kkf5.js";
|
|
4
4
|
import { ReactElement, ReactNode } from "react";
|
|
5
5
|
/** Provides `store` to the hooks below it. */
|
|
6
6
|
export declare function SceneProvider(props: {
|