@xeokit/xeokit-sdk 2.4.2-beta-29 → 2.4.2-beta-31

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.
@@ -30235,7 +30235,7 @@ class Scene extends Component {
30235
30235
  * - it runs maximum once per scene-tick
30236
30236
  *
30237
30237
  * @param {Function} cb The function to tickify
30238
- * @returns {Function)}
30238
+ * @returns {Function}
30239
30239
  */
30240
30240
  tickify(cb) {
30241
30241
  const cbString = cb.toString();
@@ -48260,29 +48260,11 @@ class BCFViewpointsPlugin extends Plugin {
48260
48260
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
48261
48261
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
48262
48262
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
48263
- * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
48264
48263
  */
48265
48264
  constructor(viewer, cfg = {}) {
48266
48265
 
48267
48266
  super("BCFViewpoints", viewer, cfg);
48268
48267
 
48269
- /**
48270
- * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
48271
- *
48272
- * When `xrayAsZeroAlpha` is `true`:
48273
- *
48274
- * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
48275
- * * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
48276
- *
48277
- * When `xrayAsZeroAlpha` is `false`:
48278
- *
48279
- * * don't save any X-ray information in viewpoints, and
48280
- * * reset all objects as not X-rayed whenever loading a viewpoint.
48281
- *
48282
- * @type {boolean}
48283
- */
48284
- this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
48285
-
48286
48268
  /**
48287
48269
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
48288
48270
  * @property originatingSystem
@@ -48307,6 +48289,9 @@ class BCFViewpointsPlugin extends Plugin {
48307
48289
  * @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.
48308
48290
  * @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.
48309
48291
  * @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.
48292
+ * @param {Boolean} [options.spacesTranslucent=false] Indicates whether ````IfcSpace```` types should be forced translucent in the viewpoint.
48293
+ * @param {Boolean} [options.spaceBoundariesTranslucent=false] Indicates whether the boundaries of ````IfcSpace```` types should be forced translucent in the viewpoint.
48294
+ * @param {Boolean} [options.openingsTranslucent=true] Indicates whether ````IfcOpening```` types should be forced translucent in the viewpoint.
48310
48295
  * @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.
48311
48296
  * @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects
48312
48297
  * as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that
@@ -48454,7 +48439,10 @@ class BCFViewpointsPlugin extends Plugin {
48454
48439
  view_setup_hints: {
48455
48440
  spaces_visible: !!options.spacesVisible,
48456
48441
  space_boundaries_visible: !!options.spaceBoundariesVisible,
48457
- openings_visible: !!options.openingsVisible
48442
+ openings_visible: !!options.openingsVisible,
48443
+ spaces_translucent: !!options.spaces_translucent,
48444
+ space_boundaries_translucent: !!options.space_boundaries_translucent,
48445
+ openings_translucent: !!options.openings_translucent
48458
48446
  }
48459
48447
  }
48460
48448
  };
@@ -48471,15 +48459,11 @@ class BCFViewpointsPlugin extends Plugin {
48471
48459
  let alpha;
48472
48460
 
48473
48461
  if (entity.xrayed) {
48474
- if (this.xrayAsZeroAlpha) {
48475
- alpha = 0;
48462
+ if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
48463
+ // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
48464
+ alpha = 0.1;
48476
48465
  } else {
48477
- if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
48478
- // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
48479
- alpha = 0.1;
48480
- } else {
48481
- alpha = scene.xrayMaterial.fillAlpha;
48482
- }
48466
+ alpha = scene.xrayMaterial.fillAlpha;
48483
48467
  }
48484
48468
  alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
48485
48469
  color = alpha + color;
@@ -48530,6 +48514,8 @@ class BCFViewpointsPlugin extends Plugin {
48530
48514
 
48531
48515
  bcfViewpoint.components.selection = this._createBCFComponents(selectedObjectIds);
48532
48516
 
48517
+ bcfViewpoint.components.translucency = this._createBCFComponents(scene.xrayedObjectIds);
48518
+
48533
48519
  if (options.snapshot !== false) {
48534
48520
  bcfViewpoint.snapshot = {
48535
48521
  snapshot_type: "png",
@@ -48715,12 +48701,19 @@ class BCFViewpointsPlugin extends Plugin {
48715
48701
  const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
48716
48702
  if (view_setup_hints) {
48717
48703
  if (view_setup_hints.spaces_visible === false) {
48718
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
48704
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
48719
48705
  }
48720
- if (view_setup_hints.openings_visible === false) {
48721
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), false);
48706
+ if (view_setup_hints.spaces_translucent !== undefined) {
48707
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
48722
48708
  }
48723
48709
  if (view_setup_hints.space_boundaries_visible !== undefined) ;
48710
+ if (view_setup_hints.openings_visible === false) {
48711
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
48712
+ }
48713
+ if (view_setup_hints.space_boundaries_translucent !== undefined) ;
48714
+ if (view_setup_hints.openings_translucent !== undefined) {
48715
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
48716
+ }
48724
48717
  }
48725
48718
  }
48726
48719
 
@@ -48730,6 +48723,11 @@ class BCFViewpointsPlugin extends Plugin {
48730
48723
 
48731
48724
  }
48732
48725
 
48726
+ if (bcfViewpoint.components.translucency) {
48727
+ scene.setObjectsXRayed(scene.xrayedObjectIds, false);
48728
+ bcfViewpoint.components.translucency.forEach(component => this._withBCFComponent(options, component, entity => entity.xrayed = true));
48729
+ }
48730
+
48733
48731
  if (bcfViewpoint.components.coloring) {
48734
48732
  bcfViewpoint.components.coloring.forEach(coloring => {
48735
48733
 
@@ -48756,16 +48754,7 @@ class BCFViewpointsPlugin extends Plugin {
48756
48754
  this._withBCFComponent(options, component, entity => {
48757
48755
  entity.colorize = colorize;
48758
48756
  if (alphaDefined) {
48759
- if (alpha === 0 && this.xrayAsZeroAlpha) {
48760
- const savedFromXeokit = (component.originating_system === this.originatingSystem);
48761
- if (savedFromXeokit) {
48762
- entity.xrayed = true;
48763
- } else {
48764
- entity.opacity = alpha;
48765
- }
48766
- } else {
48767
- entity.opacity = alpha;
48768
- }
48757
+ entity.opacity = alpha;
48769
48758
  }
48770
48759
  }));
48771
48760
  });
@@ -122564,6 +122553,15 @@ parsers[ParserV10.version] = ParserV10;
122564
122553
  * myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
122565
122554
  *````
122566
122555
  *
122556
+ * We can also provide an HTTP URL to the XKT file:
122557
+ *
122558
+ * ````javascript
122559
+ * const sceneModel = xktLoader.load({
122560
+ * manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
122561
+ * id: "myModel",
122562
+ * });
122563
+ * ````
122564
+ *
122567
122565
  * # Loading a model from a manifest of XKT files
122568
122566
  *
122569
122567
  * The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
@@ -122650,6 +122648,65 @@ parsers[ParserV10.version] = ParserV10;
122650
122648
  * They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
122651
122649
  * they have less trouble allocating the system memory they need for conversion and parsing.
122652
122650
  *
122651
+ * We can also provide an HTTP URL to the manifest:
122652
+ *
122653
+ * ````javascript
122654
+ * const sceneModel = xktLoader.load({
122655
+ * manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
122656
+ * id: "myModel",
122657
+ * });
122658
+ * ````
122659
+ *
122660
+ * We can also provide the manifest as parameter object:
122661
+ *
122662
+ * ````javascript
122663
+ * const sceneModel = xktLoader.load({
122664
+ * id: "myModel",
122665
+ * manifest: {
122666
+ * inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
122667
+ * converterApplication: "convert2xkt",
122668
+ * converterApplicationVersion: "v1.1.10",
122669
+ * conversionDate": "09-11-2023- 18-29-01",
122670
+ * xktFiles: [
122671
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
122672
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
122673
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
122674
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
122675
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
122676
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
122677
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
122678
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
122679
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
122680
+ * ]
122681
+ * }
122682
+ * });
122683
+ * ````
122684
+ *
122685
+ * We can also provide the paths to the XKT files as HTTP URLs:
122686
+ *
122687
+ * ````javascript
122688
+ * const sceneModel = xktLoader.load({
122689
+ * id: "myModel",
122690
+ * manifest: {
122691
+ * inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
122692
+ * converterApplication: "convert2xkt",
122693
+ * converterApplicationVersion: "v1.1.10",
122694
+ * conversionDate": "09-11-2023- 18-29-01",
122695
+ * xktFiles: [
122696
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
122697
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
122698
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
122699
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
122700
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
122701
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
122702
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
122703
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
122704
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
122705
+ * ]
122706
+ * }
122707
+ * });
122708
+ * ````
122709
+ *
122653
122710
  * @class XKTLoaderPlugin
122654
122711
  */
122655
122712
  class XKTLoaderPlugin extends Plugin {
@@ -122919,10 +122976,14 @@ class XKTLoaderPlugin extends Plugin {
122919
122976
  *
122920
122977
  * @param {*} params Loading parameters.
122921
122978
  * @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
122922
- * @param {String} [params.src] Path to a *````.xkt````* file, as an alternative to the ````xkt```` parameter.
122979
+ * @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
122923
122980
  * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
122924
- * @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
122981
+ * @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
122925
122982
  * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
122983
+ * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
122984
+ * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
122985
+ * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
122986
+ * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
122926
122987
  * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
122927
122988
  * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
122928
122989
  * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
@@ -122958,8 +123019,8 @@ class XKTLoaderPlugin extends Plugin {
122958
123019
  delete params.id;
122959
123020
  }
122960
123021
 
122961
- if (!params.src && !params.xkt && !params.manifestSrc) {
122962
- this.error("load() param expected: src, xkt or manifestSrc");
123022
+ if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
123023
+ this.error("load() param expected: src, xkt, manifestSrc or manifestData");
122963
123024
  return sceneModel; // Return new empty model
122964
123025
  }
122965
123026
 
@@ -123087,8 +123148,8 @@ class XKTLoaderPlugin extends Plugin {
123087
123148
  } else if (params.xkt) {
123088
123149
  this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
123089
123150
  finish();
123090
- } else if (params.manifestSrc) {
123091
- const baseDir = getBaseDirectory(params.manifestSrc);
123151
+ } else if (params.manifestSrc || params.manifest) {
123152
+ const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
123092
123153
  const loadJSONs = (metaDataFiles, done, error) => {
123093
123154
  let i = 0;
123094
123155
  const loadNext = () => {
@@ -123108,7 +123169,6 @@ class XKTLoaderPlugin extends Plugin {
123108
123169
  };
123109
123170
  loadNext();
123110
123171
  };
123111
-
123112
123172
  const loadXKTs = (xktFiles, done, error) => {
123113
123173
  let i = 0;
123114
123174
  const loadNext = () => {
@@ -123124,11 +123184,8 @@ class XKTLoaderPlugin extends Plugin {
123124
123184
  };
123125
123185
  loadNext();
123126
123186
  };
123127
-
123128
- this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
123129
- if (sceneModel.destroyed) {
123130
- return;
123131
- }
123187
+ if (params.manifest) {
123188
+ const manifestData = params.manifest;
123132
123189
  const xktFiles = manifestData.xktFiles;
123133
123190
  if (!xktFiles || xktFiles.length === 0) {
123134
123191
  error(`load(): Failed to load model manifest - manifest not valid`);
@@ -123142,7 +123199,26 @@ class XKTLoaderPlugin extends Plugin {
123142
123199
  } else {
123143
123200
  loadXKTs(xktFiles, finish, error);
123144
123201
  }
123145
- }, error);
123202
+ } else {
123203
+ this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
123204
+ if (sceneModel.destroyed) {
123205
+ return;
123206
+ }
123207
+ const xktFiles = manifestData.xktFiles;
123208
+ if (!xktFiles || xktFiles.length === 0) {
123209
+ error(`load(): Failed to load model manifest - manifest not valid`);
123210
+ return;
123211
+ }
123212
+ const metaModelFiles = manifestData.metaModelFiles;
123213
+ if (metaModelFiles) {
123214
+ loadJSONs(metaModelFiles, () => {
123215
+ loadXKTs(xktFiles, finish, error);
123216
+ }, error);
123217
+ } else {
123218
+ loadXKTs(xktFiles, finish, error);
123219
+ }
123220
+ }, error);
123221
+ }
123146
123222
  }
123147
123223
  }
123148
123224
 
@@ -30231,7 +30231,7 @@ class Scene extends Component {
30231
30231
  * - it runs maximum once per scene-tick
30232
30232
  *
30233
30233
  * @param {Function} cb The function to tickify
30234
- * @returns {Function)}
30234
+ * @returns {Function}
30235
30235
  */
30236
30236
  tickify(cb) {
30237
30237
  const cbString = cb.toString();
@@ -48256,29 +48256,11 @@ class BCFViewpointsPlugin extends Plugin {
48256
48256
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
48257
48257
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
48258
48258
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
48259
- * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
48260
48259
  */
48261
48260
  constructor(viewer, cfg = {}) {
48262
48261
 
48263
48262
  super("BCFViewpoints", viewer, cfg);
48264
48263
 
48265
- /**
48266
- * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
48267
- *
48268
- * When `xrayAsZeroAlpha` is `true`:
48269
- *
48270
- * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
48271
- * * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
48272
- *
48273
- * When `xrayAsZeroAlpha` is `false`:
48274
- *
48275
- * * don't save any X-ray information in viewpoints, and
48276
- * * reset all objects as not X-rayed whenever loading a viewpoint.
48277
- *
48278
- * @type {boolean}
48279
- */
48280
- this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
48281
-
48282
48264
  /**
48283
48265
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
48284
48266
  * @property originatingSystem
@@ -48303,6 +48285,9 @@ class BCFViewpointsPlugin extends Plugin {
48303
48285
  * @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.
48304
48286
  * @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.
48305
48287
  * @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.
48288
+ * @param {Boolean} [options.spacesTranslucent=false] Indicates whether ````IfcSpace```` types should be forced translucent in the viewpoint.
48289
+ * @param {Boolean} [options.spaceBoundariesTranslucent=false] Indicates whether the boundaries of ````IfcSpace```` types should be forced translucent in the viewpoint.
48290
+ * @param {Boolean} [options.openingsTranslucent=true] Indicates whether ````IfcOpening```` types should be forced translucent in the viewpoint.
48306
48291
  * @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.
48307
48292
  * @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects
48308
48293
  * as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that
@@ -48450,7 +48435,10 @@ class BCFViewpointsPlugin extends Plugin {
48450
48435
  view_setup_hints: {
48451
48436
  spaces_visible: !!options.spacesVisible,
48452
48437
  space_boundaries_visible: !!options.spaceBoundariesVisible,
48453
- openings_visible: !!options.openingsVisible
48438
+ openings_visible: !!options.openingsVisible,
48439
+ spaces_translucent: !!options.spaces_translucent,
48440
+ space_boundaries_translucent: !!options.space_boundaries_translucent,
48441
+ openings_translucent: !!options.openings_translucent
48454
48442
  }
48455
48443
  }
48456
48444
  };
@@ -48467,15 +48455,11 @@ class BCFViewpointsPlugin extends Plugin {
48467
48455
  let alpha;
48468
48456
 
48469
48457
  if (entity.xrayed) {
48470
- if (this.xrayAsZeroAlpha) {
48471
- alpha = 0;
48458
+ if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
48459
+ // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
48460
+ alpha = 0.1;
48472
48461
  } else {
48473
- if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
48474
- // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
48475
- alpha = 0.1;
48476
- } else {
48477
- alpha = scene.xrayMaterial.fillAlpha;
48478
- }
48462
+ alpha = scene.xrayMaterial.fillAlpha;
48479
48463
  }
48480
48464
  alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
48481
48465
  color = alpha + color;
@@ -48526,6 +48510,8 @@ class BCFViewpointsPlugin extends Plugin {
48526
48510
 
48527
48511
  bcfViewpoint.components.selection = this._createBCFComponents(selectedObjectIds);
48528
48512
 
48513
+ bcfViewpoint.components.translucency = this._createBCFComponents(scene.xrayedObjectIds);
48514
+
48529
48515
  if (options.snapshot !== false) {
48530
48516
  bcfViewpoint.snapshot = {
48531
48517
  snapshot_type: "png",
@@ -48711,12 +48697,19 @@ class BCFViewpointsPlugin extends Plugin {
48711
48697
  const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
48712
48698
  if (view_setup_hints) {
48713
48699
  if (view_setup_hints.spaces_visible === false) {
48714
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
48700
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
48715
48701
  }
48716
- if (view_setup_hints.openings_visible === false) {
48717
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), false);
48702
+ if (view_setup_hints.spaces_translucent !== undefined) {
48703
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
48718
48704
  }
48719
48705
  if (view_setup_hints.space_boundaries_visible !== undefined) ;
48706
+ if (view_setup_hints.openings_visible === false) {
48707
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
48708
+ }
48709
+ if (view_setup_hints.space_boundaries_translucent !== undefined) ;
48710
+ if (view_setup_hints.openings_translucent !== undefined) {
48711
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
48712
+ }
48720
48713
  }
48721
48714
  }
48722
48715
 
@@ -48726,6 +48719,11 @@ class BCFViewpointsPlugin extends Plugin {
48726
48719
 
48727
48720
  }
48728
48721
 
48722
+ if (bcfViewpoint.components.translucency) {
48723
+ scene.setObjectsXRayed(scene.xrayedObjectIds, false);
48724
+ bcfViewpoint.components.translucency.forEach(component => this._withBCFComponent(options, component, entity => entity.xrayed = true));
48725
+ }
48726
+
48729
48727
  if (bcfViewpoint.components.coloring) {
48730
48728
  bcfViewpoint.components.coloring.forEach(coloring => {
48731
48729
 
@@ -48752,16 +48750,7 @@ class BCFViewpointsPlugin extends Plugin {
48752
48750
  this._withBCFComponent(options, component, entity => {
48753
48751
  entity.colorize = colorize;
48754
48752
  if (alphaDefined) {
48755
- if (alpha === 0 && this.xrayAsZeroAlpha) {
48756
- const savedFromXeokit = (component.originating_system === this.originatingSystem);
48757
- if (savedFromXeokit) {
48758
- entity.xrayed = true;
48759
- } else {
48760
- entity.opacity = alpha;
48761
- }
48762
- } else {
48763
- entity.opacity = alpha;
48764
- }
48753
+ entity.opacity = alpha;
48765
48754
  }
48766
48755
  }));
48767
48756
  });
@@ -122560,6 +122549,15 @@ parsers[ParserV10.version] = ParserV10;
122560
122549
  * myViewer.scene.setObjectVisibilities("myModel1#0BTBFw6f90Nfh9rP1dlXrb", true);
122561
122550
  *````
122562
122551
  *
122552
+ * We can also provide an HTTP URL to the XKT file:
122553
+ *
122554
+ * ````javascript
122555
+ * const sceneModel = xktLoader.load({
122556
+ * manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/models/xkt/Schependomlaan.xkt",
122557
+ * id: "myModel",
122558
+ * });
122559
+ * ````
122560
+ *
122563
122561
  * # Loading a model from a manifest of XKT files
122564
122562
  *
122565
122563
  * The `ifc2gltf` tool from Creoox, which converts IFC files into glTF geometry and JSON metadata files, has the option to
@@ -122646,6 +122644,65 @@ parsers[ParserV10.version] = ParserV10;
122646
122644
  * They work much reliably (and faster) when processing smaller files (eg. 20MB) than when processing large files (eg. 500MB), where
122647
122645
  * they have less trouble allocating the system memory they need for conversion and parsing.
122648
122646
  *
122647
+ * We can also provide an HTTP URL to the manifest:
122648
+ *
122649
+ * ````javascript
122650
+ * const sceneModel = xktLoader.load({
122651
+ * manifestSrc: "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt.manifest.json",
122652
+ * id: "myModel",
122653
+ * });
122654
+ * ````
122655
+ *
122656
+ * We can also provide the manifest as parameter object:
122657
+ *
122658
+ * ````javascript
122659
+ * const sceneModel = xktLoader.load({
122660
+ * id: "myModel",
122661
+ * manifest: {
122662
+ * inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
122663
+ * converterApplication: "convert2xkt",
122664
+ * converterApplicationVersion: "v1.1.10",
122665
+ * conversionDate": "09-11-2023- 18-29-01",
122666
+ * xktFiles: [
122667
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
122668
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
122669
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
122670
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
122671
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
122672
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
122673
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
122674
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
122675
+ * "../../assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
122676
+ * ]
122677
+ * }
122678
+ * });
122679
+ * ````
122680
+ *
122681
+ * We can also provide the paths to the XKT files as HTTP URLs:
122682
+ *
122683
+ * ````javascript
122684
+ * const sceneModel = xktLoader.load({
122685
+ * id: "myModel",
122686
+ * manifest: {
122687
+ * inputFile: "assets/models/gltf/Karhumaki/model.glb.manifest.json",
122688
+ * converterApplication: "convert2xkt",
122689
+ * converterApplicationVersion: "v1.1.10",
122690
+ * conversionDate": "09-11-2023- 18-29-01",
122691
+ * xktFiles: [
122692
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model.xkt",
122693
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_1.xkt",
122694
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_2.xkt",
122695
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_3.xkt",
122696
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_4.xkt",
122697
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_5.xkt",
122698
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_6.xkt",
122699
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_7.xkt",
122700
+ * "https://xeokit.github.io/xeokit-sdk/assets/models/xkt/v10/split/Karhumaki-Bridge/model_8.xkt"
122701
+ * ]
122702
+ * }
122703
+ * });
122704
+ * ````
122705
+ *
122649
122706
  * @class XKTLoaderPlugin
122650
122707
  */
122651
122708
  class XKTLoaderPlugin extends Plugin {
@@ -122915,10 +122972,14 @@ class XKTLoaderPlugin extends Plugin {
122915
122972
  *
122916
122973
  * @param {*} params Loading parameters.
122917
122974
  * @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
122918
- * @param {String} [params.src] Path to a *````.xkt````* file, as an alternative to the ````xkt```` parameter.
122975
+ * @param {String} [params.src] Path or URL to an *````.xkt````* file, as an alternative to the ````xkt```` parameter.
122919
122976
  * @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
122920
- * @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
122977
+ * @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
122921
122978
  * @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
122979
+ * @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
122980
+ * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
122981
+ * @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
122982
+ * multiple XKT files. See [tutorial](https://www.notion.so/xeokit/Automatically-Splitting-Large-Models-for-Better-Performance-165fc022e94742cf966ee50003572259) for more info.
122922
122983
  * @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
122923
122984
  * @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
122924
122985
  * @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
@@ -122954,8 +123015,8 @@ class XKTLoaderPlugin extends Plugin {
122954
123015
  delete params.id;
122955
123016
  }
122956
123017
 
122957
- if (!params.src && !params.xkt && !params.manifestSrc) {
122958
- this.error("load() param expected: src, xkt or manifestSrc");
123018
+ if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
123019
+ this.error("load() param expected: src, xkt, manifestSrc or manifestData");
122959
123020
  return sceneModel; // Return new empty model
122960
123021
  }
122961
123022
 
@@ -123083,8 +123144,8 @@ class XKTLoaderPlugin extends Plugin {
123083
123144
  } else if (params.xkt) {
123084
123145
  this._parseModel(params.xkt, params, options, sceneModel, metaModel, manifestCtx);
123085
123146
  finish();
123086
- } else if (params.manifestSrc) {
123087
- const baseDir = getBaseDirectory(params.manifestSrc);
123147
+ } else if (params.manifestSrc || params.manifest) {
123148
+ const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
123088
123149
  const loadJSONs = (metaDataFiles, done, error) => {
123089
123150
  let i = 0;
123090
123151
  const loadNext = () => {
@@ -123104,7 +123165,6 @@ class XKTLoaderPlugin extends Plugin {
123104
123165
  };
123105
123166
  loadNext();
123106
123167
  };
123107
-
123108
123168
  const loadXKTs = (xktFiles, done, error) => {
123109
123169
  let i = 0;
123110
123170
  const loadNext = () => {
@@ -123120,11 +123180,8 @@ class XKTLoaderPlugin extends Plugin {
123120
123180
  };
123121
123181
  loadNext();
123122
123182
  };
123123
-
123124
- this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
123125
- if (sceneModel.destroyed) {
123126
- return;
123127
- }
123183
+ if (params.manifest) {
123184
+ const manifestData = params.manifest;
123128
123185
  const xktFiles = manifestData.xktFiles;
123129
123186
  if (!xktFiles || xktFiles.length === 0) {
123130
123187
  error(`load(): Failed to load model manifest - manifest not valid`);
@@ -123138,7 +123195,26 @@ class XKTLoaderPlugin extends Plugin {
123138
123195
  } else {
123139
123196
  loadXKTs(xktFiles, finish, error);
123140
123197
  }
123141
- }, error);
123198
+ } else {
123199
+ this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
123200
+ if (sceneModel.destroyed) {
123201
+ return;
123202
+ }
123203
+ const xktFiles = manifestData.xktFiles;
123204
+ if (!xktFiles || xktFiles.length === 0) {
123205
+ error(`load(): Failed to load model manifest - manifest not valid`);
123206
+ return;
123207
+ }
123208
+ const metaModelFiles = manifestData.metaModelFiles;
123209
+ if (metaModelFiles) {
123210
+ loadJSONs(metaModelFiles, () => {
123211
+ loadXKTs(xktFiles, finish, error);
123212
+ }, error);
123213
+ } else {
123214
+ loadXKTs(xktFiles, finish, error);
123215
+ }
123216
+ }, error);
123217
+ }
123142
123218
  }
123143
123219
  }
123144
123220