Ver Fonte

EXRLoader: handle unsupported BigInt Safari mobile (#23267)

* EXRLoader: handle unsupported BigInt Safari mobile

Signed-off-by: Guilherme Avila <[email protected]>

* Code formatting...

Signed-off-by: Guilherme Avila <[email protected]>

* Doobers styling

Signed-off-by: Guilherme Avila <[email protected]>
Guilherme Avila há 3 anos atrás
pai
commit
f274b4464e
1 ficheiros alterados com 15 adições e 6 exclusões
  1. 15 6
      examples/jsm/loaders/EXRLoader.js

+ 15 - 6
examples/jsm/loaders/EXRLoader.js

@@ -1756,9 +1756,18 @@ class EXRLoader extends DataTextureLoader {
 
 		}
 
-		function parseInt64( dataView, offset ) {
+		const parseInt64 = function( dataView, offset ) {
 
-			var int = Number( dataView.getBigInt64( offset.value, true ) );
+			let int;
+
+			if ( 'getBigInt64' in DataView.prototype ) {
+				
+				int = Number( dataView.getBigInt64( offset.value, true ) );
+
+			} else {
+
+				int = dataView.getUint32( offset.value + 4, true ) + Number( dataView.getUint32( offset.value, true ) << 32 );
+			}
 
 			offset.value += ULONG_SIZE;
 
@@ -2003,10 +2012,10 @@ class EXRLoader extends DataTextureLoader {
 			const spec = dataView.getUint8( 5, true ); // fullMask
 
 			EXRHeader.spec = {
-				singleTile: !! ( spec & 1 ),
-				longName: !! ( spec & 2 ),
-				deepFormat: !! ( spec & 4 ),
-				multiPart: !! ( spec & 8 ),
+				singleTile: !! ( spec & 2 ),
+				longName: !! ( spec & 4 ),
+				deepFormat: !! ( spec & 8 ),
+				multiPart: !! ( spec & 16 ),
 			};
 
 			// start of header