@ifc-lite/wasm 2.3.0 → 2.4.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": "2.3.0",
8
+ "version": "2.4.1",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -411,6 +411,12 @@ export class MeshDataJs {
411
411
  */
412
412
  readonly shadingColor: Float32Array | undefined;
413
413
  readonly textureWidth: number;
414
+ /**
415
+ * Geometry provenance for the viewer's Model/Types switch (#957 follow-up):
416
+ * 0 = occurrence, 1 = orphan type geometry (no occurrence), 2 = instanced
417
+ * type geometry (hidden in Model mode, shown in Types mode).
418
+ */
419
+ readonly geometryClass: number;
414
420
  readonly textureHeight: number;
415
421
  /**
416
422
  * Get triangle count
@@ -451,6 +457,30 @@ export class MeshDataJs {
451
457
  readonly positions: Float32Array;
452
458
  }
453
459
 
460
+ export class MeshOutlineJs {
461
+ private constructor();
462
+ free(): void;
463
+ [Symbol.dispose](): void;
464
+ /**
465
+ * Ring `i` as a flat `[u0, v0, u1, v1, …]` array, or `undefined` if out of
466
+ * range. The ring is closed implicitly (connect the last point to the
467
+ * first).
468
+ */
469
+ contour(index: number): Float32Array | undefined;
470
+ /**
471
+ * Number of boundary rings (outer + holes).
472
+ */
473
+ readonly contourCount: number;
474
+ /**
475
+ * Element extent (max) along the cut axis, world units.
476
+ */
477
+ readonly axisMax: number;
478
+ /**
479
+ * Element extent (min) along the cut axis, world units.
480
+ */
481
+ readonly axisMin: number;
482
+ }
483
+
454
484
  export class ProfileCollection {
455
485
  private constructor();
456
486
  free(): void;
@@ -679,6 +709,25 @@ export function get_memory(): any;
679
709
  */
680
710
  export function init(): void;
681
711
 
712
+ /**
713
+ * Compute the winding-robust 2D footprint outline of a triangle mesh.
714
+ *
715
+ * `positions` is flat XYZ; `indices` is flat triangle indices. `axis` is
716
+ * 0/1/2 = x/y/z (the cut axis, WebGL Y-up). Returns `undefined` when the mesh
717
+ * has no triangles or projects to nothing.
718
+ *
719
+ * ```javascript
720
+ * const outline = meshOutline2d(positions, indices, 1, false); // axis 1 = y
721
+ * if (outline) {
722
+ * for (let i = 0; i < outline.contourCount; i++) {
723
+ * const ring = outline.contour(i); // Float32Array of [u0, v0, u1, v1, ...]
724
+ * }
725
+ * outline.free();
726
+ * }
727
+ * ```
728
+ */
729
+ export function meshOutline2d(positions: Float32Array, indices: Uint32Array, axis: number, flipped: boolean): MeshOutlineJs | undefined;
730
+
682
731
  /**
683
732
  * Get the version of IFC-Lite.
684
733
  *
@@ -705,6 +754,7 @@ export interface InitOutput {
705
754
  readonly __wbg_ifcapi_free: (a: number, b: number) => void;
706
755
  readonly __wbg_meshcollection_free: (a: number, b: number) => void;
707
756
  readonly __wbg_meshdatajs_free: (a: number, b: number) => void;
757
+ readonly __wbg_meshoutlinejs_free: (a: number, b: number) => void;
708
758
  readonly __wbg_profilecollection_free: (a: number, b: number) => void;
709
759
  readonly __wbg_profileentryjs_free: (a: number, b: number) => void;
710
760
  readonly __wbg_symboliccircle_free: (a: number, b: number) => void;
@@ -752,6 +802,7 @@ export interface InitOutput {
752
802
  readonly ifcapi_setEntityIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
753
803
  readonly ifcapi_setMergeLayers: (a: number, b: number) => void;
754
804
  readonly ifcapi_version: (a: number, b: number) => void;
805
+ readonly meshOutline2d: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
755
806
  readonly meshcollection_buildingRotation: (a: number, b: number) => void;
756
807
  readonly meshcollection_geometryHashCount: (a: number) => number;
757
808
  readonly meshcollection_geometryHashIds: (a: number) => number;
@@ -767,6 +818,7 @@ export interface InitOutput {
767
818
  readonly meshcollection_totalVertices: (a: number) => number;
768
819
  readonly meshdatajs_color: (a: number, b: number) => void;
769
820
  readonly meshdatajs_expressId: (a: number) => number;
821
+ readonly meshdatajs_geometryClass: (a: number) => number;
770
822
  readonly meshdatajs_hasTexture: (a: number) => number;
771
823
  readonly meshdatajs_ifcType: (a: number, b: number) => void;
772
824
  readonly meshdatajs_indices: (a: number) => number;
@@ -781,6 +833,10 @@ export interface InitOutput {
781
833
  readonly meshdatajs_triangleCount: (a: number) => number;
782
834
  readonly meshdatajs_uvs: (a: number) => number;
783
835
  readonly meshdatajs_vertexCount: (a: number) => number;
836
+ readonly meshoutlinejs_axisMax: (a: number) => number;
837
+ readonly meshoutlinejs_axisMin: (a: number) => number;
838
+ readonly meshoutlinejs_contour: (a: number, b: number) => number;
839
+ readonly meshoutlinejs_contourCount: (a: number) => number;
784
840
  readonly profilecollection_get: (a: number, b: number) => number;
785
841
  readonly profilecollection_length: (a: number) => number;
786
842
  readonly profileentryjs_expressId: (a: number) => number;
@@ -856,9 +912,9 @@ export interface InitOutput {
856
912
  readonly symbolictext_worldY: (a: number) => number;
857
913
  readonly symbolictext_x: (a: number) => number;
858
914
  readonly symbolictext_y: (a: number) => number;
859
- readonly __wasm_bindgen_func_elem_666: (a: number, b: number, c: number) => void;
860
- readonly __wasm_bindgen_func_elem_665: (a: number, b: number) => void;
861
- readonly __wasm_bindgen_func_elem_700: (a: number, b: number, c: number, d: number) => void;
915
+ readonly __wasm_bindgen_func_elem_675: (a: number, b: number, c: number) => void;
916
+ readonly __wasm_bindgen_func_elem_674: (a: number, b: number) => void;
917
+ readonly __wasm_bindgen_func_elem_709: (a: number, b: number, c: number, d: number) => void;
862
918
  readonly __wbindgen_export: (a: number) => void;
863
919
  readonly __wbindgen_export2: (a: number, b: number, c: number) => void;
864
920
  readonly __wbindgen_export3: (a: number, b: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -245,12 +245,12 @@ if (!('encodeInto' in cachedTextEncoder)) {
245
245
 
246
246
  let WASM_VECTOR_LEN = 0;
247
247
 
248
- function __wasm_bindgen_func_elem_666(arg0, arg1, arg2) {
249
- wasm.__wasm_bindgen_func_elem_666(arg0, arg1, addHeapObject(arg2));
248
+ function __wasm_bindgen_func_elem_675(arg0, arg1, arg2) {
249
+ wasm.__wasm_bindgen_func_elem_675(arg0, arg1, addHeapObject(arg2));
250
250
  }
251
251
 
252
- function __wasm_bindgen_func_elem_700(arg0, arg1, arg2, arg3) {
253
- wasm.__wasm_bindgen_func_elem_700(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
252
+ function __wasm_bindgen_func_elem_709(arg0, arg1, arg2, arg3) {
253
+ wasm.__wasm_bindgen_func_elem_709(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
254
254
  }
255
255
 
256
256
  const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -281,6 +281,10 @@ const MeshDataJsFinalization = (typeof FinalizationRegistry === 'undefined')
281
281
  ? { register: () => {}, unregister: () => {} }
282
282
  : new FinalizationRegistry(ptr => wasm.__wbg_meshdatajs_free(ptr >>> 0, 1));
283
283
 
284
+ const MeshOutlineJsFinalization = (typeof FinalizationRegistry === 'undefined')
285
+ ? { register: () => {}, unregister: () => {} }
286
+ : new FinalizationRegistry(ptr => wasm.__wbg_meshoutlinejs_free(ptr >>> 0, 1));
287
+
284
288
  const ProfileCollectionFinalization = (typeof FinalizationRegistry === 'undefined')
285
289
  ? { register: () => {}, unregister: () => {} }
286
290
  : new FinalizationRegistry(ptr => wasm.__wbg_profilecollection_free(ptr >>> 0, 1));
@@ -1306,6 +1310,16 @@ export class MeshDataJs {
1306
1310
  const ret = wasm.meshdatajs_textureWidth(this.__wbg_ptr);
1307
1311
  return ret >>> 0;
1308
1312
  }
1313
+ /**
1314
+ * Geometry provenance for the viewer's Model/Types switch (#957 follow-up):
1315
+ * 0 = occurrence, 1 = orphan type geometry (no occurrence), 2 = instanced
1316
+ * type geometry (hidden in Model mode, shown in Types mode).
1317
+ * @returns {number}
1318
+ */
1319
+ get geometryClass() {
1320
+ const ret = wasm.meshdatajs_geometryClass(this.__wbg_ptr);
1321
+ return ret;
1322
+ }
1309
1323
  /**
1310
1324
  * @returns {number}
1311
1325
  */
@@ -1410,6 +1424,70 @@ export class MeshDataJs {
1410
1424
  }
1411
1425
  if (Symbol.dispose) MeshDataJs.prototype[Symbol.dispose] = MeshDataJs.prototype.free;
1412
1426
 
1427
+ /**
1428
+ * A mesh's projected footprint outline.
1429
+ *
1430
+ * Contours are closed rings in drawing 2D space (same basis as `projectTo2D`
1431
+ * in `@ifc-lite/drawing-2d`), WITHOUT a duplicated closing vertex.
1432
+ * `axisMin`/`axisMax` are the element's extent along the cut axis (world
1433
+ * units, not flip-adjusted) for band classification on the TS side.
1434
+ */
1435
+ export class MeshOutlineJs {
1436
+ static __wrap(ptr) {
1437
+ ptr = ptr >>> 0;
1438
+ const obj = Object.create(MeshOutlineJs.prototype);
1439
+ obj.__wbg_ptr = ptr;
1440
+ MeshOutlineJsFinalization.register(obj, obj.__wbg_ptr, obj);
1441
+ return obj;
1442
+ }
1443
+ __destroy_into_raw() {
1444
+ const ptr = this.__wbg_ptr;
1445
+ this.__wbg_ptr = 0;
1446
+ MeshOutlineJsFinalization.unregister(this);
1447
+ return ptr;
1448
+ }
1449
+ free() {
1450
+ const ptr = this.__destroy_into_raw();
1451
+ wasm.__wbg_meshoutlinejs_free(ptr, 0);
1452
+ }
1453
+ /**
1454
+ * Number of boundary rings (outer + holes).
1455
+ * @returns {number}
1456
+ */
1457
+ get contourCount() {
1458
+ const ret = wasm.meshoutlinejs_contourCount(this.__wbg_ptr);
1459
+ return ret >>> 0;
1460
+ }
1461
+ /**
1462
+ * Ring `i` as a flat `[u0, v0, u1, v1, …]` array, or `undefined` if out of
1463
+ * range. The ring is closed implicitly (connect the last point to the
1464
+ * first).
1465
+ * @param {number} index
1466
+ * @returns {Float32Array | undefined}
1467
+ */
1468
+ contour(index) {
1469
+ const ret = wasm.meshoutlinejs_contour(this.__wbg_ptr, index);
1470
+ return takeObject(ret);
1471
+ }
1472
+ /**
1473
+ * Element extent (max) along the cut axis, world units.
1474
+ * @returns {number}
1475
+ */
1476
+ get axisMax() {
1477
+ const ret = wasm.meshoutlinejs_axisMax(this.__wbg_ptr);
1478
+ return ret;
1479
+ }
1480
+ /**
1481
+ * Element extent (min) along the cut axis, world units.
1482
+ * @returns {number}
1483
+ */
1484
+ get axisMin() {
1485
+ const ret = wasm.meshoutlinejs_axisMin(this.__wbg_ptr);
1486
+ return ret;
1487
+ }
1488
+ }
1489
+ if (Symbol.dispose) MeshOutlineJs.prototype[Symbol.dispose] = MeshOutlineJs.prototype.free;
1490
+
1413
1491
  /**
1414
1492
  * A collection of extracted profiles.
1415
1493
  */
@@ -2306,6 +2384,37 @@ export function init() {
2306
2384
  wasm.init();
2307
2385
  }
2308
2386
 
2387
+ /**
2388
+ * Compute the winding-robust 2D footprint outline of a triangle mesh.
2389
+ *
2390
+ * `positions` is flat XYZ; `indices` is flat triangle indices. `axis` is
2391
+ * 0/1/2 = x/y/z (the cut axis, WebGL Y-up). Returns `undefined` when the mesh
2392
+ * has no triangles or projects to nothing.
2393
+ *
2394
+ * ```javascript
2395
+ * const outline = meshOutline2d(positions, indices, 1, false); // axis 1 = y
2396
+ * if (outline) {
2397
+ * for (let i = 0; i < outline.contourCount; i++) {
2398
+ * const ring = outline.contour(i); // Float32Array of [u0, v0, u1, v1, ...]
2399
+ * }
2400
+ * outline.free();
2401
+ * }
2402
+ * ```
2403
+ * @param {Float32Array} positions
2404
+ * @param {Uint32Array} indices
2405
+ * @param {number} axis
2406
+ * @param {boolean} flipped
2407
+ * @returns {MeshOutlineJs | undefined}
2408
+ */
2409
+ export function meshOutline2d(positions, indices, axis, flipped) {
2410
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_export3);
2411
+ const len0 = WASM_VECTOR_LEN;
2412
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_export3);
2413
+ const len1 = WASM_VECTOR_LEN;
2414
+ const ret = wasm.meshOutline2d(ptr0, len0, ptr1, len1, axis, flipped);
2415
+ return ret === 0 ? undefined : MeshOutlineJs.__wrap(ret);
2416
+ }
2417
+
2309
2418
  /**
2310
2419
  * Get the version of IFC-Lite.
2311
2420
  *
@@ -2435,7 +2544,7 @@ function __wbg_get_imports() {
2435
2544
  const a = state0.a;
2436
2545
  state0.a = 0;
2437
2546
  try {
2438
- return __wasm_bindgen_func_elem_700(a, state0.b, arg0, arg1);
2547
+ return __wasm_bindgen_func_elem_709(a, state0.b, arg0, arg1);
2439
2548
  } finally {
2440
2549
  state0.a = a;
2441
2550
  }
@@ -2540,7 +2649,7 @@ function __wbg_get_imports() {
2540
2649
  };
2541
2650
  imports.wbg.__wbindgen_cast_0093e2d96a856a3b = function(arg0, arg1) {
2542
2651
  // Cast intrinsic for `Closure(Closure { dtor_idx: 61, function: Function { arguments: [Externref], shim_idx: 62, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2543
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_665, __wasm_bindgen_func_elem_666);
2652
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_674, __wasm_bindgen_func_elem_675);
2544
2653
  return addHeapObject(ret);
2545
2654
  };
2546
2655
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
Binary file