@ifc-lite/wasm 3.0.13 → 3.0.14

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 CHANGED
@@ -101,7 +101,7 @@ This package ships the bindings only. The Rust source lives in [`rust/wasm-bindi
101
101
 
102
102
  ## API
103
103
 
104
- See the [WASM API Reference](https://ltplus-ag.github.io/ifc-lite/api/wasm/).
104
+ See the [WASM API Reference](https://ifclite.dev/docs/api/wasm/).
105
105
 
106
106
  ## License
107
107
 
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": "3.0.13",
8
+ "version": "3.0.14",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "homepage": "https://ltplus-ag.github.io/ifc-lite/",
42
+ "homepage": "https://ifclite.dev/docs/",
43
43
  "bugs": "https://github.com/LTplus-AG/ifc-lite/issues",
44
44
  "scripts": {
45
45
  "build": "node ../../scripts/run-build-wasm.mjs",
package/pkg/ifc-lite.d.ts CHANGED
@@ -93,6 +93,9 @@ export class IfcAPI {
93
93
  * `true` ⇒ lit (the default), `false` ⇒ flat `KHR_materials_unlit` (the
94
94
  * historical look — #1321). Optional at the boundary so older 5-arg callers
95
95
  * keep lit-by-default behaviour.
96
+ * `emissive` self-illuminates each material at its base colour (core glTF
97
+ * `emissiveFactor`) so renderers without ambient/IBL — Google Earth — don't
98
+ * render the model near-black (#1427); omitted or `false` ⇒ off.
96
99
  *
97
100
  * Fails CLOSED: when the visible mesh set is empty this throws an `Error`
98
101
  * whose message starts with `NO_RENDER_GEOMETRY`, instead of returning a
@@ -100,14 +103,22 @@ export class IfcAPI {
100
103
  * CLI/MCP wrappers; making the boundary itself refuse means SDK/viewer/
101
104
  * direct callers inherit it too (the TS guards stay as defense-in-depth).
102
105
  */
103
- exportGlb(content: Uint8Array, include_metadata: boolean, hidden: Uint32Array, isolated: Uint32Array, hidden_types_csv: string, lit?: boolean | null): Uint8Array;
106
+ exportGlb(content: Uint8Array, include_metadata: boolean, hidden: Uint32Array, isolated: Uint32Array, hidden_types_csv: string, lit?: boolean | null, emissive?: boolean | null): Uint8Array;
104
107
  /**
105
108
  * Package an already-produced **GLB** + georeference into a **KMZ** (`Uint8Array`)
106
109
  * for Google Earth: a ZIP of `doc.kml` (a `<Model>` placed at `latitude`/`longitude`/
107
110
  * `altitude`) + `model.glb`. `x_axis_abscissa`/`x_axis_ordinate` are the
108
111
  * `IfcMapConversion` grid-north components; pass both as `undefined` for heading 0.
112
+ *
113
+ * `altitude_mode` selects the KML vertical placement: `"clampToGround"`
114
+ * (the default when omitted) rests the model on the terrain, ignoring
115
+ * `altitude`; `"absolute"` places the origin at `altitude` metres MSL.
116
+ * Google Earth's terrain already encodes the site elevation, so clamping
117
+ * keeps a wrong/zero/double-counted OrthogonalHeight from floating the
118
+ * model into the sky (#1427); absolute is offered for models whose
119
+ * OrthogonalHeight is a true MSL elevation the user wants honoured.
109
120
  */
110
- exportKmz(glb: Uint8Array, latitude: number, longitude: number, altitude: number, x_axis_abscissa: number | null | undefined, x_axis_ordinate: number | null | undefined, name: string): Uint8Array;
121
+ exportKmz(glb: Uint8Array, latitude: number, longitude: number, altitude: number, x_axis_abscissa: number | null | undefined, x_axis_ordinate: number | null | undefined, name: string, altitude_mode?: string | null): Uint8Array;
111
122
  /**
112
123
  * Assemble a **GLB** from already-produced meshes (the viewer's `MeshData`, flattened)
113
124
  * — no re-meshing. Per mesh `i`: `vertex_counts[i]` verts + `index_counts[i]` indices
@@ -115,7 +126,20 @@ export class IfcAPI {
115
126
  * RGBA per mesh, `origins` xyz per mesh, `express_ids` labels each mesh (indices are
116
127
  * per-mesh local). The caller passes exactly the meshes it wants emitted.
117
128
  */
118
- 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): Uint8Array;
129
+ 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;
130
+ /**
131
+ * Build a Google-Earth-ready **KMZ** (`Uint8Array`) straight from the viewer's
132
+ * already-produced meshes — the working path (#1427). The model is embedded as
133
+ * **COLLADA** (`model.dae`), the only `<Model>` format Google Earth loads (a GLB
134
+ * raises "Unsupported element: Model"), with emission-lit double-sided materials
135
+ * placement. Mesh arrays match `exportGlbFromMeshes`;
136
+ * `latitude`/`longitude`/`altitude` + `x_axis_abscissa`/`x_axis_ordinate`
137
+ * (grid-north, `undefined` ⇒ heading 0) place + orient the model.
138
+ * `altitude_mode` (`"clampToGround"` default ⇒ rest on terrain, ignoring
139
+ * `altitude`; `"absolute"` ⇒ place at `altitude` metres MSL) selects the
140
+ * KML vertical placement (#1427).
141
+ */
142
+ exportKmzFromMeshes(positions: Float32Array, normals: Float32Array, indices: Uint32Array, vertex_counts: Uint32Array, index_counts: Uint32Array, colors: Float32Array, origins: Float64Array, latitude: number, longitude: number, altitude: number, x_axis_abscissa: number | null | undefined, x_axis_ordinate: number | null | undefined, name: string, altitude_mode?: string | null): Uint8Array;
119
143
  /**
120
144
  * Export the render geometry in `content` as Wavefront **OBJ** UTF-8 bytes.
121
145
  *
@@ -1217,13 +1241,14 @@ export interface InitOutput {
1217
1241
  readonly ifcapi_clearPrePassCache: (a: number) => void;
1218
1242
  readonly ifcapi_diagnoseGeometry: (a: number, b: number, c: number) => number;
1219
1243
  readonly ifcapi_exportCsv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1220
- readonly ifcapi_exportGlb: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
1221
- readonly ifcapi_exportGlbFromMeshes: (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) => void;
1244
+ readonly ifcapi_exportGlb: (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) => void;
1245
+ readonly ifcapi_exportGlbFromMeshes: (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) => void;
1222
1246
  readonly ifcapi_exportHbjson: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1223
1247
  readonly ifcapi_exportIfcx: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
1224
1248
  readonly ifcapi_exportJson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
1225
1249
  readonly ifcapi_exportJsonld: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
1226
- readonly ifcapi_exportKmz: (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) => void;
1250
+ readonly ifcapi_exportKmz: (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) => void;
1251
+ readonly ifcapi_exportKmzFromMeshes: (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, z: number, a1: number) => void;
1227
1252
  readonly ifcapi_exportMerged: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
1228
1253
  readonly ifcapi_exportObj: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
1229
1254
  readonly ifcapi_exportStep: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
package/pkg/ifc-lite.js CHANGED
@@ -639,6 +639,9 @@ export class IfcAPI {
639
639
  * `true` ⇒ lit (the default), `false` ⇒ flat `KHR_materials_unlit` (the
640
640
  * historical look — #1321). Optional at the boundary so older 5-arg callers
641
641
  * keep lit-by-default behaviour.
642
+ * `emissive` self-illuminates each material at its base colour (core glTF
643
+ * `emissiveFactor`) so renderers without ambient/IBL — Google Earth — don't
644
+ * render the model near-black (#1427); omitted or `false` ⇒ off.
642
645
  *
643
646
  * Fails CLOSED: when the visible mesh set is empty this throws an `Error`
644
647
  * whose message starts with `NO_RENDER_GEOMETRY`, instead of returning a
@@ -651,9 +654,10 @@ export class IfcAPI {
651
654
  * @param {Uint32Array} isolated
652
655
  * @param {string} hidden_types_csv
653
656
  * @param {boolean | null} [lit]
657
+ * @param {boolean | null} [emissive]
654
658
  * @returns {Uint8Array}
655
659
  */
656
- exportGlb(content, include_metadata, hidden, isolated, hidden_types_csv, lit) {
660
+ exportGlb(content, include_metadata, hidden, isolated, hidden_types_csv, lit, emissive) {
657
661
  try {
658
662
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
659
663
  const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
@@ -664,7 +668,7 @@ export class IfcAPI {
664
668
  const len2 = WASM_VECTOR_LEN;
665
669
  const ptr3 = passStringToWasm0(hidden_types_csv, wasm.__wbindgen_export, wasm.__wbindgen_export2);
666
670
  const len3 = WASM_VECTOR_LEN;
667
- wasm.ifcapi_exportGlb(retptr, this.__wbg_ptr, ptr0, len0, include_metadata, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(lit) ? 0xFFFFFF : lit ? 1 : 0);
671
+ wasm.ifcapi_exportGlb(retptr, this.__wbg_ptr, ptr0, len0, include_metadata, ptr1, len1, ptr2, len2, ptr3, len3, isLikeNone(lit) ? 0xFFFFFF : lit ? 1 : 0, isLikeNone(emissive) ? 0xFFFFFF : emissive ? 1 : 0);
668
672
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
669
673
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
670
674
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -684,6 +688,14 @@ export class IfcAPI {
684
688
  * for Google Earth: a ZIP of `doc.kml` (a `<Model>` placed at `latitude`/`longitude`/
685
689
  * `altitude`) + `model.glb`. `x_axis_abscissa`/`x_axis_ordinate` are the
686
690
  * `IfcMapConversion` grid-north components; pass both as `undefined` for heading 0.
691
+ *
692
+ * `altitude_mode` selects the KML vertical placement: `"clampToGround"`
693
+ * (the default when omitted) rests the model on the terrain, ignoring
694
+ * `altitude`; `"absolute"` places the origin at `altitude` metres MSL.
695
+ * Google Earth's terrain already encodes the site elevation, so clamping
696
+ * keeps a wrong/zero/double-counted OrthogonalHeight from floating the
697
+ * model into the sky (#1427); absolute is offered for models whose
698
+ * OrthogonalHeight is a true MSL elevation the user wants honoured.
687
699
  * @param {Uint8Array} glb
688
700
  * @param {number} latitude
689
701
  * @param {number} longitude
@@ -691,21 +703,24 @@ export class IfcAPI {
691
703
  * @param {number | null | undefined} x_axis_abscissa
692
704
  * @param {number | null | undefined} x_axis_ordinate
693
705
  * @param {string} name
706
+ * @param {string | null} [altitude_mode]
694
707
  * @returns {Uint8Array}
695
708
  */
696
- exportKmz(glb, latitude, longitude, altitude, x_axis_abscissa, x_axis_ordinate, name) {
709
+ exportKmz(glb, latitude, longitude, altitude, x_axis_abscissa, x_axis_ordinate, name, altitude_mode) {
697
710
  try {
698
711
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
699
712
  const ptr0 = passArray8ToWasm0(glb, wasm.__wbindgen_export);
700
713
  const len0 = WASM_VECTOR_LEN;
701
714
  const ptr1 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
702
715
  const len1 = WASM_VECTOR_LEN;
703
- wasm.ifcapi_exportKmz(retptr, this.__wbg_ptr, ptr0, len0, latitude, longitude, altitude, !isLikeNone(x_axis_abscissa), isLikeNone(x_axis_abscissa) ? 0 : x_axis_abscissa, !isLikeNone(x_axis_ordinate), isLikeNone(x_axis_ordinate) ? 0 : x_axis_ordinate, ptr1, len1);
716
+ var ptr2 = isLikeNone(altitude_mode) ? 0 : passStringToWasm0(altitude_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
717
+ var len2 = WASM_VECTOR_LEN;
718
+ wasm.ifcapi_exportKmz(retptr, this.__wbg_ptr, ptr0, len0, latitude, longitude, altitude, !isLikeNone(x_axis_abscissa), isLikeNone(x_axis_abscissa) ? 0 : x_axis_abscissa, !isLikeNone(x_axis_ordinate), isLikeNone(x_axis_ordinate) ? 0 : x_axis_ordinate, ptr1, len1, ptr2, len2);
704
719
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
705
720
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
706
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
721
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
707
722
  wasm.__wbindgen_export4(r0, r1 * 1, 1);
708
- return v3;
723
+ return v4;
709
724
  } finally {
710
725
  wasm.__wbindgen_add_to_stack_pointer(16);
711
726
  }
@@ -726,9 +741,10 @@ export class IfcAPI {
726
741
  * @param {Uint32Array} express_ids
727
742
  * @param {boolean} include_metadata
728
743
  * @param {boolean | null} [lit]
744
+ * @param {boolean | null} [emissive]
729
745
  * @returns {Uint8Array}
730
746
  */
731
- exportGlbFromMeshes(positions, normals, indices, vertex_counts, index_counts, colors, origins, express_ids, include_metadata, lit) {
747
+ exportGlbFromMeshes(positions, normals, indices, vertex_counts, index_counts, colors, origins, express_ids, include_metadata, lit, emissive) {
732
748
  try {
733
749
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
734
750
  const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_export);
@@ -747,7 +763,7 @@ export class IfcAPI {
747
763
  const len6 = WASM_VECTOR_LEN;
748
764
  const ptr7 = passArray32ToWasm0(express_ids, wasm.__wbindgen_export);
749
765
  const len7 = WASM_VECTOR_LEN;
750
- 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);
766
+ 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
767
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
752
768
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
753
769
  var v9 = getArrayU8FromWasm0(r0, r1).slice();
@@ -757,6 +773,64 @@ export class IfcAPI {
757
773
  wasm.__wbindgen_add_to_stack_pointer(16);
758
774
  }
759
775
  }
776
+ /**
777
+ * Build a Google-Earth-ready **KMZ** (`Uint8Array`) straight from the viewer's
778
+ * already-produced meshes — the working path (#1427). The model is embedded as
779
+ * **COLLADA** (`model.dae`), the only `<Model>` format Google Earth loads (a GLB
780
+ * raises "Unsupported element: Model"), with emission-lit double-sided materials
781
+ * placement. Mesh arrays match `exportGlbFromMeshes`;
782
+ * `latitude`/`longitude`/`altitude` + `x_axis_abscissa`/`x_axis_ordinate`
783
+ * (grid-north, `undefined` ⇒ heading 0) place + orient the model.
784
+ * `altitude_mode` (`"clampToGround"` default ⇒ rest on terrain, ignoring
785
+ * `altitude`; `"absolute"` ⇒ place at `altitude` metres MSL) selects the
786
+ * KML vertical placement (#1427).
787
+ * @param {Float32Array} positions
788
+ * @param {Float32Array} normals
789
+ * @param {Uint32Array} indices
790
+ * @param {Uint32Array} vertex_counts
791
+ * @param {Uint32Array} index_counts
792
+ * @param {Float32Array} colors
793
+ * @param {Float64Array} origins
794
+ * @param {number} latitude
795
+ * @param {number} longitude
796
+ * @param {number} altitude
797
+ * @param {number | null | undefined} x_axis_abscissa
798
+ * @param {number | null | undefined} x_axis_ordinate
799
+ * @param {string} name
800
+ * @param {string | null} [altitude_mode]
801
+ * @returns {Uint8Array}
802
+ */
803
+ exportKmzFromMeshes(positions, normals, indices, vertex_counts, index_counts, colors, origins, latitude, longitude, altitude, x_axis_abscissa, x_axis_ordinate, name, altitude_mode) {
804
+ try {
805
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
806
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_export);
807
+ const len0 = WASM_VECTOR_LEN;
808
+ const ptr1 = passArrayF32ToWasm0(normals, wasm.__wbindgen_export);
809
+ const len1 = WASM_VECTOR_LEN;
810
+ const ptr2 = passArray32ToWasm0(indices, wasm.__wbindgen_export);
811
+ const len2 = WASM_VECTOR_LEN;
812
+ const ptr3 = passArray32ToWasm0(vertex_counts, wasm.__wbindgen_export);
813
+ const len3 = WASM_VECTOR_LEN;
814
+ const ptr4 = passArray32ToWasm0(index_counts, wasm.__wbindgen_export);
815
+ const len4 = WASM_VECTOR_LEN;
816
+ const ptr5 = passArrayF32ToWasm0(colors, wasm.__wbindgen_export);
817
+ const len5 = WASM_VECTOR_LEN;
818
+ const ptr6 = passArrayF64ToWasm0(origins, wasm.__wbindgen_export);
819
+ const len6 = WASM_VECTOR_LEN;
820
+ const ptr7 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
821
+ const len7 = WASM_VECTOR_LEN;
822
+ var ptr8 = isLikeNone(altitude_mode) ? 0 : passStringToWasm0(altitude_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
823
+ var len8 = WASM_VECTOR_LEN;
824
+ wasm.ifcapi_exportKmzFromMeshes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, latitude, longitude, altitude, !isLikeNone(x_axis_abscissa), isLikeNone(x_axis_abscissa) ? 0 : x_axis_abscissa, !isLikeNone(x_axis_ordinate), isLikeNone(x_axis_ordinate) ? 0 : x_axis_ordinate, ptr7, len7, ptr8, len8);
825
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
826
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
827
+ var v10 = getArrayU8FromWasm0(r0, r1).slice();
828
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
829
+ return v10;
830
+ } finally {
831
+ wasm.__wbindgen_add_to_stack_pointer(16);
832
+ }
833
+ }
760
834
  /**
761
835
  * Export the render geometry in `content` as Wavefront **OBJ** UTF-8 bytes.
762
836
  *
Binary file