Browse Source

Fix problem with etc1s textures and glb files

Popov72 5 years ago
parent
commit
3ccf1a8d8a
1 changed files with 4 additions and 4 deletions
  1. 4 4
      ktx2Decoder/src/ktx2FileReader.ts

+ 4 - 4
ktx2Decoder/src/ktx2FileReader.ts

@@ -305,10 +305,10 @@ export class KTX2FileReader {
             const tablesByteOffset = selectorsByteOffset + sgd.selectorsByteLength;
             const extendedByteOffset = tablesByteOffset + sgd.tablesByteLength;
 
-            sgd.endpointsData = new Uint8Array(this._data.buffer, endpointsByteOffset, sgd.endpointsByteLength);
-            sgd.selectorsData = new Uint8Array(this._data.buffer, selectorsByteOffset, sgd.selectorsByteLength);
-            sgd.tablesData = new Uint8Array(this._data.buffer, tablesByteOffset, sgd.tablesByteLength);
-            sgd.extendedData = new Uint8Array(this._data.buffer, extendedByteOffset, sgd.extendedByteLength);
+            sgd.endpointsData = new Uint8Array(this._data.buffer, this._data.byteOffset + endpointsByteOffset, sgd.endpointsByteLength);
+            sgd.selectorsData = new Uint8Array(this._data.buffer, this._data.byteOffset + selectorsByteOffset, sgd.selectorsByteLength);
+            sgd.tablesData = new Uint8Array(this._data.buffer, this._data.byteOffset + tablesByteOffset, sgd.tablesByteLength);
+            sgd.extendedData = new Uint8Array(this._data.buffer, this._data.byteOffset + extendedByteOffset, sgd.extendedByteLength);
         }
 
     }