Skip to content

Commit

Permalink
USDZExporter: Add support for WebGPURenderer. (#29507)
Browse files Browse the repository at this point in the history
* USDZExporter: Add support for `WebGPURenderer`.

* Addons: Rename texture utils modules.
  • Loading branch information
Mugen87 authored Sep 27, 2024
1 parent ac963e2 commit 86b8447
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/Addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
Quaternion,
REVISION
} from 'three';
import { decompress } from './../utils/TextureUtils.js';
import { decompress } from './../utils/WebGLTextureUtils.js';


/**
Expand Down
24 changes: 21 additions & 3 deletions examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );

}

}

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 86b8447

Please sign in to comment.