Преглед изворни кода

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;