Skip to content

Commit 50ec2a0

Browse files
authored
USDZExporter: only include required modules #27382 (#27383)
1 parent bc9b22e commit 50ec2a0

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

examples/jsm/exporters/USDZExporter.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
import * as THREE from 'three';
2-
import * as fflate from '../libs/fflate.module.js';
1+
import {
2+
NoColorSpace,
3+
DoubleSide,
4+
} from 'three';
5+
6+
import {
7+
strToU8,
8+
zipSync,
9+
} from '../libs/fflate.module.js';
10+
311
import { decompress } from './../utils/TextureUtils.js';
412

513
class USDZExporter {
@@ -72,7 +80,7 @@ class USDZExporter {
7280

7381
output += buildMaterials( materials, textures, options.quickLookCompatible );
7482

75-
files[ modelFileName ] = fflate.strToU8( output );
83+
files[ modelFileName ] = strToU8( output );
7684
output = null;
7785

7886
for ( const id in textures ) {
@@ -119,7 +127,7 @@ class USDZExporter {
119127

120128
}
121129

122-
return fflate.zipSync( files, { level: 0 } );
130+
return zipSync( files, { level: 0 } );
123131

124132
}
125133

@@ -219,7 +227,7 @@ function buildUSDFileAsString( dataToInsert ) {
219227

220228
let output = buildHeader();
221229
output += dataToInsert;
222-
return fflate.strToU8( output );
230+
return strToU8( output );
223231

224232
}
225233

@@ -506,7 +514,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
506514
asset inputs:file = @textures/Texture_${ id }.png@
507515
float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
508516
${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' }
509-
token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
517+
token inputs:sourceColorSpace = "${ texture.colorSpace === NoColorSpace ? 'raw' : 'sRGB' }"
510518
token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
511519
token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
512520
float outputs:r
@@ -519,7 +527,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
519527
}
520528

521529

522-
if ( material.side === THREE.DoubleSide ) {
530+
if ( material.side === DoubleSide ) {
523531

524532
console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
525533

0 commit comments

Comments
 (0)