From e21bd679c781b879dd643e4030d1279910f498d3 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Thu, 5 Jan 2023 11:12:22 +0000 Subject: [PATCH 1/2] remove safari 9 workaround --- examples/jsm/loaders/FBXLoader.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/jsm/loaders/FBXLoader.js b/examples/jsm/loaders/FBXLoader.js index 371ebb64f12542..24881793bdc57d 100644 --- a/examples/jsm/loaders/FBXLoader.js +++ b/examples/jsm/loaders/FBXLoader.js @@ -3811,19 +3811,15 @@ class BinaryReader { getString( size ) { - // note: safari 9 doesn't support Uint8Array.indexOf; create intermediate array instead - let a = []; + const start = this.offset; + let a = new Uint8Array( this.dv.buffer, start, size ); - for ( let i = 0; i < size; i ++ ) { - - a[ i ] = this.getUint8(); - - } + this.skip( size ); const nullByte = a.indexOf( 0 ); - if ( nullByte >= 0 ) a = a.slice( 0, nullByte ); + if ( nullByte >= 0 ) a = new Uint8Array( this.dv.buffer, start, nullByte ); - return this._textDecoder.decode( new Uint8Array( a ) ); + return this.textDecoder.decode( a ); } From 22ed56a7891d5f4c63ef98baa420ae7c3111c590 Mon Sep 17 00:00:00 2001 From: aardgoose Date: Thu, 5 Jan 2023 12:16:57 +0000 Subject: [PATCH 2/2] fix to match upstream --- examples/jsm/loaders/FBXLoader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jsm/loaders/FBXLoader.js b/examples/jsm/loaders/FBXLoader.js index 24881793bdc57d..60d8191f488bfc 100644 --- a/examples/jsm/loaders/FBXLoader.js +++ b/examples/jsm/loaders/FBXLoader.js @@ -3819,7 +3819,7 @@ class BinaryReader { const nullByte = a.indexOf( 0 ); if ( nullByte >= 0 ) a = new Uint8Array( this.dv.buffer, start, nullByte ); - return this.textDecoder.decode( a ); + return this._textDecoder.decode( a ); }