fast-mesh-wasm 0.5.3 → 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.
- package/README.md +2 -1
- package/dist/{client-f895H_yB.js → client-DFgvktkT.js} +183 -10
- package/dist/{client-D7yfPOyU.d.ts → client-nvmbhtn-.d.ts} +87 -14
- package/dist/{engine-BcJ5W6kS.js → engine-BL5_sWAf.js} +21 -6
- package/dist/io.d.ts +218 -5
- package/dist/io.js +3121 -12
- package/dist/{mesh-B3QP93wx.d.ts → mesh-BHTFxsXc.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 +3 -2
- package/dist/{protocol-Dt0zgang.d.ts → protocol-DFR0JDAS.d.ts} +9 -1
- package/dist/r3f.d.ts +3 -3
- package/dist/r3f.js +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{scene-CXtM_bxV.js → scene-DUsj6uJD.js} +421 -29
- package/dist/{scene-like-Dq9_SaUL.d.ts → scene-like-CR_Dpohm.d.ts} +999 -133
- package/dist/{store-CIW19oCh.d.ts → store-8HWG90Jg.d.ts} +14 -3
- package/dist/{store-C9h7GFFl.js → store-BAzHRRkt.js} +18 -2
- package/dist/store.d.ts +3 -3
- package/dist/store.js +1 -1
- package/dist/three.d.ts +2 -2
- package/dist/three.js +1 -1
- package/dist/views-BSy-Qeg8.js +584 -0
- package/dist/wasm/fast_mesh_wasm.d.ts +21 -1
- package/dist/wasm/fast_mesh_wasm.js +50 -1
- package/dist/wasm/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_mesh_wasm_bg.wasm.d.ts +3 -0
- package/dist/wasm-threads/fast_mesh_wasm.d.ts +21 -1
- package/dist/wasm-threads/fast_mesh_wasm.js +50 -1
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm +0 -0
- package/dist/wasm-threads/fast_mesh_wasm_bg.wasm.d.ts +3 -0
- package/dist/web.d.ts +2 -2
- package/dist/web.js +3 -2
- 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/dist/views-mp7Mf8CQ.js +0 -209
|
@@ -99,49 +99,6 @@ declare class FieldHandle {
|
|
|
99
99
|
declare class SectionHandle {
|
|
100
100
|
private readonly brand;
|
|
101
101
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Zero-copy views of one mesh's render buffers, slot-aligned.
|
|
104
|
-
*
|
|
105
|
-
* Each getter builds a fresh view over the current wasm memory. A view is
|
|
106
|
-
* only valid until the next scene call that may allocate or move buffers
|
|
107
|
-
* (any edit, add, undo, query, ...): the buffer may have moved, so a kept
|
|
108
|
-
* view may read other data, or be empty once the memory grew. Re-acquire
|
|
109
|
-
* views after every scene call and do not keep them. With
|
|
110
|
-
* `new Scene({ debug: true })` reading a kept view warns.
|
|
111
|
-
*/
|
|
112
|
-
interface MeshViews {
|
|
113
|
-
/** Local positions, 3 floats per vertex slot; dead slots hold stale data. */
|
|
114
|
-
positions(): Float32Array;
|
|
115
|
-
/**
|
|
116
|
-
* Vertex normals, 3 floats per vertex slot, or `null` when normals are off.
|
|
117
|
-
* For a `"lazy"` or `"manual"` mesh it can be shorter than 3 · vertex slots
|
|
118
|
-
* after a growth, until the mesh is updated ({@link Scene.update}).
|
|
119
|
-
*/
|
|
120
|
-
normals(): Float32Array | null;
|
|
121
|
-
/** RGBA8 colours, 4 bytes per vertex slot, or `null` without colouring. */
|
|
122
|
-
colors(): Uint8Array | null;
|
|
123
|
-
/**
|
|
124
|
-
* The values the colours are made from (the colouring field's values), 1
|
|
125
|
-
* float per vertex slot, or `null` without colouring. They change only at
|
|
126
|
-
* the colours' dirty slots, so they follow the `colors` change ranges.
|
|
127
|
-
* Optional for other {@link SceneLike} hosts; `Scene` and `WorkerScene`
|
|
128
|
-
* provide it.
|
|
129
|
-
*/
|
|
130
|
-
values?(): Float32Array | null;
|
|
131
|
-
/**
|
|
132
|
-
* Texture coordinates, 2 floats per vertex slot, or `null` for a mesh
|
|
133
|
-
* without them (never given, or dropped by an operation: see
|
|
134
|
-
* `docs/uv-channel.md`). Optional for other {@link SceneLike} hosts; `Scene`
|
|
135
|
-
* and `WorkerScene` provide it ({@link SceneMeshViews}).
|
|
136
|
-
*/
|
|
137
|
-
uvs?(): Float32Array | null;
|
|
138
|
-
/** 3 vertex indices per triangle slot; a removed triangle reads `0, 0, 0`. */
|
|
139
|
-
indices(): Uint32Array;
|
|
140
|
-
}
|
|
141
|
-
/** {@link MeshViews} of `Scene` and `WorkerScene`, which always provide `uvs`. */
|
|
142
|
-
interface SceneMeshViews extends MeshViews {
|
|
143
|
-
uvs(): Float32Array | null;
|
|
144
|
-
}
|
|
145
102
|
/** `[start, count]` in elements: vertex slots, or triangle slots for indices. */
|
|
146
103
|
type Range = readonly [start: number, count: number];
|
|
147
104
|
/** A snapshot of selected vertices of one mesh; see the module docs. */
|
|
@@ -194,6 +151,49 @@ interface IsolateReport {
|
|
|
194
151
|
/** The same vertex set with the post-edit stamp. */
|
|
195
152
|
selection: VertexSelection;
|
|
196
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Zero-copy views of one mesh's render buffers, slot-aligned.
|
|
156
|
+
*
|
|
157
|
+
* Each getter builds a fresh view over the current wasm memory. A view is
|
|
158
|
+
* only valid until the next scene call that may allocate or move buffers
|
|
159
|
+
* (any edit, add, undo, query, ...): the buffer may have moved, so a kept
|
|
160
|
+
* view may read other data, or be empty once the memory grew. Re-acquire
|
|
161
|
+
* views after every scene call and do not keep them. With
|
|
162
|
+
* `new Scene({ debug: true })` reading a kept view warns.
|
|
163
|
+
*/
|
|
164
|
+
interface MeshViews {
|
|
165
|
+
/** Local positions, 3 floats per vertex slot; dead slots hold stale data. */
|
|
166
|
+
positions(): Float32Array;
|
|
167
|
+
/**
|
|
168
|
+
* Vertex normals, 3 floats per vertex slot, or `null` when normals are off.
|
|
169
|
+
* For a `"lazy"` or `"manual"` mesh it can be shorter than 3 · vertex slots
|
|
170
|
+
* after a growth, until the mesh is updated ({@link Scene.update}).
|
|
171
|
+
*/
|
|
172
|
+
normals(): Float32Array | null;
|
|
173
|
+
/** RGBA8 colours, 4 bytes per vertex slot, or `null` without colouring. */
|
|
174
|
+
colors(): Uint8Array | null;
|
|
175
|
+
/**
|
|
176
|
+
* The values the colours are made from (the colouring field's values), 1
|
|
177
|
+
* float per vertex slot, or `null` without colouring. They change only at
|
|
178
|
+
* the colours' dirty slots, so they follow the `colors` change ranges.
|
|
179
|
+
* Optional for other {@link SceneLike} hosts; `Scene` and `WorkerScene`
|
|
180
|
+
* provide it.
|
|
181
|
+
*/
|
|
182
|
+
values?(): Float32Array | null;
|
|
183
|
+
/**
|
|
184
|
+
* Texture coordinates, 2 floats per vertex slot, or `null` for a mesh
|
|
185
|
+
* without them (never given, or dropped by an operation: see
|
|
186
|
+
* `docs/uv-channel.md`). Optional for other {@link SceneLike} hosts; `Scene`
|
|
187
|
+
* and `WorkerScene` provide it ({@link SceneMeshViews}).
|
|
188
|
+
*/
|
|
189
|
+
uvs?(): Float32Array | null;
|
|
190
|
+
/** 3 vertex indices per triangle slot; a removed triangle reads `0, 0, 0`. */
|
|
191
|
+
indices(): Uint32Array;
|
|
192
|
+
}
|
|
193
|
+
/** {@link MeshViews} of `Scene` and `WorkerScene`, which always provide `uvs`. */
|
|
194
|
+
interface SceneMeshViews extends MeshViews {
|
|
195
|
+
uvs(): Float32Array | null;
|
|
196
|
+
}
|
|
197
197
|
/**
|
|
198
198
|
* What changed in one mesh since the previous {@link Scene.takeChanges}.
|
|
199
199
|
* Range lists are ascending; `"all"` means re-upload the whole buffer.
|
|
@@ -691,39 +691,51 @@ interface AnalyzeOptions {
|
|
|
691
691
|
/** The most entries kept in each counted list. Defaults to 1000. */
|
|
692
692
|
maxListed?: number;
|
|
693
693
|
}
|
|
694
|
+
/** Which normal direction `inflate` pushes vertices along. */
|
|
695
|
+
type InflateMethod = "vertexNormal" | "averageNormal" | "strokeNormal";
|
|
696
|
+
/** Surface relaxation kernel for `smooth`. */
|
|
697
|
+
type SmoothMethod = "taubin" | "laplacian" | "hcLaplacian" | "cotangent";
|
|
698
|
+
/** Spatial or elastic kernel for `grab`. */
|
|
699
|
+
type GrabMethod = "sphere" | "geodesic" | "kelvinlet";
|
|
700
|
+
/** Which side(s) of the brush plane `flatten` projects toward the plane. */
|
|
701
|
+
type FlattenMode = "both" | "peaks" | "valleys";
|
|
702
|
+
/** Footprint profile for `clay`. */
|
|
703
|
+
type ClayProfile = "round" | "strips";
|
|
704
|
+
/** Rotational kernel for `twist`. */
|
|
705
|
+
type TwistMethod = "vortex" | "kelvinlet";
|
|
706
|
+
/** Surface offsetting / reconstruction algorithm for `repair(mesh, { op: "offset", ... })`. */
|
|
707
|
+
type OffsetAlgorithm = "normal" | "fhEdt" | "bvhSdf";
|
|
694
708
|
/**
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
* tolerance or area below the `f32` range rounds to 0.
|
|
709
|
+
* Composable per-vertex surface feature mask multiplied into a brush's
|
|
710
|
+
* spatial falloff.
|
|
698
711
|
*/
|
|
699
|
-
type
|
|
700
|
-
|
|
701
|
-
tolerance: number;
|
|
702
|
-
} | {
|
|
703
|
-
op: "removeDegenerate";
|
|
704
|
-
areaEpsilon?: number;
|
|
705
|
-
removeUnusedVertices?: boolean;
|
|
706
|
-
} | {
|
|
707
|
-
op: "removeSmallComponents";
|
|
708
|
-
minTriangles?: number;
|
|
709
|
-
minArea?: number;
|
|
710
|
-
keepLargest?: boolean;
|
|
712
|
+
type SurfaceFilter = {
|
|
713
|
+
kind: "none";
|
|
711
714
|
} | {
|
|
712
|
-
|
|
715
|
+
kind: "peaksOnly";
|
|
716
|
+
threshold?: number;
|
|
717
|
+
contrast?: number;
|
|
713
718
|
} | {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
maxArea?: number;
|
|
718
|
-
loops?: readonly LoopId[];
|
|
719
|
-
allowUnclean?: boolean;
|
|
720
|
-
fair?: boolean;
|
|
721
|
-
dpLimit?: number;
|
|
722
|
-
/** Reject a minimum-weight triangulation past this dihedral, in radians. */
|
|
723
|
-
maxDihedral?: number;
|
|
724
|
-
/** Stop refining a patch once it has this many new vertices. */
|
|
725
|
-
maxRefineVertices?: number;
|
|
719
|
+
kind: "valleysOnly";
|
|
720
|
+
threshold?: number;
|
|
721
|
+
contrast?: number;
|
|
726
722
|
} | {
|
|
723
|
+
kind: "normalAngle";
|
|
724
|
+
normal?: Readonly<Vec3>;
|
|
725
|
+
maxAngleDeg?: number;
|
|
726
|
+
};
|
|
727
|
+
/** Mirror symmetry axes across local coordinate planes `x = 0`, `y = 0`, `z = 0`. */
|
|
728
|
+
interface Symmetry {
|
|
729
|
+
x?: boolean;
|
|
730
|
+
y?: boolean;
|
|
731
|
+
z?: boolean;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* One sculpt brush, stroke capture, or dynamic-topology operation for
|
|
735
|
+
* {@link Scene.sculpt} (and accepted identically by {@link Scene.repair}).
|
|
736
|
+
* Distances are in local mesh units.
|
|
737
|
+
*/
|
|
738
|
+
type SculptOp = {
|
|
727
739
|
op: "inflate";
|
|
728
740
|
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
729
741
|
center: Readonly<Vec3>;
|
|
@@ -731,6 +743,14 @@ type RepairOp = {
|
|
|
731
743
|
falloff: "linear" | "smooth";
|
|
732
744
|
/** Displacement scale; negative pulls instead of pushing. */
|
|
733
745
|
strength: number;
|
|
746
|
+
/** Normal evaluation mode; unset means `"vertexNormal"`. */
|
|
747
|
+
method?: InflateMethod;
|
|
748
|
+
/** Optional per-vertex surface feature mask. */
|
|
749
|
+
filter?: SurfaceFilter;
|
|
750
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
751
|
+
symmetry?: Symmetry;
|
|
752
|
+
/** Vertices this op must hold in place, or move less. */
|
|
753
|
+
protect?: VertexProtection;
|
|
734
754
|
} | {
|
|
735
755
|
op: "smooth";
|
|
736
756
|
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
@@ -739,25 +759,32 @@ type RepairOp = {
|
|
|
739
759
|
falloff: "linear" | "smooth";
|
|
740
760
|
/** Displacement scale; the per-vertex weight is `strength * falloff`. */
|
|
741
761
|
strength: number;
|
|
742
|
-
/** How many
|
|
762
|
+
/** How many relaxation cycles to run; 0 moves nothing. */
|
|
743
763
|
cycles: number;
|
|
764
|
+
/** Relaxation kernel; unset means `"taubin"`. */
|
|
765
|
+
method?: SmoothMethod;
|
|
766
|
+
/** Optional per-vertex surface feature mask. */
|
|
767
|
+
filter?: SurfaceFilter;
|
|
768
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
769
|
+
symmetry?: Symmetry;
|
|
770
|
+
/** Vertices this op must hold in place, or move less. */
|
|
771
|
+
protect?: VertexProtection;
|
|
744
772
|
} | {
|
|
745
|
-
op: "
|
|
746
|
-
/**
|
|
773
|
+
op: "relax";
|
|
774
|
+
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
747
775
|
center: Readonly<Vec3>;
|
|
748
776
|
radius: number;
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
maxEdges?: number;
|
|
777
|
+
falloff: "linear" | "smooth";
|
|
778
|
+
/** Displacement scale; the per-vertex weight is `strength * falloff`. */
|
|
779
|
+
strength: number;
|
|
780
|
+
/** How many plain Laplacian passes to run; 0 moves nothing. */
|
|
781
|
+
cycles: number;
|
|
782
|
+
/** Optional per-vertex surface feature mask. */
|
|
783
|
+
filter?: SurfaceFilter;
|
|
784
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
785
|
+
symmetry?: Symmetry;
|
|
786
|
+
/** Vertices this op must hold in place, or move less. */
|
|
787
|
+
protect?: VertexProtection;
|
|
761
788
|
} | {
|
|
762
789
|
op: "grab";
|
|
763
790
|
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
@@ -768,25 +795,266 @@ type RepairOp = {
|
|
|
768
795
|
strength: number;
|
|
769
796
|
/** The drag vector in local coordinates; zero moves nothing. */
|
|
770
797
|
direction: Readonly<Vec3>;
|
|
798
|
+
/** Spatial or elastic kernel; unset means `"sphere"`. */
|
|
799
|
+
method?: GrabMethod;
|
|
800
|
+
/** Elastic Poisson ratio in `[0, 0.5]` for `"kelvinlet"`; unset means `0.4`. */
|
|
801
|
+
poisson?: number;
|
|
802
|
+
/** Evaluate offsets from stroke-start rest positions (`captureStrokeState`). */
|
|
803
|
+
fromStroke?: boolean;
|
|
804
|
+
/** Automatically widen brush reach on tangential surface drags to prevent fold-over. */
|
|
805
|
+
adaptiveReach?: boolean;
|
|
806
|
+
/** Optional per-vertex surface feature mask. */
|
|
807
|
+
filter?: SurfaceFilter;
|
|
808
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
809
|
+
symmetry?: Symmetry;
|
|
810
|
+
/** Vertices this op must hold in place, or move less. */
|
|
811
|
+
protect?: VertexProtection;
|
|
771
812
|
} | {
|
|
772
|
-
op: "
|
|
813
|
+
op: "flatten";
|
|
773
814
|
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
774
815
|
center: Readonly<Vec3>;
|
|
775
816
|
radius: number;
|
|
776
817
|
falloff: "linear" | "smooth";
|
|
777
|
-
/**
|
|
818
|
+
/** Projection blend scale toward the brush plane. */
|
|
778
819
|
strength: number;
|
|
779
|
-
/**
|
|
780
|
-
|
|
820
|
+
/** Which side(s) of the plane to project; unset means `"both"`. */
|
|
821
|
+
mode?: FlattenMode;
|
|
822
|
+
/** Explicit plane origin in local coordinates; unset fits the falloff-weighted centroid. */
|
|
823
|
+
planeOrigin?: Readonly<Vec3>;
|
|
824
|
+
/** Explicit non-zero plane normal in local coordinates; unset fits the falloff-weighted average normal. */
|
|
825
|
+
planeNormal?: Readonly<Vec3>;
|
|
826
|
+
/** Optional per-vertex surface feature mask. */
|
|
827
|
+
filter?: SurfaceFilter;
|
|
828
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
829
|
+
symmetry?: Symmetry;
|
|
830
|
+
/** Vertices this op must hold in place, or move less. */
|
|
831
|
+
protect?: VertexProtection;
|
|
832
|
+
} | {
|
|
833
|
+
op: "crease";
|
|
834
|
+
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
835
|
+
center: Readonly<Vec3>;
|
|
836
|
+
radius: number;
|
|
837
|
+
falloff: "linear" | "smooth";
|
|
838
|
+
/** Normal groove/ridge scale (`< 0` carves a crease, `> 0` raises a ridge, `0` pinches only). */
|
|
839
|
+
strength: number;
|
|
840
|
+
/** Tangent-plane radial pinch factor in `[0, 1]`; unset means `0.5`. */
|
|
841
|
+
pinch?: number;
|
|
842
|
+
/** Optional per-vertex surface feature mask. */
|
|
843
|
+
filter?: SurfaceFilter;
|
|
844
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
845
|
+
symmetry?: Symmetry;
|
|
846
|
+
/** Vertices this op must hold in place, or move less. */
|
|
847
|
+
protect?: VertexProtection;
|
|
848
|
+
} | {
|
|
849
|
+
op: "clay";
|
|
850
|
+
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
851
|
+
center: Readonly<Vec3>;
|
|
852
|
+
radius: number;
|
|
853
|
+
falloff: "linear" | "smooth";
|
|
854
|
+
/** Buildup/carve scale (`> 0` builds up, `< 0` carves down). */
|
|
855
|
+
strength: number;
|
|
856
|
+
/** Footprint profile (`"round"` or `"strips"`); unset means `"round"`. */
|
|
857
|
+
profile?: ClayProfile;
|
|
858
|
+
/** Optional stroke tangent direction in local coordinates for `"strips"`. */
|
|
859
|
+
tangent?: Readonly<Vec3>;
|
|
860
|
+
/** Optional per-vertex surface feature mask. */
|
|
861
|
+
filter?: SurfaceFilter;
|
|
862
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
863
|
+
symmetry?: Symmetry;
|
|
864
|
+
/** Vertices this op must hold in place, or move less. */
|
|
865
|
+
protect?: VertexProtection;
|
|
866
|
+
} | {
|
|
867
|
+
op: "twist";
|
|
868
|
+
/** Brush center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
869
|
+
center: Readonly<Vec3>;
|
|
870
|
+
radius: number;
|
|
871
|
+
falloff: "linear" | "smooth";
|
|
872
|
+
/** Twist angle scale in radians. */
|
|
873
|
+
strength: number;
|
|
874
|
+
/** Rotational kernel; unset means `"vortex"`. */
|
|
875
|
+
method?: TwistMethod;
|
|
876
|
+
/** Explicit non-zero twist axis in local coordinates; unset uses the average brush normal. */
|
|
877
|
+
axis?: Readonly<Vec3>;
|
|
878
|
+
/** Optional per-vertex surface feature mask. */
|
|
879
|
+
filter?: SurfaceFilter;
|
|
880
|
+
/** Optional mirror symmetry across local coordinate planes. */
|
|
881
|
+
symmetry?: Symmetry;
|
|
882
|
+
/** Vertices this op must hold in place, or move less. */
|
|
883
|
+
protect?: VertexProtection;
|
|
884
|
+
} | {
|
|
885
|
+
/**
|
|
886
|
+
* Snapshots lazy stroke-start rest positions and smooth normals for
|
|
887
|
+
* `inflate` (`method: "strokeNormal"`) and `grab` (`fromStroke: true`).
|
|
888
|
+
* Not an edit: no undo step, and it must be the only op of its list.
|
|
889
|
+
*/
|
|
890
|
+
op: "captureStrokeState";
|
|
891
|
+
/** Keep an already active stroke snapshot on this mesh. Unset means `false`. */
|
|
892
|
+
onlyIfMissing?: boolean;
|
|
893
|
+
} | {
|
|
894
|
+
op: "remesh";
|
|
895
|
+
/** Region center in local mesh coordinates, as in `views(mesh).positions()`. */
|
|
896
|
+
center: Readonly<Vec3>;
|
|
897
|
+
radius: number;
|
|
898
|
+
/** Target edge length; unset means the mesh-wide mean edge length. */
|
|
899
|
+
targetLength?: number;
|
|
900
|
+
/** Maximum split/collapse/flip rounds; unset means the default (10). */
|
|
901
|
+
maxRounds?: number;
|
|
902
|
+
/** Split long edges only (no collapses, no flips); unset means a full pass. */
|
|
903
|
+
splitOnly?: boolean;
|
|
904
|
+
} | {
|
|
905
|
+
/**
|
|
906
|
+
* Records each vertex's longest edge as its rest size, for
|
|
907
|
+
* `splitStretched`. Run it before the deformation starts. Not an edit:
|
|
908
|
+
* no undo step, and it must be the only op of its list. Running it again
|
|
909
|
+
* accepts the mesh as it is then as the new rest shape; `onlyIfMissing`
|
|
910
|
+
* avoids that. The sizes last until a topology edit other than
|
|
911
|
+
* `splitStretched`, or an undo or redo of an edit from before the capture;
|
|
912
|
+
* undoing a topology edit from after it brings them back.
|
|
913
|
+
*/
|
|
914
|
+
op: "captureRestSizes";
|
|
915
|
+
/** Keep rest sizes the mesh still holds. Unset means `false`. */
|
|
916
|
+
onlyIfMissing?: boolean;
|
|
917
|
+
} | {
|
|
918
|
+
/**
|
|
919
|
+
* Splits the edges a deformation stretched, and nothing else: an edge
|
|
920
|
+
* splits once it is past `limit` times the smaller rest size of its
|
|
921
|
+
* endpoints, measured by `captureRestSizes`. Existing vertices keep their
|
|
922
|
+
* ids and positions, nothing collapses or flips, and a triangle with no
|
|
923
|
+
* split edge keeps its slot. Fails while the mesh holds no valid rest
|
|
924
|
+
* sizes: see `captureRestSizes`.
|
|
925
|
+
*/
|
|
926
|
+
op: "splitStretched";
|
|
927
|
+
/** Region center in local mesh coordinates; edges with an endpoint in the region are checked. */
|
|
928
|
+
center: Readonly<Vec3>;
|
|
929
|
+
radius: number;
|
|
930
|
+
/** Multiple of the rest size an edge may reach, above 1; unset means 4/3. */
|
|
931
|
+
limit?: number;
|
|
932
|
+
/** Most interior splits per call, the longest first; boundary edges do not count. Unset means 2^20. */
|
|
933
|
+
maxSplits?: number;
|
|
934
|
+
/** New interior vertices follow the surface's curvature; `false` uses midpoints. Unset means `true`. */
|
|
935
|
+
smooth?: boolean;
|
|
936
|
+
/**
|
|
937
|
+
* With `smooth`, the angle in degrees past which two faces count as
|
|
938
|
+
* separated by a crease, in `(0, 180]`; unset means 45. A new vertex on
|
|
939
|
+
* such an edge sits at its midpoint, and faces beyond it do not tilt a
|
|
940
|
+
* curved point. A gentler crease rounds off, and a flat face beside it
|
|
941
|
+
* bulges: at 45, 0.20 beside a 30 degree crease on a 6.0 edge. Set it below
|
|
942
|
+
* a model's gentlest crease to keep that crease's flat faces flat; a coarse
|
|
943
|
+
* curved surface then rounds less.
|
|
944
|
+
*/
|
|
945
|
+
sharpAngle?: number;
|
|
946
|
+
};
|
|
947
|
+
/** Domain preset for {@link AutoRepairRequest}. */
|
|
948
|
+
type AutoRepairPreset = "general" | "scan3d" | "print3d" | "cadImport";
|
|
949
|
+
/** Strategy for {@link resolveSelfIntersections} and {@link AutoRepairRequest}. */
|
|
950
|
+
type SelfIntersectionMode = "none" | "deleteAndFill" | "cutAndStitch" | "voxelHeal";
|
|
951
|
+
/** Options for the `"makeManifold"` repair op. */
|
|
952
|
+
interface ManifoldOptions {
|
|
953
|
+
/** Remove exact duplicate triangles sharing the same unordered vertex triple. Defaults to `true`. */
|
|
954
|
+
removeDuplicates?: boolean;
|
|
955
|
+
/** Prune small dangling boundary fins attached to non-manifold edges. Defaults to `true`. */
|
|
956
|
+
pruneFins?: boolean;
|
|
957
|
+
/** Separate non-manifold edges (`> 2` incident faces) across sheets. Defaults to `true`. */
|
|
958
|
+
splitNonManifoldEdges?: boolean;
|
|
959
|
+
/** Separate pinch (bow-tie) vertices into distinct fan components. Defaults to `true`. */
|
|
960
|
+
splitPinchVertices?: boolean;
|
|
961
|
+
}
|
|
962
|
+
/** Options for the `"resolveSelfIntersections"` repair op. */
|
|
963
|
+
interface SelfIntersectOptions {
|
|
964
|
+
/** Resolution mode. Defaults to `"deleteAndFill"`. */
|
|
965
|
+
mode?: SelfIntersectionMode;
|
|
966
|
+
/** Number of 1-ring neighbor layers deleted around colliding faces (`"deleteAndFill"` and local fallback). Defaults to `1`. */
|
|
967
|
+
ringExpansion?: number;
|
|
968
|
+
/** Explicit voxel pitch in mesh units for `"voxelHeal"`. Omit for automatic sizing. */
|
|
969
|
+
voxelSize?: number;
|
|
970
|
+
/** Maximum voxel count for `"voxelHeal"` (`>= 64`). Defaults to `16_777_216` (`256^3`). */
|
|
971
|
+
maxVoxels?: number;
|
|
972
|
+
/** Optional hole boundary edge cap passed to `fillHoles`. Defaults to unbounded. */
|
|
973
|
+
maxHoleEdges?: number;
|
|
974
|
+
/** Whether hole patches in `"deleteAndFill"` are faired. Defaults to `true`. */
|
|
975
|
+
fair?: boolean;
|
|
976
|
+
/** Spatial weld tolerance for shared cut seam vertices in `"cutAndStitch"`. Defaults to `1e-5`. */
|
|
977
|
+
stitchTolerance?: number;
|
|
978
|
+
}
|
|
979
|
+
/** Options for the `"cleanupSlivers"` repair op. */
|
|
980
|
+
interface SliverOptions {
|
|
981
|
+
/** Maximum allowed circumradius-to-2-inradius aspect ratio (`>= 1`). Defaults to `20`. */
|
|
982
|
+
maxAspectRatio?: number;
|
|
983
|
+
/** Minimum interior angle threshold in degrees (`[0, 60]`). Defaults to `2`. */
|
|
984
|
+
minAngleDeg?: number;
|
|
985
|
+
/** Maximum interior angle threshold in degrees (`[60, 180]`). Defaults to `176`. */
|
|
986
|
+
maxAngleDeg?: number;
|
|
987
|
+
/** Maximum cleanup passes over the mesh. Defaults to `3`. */
|
|
988
|
+
maxIterations?: number;
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* One repair operation for {@link Scene.repair}. Distances and areas are in
|
|
992
|
+
* mesh units (equal to world units). They are converted to `f32`, so a
|
|
993
|
+
* tolerance or area below the `f32` range rounds to 0.
|
|
994
|
+
*/
|
|
995
|
+
type RepairOp = SculptOp | {
|
|
996
|
+
op: "weld";
|
|
997
|
+
tolerance: number;
|
|
998
|
+
} | {
|
|
999
|
+
op: "removeDegenerate";
|
|
1000
|
+
areaEpsilon?: number;
|
|
1001
|
+
removeUnusedVertices?: boolean;
|
|
1002
|
+
} | {
|
|
1003
|
+
op: "removeSmallComponents";
|
|
1004
|
+
minTriangles?: number;
|
|
1005
|
+
minArea?: number;
|
|
1006
|
+
keepLargest?: boolean;
|
|
1007
|
+
} | {
|
|
1008
|
+
op: "orient";
|
|
1009
|
+
} | ({
|
|
1010
|
+
op: "makeManifold";
|
|
1011
|
+
} & ManifoldOptions) | ({
|
|
1012
|
+
op: "resolveSelfIntersections";
|
|
1013
|
+
} & SelfIntersectOptions) | ({
|
|
1014
|
+
op: "cleanupSlivers";
|
|
1015
|
+
} & SliverOptions) | {
|
|
1016
|
+
op: "fillHoles";
|
|
1017
|
+
maxEdges?: number;
|
|
1018
|
+
maxPerimeter?: number;
|
|
1019
|
+
maxArea?: number;
|
|
1020
|
+
loops?: readonly LoopId[];
|
|
1021
|
+
allowUnclean?: boolean;
|
|
1022
|
+
fair?: boolean;
|
|
1023
|
+
dpLimit?: number;
|
|
1024
|
+
/** Reject a minimum-weight triangulation past this dihedral, in radians. */
|
|
1025
|
+
maxDihedral?: number;
|
|
1026
|
+
/** Stop refining a patch once it has this many new vertices. */
|
|
1027
|
+
maxRefineVertices?: number;
|
|
1028
|
+
} | {
|
|
1029
|
+
op: "bridgeLoops";
|
|
1030
|
+
/** The two loops to connect, from `analyze(mesh).loops`. Order is insignificant. */
|
|
1031
|
+
loops: readonly [LoopId, LoopId];
|
|
1032
|
+
/** Maximum vertices per loop; unset means the default (128). */
|
|
1033
|
+
maxEdges?: number;
|
|
781
1034
|
} | {
|
|
782
1035
|
op: "offset";
|
|
783
1036
|
/**
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
* 0
|
|
1037
|
+
* Offset distance in local mesh units.
|
|
1038
|
+
* - `"normal"` (default): moves vertices along smooth normals (`0` moves nothing).
|
|
1039
|
+
* - `"fhEdt"` / `"bvhSdf"`: on closed outward-wound solids, positive expands,
|
|
1040
|
+
* negative shrinks, and `0` voxel-remeshes at the current surface; on open
|
|
1041
|
+
* sheets, `distance > 0` builds a closed thickened shell and `distance <= 0`
|
|
1042
|
+
* throws `INVALID_ARGUMENT`. Drops UVs (`uvsDropped: true`, undoable).
|
|
788
1043
|
*/
|
|
789
1044
|
distance: number;
|
|
1045
|
+
/** Offsetting algorithm; defaults to `"normal"`. */
|
|
1046
|
+
algorithm?: OffsetAlgorithm;
|
|
1047
|
+
/**
|
|
1048
|
+
* Grid spacing in local mesh units for `"fhEdt"` and `"bvhSdf"`; must be
|
|
1049
|
+
* positive and finite when provided. Omit for automatic (`bbox_diag / 64`,
|
|
1050
|
+
* clamped to `maxVoxels`). Ignored when `algorithm` is `"normal"`.
|
|
1051
|
+
*/
|
|
1052
|
+
voxelSize?: number;
|
|
1053
|
+
/**
|
|
1054
|
+
* Maximum 3D grid voxel count (`nx * ny * nz`) for `"fhEdt"` and `"bvhSdf"`;
|
|
1055
|
+
* must be an integer `>= 64`. Defaults to `16_777_216` (`256^3`).
|
|
1056
|
+
*/
|
|
1057
|
+
maxVoxels?: number;
|
|
790
1058
|
} | {
|
|
791
1059
|
op: "shell";
|
|
792
1060
|
/**
|
|
@@ -868,6 +1136,26 @@ interface FillReport {
|
|
|
868
1136
|
reason: "projectionFolds" | "noValidTriangulation" | "solver";
|
|
869
1137
|
}[];
|
|
870
1138
|
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Vertices a brush op holds back, with optional geodesic soft-band feathering.
|
|
1141
|
+
* After the op runs, each listed vertex's move is scaled by its weight: `0`
|
|
1142
|
+
* leaves it at exactly the bytes it had, `1` keeps the whole move. When
|
|
1143
|
+
* `band > 0`, vertices within geodesic surface distance `band` of `0`-weight
|
|
1144
|
+
* vertices feather smoothly across `[0, band]`. The op's report describes its
|
|
1145
|
+
* own move before scaling, and it stays one undo step; an op alone whose brush
|
|
1146
|
+
* holds only vertices at `0` reports 0 and leaves no step.
|
|
1147
|
+
*
|
|
1148
|
+
* @throws `INVALID_ARGUMENT` when a vertex is not alive, a weight is outside
|
|
1149
|
+
* `[0, 1]`, `band` is negative or non-finite, or the lists differ in length.
|
|
1150
|
+
*/
|
|
1151
|
+
interface VertexProtection {
|
|
1152
|
+
/** The vertex slots to protect. */
|
|
1153
|
+
vertices: Indices;
|
|
1154
|
+
/** One weight per vertex, each in `[0, 1]`; unset holds every listed vertex fully (all `0`). */
|
|
1155
|
+
weights?: ArrayLike<number>;
|
|
1156
|
+
/** Geodesic soft-falloff transition band width in local units around `0`-weight vertices; unset means `0`. */
|
|
1157
|
+
band?: number;
|
|
1158
|
+
}
|
|
871
1159
|
/** What `inflate` did. */
|
|
872
1160
|
interface InflateReport {
|
|
873
1161
|
moved: number;
|
|
@@ -878,6 +1166,28 @@ interface SmoothReport {
|
|
|
878
1166
|
moved: number;
|
|
879
1167
|
maxDisplacement: number;
|
|
880
1168
|
}
|
|
1169
|
+
/** What `flatten` did. */
|
|
1170
|
+
interface FlattenReport {
|
|
1171
|
+
moved: number;
|
|
1172
|
+
maxDisplacement: number;
|
|
1173
|
+
}
|
|
1174
|
+
/** What `crease` did. */
|
|
1175
|
+
interface CreaseReport {
|
|
1176
|
+
moved: number;
|
|
1177
|
+
maxDisplacement: number;
|
|
1178
|
+
}
|
|
1179
|
+
/** What `clay` did. */
|
|
1180
|
+
interface ClayReport {
|
|
1181
|
+
moved: number;
|
|
1182
|
+
maxDisplacement: number;
|
|
1183
|
+
}
|
|
1184
|
+
/** What `twist` did. */
|
|
1185
|
+
interface TwistReport {
|
|
1186
|
+
moved: number;
|
|
1187
|
+
maxDisplacement: number;
|
|
1188
|
+
}
|
|
1189
|
+
/** What `captureStrokeState` did: nothing to report. */
|
|
1190
|
+
type CaptureStrokeReport = Record<string, never>;
|
|
881
1191
|
/** What `remesh` did. */
|
|
882
1192
|
interface RemeshReport {
|
|
883
1193
|
splits: number;
|
|
@@ -885,6 +1195,20 @@ interface RemeshReport {
|
|
|
885
1195
|
flips: number;
|
|
886
1196
|
rounds: number;
|
|
887
1197
|
}
|
|
1198
|
+
/** What `splitStretched` did. */
|
|
1199
|
+
interface StretchReport {
|
|
1200
|
+
splits: number;
|
|
1201
|
+
/** Edges still past the limit because `maxSplits` ran out, for a later call. */
|
|
1202
|
+
remaining: number;
|
|
1203
|
+
/**
|
|
1204
|
+
* `new, a, b` per split, in order: the new vertex and its edge's endpoints,
|
|
1205
|
+
* which may be new vertices from earlier in the list. For a caller that holds
|
|
1206
|
+
* per-vertex state of its own and has to carry it over.
|
|
1207
|
+
*/
|
|
1208
|
+
vertices: Uint32Array;
|
|
1209
|
+
}
|
|
1210
|
+
/** What `captureRestSizes` did: nothing to report. */
|
|
1211
|
+
type CaptureRestReport = Record<string, never>;
|
|
888
1212
|
/** What `bridgeLoops` did. */
|
|
889
1213
|
interface BridgeReport {
|
|
890
1214
|
trianglesAdded: number;
|
|
@@ -905,8 +1229,18 @@ interface OffsetReport {
|
|
|
905
1229
|
maxDisplacement: number;
|
|
906
1230
|
/** Degenerate triangles the cleanup pass removed. */
|
|
907
1231
|
degenerateRemoved: number;
|
|
908
|
-
/** Vertices
|
|
1232
|
+
/** Vertices removed (cleanup pass for `"normal"`, replaced + cleanup for volumetric). */
|
|
909
1233
|
verticesRemoved: number;
|
|
1234
|
+
/** New vertices added by Marching Cubes (`0` for `"normal"`). */
|
|
1235
|
+
verticesAdded: number;
|
|
1236
|
+
/** New triangles added by Marching Cubes (`0` for `"normal"`). */
|
|
1237
|
+
trianglesAdded: number;
|
|
1238
|
+
/** Original triangles replaced (`0` for `"normal"`). */
|
|
1239
|
+
trianglesRemoved: number;
|
|
1240
|
+
/** Voxel spacing used in local mesh units (`0` for `"normal"`). */
|
|
1241
|
+
voxelSize: number;
|
|
1242
|
+
/** Whether the `"uv"` channel was dropped (`false` for `"normal"` or meshes without UVs). */
|
|
1243
|
+
uvsDropped: boolean;
|
|
910
1244
|
}
|
|
911
1245
|
/** What `shell` did. */
|
|
912
1246
|
interface ShellReport {
|
|
@@ -937,6 +1271,31 @@ interface SubdivideReport {
|
|
|
937
1271
|
/** Triangles added: three per subdivided triangle per level. */
|
|
938
1272
|
trianglesAdded: number;
|
|
939
1273
|
}
|
|
1274
|
+
/** What `makeManifold` did. */
|
|
1275
|
+
interface ManifoldReport {
|
|
1276
|
+
removedDuplicateTriangles: number;
|
|
1277
|
+
prunedFinTriangles: number;
|
|
1278
|
+
splitNonManifoldEdges: number;
|
|
1279
|
+
splitPinchVertices: number;
|
|
1280
|
+
verticesAdded: number;
|
|
1281
|
+
removedVertices: number;
|
|
1282
|
+
}
|
|
1283
|
+
/** What `resolveSelfIntersections` did. */
|
|
1284
|
+
interface SelfIntersectReport {
|
|
1285
|
+
initialPairs: number;
|
|
1286
|
+
remainingPairs: number;
|
|
1287
|
+
removedTriangles: number;
|
|
1288
|
+
addedTriangles: number;
|
|
1289
|
+
modeUsed: SelfIntersectionMode;
|
|
1290
|
+
uvsDropped: boolean;
|
|
1291
|
+
}
|
|
1292
|
+
/** What `cleanupSlivers` did. */
|
|
1293
|
+
interface SliverReport {
|
|
1294
|
+
collapsedNeedles: number;
|
|
1295
|
+
flippedCaps: number;
|
|
1296
|
+
removedDegenerate: number;
|
|
1297
|
+
removedVertices: number;
|
|
1298
|
+
}
|
|
940
1299
|
/** Options of {@link Scene.join}. */
|
|
941
1300
|
interface JoinOptions {
|
|
942
1301
|
/** The loop on the target, from `analyze(target).loops`. */
|
|
@@ -1075,8 +1434,9 @@ interface RegisterResult {
|
|
|
1075
1434
|
/** Options of {@link Scene.cutByPlane}. */
|
|
1076
1435
|
interface CutOptions {
|
|
1077
1436
|
/**
|
|
1078
|
-
* Close both openings with flat, unfaired patches
|
|
1079
|
-
* without it both parts keep the open
|
|
1437
|
+
* Close both openings with flat, unfaired patches, across UV seams on a
|
|
1438
|
+
* mesh with UVs. Defaults to `true`; without it both parts keep the open
|
|
1439
|
+
* rim the cut leaves.
|
|
1080
1440
|
*/
|
|
1081
1441
|
cap?: boolean;
|
|
1082
1442
|
}
|
|
@@ -1102,11 +1462,19 @@ type BooleanOp = "union" | "subtract" | "intersect";
|
|
|
1102
1462
|
*/
|
|
1103
1463
|
interface AutoRepairRequest {
|
|
1104
1464
|
kind: "auto";
|
|
1105
|
-
/**
|
|
1465
|
+
/** Domain preset configuring stages and defaults. Defaults to `"general"`. */
|
|
1466
|
+
preset?: AutoRepairPreset;
|
|
1467
|
+
/** Optional self-intersection resolution override for this run. */
|
|
1468
|
+
selfIntersectionMode?: SelfIntersectionMode;
|
|
1469
|
+
/** Voxel spacing in mesh units for volumetric healing (`"voxelHeal"` or `"print3d"` fallback). */
|
|
1470
|
+
voxelSize?: number;
|
|
1471
|
+
/** Maximum voxel count (`>= 64`) for volumetric healing. Defaults to `16_777_216`. */
|
|
1472
|
+
maxVoxels?: number;
|
|
1473
|
+
/** Vertices at most this far apart are welded, in mesh units. Default depends on `preset` (`1e-5` for `"general"`). */
|
|
1106
1474
|
weldTolerance?: number;
|
|
1107
|
-
/** Components with fewer triangles are removed; the largest always stays. Default `500
|
|
1475
|
+
/** Components with fewer triangles are removed; the largest always stays. Default depends on `preset` (`500` for `"general"`). */
|
|
1108
1476
|
minTriangles?: number;
|
|
1109
|
-
/** Fill only holes with at most this many edges; `Infinity` fills any size. Default `64
|
|
1477
|
+
/** Fill only holes with at most this many edges; `Infinity` fills any size (`"cadImport"` preserves open boundaries unless finite). Default depends on `preset` (`64` for `"general"`). */
|
|
1110
1478
|
maxEdges?: number;
|
|
1111
1479
|
/** Refine and fair each fill so it follows the surrounding curvature. Default `true`. */
|
|
1112
1480
|
fair?: boolean;
|
|
@@ -1121,9 +1489,40 @@ interface AutoRepairReport {
|
|
|
1121
1489
|
orient: OrientReport;
|
|
1122
1490
|
removeSmallComponents: RemoveReport;
|
|
1123
1491
|
fillHoles: FillReport;
|
|
1124
|
-
|
|
1492
|
+
makeManifold?: ManifoldReport;
|
|
1493
|
+
cleanupSlivers?: SliverReport;
|
|
1494
|
+
resolveSelfIntersections?: SelfIntersectReport;
|
|
1495
|
+
}
|
|
1496
|
+
/** The report of a {@link SculptOp}. */
|
|
1497
|
+
type SculptReport = InflateReport | SmoothReport | RelaxReport | GrabReport | FlattenReport | CreaseReport | ClayReport | TwistReport | CaptureStrokeReport | CaptureRestReport | StretchReport | RemeshReport;
|
|
1498
|
+
/** The report type of a sculpt op. */
|
|
1499
|
+
type SculptReportOf<O extends SculptOp> = O extends {
|
|
1500
|
+
op: "inflate";
|
|
1501
|
+
} ? InflateReport : O extends {
|
|
1502
|
+
op: "smooth";
|
|
1503
|
+
} ? SmoothReport : O extends {
|
|
1504
|
+
op: "relax";
|
|
1505
|
+
} ? RelaxReport : O extends {
|
|
1506
|
+
op: "grab";
|
|
1507
|
+
} ? GrabReport : O extends {
|
|
1508
|
+
op: "flatten";
|
|
1509
|
+
} ? FlattenReport : O extends {
|
|
1510
|
+
op: "crease";
|
|
1511
|
+
} ? CreaseReport : O extends {
|
|
1512
|
+
op: "clay";
|
|
1513
|
+
} ? ClayReport : O extends {
|
|
1514
|
+
op: "twist";
|
|
1515
|
+
} ? TwistReport : O extends {
|
|
1516
|
+
op: "captureStrokeState";
|
|
1517
|
+
} ? CaptureStrokeReport : O extends {
|
|
1518
|
+
op: "captureRestSizes";
|
|
1519
|
+
} ? CaptureRestReport : O extends {
|
|
1520
|
+
op: "splitStretched";
|
|
1521
|
+
} ? StretchReport : O extends {
|
|
1522
|
+
op: "remesh";
|
|
1523
|
+
} ? RemeshReport : SculptReport;
|
|
1125
1524
|
/** The report of a {@link RepairOp}. */
|
|
1126
|
-
type RepairReport = WeldReport | DegenerateReport | RemoveReport | OrientReport | FillReport |
|
|
1525
|
+
type RepairReport = SculptReport | WeldReport | DegenerateReport | RemoveReport | OrientReport | FillReport | BridgeReport | OffsetReport | ShellReport | SimplifyReport | SubdivideReport | ManifoldReport | SelfIntersectReport | SliverReport;
|
|
1127
1526
|
/** The report type of a repair op. */
|
|
1128
1527
|
type RepairReportOf<O extends RepairOp> = O extends {
|
|
1129
1528
|
op: "weld";
|
|
@@ -1134,6 +1533,12 @@ type RepairReportOf<O extends RepairOp> = O extends {
|
|
|
1134
1533
|
} ? RemoveReport : O extends {
|
|
1135
1534
|
op: "orient";
|
|
1136
1535
|
} ? OrientReport : O extends {
|
|
1536
|
+
op: "makeManifold";
|
|
1537
|
+
} ? ManifoldReport : O extends {
|
|
1538
|
+
op: "resolveSelfIntersections";
|
|
1539
|
+
} ? SelfIntersectReport : O extends {
|
|
1540
|
+
op: "cleanupSlivers";
|
|
1541
|
+
} ? SliverReport : O extends {
|
|
1137
1542
|
op: "fillHoles";
|
|
1138
1543
|
} ? FillReport : O extends {
|
|
1139
1544
|
op: "inflate";
|
|
@@ -1148,6 +1553,16 @@ type RepairReportOf<O extends RepairOp> = O extends {
|
|
|
1148
1553
|
} ? GrabReport : O extends {
|
|
1149
1554
|
op: "relax";
|
|
1150
1555
|
} ? RelaxReport : O extends {
|
|
1556
|
+
op: "flatten";
|
|
1557
|
+
} ? FlattenReport : O extends {
|
|
1558
|
+
op: "crease";
|
|
1559
|
+
} ? CreaseReport : O extends {
|
|
1560
|
+
op: "clay";
|
|
1561
|
+
} ? ClayReport : O extends {
|
|
1562
|
+
op: "twist";
|
|
1563
|
+
} ? TwistReport : O extends {
|
|
1564
|
+
op: "captureStrokeState";
|
|
1565
|
+
} ? CaptureStrokeReport : O extends {
|
|
1151
1566
|
op: "offset";
|
|
1152
1567
|
} ? OffsetReport : O extends {
|
|
1153
1568
|
op: "shell";
|
|
@@ -1155,7 +1570,11 @@ type RepairReportOf<O extends RepairOp> = O extends {
|
|
|
1155
1570
|
op: "simplify";
|
|
1156
1571
|
} ? SimplifyReport : O extends {
|
|
1157
1572
|
op: "subdivide";
|
|
1158
|
-
} ? SubdivideReport :
|
|
1573
|
+
} ? SubdivideReport : O extends {
|
|
1574
|
+
op: "splitStretched";
|
|
1575
|
+
} ? StretchReport : O extends {
|
|
1576
|
+
op: "captureRestSizes";
|
|
1577
|
+
} ? CaptureRestReport : RepairReport;
|
|
1159
1578
|
/**
|
|
1160
1579
|
* A scene of editable meshes. Create it after `await init()`; release it with
|
|
1161
1580
|
* {@link Scene.free} or a `using` declaration (otherwise it is freed when
|
|
@@ -1168,6 +1587,24 @@ type RepairReportOf<O extends RepairOp> = O extends {
|
|
|
1168
1587
|
*/
|
|
1169
1588
|
declare class Scene implements SceneLike {
|
|
1170
1589
|
#private;
|
|
1590
|
+
/**
|
|
1591
|
+
* Callable repair domain (`scene.repair(mesh, op)` and `scene.repair.<method>(...)`).
|
|
1592
|
+
*/
|
|
1593
|
+
readonly repair: SyncRepairDomain;
|
|
1594
|
+
/**
|
|
1595
|
+
* Callable sculpt domain (`scene.sculpt(mesh, op)` and `scene.sculpt.<method>(...)`).
|
|
1596
|
+
*/
|
|
1597
|
+
readonly sculpt: SyncSculptDomain;
|
|
1598
|
+
/** Remesh, simplification, subdivision, and volumetric reconstruction domain. */
|
|
1599
|
+
readonly remesh: SyncRemeshDomain;
|
|
1600
|
+
/** Callable boolean, cutting, offsetting, and shell domain. */
|
|
1601
|
+
readonly boolean: SyncBooleanDomain;
|
|
1602
|
+
/** Surface deformation and vertex-protection domain. */
|
|
1603
|
+
readonly deform: SyncDeformDomain;
|
|
1604
|
+
/** Defect analysis, metrology, queries, fields, and section inspection domain. */
|
|
1605
|
+
readonly inspect: SyncInspectDomain;
|
|
1606
|
+
/** Rigid registration and alignment domain. */
|
|
1607
|
+
readonly align: SyncAlignDomain;
|
|
1171
1608
|
constructor(options?: SceneOptions);
|
|
1172
1609
|
/** Releases the scene and everything in it. Later calls throw `INVALID_ARGUMENT`; calling it again does nothing. */
|
|
1173
1610
|
free(): void;
|
|
@@ -1196,6 +1633,7 @@ declare class Scene implements SceneLike {
|
|
|
1196
1633
|
* one step; the removal is permanent. A drag of the source ends first,
|
|
1197
1634
|
* recording its moves as one step, so they survive a failed join.
|
|
1198
1635
|
*
|
|
1636
|
+
* @deprecated Use `scene.repair.join()` instead.
|
|
1199
1637
|
* @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` for one
|
|
1200
1638
|
* mesh twice or loops that cannot bridge; `STALE_LOOPS` for a loop that is
|
|
1201
1639
|
* not there. A failed join changes nothing.
|
|
@@ -1206,30 +1644,22 @@ declare class Scene implements SceneLike {
|
|
|
1206
1644
|
* (`signedDistance >= 0`) stays on the mesh and the `-` side is added as
|
|
1207
1645
|
* a new mesh with the same placement, so the world shape is kept.
|
|
1208
1646
|
* Cutting a closed mesh with `cap` (the default) yields two closed
|
|
1209
|
-
* meshes, capped with flat, unfaired patches.
|
|
1647
|
+
* meshes, capped with flat, unfaired patches. On a mesh with UVs, closed
|
|
1648
|
+
* means closed by exact position, so seams count as closed: the cap's UVs
|
|
1649
|
+
* come from the rim and blend across a seam. A rim that runs into a real
|
|
1650
|
+
* boundary of an open mesh stays open. A mesh without UVs is read by vertex
|
|
1651
|
+
* index, so its split vertices are such a boundary: weld it first.
|
|
1210
1652
|
*
|
|
1211
1653
|
* The cut undoes in one step; the added mesh stays, like the removed
|
|
1212
1654
|
* source of {@link Scene.join}.
|
|
1213
1655
|
*
|
|
1656
|
+
* @deprecated Use `scene.boolean.cut()` instead.
|
|
1214
1657
|
* @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` when
|
|
1215
|
-
* the plane does not cut the mesh or a rim cannot be capped
|
|
1216
|
-
*
|
|
1658
|
+
* the plane does not cut the mesh or a rim cannot be capped, as listed in
|
|
1659
|
+
* `docs/uv-channel.md`, for example a rim that closes by position with its
|
|
1660
|
+
* walls wound against each other. A failed cut changes nothing.
|
|
1217
1661
|
*/
|
|
1218
1662
|
cutByPlane(mesh: MeshHandle, plane: SectionPlane, options?: CutOptions): CutReport;
|
|
1219
|
-
/**
|
|
1220
|
-
* Combines `source` into `target` in the world: the union, subtraction
|
|
1221
|
-
* (`target` minus `source`) or intersection. Returns `target`, now
|
|
1222
|
-
* holding the result with its placement; `source` is unchanged.
|
|
1223
|
-
*
|
|
1224
|
-
* Both meshes must be closed and manifold. The boolean undoes in one
|
|
1225
|
-
* step. Combining a mesh with itself is a no-op for `"union"` and
|
|
1226
|
-
* `"intersect"`, and clears it for `"subtract"`.
|
|
1227
|
-
*
|
|
1228
|
-
* @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` for an
|
|
1229
|
-
* input that is not closed, manifold and consistently wound. A failed
|
|
1230
|
-
* boolean changes nothing.
|
|
1231
|
-
*/
|
|
1232
|
-
boolean(target: MeshHandle, source: MeshHandle, op: BooleanOp): MeshHandle;
|
|
1233
1663
|
/**
|
|
1234
1664
|
* Rigidly aligns the mesh `moving` to the mesh `fixed` by point-to-plane ICP,
|
|
1235
1665
|
* with the closest points found through `fixed`'s BVH and trimmed by
|
|
@@ -1258,6 +1688,7 @@ declare class Scene implements SceneLike {
|
|
|
1258
1688
|
* followed exactly on a copy baked through it, so each such call costs a BVH
|
|
1259
1689
|
* build. All distances are in world units.
|
|
1260
1690
|
*
|
|
1691
|
+
* @deprecated Use `scene.align.register()` instead.
|
|
1261
1692
|
* @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` for one
|
|
1262
1693
|
* mesh twice, a mesh without triangles or an invalid option; `STALE_BVH` for
|
|
1263
1694
|
* a stale Manual `fixed`. Bad options and one mesh twice change nothing,
|
|
@@ -1277,6 +1708,11 @@ declare class Scene implements SceneLike {
|
|
|
1277
1708
|
setPlacement(mesh: MeshHandle, placement: PlacementInput): void;
|
|
1278
1709
|
/** A mesh's placement, with the rotation as a row-major matrix. */
|
|
1279
1710
|
placement(mesh: MeshHandle): Placement;
|
|
1711
|
+
/**
|
|
1712
|
+
* The mesh's origin. `views(mesh).positions()` are relative to it, while
|
|
1713
|
+
* `edit`'s `setPositions` and `addVertices` take positions with it added.
|
|
1714
|
+
*/
|
|
1715
|
+
origin(mesh: MeshHandle): Vec3;
|
|
1280
1716
|
/**
|
|
1281
1717
|
* The column-major world matrix of the local render coordinates,
|
|
1282
1718
|
* `placement · translate(origin)`, ready for renderers (convert to `f32`
|
|
@@ -1284,6 +1720,26 @@ declare class Scene implements SceneLike {
|
|
|
1284
1720
|
* inverse-transpose (three.js' normal matrix does this from the matrix).
|
|
1285
1721
|
*/
|
|
1286
1722
|
matrix4(mesh: MeshHandle): Float64Array;
|
|
1723
|
+
/**
|
|
1724
|
+
* Starts (`points`) or ends (`null`) an interaction: a gesture that changes
|
|
1725
|
+
* a placement or a mesh many times a second (a drag, a brush stroke), during
|
|
1726
|
+
* which a distance field too large to recompute per update stays live near
|
|
1727
|
+
* the contact, and is made exact when the gesture ends.
|
|
1728
|
+
*
|
|
1729
|
+
* While it lasts, a field with more finite values than `points` updates
|
|
1730
|
+
* only the vertices near its moved targets (within a margin that follows
|
|
1731
|
+
* the work, about `points` vertices an update), the vertices an edit moved
|
|
1732
|
+
* and a sweep of a quarter of `points` others. The rest keep their values
|
|
1733
|
+
* and colours, out of date by at most how far the meshes moved since, so
|
|
1734
|
+
* nothing turns far meanwhile. A smaller field updates as usual. Ending it
|
|
1735
|
+
* recomputes the fields it left out of date: their values and colours are
|
|
1736
|
+
* then those of an exact update. A gesture that changed nothing costs
|
|
1737
|
+
* nothing. The results do not depend on the thread count.
|
|
1738
|
+
*
|
|
1739
|
+
* @throws `INVALID_ARGUMENT` unless `points` is `null` or an integer in
|
|
1740
|
+
* `[1, 2^32)`.
|
|
1741
|
+
*/
|
|
1742
|
+
setFieldInteraction(points: number | null): void;
|
|
1287
1743
|
/** Sets when the mesh's derived data follows its edits; see {@link UpdateMode}. */
|
|
1288
1744
|
setMode(mesh: MeshHandle, mode: UpdateMode): void;
|
|
1289
1745
|
/** When the mesh's derived data follows its edits; see {@link UpdateMode}. */
|
|
@@ -1390,6 +1846,7 @@ declare class Scene implements SceneLike {
|
|
|
1390
1846
|
* triangles, non-manifold edges and vertices, components, orientation
|
|
1391
1847
|
* conflicts and, on request, self-intersection.
|
|
1392
1848
|
*
|
|
1849
|
+
* @deprecated Use `scene.inspect.analyze()` or `scene.repair.analyze()` instead.
|
|
1393
1850
|
* @throws `INVALID_ARGUMENT` for a negative or non-finite `weldTolerance`; `STALE_BVH`, see {@link AnalyzeOptions.selfIntersection}.
|
|
1394
1851
|
*/
|
|
1395
1852
|
analyze(mesh: MeshHandle, options?: AnalyzeOptions): Analysis;
|
|
@@ -1399,44 +1856,58 @@ declare class Scene implements SceneLike {
|
|
|
1399
1856
|
* non-manifold mesh still gets its area; only `volume` is `null`, with
|
|
1400
1857
|
* `volumeReason` saying why. A read-only call: it leaves every view
|
|
1401
1858
|
* valid.
|
|
1859
|
+
*
|
|
1860
|
+
* @deprecated Use `scene.inspect.measure()` instead.
|
|
1402
1861
|
*/
|
|
1403
1862
|
measure(mesh: MeshHandle): MeasureResult;
|
|
1404
1863
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
* `{ kind: "auto" }` runs the standard cleanup pipeline the same way and
|
|
1409
|
-
* returns a report per stage; see {@link AutoRepairRequest}.
|
|
1864
|
+
* Live triangle-used vertex ids of `mesh` inside the closed local-space
|
|
1865
|
+
* sphere `(center, radius)`, in ascending order. Brings a `"lazy"` BVH up
|
|
1866
|
+
* to date first; throws `STALE_BVH` on a stale `"manual"` mesh.
|
|
1410
1867
|
*
|
|
1411
|
-
* @
|
|
1868
|
+
* @deprecated Use `scene.sculpt.verticesInSphere()` instead.
|
|
1869
|
+
* @throws `UNKNOWN_MESH` for a removed handle; `INVALID_ARGUMENT` when
|
|
1870
|
+
* `center` is not 3 finite numbers or `radius` is negative or non-finite;
|
|
1871
|
+
* `STALE_BVH` for a stale `"manual"` mesh.
|
|
1412
1872
|
*/
|
|
1413
|
-
|
|
1414
|
-
repair<const O extends RepairOp>(mesh: MeshHandle, op: O): RepairReportOf<O>;
|
|
1415
|
-
repair<const O extends readonly RepairOp[]>(mesh: MeshHandle, ops: O): { -readonly [K in keyof O]: RepairReportOf<O[K]>; };
|
|
1873
|
+
verticesInSphere(mesh: MeshHandle, center: Readonly<Vec3>, radius: number): Uint32Array;
|
|
1416
1874
|
/**
|
|
1417
1875
|
* The nearest hit of a world ray over every mesh, or `null`. `direction`
|
|
1418
1876
|
* need not be unit length; `distance` is in world units. Lazy meshes are
|
|
1419
1877
|
* brought up to date first.
|
|
1420
1878
|
*
|
|
1879
|
+
* @deprecated Use `scene.inspect.raycast()` instead.
|
|
1421
1880
|
* @throws `INVALID_ARGUMENT` for a non-finite origin or a zero direction; `STALE_BVH` for a stale `"manual"` mesh.
|
|
1422
1881
|
*/
|
|
1423
1882
|
raycast(origin: Readonly<Vec3>, direction: Readonly<Vec3>, options?: RaycastOptions): RayHit | null;
|
|
1424
1883
|
/**
|
|
1425
1884
|
* The surface point nearest to a world point, over every mesh or one, or
|
|
1426
1885
|
* `null` when none is within `maxDistance`.
|
|
1886
|
+
*
|
|
1887
|
+
* @deprecated Use `scene.inspect.closestPoint()` instead.
|
|
1427
1888
|
*/
|
|
1428
1889
|
closestPoint(point: Readonly<Vec3>, options?: ClosestPointOptions): ClosestHit | null;
|
|
1429
1890
|
/**
|
|
1430
1891
|
* The distance between two meshes' surfaces as placed, with a closest pair
|
|
1431
1892
|
* of points, or `null` when it exceeds `maxDistance` (default `Infinity`)
|
|
1432
1893
|
* or a mesh has no triangle.
|
|
1894
|
+
*
|
|
1895
|
+
* @deprecated Use `scene.inspect.meshDistance()` instead.
|
|
1433
1896
|
*/
|
|
1434
1897
|
meshDistance(a: MeshHandle, b: MeshHandle, options?: {
|
|
1435
1898
|
maxDistance?: number;
|
|
1436
1899
|
}): MeshDistance | null;
|
|
1437
|
-
/**
|
|
1900
|
+
/**
|
|
1901
|
+
* Whether two meshes intersect or touch as placed.
|
|
1902
|
+
*
|
|
1903
|
+
* @deprecated Use `scene.inspect.intersects()` instead.
|
|
1904
|
+
*/
|
|
1438
1905
|
intersects(a: MeshHandle, b: MeshHandle): boolean;
|
|
1439
|
-
/**
|
|
1906
|
+
/**
|
|
1907
|
+
* Every mesh pair (or every pair of `pairs`) within `margin`, sorted by mesh id.
|
|
1908
|
+
*
|
|
1909
|
+
* @deprecated Use `scene.inspect.findContacts()` instead.
|
|
1910
|
+
*/
|
|
1440
1911
|
findContacts(options?: FindContactsOptions): Contact[];
|
|
1441
1912
|
/**
|
|
1442
1913
|
* Selects vertices of a mesh: a sphere brush, a lasso polygon, or the
|
|
@@ -1501,6 +1972,7 @@ declare class Scene implements SceneLike {
|
|
|
1501
1972
|
* edits and placements by the mesh modes, like normals. Removing a mesh of
|
|
1502
1973
|
* `to` removes it from the field, or the field with its last target.
|
|
1503
1974
|
*
|
|
1975
|
+
* @deprecated Use `scene.inspect.addDistanceField()` instead.
|
|
1504
1976
|
* @throws `INVALID_ARGUMENT` when `to` is empty, holds `on` or a mesh twice, `maxDistance` is negative or NaN, or the name is taken.
|
|
1505
1977
|
*/
|
|
1506
1978
|
addDistanceField(desc: DistanceFieldDesc): FieldHandle;
|
|
@@ -1511,6 +1983,7 @@ declare class Scene implements SceneLike {
|
|
|
1511
1983
|
* `maxDistance` read `Infinity`. It follows edits and placements by the
|
|
1512
1984
|
* mesh modes, like normals, and colours like any field.
|
|
1513
1985
|
*
|
|
1986
|
+
* @deprecated Use `scene.inspect.addThicknessField()` instead.
|
|
1514
1987
|
* @throws `INVALID_ARGUMENT` when `maxDistance` is negative or NaN, or the name is taken.
|
|
1515
1988
|
*/
|
|
1516
1989
|
addThicknessField(desc: ThicknessFieldDesc): FieldHandle;
|
|
@@ -1520,6 +1993,7 @@ declare class Scene implements SceneLike {
|
|
|
1520
1993
|
* negative in bowls, zero on flats). It follows edits and placements by
|
|
1521
1994
|
* the mesh modes, like normals, and colours like any field.
|
|
1522
1995
|
*
|
|
1996
|
+
* @deprecated Use `scene.inspect.addCurvatureField()` instead.
|
|
1523
1997
|
* @throws `INVALID_ARGUMENT` when the name is taken.
|
|
1524
1998
|
*/
|
|
1525
1999
|
addCurvatureField(desc: CurvatureFieldDesc): FieldHandle;
|
|
@@ -1605,11 +2079,403 @@ declare class Scene implements SceneLike {
|
|
|
1605
2079
|
*/
|
|
1606
2080
|
sectionGap(section: SectionHandle, a: MeshHandle, b: MeshHandle): SectionGap | null;
|
|
1607
2081
|
}
|
|
2082
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2083
|
+
type AlignReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2084
|
+
/** Low-level host backend used by {@link createAlignDomain}. */
|
|
2085
|
+
interface AlignBackend<Async extends boolean = false> {
|
|
2086
|
+
register(moving: MeshHandle, fixed: MeshHandle, options?: RegisterOptions): AlignReturn<Async, RegisterResult>;
|
|
2087
|
+
}
|
|
2088
|
+
/** Rigid registration and alignment domain (`scene.align.*`). */
|
|
2089
|
+
interface AlignDomain<Async extends boolean = false> {
|
|
2090
|
+
register(moving: MeshHandle, fixed: MeshHandle, options?: RegisterOptions): AlignReturn<Async, RegisterResult>;
|
|
2091
|
+
}
|
|
2092
|
+
/** Synchronous alignment domain exposed by `Scene.align`. */
|
|
2093
|
+
type SyncAlignDomain = AlignDomain<false>;
|
|
2094
|
+
/** Asynchronous alignment domain exposed by `WorkerScene.align`. */
|
|
2095
|
+
type WorkerAlignDomain = AlignDomain<true>;
|
|
2096
|
+
/** Builds an {@link AlignDomain} backed by `backend`. */
|
|
2097
|
+
declare function createAlignDomain<Async extends boolean>(backend: AlignBackend<Async>): AlignDomain<Async>;
|
|
2098
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2099
|
+
type BooleanReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2100
|
+
/** Options for {@link BooleanDomain.offset}. */
|
|
2101
|
+
type OffsetOptions = Omit<Extract<RepairOp, {
|
|
2102
|
+
op: "offset";
|
|
2103
|
+
}>, "op">;
|
|
2104
|
+
/** Options for {@link BooleanDomain.shell}. */
|
|
2105
|
+
type ShellOptions = Omit<Extract<RepairOp, {
|
|
2106
|
+
op: "shell";
|
|
2107
|
+
}>, "op">;
|
|
2108
|
+
/** Low-level host backend used by {@link createBooleanDomain}. */
|
|
2109
|
+
interface BooleanBackend<Async extends boolean = false> {
|
|
2110
|
+
readonly isAsync: Async;
|
|
2111
|
+
repair<const O extends RepairOp>(mesh: MeshHandle, op: O): BooleanReturn<Async, RepairReportOf<O>>;
|
|
2112
|
+
boolean?: (target: MeshHandle, source: MeshHandle, op: BooleanOp) => BooleanReturn<Async, MeshHandle>;
|
|
2113
|
+
cutByPlane?: (mesh: MeshHandle, plane: SectionPlane, options?: CutOptions) => BooleanReturn<Async, CutReport>;
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Callable boolean, cutting, offsetting, and shell solidification domain
|
|
2117
|
+
* (`scene.boolean(...)` and `scene.boolean.<method>(...)`).
|
|
2118
|
+
*/
|
|
2119
|
+
interface BooleanDomain<Async extends boolean = false> {
|
|
2120
|
+
(target: MeshHandle, source: MeshHandle, op: BooleanOp): BooleanReturn<Async, MeshHandle>;
|
|
2121
|
+
union(target: MeshHandle, source: MeshHandle): BooleanReturn<Async, MeshHandle>;
|
|
2122
|
+
difference(target: MeshHandle, source: MeshHandle): BooleanReturn<Async, MeshHandle>;
|
|
2123
|
+
subtract(target: MeshHandle, source: MeshHandle): BooleanReturn<Async, MeshHandle>;
|
|
2124
|
+
intersection(target: MeshHandle, source: MeshHandle): BooleanReturn<Async, MeshHandle>;
|
|
2125
|
+
intersect(target: MeshHandle, source: MeshHandle): BooleanReturn<Async, MeshHandle>;
|
|
2126
|
+
cut(mesh: MeshHandle, plane: SectionPlane, options?: CutOptions): BooleanReturn<Async, CutReport>;
|
|
2127
|
+
cutByPlane(mesh: MeshHandle, plane: SectionPlane, options?: CutOptions): BooleanReturn<Async, CutReport>;
|
|
2128
|
+
offset(mesh: MeshHandle, options: OffsetOptions): BooleanReturn<Async, OffsetReport>;
|
|
2129
|
+
shell(mesh: MeshHandle, thickness: number | ShellOptions): BooleanReturn<Async, ShellReport>;
|
|
2130
|
+
}
|
|
2131
|
+
/** Synchronous boolean domain exposed by `Scene.boolean`. */
|
|
2132
|
+
type SyncBooleanDomain = BooleanDomain<false>;
|
|
2133
|
+
/** Asynchronous boolean domain exposed by `WorkerScene.boolean`. */
|
|
2134
|
+
type WorkerBooleanDomain = BooleanDomain<true>;
|
|
2135
|
+
/** Builds a callable {@link BooleanDomain} backed by `backend`. */
|
|
2136
|
+
declare function createBooleanDomain<Async extends boolean>(backend: BooleanBackend<Async>): BooleanDomain<Async>;
|
|
2137
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2138
|
+
type SculptReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2139
|
+
type InflateOp = Omit<Extract<SculptOp, {
|
|
2140
|
+
op: "inflate";
|
|
2141
|
+
}>, "op">;
|
|
2142
|
+
type SmoothOp = Omit<Extract<SculptOp, {
|
|
2143
|
+
op: "smooth";
|
|
2144
|
+
}>, "op">;
|
|
2145
|
+
type RelaxOp = Omit<Extract<SculptOp, {
|
|
2146
|
+
op: "relax";
|
|
2147
|
+
}>, "op">;
|
|
2148
|
+
type GrabOp = Omit<Extract<SculptOp, {
|
|
2149
|
+
op: "grab";
|
|
2150
|
+
}>, "op">;
|
|
2151
|
+
type FlattenOp = Omit<Extract<SculptOp, {
|
|
2152
|
+
op: "flatten";
|
|
2153
|
+
}>, "op">;
|
|
2154
|
+
type CreaseOp = Omit<Extract<SculptOp, {
|
|
2155
|
+
op: "crease";
|
|
2156
|
+
}>, "op">;
|
|
2157
|
+
type ClayOp = Omit<Extract<SculptOp, {
|
|
2158
|
+
op: "clay";
|
|
2159
|
+
}>, "op">;
|
|
2160
|
+
type TwistOp = Omit<Extract<SculptOp, {
|
|
2161
|
+
op: "twist";
|
|
2162
|
+
}>, "op">;
|
|
2163
|
+
type CaptureStrokeOptions = Omit<Extract<SculptOp, {
|
|
2164
|
+
op: "captureStrokeState";
|
|
2165
|
+
}>, "op">;
|
|
2166
|
+
type CaptureRestOptions = Omit<Extract<SculptOp, {
|
|
2167
|
+
op: "captureRestSizes";
|
|
2168
|
+
}>, "op">;
|
|
2169
|
+
type SplitStretchedOptions = Omit<Extract<SculptOp, {
|
|
2170
|
+
op: "splitStretched";
|
|
2171
|
+
}>, "op">;
|
|
2172
|
+
/** Options for {@link SculptDomain.beginStroke}. */
|
|
2173
|
+
interface BeginStrokeOptions {
|
|
2174
|
+
/** Keep an already active stroke snapshot on the mesh (`false` by default). */
|
|
2175
|
+
onlyIfMissing?: boolean;
|
|
2176
|
+
/** Also capture per-vertex rest edge sizes for dynamic `splitStretched`. */
|
|
2177
|
+
captureRestSizes?: boolean;
|
|
2178
|
+
/** Wrap stroke dabs inside a single history step when supported (`true` by default). */
|
|
2179
|
+
groupStep?: boolean;
|
|
2180
|
+
}
|
|
2181
|
+
/** Sculpt operations that support composable per-vertex surface filters. */
|
|
2182
|
+
type FilteredSculptOp = Extract<SculptOp, {
|
|
2183
|
+
filter?: SurfaceFilter;
|
|
2184
|
+
}>;
|
|
2185
|
+
/** Low-level host backend used by {@link createSculptDomain}. */
|
|
2186
|
+
interface SculptBackend<Async extends boolean = false> {
|
|
2187
|
+
sculpt<const O extends SculptOp>(mesh: MeshHandle, op: O): SculptReturn<Async, SculptReportOf<O>>;
|
|
2188
|
+
sculpt<const O extends readonly SculptOp[]>(mesh: MeshHandle, ops: O): SculptReturn<Async, { -readonly [K in keyof O]: SculptReportOf<O[K]>; }>;
|
|
2189
|
+
verticesInSphere(mesh: MeshHandle, center: Readonly<Vec3>, radius: number): SculptReturn<Async, Uint32Array>;
|
|
2190
|
+
beginStep?: () => void;
|
|
2191
|
+
endStep?: () => void;
|
|
2192
|
+
cancelStep?: () => void;
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Callable sculpt domain namespace (`scene.sculpt(...)` and `scene.sculpt.<method>(...)`).
|
|
2196
|
+
*
|
|
2197
|
+
* Preserves legacy `sculpt(mesh, op | ops)` call signatures while exposing
|
|
2198
|
+
* stroke lifecycle, surface filter helpers, brush shorthands, and dynamic
|
|
2199
|
+
* topology subdivision.
|
|
2200
|
+
*/
|
|
2201
|
+
interface SculptDomain<Async extends boolean = false> {
|
|
2202
|
+
<const O extends SculptOp>(mesh: MeshHandle, op: O): SculptReturn<Async, SculptReportOf<O>>;
|
|
2203
|
+
<const O extends readonly SculptOp[]>(mesh: MeshHandle, ops: O): SculptReturn<Async, { -readonly [K in keyof O]: SculptReportOf<O[K]>; }>;
|
|
2204
|
+
beginStroke(mesh: MeshHandle, options?: BeginStrokeOptions): SculptReturn<Async, CaptureStrokeReport>;
|
|
2205
|
+
dab<const O extends SculptOp>(mesh: MeshHandle, op: O): SculptReturn<Async, SculptReportOf<O>>;
|
|
2206
|
+
dab<const O extends readonly SculptOp[]>(mesh: MeshHandle, ops: O): SculptReturn<Async, { -readonly [K in keyof O]: SculptReportOf<O[K]>; }>;
|
|
2207
|
+
endStroke(): void;
|
|
2208
|
+
cancelStroke(): void;
|
|
2209
|
+
filter<T extends FilteredSculptOp>(op: T, surfaceFilter: SurfaceFilter): T & {
|
|
2210
|
+
filter: SurfaceFilter;
|
|
2211
|
+
};
|
|
2212
|
+
filter<const O extends FilteredSculptOp>(mesh: MeshHandle, op: O, surfaceFilter: SurfaceFilter): SculptReturn<Async, SculptReportOf<O>>;
|
|
2213
|
+
inflate(mesh: MeshHandle, op: InflateOp): SculptReturn<Async, InflateReport>;
|
|
2214
|
+
smooth(mesh: MeshHandle, op: SmoothOp): SculptReturn<Async, SmoothReport>;
|
|
2215
|
+
relax(mesh: MeshHandle, op: RelaxOp): SculptReturn<Async, RelaxReport>;
|
|
2216
|
+
grab(mesh: MeshHandle, op: GrabOp): SculptReturn<Async, GrabReport>;
|
|
2217
|
+
flatten(mesh: MeshHandle, op: FlattenOp): SculptReturn<Async, FlattenReport>;
|
|
2218
|
+
crease(mesh: MeshHandle, op: CreaseOp): SculptReturn<Async, CreaseReport>;
|
|
2219
|
+
clay(mesh: MeshHandle, op: ClayOp): SculptReturn<Async, ClayReport>;
|
|
2220
|
+
twist(mesh: MeshHandle, op: TwistOp): SculptReturn<Async, TwistReport>;
|
|
2221
|
+
captureStrokeState(mesh: MeshHandle, options?: CaptureStrokeOptions): SculptReturn<Async, CaptureStrokeReport>;
|
|
2222
|
+
captureRestSizes(mesh: MeshHandle, options?: CaptureRestOptions): SculptReturn<Async, CaptureRestReport>;
|
|
2223
|
+
splitStretched(mesh: MeshHandle, op: SplitStretchedOptions): SculptReturn<Async, StretchReport>;
|
|
2224
|
+
verticesInSphere(mesh: MeshHandle, center: Readonly<Vec3>, radius: number): SculptReturn<Async, Uint32Array>;
|
|
2225
|
+
}
|
|
2226
|
+
/** Synchronous sculpt domain exposed by `Scene.sculpt`. */
|
|
2227
|
+
type SyncSculptDomain = SculptDomain<false>;
|
|
2228
|
+
/** Asynchronous sculpt domain exposed by `WorkerScene.sculpt`. */
|
|
2229
|
+
type WorkerSculptDomain = SculptDomain<true>;
|
|
2230
|
+
/** Builds a callable {@link SculptDomain} backed by `backend`. */
|
|
2231
|
+
declare function createSculptDomain<Async extends boolean>(backend: SculptBackend<Async>): SculptDomain<Async>;
|
|
2232
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2233
|
+
type DeformReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2234
|
+
/** Deformation operations supporting per-vertex protection weights and geodesic falloff bands. */
|
|
2235
|
+
type ProtectedSculptOp = Extract<SculptOp, {
|
|
2236
|
+
protect?: VertexProtection;
|
|
2237
|
+
}>;
|
|
2238
|
+
/** Low-level host backend used by {@link createDeformDomain}. */
|
|
2239
|
+
interface DeformBackend<Async extends boolean = false> {
|
|
2240
|
+
sculpt<const O extends SculptOp>(mesh: MeshHandle, op: O): DeformReturn<Async, SculptReportOf<O>>;
|
|
2241
|
+
}
|
|
2242
|
+
/** Surface deformation and vertex-protection domain. */
|
|
2243
|
+
interface DeformDomain<Async extends boolean = false> {
|
|
2244
|
+
inflate(mesh: MeshHandle, op: InflateOp): DeformReturn<Async, InflateReport>;
|
|
2245
|
+
smooth(mesh: MeshHandle, op: SmoothOp): DeformReturn<Async, SmoothReport>;
|
|
2246
|
+
relax(mesh: MeshHandle, op: RelaxOp): DeformReturn<Async, RelaxReport>;
|
|
2247
|
+
relaxed(mesh: MeshHandle, op: RelaxOp): DeformReturn<Async, RelaxReport>;
|
|
2248
|
+
grab(mesh: MeshHandle, op: GrabOp): DeformReturn<Async, GrabReport>;
|
|
2249
|
+
flatten(mesh: MeshHandle, op: FlattenOp): DeformReturn<Async, FlattenReport>;
|
|
2250
|
+
crease(mesh: MeshHandle, op: CreaseOp): DeformReturn<Async, CreaseReport>;
|
|
2251
|
+
clay(mesh: MeshHandle, op: ClayOp): DeformReturn<Async, ClayReport>;
|
|
2252
|
+
twist(mesh: MeshHandle, op: TwistOp): DeformReturn<Async, TwistReport>;
|
|
2253
|
+
protect<T extends ProtectedSculptOp>(op: T, protection: VertexProtection): T & {
|
|
2254
|
+
protect: VertexProtection;
|
|
2255
|
+
};
|
|
2256
|
+
protect<const O extends ProtectedSculptOp>(mesh: MeshHandle, op: O, protection: VertexProtection): DeformReturn<Async, SculptReportOf<O>>;
|
|
2257
|
+
}
|
|
2258
|
+
/** Synchronous deformation domain exposed by `Scene.deform`. */
|
|
2259
|
+
type SyncDeformDomain = DeformDomain<false>;
|
|
2260
|
+
/** Asynchronous deformation domain exposed by `WorkerScene.deform`. */
|
|
2261
|
+
type WorkerDeformDomain = DeformDomain<true>;
|
|
2262
|
+
/** Builds a {@link DeformDomain} backed by `backend`. */
|
|
2263
|
+
declare function createDeformDomain<Async extends boolean>(backend: DeformBackend<Async>): DeformDomain<Async>;
|
|
2264
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2265
|
+
type InspectReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2266
|
+
/** Low-level host backend used by {@link createInspectDomain}. */
|
|
2267
|
+
interface InspectBackend<Async extends boolean = false> {
|
|
2268
|
+
analyze(mesh: MeshHandle, options?: AnalyzeOptions): InspectReturn<Async, Analysis>;
|
|
2269
|
+
measure(mesh: MeshHandle): InspectReturn<Async, MeasureResult>;
|
|
2270
|
+
bounds(mesh: MeshHandle): Bounds | null;
|
|
2271
|
+
raycast(origin: Readonly<Vec3>, direction: Readonly<Vec3>, options?: RaycastOptions): InspectReturn<Async, RayHit | null>;
|
|
2272
|
+
closestPoint(point: Readonly<Vec3>, options?: ClosestPointOptions): InspectReturn<Async, ClosestHit | null>;
|
|
2273
|
+
meshDistance(a: MeshHandle, b: MeshHandle, options?: {
|
|
2274
|
+
maxDistance?: number;
|
|
2275
|
+
}): InspectReturn<Async, MeshDistance | null>;
|
|
2276
|
+
intersects(a: MeshHandle, b: MeshHandle): InspectReturn<Async, boolean>;
|
|
2277
|
+
findContacts(options?: FindContactsOptions): InspectReturn<Async, Contact[]>;
|
|
2278
|
+
addDistanceField(desc: DistanceFieldDesc): FieldHandle;
|
|
2279
|
+
addThicknessField?: (desc: ThicknessFieldDesc) => FieldHandle;
|
|
2280
|
+
addCurvatureField?: (desc: CurvatureFieldDesc) => FieldHandle;
|
|
2281
|
+
removeField(field: FieldHandle): void;
|
|
2282
|
+
fieldValues(field: FieldHandle): InspectReturn<Async, Float32Array>;
|
|
2283
|
+
fieldNearest(field: FieldHandle): InspectReturn<Async, Uint32Array>;
|
|
2284
|
+
fieldStatus(field: FieldHandle): InspectReturn<Async, FieldStatus>;
|
|
2285
|
+
fieldTargetStatus(field: FieldHandle): InspectReturn<Async, FieldStatus["sign"][]>;
|
|
2286
|
+
setColoring(mesh: MeshHandle, rule: ColorRule | null): void;
|
|
2287
|
+
coloring(mesh: MeshHandle): ColorRule | null;
|
|
2288
|
+
addSection(desc: SectionDesc): SectionHandle;
|
|
2289
|
+
setSectionPlane(section: SectionHandle, plane: SectionPlane): void;
|
|
2290
|
+
sectionPlane(section: SectionHandle): SectionPlane;
|
|
2291
|
+
setSectionMeshes(section: SectionHandle, meshes: readonly MeshHandle[]): void;
|
|
2292
|
+
setSectionFill(section: SectionHandle, fill: boolean): void;
|
|
2293
|
+
removeSection(section: SectionHandle): void;
|
|
2294
|
+
section(section: SectionHandle, mesh: MeshHandle): SectionResult;
|
|
2295
|
+
sectionGap(section: SectionHandle, a: MeshHandle, b: MeshHandle): InspectReturn<Async, SectionGap | null>;
|
|
2296
|
+
updateSections?: () => void;
|
|
2297
|
+
}
|
|
2298
|
+
/** Metrology, defect analysis, raycasting, distance/thickness/curvature fields, and cross-section inspection domain. */
|
|
2299
|
+
interface InspectDomain<Async extends boolean = false> {
|
|
2300
|
+
analyze(mesh: MeshHandle, options?: AnalyzeOptions): InspectReturn<Async, Analysis>;
|
|
2301
|
+
measure(mesh: MeshHandle): InspectReturn<Async, MeasureResult>;
|
|
2302
|
+
bounds(mesh: MeshHandle): Bounds | null;
|
|
2303
|
+
raycast(origin: Readonly<Vec3>, direction: Readonly<Vec3>, options?: RaycastOptions): InspectReturn<Async, RayHit | null>;
|
|
2304
|
+
closestPoint(point: Readonly<Vec3>, options?: ClosestPointOptions): InspectReturn<Async, ClosestHit | null>;
|
|
2305
|
+
meshDistance(a: MeshHandle, b: MeshHandle, options?: {
|
|
2306
|
+
maxDistance?: number;
|
|
2307
|
+
}): InspectReturn<Async, MeshDistance | null>;
|
|
2308
|
+
intersects(a: MeshHandle, b: MeshHandle): InspectReturn<Async, boolean>;
|
|
2309
|
+
findContacts(options?: FindContactsOptions): InspectReturn<Async, Contact[]>;
|
|
2310
|
+
addDistanceField(desc: DistanceFieldDesc): FieldHandle;
|
|
2311
|
+
addThicknessField(desc: ThicknessFieldDesc): FieldHandle;
|
|
2312
|
+
addCurvatureField(desc: CurvatureFieldDesc): FieldHandle;
|
|
2313
|
+
removeField(field: FieldHandle): void;
|
|
2314
|
+
fieldValues(field: FieldHandle): InspectReturn<Async, Float32Array>;
|
|
2315
|
+
fieldNearest(field: FieldHandle): InspectReturn<Async, Uint32Array>;
|
|
2316
|
+
fieldStatus(field: FieldHandle): InspectReturn<Async, FieldStatus>;
|
|
2317
|
+
fieldTargetStatus(field: FieldHandle): InspectReturn<Async, FieldStatus["sign"][]>;
|
|
2318
|
+
setColoring(mesh: MeshHandle, rule: ColorRule | null): void;
|
|
2319
|
+
coloring(mesh: MeshHandle): ColorRule | null;
|
|
2320
|
+
addSection(desc: SectionDesc): SectionHandle;
|
|
2321
|
+
setSectionPlane(section: SectionHandle, plane: SectionPlane): void;
|
|
2322
|
+
sectionPlane(section: SectionHandle): SectionPlane;
|
|
2323
|
+
setSectionMeshes(section: SectionHandle, meshes: readonly MeshHandle[]): void;
|
|
2324
|
+
setSectionFill(section: SectionHandle, fill: boolean): void;
|
|
2325
|
+
removeSection(section: SectionHandle): void;
|
|
2326
|
+
section(section: SectionHandle, mesh: MeshHandle): SectionResult;
|
|
2327
|
+
sectionGap(section: SectionHandle, a: MeshHandle, b: MeshHandle): InspectReturn<Async, SectionGap | null>;
|
|
2328
|
+
updateSections(): void;
|
|
2329
|
+
}
|
|
2330
|
+
/** Synchronous inspect domain exposed by `Scene.inspect`. */
|
|
2331
|
+
type SyncInspectDomain = InspectDomain<false>;
|
|
2332
|
+
/** Asynchronous inspect domain exposed by `WorkerScene.inspect`. */
|
|
2333
|
+
type WorkerInspectDomain = InspectDomain<true>;
|
|
2334
|
+
/** Builds an {@link InspectDomain} backed by `backend`. */
|
|
2335
|
+
declare function createInspectDomain<Async extends boolean>(backend: InspectBackend<Async>): InspectDomain<Async>;
|
|
2336
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2337
|
+
type RemeshReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2338
|
+
/** Options for {@link RemeshDomain.region} / {@link RemeshDomain.remesh}. */
|
|
2339
|
+
type RegionRemeshOptions = Omit<Extract<RepairOp, {
|
|
2340
|
+
op: "remesh";
|
|
2341
|
+
}>, "op">;
|
|
2342
|
+
/** Options for {@link RemeshDomain.simplify}. */
|
|
2343
|
+
type SimplifyOptions = Omit<Extract<RepairOp, {
|
|
2344
|
+
op: "simplify";
|
|
2345
|
+
}>, "op">;
|
|
2346
|
+
/** Options for {@link RemeshDomain.subdivide}. */
|
|
2347
|
+
type SubdivideOptions = Omit<Extract<RepairOp, {
|
|
2348
|
+
op: "subdivide";
|
|
2349
|
+
}>, "op">;
|
|
2350
|
+
/** Options for {@link RemeshDomain.voxel}. */
|
|
2351
|
+
interface VoxelRemeshOptions {
|
|
2352
|
+
/** Volumetric reconstruction backend (`"fhEdt"` by default). */
|
|
2353
|
+
algorithm?: Exclude<OffsetAlgorithm, "normal">;
|
|
2354
|
+
/** Grid voxel size in local mesh units (automatic when omitted). */
|
|
2355
|
+
voxelSize?: number;
|
|
2356
|
+
/** Maximum 3D grid voxel count (`>= 64`, defaults to `16_777_216`). */
|
|
2357
|
+
maxVoxels?: number;
|
|
2358
|
+
}
|
|
2359
|
+
/** Low-level host backend used by {@link createRemeshDomain}. */
|
|
2360
|
+
interface RemeshBackend<Async extends boolean = false> {
|
|
2361
|
+
repair<const O extends RepairOp>(mesh: MeshHandle, op: O): RemeshReturn<Async, RepairReportOf<O>>;
|
|
2362
|
+
}
|
|
2363
|
+
/** Remesh, simplification, subdivision, and volumetric reconstruction domain. */
|
|
2364
|
+
interface RemeshDomain<Async extends boolean = false> {
|
|
2365
|
+
remesh(mesh: MeshHandle, options: RegionRemeshOptions): RemeshReturn<Async, RemeshReport>;
|
|
2366
|
+
region(mesh: MeshHandle, options: RegionRemeshOptions): RemeshReturn<Async, RemeshReport>;
|
|
2367
|
+
simplify(mesh: MeshHandle, options: SimplifyOptions): RemeshReturn<Async, SimplifyReport>;
|
|
2368
|
+
subdivide(mesh: MeshHandle, options?: SubdivideOptions): RemeshReturn<Async, SubdivideReport>;
|
|
2369
|
+
voxel(mesh: MeshHandle, options?: VoxelRemeshOptions): RemeshReturn<Async, OffsetReport>;
|
|
2370
|
+
}
|
|
2371
|
+
/** Synchronous remesh domain exposed by `Scene.remesh`. */
|
|
2372
|
+
type SyncRemeshDomain = RemeshDomain<false>;
|
|
2373
|
+
/** Asynchronous remesh domain exposed by `WorkerScene.remesh`. */
|
|
2374
|
+
type WorkerRemeshDomain = RemeshDomain<true>;
|
|
2375
|
+
/** Builds a {@link RemeshDomain} backed by `backend`. */
|
|
2376
|
+
declare function createRemeshDomain<Async extends boolean>(backend: RemeshBackend<Async>): RemeshDomain<Async>;
|
|
2377
|
+
/** Return type parameterized over synchronous (`Scene`) vs worker (`WorkerScene`) hosts. */
|
|
2378
|
+
type RepairReturn<Async extends boolean, T> = Async extends true ? Promise<T> : T;
|
|
2379
|
+
/** Options for {@link RepairDomain.autoRepair} (`AutoRepairRequest` without `kind`). */
|
|
2380
|
+
type AutoRepairOptions = Omit<AutoRepairRequest, "kind">;
|
|
2381
|
+
/** Options for {@link RepairDomain.removeDegenerate}. */
|
|
2382
|
+
type DegenerateOptions = Omit<Extract<RepairOp, {
|
|
2383
|
+
op: "removeDegenerate";
|
|
2384
|
+
}>, "op">;
|
|
2385
|
+
/** Options for {@link RepairDomain.removeSmallComponents}. */
|
|
2386
|
+
type SmallComponentOptions = Omit<Extract<RepairOp, {
|
|
2387
|
+
op: "removeSmallComponents";
|
|
2388
|
+
}>, "op">;
|
|
2389
|
+
/** Options for {@link RepairDomain.fillHoles}. */
|
|
2390
|
+
type FillHolesOptions = Omit<Extract<RepairOp, {
|
|
2391
|
+
op: "fillHoles";
|
|
2392
|
+
}>, "op">;
|
|
2393
|
+
/** Options for {@link RepairDomain.bridge}. */
|
|
2394
|
+
type BridgeLoopsOptions = Omit<Extract<RepairOp, {
|
|
2395
|
+
op: "bridgeLoops";
|
|
2396
|
+
}>, "op">;
|
|
2397
|
+
/** Options for {@link RepairDomain.clean}. */
|
|
2398
|
+
interface CleanOptions {
|
|
2399
|
+
areaEpsilon?: number;
|
|
2400
|
+
removeUnusedVertices?: boolean;
|
|
2401
|
+
minTriangles?: number;
|
|
2402
|
+
minArea?: number;
|
|
2403
|
+
keepLargest?: boolean;
|
|
2404
|
+
}
|
|
2405
|
+
/** Combined report returned by {@link RepairDomain.clean}. */
|
|
2406
|
+
interface CleanReport {
|
|
2407
|
+
degenerate: DegenerateReport;
|
|
2408
|
+
components: RemoveReport;
|
|
2409
|
+
}
|
|
2410
|
+
/** Low-level host backend used by {@link createRepairDomain}. */
|
|
2411
|
+
interface RepairBackend<Async extends boolean = false> {
|
|
2412
|
+
repair(mesh: MeshHandle, request: AutoRepairRequest): RepairReturn<Async, AutoRepairReport>;
|
|
2413
|
+
repair<const O extends RepairOp>(mesh: MeshHandle, op: O): RepairReturn<Async, RepairReportOf<O>>;
|
|
2414
|
+
repair<const O extends readonly RepairOp[]>(mesh: MeshHandle, ops: O): RepairReturn<Async, { -readonly [K in keyof O]: RepairReportOf<O[K]>; }>;
|
|
2415
|
+
analyze(mesh: MeshHandle, options?: AnalyzeOptions): RepairReturn<Async, Analysis>;
|
|
2416
|
+
join(target: MeshHandle, source: MeshHandle, options: JoinOptions): RepairReturn<Async, JoinReport>;
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Callable repair domain namespace (`scene.repair(...)` and `scene.repair.<method>(...)`).
|
|
2420
|
+
*
|
|
2421
|
+
* Preserves legacy `repair(mesh, op | ops | request)` call signatures while
|
|
2422
|
+
* organizing repair operations cleanly under `scene.repair.*`.
|
|
2423
|
+
*/
|
|
2424
|
+
interface RepairDomain<Async extends boolean = false> {
|
|
2425
|
+
(mesh: MeshHandle, request: AutoRepairRequest): RepairReturn<Async, AutoRepairReport>;
|
|
2426
|
+
<const O extends RepairOp>(mesh: MeshHandle, op: O): RepairReturn<Async, RepairReportOf<O>>;
|
|
2427
|
+
<const O extends readonly RepairOp[]>(mesh: MeshHandle, ops: O): RepairReturn<Async, { -readonly [K in keyof O]: RepairReportOf<O[K]>; }>;
|
|
2428
|
+
analyze(mesh: MeshHandle, options?: AnalyzeOptions): RepairReturn<Async, Analysis>;
|
|
2429
|
+
autoRepair(mesh: MeshHandle, options?: AutoRepairOptions): RepairReturn<Async, AutoRepairReport>;
|
|
2430
|
+
clean(mesh: MeshHandle, options?: CleanOptions): RepairReturn<Async, CleanReport>;
|
|
2431
|
+
weld(mesh: MeshHandle, tolerance: number): RepairReturn<Async, WeldReport>;
|
|
2432
|
+
removeDegenerate(mesh: MeshHandle, options?: DegenerateOptions): RepairReturn<Async, DegenerateReport>;
|
|
2433
|
+
removeSmallComponents(mesh: MeshHandle, options?: SmallComponentOptions): RepairReturn<Async, RemoveReport>;
|
|
2434
|
+
orient(mesh: MeshHandle): RepairReturn<Async, OrientReport>;
|
|
2435
|
+
fillHoles(mesh: MeshHandle, options?: FillHolesOptions): RepairReturn<Async, FillReport>;
|
|
2436
|
+
bridge(mesh: MeshHandle, options: BridgeLoopsOptions): RepairReturn<Async, BridgeReport>;
|
|
2437
|
+
bridgeLoops(mesh: MeshHandle, options: BridgeLoopsOptions): RepairReturn<Async, BridgeReport>;
|
|
2438
|
+
join(target: MeshHandle, source: MeshHandle, options: JoinOptions): RepairReturn<Async, JoinReport>;
|
|
2439
|
+
makeManifold(mesh: MeshHandle, options?: ManifoldOptions): RepairReturn<Async, ManifoldReport>;
|
|
2440
|
+
resolveSelfIntersections(mesh: MeshHandle, options?: SelfIntersectOptions): RepairReturn<Async, SelfIntersectReport>;
|
|
2441
|
+
cleanupSlivers(mesh: MeshHandle, options?: SliverOptions): RepairReturn<Async, SliverReport>;
|
|
2442
|
+
}
|
|
2443
|
+
/** Synchronous repair domain exposed by `Scene.repair`. */
|
|
2444
|
+
type SyncRepairDomain = RepairDomain<false>;
|
|
2445
|
+
/** Asynchronous repair domain exposed by `WorkerScene.repair`. */
|
|
2446
|
+
type WorkerRepairDomain = RepairDomain<true>;
|
|
2447
|
+
/** Builds a callable {@link RepairDomain} backed by `backend`. */
|
|
2448
|
+
declare function createRepairDomain<Async extends boolean>(backend: RepairBackend<Async>): RepairDomain<Async>;
|
|
2449
|
+
/** Complete seven-domain API surface shared by `Scene` and `WorkerScene`. */
|
|
2450
|
+
interface SceneDomains<Async extends boolean = false> {
|
|
2451
|
+
readonly repair: RepairDomain<Async>;
|
|
2452
|
+
readonly sculpt: SculptDomain<Async>;
|
|
2453
|
+
readonly remesh: RemeshDomain<Async>;
|
|
2454
|
+
readonly boolean: BooleanDomain<Async>;
|
|
2455
|
+
readonly deform: DeformDomain<Async>;
|
|
2456
|
+
readonly inspect: InspectDomain<Async>;
|
|
2457
|
+
readonly align: AlignDomain<Async>;
|
|
2458
|
+
}
|
|
2459
|
+
/** Synchronous seven-domain surface implemented by `Scene`. */
|
|
2460
|
+
type SyncSceneDomains = SceneDomains<false>;
|
|
2461
|
+
/** Asynchronous seven-domain surface implemented by `WorkerScene`. */
|
|
2462
|
+
type WorkerSceneDomains = SceneDomains<true>;
|
|
2463
|
+
/** Domain-separated capability surface exposed by both `Scene` and `WorkerScene`. */
|
|
2464
|
+
interface SceneDomainsLike {
|
|
2465
|
+
readonly repair?: SyncRepairDomain | WorkerRepairDomain;
|
|
2466
|
+
readonly sculpt?: SyncSculptDomain | WorkerSculptDomain;
|
|
2467
|
+
readonly remesh?: SyncRemeshDomain | WorkerRemeshDomain;
|
|
2468
|
+
readonly boolean?: SyncBooleanDomain | WorkerBooleanDomain;
|
|
2469
|
+
readonly deform?: SyncDeformDomain | WorkerDeformDomain;
|
|
2470
|
+
readonly inspect?: SyncInspectDomain | WorkerInspectDomain;
|
|
2471
|
+
readonly align?: SyncAlignDomain | WorkerAlignDomain;
|
|
2472
|
+
}
|
|
1608
2473
|
/**
|
|
1609
2474
|
* What the adapters need from a scene: render buffers, placements, section
|
|
1610
2475
|
* results, change notification and drags. All methods are synchronous.
|
|
2476
|
+
* `Scene` and `WorkerScene` also attach the seven optional domain namespaces.
|
|
1611
2477
|
*/
|
|
1612
|
-
interface SceneLike {
|
|
2478
|
+
interface SceneLike extends SceneDomainsLike {
|
|
1613
2479
|
/**
|
|
1614
2480
|
* Views of the mesh's render buffers. Slot counts follow from them, so
|
|
1615
2481
|
* `positions()` must be exactly 3 × vertex slots long and `indices()`
|
|
@@ -1642,4 +2508,4 @@ interface SceneLike {
|
|
|
1642
2508
|
*/
|
|
1643
2509
|
bounds?(mesh: MeshHandle): Bounds | null;
|
|
1644
2510
|
}
|
|
1645
|
-
export {
|
|
2511
|
+
export { SculptDomain as $, StretchReport as $n, FindContactsOptions as $t, InspectDomain as A, RepairReport as An, Vec3 as Ar, CaptureRestReport as At, WorkerDeformDomain as B, SectionGap as Bn, CurvatureFieldDesc as Bt, SimplifyOptions as C, RegisterOptions as Cn, Mat3 as Cr, AnalyzeOptions as Ct, WorkerRemeshDomain as D, RemeshReport as Dn, Positions64 as Dr, BooleanOp as Dt, VoxelRemeshOptions as E, RelaxReport as En, Positions as Er, AutoRepairRequest as Et, DeformBackend as F, SculptOp as Fn, ClosestPointOptions as Ft, ClayOp as G, SelfIntersectionMode as Gn, DragOptions as Gt, BeginStrokeOptions as H, SectionResult as Hn, CutReport as Ht, DeformDomain as I, SculptReport as In, ColorRule as It, FlattenOp as J, SimplifyReport as Jn, EditRef as Jt, CreaseOp as K, ShellReport as Kn, DragSession as Kt, DeformReturn as L, SculptReportOf as Ln, Colormap as Lt, SyncInspectDomain as M, Rgba as Mn, computeVertexNormals as Mr, ClayProfile as Mt, WorkerInspectDomain as N, Scene as Nn, ClayReport as Nt, createRemeshDomain as O, RemoveReport as On, Quat as Or, BoundaryLoop as Ot, createInspectDomain as P, SceneOptions as Pn, ClosestHit as Pt, SculptBackend as Q, SmoothReport as Qn, FilledLoop as Qt, ProtectedSculptOp as R, SectionContour as Rn, Contact as Rt, RemeshReturn as S, RegisterNotApplied as Sn, InitInput as Sr, Analysis as St, SyncRemeshDomain as T, RegisterStatus as Tn, PlacementInput as Tr, AutoRepairReport as Tt, CaptureRestOptions as U, SelfIntersectOptions as Un, DegenerateReport as Ut, createDeformDomain as V, SectionPlane as Vn, CutOptions as Vt, CaptureStrokeOptions as W, SelfIntersectReport as Wn, DistanceFieldDesc as Wt, InflateOp as X, SliverReport as Xn, FieldStatus as Xt, GrabOp as Y, SliverOptions as Yn, EditResult as Yt, RelaxOp as Z, SmoothMethod as Zn, FillReport as Zt, WorkerRepairDomain as _, OrientReport as _n, FieldHandle as _r, AlignReturn as _t, WorkerSceneDomains as a, InflateReport as an, TwistReport as ar, WorkerSculptDomain as at, RemeshBackend as b, RaycastOptions as bn, Bounds as br, createAlignDomain as bt, CleanOptions as c, LoopId as cn, MeshViews as cr, BooleanDomain as ct, FillHolesOptions as d, MeasureResult as dn, ComponentSelect as dr, ShellOptions as dt, FlattenMode as en, SubdivideReport as er, SculptReturn as et, RepairBackend as f, MeshChange as fn, IsolateReport as fr, SyncBooleanDomain as ft, SyncRepairDomain as g, OffsetReport as gn, Range as gr, AlignDomain as gt, SmallComponentOptions as h, OffsetAlgorithm as hn, VertexSelection as hr, AlignBackend as ht, SyncSceneDomains as i, InflateMethod as in, TwistMethod as ir, TwistOp as it, InspectReturn as j, RepairReportOf as jn, computeBounds as jr, CaptureStrokeReport as jt, InspectBackend as k, RepairOp as kn, UpdateMode as kr, BridgeReport as kt, CleanReport as l, ManifoldOptions as ln, SceneMeshViews as lr, BooleanReturn as lt, RepairReturn as m, MeshDistance as mn, SelectSpec as mr, createBooleanDomain as mt, SceneLike as n, GrabMethod as nn, Symmetry as nr, SplitStretchedOptions as nt, AutoRepairOptions as o, JoinOptions as on, VertexProtection as or, createSculptDomain as ot, RepairDomain as p, MeshComponent as pn, LassoSelect as pr, WorkerBooleanDomain as pt, FilteredSculptOp as q, SignMode as qn, EditOp as qt, SceneDomains as r, GrabReport as rn, ThicknessFieldDesc as rr, SyncSculptDomain as rt, BridgeLoopsOptions as s, JoinReport as sn, WeldReport as sr, BooleanBackend as st, SceneDomainsLike as t, FlattenReport as tn, SurfaceFilter as tr, SmoothOp as tt, DegenerateOptions as u, ManifoldReport as un, BrushSelect as ur, OffsetOptions as ut, createRepairDomain as v, OutOfRange as vn, MeshHandle as vr, SyncAlignDomain as vt, SubdivideOptions as w, RegisterResult as wn, Placement as wr, AutoRepairPreset as wt, RemeshDomain as x, RegisterMotion as xn, Indices as xr, AddMeshOptions as xt, RegionRemeshOptions as y, RayHit as yn, SectionHandle as yr, WorkerAlignDomain as yt, SyncDeformDomain as z, SectionDesc as zn, CreaseReport as zt };
|