@xeokit/xeokit-sdk 2.4.2-beta-43 → 2.4.2-beta-45

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.
@@ -60470,19 +60470,141 @@ function getBatchingRenderers$1(scene) {
60470
60470
  return batchingRenderers;
60471
60471
  }
60472
60472
 
60473
+ let maxDataTextureHeight = 1 << 16;
60474
+ let maxGeometryBatchSize = 4096;
60475
+
60473
60476
  /**
60474
- * @private
60477
+ * Manages global configurations for all {@link Viewer}s.
60478
+ *
60479
+ * ## Example
60480
+ *
60481
+ * In the example below, we'll disable xeokit's double-precision support, which gives a performance and memory boost
60482
+ * on low-power devices, but also means that we can no longer render double-precision models without jittering.
60483
+ *
60484
+ * That's OK if we know that we're not going to view models that are geographically vast, or offset far from the World coordinate origin.
60485
+ *
60486
+ * [[Run this example](/examples/#Configs_disableDoublePrecisionAndRAF)]
60487
+ *
60488
+ * ````javascript
60489
+ * import {Configs, Viewer, XKTLoaderPlugin} from "https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js";
60490
+ *
60491
+ * // Access xeoit-sdk global configs.
60492
+ * // We typically set configs only before we create any Viewers.
60493
+ * const configs = new Configs();
60494
+ *
60495
+ * // Disable 64-bit precision for extra speed.
60496
+ * // Only set this config once, before you create any Viewers.
60497
+ * configs.doublePrecisionEnabled = false;
60498
+ *
60499
+ * // Create a Viewer, to which our configs apply
60500
+ * const viewer = new Viewer({
60501
+ * canvasId: "myCanvas"
60502
+ * });
60503
+ *
60504
+ * viewer.camera.eye = [-3.933, 2.855, 27.018];
60505
+ * viewer.camera.look = [4.400, 3.724, 8.899];
60506
+ * viewer.camera.up = [-0.018, 0.999, 0.039];
60507
+ *
60508
+ * const xktLoader = new XKTLoaderPlugin(viewer);
60509
+ *
60510
+ * const model = xktLoader.load({
60511
+ * src: "../assets/models/xkt/v8/ifc/Duplex.ifc.xkt"
60512
+ * });
60513
+ * ````
60475
60514
  */
60476
- class TrianglesBatchingBuffer {
60515
+ class Configs {
60477
60516
 
60478
- constructor(maxGeometryBatchSize = 5000000) {
60517
+ /**
60518
+ * Creates a Configs.
60519
+ */
60520
+ constructor() {
60479
60521
 
60480
- if (maxGeometryBatchSize > 5000000) {
60481
- maxGeometryBatchSize = 5000000;
60522
+ }
60523
+
60524
+ /**
60525
+ * Sets whether double precision mode is enabled for Viewers.
60526
+ *
60527
+ * When double precision mode is enabled (default), Viewers will accurately render models that contain
60528
+ * double-precision coordinates, without jittering.
60529
+ *
60530
+ * Internally, double precision incurs extra performance and memory overhead, so if we're certain that
60531
+ * we're not going to render models that rely on double-precision coordinates, then it's a good idea to disable
60532
+ * it, especially on low-power devices.
60533
+ *
60534
+ * This should only be set once, before creating any Viewers.
60535
+ *
60536
+ * @returns {Boolean}
60537
+ */
60538
+ set doublePrecisionEnabled(doublePrecision) {
60539
+ math.setDoublePrecisionEnabled(doublePrecision);
60540
+ }
60541
+
60542
+ /**
60543
+ * Gets whether double precision mode is enabled for all Viewers.
60544
+ *
60545
+ * @returns {Boolean}
60546
+ */
60547
+ get doublePrecisionEnabled() {
60548
+ return math.getDoublePrecisionEnabled();
60549
+ }
60550
+
60551
+ /**
60552
+ * Sets the maximum data texture height.
60553
+ *
60554
+ * Should be a multiple of 1024. Default is 4096, which is the maximum allowed value.
60555
+ */
60556
+ set maxDataTextureHeight(value) {
60557
+ value = Math.ceil(value / 1024) * 1024;
60558
+ if (value > 4096) {
60559
+ value = 4096;
60560
+ } else if (value < 1024) {
60561
+ value = 1024;
60482
60562
  }
60563
+ maxDataTextureHeight = value;
60564
+ }
60483
60565
 
60484
- this.maxVerts = maxGeometryBatchSize;
60485
- this.maxIndices = maxGeometryBatchSize * 3; // Rough rule-of-thumb
60566
+ /**
60567
+ * Sets maximum data texture height.
60568
+ * @returns {*|number}
60569
+ */
60570
+ get maxDataTextureHeight() {
60571
+ return maxDataTextureHeight;
60572
+ }
60573
+
60574
+ /**
60575
+ * Sets the maximum batched geometry VBO size.
60576
+ *
60577
+ * Default value is 5000000, which is the maximum size.
60578
+ *
60579
+ * Minimum size is 100000.
60580
+ */
60581
+ set maxGeometryBatchSize(value) {
60582
+ if (value < 100000) {
60583
+ value = 100000;
60584
+ } else if (value > 5000000) {
60585
+ value = 5000000;
60586
+ }
60587
+ maxGeometryBatchSize = value;
60588
+ }
60589
+
60590
+ /**
60591
+ * Gets the maximum batched geometry VBO size.
60592
+ */
60593
+ get maxGeometryBatchSize() {
60594
+ return maxGeometryBatchSize;
60595
+ }
60596
+ }
60597
+
60598
+ const configs$1 = new Configs();
60599
+
60600
+ /**
60601
+ * @private
60602
+ */
60603
+ class TrianglesBatchingBuffer {
60604
+
60605
+ constructor() {
60606
+ this.maxVerts = configs$1.maxGeometryBatchSize;
60607
+ this.maxIndices = configs$1.maxGeometryBatchSize * 3; // Rough rule-of-thumb
60486
60608
  this.positions = [];
60487
60609
  this.colors = [];
60488
60610
  this.uv = [];
@@ -81121,6 +81243,8 @@ class DataTextureGenerator {
81121
81243
  }
81122
81244
  }
81123
81245
 
81246
+ const configs = new Configs();
81247
+
81124
81248
  /**
81125
81249
  * 12-bits allowed for object ids.
81126
81250
  * Limits the per-object texture height in the layer.
@@ -81131,7 +81255,7 @@ const MAX_NUMBER_OF_OBJECTS_IN_LAYER = (1 << 16);
81131
81255
  * 4096 is max data texture height.
81132
81256
  * Limits the aggregated geometry texture height in the layer.
81133
81257
  */
81134
- const MAX_DATA_TEXTURE_HEIGHT = (1 << 12);
81258
+ const MAX_DATA_TEXTURE_HEIGHT = configs.maxDataTextureHeight;
81135
81259
 
81136
81260
  /**
81137
81261
  * Align `indices` and `edgeIndices` memory layout to 8 elements.
@@ -100726,82 +100850,6 @@ class Viewer {
100726
100850
  }
100727
100851
  }
100728
100852
 
100729
- /**
100730
- * Manages global configurations for all {@link Viewer}s.
100731
- *
100732
- * ## Example
100733
- *
100734
- * In the example below, we'll disable xeokit's double-precision support, which gives a performance and memory boost
100735
- * on low-power devices, but also means that we can no longer render double-precision models without jittering.
100736
- *
100737
- * That's OK if we know that we're not going to view models that are geographically vast, or offset far from the World coordinate origin.
100738
- *
100739
- * [[Run this example](/examples/#Configs_disableDoublePrecisionAndRAF)]
100740
- *
100741
- * ````javascript
100742
- * import {Configs, Viewer, XKTLoaderPlugin} from "https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js";
100743
- *
100744
- * // Access xeoit-sdk global configs.
100745
- * // We typically set configs only before we create any Viewers.
100746
- * const configs = new Configs();
100747
- *
100748
- * // Disable 64-bit precision for extra speed.
100749
- * // Only set this config once, before you create any Viewers.
100750
- * configs.doublePrecisionEnabled = false;
100751
- *
100752
- * // Create a Viewer, to which our configs apply
100753
- * const viewer = new Viewer({
100754
- * canvasId: "myCanvas"
100755
- * });
100756
- *
100757
- * viewer.camera.eye = [-3.933, 2.855, 27.018];
100758
- * viewer.camera.look = [4.400, 3.724, 8.899];
100759
- * viewer.camera.up = [-0.018, 0.999, 0.039];
100760
- *
100761
- * const xktLoader = new XKTLoaderPlugin(viewer);
100762
- *
100763
- * const model = xktLoader.load({
100764
- * src: "../assets/models/xkt/v8/ifc/Duplex.ifc.xkt"
100765
- * });
100766
- * ````
100767
- */
100768
- class Configs {
100769
-
100770
- /**
100771
- * Creates a Configs.
100772
- */
100773
- constructor() {
100774
-
100775
- }
100776
-
100777
- /**
100778
- * Sets whether double precision mode is enabled for Viewers.
100779
- *
100780
- * When double precision mode is enabled (default), Viewers will accurately render models that contain
100781
- * double-precision coordinates, without jittering.
100782
- *
100783
- * Internally, double precision incurs extra performance and memory overhead, so if we're certain that
100784
- * we're not going to render models that rely on double-precision coordinates, then it's a good idea to disable
100785
- * it, especially on low-power devices.
100786
- *
100787
- * This should only be set once, before creating any Viewers.
100788
- *
100789
- * @returns {Boolean}
100790
- */
100791
- set doublePrecisionEnabled(doublePrecision) {
100792
- math.setDoublePrecisionEnabled(doublePrecision);
100793
- }
100794
-
100795
- /**
100796
- * Gets whether double precision mode is enabled for all Viewers.
100797
- *
100798
- * @returns {Boolean}
100799
- */
100800
- get doublePrecisionEnabled() {
100801
- return math.getDoublePrecisionEnabled();
100802
- }
100803
- }
100804
-
100805
100853
  function assert$5(condition, message) {
100806
100854
  if (!condition) {
100807
100855
  throw new Error(message || 'loader assertion failed.');
@@ -60466,19 +60466,141 @@ function getBatchingRenderers$1(scene) {
60466
60466
  return batchingRenderers;
60467
60467
  }
60468
60468
 
60469
+ let maxDataTextureHeight = 1 << 16;
60470
+ let maxGeometryBatchSize = 4096;
60471
+
60469
60472
  /**
60470
- * @private
60473
+ * Manages global configurations for all {@link Viewer}s.
60474
+ *
60475
+ * ## Example
60476
+ *
60477
+ * In the example below, we'll disable xeokit's double-precision support, which gives a performance and memory boost
60478
+ * on low-power devices, but also means that we can no longer render double-precision models without jittering.
60479
+ *
60480
+ * That's OK if we know that we're not going to view models that are geographically vast, or offset far from the World coordinate origin.
60481
+ *
60482
+ * [[Run this example](/examples/#Configs_disableDoublePrecisionAndRAF)]
60483
+ *
60484
+ * ````javascript
60485
+ * import {Configs, Viewer, XKTLoaderPlugin} from "https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js";
60486
+ *
60487
+ * // Access xeoit-sdk global configs.
60488
+ * // We typically set configs only before we create any Viewers.
60489
+ * const configs = new Configs();
60490
+ *
60491
+ * // Disable 64-bit precision for extra speed.
60492
+ * // Only set this config once, before you create any Viewers.
60493
+ * configs.doublePrecisionEnabled = false;
60494
+ *
60495
+ * // Create a Viewer, to which our configs apply
60496
+ * const viewer = new Viewer({
60497
+ * canvasId: "myCanvas"
60498
+ * });
60499
+ *
60500
+ * viewer.camera.eye = [-3.933, 2.855, 27.018];
60501
+ * viewer.camera.look = [4.400, 3.724, 8.899];
60502
+ * viewer.camera.up = [-0.018, 0.999, 0.039];
60503
+ *
60504
+ * const xktLoader = new XKTLoaderPlugin(viewer);
60505
+ *
60506
+ * const model = xktLoader.load({
60507
+ * src: "../assets/models/xkt/v8/ifc/Duplex.ifc.xkt"
60508
+ * });
60509
+ * ````
60471
60510
  */
60472
- class TrianglesBatchingBuffer {
60511
+ class Configs {
60473
60512
 
60474
- constructor(maxGeometryBatchSize = 5000000) {
60513
+ /**
60514
+ * Creates a Configs.
60515
+ */
60516
+ constructor() {
60475
60517
 
60476
- if (maxGeometryBatchSize > 5000000) {
60477
- maxGeometryBatchSize = 5000000;
60518
+ }
60519
+
60520
+ /**
60521
+ * Sets whether double precision mode is enabled for Viewers.
60522
+ *
60523
+ * When double precision mode is enabled (default), Viewers will accurately render models that contain
60524
+ * double-precision coordinates, without jittering.
60525
+ *
60526
+ * Internally, double precision incurs extra performance and memory overhead, so if we're certain that
60527
+ * we're not going to render models that rely on double-precision coordinates, then it's a good idea to disable
60528
+ * it, especially on low-power devices.
60529
+ *
60530
+ * This should only be set once, before creating any Viewers.
60531
+ *
60532
+ * @returns {Boolean}
60533
+ */
60534
+ set doublePrecisionEnabled(doublePrecision) {
60535
+ math.setDoublePrecisionEnabled(doublePrecision);
60536
+ }
60537
+
60538
+ /**
60539
+ * Gets whether double precision mode is enabled for all Viewers.
60540
+ *
60541
+ * @returns {Boolean}
60542
+ */
60543
+ get doublePrecisionEnabled() {
60544
+ return math.getDoublePrecisionEnabled();
60545
+ }
60546
+
60547
+ /**
60548
+ * Sets the maximum data texture height.
60549
+ *
60550
+ * Should be a multiple of 1024. Default is 4096, which is the maximum allowed value.
60551
+ */
60552
+ set maxDataTextureHeight(value) {
60553
+ value = Math.ceil(value / 1024) * 1024;
60554
+ if (value > 4096) {
60555
+ value = 4096;
60556
+ } else if (value < 1024) {
60557
+ value = 1024;
60478
60558
  }
60559
+ maxDataTextureHeight = value;
60560
+ }
60479
60561
 
60480
- this.maxVerts = maxGeometryBatchSize;
60481
- this.maxIndices = maxGeometryBatchSize * 3; // Rough rule-of-thumb
60562
+ /**
60563
+ * Sets maximum data texture height.
60564
+ * @returns {*|number}
60565
+ */
60566
+ get maxDataTextureHeight() {
60567
+ return maxDataTextureHeight;
60568
+ }
60569
+
60570
+ /**
60571
+ * Sets the maximum batched geometry VBO size.
60572
+ *
60573
+ * Default value is 5000000, which is the maximum size.
60574
+ *
60575
+ * Minimum size is 100000.
60576
+ */
60577
+ set maxGeometryBatchSize(value) {
60578
+ if (value < 100000) {
60579
+ value = 100000;
60580
+ } else if (value > 5000000) {
60581
+ value = 5000000;
60582
+ }
60583
+ maxGeometryBatchSize = value;
60584
+ }
60585
+
60586
+ /**
60587
+ * Gets the maximum batched geometry VBO size.
60588
+ */
60589
+ get maxGeometryBatchSize() {
60590
+ return maxGeometryBatchSize;
60591
+ }
60592
+ }
60593
+
60594
+ const configs$1 = new Configs();
60595
+
60596
+ /**
60597
+ * @private
60598
+ */
60599
+ class TrianglesBatchingBuffer {
60600
+
60601
+ constructor() {
60602
+ this.maxVerts = configs$1.maxGeometryBatchSize;
60603
+ this.maxIndices = configs$1.maxGeometryBatchSize * 3; // Rough rule-of-thumb
60482
60604
  this.positions = [];
60483
60605
  this.colors = [];
60484
60606
  this.uv = [];
@@ -81117,6 +81239,8 @@ class DataTextureGenerator {
81117
81239
  }
81118
81240
  }
81119
81241
 
81242
+ const configs = new Configs();
81243
+
81120
81244
  /**
81121
81245
  * 12-bits allowed for object ids.
81122
81246
  * Limits the per-object texture height in the layer.
@@ -81127,7 +81251,7 @@ const MAX_NUMBER_OF_OBJECTS_IN_LAYER = (1 << 16);
81127
81251
  * 4096 is max data texture height.
81128
81252
  * Limits the aggregated geometry texture height in the layer.
81129
81253
  */
81130
- const MAX_DATA_TEXTURE_HEIGHT = (1 << 12);
81254
+ const MAX_DATA_TEXTURE_HEIGHT = configs.maxDataTextureHeight;
81131
81255
 
81132
81256
  /**
81133
81257
  * Align `indices` and `edgeIndices` memory layout to 8 elements.
@@ -100722,82 +100846,6 @@ class Viewer {
100722
100846
  }
100723
100847
  }
100724
100848
 
100725
- /**
100726
- * Manages global configurations for all {@link Viewer}s.
100727
- *
100728
- * ## Example
100729
- *
100730
- * In the example below, we'll disable xeokit's double-precision support, which gives a performance and memory boost
100731
- * on low-power devices, but also means that we can no longer render double-precision models without jittering.
100732
- *
100733
- * That's OK if we know that we're not going to view models that are geographically vast, or offset far from the World coordinate origin.
100734
- *
100735
- * [[Run this example](/examples/#Configs_disableDoublePrecisionAndRAF)]
100736
- *
100737
- * ````javascript
100738
- * import {Configs, Viewer, XKTLoaderPlugin} from "https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/xeokit-sdk.es.min.js";
100739
- *
100740
- * // Access xeoit-sdk global configs.
100741
- * // We typically set configs only before we create any Viewers.
100742
- * const configs = new Configs();
100743
- *
100744
- * // Disable 64-bit precision for extra speed.
100745
- * // Only set this config once, before you create any Viewers.
100746
- * configs.doublePrecisionEnabled = false;
100747
- *
100748
- * // Create a Viewer, to which our configs apply
100749
- * const viewer = new Viewer({
100750
- * canvasId: "myCanvas"
100751
- * });
100752
- *
100753
- * viewer.camera.eye = [-3.933, 2.855, 27.018];
100754
- * viewer.camera.look = [4.400, 3.724, 8.899];
100755
- * viewer.camera.up = [-0.018, 0.999, 0.039];
100756
- *
100757
- * const xktLoader = new XKTLoaderPlugin(viewer);
100758
- *
100759
- * const model = xktLoader.load({
100760
- * src: "../assets/models/xkt/v8/ifc/Duplex.ifc.xkt"
100761
- * });
100762
- * ````
100763
- */
100764
- class Configs {
100765
-
100766
- /**
100767
- * Creates a Configs.
100768
- */
100769
- constructor() {
100770
-
100771
- }
100772
-
100773
- /**
100774
- * Sets whether double precision mode is enabled for Viewers.
100775
- *
100776
- * When double precision mode is enabled (default), Viewers will accurately render models that contain
100777
- * double-precision coordinates, without jittering.
100778
- *
100779
- * Internally, double precision incurs extra performance and memory overhead, so if we're certain that
100780
- * we're not going to render models that rely on double-precision coordinates, then it's a good idea to disable
100781
- * it, especially on low-power devices.
100782
- *
100783
- * This should only be set once, before creating any Viewers.
100784
- *
100785
- * @returns {Boolean}
100786
- */
100787
- set doublePrecisionEnabled(doublePrecision) {
100788
- math.setDoublePrecisionEnabled(doublePrecision);
100789
- }
100790
-
100791
- /**
100792
- * Gets whether double precision mode is enabled for all Viewers.
100793
- *
100794
- * @returns {Boolean}
100795
- */
100796
- get doublePrecisionEnabled() {
100797
- return math.getDoublePrecisionEnabled();
100798
- }
100799
- }
100800
-
100801
100849
  function assert$5(condition, message) {
100802
100850
  if (!condition) {
100803
100851
  throw new Error(message || 'loader assertion failed.');