Skip to content

Commit

Permalink
USDZExporter: export from compressed texture data #23321 (#27382)
Browse files Browse the repository at this point in the history
* 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 <michael.herzog@human-interactive.org>
  • Loading branch information
jeffbeene and Mugen87 committed Dec 15, 2023
1 parent 3d65226 commit 7f29595
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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 ) );
Expand Down

0 comments on commit 7f29595

Please sign in to comment.