소스 검색

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 ) );