babylonjs-ktx2decoder 5.45.2 → 5.47.0

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.
@@ -76,6 +76,12 @@ __webpack_require__.r(__webpack_exports__);
76
76
  * Utility class for reading from a data buffer
77
77
  */
78
78
  class DataReader {
79
+ /**
80
+ * The current byte offset from the beginning of the data buffer.
81
+ */
82
+ get byteOffset() {
83
+ return this._dataByteOffset;
84
+ }
79
85
  /**
80
86
  * Constructor
81
87
  * @param buffer The buffer to set
@@ -91,12 +97,6 @@ class DataReader {
91
97
  }
92
98
  this._dataByteOffset = 0;
93
99
  }
94
- /**
95
- * The current byte offset from the beginning of the data buffer.
96
- */
97
- get byteOffset() {
98
- return this._dataByteOffset;
99
- }
100
100
  /**
101
101
  * Read a unsigned 8-bit integer from the currently loaded data range.
102
102
  * @returns The 8-bit integer read
@@ -1113,16 +1113,16 @@ class KTX2FileReader {
1113
1113
  return Math.max(this._header.layerCount, 1) * this._header.faceCount * layerPixelDepth;
1114
1114
  }
1115
1115
  get textureFormat() {
1116
- return this._dfdBlock.colorModel === 166 /* UASTC */ ? core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.UASTC4x4 : core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.ETC1S;
1116
+ return this._dfdBlock.colorModel === 166 /* DFDModel.UASTC */ ? core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.UASTC4x4 : core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.ETC1S;
1117
1117
  }
1118
1118
  get hasAlpha() {
1119
1119
  const tformat = this.textureFormat;
1120
1120
  switch (tformat) {
1121
1121
  case core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.ETC1S:
1122
1122
  return (this._dfdBlock.numSamples === 2 &&
1123
- (this._dfdBlock.samples[0].channelType === 15 /* AAA */ || this._dfdBlock.samples[1].channelType === 15 /* AAA */));
1123
+ (this._dfdBlock.samples[0].channelType === 15 /* DFDChannel_ETC1S.AAA */ || this._dfdBlock.samples[1].channelType === 15 /* DFDChannel_ETC1S.AAA */));
1124
1124
  case core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.UASTC4x4:
1125
- return this._dfdBlock.samples[0].channelType === 3 /* RGBA */;
1125
+ return this._dfdBlock.samples[0].channelType === 3 /* DFDChannel_UASTC.RGBA */;
1126
1126
  }
1127
1127
  return false;
1128
1128
  }
@@ -1130,7 +1130,7 @@ class KTX2FileReader {
1130
1130
  return this._header.supercompressionScheme === SupercompressionScheme.ZStandard;
1131
1131
  }
1132
1132
  get isInGammaSpace() {
1133
- return this._dfdBlock.transferFunction === 2 /* sRGB */;
1133
+ return this._dfdBlock.transferFunction === 2 /* DFDTransferFunction.sRGB */;
1134
1134
  }
1135
1135
  static IsValid(data) {
1136
1136
  if (data.byteLength >= 12) {
@@ -1381,14 +1381,6 @@ const DecisionTree = {
1381
1381
  },
1382
1382
  };
1383
1383
  class TranscodeDecisionTree {
1384
- constructor(textureFormat, hasAlpha, isPowerOfTwo, caps, options) {
1385
- this._textureFormat = textureFormat;
1386
- this._hasAlpha = hasAlpha;
1387
- this._isPowerOfTwo = isPowerOfTwo;
1388
- this._caps = caps;
1389
- this._options = options ?? {};
1390
- this.parseTree(DecisionTree);
1391
- }
1392
1384
  static _IsLeafNode(node) {
1393
1385
  return node.engineFormat !== undefined;
1394
1386
  }
@@ -1401,6 +1393,14 @@ class TranscodeDecisionTree {
1401
1393
  get roundToMultiple4() {
1402
1394
  return this._roundToMultiple4;
1403
1395
  }
1396
+ constructor(textureFormat, hasAlpha, isPowerOfTwo, caps, options) {
1397
+ this._textureFormat = textureFormat;
1398
+ this._hasAlpha = hasAlpha;
1399
+ this._isPowerOfTwo = isPowerOfTwo;
1400
+ this._caps = caps;
1401
+ this._options = options ?? {};
1402
+ this.parseTree(DecisionTree);
1403
+ }
1404
1404
  parseTree(tree) {
1405
1405
  const node = this._textureFormat === core_Materials_Textures_ktx2decoderTypes__WEBPACK_IMPORTED_MODULE_0__.SourceTextureFormat.UASTC4x4 ? tree.UASTC : tree.ETC1S;
1406
1406
  if (node) {
@@ -1560,13 +1560,6 @@ __webpack_require__.r(__webpack_exports__);
1560
1560
  * @internal
1561
1561
  */
1562
1562
  class WASMMemoryManager {
1563
- constructor(initialMemoryPages = WASMMemoryManager.InitialMemoryPages) {
1564
- this._numPages = initialMemoryPages;
1565
- this._memory = new WebAssembly.Memory({ initial: this._numPages });
1566
- this._memoryViewByteLength = this._numPages << 16;
1567
- this._memoryViewOffset = 0;
1568
- this._memoryView = new Uint8Array(this._memory.buffer, this._memoryViewOffset, this._memoryViewByteLength);
1569
- }
1570
1563
  static LoadWASM(path) {
1571
1564
  if (this.LoadBinariesFromCurrentThread) {
1572
1565
  return new Promise((resolve, reject) => {
@@ -1595,6 +1588,13 @@ class WASMMemoryManager {
1595
1588
  postMessage({ action: "loadWASM", path: path, id: id });
1596
1589
  });
1597
1590
  }
1591
+ constructor(initialMemoryPages = WASMMemoryManager.InitialMemoryPages) {
1592
+ this._numPages = initialMemoryPages;
1593
+ this._memory = new WebAssembly.Memory({ initial: this._numPages });
1594
+ this._memoryViewByteLength = this._numPages << 16;
1595
+ this._memoryViewOffset = 0;
1596
+ this._memoryView = new Uint8Array(this._memory.buffer, this._memoryViewOffset, this._memoryViewByteLength);
1597
+ }
1598
1598
  get wasmMemory() {
1599
1599
  return this._memory;
1600
1600
  }