Kaynağa Gözat

Use ImageBitmapLoader in GLTFLoader for Safari >= 17, fixes texture loading in a web worker (#28560)

pmjo 1 yıl önce
ebeveyn
işleme
abbf28a79a
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      examples/jsm/loaders/GLTFLoader.js

+ 3 - 1
examples/jsm/loaders/GLTFLoader.js

@@ -2580,18 +2580,20 @@ class GLTFParser {
 		// expensive work of uploading a texture to the GPU off the main thread.
 
 		let isSafari = false;
+		let safariVersion = - 1;
 		let isFirefox = false;
 		let firefoxVersion = - 1;
 
 		if ( typeof navigator !== 'undefined' ) {
 
 			isSafari = /^((?!chrome|android).)*safari/i.test( navigator.userAgent ) === true;
+			safariVersion = isSafari ? navigator.userAgent.match( /Version\/(\d+)/ )[ 1 ] : - 1;
 			isFirefox = navigator.userAgent.indexOf( 'Firefox' ) > - 1;
 			firefoxVersion = isFirefox ? navigator.userAgent.match( /Firefox\/([0-9]+)\./ )[ 1 ] : - 1;
 
 		}
 
-		if ( typeof createImageBitmap === 'undefined' || isSafari || ( isFirefox && firefoxVersion < 98 ) ) {
+		if ( typeof createImageBitmap === 'undefined' || ( isSafari && safariVersion < 17 ) || ( isFirefox && firefoxVersion < 98 ) ) {
 
 			this.textureLoader = new TextureLoader( this.options.manager );