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

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.4.2-beta-29",
3
+ "version": "2.4.2-beta-30",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -316,29 +316,11 @@ class BCFViewpointsPlugin extends Plugin {
316
316
  * @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
317
317
  * @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
318
318
  * @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
319
- * @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
320
319
  */
321
320
  constructor(viewer, cfg = {}) {
322
321
 
323
322
  super("BCFViewpoints", viewer, cfg);
324
323
 
325
- /**
326
- * Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
327
- *
328
- * When `xrayAsZeroAlpha` is `true`:
329
- *
330
- * * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
331
- * * 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`
332
- *
333
- * When `xrayAsZeroAlpha` is `false`:
334
- *
335
- * * don't save any X-ray information in viewpoints, and
336
- * * reset all objects as not X-rayed whenever loading a viewpoint.
337
- *
338
- * @type {boolean}
339
- */
340
- this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
341
-
342
324
  /**
343
325
  * Identifies the originating system to include in BCF viewpoints saved by this plugin.
344
326
  * @property originatingSystem
@@ -363,6 +345,9 @@ class BCFViewpointsPlugin extends Plugin {
363
345
  * @param {Boolean} [options.spacesVisible=false] Indicates whether ````IfcSpace```` types should be forced visible in the viewpoint.
364
346
  * @param {Boolean} [options.openingsVisible=false] Indicates whether ````IfcOpening```` types should be forced visible in the viewpoint.
365
347
  * @param {Boolean} [options.spaceBoundariesVisible=false] Indicates whether the boundaries of ````IfcSpace```` types should be visible in the viewpoint.
348
+ * @param {Boolean} [options.spacesTranslucent=false] Indicates whether ````IfcSpace```` types should be forced translucent in the viewpoint.
349
+ * @param {Boolean} [options.spaceBoundariesTranslucent=false] Indicates whether the boundaries of ````IfcSpace```` types should be forced translucent in the viewpoint.
350
+ * @param {Boolean} [options.openingsTranslucent=true] Indicates whether ````IfcOpening```` types should be forced translucent in the viewpoint.
366
351
  * @param {Boolean} [options.snapshot=true] Indicates whether the snapshot should be included in the viewpoint.
367
352
  * @param {Boolean} [options.defaultInvisible=false] When ````true````, will save the default visibility of all objects
368
353
  * as ````false````. This means that when we load the viewpoint again, and there are additional models loaded that
@@ -510,7 +495,10 @@ class BCFViewpointsPlugin extends Plugin {
510
495
  view_setup_hints: {
511
496
  spaces_visible: !!options.spacesVisible,
512
497
  space_boundaries_visible: !!options.spaceBoundariesVisible,
513
- openings_visible: !!options.openingsVisible
498
+ openings_visible: !!options.openingsVisible,
499
+ spaces_translucent: !!options.spaces_translucent,
500
+ space_boundaries_translucent: !!options.space_boundaries_translucent,
501
+ openings_translucent: !!options.openings_translucent
514
502
  }
515
503
  }
516
504
  };
@@ -527,15 +515,11 @@ class BCFViewpointsPlugin extends Plugin {
527
515
  let alpha;
528
516
 
529
517
  if (entity.xrayed) {
530
- if (this.xrayAsZeroAlpha) {
531
- alpha = 0;
518
+ if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
519
+ // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
520
+ alpha = 0.1;
532
521
  } else {
533
- if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
534
- // BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
535
- alpha = 0.1;
536
- } else {
537
- alpha = scene.xrayMaterial.fillAlpha;
538
- }
522
+ alpha = scene.xrayMaterial.fillAlpha;
539
523
  }
540
524
  alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
541
525
  color = alpha + color;
@@ -586,6 +570,8 @@ class BCFViewpointsPlugin extends Plugin {
586
570
 
587
571
  bcfViewpoint.components.selection = this._createBCFComponents(selectedObjectIds);
588
572
 
573
+ bcfViewpoint.components.translucency = this._createBCFComponents(scene.xrayedObjectIds);
574
+
589
575
  if (options.snapshot !== false) {
590
576
  bcfViewpoint.snapshot = {
591
577
  snapshot_type: "png",
@@ -771,13 +757,22 @@ class BCFViewpointsPlugin extends Plugin {
771
757
  const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
772
758
  if (view_setup_hints) {
773
759
  if (view_setup_hints.spaces_visible === false) {
774
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
760
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
775
761
  }
776
- if (view_setup_hints.openings_visible === false) {
777
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), false);
762
+ if (view_setup_hints.spaces_translucent !== undefined) {
763
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
778
764
  }
779
765
  if (view_setup_hints.space_boundaries_visible !== undefined) {
780
- // TODO: Ability to show boundaries
766
+
767
+ }
768
+ if (view_setup_hints.openings_visible === false) {
769
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
770
+ }
771
+ if (view_setup_hints.space_boundaries_translucent !== undefined) {
772
+
773
+ }
774
+ if (view_setup_hints.openings_translucent !== undefined) {
775
+ scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"), true);
781
776
  }
782
777
  }
783
778
  }
@@ -788,6 +783,11 @@ class BCFViewpointsPlugin extends Plugin {
788
783
 
789
784
  }
790
785
 
786
+ if (bcfViewpoint.components.translucency) {
787
+ scene.setObjectsXRayed(scene.xrayedObjectIds, false);
788
+ bcfViewpoint.components.translucency.forEach(component => this._withBCFComponent(options, component, entity => entity.xrayed = true));
789
+ }
790
+
791
791
  if (bcfViewpoint.components.coloring) {
792
792
  bcfViewpoint.components.coloring.forEach(coloring => {
793
793
 
@@ -814,16 +814,7 @@ class BCFViewpointsPlugin extends Plugin {
814
814
  this._withBCFComponent(options, component, entity => {
815
815
  entity.colorize = colorize;
816
816
  if (alphaDefined) {
817
- if (alpha === 0 && this.xrayAsZeroAlpha) {
818
- const savedFromXeokit = (component.originating_system === this.originatingSystem);
819
- if (savedFromXeokit) {
820
- entity.xrayed = true;
821
- } else {
822
- entity.opacity = alpha;
823
- }
824
- } else {
825
- entity.opacity = alpha;
826
- }
817
+ entity.opacity = alpha;
827
818
  }
828
819
  }));
829
820
  });