okgeometry-api 1.18.0 → 1.20.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/dist/Mesh.d.ts +20 -0
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +29 -0
- package/dist/Mesh.js.map +1 -1
- package/dist/SculptSession.d.ts +26 -0
- package/dist/SculptSession.d.ts.map +1 -1
- package/dist/SculptSession.js +37 -0
- package/dist/SculptSession.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/dist/wasm-bindings.d.ts +50 -0
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +92 -0
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +59 -59
- package/src/Mesh.ts +3852 -3810
- package/src/SculptSession.ts +377 -337
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +38 -0
- package/src/wasm-bindings.js +99 -0
package/src/wasm-bindings.d.ts
CHANGED
|
@@ -923,6 +923,15 @@ export function mesh_polyline_intersection_points(vertex_count: number, buffer:
|
|
|
923
923
|
*/
|
|
924
924
|
export function mesh_prepare_boolean_cutter_curve(coords: Float64Array, closed: boolean, nx: number, ny: number, nz: number, height: number): Float64Array;
|
|
925
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Host-aware boolean cutter preparation: like
|
|
928
|
+
* `mesh_prepare_boolean_cutter_curve`, but the bias is raised past the
|
|
929
|
+
* measured host-surface deviation under the cutter footprint (sculpted /
|
|
930
|
+
* non-planar faces). The host arrives as a standard triangulated buffer.
|
|
931
|
+
* Returns [height, epsilon, pointCount, x,y,z,...]
|
|
932
|
+
*/
|
|
933
|
+
export function mesh_prepare_hosted_boolean_cutter(host_vertex_count: number, host_buffer: Float64Array, coords: Float64Array, closed: boolean, nx: number, ny: number, nz: number, height: number): Float64Array;
|
|
934
|
+
|
|
926
935
|
/**
|
|
927
936
|
* Raycast against mesh and return closest hit.
|
|
928
937
|
* Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
|
|
@@ -1328,11 +1337,28 @@ export function sculpt_session_create(vertex_count: number, buffer: Float64Array
|
|
|
1328
1337
|
*/
|
|
1329
1338
|
export function sculpt_session_dab(id: number, cx: number, cy: number, cz: number, vx: number, vy: number, vz: number, dragx: number, dragy: number, dragz: number, pressure: number): Float32Array;
|
|
1330
1339
|
|
|
1340
|
+
/**
|
|
1341
|
+
* Locally REDUCE point density in the given triangle group (constrained
|
|
1342
|
+
* edge collapse of interior vertices; the group boundary is preserved)
|
|
1343
|
+
* until the group has at most `target_points` unique vertices or no safe
|
|
1344
|
+
* collapse remains. Returns 1 when at least one collapse happened, 0
|
|
1345
|
+
* otherwise. Clears session undo history; callers must refetch
|
|
1346
|
+
* `sculpt_session_render_data` afterwards.
|
|
1347
|
+
*/
|
|
1348
|
+
export function sculpt_session_decimate_faces(id: number, triangles: Uint32Array, target_points: number): number;
|
|
1349
|
+
|
|
1331
1350
|
/**
|
|
1332
1351
|
* Finish the active stroke (pushes one undo entry).
|
|
1333
1352
|
*/
|
|
1334
1353
|
export function sculpt_session_end_stroke(id: number): void;
|
|
1335
1354
|
|
|
1355
|
+
/**
|
|
1356
|
+
* Smooth face group around a seed triangle (dihedral flood fill, same
|
|
1357
|
+
* semantics as the mesh-level query push-pull uses). Returns the group's
|
|
1358
|
+
* triangle indices; empty when the session/seed is invalid.
|
|
1359
|
+
*/
|
|
1360
|
+
export function sculpt_session_face_group(id: number, seed_triangle: number, max_angle_deg: number): Uint32Array;
|
|
1361
|
+
|
|
1336
1362
|
/**
|
|
1337
1363
|
* Session stats: `[vertexCount, triangleCount, averageEdgeLength, undoDepth,
|
|
1338
1364
|
* redoDepth]`; empty if the session does not exist.
|
|
@@ -1385,6 +1411,14 @@ export function sculpt_session_render_data(id: number): Float32Array;
|
|
|
1385
1411
|
*/
|
|
1386
1412
|
export function sculpt_session_subdivide(id: number): number;
|
|
1387
1413
|
|
|
1414
|
+
/**
|
|
1415
|
+
* Locally refine the given triangles 1:4 with crack-free conforming
|
|
1416
|
+
* neighbor splits (red-green refinement). Returns 1 on success, 0 when
|
|
1417
|
+
* refused (bad input or safety cap). Clears session undo history; callers
|
|
1418
|
+
* must refetch `sculpt_session_render_data` afterwards.
|
|
1419
|
+
*/
|
|
1420
|
+
export function sculpt_session_subdivide_faces(id: number, triangles: Uint32Array): number;
|
|
1421
|
+
|
|
1388
1422
|
/**
|
|
1389
1423
|
* Undo the last stroke. Returns the render patch restoring the previous
|
|
1390
1424
|
* positions; empty when there is nothing to undo.
|
|
@@ -1569,6 +1603,7 @@ export interface InitOutput {
|
|
|
1569
1603
|
readonly mesh_plane_intersect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1570
1604
|
readonly mesh_polyline_intersection_points: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
1571
1605
|
readonly mesh_prepare_boolean_cutter_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1606
|
+
readonly mesh_prepare_hosted_boolean_cutter: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
1572
1607
|
readonly mesh_raycast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
1573
1608
|
readonly mesh_raycast_all: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
1574
1609
|
readonly mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
@@ -1622,7 +1657,9 @@ export interface InitOutput {
|
|
|
1622
1657
|
readonly sculpt_session_begin_stroke: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
1623
1658
|
readonly sculpt_session_create: (a: number, b: number, c: number) => number;
|
|
1624
1659
|
readonly sculpt_session_dab: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
|
|
1660
|
+
readonly sculpt_session_decimate_faces: (a: number, b: number, c: number, d: number) => number;
|
|
1625
1661
|
readonly sculpt_session_end_stroke: (a: number) => void;
|
|
1662
|
+
readonly sculpt_session_face_group: (a: number, b: number, c: number) => [number, number];
|
|
1626
1663
|
readonly sculpt_session_info: (a: number) => [number, number];
|
|
1627
1664
|
readonly sculpt_session_mask_fill: (a: number, b: number) => [number, number];
|
|
1628
1665
|
readonly sculpt_session_mask_invert: (a: number) => [number, number];
|
|
@@ -1632,6 +1669,7 @@ export interface InitOutput {
|
|
|
1632
1669
|
readonly sculpt_session_release: (a: number) => void;
|
|
1633
1670
|
readonly sculpt_session_render_data: (a: number) => [number, number];
|
|
1634
1671
|
readonly sculpt_session_subdivide: (a: number) => number;
|
|
1672
|
+
readonly sculpt_session_subdivide_faces: (a: number, b: number, c: number) => number;
|
|
1635
1673
|
readonly sculpt_session_undo: (a: number) => [number, number];
|
|
1636
1674
|
readonly sweep_curves: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1637
1675
|
readonly sweep_polylines: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
package/src/wasm-bindings.js
CHANGED
|
@@ -2830,6 +2830,33 @@ export function mesh_prepare_boolean_cutter_curve(coords, closed, nx, ny, nz, he
|
|
|
2830
2830
|
return v2;
|
|
2831
2831
|
}
|
|
2832
2832
|
|
|
2833
|
+
/**
|
|
2834
|
+
* Host-aware boolean cutter preparation: like
|
|
2835
|
+
* `mesh_prepare_boolean_cutter_curve`, but the bias is raised past the
|
|
2836
|
+
* measured host-surface deviation under the cutter footprint (sculpted /
|
|
2837
|
+
* non-planar faces). The host arrives as a standard triangulated buffer.
|
|
2838
|
+
* Returns [height, epsilon, pointCount, x,y,z,...]
|
|
2839
|
+
* @param {number} host_vertex_count
|
|
2840
|
+
* @param {Float64Array} host_buffer
|
|
2841
|
+
* @param {Float64Array} coords
|
|
2842
|
+
* @param {boolean} closed
|
|
2843
|
+
* @param {number} nx
|
|
2844
|
+
* @param {number} ny
|
|
2845
|
+
* @param {number} nz
|
|
2846
|
+
* @param {number} height
|
|
2847
|
+
* @returns {Float64Array}
|
|
2848
|
+
*/
|
|
2849
|
+
export function mesh_prepare_hosted_boolean_cutter(host_vertex_count, host_buffer, coords, closed, nx, ny, nz, height) {
|
|
2850
|
+
const ptr0 = passArrayF64ToWasm0(host_buffer, wasm.__wbindgen_malloc);
|
|
2851
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2852
|
+
const ptr1 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2853
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2854
|
+
const ret = wasm.mesh_prepare_hosted_boolean_cutter(host_vertex_count, ptr0, len0, ptr1, len1, closed, nx, ny, nz, height);
|
|
2855
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2856
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2857
|
+
return v3;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2833
2860
|
/**
|
|
2834
2861
|
* Raycast against mesh and return closest hit.
|
|
2835
2862
|
* Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
|
|
@@ -3943,6 +3970,25 @@ export function sculpt_session_dab(id, cx, cy, cz, vx, vy, vz, dragx, dragy, dra
|
|
|
3943
3970
|
return v1;
|
|
3944
3971
|
}
|
|
3945
3972
|
|
|
3973
|
+
/**
|
|
3974
|
+
* Locally REDUCE point density in the given triangle group (constrained
|
|
3975
|
+
* edge collapse of interior vertices; the group boundary is preserved)
|
|
3976
|
+
* until the group has at most `target_points` unique vertices or no safe
|
|
3977
|
+
* collapse remains. Returns 1 when at least one collapse happened, 0
|
|
3978
|
+
* otherwise. Clears session undo history; callers must refetch
|
|
3979
|
+
* `sculpt_session_render_data` afterwards.
|
|
3980
|
+
* @param {number} id
|
|
3981
|
+
* @param {Uint32Array} triangles
|
|
3982
|
+
* @param {number} target_points
|
|
3983
|
+
* @returns {number}
|
|
3984
|
+
*/
|
|
3985
|
+
export function sculpt_session_decimate_faces(id, triangles, target_points) {
|
|
3986
|
+
const ptr0 = passArray32ToWasm0(triangles, wasm.__wbindgen_malloc);
|
|
3987
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3988
|
+
const ret = wasm.sculpt_session_decimate_faces(id, ptr0, len0, target_points);
|
|
3989
|
+
return ret >>> 0;
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3946
3992
|
/**
|
|
3947
3993
|
* Finish the active stroke (pushes one undo entry).
|
|
3948
3994
|
* @param {number} id
|
|
@@ -3951,6 +3997,22 @@ export function sculpt_session_end_stroke(id) {
|
|
|
3951
3997
|
wasm.sculpt_session_end_stroke(id);
|
|
3952
3998
|
}
|
|
3953
3999
|
|
|
4000
|
+
/**
|
|
4001
|
+
* Smooth face group around a seed triangle (dihedral flood fill, same
|
|
4002
|
+
* semantics as the mesh-level query push-pull uses). Returns the group's
|
|
4003
|
+
* triangle indices; empty when the session/seed is invalid.
|
|
4004
|
+
* @param {number} id
|
|
4005
|
+
* @param {number} seed_triangle
|
|
4006
|
+
* @param {number} max_angle_deg
|
|
4007
|
+
* @returns {Uint32Array}
|
|
4008
|
+
*/
|
|
4009
|
+
export function sculpt_session_face_group(id, seed_triangle, max_angle_deg) {
|
|
4010
|
+
const ret = wasm.sculpt_session_face_group(id, seed_triangle, max_angle_deg);
|
|
4011
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
4012
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4013
|
+
return v1;
|
|
4014
|
+
}
|
|
4015
|
+
|
|
3954
4016
|
/**
|
|
3955
4017
|
* Session stats: `[vertexCount, triangleCount, averageEdgeLength, undoDepth,
|
|
3956
4018
|
* redoDepth]`; empty if the session does not exist.
|
|
@@ -4067,6 +4129,22 @@ export function sculpt_session_subdivide(id) {
|
|
|
4067
4129
|
return ret >>> 0;
|
|
4068
4130
|
}
|
|
4069
4131
|
|
|
4132
|
+
/**
|
|
4133
|
+
* Locally refine the given triangles 1:4 with crack-free conforming
|
|
4134
|
+
* neighbor splits (red-green refinement). Returns 1 on success, 0 when
|
|
4135
|
+
* refused (bad input or safety cap). Clears session undo history; callers
|
|
4136
|
+
* must refetch `sculpt_session_render_data` afterwards.
|
|
4137
|
+
* @param {number} id
|
|
4138
|
+
* @param {Uint32Array} triangles
|
|
4139
|
+
* @returns {number}
|
|
4140
|
+
*/
|
|
4141
|
+
export function sculpt_session_subdivide_faces(id, triangles) {
|
|
4142
|
+
const ptr0 = passArray32ToWasm0(triangles, wasm.__wbindgen_malloc);
|
|
4143
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4144
|
+
const ret = wasm.sculpt_session_subdivide_faces(id, ptr0, len0);
|
|
4145
|
+
return ret >>> 0;
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4070
4148
|
/**
|
|
4071
4149
|
* Undo the last stroke. Returns the render patch restoring the previous
|
|
4072
4150
|
* positions; empty when there is nothing to undo.
|
|
@@ -4241,6 +4319,11 @@ function getArrayF64FromWasm0(ptr, len) {
|
|
|
4241
4319
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
4242
4320
|
}
|
|
4243
4321
|
|
|
4322
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
4323
|
+
ptr = ptr >>> 0;
|
|
4324
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4244
4327
|
function getArrayU8FromWasm0(ptr, len) {
|
|
4245
4328
|
ptr = ptr >>> 0;
|
|
4246
4329
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -4267,6 +4350,14 @@ function getStringFromWasm0(ptr, len) {
|
|
|
4267
4350
|
return decodeText(ptr, len);
|
|
4268
4351
|
}
|
|
4269
4352
|
|
|
4353
|
+
let cachedUint32ArrayMemory0 = null;
|
|
4354
|
+
function getUint32ArrayMemory0() {
|
|
4355
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
4356
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
4357
|
+
}
|
|
4358
|
+
return cachedUint32ArrayMemory0;
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4270
4361
|
let cachedUint8ArrayMemory0 = null;
|
|
4271
4362
|
function getUint8ArrayMemory0() {
|
|
4272
4363
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
@@ -4275,6 +4366,13 @@ function getUint8ArrayMemory0() {
|
|
|
4275
4366
|
return cachedUint8ArrayMemory0;
|
|
4276
4367
|
}
|
|
4277
4368
|
|
|
4369
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
4370
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
4371
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
4372
|
+
WASM_VECTOR_LEN = arg.length;
|
|
4373
|
+
return ptr;
|
|
4374
|
+
}
|
|
4375
|
+
|
|
4278
4376
|
function passArray8ToWasm0(arg, malloc) {
|
|
4279
4377
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
4280
4378
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -4361,6 +4459,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
4361
4459
|
wasmModule = module;
|
|
4362
4460
|
cachedFloat32ArrayMemory0 = null;
|
|
4363
4461
|
cachedFloat64ArrayMemory0 = null;
|
|
4462
|
+
cachedUint32ArrayMemory0 = null;
|
|
4364
4463
|
cachedUint8ArrayMemory0 = null;
|
|
4365
4464
|
wasm.__wbindgen_start();
|
|
4366
4465
|
return wasm;
|