@ifc-lite/wasm 1.16.8 → 1.17.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 -2
- package/package.json +5 -3
- package/pkg/ifc-lite.d.ts +110 -4
- package/pkg/ifc-lite.js +179 -9
- package/pkg/ifc-lite_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -131,11 +131,11 @@ All classes implement `free()` and `[Symbol.dispose]()` — call `free()` (or us
|
|
|
131
131
|
|
|
132
132
|
## Rust source
|
|
133
133
|
|
|
134
|
-
This package ships the bindings only. The Rust source lives in [`rust/wasm-bindings/`](https://github.com/
|
|
134
|
+
This package ships the bindings only. The Rust source lives in [`rust/wasm-bindings/`](https://github.com/LTplus-AG/ifc-lite/tree/main/rust/wasm-bindings) and the core in [`rust/core/`](https://github.com/LTplus-AG/ifc-lite/tree/main/rust/core). Available on crates.io as `ifc-lite-core`.
|
|
135
135
|
|
|
136
136
|
## API
|
|
137
137
|
|
|
138
|
-
See the [WASM API Reference](https://
|
|
138
|
+
See the [WASM API Reference](https://ltplus-ag.github.io/ifc-lite/api/wasm/).
|
|
139
139
|
|
|
140
140
|
## License
|
|
141
141
|
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"IFC-Lite Contributors"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for IFC-Lite",
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.17.0",
|
|
9
9
|
"license": "MPL-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/LTplus-AG/ifc-lite"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"pkg/ifc-lite_bg.wasm",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
".": {
|
|
24
24
|
"import": "./pkg/ifc-lite.js",
|
|
25
25
|
"types": "./pkg/ifc-lite.d.ts"
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
"./ifc-lite_bg.wasm": "./pkg/ifc-lite_bg.wasm"
|
|
27
28
|
},
|
|
28
29
|
"sideEffects": false,
|
|
29
30
|
"keywords": [
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"aec"
|
|
35
36
|
],
|
|
36
37
|
"scripts": {
|
|
38
|
+
"build": "bash ../../scripts/build-wasm.sh",
|
|
37
39
|
"test": "node --test test/*.test.mjs"
|
|
38
40
|
}
|
|
39
41
|
}
|
package/pkg/ifc-lite.d.ts
CHANGED
|
@@ -349,6 +349,62 @@ export class IfcAPI {
|
|
|
349
349
|
* Takes raw bytes and pre-pass data from buildPrePassOnce.
|
|
350
350
|
*/
|
|
351
351
|
processGeometryBatch(data: Uint8Array, jobs_flat: Uint32Array, unit_scale: number, rtc_x: number, rtc_y: number, rtc_z: number, needs_shift: boolean, void_keys: Uint32Array, void_counts: Uint32Array, void_values: Uint32Array, style_ids: Uint32Array, style_colors: Uint8Array): MeshCollection;
|
|
352
|
+
/**
|
|
353
|
+
* Phase 1 of Path C — sharded entity-index scan.
|
|
354
|
+
*
|
|
355
|
+
* Walks the bytes in `[range_start, range_end)` once and emits
|
|
356
|
+
* `(express_id, byte_offset, byte_length)` triples for every entity
|
|
357
|
+
* whose `#N=` opener falls in that range. Byte offsets are GLOBAL
|
|
358
|
+
* (relative to file start), so multiple shards' outputs concatenate
|
|
359
|
+
* without rewriting.
|
|
360
|
+
*
|
|
361
|
+
* Cross-boundary handling: the scanner rewinds `range_start` to the
|
|
362
|
+
* byte after the previous `\n` so we don't mis-parse a half entity.
|
|
363
|
+
* The previous shard owns any entity whose opener is BEFORE its own
|
|
364
|
+
* range_end (its terminator may extend past it; that's fine — the
|
|
365
|
+
* scanner walks STEP entities to their terminating `;`, even if that
|
|
366
|
+
* terminator is past the shard's nominal range_end).
|
|
367
|
+
*
|
|
368
|
+
* Returns nothing through the JS callback for performance signals;
|
|
369
|
+
* emits exactly one `index-shard` event with three Uint32Arrays:
|
|
370
|
+
* `{ type: "index-shard", ids: Uint32Array, starts: Uint32Array,
|
|
371
|
+
* lengths: Uint32Array, shardStart: u32, shardEnd: u32 }`
|
|
372
|
+
*
|
|
373
|
+
* Used by the JS-side shard coordinator to merge N shards' indices
|
|
374
|
+
* into a single entity-index without paying the 3 s single-threaded
|
|
375
|
+
* scan cost. Style and job emission are NOT done here — they remain
|
|
376
|
+
* the job of the existing `build_pre_pass_streaming` (which can be
|
|
377
|
+
* called on shard 0 in parallel with the other shards' index-only
|
|
378
|
+
* scans).
|
|
379
|
+
*/
|
|
380
|
+
scanEntityIndexShard(data: Uint8Array, on_event: Function, range_start: number, range_end: number): any;
|
|
381
|
+
/**
|
|
382
|
+
* Streaming pre-pass: emits geometry jobs in chunks via a JS callback
|
|
383
|
+
* instead of waiting for the full file scan to complete.
|
|
384
|
+
*
|
|
385
|
+
* Single linear walk over the file:
|
|
386
|
+
* 1. Builds the entity index incrementally from the same scan that
|
|
387
|
+
* collects geometry jobs (the old `build_pre_pass_fast` did two
|
|
388
|
+
* full-file scans — one for entities, one for the index — which
|
|
389
|
+
* doubled wall-clock).
|
|
390
|
+
* 2. As soon as `IFCPROJECT` has been seen, the unit scale and the
|
|
391
|
+
* first ~50 geometry jobs have been collected, resolves
|
|
392
|
+
* `unitScale` + `rtcOffset` and emits a `meta` callback so the
|
|
393
|
+
* JS host can spin up geometry process workers.
|
|
394
|
+
* 3. Emits `jobs` callbacks every `chunk_size` jobs (or fewer if
|
|
395
|
+
* the meta phase already buffered some).
|
|
396
|
+
* 4. Emits `complete` with the total job count at end of scan.
|
|
397
|
+
*
|
|
398
|
+
* On a 986 MB / 14 M-entity file this drops time-to-first-geometry
|
|
399
|
+
* from ~17 s (full pre-pass + worker spawn + first batch) to ~3 s
|
|
400
|
+
* (first 100 K bytes scanned + meta + first chunk).
|
|
401
|
+
*
|
|
402
|
+
* The callback receives a single `JsValue` argument shaped as one of:
|
|
403
|
+
* `{ type: "meta", unitScale, rtcOffset: [x,y,z], needsShift, buildingRotation? }`
|
|
404
|
+
* `{ type: "jobs", jobs: Uint32Array }` // [id, start, end] triples
|
|
405
|
+
* `{ type: "complete", totalJobs }`
|
|
406
|
+
*/
|
|
407
|
+
buildPrePassStreaming(data: Uint8Array, on_event: Function, chunk_size: number): any;
|
|
352
408
|
/**
|
|
353
409
|
* Parse IFC file with streaming GPU-ready geometry batches
|
|
354
410
|
*
|
|
@@ -475,7 +531,53 @@ export class IfcAPI {
|
|
|
475
531
|
*/
|
|
476
532
|
getMemory(): any;
|
|
477
533
|
/**
|
|
478
|
-
*
|
|
534
|
+
* Populate `cached_entity_index` from pre-extracted column arrays.
|
|
535
|
+
*
|
|
536
|
+
* Used by the streaming pre-pass to share its already-built entity
|
|
537
|
+
* index across worker realms via SAB-backed Uint32Arrays — every
|
|
538
|
+
* process worker would otherwise re-scan the entire file in
|
|
539
|
+
* `processGeometryBatch`'s lazy build path (~5 s on a 1 GB IFC),
|
|
540
|
+
* even though the pre-pass worker built the same index minutes
|
|
541
|
+
* earlier.
|
|
542
|
+
*
|
|
543
|
+
* Building an `FxHashMap` from the three input slices costs ~1 s on
|
|
544
|
+
* 14 M entries — about 4–5× faster than re-scanning the file. After
|
|
545
|
+
* this call, the next `processGeometryBatch` skips the lazy build
|
|
546
|
+
* branch and reuses the populated cache by `Arc::clone()`.
|
|
547
|
+
*
|
|
548
|
+
* `lengths[i]` is the byte length of entity `ids[i]`, so the cache
|
|
549
|
+
* stores `(start, start + length)` to match the existing tuple layout.
|
|
550
|
+
*
|
|
551
|
+
* Idempotent in the sense that repeated calls REPLACE the cache —
|
|
552
|
+
* supports the parser-worker pattern of reusing one IfcAPI across
|
|
553
|
+
* multiple loads with different files.
|
|
554
|
+
*/
|
|
555
|
+
setEntityIndex(ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array): void;
|
|
556
|
+
/**
|
|
557
|
+
* Toggle the "render multilayer walls as a single solid" mode (issue #540).
|
|
558
|
+
*
|
|
559
|
+
* When `enabled` is `true`, every subsequent `parseMeshes*` call will
|
|
560
|
+
* suppress geometry emission for `IfcBuildingElementPart` entities whose
|
|
561
|
+
* `IfcRelAggregates` parent wall is sliceable (has an
|
|
562
|
+
* `IfcMaterialLayerSetUsage`) AND has its own `Representation`. The
|
|
563
|
+
* parent wall keeps its per-layer sub-mesh colouring, so the visual
|
|
564
|
+
* result is the same as the layered render but with one mesh per wall
|
|
565
|
+
* instead of one per layer part — much cheaper for both CPU and GPU.
|
|
566
|
+
*
|
|
567
|
+
* Default is `false`. Pass `true` before calling `parseMeshes`,
|
|
568
|
+
* `parseMeshesSubset`, `parseMeshesAsync`, `parseMeshesInstanced`, or
|
|
569
|
+
* `parseMeshesInstancedAsync`.
|
|
570
|
+
*/
|
|
571
|
+
setMergeLayers(enabled: boolean): void;
|
|
572
|
+
/**
|
|
573
|
+
* Clear the cached entity index (call between loads when reusing
|
|
574
|
+
* the same `IfcAPI` instance — e.g. the parser worker keeps one
|
|
575
|
+
* `IfcAPI` alive across multiple `parse` requests).
|
|
576
|
+
*
|
|
577
|
+
* Panics if the cache Mutex is poisoned. Poisoning means an
|
|
578
|
+
* earlier panic occurred while the lock was held — silently
|
|
579
|
+
* continuing would mean operating on an inconsistent cache, so
|
|
580
|
+
* fail fast.
|
|
479
581
|
*/
|
|
480
582
|
clearPrePassCache(): void;
|
|
481
583
|
/**
|
|
@@ -1061,6 +1163,7 @@ export interface InitOutput {
|
|
|
1061
1163
|
readonly gpumeshmetadata_vertexOffset: (a: number) => number;
|
|
1062
1164
|
readonly ifcapi_buildPrePassFast: (a: number, b: number, c: number) => number;
|
|
1063
1165
|
readonly ifcapi_buildPrePassOnce: (a: number, b: number, c: number) => number;
|
|
1166
|
+
readonly ifcapi_buildPrePassStreaming: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1064
1167
|
readonly ifcapi_clearPrePassCache: (a: number) => void;
|
|
1065
1168
|
readonly ifcapi_debugProcessEntity953: (a: number, b: number, c: number, d: number) => void;
|
|
1066
1169
|
readonly ifcapi_debugProcessFirstWall: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1086,8 +1189,11 @@ export interface InitOutput {
|
|
|
1086
1189
|
readonly ifcapi_processInstancedGeometryBatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => number;
|
|
1087
1190
|
readonly ifcapi_scanEntitiesFast: (a: number, b: number, c: number) => number;
|
|
1088
1191
|
readonly ifcapi_scanEntitiesFastBytes: (a: number, b: number, c: number) => number;
|
|
1192
|
+
readonly ifcapi_scanEntityIndexShard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1089
1193
|
readonly ifcapi_scanGeometryEntitiesFast: (a: number, b: number, c: number) => number;
|
|
1090
1194
|
readonly ifcapi_scanRelevantEntitiesFastBytes: (a: number, b: number, c: number) => number;
|
|
1195
|
+
readonly ifcapi_setEntityIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1196
|
+
readonly ifcapi_setMergeLayers: (a: number, b: number) => void;
|
|
1091
1197
|
readonly ifcapi_version: (a: number, b: number) => void;
|
|
1092
1198
|
readonly instancedata_color: (a: number, b: number) => void;
|
|
1093
1199
|
readonly instancedata_expressId: (a: number) => number;
|
|
@@ -1194,9 +1300,9 @@ export interface InitOutput {
|
|
|
1194
1300
|
readonly profileentryjs_expressId: (a: number) => number;
|
|
1195
1301
|
readonly symboliccircle_expressId: (a: number) => number;
|
|
1196
1302
|
readonly __wbg_gpuinstancedgeometryref_free: (a: number, b: number) => void;
|
|
1197
|
-
readonly
|
|
1198
|
-
readonly
|
|
1199
|
-
readonly
|
|
1303
|
+
readonly __wasm_bindgen_func_elem_1480: (a: number, b: number, c: number) => void;
|
|
1304
|
+
readonly __wasm_bindgen_func_elem_1479: (a: number, b: number) => void;
|
|
1305
|
+
readonly __wasm_bindgen_func_elem_1520: (a: number, b: number, c: number, d: number) => void;
|
|
1200
1306
|
readonly __wbindgen_export: (a: number) => void;
|
|
1201
1307
|
readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
|
|
1202
1308
|
readonly __wbindgen_export3: (a: number, b: number) => number;
|
package/pkg/ifc-lite.js
CHANGED
|
@@ -9,6 +9,12 @@ function addHeapObject(obj) {
|
|
|
9
9
|
return idx;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
function addBorrowedObject(obj) {
|
|
13
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
14
|
+
heap[--stack_pointer] = obj;
|
|
15
|
+
return stack_pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
13
19
|
? { register: () => {}, unregister: () => {} }
|
|
14
20
|
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
@@ -177,6 +183,8 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
177
183
|
return ptr;
|
|
178
184
|
}
|
|
179
185
|
|
|
186
|
+
let stack_pointer = 128;
|
|
187
|
+
|
|
180
188
|
function takeObject(idx) {
|
|
181
189
|
const ret = getObject(idx);
|
|
182
190
|
dropObject(idx);
|
|
@@ -212,12 +220,12 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
212
220
|
|
|
213
221
|
let WASM_VECTOR_LEN = 0;
|
|
214
222
|
|
|
215
|
-
function
|
|
216
|
-
wasm.
|
|
223
|
+
function __wasm_bindgen_func_elem_1480(arg0, arg1, arg2) {
|
|
224
|
+
wasm.__wasm_bindgen_func_elem_1480(arg0, arg1, addHeapObject(arg2));
|
|
217
225
|
}
|
|
218
226
|
|
|
219
|
-
function
|
|
220
|
-
wasm.
|
|
227
|
+
function __wasm_bindgen_func_elem_1520(arg0, arg1, arg2, arg3) {
|
|
228
|
+
wasm.__wasm_bindgen_func_elem_1520(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
const GeoReferenceJsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1321,6 +1329,105 @@ export class IfcAPI {
|
|
|
1321
1329
|
const ret = wasm.ifcapi_processGeometryBatch(this.__wbg_ptr, ptr0, len0, ptr1, len1, unit_scale, rtc_x, rtc_y, rtc_z, needs_shift, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
1322
1330
|
return MeshCollection.__wrap(ret);
|
|
1323
1331
|
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Phase 1 of Path C — sharded entity-index scan.
|
|
1334
|
+
*
|
|
1335
|
+
* Walks the bytes in `[range_start, range_end)` once and emits
|
|
1336
|
+
* `(express_id, byte_offset, byte_length)` triples for every entity
|
|
1337
|
+
* whose `#N=` opener falls in that range. Byte offsets are GLOBAL
|
|
1338
|
+
* (relative to file start), so multiple shards' outputs concatenate
|
|
1339
|
+
* without rewriting.
|
|
1340
|
+
*
|
|
1341
|
+
* Cross-boundary handling: the scanner rewinds `range_start` to the
|
|
1342
|
+
* byte after the previous `\n` so we don't mis-parse a half entity.
|
|
1343
|
+
* The previous shard owns any entity whose opener is BEFORE its own
|
|
1344
|
+
* range_end (its terminator may extend past it; that's fine — the
|
|
1345
|
+
* scanner walks STEP entities to their terminating `;`, even if that
|
|
1346
|
+
* terminator is past the shard's nominal range_end).
|
|
1347
|
+
*
|
|
1348
|
+
* Returns nothing through the JS callback for performance signals;
|
|
1349
|
+
* emits exactly one `index-shard` event with three Uint32Arrays:
|
|
1350
|
+
* `{ type: "index-shard", ids: Uint32Array, starts: Uint32Array,
|
|
1351
|
+
* lengths: Uint32Array, shardStart: u32, shardEnd: u32 }`
|
|
1352
|
+
*
|
|
1353
|
+
* Used by the JS-side shard coordinator to merge N shards' indices
|
|
1354
|
+
* into a single entity-index without paying the 3 s single-threaded
|
|
1355
|
+
* scan cost. Style and job emission are NOT done here — they remain
|
|
1356
|
+
* the job of the existing `build_pre_pass_streaming` (which can be
|
|
1357
|
+
* called on shard 0 in parallel with the other shards' index-only
|
|
1358
|
+
* scans).
|
|
1359
|
+
* @param {Uint8Array} data
|
|
1360
|
+
* @param {Function} on_event
|
|
1361
|
+
* @param {number} range_start
|
|
1362
|
+
* @param {number} range_end
|
|
1363
|
+
* @returns {any}
|
|
1364
|
+
*/
|
|
1365
|
+
scanEntityIndexShard(data, on_event, range_start, range_end) {
|
|
1366
|
+
try {
|
|
1367
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1368
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export3);
|
|
1369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1370
|
+
wasm.ifcapi_scanEntityIndexShard(retptr, this.__wbg_ptr, ptr0, len0, addBorrowedObject(on_event), range_start, range_end);
|
|
1371
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1372
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1373
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1374
|
+
if (r2) {
|
|
1375
|
+
throw takeObject(r1);
|
|
1376
|
+
}
|
|
1377
|
+
return takeObject(r0);
|
|
1378
|
+
} finally {
|
|
1379
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1380
|
+
heap[stack_pointer++] = undefined;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Streaming pre-pass: emits geometry jobs in chunks via a JS callback
|
|
1385
|
+
* instead of waiting for the full file scan to complete.
|
|
1386
|
+
*
|
|
1387
|
+
* Single linear walk over the file:
|
|
1388
|
+
* 1. Builds the entity index incrementally from the same scan that
|
|
1389
|
+
* collects geometry jobs (the old `build_pre_pass_fast` did two
|
|
1390
|
+
* full-file scans — one for entities, one for the index — which
|
|
1391
|
+
* doubled wall-clock).
|
|
1392
|
+
* 2. As soon as `IFCPROJECT` has been seen, the unit scale and the
|
|
1393
|
+
* first ~50 geometry jobs have been collected, resolves
|
|
1394
|
+
* `unitScale` + `rtcOffset` and emits a `meta` callback so the
|
|
1395
|
+
* JS host can spin up geometry process workers.
|
|
1396
|
+
* 3. Emits `jobs` callbacks every `chunk_size` jobs (or fewer if
|
|
1397
|
+
* the meta phase already buffered some).
|
|
1398
|
+
* 4. Emits `complete` with the total job count at end of scan.
|
|
1399
|
+
*
|
|
1400
|
+
* On a 986 MB / 14 M-entity file this drops time-to-first-geometry
|
|
1401
|
+
* from ~17 s (full pre-pass + worker spawn + first batch) to ~3 s
|
|
1402
|
+
* (first 100 K bytes scanned + meta + first chunk).
|
|
1403
|
+
*
|
|
1404
|
+
* The callback receives a single `JsValue` argument shaped as one of:
|
|
1405
|
+
* `{ type: "meta", unitScale, rtcOffset: [x,y,z], needsShift, buildingRotation? }`
|
|
1406
|
+
* `{ type: "jobs", jobs: Uint32Array }` // [id, start, end] triples
|
|
1407
|
+
* `{ type: "complete", totalJobs }`
|
|
1408
|
+
* @param {Uint8Array} data
|
|
1409
|
+
* @param {Function} on_event
|
|
1410
|
+
* @param {number} chunk_size
|
|
1411
|
+
* @returns {any}
|
|
1412
|
+
*/
|
|
1413
|
+
buildPrePassStreaming(data, on_event, chunk_size) {
|
|
1414
|
+
try {
|
|
1415
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1416
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export3);
|
|
1417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1418
|
+
wasm.ifcapi_buildPrePassStreaming(retptr, this.__wbg_ptr, ptr0, len0, addBorrowedObject(on_event), chunk_size);
|
|
1419
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1420
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1421
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1422
|
+
if (r2) {
|
|
1423
|
+
throw takeObject(r1);
|
|
1424
|
+
}
|
|
1425
|
+
return takeObject(r0);
|
|
1426
|
+
} finally {
|
|
1427
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1428
|
+
heap[stack_pointer++] = undefined;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1324
1431
|
/**
|
|
1325
1432
|
* Parse IFC file with streaming GPU-ready geometry batches
|
|
1326
1433
|
*
|
|
@@ -1548,7 +1655,67 @@ export class IfcAPI {
|
|
|
1548
1655
|
return takeObject(ret);
|
|
1549
1656
|
}
|
|
1550
1657
|
/**
|
|
1551
|
-
*
|
|
1658
|
+
* Populate `cached_entity_index` from pre-extracted column arrays.
|
|
1659
|
+
*
|
|
1660
|
+
* Used by the streaming pre-pass to share its already-built entity
|
|
1661
|
+
* index across worker realms via SAB-backed Uint32Arrays — every
|
|
1662
|
+
* process worker would otherwise re-scan the entire file in
|
|
1663
|
+
* `processGeometryBatch`'s lazy build path (~5 s on a 1 GB IFC),
|
|
1664
|
+
* even though the pre-pass worker built the same index minutes
|
|
1665
|
+
* earlier.
|
|
1666
|
+
*
|
|
1667
|
+
* Building an `FxHashMap` from the three input slices costs ~1 s on
|
|
1668
|
+
* 14 M entries — about 4–5× faster than re-scanning the file. After
|
|
1669
|
+
* this call, the next `processGeometryBatch` skips the lazy build
|
|
1670
|
+
* branch and reuses the populated cache by `Arc::clone()`.
|
|
1671
|
+
*
|
|
1672
|
+
* `lengths[i]` is the byte length of entity `ids[i]`, so the cache
|
|
1673
|
+
* stores `(start, start + length)` to match the existing tuple layout.
|
|
1674
|
+
*
|
|
1675
|
+
* Idempotent in the sense that repeated calls REPLACE the cache —
|
|
1676
|
+
* supports the parser-worker pattern of reusing one IfcAPI across
|
|
1677
|
+
* multiple loads with different files.
|
|
1678
|
+
* @param {Uint32Array} ids
|
|
1679
|
+
* @param {Uint32Array} starts
|
|
1680
|
+
* @param {Uint32Array} lengths
|
|
1681
|
+
*/
|
|
1682
|
+
setEntityIndex(ids, starts, lengths) {
|
|
1683
|
+
const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_export3);
|
|
1684
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1685
|
+
const ptr1 = passArray32ToWasm0(starts, wasm.__wbindgen_export3);
|
|
1686
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1687
|
+
const ptr2 = passArray32ToWasm0(lengths, wasm.__wbindgen_export3);
|
|
1688
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1689
|
+
wasm.ifcapi_setEntityIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Toggle the "render multilayer walls as a single solid" mode (issue #540).
|
|
1693
|
+
*
|
|
1694
|
+
* When `enabled` is `true`, every subsequent `parseMeshes*` call will
|
|
1695
|
+
* suppress geometry emission for `IfcBuildingElementPart` entities whose
|
|
1696
|
+
* `IfcRelAggregates` parent wall is sliceable (has an
|
|
1697
|
+
* `IfcMaterialLayerSetUsage`) AND has its own `Representation`. The
|
|
1698
|
+
* parent wall keeps its per-layer sub-mesh colouring, so the visual
|
|
1699
|
+
* result is the same as the layered render but with one mesh per wall
|
|
1700
|
+
* instead of one per layer part — much cheaper for both CPU and GPU.
|
|
1701
|
+
*
|
|
1702
|
+
* Default is `false`. Pass `true` before calling `parseMeshes`,
|
|
1703
|
+
* `parseMeshesSubset`, `parseMeshesAsync`, `parseMeshesInstanced`, or
|
|
1704
|
+
* `parseMeshesInstancedAsync`.
|
|
1705
|
+
* @param {boolean} enabled
|
|
1706
|
+
*/
|
|
1707
|
+
setMergeLayers(enabled) {
|
|
1708
|
+
wasm.ifcapi_setMergeLayers(this.__wbg_ptr, enabled);
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Clear the cached entity index (call between loads when reusing
|
|
1712
|
+
* the same `IfcAPI` instance — e.g. the parser worker keeps one
|
|
1713
|
+
* `IfcAPI` alive across multiple `parse` requests).
|
|
1714
|
+
*
|
|
1715
|
+
* Panics if the cache Mutex is poisoned. Poisoning means an
|
|
1716
|
+
* earlier panic occurred while the lock was held — silently
|
|
1717
|
+
* continuing would mean operating on an inconsistent cache, so
|
|
1718
|
+
* fail fast.
|
|
1552
1719
|
*/
|
|
1553
1720
|
clearPrePassCache() {
|
|
1554
1721
|
wasm.ifcapi_clearPrePassCache(this.__wbg_ptr);
|
|
@@ -3058,6 +3225,9 @@ function __wbg_get_imports() {
|
|
|
3058
3225
|
const ret = GpuGeometry.__wrap(arg0);
|
|
3059
3226
|
return addHeapObject(ret);
|
|
3060
3227
|
};
|
|
3228
|
+
imports.wbg.__wbg_info_ce6bcc489c22f6f0 = function(arg0) {
|
|
3229
|
+
console.info(getObject(arg0));
|
|
3230
|
+
};
|
|
3061
3231
|
imports.wbg.__wbg_instancedgeometry_new = function(arg0) {
|
|
3062
3232
|
const ret = InstancedGeometry.__wrap(arg0);
|
|
3063
3233
|
return addHeapObject(ret);
|
|
@@ -3093,7 +3263,7 @@ function __wbg_get_imports() {
|
|
|
3093
3263
|
const a = state0.a;
|
|
3094
3264
|
state0.a = 0;
|
|
3095
3265
|
try {
|
|
3096
|
-
return
|
|
3266
|
+
return __wasm_bindgen_func_elem_1520(a, state0.b, arg0, arg1);
|
|
3097
3267
|
} finally {
|
|
3098
3268
|
state0.a = a;
|
|
3099
3269
|
}
|
|
@@ -3205,9 +3375,9 @@ function __wbg_get_imports() {
|
|
|
3205
3375
|
const ret = BigInt.asUintN(64, arg0);
|
|
3206
3376
|
return addHeapObject(ret);
|
|
3207
3377
|
};
|
|
3208
|
-
imports.wbg.
|
|
3209
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
3210
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
3378
|
+
imports.wbg.__wbindgen_cast_73cbb7b49382c492 = function(arg0, arg1) {
|
|
3379
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 179, function: Function { arguments: [Externref], shim_idx: 180, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3380
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1479, __wasm_bindgen_func_elem_1480);
|
|
3211
3381
|
return addHeapObject(ret);
|
|
3212
3382
|
};
|
|
3213
3383
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
package/pkg/ifc-lite_bg.wasm
CHANGED
|
Binary file
|