瀏覽代碼

USDZExporter: Resize textures to 1024 by default.

Mr.doob 4 年之前
父節點
當前提交
aa5bb104d2
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/jsm/exporters/USDZExporter.js

+ 2 - 2
examples/jsm/exporters/USDZExporter.js

@@ -57,8 +57,8 @@ async function imgToU8( image ) {
 		( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
 		( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
 
 
 		const canvas = document.createElement( 'canvas' );
 		const canvas = document.createElement( 'canvas' );
-		canvas.width = image.width;
-		canvas.height = image.height;
+		canvas.width = Math.min( 1024, image.width );
+		canvas.height = Math.min( 1024, image.height );
 
 
 		const context = canvas.getContext( '2d' );
 		const context = canvas.getContext( '2d' );
 		context.drawImage( image, 0, 0, canvas.width, canvas.height );
 		context.drawImage( image, 0, 0, canvas.width, canvas.height );