@xeokit/xeokit-sdk 2.4.2-beta-9 → 2.4.2-beta-10
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/dist/xeokit-sdk.cjs.js +36 -5
- package/dist/xeokit-sdk.es.js +36 -5
- package/dist/xeokit-sdk.es5.js +18 -3
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +1 -1
- package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +36 -5
package/package.json
CHANGED
|
@@ -316,11 +316,29 @@ 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.
|
|
319
320
|
*/
|
|
320
321
|
constructor(viewer, cfg = {}) {
|
|
321
322
|
|
|
322
323
|
super("BCFViewpoints", viewer, cfg);
|
|
323
324
|
|
|
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
|
+
|
|
324
342
|
/**
|
|
325
343
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
326
344
|
* @property originatingSystem
|
|
@@ -509,11 +527,15 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
509
527
|
let alpha;
|
|
510
528
|
|
|
511
529
|
if (entity.xrayed) {
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
alpha = 0.1;
|
|
530
|
+
if (this.xrayAsZeroAlpha) {
|
|
531
|
+
alpha = 0;
|
|
515
532
|
} else {
|
|
516
|
-
|
|
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
|
+
}
|
|
517
539
|
}
|
|
518
540
|
alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
519
541
|
color = alpha + color;
|
|
@@ -792,7 +814,16 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
792
814
|
this._withBCFComponent(options, component, entity => {
|
|
793
815
|
entity.colorize = colorize;
|
|
794
816
|
if (alphaDefined) {
|
|
795
|
-
|
|
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
|
+
}
|
|
796
827
|
}
|
|
797
828
|
}));
|
|
798
829
|
});
|