okgeometry-api 0.5.7 → 0.5.9
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/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -58
- package/dist/engine.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/package.json +9 -3
- package/src/engine.ts +25 -82
- package/src/wasm-base64.ts +1 -1
- package/wasm/okgeometrycore.d.ts +26 -2
- package/wasm/okgeometrycore.js +51 -2
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/okgeometrycore_bg.wasm.d.ts +1 -0
package/dist/wasm-base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,0+kvCAA0+kvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okgeometry-api",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "Geometry engine API for AEC applications — NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,8 +19,13 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"inline-wasm": "tsx scripts/inline-wasm.ts",
|
|
21
21
|
"build": "npm run inline-wasm && tsc",
|
|
22
|
+
"bench:boolean-manifold-baseline": "npm run build && tsx scripts/bench-boolean-manifold-baseline.ts",
|
|
23
|
+
"bench:boolean-nextgen-heavy": "npm run build && tsx scripts/bench-boolean-nextgen-heavy.ts",
|
|
24
|
+
"bench:boolean-ab": "npm run build && tsx scripts/bench-boolean-ab.ts",
|
|
25
|
+
"bench:subtraction-bunny-parity": "npm run build && tsx scripts/bench-subtraction-bunny-parity.ts",
|
|
22
26
|
"bench:boolean-nextgen": "npm run build && tsx scripts/gate-boolean-nextgen.ts",
|
|
23
27
|
"gate:boolean-nextgen": "npm run build && tsx scripts/gate-boolean-nextgen.ts",
|
|
28
|
+
"gate:boolean-nextgen-vs-manifold": "npm run bench:boolean-manifold-baseline && npm run gate:boolean-nextgen",
|
|
24
29
|
"prepublishOnly": "npm run build"
|
|
25
30
|
},
|
|
26
31
|
"keywords": [
|
|
@@ -40,7 +45,8 @@
|
|
|
40
45
|
"url": "https://github.com/moel-ai/okgeometrycore"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"tsx": "^4.7.0"
|
|
48
|
+
"manifold-3d": "^3.3.2",
|
|
49
|
+
"tsx": "^4.7.0",
|
|
50
|
+
"typescript": "^5.4.0"
|
|
45
51
|
}
|
|
46
52
|
}
|
package/src/engine.ts
CHANGED
|
@@ -1,85 +1,28 @@
|
|
|
1
|
-
import { WASM_B64 } from "./wasm-base64.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
const engineGlobal = globalThis as typeof globalThis & {
|
|
8
|
-
__okgeometry_boolean_should_cancel?: () => boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
if (typeof engineGlobal.__okgeometry_boolean_should_cancel !== "function") {
|
|
12
|
-
engineGlobal.__okgeometry_boolean_should_cancel = () => false;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (cancelKey) {
|
|
27
|
-
importModule[cancelKey] = cancelFn;
|
|
28
|
-
} else {
|
|
29
|
-
// Fallback to current known symbol in generated bindings.
|
|
30
|
-
importModule.__wbg___okgeometry_boolean_should_cancel_3e76652b5286d323 = cancelFn;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Fill hash-suffixed imports that may not be exported by generated glue in this runtime.
|
|
34
|
-
for (const name of requiredNames) {
|
|
35
|
-
const existing = importModule[name];
|
|
36
|
-
if (typeof existing === "function") {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (name.startsWith("__wbg___okgeometry_boolean_should_cancel_")) {
|
|
40
|
-
importModule[name] = cancelFn;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (name.startsWith("__wbg_now_")) {
|
|
44
|
-
importModule[name] = () => Date.now();
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
if (name.startsWith("__wbg___wbindgen_throw_")) {
|
|
48
|
-
importModule[name] = () => {
|
|
49
|
-
throw new Error("WASM trap: __wbindgen_throw");
|
|
50
|
-
};
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (name === "__wbindgen_init_externref_table") {
|
|
54
|
-
importModule[name] = () => {};
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return importModule;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function init(): Promise<void> {
|
|
63
|
-
if (initialized) return;
|
|
64
|
-
const raw = atob(WASM_B64);
|
|
65
|
-
const bytes = new Uint8Array(raw.length);
|
|
66
|
-
for (let i = 0; i < raw.length; i++) bytes[i] = raw.charCodeAt(i);
|
|
67
|
-
|
|
68
|
-
const wasmModule = await WebAssembly.compile(bytes.buffer);
|
|
69
|
-
const requiredNames = WebAssembly.Module.imports(wasmModule)
|
|
70
|
-
.filter((imp) => imp.module === "./okgeometrycore_bg.js")
|
|
71
|
-
.map((imp) => imp.name);
|
|
72
|
-
const importModule = buildWasmImports(requiredNames);
|
|
73
|
-
const instance = await WebAssembly.instantiate(wasmModule, {
|
|
74
|
-
"./okgeometrycore_bg.js": importModule as any,
|
|
75
|
-
});
|
|
76
|
-
wasmExports = instance.exports as Record<string, unknown>;
|
|
77
|
-
|
|
78
|
-
(bg as any).__wbg_set_wasm(instance.exports);
|
|
79
|
-
(instance.exports as any).__wbindgen_start();
|
|
80
|
-
|
|
81
|
-
initialized = true;
|
|
82
|
-
}
|
|
1
|
+
import { WASM_B64 } from "./wasm-base64.js";
|
|
2
|
+
import coreWasmInit from "../wasm/okgeometrycore.js";
|
|
3
|
+
import * as bg from "../wasm/okgeometrycore_bg.js";
|
|
4
|
+
|
|
5
|
+
let initialized = false;
|
|
6
|
+
|
|
7
|
+
const engineGlobal = globalThis as typeof globalThis & {
|
|
8
|
+
__okgeometry_boolean_should_cancel?: () => boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
if (typeof engineGlobal.__okgeometry_boolean_should_cancel !== "function") {
|
|
12
|
+
engineGlobal.__okgeometry_boolean_should_cancel = () => false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function init(): Promise<void> {
|
|
16
|
+
if (initialized) return;
|
|
17
|
+
const raw = atob(WASM_B64);
|
|
18
|
+
const bytes = new Uint8Array(raw.length);
|
|
19
|
+
for (let i = 0; i < raw.length; i++) bytes[i] = raw.charCodeAt(i);
|
|
20
|
+
|
|
21
|
+
const exports = await coreWasmInit({ module_or_path: bytes });
|
|
22
|
+
(bg as any).__wbg_set_wasm(exports);
|
|
23
|
+
|
|
24
|
+
initialized = true;
|
|
25
|
+
}
|
|
83
26
|
|
|
84
27
|
export function ensureInit(): void {
|
|
85
28
|
if (!initialized) {
|