Преглед на файлове

Use TextDecoder when available in glTF loader

Gary Hsu преди 6 години
родител
ревизия
382ff56322
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      loaders/src/glTF/glTFFileLoader.ts

+ 4 - 0
loaders/src/glTF/glTFFileLoader.ts

@@ -796,6 +796,10 @@ export class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISc
     }
 
     private static _decodeBufferToText(buffer: Uint8Array): string {
+        if (typeof TextDecoder !== "undefined") {
+            return new TextDecoder().decode(buffer);
+        }
+
         let result = "";
         const length = buffer.byteLength;