瀏覽代碼

USDZExporter: export from compressed texture data #23321 (#27382)

* USDZExporter: export from compressed texture data #23321

* add screenshot, update files.json

* Update USDZExporter.js

Clean up.

* remove usdz compressed example

* Update USDZExporter.js

---------

Co-authored-by: Michael Herzog <[email protected]>
Jeff Beene 1 年之前
父節點
當前提交
7f29595326
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      examples/jsm/exporters/USDZExporter.js

+ 8 - 1
examples/jsm/exporters/USDZExporter.js

@@ -1,5 +1,6 @@
 import * as THREE from 'three';
 import * as fflate from '../libs/fflate.module.js';
+import { decompress } from './../utils/TextureUtils.js';
 
 class USDZExporter {
 
@@ -76,7 +77,13 @@ class USDZExporter {
 
 		for ( const id in textures ) {
 
-			const texture = textures[ id ];
+			let texture = textures[ id ];
+
+			if ( texture.isCompressedTexture === true ) {
+
+				texture = decompress( texture );
+
+			}
 
 			const canvas = imageToCanvas( texture.image, texture.flipY );
 			const blob = await new Promise( resolve => canvas.toBlob( resolve, 'image/png', 1 ) );