Explorar o código

Use TextDecoder when available in glTF loader

Gary Hsu %!s(int64=6) %!d(string=hai) anos
pai
achega
382ff56322
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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;