瀏覽代碼

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;