Преглед изворни кода

USDZExporter: Add support for `WebGPURenderer`. (#29507)

* USDZExporter: Add support for `WebGPURenderer`.

* Addons: Rename texture utils modules.
Michael Herzog пре 1 година
родитељ
комит
86b8447f70

+ 1 - 1
examples/jsm/Addons.js

@@ -274,7 +274,7 @@ export * as SceneUtils from './utils/SceneUtils.js';
 export * from './utils/ShadowMapViewer.js';
 export * as SkeletonUtils from './utils/SkeletonUtils.js';
 export * as SortUtils from './utils/SortUtils.js';
-export * from './utils/TextureUtils.js';
+export * from './utils/WebGLTextureUtils.js';
 export * from './utils/UVsDebug.js';
 export * from './utils/WorkerPool.js';
 

+ 1 - 1
examples/jsm/exporters/GLTFExporter.js

@@ -26,7 +26,7 @@ import {
 	Quaternion,
 	REVISION
 } from 'three';
-import { decompress } from './../utils/TextureUtils.js';
+import { decompress } from './../utils/WebGLTextureUtils.js';
 
 
 /**

+ 21 - 3
examples/jsm/exporters/USDZExporter.js

@@ -9,10 +9,20 @@ import {
 	zipSync,
 } from '../libs/fflate.module.js';
 
-import { decompress } from './../utils/TextureUtils.js';
-
 class USDZExporter {
 
+	constructor() {
+
+		this.textureUtils = null;
+
+	}
+
+	setTextureUtils( utils ) {
+
+		this.textureUtils = utils;
+
+	}
+
 	parse( scene, onDone, onError, options ) {
 
 		this.parseAsync( scene, options ).then( onDone ).catch( onError );
@@ -98,7 +108,15 @@ class USDZExporter {
 
 			if ( texture.isCompressedTexture === true ) {
 
-				texture = decompress( texture );
+				if ( this.textureUtils === null ) {
+
+					throw new Error( 'THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.' );
+
+				} else {
+
+					texture = await this.textureUtils.decompress( texture );
+
+				}
 
 			}
 

+ 0 - 0
examples/jsm/utils/TextureUtils.js → examples/jsm/utils/WebGLTextureUtils.js


+ 0 - 0
examples/jsm/utils/TextureUtilsGPU.js → examples/jsm/utils/WebGPUTextureUtils.js


粤ICP备19079148号