@ifc-lite/wasm 4.3.0 → 4.3.1

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "4.3.0",
8
+ "version": "4.3.1",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -276,6 +276,13 @@ export class IfcAPI {
276
276
  * taken in order from the concatenated `positions`/`normals`/`indices`; `colors` is
277
277
  * RGBA per mesh, `origins` xyz per mesh, `express_ids` labels each mesh (indices are
278
278
  * per-mesh local). The caller passes exactly the meshes it wants emitted.
279
+ *
280
+ * Fails CLOSED: if the declared vertex/index counts run past the flattened
281
+ * `positions` / `indices`, there are fewer `index_counts` than meshes, or `normals`
282
+ * is empty or too short to cover every vertex, this throws an `Error` whose message
283
+ * starts with `MALFORMED_MESH_INPUT` — instead of silently emitting a GLB with those
284
+ * meshes dropped. (The viewer always passes fully-backed, normal-covered arrays, so
285
+ * this only fires on a caller bug.)
279
286
  */
280
287
  exportGlbFromMeshes(positions: Float32Array, normals: Float32Array, indices: Uint32Array, vertex_counts: Uint32Array, index_counts: Uint32Array, colors: Float32Array, origins: Float64Array, express_ids: Uint32Array, include_metadata: boolean, lit?: boolean | null, emissive?: boolean | null): Uint8Array;
281
288
  /**
@@ -374,6 +381,12 @@ export class IfcAPI {
374
381
  * property-set synthesis); empty ⇒ none. See `export_step_json` for the shape.
375
382
  */
376
383
  exportStep(content: Uint8Array, schema: string, included: Uint32Array, mutations_json: string): Uint8Array;
384
+ /**
385
+ * Export **OpenUSD** (`.usda` ASCII): a real Z-up USD stage — spatial hierarchy of
386
+ * `Xform` prims, `UsdGeomMesh` geometry, `UsdPreviewSurface` materials, IFC
387
+ * metadata as custom attributes. Whole-model (geometry-backed).
388
+ */
389
+ exportUsd(content: Uint8Array): Uint8Array;
377
390
  /**
378
391
  * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
379
392
  * representations.
@@ -547,15 +560,22 @@ export class IfcAPI {
547
560
  * range_end)` shard; the main thread stitches the returned columns into the
548
561
  * full entity index (byte-identical to the single-threaded
549
562
  * `build_entity_index`) by binary-searching each shard for the previous
550
- * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard`, the
551
- * exact per-chunk primitive the native `build_entity_index_parallel` fans
552
- * across cores so the sharded merge cannot drift from the serial builder.
563
+ * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard_classified`
564
+ * a separately-maintained loop over the same `EntityScanner` primitive as
565
+ * `scan_shard` (the one the native `build_entity_index_parallel` fans across
566
+ * cores), plus a per-record class column this sharded path also needs. The
567
+ * two loops' records/handoff are kept in parity by a dedicated test
568
+ * (`rust/processing/tests/issue_2053_shard_scan_parity.rs`), not by
569
+ * delegation — edit one without the other and that test catches the drift.
553
570
  *
554
571
  * Byte offsets returned are GLOBAL (relative to file start), so shards
555
572
  * concatenate without rewriting. Returns a plain object:
556
573
  * `{ ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array,
557
- * handoff: number }`
558
- * where `handoff` is the global start of the first entity at/after
574
+ * classes: Uint8Array, handoff: number }`
575
+ * where `classes` is the parallel per-record prepass class byte
576
+ * (`PREPASS_CLASS_*`: named code in the low bits plus the geometry-job /
577
+ * type-candidate flags) the host filters on to rebuild pre-pass span
578
+ * lists, and `handoff` is the global start of the first entity at/after
559
579
  * `range_end` (the next shard's first real entity), or `-1` at EOF.
560
580
  */
561
581
  scanEntityIndexShard(data: Uint8Array, range_start: number, range_end: number): any;
@@ -1646,6 +1666,7 @@ export interface InitOutput {
1646
1666
  readonly ifcapi_exportMerged: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1647
1667
  readonly ifcapi_exportObj: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1648
1668
  readonly ifcapi_exportStep: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
1669
+ readonly ifcapi_exportUsd: (a: number, b: number, c: number, d: number) => void;
1649
1670
  readonly ifcapi_extractProfiles: (a: number, b: number, c: number, d: number) => number;
1650
1671
  readonly ifcapi_finalizePrepassStyles: (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, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number) => void;
1651
1672
  readonly ifcapi_getMemory: (a: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -715,6 +715,13 @@ export class IfcAPI {
715
715
  * taken in order from the concatenated `positions`/`normals`/`indices`; `colors` is
716
716
  * RGBA per mesh, `origins` xyz per mesh, `express_ids` labels each mesh (indices are
717
717
  * per-mesh local). The caller passes exactly the meshes it wants emitted.
718
+ *
719
+ * Fails CLOSED: if the declared vertex/index counts run past the flattened
720
+ * `positions` / `indices`, there are fewer `index_counts` than meshes, or `normals`
721
+ * is empty or too short to cover every vertex, this throws an `Error` whose message
722
+ * starts with `MALFORMED_MESH_INPUT` — instead of silently emitting a GLB with those
723
+ * meshes dropped. (The viewer always passes fully-backed, normal-covered arrays, so
724
+ * this only fires on a caller bug.)
718
725
  * @param {Float32Array} positions
719
726
  * @param {Float32Array} normals
720
727
  * @param {Uint32Array} indices
@@ -750,6 +757,11 @@ export class IfcAPI {
750
757
  wasm.ifcapi_exportGlbFromMeshes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, include_metadata, isLikeNone(lit) ? 0xFFFFFF : lit ? 1 : 0, isLikeNone(emissive) ? 0xFFFFFF : emissive ? 1 : 0);
751
758
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
752
759
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
760
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
761
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
762
+ if (r3) {
763
+ throw takeObject(r2);
764
+ }
753
765
  var v9 = getArrayU8FromWasm0(r0, r1).slice();
754
766
  wasm.__wbindgen_export4(r0, r1 * 1, 1);
755
767
  return v9;
@@ -1076,6 +1088,28 @@ export class IfcAPI {
1076
1088
  wasm.__wbindgen_add_to_stack_pointer(16);
1077
1089
  }
1078
1090
  }
1091
+ /**
1092
+ * Export **OpenUSD** (`.usda` ASCII): a real Z-up USD stage — spatial hierarchy of
1093
+ * `Xform` prims, `UsdGeomMesh` geometry, `UsdPreviewSurface` materials, IFC
1094
+ * metadata as custom attributes. Whole-model (geometry-backed).
1095
+ * @param {Uint8Array} content
1096
+ * @returns {Uint8Array}
1097
+ */
1098
+ exportUsd(content) {
1099
+ try {
1100
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1101
+ const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
1102
+ const len0 = WASM_VECTOR_LEN;
1103
+ wasm.ifcapi_exportUsd(retptr, this.__wbg_ptr, ptr0, len0);
1104
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1105
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1106
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
1107
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1108
+ return v2;
1109
+ } finally {
1110
+ wasm.__wbindgen_add_to_stack_pointer(16);
1111
+ }
1112
+ }
1079
1113
  /**
1080
1114
  * Extract raw profile polygons from all building elements with `IfcExtrudedAreaSolid`
1081
1115
  * representations.
@@ -1593,15 +1627,22 @@ export class IfcAPI {
1593
1627
  * range_end)` shard; the main thread stitches the returned columns into the
1594
1628
  * full entity index (byte-identical to the single-threaded
1595
1629
  * `build_entity_index`) by binary-searching each shard for the previous
1596
- * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard`, the
1597
- * exact per-chunk primitive the native `build_entity_index_parallel` fans
1598
- * across cores so the sharded merge cannot drift from the serial builder.
1630
+ * shard's `handoff`. Delegates to `ifc_lite_processing::scan_shard_classified`
1631
+ * a separately-maintained loop over the same `EntityScanner` primitive as
1632
+ * `scan_shard` (the one the native `build_entity_index_parallel` fans across
1633
+ * cores), plus a per-record class column this sharded path also needs. The
1634
+ * two loops' records/handoff are kept in parity by a dedicated test
1635
+ * (`rust/processing/tests/issue_2053_shard_scan_parity.rs`), not by
1636
+ * delegation — edit one without the other and that test catches the drift.
1599
1637
  *
1600
1638
  * Byte offsets returned are GLOBAL (relative to file start), so shards
1601
1639
  * concatenate without rewriting. Returns a plain object:
1602
1640
  * `{ ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array,
1603
- * handoff: number }`
1604
- * where `handoff` is the global start of the first entity at/after
1641
+ * classes: Uint8Array, handoff: number }`
1642
+ * where `classes` is the parallel per-record prepass class byte
1643
+ * (`PREPASS_CLASS_*`: named code in the low bits plus the geometry-job /
1644
+ * type-candidate flags) the host filters on to rebuild pre-pass span
1645
+ * lists, and `handoff` is the global start of the first entity at/after
1605
1646
  * `range_end` (the next shard's first real entity), or `-1` at EOF.
1606
1647
  * @param {Uint8Array} data
1607
1648
  * @param {number} range_start
Binary file