瀏覽代碼

Update js/loaders/GLTFLoader.js

Brandon Jones 5 年之前
父節點
當前提交
38b5e9355d
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      examples/js/loaders/GLTFLoader.js

+ 6 - 0
examples/js/loaders/GLTFLoader.js

@@ -1416,6 +1416,12 @@ THREE.GLTFLoader = ( function () {
 		this.textureLoader = new THREE.TextureLoader( this.options.manager );
 		this.textureLoader.setCrossOrigin( this.options.crossOrigin );
 
+		// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
+		// expensive work of uploading a texture to the GPU off the main thread.
+		if ( typeof createImageBitmap !== 'undefined' ) {
+			this.textureLoader.setImageLoader( new THREE.ImageBitmapLoader( this.options.manager ) );
+		}
+
 		this.fileLoader = new THREE.FileLoader( this.options.manager );
 		this.fileLoader.setResponseType( 'arraybuffer' );