@ifc-lite/wasm 1.0.0 → 1.1.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.
@@ -89,6 +89,11 @@ function getArrayF32FromWasm0(ptr, len) {
89
89
  return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
90
90
  }
91
91
 
92
+ function getArrayF64FromWasm0(ptr, len) {
93
+ ptr = ptr >>> 0;
94
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
95
+ }
96
+
92
97
  function getArrayU32FromWasm0(ptr, len) {
93
98
  ptr = ptr >>> 0;
94
99
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
@@ -110,6 +115,14 @@ function getFloat32ArrayMemory0() {
110
115
  return cachedFloat32ArrayMemory0;
111
116
  }
112
117
 
118
+ let cachedFloat64ArrayMemory0 = null;
119
+ function getFloat64ArrayMemory0() {
120
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
121
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
122
+ }
123
+ return cachedFloat64ArrayMemory0;
124
+ }
125
+
113
126
  function getStringFromWasm0(ptr, len) {
114
127
  ptr = ptr >>> 0;
115
128
  return decodeText(ptr, len);
@@ -250,30 +263,257 @@ if (!('encodeInto' in cachedTextEncoder)) {
250
263
 
251
264
  let WASM_VECTOR_LEN = 0;
252
265
 
253
- function __wasm_bindgen_func_elem_160(arg0, arg1, arg2) {
254
- wasm.__wasm_bindgen_func_elem_160(arg0, arg1, addHeapObject(arg2));
266
+ function __wasm_bindgen_func_elem_295(arg0, arg1) {
267
+ wasm.__wasm_bindgen_func_elem_295(arg0, arg1);
268
+ }
269
+
270
+ function __wasm_bindgen_func_elem_306(arg0, arg1, arg2) {
271
+ wasm.__wasm_bindgen_func_elem_306(arg0, arg1, addHeapObject(arg2));
255
272
  }
256
273
 
257
- function __wasm_bindgen_func_elem_198(arg0, arg1, arg2, arg3) {
258
- wasm.__wasm_bindgen_func_elem_198(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
274
+ function __wasm_bindgen_func_elem_340(arg0, arg1, arg2, arg3) {
275
+ wasm.__wasm_bindgen_func_elem_340(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
259
276
  }
260
277
 
278
+ const GeoReferenceJsFinalization = (typeof FinalizationRegistry === 'undefined')
279
+ ? { register: () => {}, unregister: () => {} }
280
+ : new FinalizationRegistry(ptr => wasm.__wbg_georeferencejs_free(ptr >>> 0, 1));
281
+
261
282
  const IfcAPIFinalization = (typeof FinalizationRegistry === 'undefined')
262
283
  ? { register: () => {}, unregister: () => {} }
263
284
  : new FinalizationRegistry(ptr => wasm.__wbg_ifcapi_free(ptr >>> 0, 1));
264
285
 
286
+ const InstanceDataFinalization = (typeof FinalizationRegistry === 'undefined')
287
+ ? { register: () => {}, unregister: () => {} }
288
+ : new FinalizationRegistry(ptr => wasm.__wbg_instancedata_free(ptr >>> 0, 1));
289
+
290
+ const InstancedGeometryFinalization = (typeof FinalizationRegistry === 'undefined')
291
+ ? { register: () => {}, unregister: () => {} }
292
+ : new FinalizationRegistry(ptr => wasm.__wbg_instancedgeometry_free(ptr >>> 0, 1));
293
+
294
+ const InstancedMeshCollectionFinalization = (typeof FinalizationRegistry === 'undefined')
295
+ ? { register: () => {}, unregister: () => {} }
296
+ : new FinalizationRegistry(ptr => wasm.__wbg_instancedmeshcollection_free(ptr >>> 0, 1));
297
+
265
298
  const MeshCollectionFinalization = (typeof FinalizationRegistry === 'undefined')
266
299
  ? { register: () => {}, unregister: () => {} }
267
300
  : new FinalizationRegistry(ptr => wasm.__wbg_meshcollection_free(ptr >>> 0, 1));
268
301
 
302
+ const MeshCollectionWithRtcFinalization = (typeof FinalizationRegistry === 'undefined')
303
+ ? { register: () => {}, unregister: () => {} }
304
+ : new FinalizationRegistry(ptr => wasm.__wbg_meshcollectionwithrtc_free(ptr >>> 0, 1));
305
+
269
306
  const MeshDataJsFinalization = (typeof FinalizationRegistry === 'undefined')
270
307
  ? { register: () => {}, unregister: () => {} }
271
308
  : new FinalizationRegistry(ptr => wasm.__wbg_meshdatajs_free(ptr >>> 0, 1));
272
309
 
310
+ const RtcOffsetJsFinalization = (typeof FinalizationRegistry === 'undefined')
311
+ ? { register: () => {}, unregister: () => {} }
312
+ : new FinalizationRegistry(ptr => wasm.__wbg_rtcoffsetjs_free(ptr >>> 0, 1));
313
+
273
314
  const ZeroCopyMeshFinalization = (typeof FinalizationRegistry === 'undefined')
274
315
  ? { register: () => {}, unregister: () => {} }
275
316
  : new FinalizationRegistry(ptr => wasm.__wbg_zerocopymesh_free(ptr >>> 0, 1));
276
317
 
318
+ /**
319
+ * Georeferencing information exposed to JavaScript
320
+ */
321
+ export class GeoReferenceJs {
322
+ static __wrap(ptr) {
323
+ ptr = ptr >>> 0;
324
+ const obj = Object.create(GeoReferenceJs.prototype);
325
+ obj.__wbg_ptr = ptr;
326
+ GeoReferenceJsFinalization.register(obj, obj.__wbg_ptr, obj);
327
+ return obj;
328
+ }
329
+ __destroy_into_raw() {
330
+ const ptr = this.__wbg_ptr;
331
+ this.__wbg_ptr = 0;
332
+ GeoReferenceJsFinalization.unregister(this);
333
+ return ptr;
334
+ }
335
+ free() {
336
+ const ptr = this.__destroy_into_raw();
337
+ wasm.__wbg_georeferencejs_free(ptr, 0);
338
+ }
339
+ /**
340
+ * Transform local coordinates to map coordinates
341
+ * @param {number} x
342
+ * @param {number} y
343
+ * @param {number} z
344
+ * @returns {Float64Array}
345
+ */
346
+ localToMap(x, y, z) {
347
+ try {
348
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
349
+ wasm.georeferencejs_localToMap(retptr, this.__wbg_ptr, x, y, z);
350
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
351
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
352
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
353
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
354
+ return v1;
355
+ } finally {
356
+ wasm.__wbindgen_add_to_stack_pointer(16);
357
+ }
358
+ }
359
+ /**
360
+ * Transform map coordinates to local coordinates
361
+ * @param {number} e
362
+ * @param {number} n
363
+ * @param {number} h
364
+ * @returns {Float64Array}
365
+ */
366
+ mapToLocal(e, n, h) {
367
+ try {
368
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
369
+ wasm.georeferencejs_mapToLocal(retptr, this.__wbg_ptr, e, n, h);
370
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
371
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
372
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
373
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
374
+ return v1;
375
+ } finally {
376
+ wasm.__wbindgen_add_to_stack_pointer(16);
377
+ }
378
+ }
379
+ /**
380
+ * Get CRS name
381
+ * @returns {string | undefined}
382
+ */
383
+ get crsName() {
384
+ try {
385
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
386
+ wasm.georeferencejs_crsName(retptr, this.__wbg_ptr);
387
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
388
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
389
+ let v1;
390
+ if (r0 !== 0) {
391
+ v1 = getStringFromWasm0(r0, r1).slice();
392
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
393
+ }
394
+ return v1;
395
+ } finally {
396
+ wasm.__wbindgen_add_to_stack_pointer(16);
397
+ }
398
+ }
399
+ /**
400
+ * Get rotation angle in radians
401
+ * @returns {number}
402
+ */
403
+ get rotation() {
404
+ const ret = wasm.georeferencejs_rotation(this.__wbg_ptr);
405
+ return ret;
406
+ }
407
+ /**
408
+ * Get 4x4 transformation matrix (column-major for WebGL)
409
+ * @returns {Float64Array}
410
+ */
411
+ toMatrix() {
412
+ try {
413
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
+ wasm.georeferencejs_toMatrix(retptr, this.__wbg_ptr);
415
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
416
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
417
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
418
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
419
+ return v1;
420
+ } finally {
421
+ wasm.__wbindgen_add_to_stack_pointer(16);
422
+ }
423
+ }
424
+ /**
425
+ * Eastings (X offset)
426
+ * @returns {number}
427
+ */
428
+ get eastings() {
429
+ const ret = wasm.__wbg_get_georeferencejs_eastings(this.__wbg_ptr);
430
+ return ret;
431
+ }
432
+ /**
433
+ * Eastings (X offset)
434
+ * @param {number} arg0
435
+ */
436
+ set eastings(arg0) {
437
+ wasm.__wbg_set_georeferencejs_eastings(this.__wbg_ptr, arg0);
438
+ }
439
+ /**
440
+ * Northings (Y offset)
441
+ * @returns {number}
442
+ */
443
+ get northings() {
444
+ const ret = wasm.__wbg_get_georeferencejs_northings(this.__wbg_ptr);
445
+ return ret;
446
+ }
447
+ /**
448
+ * Northings (Y offset)
449
+ * @param {number} arg0
450
+ */
451
+ set northings(arg0) {
452
+ wasm.__wbg_set_georeferencejs_northings(this.__wbg_ptr, arg0);
453
+ }
454
+ /**
455
+ * Orthogonal height (Z offset)
456
+ * @returns {number}
457
+ */
458
+ get orthogonal_height() {
459
+ const ret = wasm.__wbg_get_georeferencejs_orthogonal_height(this.__wbg_ptr);
460
+ return ret;
461
+ }
462
+ /**
463
+ * Orthogonal height (Z offset)
464
+ * @param {number} arg0
465
+ */
466
+ set orthogonal_height(arg0) {
467
+ wasm.__wbg_set_georeferencejs_orthogonal_height(this.__wbg_ptr, arg0);
468
+ }
469
+ /**
470
+ * X-axis abscissa (cos of rotation)
471
+ * @returns {number}
472
+ */
473
+ get x_axis_abscissa() {
474
+ const ret = wasm.__wbg_get_georeferencejs_x_axis_abscissa(this.__wbg_ptr);
475
+ return ret;
476
+ }
477
+ /**
478
+ * X-axis abscissa (cos of rotation)
479
+ * @param {number} arg0
480
+ */
481
+ set x_axis_abscissa(arg0) {
482
+ wasm.__wbg_set_georeferencejs_x_axis_abscissa(this.__wbg_ptr, arg0);
483
+ }
484
+ /**
485
+ * X-axis ordinate (sin of rotation)
486
+ * @returns {number}
487
+ */
488
+ get x_axis_ordinate() {
489
+ const ret = wasm.__wbg_get_georeferencejs_x_axis_ordinate(this.__wbg_ptr);
490
+ return ret;
491
+ }
492
+ /**
493
+ * X-axis ordinate (sin of rotation)
494
+ * @param {number} arg0
495
+ */
496
+ set x_axis_ordinate(arg0) {
497
+ wasm.__wbg_set_georeferencejs_x_axis_ordinate(this.__wbg_ptr, arg0);
498
+ }
499
+ /**
500
+ * Scale factor
501
+ * @returns {number}
502
+ */
503
+ get scale() {
504
+ const ret = wasm.__wbg_get_georeferencejs_scale(this.__wbg_ptr);
505
+ return ret;
506
+ }
507
+ /**
508
+ * Scale factor
509
+ * @param {number} arg0
510
+ */
511
+ set scale(arg0) {
512
+ wasm.__wbg_set_georeferencejs_scale(this.__wbg_ptr, arg0);
513
+ }
514
+ }
515
+ if (Symbol.dispose) GeoReferenceJs.prototype[Symbol.dispose] = GeoReferenceJs.prototype.free;
516
+
277
517
  /**
278
518
  * Main IFC-Lite API
279
519
  */
@@ -370,6 +610,112 @@ export class IfcAPI {
370
610
  const ret = wasm.ifcapi_parseZeroCopy(this.__wbg_ptr, ptr0, len0);
371
611
  return ZeroCopyMesh.__wrap(ret);
372
612
  }
613
+ /**
614
+ * Extract georeferencing information from IFC content
615
+ * Returns null if no georeferencing is present
616
+ *
617
+ * Example:
618
+ * ```javascript
619
+ * const api = new IfcAPI();
620
+ * const georef = api.getGeoReference(ifcData);
621
+ * if (georef) {
622
+ * console.log('CRS:', georef.crsName);
623
+ * const [e, n, h] = georef.localToMap(10, 20, 5);
624
+ * }
625
+ * ```
626
+ * @param {string} content
627
+ * @returns {GeoReferenceJs | undefined}
628
+ */
629
+ getGeoReference(content) {
630
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
631
+ const len0 = WASM_VECTOR_LEN;
632
+ const ret = wasm.ifcapi_getGeoReference(this.__wbg_ptr, ptr0, len0);
633
+ return ret === 0 ? undefined : GeoReferenceJs.__wrap(ret);
634
+ }
635
+ /**
636
+ * Parse IFC file with streaming mesh batches for progressive rendering
637
+ * Calls the callback with batches of meshes, yielding to browser between batches
638
+ *
639
+ * Example:
640
+ * ```javascript
641
+ * const api = new IfcAPI();
642
+ * await api.parseMeshesAsync(ifcData, {
643
+ * batchSize: 100,
644
+ * onBatch: (meshes, progress) => {
645
+ * // Add meshes to scene
646
+ * for (const mesh of meshes) {
647
+ * scene.add(createThreeMesh(mesh));
648
+ * }
649
+ * console.log(`Progress: ${progress.percent}%`);
650
+ * },
651
+ * onComplete: (stats) => {
652
+ * console.log(`Done! ${stats.totalMeshes} meshes`);
653
+ * }
654
+ * });
655
+ * ```
656
+ * @param {string} content
657
+ * @param {any} options
658
+ * @returns {Promise<any>}
659
+ */
660
+ parseMeshesAsync(content, options) {
661
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
662
+ const len0 = WASM_VECTOR_LEN;
663
+ const ret = wasm.ifcapi_parseMeshesAsync(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
664
+ return takeObject(ret);
665
+ }
666
+ /**
667
+ * Parse IFC file and return mesh with RTC offset for large coordinates
668
+ * This handles georeferenced models by shifting to centroid
669
+ *
670
+ * Example:
671
+ * ```javascript
672
+ * const api = new IfcAPI();
673
+ * const result = api.parseMeshesWithRtc(ifcData);
674
+ * const rtcOffset = result.rtcOffset;
675
+ * const meshes = result.meshes;
676
+ *
677
+ * // Convert local coords back to world:
678
+ * if (rtcOffset.isSignificant()) {
679
+ * const [wx, wy, wz] = rtcOffset.toWorld(localX, localY, localZ);
680
+ * }
681
+ * ```
682
+ * @param {string} content
683
+ * @returns {MeshCollectionWithRtc}
684
+ */
685
+ parseMeshesWithRtc(content) {
686
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
687
+ const len0 = WASM_VECTOR_LEN;
688
+ const ret = wasm.ifcapi_parseMeshesWithRtc(this.__wbg_ptr, ptr0, len0);
689
+ return MeshCollectionWithRtc.__wrap(ret);
690
+ }
691
+ /**
692
+ * Parse IFC file and return instanced geometry grouped by geometry hash
693
+ * This reduces draw calls by grouping identical geometries with different transforms
694
+ *
695
+ * Example:
696
+ * ```javascript
697
+ * const api = new IfcAPI();
698
+ * const collection = api.parseMeshesInstanced(ifcData);
699
+ * for (let i = 0; i < collection.length; i++) {
700
+ * const geometry = collection.get(i);
701
+ * console.log('Geometry ID:', geometry.geometryId);
702
+ * console.log('Instances:', geometry.instanceCount);
703
+ * for (let j = 0; j < geometry.instanceCount; j++) {
704
+ * const inst = geometry.getInstance(j);
705
+ * console.log(' Express ID:', inst.expressId);
706
+ * console.log(' Transform:', inst.transform);
707
+ * }
708
+ * }
709
+ * ```
710
+ * @param {string} content
711
+ * @returns {InstancedMeshCollection}
712
+ */
713
+ parseMeshesInstanced(content) {
714
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
715
+ const len0 = WASM_VECTOR_LEN;
716
+ const ret = wasm.ifcapi_parseMeshesInstanced(this.__wbg_ptr, ptr0, len0);
717
+ return InstancedMeshCollection.__wrap(ret);
718
+ }
373
719
  /**
374
720
  * Debug: Test processing entity #953 (FacetedBrep wall)
375
721
  * @param {string} content
@@ -416,6 +762,36 @@ export class IfcAPI {
416
762
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
417
763
  }
418
764
  }
765
+ /**
766
+ * Parse IFC file with streaming instanced geometry batches for progressive rendering
767
+ * Groups identical geometries and yields batches of InstancedGeometry
768
+ * Uses fast-first-frame streaming: simple geometry (walls, slabs) first
769
+ *
770
+ * Example:
771
+ * ```javascript
772
+ * const api = new IfcAPI();
773
+ * await api.parseMeshesInstancedAsync(ifcData, {
774
+ * batchSize: 25, // Number of unique geometries per batch
775
+ * onBatch: (geometries, progress) => {
776
+ * for (const geom of geometries) {
777
+ * renderer.addInstancedGeometry(geom);
778
+ * }
779
+ * },
780
+ * onComplete: (stats) => {
781
+ * console.log(`Done! ${stats.totalGeometries} unique geometries, ${stats.totalInstances} instances`);
782
+ * }
783
+ * });
784
+ * ```
785
+ * @param {string} content
786
+ * @param {any} options
787
+ * @returns {Promise<any>}
788
+ */
789
+ parseMeshesInstancedAsync(content, options) {
790
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
791
+ const len0 = WASM_VECTOR_LEN;
792
+ const ret = wasm.ifcapi_parseMeshesInstancedAsync(this.__wbg_ptr, ptr0, len0, addHeapObject(options));
793
+ return takeObject(ret);
794
+ }
419
795
  /**
420
796
  * Create and initialize the IFC API
421
797
  */
@@ -474,6 +850,180 @@ export class IfcAPI {
474
850
  }
475
851
  if (Symbol.dispose) IfcAPI.prototype[Symbol.dispose] = IfcAPI.prototype.free;
476
852
 
853
+ /**
854
+ * Instance data for instanced rendering
855
+ */
856
+ export class InstanceData {
857
+ static __wrap(ptr) {
858
+ ptr = ptr >>> 0;
859
+ const obj = Object.create(InstanceData.prototype);
860
+ obj.__wbg_ptr = ptr;
861
+ InstanceDataFinalization.register(obj, obj.__wbg_ptr, obj);
862
+ return obj;
863
+ }
864
+ __destroy_into_raw() {
865
+ const ptr = this.__wbg_ptr;
866
+ this.__wbg_ptr = 0;
867
+ InstanceDataFinalization.unregister(this);
868
+ return ptr;
869
+ }
870
+ free() {
871
+ const ptr = this.__destroy_into_raw();
872
+ wasm.__wbg_instancedata_free(ptr, 0);
873
+ }
874
+ /**
875
+ * @returns {number}
876
+ */
877
+ get expressId() {
878
+ const ret = wasm.instancedata_expressId(this.__wbg_ptr);
879
+ return ret >>> 0;
880
+ }
881
+ /**
882
+ * @returns {Float32Array}
883
+ */
884
+ get color() {
885
+ try {
886
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
887
+ wasm.instancedata_color(retptr, this.__wbg_ptr);
888
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
889
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
890
+ var v1 = getArrayF32FromWasm0(r0, r1).slice();
891
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
892
+ return v1;
893
+ } finally {
894
+ wasm.__wbindgen_add_to_stack_pointer(16);
895
+ }
896
+ }
897
+ /**
898
+ * @returns {Float32Array}
899
+ */
900
+ get transform() {
901
+ const ret = wasm.instancedata_transform(this.__wbg_ptr);
902
+ return takeObject(ret);
903
+ }
904
+ }
905
+ if (Symbol.dispose) InstanceData.prototype[Symbol.dispose] = InstanceData.prototype.free;
906
+
907
+ /**
908
+ * Instanced geometry - one geometry definition with multiple instances
909
+ */
910
+ export class InstancedGeometry {
911
+ static __wrap(ptr) {
912
+ ptr = ptr >>> 0;
913
+ const obj = Object.create(InstancedGeometry.prototype);
914
+ obj.__wbg_ptr = ptr;
915
+ InstancedGeometryFinalization.register(obj, obj.__wbg_ptr, obj);
916
+ return obj;
917
+ }
918
+ __destroy_into_raw() {
919
+ const ptr = this.__wbg_ptr;
920
+ this.__wbg_ptr = 0;
921
+ InstancedGeometryFinalization.unregister(this);
922
+ return ptr;
923
+ }
924
+ free() {
925
+ const ptr = this.__destroy_into_raw();
926
+ wasm.__wbg_instancedgeometry_free(ptr, 0);
927
+ }
928
+ /**
929
+ * @returns {bigint}
930
+ */
931
+ get geometryId() {
932
+ const ret = wasm.instancedgeometry_geometryId(this.__wbg_ptr);
933
+ return BigInt.asUintN(64, ret);
934
+ }
935
+ /**
936
+ * @param {number} index
937
+ * @returns {InstanceData | undefined}
938
+ */
939
+ get_instance(index) {
940
+ const ret = wasm.instancedgeometry_get_instance(this.__wbg_ptr, index);
941
+ return ret === 0 ? undefined : InstanceData.__wrap(ret);
942
+ }
943
+ /**
944
+ * @returns {number}
945
+ */
946
+ get instance_count() {
947
+ const ret = wasm.instancedgeometry_instance_count(this.__wbg_ptr);
948
+ return ret >>> 0;
949
+ }
950
+ /**
951
+ * @returns {Uint32Array}
952
+ */
953
+ get indices() {
954
+ const ret = wasm.instancedgeometry_indices(this.__wbg_ptr);
955
+ return takeObject(ret);
956
+ }
957
+ /**
958
+ * @returns {Float32Array}
959
+ */
960
+ get normals() {
961
+ const ret = wasm.instancedgeometry_normals(this.__wbg_ptr);
962
+ return takeObject(ret);
963
+ }
964
+ /**
965
+ * @returns {Float32Array}
966
+ */
967
+ get positions() {
968
+ const ret = wasm.instancedgeometry_positions(this.__wbg_ptr);
969
+ return takeObject(ret);
970
+ }
971
+ }
972
+ if (Symbol.dispose) InstancedGeometry.prototype[Symbol.dispose] = InstancedGeometry.prototype.free;
973
+
974
+ /**
975
+ * Collection of instanced geometries
976
+ */
977
+ export class InstancedMeshCollection {
978
+ static __wrap(ptr) {
979
+ ptr = ptr >>> 0;
980
+ const obj = Object.create(InstancedMeshCollection.prototype);
981
+ obj.__wbg_ptr = ptr;
982
+ InstancedMeshCollectionFinalization.register(obj, obj.__wbg_ptr, obj);
983
+ return obj;
984
+ }
985
+ __destroy_into_raw() {
986
+ const ptr = this.__wbg_ptr;
987
+ this.__wbg_ptr = 0;
988
+ InstancedMeshCollectionFinalization.unregister(this);
989
+ return ptr;
990
+ }
991
+ free() {
992
+ const ptr = this.__destroy_into_raw();
993
+ wasm.__wbg_instancedmeshcollection_free(ptr, 0);
994
+ }
995
+ /**
996
+ * @returns {number}
997
+ */
998
+ get totalInstances() {
999
+ const ret = wasm.instancedmeshcollection_totalInstances(this.__wbg_ptr);
1000
+ return ret >>> 0;
1001
+ }
1002
+ /**
1003
+ * @returns {number}
1004
+ */
1005
+ get totalGeometries() {
1006
+ const ret = wasm.instancedmeshcollection_length(this.__wbg_ptr);
1007
+ return ret >>> 0;
1008
+ }
1009
+ /**
1010
+ * @param {number} index
1011
+ * @returns {InstancedGeometry | undefined}
1012
+ */
1013
+ get(index) {
1014
+ const ret = wasm.instancedmeshcollection_get(this.__wbg_ptr, index);
1015
+ return ret === 0 ? undefined : InstancedGeometry.__wrap(ret);
1016
+ }
1017
+ /**
1018
+ * @returns {number}
1019
+ */
1020
+ get length() {
1021
+ const ret = wasm.instancedmeshcollection_length(this.__wbg_ptr);
1022
+ return ret >>> 0;
1023
+ }
1024
+ }
1025
+ if (Symbol.dispose) InstancedMeshCollection.prototype[Symbol.dispose] = InstancedMeshCollection.prototype.free;
1026
+
477
1027
  /**
478
1028
  * Collection of mesh data for returning multiple meshes
479
1029
  */
@@ -525,12 +1075,69 @@ export class MeshCollection {
525
1075
  * @returns {number}
526
1076
  */
527
1077
  get length() {
528
- const ret = wasm.meshcollection_length(this.__wbg_ptr);
1078
+ const ret = wasm.instancedmeshcollection_length(this.__wbg_ptr);
529
1079
  return ret >>> 0;
530
1080
  }
531
1081
  }
532
1082
  if (Symbol.dispose) MeshCollection.prototype[Symbol.dispose] = MeshCollection.prototype.free;
533
1083
 
1084
+ /**
1085
+ * Mesh collection with RTC offset for large coordinates
1086
+ */
1087
+ export class MeshCollectionWithRtc {
1088
+ static __wrap(ptr) {
1089
+ ptr = ptr >>> 0;
1090
+ const obj = Object.create(MeshCollectionWithRtc.prototype);
1091
+ obj.__wbg_ptr = ptr;
1092
+ MeshCollectionWithRtcFinalization.register(obj, obj.__wbg_ptr, obj);
1093
+ return obj;
1094
+ }
1095
+ __destroy_into_raw() {
1096
+ const ptr = this.__wbg_ptr;
1097
+ this.__wbg_ptr = 0;
1098
+ MeshCollectionWithRtcFinalization.unregister(this);
1099
+ return ptr;
1100
+ }
1101
+ free() {
1102
+ const ptr = this.__destroy_into_raw();
1103
+ wasm.__wbg_meshcollectionwithrtc_free(ptr, 0);
1104
+ }
1105
+ /**
1106
+ * Get the RTC offset
1107
+ * @returns {RtcOffsetJs}
1108
+ */
1109
+ get rtcOffset() {
1110
+ const ret = wasm.meshcollectionwithrtc_rtcOffset(this.__wbg_ptr);
1111
+ return RtcOffsetJs.__wrap(ret);
1112
+ }
1113
+ /**
1114
+ * Get mesh at index
1115
+ * @param {number} index
1116
+ * @returns {MeshDataJs | undefined}
1117
+ */
1118
+ get(index) {
1119
+ const ret = wasm.meshcollectionwithrtc_get(this.__wbg_ptr, index);
1120
+ return ret === 0 ? undefined : MeshDataJs.__wrap(ret);
1121
+ }
1122
+ /**
1123
+ * Get number of meshes
1124
+ * @returns {number}
1125
+ */
1126
+ get length() {
1127
+ const ret = wasm.meshcollectionwithrtc_length(this.__wbg_ptr);
1128
+ return ret >>> 0;
1129
+ }
1130
+ /**
1131
+ * Get the mesh collection
1132
+ * @returns {MeshCollection}
1133
+ */
1134
+ get meshes() {
1135
+ const ret = wasm.meshcollectionwithrtc_meshes(this.__wbg_ptr);
1136
+ return MeshCollection.__wrap(ret);
1137
+ }
1138
+ }
1139
+ if (Symbol.dispose) MeshCollectionWithRtc.prototype[Symbol.dispose] = MeshCollectionWithRtc.prototype.free;
1140
+
534
1141
  /**
535
1142
  * Individual mesh data with express ID and color (matches MeshData interface)
536
1143
  */
@@ -620,6 +1227,103 @@ export class MeshDataJs {
620
1227
  }
621
1228
  if (Symbol.dispose) MeshDataJs.prototype[Symbol.dispose] = MeshDataJs.prototype.free;
622
1229
 
1230
+ /**
1231
+ * RTC offset information exposed to JavaScript
1232
+ */
1233
+ export class RtcOffsetJs {
1234
+ static __wrap(ptr) {
1235
+ ptr = ptr >>> 0;
1236
+ const obj = Object.create(RtcOffsetJs.prototype);
1237
+ obj.__wbg_ptr = ptr;
1238
+ RtcOffsetJsFinalization.register(obj, obj.__wbg_ptr, obj);
1239
+ return obj;
1240
+ }
1241
+ __destroy_into_raw() {
1242
+ const ptr = this.__wbg_ptr;
1243
+ this.__wbg_ptr = 0;
1244
+ RtcOffsetJsFinalization.unregister(this);
1245
+ return ptr;
1246
+ }
1247
+ free() {
1248
+ const ptr = this.__destroy_into_raw();
1249
+ wasm.__wbg_rtcoffsetjs_free(ptr, 0);
1250
+ }
1251
+ /**
1252
+ * Check if offset is significant (>10km)
1253
+ * @returns {boolean}
1254
+ */
1255
+ isSignificant() {
1256
+ const ret = wasm.rtcoffsetjs_isSignificant(this.__wbg_ptr);
1257
+ return ret !== 0;
1258
+ }
1259
+ /**
1260
+ * Convert local coordinates to world coordinates
1261
+ * @param {number} x
1262
+ * @param {number} y
1263
+ * @param {number} z
1264
+ * @returns {Float64Array}
1265
+ */
1266
+ toWorld(x, y, z) {
1267
+ try {
1268
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1269
+ wasm.rtcoffsetjs_toWorld(retptr, this.__wbg_ptr, x, y, z);
1270
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1271
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1272
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
1273
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
1274
+ return v1;
1275
+ } finally {
1276
+ wasm.__wbindgen_add_to_stack_pointer(16);
1277
+ }
1278
+ }
1279
+ /**
1280
+ * X offset (subtracted from positions)
1281
+ * @returns {number}
1282
+ */
1283
+ get x() {
1284
+ const ret = wasm.__wbg_get_georeferencejs_eastings(this.__wbg_ptr);
1285
+ return ret;
1286
+ }
1287
+ /**
1288
+ * X offset (subtracted from positions)
1289
+ * @param {number} arg0
1290
+ */
1291
+ set x(arg0) {
1292
+ wasm.__wbg_set_georeferencejs_eastings(this.__wbg_ptr, arg0);
1293
+ }
1294
+ /**
1295
+ * Y offset
1296
+ * @returns {number}
1297
+ */
1298
+ get y() {
1299
+ const ret = wasm.__wbg_get_georeferencejs_northings(this.__wbg_ptr);
1300
+ return ret;
1301
+ }
1302
+ /**
1303
+ * Y offset
1304
+ * @param {number} arg0
1305
+ */
1306
+ set y(arg0) {
1307
+ wasm.__wbg_set_georeferencejs_northings(this.__wbg_ptr, arg0);
1308
+ }
1309
+ /**
1310
+ * Z offset
1311
+ * @returns {number}
1312
+ */
1313
+ get z() {
1314
+ const ret = wasm.__wbg_get_georeferencejs_orthogonal_height(this.__wbg_ptr);
1315
+ return ret;
1316
+ }
1317
+ /**
1318
+ * Z offset
1319
+ * @param {number} arg0
1320
+ */
1321
+ set z(arg0) {
1322
+ wasm.__wbg_set_georeferencejs_orthogonal_height(this.__wbg_ptr, arg0);
1323
+ }
1324
+ }
1325
+ if (Symbol.dispose) RtcOffsetJs.prototype[Symbol.dispose] = RtcOffsetJs.prototype.free;
1326
+
623
1327
  /**
624
1328
  * Zero-copy mesh that exposes pointers to WASM memory
625
1329
  */
@@ -770,14 +1474,27 @@ export function get_memory() {
770
1474
  }
771
1475
 
772
1476
  /**
773
- * Initialize the WASM module
1477
+ * Initialize the WASM module.
1478
+ *
1479
+ * This function is called automatically when the WASM module is loaded.
1480
+ * It sets up panic hooks for better error messages in the browser console.
774
1481
  */
775
1482
  export function init() {
776
1483
  wasm.init();
777
1484
  }
778
1485
 
779
1486
  /**
780
- * Get the version of IFC-Lite
1487
+ * Get the version of IFC-Lite.
1488
+ *
1489
+ * # Returns
1490
+ *
1491
+ * Version string (e.g., "0.1.0")
1492
+ *
1493
+ * # Example
1494
+ *
1495
+ * ```javascript
1496
+ * console.log(`IFC-Lite version: ${version()}`);
1497
+ * ```
781
1498
  * @returns {string}
782
1499
  */
783
1500
  export function version() {
@@ -851,6 +1568,12 @@ function __wbg_get_imports() {
851
1568
  const ret = wasm.memory;
852
1569
  return addHeapObject(ret);
853
1570
  };
1571
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1572
+ const obj = getObject(arg1);
1573
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1574
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1575
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1576
+ };
854
1577
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
855
1578
  throw new Error(getStringFromWasm0(arg0, arg1));
856
1579
  };
@@ -865,6 +1588,14 @@ function __wbg_get_imports() {
865
1588
  const ret = getObject(arg0).call(getObject(arg1));
866
1589
  return addHeapObject(ret);
867
1590
  }, arguments) };
1591
+ imports.wbg.__wbg_call_c8baa5c5e72d274e = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1592
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
1593
+ return addHeapObject(ret);
1594
+ }, arguments) };
1595
+ imports.wbg.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) {
1596
+ const ret = clearTimeout(takeObject(arg0));
1597
+ return addHeapObject(ret);
1598
+ };
868
1599
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
869
1600
  let deferred0_0;
870
1601
  let deferred0_1;
@@ -876,10 +1607,30 @@ function __wbg_get_imports() {
876
1607
  wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
877
1608
  }
878
1609
  };
1610
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1611
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1612
+ return addHeapObject(ret);
1613
+ }, arguments) };
1614
+ imports.wbg.__wbg_instancedgeometry_new = function(arg0) {
1615
+ const ret = InstancedGeometry.__wrap(arg0);
1616
+ return addHeapObject(ret);
1617
+ };
1618
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1619
+ const ret = getObject(arg0).length;
1620
+ return ret;
1621
+ };
1622
+ imports.wbg.__wbg_meshdatajs_new = function(arg0) {
1623
+ const ret = MeshDataJs.__wrap(arg0);
1624
+ return addHeapObject(ret);
1625
+ };
879
1626
  imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
880
1627
  const ret = new Object();
881
1628
  return addHeapObject(ret);
882
1629
  };
1630
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1631
+ const ret = new Array();
1632
+ return addHeapObject(ret);
1633
+ };
883
1634
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
884
1635
  const ret = new Error();
885
1636
  return addHeapObject(ret);
@@ -891,7 +1642,7 @@ function __wbg_get_imports() {
891
1642
  const a = state0.a;
892
1643
  state0.a = 0;
893
1644
  try {
894
- return __wasm_bindgen_func_elem_198(a, state0.b, arg0, arg1);
1645
+ return __wasm_bindgen_func_elem_340(a, state0.b, arg0, arg1);
895
1646
  } finally {
896
1647
  state0.a = a;
897
1648
  }
@@ -914,6 +1665,10 @@ function __wbg_get_imports() {
914
1665
  const ret = new Function(getStringFromWasm0(arg0, arg1));
915
1666
  return addHeapObject(ret);
916
1667
  };
1668
+ imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
1669
+ const ret = getObject(arg0).push(getObject(arg1));
1670
+ return ret;
1671
+ };
917
1672
  imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
918
1673
  const ret = getObject(arg0).queueMicrotask;
919
1674
  return addHeapObject(ret);
@@ -925,6 +1680,10 @@ function __wbg_get_imports() {
925
1680
  const ret = Promise.resolve(getObject(arg0));
926
1681
  return addHeapObject(ret);
927
1682
  };
1683
+ imports.wbg.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
1684
+ const ret = setTimeout(getObject(arg0), arg1);
1685
+ return addHeapObject(ret);
1686
+ }, arguments) };
928
1687
  imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
929
1688
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
930
1689
  return ret;
@@ -961,9 +1720,14 @@ function __wbg_get_imports() {
961
1720
  const ret = getStringFromWasm0(arg0, arg1);
962
1721
  return addHeapObject(ret);
963
1722
  };
964
- imports.wbg.__wbindgen_cast_a2f2ccacb7ef777f = function(arg0, arg1) {
965
- // Cast intrinsic for `Closure(Closure { dtor_idx: 31, function: Function { arguments: [Externref], shim_idx: 32, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
966
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_159, __wasm_bindgen_func_elem_160);
1723
+ imports.wbg.__wbindgen_cast_6da2ad44da782ca3 = function(arg0, arg1) {
1724
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 43, function: Function { arguments: [], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1725
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_294, __wasm_bindgen_func_elem_295);
1726
+ return addHeapObject(ret);
1727
+ };
1728
+ imports.wbg.__wbindgen_cast_cfd578dc132ebaa8 = function(arg0, arg1) {
1729
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 49, function: Function { arguments: [Externref], shim_idx: 50, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1730
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_305, __wasm_bindgen_func_elem_306);
967
1731
  return addHeapObject(ret);
968
1732
  };
969
1733
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
@@ -987,6 +1751,7 @@ function __wbg_finalize_init(instance, module) {
987
1751
  __wbg_init.__wbindgen_wasm_module = module;
988
1752
  cachedDataViewMemory0 = null;
989
1753
  cachedFloat32ArrayMemory0 = null;
1754
+ cachedFloat64ArrayMemory0 = null;
990
1755
  cachedUint32ArrayMemory0 = null;
991
1756
  cachedUint8ArrayMemory0 = null;
992
1757
 
@@ -1028,7 +1793,7 @@ async function __wbg_init(module_or_path) {
1028
1793
  }
1029
1794
 
1030
1795
  if (typeof module_or_path === 'undefined') {
1031
- module_or_path = new URL('ifc_lite_wasm_bg.wasm', import.meta.url);
1796
+ module_or_path = new URL('ifc-lite_bg.wasm', import.meta.url);
1032
1797
  }
1033
1798
  const imports = __wbg_get_imports();
1034
1799