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
+
3
11
import { decompress } from './../utils/TextureUtils.js' ;
4
12
5
13
class USDZExporter {
@@ -72,7 +80,7 @@ class USDZExporter {
72
80
73
81
output += buildMaterials ( materials , textures , options . quickLookCompatible ) ;
74
82
75
- files [ modelFileName ] = fflate . strToU8 ( output ) ;
83
+ files [ modelFileName ] = strToU8 ( output ) ;
76
84
output = null ;
77
85
78
86
for ( const id in textures ) {
@@ -119,7 +127,7 @@ class USDZExporter {
119
127
120
128
}
121
129
122
- return fflate . zipSync ( files , { level : 0 } ) ;
130
+ return zipSync ( files , { level : 0 } ) ;
123
131
124
132
}
125
133
@@ -219,7 +227,7 @@ function buildUSDFileAsString( dataToInsert ) {
219
227
220
228
let output = buildHeader ( ) ;
221
229
output += dataToInsert ;
222
- return fflate . strToU8 ( output ) ;
230
+ return strToU8 ( output ) ;
223
231
224
232
}
225
233
@@ -506,7 +514,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
506
514
asset inputs:file = @textures/Texture_${ id } .png@
507
515
float2 inputs:st.connect = </Materials/Material_${ material . id } /Transform2d_${ mapType } .outputs:result>
508
516
${ 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' } "
510
518
token inputs:wrapS = "${ WRAPPINGS [ texture . wrapS ] } "
511
519
token inputs:wrapT = "${ WRAPPINGS [ texture . wrapT ] } "
512
520
float outputs:r
@@ -519,7 +527,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
519
527
}
520
528
521
529
522
- if ( material . side === THREE . DoubleSide ) {
530
+ if ( material . side === DoubleSide ) {
523
531
524
532
console . warn ( 'THREE.USDZExporter: USDZ does not support double sided materials' , material ) ;
525
533
0 commit comments