Browse Source

FBXLoader: Remove workaround for Safari 9. (#25241)

* remove safari 9 workaround

* fix to match upstream

Co-authored-by: aardgoose <[email protected]>
aardgoose 2 years ago
parent
commit
f19f140666
1 changed files with 5 additions and 9 deletions
  1. 5 9
      examples/jsm/loaders/FBXLoader.js

+ 5 - 9
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 );
 
 	}