@ifc-lite/viewer 1.0.0 → 1.1.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/assets/{geometry.worker-DpnHtNr3.ts → geometry.worker-CiROVpKV.ts} +6 -9
- package/dist/assets/ifc-lite_bg-BQVS1Fh7.wasm +0 -0
- package/dist/assets/index-CvYpbxNF.js +728 -0
- package/dist/ifc-lite_bg.wasm +0 -0
- package/dist/index.html +1 -1
- package/package.json +9 -9
- package/public/ifc-lite_bg.wasm +0 -0
- package/src/components/viewer/Viewport.tsx +198 -66
- package/src/components/viewer/ViewportContainer.tsx +1 -1
- package/src/hooks/useIfc.ts +235 -20
- package/src/services/ifc-cache.ts +251 -0
- package/src/store.ts +55 -4
- package/tsconfig.json +5 -1
- package/vite.config.ts +15 -1
- package/dist/assets/ifc_lite_wasm_bg-Cd3m3f2h.wasm +0 -0
- package/dist/assets/index-Dzz3WVwq.js +0 -637
- package/dist/ifc_lite_wasm_bg.wasm +0 -0
- package/public/ifc_lite_wasm_bg.wasm +0 -0
|
@@ -31,8 +31,9 @@ let ifcApiInitialized: boolean = false;
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Initialize IFC-Lite API in worker context
|
|
34
|
+
* The WASM binary is automatically resolved from the same location as the JS module
|
|
34
35
|
*/
|
|
35
|
-
async function initIfcApi(
|
|
36
|
+
async function initIfcApi(): Promise<IfcAPI> {
|
|
36
37
|
if (ifcApi && ifcApiInitialized) {
|
|
37
38
|
return ifcApi;
|
|
38
39
|
}
|
|
@@ -40,12 +41,8 @@ async function initIfcApi(wasmPath: string = '/'): Promise<IfcAPI> {
|
|
|
40
41
|
const initStart = performance.now();
|
|
41
42
|
console.log('[Worker] Initializing IFC-Lite...');
|
|
42
43
|
|
|
43
|
-
// Initialize WASM module
|
|
44
|
-
|
|
45
|
-
? `${wasmPath}ifc_lite_wasm_bg.wasm`
|
|
46
|
-
: `${wasmPath}/ifc_lite_wasm_bg.wasm`;
|
|
47
|
-
|
|
48
|
-
await init(wasmUrl);
|
|
44
|
+
// Initialize WASM module - wasm-bindgen automatically resolves the WASM URL
|
|
45
|
+
await init();
|
|
49
46
|
ifcApi = new IfcAPI();
|
|
50
47
|
ifcApiInitialized = true;
|
|
51
48
|
|
|
@@ -60,11 +57,11 @@ async function initIfcApi(wasmPath: string = '/'): Promise<IfcAPI> {
|
|
|
60
57
|
*/
|
|
61
58
|
async function handleMeshCollection(data: { buffer: ArrayBuffer; wasmPath?: string }): Promise<MeshData[]> {
|
|
62
59
|
const taskStart = performance.now();
|
|
63
|
-
const { buffer
|
|
60
|
+
const { buffer } = data;
|
|
64
61
|
|
|
65
62
|
// Initialize IFC-Lite if needed
|
|
66
63
|
const apiInitStart = performance.now();
|
|
67
|
-
const api = await initIfcApi(
|
|
64
|
+
const api = await initIfcApi();
|
|
68
65
|
const apiInitTime = performance.now() - apiInitStart;
|
|
69
66
|
if (apiInitTime > 10) {
|
|
70
67
|
console.log(`[Worker] IFC-Lite init took ${apiInitTime.toFixed(2)}ms`);
|
|
Binary file
|