From ebc8dda46b92c540d021e787af157c86ad9d6ccd Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 26 Sep 2024 12:55:18 +0200 Subject: [PATCH 1/2] USDZExporter: Add support for `WebGPURenderer`. --- examples/jsm/exporters/USDZExporter.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/examples/jsm/exporters/USDZExporter.js b/examples/jsm/exporters/USDZExporter.js index cb116c189c3919..65de4f5b82da4e 100644 --- a/examples/jsm/exporters/USDZExporter.js +++ b/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 ); + + } } From ab187909c40324522b6f7c0923a9aac06a369ea3 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Fri, 27 Sep 2024 11:54:39 +0200 Subject: [PATCH 2/2] Addons: Rename texture utils modules. --- examples/jsm/Addons.js | 2 +- examples/jsm/exporters/GLTFExporter.js | 2 +- examples/jsm/utils/{TextureUtils.js => WebGLTextureUtils.js} | 0 .../jsm/utils/{TextureUtilsGPU.js => WebGPUTextureUtils.js} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename examples/jsm/utils/{TextureUtils.js => WebGLTextureUtils.js} (100%) rename examples/jsm/utils/{TextureUtilsGPU.js => WebGPUTextureUtils.js} (100%) diff --git a/examples/jsm/Addons.js b/examples/jsm/Addons.js index 81a0a1d6a8a01a..8bbc6f1bd5a941 100644 --- a/examples/jsm/Addons.js +++ b/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'; diff --git a/examples/jsm/exporters/GLTFExporter.js b/examples/jsm/exporters/GLTFExporter.js index 52cc3c1c82ccf0..959ea61d24c105 100644 --- a/examples/jsm/exporters/GLTFExporter.js +++ b/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'; /** diff --git a/examples/jsm/utils/TextureUtils.js b/examples/jsm/utils/WebGLTextureUtils.js similarity index 100% rename from examples/jsm/utils/TextureUtils.js rename to examples/jsm/utils/WebGLTextureUtils.js diff --git a/examples/jsm/utils/TextureUtilsGPU.js b/examples/jsm/utils/WebGPUTextureUtils.js similarity index 100% rename from examples/jsm/utils/TextureUtilsGPU.js rename to examples/jsm/utils/WebGPUTextureUtils.js