Forráskód Böngészése

Remove the dependency with Tools.LoadFileAsync

Popov72 5 éve
szülő
commit
4825b9b86a
1 módosított fájl, 5 hozzáadás és 2 törlés
  1. 5 2
      src/Misc/KTX2/LiteTranscoder.ts

+ 5 - 2
src/Misc/KTX2/LiteTranscoder.ts

@@ -1,5 +1,4 @@
 import { Nullable } from '../../types';
-import { Tools } from '../tools';
 import { Transcoder, sourceTextureFormat, transcodeTarget } from './transcoder';
 import { WASMMemoryManager } from './wasmMemoryManager';
 import { KTX2FileReader, IKTX2_ImageDesc } from './KTX2FileReader';
@@ -19,7 +18,11 @@ export class LiteTranscoder extends Transcoder {
         }
 
         this._modulePromise = new Promise((resolve) => {
-            Tools.LoadFileAsync(this._modulePath).then((wasmBinary: string | ArrayBuffer) => {
+            fetch(this._modulePath).
+            then((response) => {
+                return response.arrayBuffer();
+            }).
+            then((wasmBinary: string | ArrayBuffer) => {
                 WebAssembly.instantiate(wasmBinary as ArrayBuffer, { env: { memory: this._memoryManager.wasmMemory } }).then((moduleWrapper) => {
                     resolve({ module: moduleWrapper.instance.exports });
                 });