@xeokit/xeokit-sdk 2.6.100 → 2.6.101

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * xeokit-sdk v2.6.100
3
- * Commit: 7a4d724a55a508d0bb365f751ff9e10dddfe9af8
4
- * Built: 2025-12-12T19:59:05.622Z
2
+ * xeokit-sdk v2.6.101
3
+ * Commit: cc32112384a95de94907d31b3001855a94b23fd3
4
+ * Built: 2025-12-22T10:25:15.233Z
5
5
  */
6
6
 
7
7
  if (typeof window !== 'undefined') {
8
- window.__XEOKIT__ = { version: '2.6.100', commit: '7a4d724a55a508d0bb365f751ff9e10dddfe9af8', built: '2025-12-12T19:59:05.622Z' };
8
+ window.__XEOKIT__ = { version: '2.6.101', commit: 'cc32112384a95de94907d31b3001855a94b23fd3', built: '2025-12-22T10:25:15.233Z' };
9
9
  }
10
10
 
11
11
  'use strict';
@@ -2513,6 +2513,25 @@ const math = {
2513
2513
  return dest;
2514
2514
  },
2515
2515
 
2516
+ /**
2517
+ * Multiplies one three-element vector by another.
2518
+ * @method mulVec3
2519
+ * @static
2520
+ * @param {Array(Number)} u First vector
2521
+ * @param {Array(Number)} v Second vector
2522
+ * @param {Array(Number)} [dest] Destination vector
2523
+ * @return {Array(Number)} dest if specified, u otherwise
2524
+ */
2525
+ mulVec3(u, v, dest) {
2526
+ if (!dest) {
2527
+ dest = u;
2528
+ }
2529
+ dest[0] = u[0] * v[0];
2530
+ dest[1] = u[1] * v[1];
2531
+ dest[2] = u[2] * v[2];
2532
+ return dest;
2533
+ },
2534
+
2516
2535
  /**
2517
2536
  * Multiplies one four-element vector by another.
2518
2537
  * @method mulVec4
@@ -12768,9 +12787,9 @@ const createPositionsDecodeMatrix$1 = (function () {
12768
12787
  const xmin = aabb[0];
12769
12788
  const ymin = aabb[1];
12770
12789
  const zmin = aabb[2];
12771
- const xwid = aabb[3] - xmin;
12772
- const ywid = aabb[4] - ymin;
12773
- const zwid = aabb[5] - zmin;
12790
+ const xwid = (aabb[3] - xmin) || 1;
12791
+ const ywid = (aabb[4] - ymin) || 1;
12792
+ const zwid = (aabb[5] - zmin) || 1;
12774
12793
  const maxInt = 65535;
12775
12794
  math.identityMat4(translate);
12776
12795
  math.translationMat4v(aabb, translate);
@@ -33022,7 +33041,9 @@ class DTXLayer extends Layer {
33022
33041
  }
33023
33042
  }
33024
33043
  };
33025
- }
33044
+ },
33045
+
33046
+ _clearToOptimizeGC: () => { indicesBuffer.length = edgeIndicesBuffer.length = 0; }
33026
33047
  };
33027
33048
  };
33028
33049
 
@@ -33323,7 +33344,14 @@ class DTXLayer extends Layer {
33323
33344
  const draw16 = buffer.geometry16Bits.createDrawers(createTextureForSingleItems, gl.UNSIGNED_SHORT);
33324
33345
  const draw32 = buffer.geometry32Bits.createDrawers(createTextureForSingleItems, gl.UNSIGNED_INT);
33325
33346
 
33326
- // Free up memory
33347
+ // Optimization to free up memory (XCD-408 and XCD-424).
33348
+ // The following lines were added to assist GC in cleaning up some of the data. See also the `texArray = null`.
33349
+ // A Chrome test with Lyon[1-9].xkt models loaded simultaneously showed a decrease of 596MB to 158MB.
33350
+ this._bucketGeometries = null;
33351
+ this._buffer.geometry8Bits._clearToOptimizeGC();
33352
+ this._buffer.geometry16Bits._clearToOptimizeGC();
33353
+ this._buffer.geometry32Bits._clearToOptimizeGC();
33354
+ Object.keys(this._buffer).forEach(k => this._buffer[k] = null);
33327
33355
  this._buffer = null;
33328
33356
 
33329
33357
  let deferredSetFlagsActive = false;
@@ -33534,7 +33562,7 @@ const createBindableDataTexture = function(gl, entitiesCnt, entitySize, type, en
33534
33562
  if (textureHeight === 0) {
33535
33563
  throw "texture height===0";
33536
33564
  }
33537
- const texArray = new arrayType(textureWidth * textureHeight * pixelWidth);
33565
+ let texArray = new arrayType(textureWidth * textureHeight * pixelWidth);
33538
33566
  dataTextureRamStats[statsProp] += texArray.byteLength;
33539
33567
  dataTextureRamStats.numberOfTextures++;
33540
33568
 
@@ -33550,6 +33578,10 @@ const createBindableDataTexture = function(gl, entitiesCnt, entitySize, type, en
33550
33578
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
33551
33579
  gl.bindTexture(gl.TEXTURE_2D, null);
33552
33580
 
33581
+ if (! exposeData) {
33582
+ texArray = null; // See the comment related to XCD-408 and XCD-424 above.
33583
+ }
33584
+
33553
33585
  return {
33554
33586
  // called by createSampler::bindTexture
33555
33587
  bind(unit) {
@@ -34053,7 +34085,8 @@ class VBOLayer extends Layer {
34053
34085
  });
34054
34086
 
34055
34087
  return buf;
34056
- }
34088
+ },
34089
+ _clearToOptimizeGC: () => { portions.length = 0; }
34057
34090
  };
34058
34091
  };
34059
34092
 
@@ -34380,12 +34413,13 @@ class VBOLayer extends Layer {
34380
34413
  : (quantizePositions(buffer.positions.compileBuffer(Float64Array), modelAABB, positionsDecodeMatrix = math.mat4()))));
34381
34414
  const positionsBuf = positions && maybeCreateBuffer(positions, 3, gl.STATIC_DRAW);
34382
34415
  if (! instancing) {
34383
- portions.forEach(portion => {
34384
- if (portion.retainedGeometry) {
34416
+ for (let i = 0; i < portions.length; ++i) { // WARNING: Replacing this for-loop by forEach increases memory consumption
34417
+ const portion = portions[i]; // by not GCing `positions` arr, even if portion.retainedGeometry is false.
34418
+ if (portion.retainedGeometry) { // See the comment related to XCD-408 and XCD-424 below.
34385
34419
  const start = 3 * portion.portionBase;
34386
34420
  portion.retainedGeometry.quantizedPositions = positions.subarray(start, start + 3 * portion.portionSize);
34387
34421
  }
34388
- });
34422
+ }
34389
34423
  }
34390
34424
 
34391
34425
  const modelMatrixColBufs = instancing && buffer.modelMatrixCol.map(b => maybeCreateBuffer(b.compileBuffer(Float32Array), 4, gl.STATIC_DRAW, true));
@@ -34424,6 +34458,10 @@ class VBOLayer extends Layer {
34424
34458
  })());
34425
34459
 
34426
34460
  // Free up memory
34461
+ // Optimization to free up memory (XCD-408 and XCD-424)
34462
+ // The following line was added to assist GC in cleaning up some of the data. See also the `portions` loop above.
34463
+ // A Chrome test with Lyon[1-9].xkt models loaded simultaneously showed a decrease of 538MB to 143MB.
34464
+ Object.values(this._buffer).forEach(a => a._clearToOptimizeGC ? a._clearToOptimizeGC() : a.forEach(a => a._clearToOptimizeGC()));
34427
34465
  this._buffer = null;
34428
34466
 
34429
34467
  scratchMemory.acquire();
@@ -1,11 +1,11 @@
1
1
  /**
2
- * xeokit-sdk v2.6.100
3
- * Commit: 7a4d724a55a508d0bb365f751ff9e10dddfe9af8
4
- * Built: 2025-12-12T19:59:05.622Z
2
+ * xeokit-sdk v2.6.101
3
+ * Commit: cc32112384a95de94907d31b3001855a94b23fd3
4
+ * Built: 2025-12-22T10:25:15.233Z
5
5
  */
6
6
 
7
7
  if (typeof window !== 'undefined') {
8
- window.__XEOKIT__ = { version: '2.6.100', commit: '7a4d724a55a508d0bb365f751ff9e10dddfe9af8', built: '2025-12-12T19:59:05.622Z' };
8
+ window.__XEOKIT__ = { version: '2.6.101', commit: 'cc32112384a95de94907d31b3001855a94b23fd3', built: '2025-12-22T10:25:15.233Z' };
9
9
  }
10
10
 
11
11
  /** @private */
@@ -2509,6 +2509,25 @@ const math = {
2509
2509
  return dest;
2510
2510
  },
2511
2511
 
2512
+ /**
2513
+ * Multiplies one three-element vector by another.
2514
+ * @method mulVec3
2515
+ * @static
2516
+ * @param {Array(Number)} u First vector
2517
+ * @param {Array(Number)} v Second vector
2518
+ * @param {Array(Number)} [dest] Destination vector
2519
+ * @return {Array(Number)} dest if specified, u otherwise
2520
+ */
2521
+ mulVec3(u, v, dest) {
2522
+ if (!dest) {
2523
+ dest = u;
2524
+ }
2525
+ dest[0] = u[0] * v[0];
2526
+ dest[1] = u[1] * v[1];
2527
+ dest[2] = u[2] * v[2];
2528
+ return dest;
2529
+ },
2530
+
2512
2531
  /**
2513
2532
  * Multiplies one four-element vector by another.
2514
2533
  * @method mulVec4
@@ -12764,9 +12783,9 @@ const createPositionsDecodeMatrix$1 = (function () {
12764
12783
  const xmin = aabb[0];
12765
12784
  const ymin = aabb[1];
12766
12785
  const zmin = aabb[2];
12767
- const xwid = aabb[3] - xmin;
12768
- const ywid = aabb[4] - ymin;
12769
- const zwid = aabb[5] - zmin;
12786
+ const xwid = (aabb[3] - xmin) || 1;
12787
+ const ywid = (aabb[4] - ymin) || 1;
12788
+ const zwid = (aabb[5] - zmin) || 1;
12770
12789
  const maxInt = 65535;
12771
12790
  math.identityMat4(translate);
12772
12791
  math.translationMat4v(aabb, translate);
@@ -33018,7 +33037,9 @@ class DTXLayer extends Layer {
33018
33037
  }
33019
33038
  }
33020
33039
  };
33021
- }
33040
+ },
33041
+
33042
+ _clearToOptimizeGC: () => { indicesBuffer.length = edgeIndicesBuffer.length = 0; }
33022
33043
  };
33023
33044
  };
33024
33045
 
@@ -33319,7 +33340,14 @@ class DTXLayer extends Layer {
33319
33340
  const draw16 = buffer.geometry16Bits.createDrawers(createTextureForSingleItems, gl.UNSIGNED_SHORT);
33320
33341
  const draw32 = buffer.geometry32Bits.createDrawers(createTextureForSingleItems, gl.UNSIGNED_INT);
33321
33342
 
33322
- // Free up memory
33343
+ // Optimization to free up memory (XCD-408 and XCD-424).
33344
+ // The following lines were added to assist GC in cleaning up some of the data. See also the `texArray = null`.
33345
+ // A Chrome test with Lyon[1-9].xkt models loaded simultaneously showed a decrease of 596MB to 158MB.
33346
+ this._bucketGeometries = null;
33347
+ this._buffer.geometry8Bits._clearToOptimizeGC();
33348
+ this._buffer.geometry16Bits._clearToOptimizeGC();
33349
+ this._buffer.geometry32Bits._clearToOptimizeGC();
33350
+ Object.keys(this._buffer).forEach(k => this._buffer[k] = null);
33323
33351
  this._buffer = null;
33324
33352
 
33325
33353
  let deferredSetFlagsActive = false;
@@ -33530,7 +33558,7 @@ const createBindableDataTexture = function(gl, entitiesCnt, entitySize, type, en
33530
33558
  if (textureHeight === 0) {
33531
33559
  throw "texture height===0";
33532
33560
  }
33533
- const texArray = new arrayType(textureWidth * textureHeight * pixelWidth);
33561
+ let texArray = new arrayType(textureWidth * textureHeight * pixelWidth);
33534
33562
  dataTextureRamStats[statsProp] += texArray.byteLength;
33535
33563
  dataTextureRamStats.numberOfTextures++;
33536
33564
 
@@ -33546,6 +33574,10 @@ const createBindableDataTexture = function(gl, entitiesCnt, entitySize, type, en
33546
33574
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
33547
33575
  gl.bindTexture(gl.TEXTURE_2D, null);
33548
33576
 
33577
+ if (! exposeData) {
33578
+ texArray = null; // See the comment related to XCD-408 and XCD-424 above.
33579
+ }
33580
+
33549
33581
  return {
33550
33582
  // called by createSampler::bindTexture
33551
33583
  bind(unit) {
@@ -34049,7 +34081,8 @@ class VBOLayer extends Layer {
34049
34081
  });
34050
34082
 
34051
34083
  return buf;
34052
- }
34084
+ },
34085
+ _clearToOptimizeGC: () => { portions.length = 0; }
34053
34086
  };
34054
34087
  };
34055
34088
 
@@ -34376,12 +34409,13 @@ class VBOLayer extends Layer {
34376
34409
  : (quantizePositions(buffer.positions.compileBuffer(Float64Array), modelAABB, positionsDecodeMatrix = math.mat4()))));
34377
34410
  const positionsBuf = positions && maybeCreateBuffer(positions, 3, gl.STATIC_DRAW);
34378
34411
  if (! instancing) {
34379
- portions.forEach(portion => {
34380
- if (portion.retainedGeometry) {
34412
+ for (let i = 0; i < portions.length; ++i) { // WARNING: Replacing this for-loop by forEach increases memory consumption
34413
+ const portion = portions[i]; // by not GCing `positions` arr, even if portion.retainedGeometry is false.
34414
+ if (portion.retainedGeometry) { // See the comment related to XCD-408 and XCD-424 below.
34381
34415
  const start = 3 * portion.portionBase;
34382
34416
  portion.retainedGeometry.quantizedPositions = positions.subarray(start, start + 3 * portion.portionSize);
34383
34417
  }
34384
- });
34418
+ }
34385
34419
  }
34386
34420
 
34387
34421
  const modelMatrixColBufs = instancing && buffer.modelMatrixCol.map(b => maybeCreateBuffer(b.compileBuffer(Float32Array), 4, gl.STATIC_DRAW, true));
@@ -34420,6 +34454,10 @@ class VBOLayer extends Layer {
34420
34454
  })());
34421
34455
 
34422
34456
  // Free up memory
34457
+ // Optimization to free up memory (XCD-408 and XCD-424)
34458
+ // The following line was added to assist GC in cleaning up some of the data. See also the `portions` loop above.
34459
+ // A Chrome test with Lyon[1-9].xkt models loaded simultaneously showed a decrease of 538MB to 143MB.
34460
+ Object.values(this._buffer).forEach(a => a._clearToOptimizeGC ? a._clearToOptimizeGC() : a.forEach(a => a._clearToOptimizeGC()));
34423
34461
  this._buffer = null;
34424
34462
 
34425
34463
  scratchMemory.acquire();