@roomle/web-sdk 3.4.0 → 3.5.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/{BufferGeometry-Br8QIDeK.mjs → BufferGeometry-zhwL66xZ.mjs} +170 -178
  2. package/lib/BufferGeometry-zhwL66xZ.mjs.map +1 -0
  3. package/lib/ConfiguratorKernel.wasm +0 -0
  4. package/lib/{GLTFExporter-DUjuGznV.mjs → GLTFExporter-DmFnAzRr.mjs} +24 -24
  5. package/lib/GLTFExporter-DmFnAzRr.mjs.map +1 -0
  6. package/lib/{PointLightHelper-_pWwb-rd.mjs → PointLightHelper-SLT01bR2.mjs} +19 -19
  7. package/lib/PointLightHelper-SLT01bR2.mjs.map +1 -0
  8. package/lib/RoomleCore.wasm +0 -0
  9. package/lib/RoomleToolsCore.wasm +0 -0
  10. package/lib/{SpotLightHelper-DiuKfHVi.mjs → SpotLightHelper-CC4_xqY4.mjs} +24 -24
  11. package/lib/SpotLightHelper-CC4_xqY4.mjs.map +1 -0
  12. package/lib/USDZExporter-Cpnpkq95.mjs +545 -0
  13. package/lib/USDZExporter-Cpnpkq95.mjs.map +1 -0
  14. package/lib/{banana-for-scale-Bio4mpMQ.mjs → banana-for-scale-evc4Yb9f.mjs} +2 -2
  15. package/lib/{banana-for-scale-Bio4mpMQ.mjs.map → banana-for-scale-evc4Yb9f.mjs.map} +1 -1
  16. package/lib/component-dimensioning-Dvorqw_7.mjs +229 -0
  17. package/lib/component-dimensioning-Dvorqw_7.mjs.map +1 -0
  18. package/lib/{continuous-drawing-helper-BYjzGaWD.mjs → continuous-drawing-helper-BfZl8h5N.mjs} +2 -2
  19. package/lib/{continuous-drawing-helper-BYjzGaWD.mjs.map → continuous-drawing-helper-BfZl8h5N.mjs.map} +1 -1
  20. package/lib/homag-intelligence-CJgnNjgW.mjs +547 -0
  21. package/lib/homag-intelligence-CJgnNjgW.mjs.map +1 -0
  22. package/lib/{imos-ix-poc-export-helper-Bl13RKd1.mjs → imos-ix-poc-export-helper--y8HNzbW.mjs} +2 -2
  23. package/lib/{imos-ix-poc-export-helper-Bl13RKd1.mjs.map → imos-ix-poc-export-helper--y8HNzbW.mjs.map} +1 -1
  24. package/lib/{index-DYoZpNEJ.mjs → index-E00NytVZ.mjs} +18423 -15546
  25. package/lib/index-E00NytVZ.mjs.map +1 -0
  26. package/lib/{material-viewer-DqZ9kv7j.mjs → material-viewer-DdvFNwKG.mjs} +2 -2
  27. package/lib/{material-viewer-DqZ9kv7j.mjs.map → material-viewer-DdvFNwKG.mjs.map} +1 -1
  28. package/lib/roomle-sdk.d.ts +46 -14
  29. package/lib/roomle-sdk.js +22 -22
  30. package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
  31. package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
  32. package/lib/static/roomle-core-hsc/RoomleServiceCore.wasm +0 -0
  33. package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
  34. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +8 -4
  35. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js +6 -2
  36. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js.map +1 -1
  37. package/lib/static/roomle-core-hsc/package.json +1 -1
  38. package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +8 -4
  39. package/lib/static/roomle-core-hsc/plannerCoreInterface.js +6 -2
  40. package/lib/static/roomle-core-hsc/plannerCoreInterface.js.map +1 -1
  41. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +8 -4
  42. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js +6 -2
  43. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
  44. package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  45. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  46. package/lib/static/roomle-core-hsc/wasm_modern/RoomleServiceCore.wasm +0 -0
  47. package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  48. package/lib/{stats-helper-BedaceYL.mjs → stats-helper-NaTxB7Fu.mjs} +2 -2
  49. package/lib/{stats-helper-BedaceYL.mjs.map → stats-helper-NaTxB7Fu.mjs.map} +1 -1
  50. package/lib/{three.webgpu-Bk8XgilA.mjs → three.webgpu-DN1k7B0u.mjs} +7222 -4815
  51. package/lib/three.webgpu-DN1k7B0u.mjs.map +1 -0
  52. package/lib/{tools-core-D1vOTlAR.mjs → tools-core-By95pE-u.mjs} +2 -2
  53. package/lib/{tools-core-D1vOTlAR.mjs.map → tools-core-By95pE-u.mjs.map} +1 -1
  54. package/package.json +3 -3
  55. package/lib/BufferGeometry-Br8QIDeK.mjs.map +0 -1
  56. package/lib/GLTFExporter-DUjuGznV.mjs.map +0 -1
  57. package/lib/PointLightHelper-_pWwb-rd.mjs.map +0 -1
  58. package/lib/SpotLightHelper-DiuKfHVi.mjs.map +0 -1
  59. package/lib/USDZExporter-B9ygWQMw.mjs +0 -545
  60. package/lib/USDZExporter-B9ygWQMw.mjs.map +0 -1
  61. package/lib/component-dimensioning-Bar2YYNs.mjs +0 -148
  62. package/lib/component-dimensioning-Bar2YYNs.mjs.map +0 -1
  63. package/lib/homag-intelligence-Bb8gfi80.mjs +0 -1626
  64. package/lib/homag-intelligence-Bb8gfi80.mjs.map +0 -1
  65. package/lib/index-DYoZpNEJ.mjs.map +0 -1
  66. package/lib/three.webgpu-Bk8XgilA.mjs.map +0 -1
@@ -0,0 +1,545 @@
1
+ import { fK as S, fL as A, j as O, f as C, bZ as D } from "./index-E00NytVZ.mjs";
2
+ class $ {
3
+ constructor(n, e = "", r = [], o = []) {
4
+ this.name = n, this.type = e, this.metadata = r, this.properties = o, this.children = [];
5
+ }
6
+ addMetadata(n, e) {
7
+ this.metadata.push({ key: n, value: e });
8
+ }
9
+ addProperty(n, e = []) {
10
+ this.properties.push({ property: n, metadata: e });
11
+ }
12
+ addChild(n) {
13
+ this.children.push(n);
14
+ }
15
+ toString(n = 0) {
16
+ const e = " ".repeat(n), r = this.metadata.map((c) => {
17
+ const h = c.key, p = c.value;
18
+ if (Array.isArray(p)) {
19
+ const u = [];
20
+ return u.push(`${h} = {`), p.forEach((M) => {
21
+ u.push(`${e} ${M}`);
22
+ }), u.push(`${e} }`), u.join(`
23
+ `);
24
+ } else
25
+ return `${h} = ${p}`;
26
+ }), o = r.length ? ` (
27
+ ${r.map((c) => `${e} ${c}`).join(`
28
+ `)}
29
+ ${e})` : "", s = this.properties.map((c) => {
30
+ const h = c.property, p = c.metadata.length ? ` (
31
+ ${c.metadata.map((u) => `${e} ${u}`).join(`
32
+ `)}
33
+ ${e} )` : "";
34
+ return `${e} ${h}${p}`;
35
+ }), i = this.children.map((c) => c.toString(n + 1)), d = [];
36
+ if (s.length > 0 && d.push(...s), i.length > 0) {
37
+ s.length > 0 && d.push("");
38
+ for (let c = 0; c < i.length; c++)
39
+ d.push(i[c]), c < i.length - 1 && d.push("");
40
+ }
41
+ const a = d.join(`
42
+ `), l = this.type ? this.type + " " : "";
43
+ return `${e}def ${l}"${this.name}"${o}
44
+ ${e}{
45
+ ${a}
46
+ ${e}}`;
47
+ }
48
+ }
49
+ class W {
50
+ /**
51
+ * Constructs a new USDZ exporter.
52
+ */
53
+ constructor() {
54
+ this.textureUtils = null;
55
+ }
56
+ /**
57
+ * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.
58
+ *
59
+ * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the
60
+ * corresponding texture utils {@link WebGLTextureUtils} or {@link WebGPUTextureUtils}.
61
+ *
62
+ * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils.
63
+ */
64
+ setTextureUtils(n) {
65
+ this.textureUtils = n;
66
+ }
67
+ /**
68
+ * Parse the given 3D object and generates the USDZ output.
69
+ *
70
+ * @param {Object3D} scene - The 3D object to export.
71
+ * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished.
72
+ * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens.
73
+ * @param {USDZExporter~Options} options - The export options.
74
+ */
75
+ parse(n, e, r, o) {
76
+ this.parseAsync(n, o).then(e).catch(r);
77
+ }
78
+ /**
79
+ * Async version of {@link USDZExporter#parse}.
80
+ *
81
+ * @async
82
+ * @param {Object3D} scene - The 3D object to export.
83
+ * @param {USDZExporter~Options} options - The export options.
84
+ * @return {Promise<ArrayBuffer>} A Promise that resolved with the exported USDZ data.
85
+ */
86
+ async parseAsync(n, e = {}) {
87
+ e = Object.assign(
88
+ {
89
+ ar: {
90
+ anchoring: { type: "plane" },
91
+ planeAnchoring: { alignment: "horizontal" }
92
+ },
93
+ includeAnchoringProperties: !0,
94
+ onlyVisible: !0,
95
+ quickLookCompatible: !1,
96
+ maxTextureSize: 1024
97
+ },
98
+ e
99
+ );
100
+ const r = /* @__PURE__ */ new Set(), o = {}, s = "model.usda";
101
+ o[s] = null;
102
+ const i = new $("Root", "Xform"), d = new $("Scenes", "Scope");
103
+ d.addMetadata("kind", '"sceneLibrary"'), i.addChild(d);
104
+ const a = "Scene", l = new $(a, "Xform");
105
+ l.addMetadata("customData", [
106
+ "bool preliminary_collidesWithEnvironment = 0",
107
+ `string sceneName = "${a}"`
108
+ ]), l.addMetadata("sceneName", `"${a}"`), e.includeAnchoringProperties && (l.addProperty(
109
+ `token preliminary:anchoring:type = "${e.ar.anchoring.type}"`
110
+ ), l.addProperty(
111
+ `token preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"`
112
+ )), d.addChild(l);
113
+ let c;
114
+ const h = {}, p = {};
115
+ T(n, l, h, r, o, e);
116
+ const u = G(
117
+ h,
118
+ p,
119
+ e.quickLookCompatible
120
+ );
121
+ c = E() + `
122
+ ` + i.toString() + `
123
+
124
+ ` + u.toString(), o[s] = S(c), c = null;
125
+ for (const x in p) {
126
+ let P = p[x];
127
+ if (P.isCompressedTexture === !0) {
128
+ if (this.textureUtils === null)
129
+ throw new Error(
130
+ "THREE.USDZExporter: setTextureUtils() must be called to process compressed textures."
131
+ );
132
+ P = await this.textureUtils.decompress(P);
133
+ }
134
+ const m = I(
135
+ P.image,
136
+ P.flipY,
137
+ e.maxTextureSize
138
+ ), g = await new Promise(
139
+ (f) => m.toBlob(f, "image/png", 1)
140
+ );
141
+ o[`textures/Texture_${x}.png`] = new Uint8Array(
142
+ await g.arrayBuffer()
143
+ );
144
+ }
145
+ let M = 0;
146
+ for (const x in o) {
147
+ const P = o[x], m = 34 + x.length;
148
+ M += m;
149
+ const g = M & 63;
150
+ if (g !== 4) {
151
+ const f = 64 - g, k = new Uint8Array(f);
152
+ o[x] = [P, { extra: { 12345: k } }];
153
+ }
154
+ M = P.length;
155
+ }
156
+ return A(o, { level: 0 });
157
+ }
158
+ }
159
+ function N(t, n) {
160
+ let e = t.name;
161
+ return e = e.replace(/[^A-Za-z0-9_]/g, ""), /^[0-9]/.test(e) && (e = "_" + e), e === "" && (t.isCamera ? e = "Camera" : e = "Object"), n.has(e) && (e = e + "_" + t.id), n.add(e), e;
162
+ }
163
+ function I(t, n, e) {
164
+ if (typeof HTMLImageElement < "u" && t instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && t instanceof OffscreenCanvas || typeof ImageBitmap < "u" && t instanceof ImageBitmap) {
165
+ const r = e / Math.max(t.width, t.height), o = document.createElement("canvas");
166
+ o.width = t.width * Math.min(1, r), o.height = t.height * Math.min(1, r);
167
+ const s = o.getContext("2d");
168
+ return n === !0 && (s.translate(0, o.height), s.scale(1, -1)), s.drawImage(t, 0, 0, o.width, o.height), o;
169
+ } else
170
+ throw new Error(
171
+ "THREE.USDZExporter: No valid image data found. Unable to process texture."
172
+ );
173
+ }
174
+ const y = 7;
175
+ function E() {
176
+ return `#usda 1.0
177
+ (
178
+ customLayerData = {
179
+ string creator = "Three.js USDZExporter"
180
+ }
181
+ defaultPrim = "Root"
182
+ metersPerUnit = 1
183
+ upAxis = "Y"
184
+ )
185
+ `;
186
+ }
187
+ function T(t, n, e, r, o, s) {
188
+ for (let i = 0, d = t.children.length; i < d; i++) {
189
+ const a = t.children[i];
190
+ if (a.visible === !1 && s.onlyVisible === !0) continue;
191
+ let l;
192
+ if (a.isMesh) {
193
+ const c = a.geometry, h = a.material;
194
+ if (h.isMeshStandardMaterial) {
195
+ const p = "geometries/Geometry_" + c.id + ".usda";
196
+ if (!(p in o)) {
197
+ const u = H(c);
198
+ o[p] = S(
199
+ E() + `
200
+ ` + u.toString()
201
+ );
202
+ }
203
+ h.uuid in e || (e[h.uuid] = h), l = Z(
204
+ a,
205
+ c,
206
+ e[h.uuid],
207
+ r
208
+ );
209
+ } else
210
+ console.warn(
211
+ "THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",
212
+ a
213
+ );
214
+ } else a.isCamera ? l = F(a, r) : l = R(a, r);
215
+ l && (n.addChild(l), T(a, l, e, r, o, s));
216
+ }
217
+ }
218
+ function R(t, n) {
219
+ const e = N(t, n), r = U(t.matrix);
220
+ t.matrix.determinant() < 0 && console.warn(
221
+ "THREE.USDZExporter: USDZ does not support negative scales",
222
+ t
223
+ );
224
+ const o = new $(e, "Xform");
225
+ return o.addProperty(`matrix4d xformOp:transform = ${r}`), o.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]'), o;
226
+ }
227
+ function Z(t, n, e, r) {
228
+ const o = R(t, r);
229
+ return o.addMetadata(
230
+ "prepend references",
231
+ `@./geometries/Geometry_${n.id}.usda@</Geometry>`
232
+ ), o.addMetadata("prepend apiSchemas", '["MaterialBindingAPI"]'), o.addProperty(
233
+ `rel material:binding = </Materials/Material_${e.id}>`
234
+ ), o;
235
+ }
236
+ function U(t) {
237
+ const n = t.elements;
238
+ return `( ${_(n, 0)}, ${_(
239
+ n,
240
+ 4
241
+ )}, ${_(n, 8)}, ${_(n, 12)} )`;
242
+ }
243
+ function _(t, n) {
244
+ return `(${t[n + 0]}, ${t[n + 1]}, ${t[n + 2]}, ${t[n + 3]})`;
245
+ }
246
+ function H(t) {
247
+ const n = new $("Geometry"), e = L(t);
248
+ return n.addChild(e), n;
249
+ }
250
+ function L(t) {
251
+ const n = "Geometry", e = t.attributes, r = e.position.count, o = new $(n, "Mesh");
252
+ o.addProperty(
253
+ `int[] faceVertexCounts = [${j(t)}]`
254
+ ), o.addProperty(
255
+ `int[] faceVertexIndices = [${V(t)}]`
256
+ ), o.addProperty(
257
+ `normal3f[] normals = [${b(e.normal, r)}]`,
258
+ ['interpolation = "vertex"']
259
+ ), o.addProperty(
260
+ `point3f[] points = [${b(e.position, r)}]`
261
+ );
262
+ for (let i = 0; i < 4; i++) {
263
+ const d = i > 0 ? i : "", a = e["uv" + d];
264
+ a !== void 0 && o.addProperty(
265
+ `texCoord2f[] primvars:st${d} = [${z(a)}]`,
266
+ ['interpolation = "vertex"']
267
+ );
268
+ }
269
+ const s = e.color;
270
+ return s !== void 0 && o.addProperty(
271
+ `color3f[] primvars:displayColor = [${b(
272
+ s,
273
+ r
274
+ )}]`,
275
+ ['interpolation = "vertex"']
276
+ ), o.addProperty('uniform token subdivisionScheme = "none"'), o;
277
+ }
278
+ function j(t) {
279
+ const n = t.index !== null ? t.index.count : t.attributes.position.count;
280
+ return Array(n / 3).fill(3).join(", ");
281
+ }
282
+ function V(t) {
283
+ const n = t.index, e = [];
284
+ if (n !== null)
285
+ for (let r = 0; r < n.count; r++)
286
+ e.push(n.getX(r));
287
+ else {
288
+ const r = t.attributes.position.count;
289
+ for (let o = 0; o < r; o++)
290
+ e.push(o);
291
+ }
292
+ return e.join(", ");
293
+ }
294
+ function b(t, n) {
295
+ if (t === void 0)
296
+ return console.warn("USDZExporter: Normals missing."), Array(n).fill("(0, 0, 0)").join(", ");
297
+ const e = [];
298
+ for (let r = 0; r < t.count; r++) {
299
+ const o = t.getX(r), s = t.getY(r), i = t.getZ(r);
300
+ e.push(
301
+ `(${o.toPrecision(y)}, ${s.toPrecision(
302
+ y
303
+ )}, ${i.toPrecision(y)})`
304
+ );
305
+ }
306
+ return e.join(", ");
307
+ }
308
+ function z(t) {
309
+ const n = [];
310
+ for (let e = 0; e < t.count; e++) {
311
+ const r = t.getX(e), o = t.getY(e);
312
+ n.push(
313
+ `(${r.toPrecision(y)}, ${1 - o.toPrecision(y)})`
314
+ );
315
+ }
316
+ return n.join(", ");
317
+ }
318
+ function G(t, n, e = !1) {
319
+ const r = new $("Materials");
320
+ for (const o in t) {
321
+ const s = t[o];
322
+ r.addChild(
323
+ X(s, n, e)
324
+ );
325
+ }
326
+ return r;
327
+ }
328
+ function X(t, n, e = !1) {
329
+ const r = new $(`Material_${t.id}`, "Material");
330
+ function o(i, d, a) {
331
+ const l = i.source.id + "_" + i.flipY;
332
+ n[l] = i;
333
+ const c = i.channel > 0 ? "st" + i.channel : "st", h = {
334
+ 1e3: "repeat",
335
+ // RepeatWrapping
336
+ 1001: "clamp",
337
+ // ClampToEdgeWrapping
338
+ 1002: "mirror"
339
+ // MirroredRepeatWrapping
340
+ }, p = i.repeat.clone(), u = i.offset.clone(), M = i.rotation, x = Math.sin(M), P = Math.cos(M);
341
+ u.y = 1 - u.y - p.y, e ? (u.x = u.x / p.x, u.y = u.y / p.y, u.x += x / p.x, u.y += P - 1) : (u.x += x * p.x, u.y += (1 - P) * p.y);
342
+ const m = new $(`PrimvarReader_${d}`, "Shader");
343
+ m.addProperty(
344
+ 'uniform token info:id = "UsdPrimvarReader_float2"'
345
+ ), m.addProperty("float2 inputs:fallback = (0.0, 0.0)"), m.addProperty(`string inputs:varname = "${c}"`), m.addProperty("float2 outputs:result");
346
+ const g = new $(`Transform2d_${d}`, "Shader");
347
+ g.addProperty('uniform token info:id = "UsdTransform2d"'), g.addProperty(
348
+ `float2 inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${d}.outputs:result>`
349
+ ), g.addProperty(
350
+ `float inputs:rotation = ${(M * (180 / Math.PI)).toFixed(
351
+ y
352
+ )}`
353
+ ), g.addProperty(
354
+ `float2 inputs:scale = ${w(p)}`
355
+ ), g.addProperty(
356
+ `float2 inputs:translation = ${w(u)}`
357
+ ), g.addProperty("float2 outputs:result");
358
+ const f = new $(
359
+ `Texture_${i.id}_${d}`,
360
+ "Shader"
361
+ );
362
+ return f.addProperty('uniform token info:id = "UsdUVTexture"'), f.addProperty(`asset inputs:file = @textures/Texture_${l}.png@`), f.addProperty(
363
+ `float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${d}.outputs:result>`
364
+ ), a !== void 0 && f.addProperty(`float4 inputs:scale = ${B(a)}`), d === "normal" && (f.addProperty("float4 inputs:scale = (2, 2, 2, 1)"), f.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")), f.addProperty(
365
+ `token inputs:sourceColorSpace = "${i.colorSpace === D ? "raw" : "sRGB"}"`
366
+ ), f.addProperty(
367
+ `token inputs:wrapS = "${h[i.wrapS]}"`
368
+ ), f.addProperty(
369
+ `token inputs:wrapT = "${h[i.wrapT]}"`
370
+ ), f.addProperty("float outputs:r"), f.addProperty("float outputs:g"), f.addProperty("float outputs:b"), f.addProperty("float3 outputs:rgb"), (t.transparent || t.alphaTest > 0) && f.addProperty("float outputs:a"), [m, g, f];
371
+ }
372
+ t.side === O && console.warn(
373
+ "THREE.USDZExporter: USDZ does not support double sided materials",
374
+ t
375
+ );
376
+ const s = new $("PreviewSurface", "Shader");
377
+ if (s.addProperty('uniform token info:id = "UsdPreviewSurface"'), t.map !== null ? (s.addProperty(
378
+ `color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`
379
+ ), t.transparent ? s.addProperty(
380
+ `float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`
381
+ ) : t.alphaTest > 0 && (s.addProperty(
382
+ `float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`
383
+ ), s.addProperty(
384
+ `float inputs:opacityThreshold = ${t.alphaTest}`
385
+ )), o(
386
+ t.map,
387
+ "diffuse",
388
+ t.color
389
+ ).forEach((d) => r.addChild(d))) : s.addProperty(
390
+ `color3f inputs:diffuseColor = ${v(t.color)}`
391
+ ), t.emissiveMap !== null) {
392
+ s.addProperty(
393
+ `color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`
394
+ );
395
+ const i = new C(
396
+ t.emissive.r * t.emissiveIntensity,
397
+ t.emissive.g * t.emissiveIntensity,
398
+ t.emissive.b * t.emissiveIntensity
399
+ );
400
+ o(
401
+ t.emissiveMap,
402
+ "emissive",
403
+ i
404
+ ).forEach((a) => r.addChild(a));
405
+ } else t.emissive.getHex() > 0 && s.addProperty(
406
+ `color3f inputs:emissiveColor = ${v(t.emissive)}`
407
+ );
408
+ if (t.normalMap !== null && (s.addProperty(
409
+ `normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`
410
+ ), o(t.normalMap, "normal").forEach((d) => r.addChild(d))), t.aoMap !== null) {
411
+ s.addProperty(
412
+ `float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`
413
+ );
414
+ const i = new C(
415
+ t.aoMapIntensity,
416
+ t.aoMapIntensity,
417
+ t.aoMapIntensity
418
+ );
419
+ o(
420
+ t.aoMap,
421
+ "occlusion",
422
+ i
423
+ ).forEach((a) => r.addChild(a));
424
+ }
425
+ if (t.roughnessMap !== null) {
426
+ s.addProperty(
427
+ `float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`
428
+ );
429
+ const i = new C(
430
+ t.roughness,
431
+ t.roughness,
432
+ t.roughness
433
+ );
434
+ o(
435
+ t.roughnessMap,
436
+ "roughness",
437
+ i
438
+ ).forEach((a) => r.addChild(a));
439
+ } else
440
+ s.addProperty(
441
+ `float inputs:roughness = ${t.roughness}`
442
+ );
443
+ if (t.metalnessMap !== null) {
444
+ s.addProperty(
445
+ `float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`
446
+ );
447
+ const i = new C(
448
+ t.metalness,
449
+ t.metalness,
450
+ t.metalness
451
+ );
452
+ o(
453
+ t.metalnessMap,
454
+ "metallic",
455
+ i
456
+ ).forEach((a) => r.addChild(a));
457
+ } else
458
+ s.addProperty(
459
+ `float inputs:metallic = ${t.metalness}`
460
+ );
461
+ if (t.alphaMap !== null ? (s.addProperty(
462
+ `float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.alphaMap.id}_opacity.outputs:r>`
463
+ ), s.addProperty("float inputs:opacityThreshold = 0.0001"), o(t.alphaMap, "opacity").forEach((d) => r.addChild(d))) : s.addProperty(
464
+ `float inputs:opacity = ${t.opacity}`
465
+ ), t.isMeshPhysicalMaterial) {
466
+ if (t.clearcoatMap !== null) {
467
+ s.addProperty(
468
+ `float inputs:clearcoat.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatMap.id}_clearcoat.outputs:r>`
469
+ );
470
+ const i = new C(
471
+ t.clearcoat,
472
+ t.clearcoat,
473
+ t.clearcoat
474
+ );
475
+ o(
476
+ t.clearcoatMap,
477
+ "clearcoat",
478
+ i
479
+ ).forEach((a) => r.addChild(a));
480
+ } else
481
+ s.addProperty(
482
+ `float inputs:clearcoat = ${t.clearcoat}`
483
+ );
484
+ if (t.clearcoatRoughnessMap !== null) {
485
+ s.addProperty(
486
+ `float inputs:clearcoatRoughness.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`
487
+ );
488
+ const i = new C(
489
+ t.clearcoatRoughness,
490
+ t.clearcoatRoughness,
491
+ t.clearcoatRoughness
492
+ );
493
+ o(
494
+ t.clearcoatRoughnessMap,
495
+ "clearcoatRoughness",
496
+ i
497
+ ).forEach((a) => r.addChild(a));
498
+ } else
499
+ s.addProperty(
500
+ `float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`
501
+ );
502
+ s.addProperty(`float inputs:ior = ${t.ior}`);
503
+ }
504
+ return s.addProperty("int inputs:useSpecularWorkflow = 0"), s.addProperty("token outputs:surface"), r.addChild(s), r.addProperty(
505
+ `token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>`
506
+ ), r;
507
+ }
508
+ function v(t) {
509
+ return `(${t.r}, ${t.g}, ${t.b})`;
510
+ }
511
+ function B(t) {
512
+ return `(${t.r}, ${t.g}, ${t.b}, 1.0)`;
513
+ }
514
+ function w(t) {
515
+ return `(${t.x}, ${t.y})`;
516
+ }
517
+ function F(t, n) {
518
+ const e = N(t, n), r = U(t.matrix);
519
+ t.matrix.determinant() < 0 && console.warn(
520
+ "THREE.USDZExporter: USDZ does not support negative scales",
521
+ t
522
+ );
523
+ const o = new $(e, "Camera");
524
+ o.addProperty(`matrix4d xformOp:transform = ${r}`), o.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');
525
+ const s = t.isOrthographicCamera ? "orthographic" : "perspective";
526
+ o.addProperty(`token projection = "${s}"`);
527
+ const i = `(${t.near.toPrecision(
528
+ y
529
+ )}, ${t.far.toPrecision(y)})`;
530
+ o.addProperty(`float2 clippingRange = ${i}`);
531
+ let d;
532
+ t.isOrthographicCamera ? d = ((Math.abs(t.left) + Math.abs(t.right)) * 10).toPrecision(y) : d = t.getFilmWidth().toPrecision(y), o.addProperty(`float horizontalAperture = ${d}`);
533
+ let a;
534
+ if (t.isOrthographicCamera ? a = ((Math.abs(t.top) + Math.abs(t.bottom)) * 10).toPrecision(y) : a = t.getFilmHeight().toPrecision(y), o.addProperty(`float verticalAperture = ${a}`), t.isPerspectiveCamera) {
535
+ const l = t.getFocalLength().toPrecision(y);
536
+ o.addProperty(`float focalLength = ${l}`);
537
+ const c = t.focus.toPrecision(y);
538
+ o.addProperty(`float focusDistance = ${c}`);
539
+ }
540
+ return o;
541
+ }
542
+ export {
543
+ W as USDZExporter
544
+ };
545
+ //# sourceMappingURL=USDZExporter-Cpnpkq95.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"USDZExporter-Cpnpkq95.mjs","sources":["../../../../node_modules/three/examples/jsm/exporters/USDZExporter.js"],"sourcesContent":["import {\n\tNoColorSpace,\n\tDoubleSide,\n\tColor,\n} from 'three';\n\nimport {\n\tstrToU8,\n\tzipSync,\n} from '../libs/fflate.module.js';\n\nclass USDNode {\n\n\tconstructor( name, type = '', metadata = [], properties = [] ) {\n\n\t\tthis.name = name;\n\t\tthis.type = type;\n\t\tthis.metadata = metadata;\n\t\tthis.properties = properties;\n\t\tthis.children = [];\n\n\t}\n\n\taddMetadata( key, value ) {\n\n\t\tthis.metadata.push( { key, value } );\n\n\t}\n\n\taddProperty( property, metadata = [] ) {\n\n\t\tthis.properties.push( { property, metadata } );\n\n\t}\n\n\taddChild( child ) {\n\n\t\tthis.children.push( child );\n\n\t}\n\n\ttoString( indent = 0 ) {\n\n\t\tconst pad = '\\t'.repeat( indent );\n\n\t\tconst formattedMetadata = this.metadata.map( ( item ) => {\n\n\t\t\tconst key = item.key;\n\t\t\tconst value = item.value;\n\n\t\t\tif ( Array.isArray( value ) ) {\n\n\t\t\t\tconst lines = [];\n\t\t\t\tlines.push( `${key} = {` );\n\t\t\t\tvalue.forEach( ( line ) => {\n\n\t\t\t\t\tlines.push( `${pad}\\t\\t${line}` );\n\n\t\t\t\t} );\n\t\t\t\tlines.push( `${pad}\\t}` );\n\t\t\t\treturn lines.join( '\\n' );\n\n\t\t\t} else {\n\n\t\t\t\treturn `${key} = ${value}`;\n\n\t\t\t}\n\n\t\t} );\n\n\t\tconst meta = formattedMetadata.length\n\t\t\t? ` (\\n${formattedMetadata\n\t\t\t\t.map( ( l ) => `${pad}\\t${l}` )\n\t\t\t\t.join( '\\n' )}\\n${pad})`\n\t\t\t: '';\n\n\t\tconst properties = this.properties.map( ( l ) => {\n\n\t\t\tconst property = l.property;\n\t\t\tconst metadata = l.metadata.length\n\t\t\t\t? ` (\\n${l.metadata.map( ( m ) => `${pad}\\t\\t${m}` ).join( '\\n' )}\\n${pad}\\t)`\n\t\t\t\t: '';\n\t\t\treturn `${pad}\\t${property}${metadata}`;\n\n\t\t} );\n\t\tconst children = this.children.map( ( c ) => c.toString( indent + 1 ) );\n\n\t\tconst bodyLines = [];\n\n\t\tif ( properties.length > 0 ) {\n\n\t\t\tbodyLines.push( ...properties );\n\n\t\t}\n\n\t\tif ( children.length > 0 ) {\n\n\t\t\tif ( properties.length > 0 ) {\n\n\t\t\t\tbodyLines.push( '' );\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tbodyLines.push( children[ i ] );\n\t\t\t\tif ( i < children.length - 1 ) {\n\n\t\t\t\t\tbodyLines.push( '' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bodyContent = bodyLines.join( '\\n' );\n\n\t\tconst type = this.type ? this.type + ' ' : '';\n\n\t\treturn `${pad}def ${type}\"${this.name}\"${meta}\\n${pad}{\\n${bodyContent}\\n${pad}}`;\n\n\t}\n\n}\n\n/**\n * An exporter for USDZ.\n *\n * ```js\n * const exporter = new USDZExporter();\n * const arraybuffer = await exporter.parseAsync( scene );\n * ```\n *\n * @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js';\n */\nclass USDZExporter {\n\n\t/**\n\t * Constructs a new USDZ exporter.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * A reference to a texture utils module.\n\t\t *\n\t\t * @type {?(WebGLTextureUtils|WebGPUTextureUtils)}\n\t\t * @default null\n\t\t */\n\t\tthis.textureUtils = null;\n\n\t}\n\n\t/**\n\t * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported.\n\t *\n\t * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the\n\t * corresponding texture utils {@link WebGLTextureUtils} or {@link WebGPUTextureUtils}.\n\t *\n\t * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils.\n\t */\n\tsetTextureUtils( utils ) {\n\n\t\tthis.textureUtils = utils;\n\n\t}\n\n\t/**\n\t * Parse the given 3D object and generates the USDZ output.\n\t *\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished.\n\t * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens.\n\t * @param {USDZExporter~Options} options - The export options.\n\t */\n\tparse( scene, onDone, onError, options ) {\n\n\t\tthis.parseAsync( scene, options ).then( onDone ).catch( onError );\n\n\t}\n\n\t/**\n\t * Async version of {@link USDZExporter#parse}.\n\t *\n\t * @async\n\t * @param {Object3D} scene - The 3D object to export.\n\t * @param {USDZExporter~Options} options - The export options.\n\t * @return {Promise<ArrayBuffer>} A Promise that resolved with the exported USDZ data.\n\t */\n\tasync parseAsync( scene, options = {} ) {\n\n\t\toptions = Object.assign(\n\t\t\t{\n\t\t\t\tar: {\n\t\t\t\t\tanchoring: { type: 'plane' },\n\t\t\t\t\tplaneAnchoring: { alignment: 'horizontal' },\n\t\t\t\t},\n\t\t\t\tincludeAnchoringProperties: true,\n\t\t\t\tonlyVisible: true,\n\t\t\t\tquickLookCompatible: false,\n\t\t\t\tmaxTextureSize: 1024,\n\t\t\t},\n\t\t\toptions\n\t\t);\n\n\t\tconst usedNames = new Set();\n\n\t\tconst files = {};\n\t\tconst modelFileName = 'model.usda';\n\n\t\t// model file should be first in USDZ archive so we init it here\n\t\tfiles[ modelFileName ] = null;\n\n\t\tconst root = new USDNode( 'Root', 'Xform' );\n\t\tconst scenesNode = new USDNode( 'Scenes', 'Scope' );\n\t\tscenesNode.addMetadata( 'kind', '\"sceneLibrary\"' );\n\t\troot.addChild( scenesNode );\n\n\t\tconst sceneName = 'Scene';\n\t\tconst sceneNode = new USDNode( sceneName, 'Xform' );\n\t\tsceneNode.addMetadata( 'customData', [\n\t\t\t'bool preliminary_collidesWithEnvironment = 0',\n\t\t\t`string sceneName = \"${sceneName}\"`,\n\t\t] );\n\t\tsceneNode.addMetadata( 'sceneName', `\"${sceneName}\"` );\n\t\tif ( options.includeAnchoringProperties ) {\n\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:anchoring:type = \"${options.ar.anchoring.type}\"`\n\t\t\t);\n\t\t\tsceneNode.addProperty(\n\t\t\t\t`token preliminary:planeAnchoring:alignment = \"${options.ar.planeAnchoring.alignment}\"`\n\t\t\t);\n\n\t\t}\n\n\t\tscenesNode.addChild( sceneNode );\n\n\t\tlet output;\n\n\t\tconst materials = {};\n\t\tconst textures = {};\n\n\t\tbuildHierarchy( scene, sceneNode, materials, usedNames, files, options );\n\n\t\tconst materialsNode = buildMaterials(\n\t\t\tmaterials,\n\t\t\ttextures,\n\t\t\toptions.quickLookCompatible\n\t\t);\n\n\t\toutput =\n\t\t\tbuildHeader() +\n\t\t\t'\\n' +\n\t\t\troot.toString() +\n\t\t\t'\\n\\n' +\n\t\t\tmaterialsNode.toString();\n\n\t\tfiles[ modelFileName ] = strToU8( output );\n\t\toutput = null;\n\n\t\tfor ( const id in textures ) {\n\n\t\t\tlet texture = textures[ id ];\n\n\t\t\tif ( texture.isCompressedTexture === true ) {\n\n\t\t\t\tif ( this.textureUtils === null ) {\n\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.'\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture = await this.textureUtils.decompress( texture );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst canvas = imageToCanvas(\n\t\t\t\ttexture.image,\n\t\t\t\ttexture.flipY,\n\t\t\t\toptions.maxTextureSize\n\t\t\t);\n\t\t\tconst blob = await new Promise( ( resolve ) =>\n\t\t\t\tcanvas.toBlob( resolve, 'image/png', 1 )\n\t\t\t);\n\n\t\t\tfiles[ `textures/Texture_${id}.png` ] = new Uint8Array(\n\t\t\t\tawait blob.arrayBuffer()\n\t\t\t);\n\n\t\t}\n\n\t\t// 64 byte alignment\n\t\t// https://github.com/101arrowz/fflate/issues/39#issuecomment-777263109\n\n\t\tlet offset = 0;\n\n\t\tfor ( const filename in files ) {\n\n\t\t\tconst file = files[ filename ];\n\t\t\tconst headerSize = 34 + filename.length;\n\n\t\t\toffset += headerSize;\n\n\t\t\tconst offsetMod64 = offset & 63;\n\n\t\t\tif ( offsetMod64 !== 4 ) {\n\n\t\t\t\tconst padLength = 64 - offsetMod64;\n\t\t\t\tconst padding = new Uint8Array( padLength );\n\n\t\t\t\tfiles[ filename ] = [ file, { extra: { 12345: padding } } ];\n\n\t\t\t}\n\n\t\t\toffset = file.length;\n\n\t\t}\n\n\t\treturn zipSync( files, { level: 0 } );\n\n\t}\n\n}\n\nfunction getName( object, namesSet ) {\n\n\tlet name = object.name;\n\tname = name.replace( /[^A-Za-z0-9_]/g, '' );\n\tif ( /^[0-9]/.test( name ) ) {\n\n\t\tname = '_' + name;\n\n\t}\n\n\tif ( name === '' ) {\n\n\t\tif ( object.isCamera ) {\n\n\t\t\tname = 'Camera';\n\n\t\t} else {\n\n\t\t\tname = 'Object';\n\n\t\t}\n\n\t}\n\n\tif ( namesSet.has( name ) ) {\n\n\t\tname = name + '_' + object.id;\n\n\t}\n\n\tnamesSet.add( name );\n\n\treturn name;\n\n}\n\nfunction imageToCanvas( image, flipY, maxTextureSize ) {\n\n\tif (\n\t\t( typeof HTMLImageElement !== 'undefined' &&\n\t\t\timage instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' &&\n\t\t\timage instanceof HTMLCanvasElement ) ||\n\t\t( typeof OffscreenCanvas !== 'undefined' &&\n\t\t\timage instanceof OffscreenCanvas ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap )\n\t) {\n\n\t\tconst scale = maxTextureSize / Math.max( image.width, image.height );\n\n\t\tconst canvas = document.createElement( 'canvas' );\n\t\tcanvas.width = image.width * Math.min( 1, scale );\n\t\tcanvas.height = image.height * Math.min( 1, scale );\n\n\t\tconst context = canvas.getContext( '2d' );\n\n\t\t// TODO: We should be able to do this in the UsdTransform2d?\n\n\t\tif ( flipY === true ) {\n\n\t\t\tcontext.translate( 0, canvas.height );\n\t\t\tcontext.scale( 1, - 1 );\n\n\t\t}\n\n\t\tcontext.drawImage( image, 0, 0, canvas.width, canvas.height );\n\n\t\treturn canvas;\n\n\t} else {\n\n\t\tthrow new Error(\n\t\t\t'THREE.USDZExporter: No valid image data found. Unable to process texture.'\n\t\t);\n\n\t}\n\n}\n\n//\n\nconst PRECISION = 7;\n\nfunction buildHeader() {\n\n\treturn `#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = \"Three.js USDZExporter\"\n\t}\n\tdefaultPrim = \"Root\"\n\tmetersPerUnit = 1\n\tupAxis = \"Y\"\n)\n`;\n\n}\n\n// Xform\n\nfunction buildHierarchy( object, parentNode, materials, usedNames, files, options ) {\n\n\tfor ( let i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\tconst child = object.children[ i ];\n\n\t\tif ( child.visible === false && options.onlyVisible === true ) continue;\n\n\t\tlet childNode;\n\n\t\tif ( child.isMesh ) {\n\n\t\t\tconst geometry = child.geometry;\n\t\t\tconst material = child.material;\n\n\t\t\tif ( material.isMeshStandardMaterial ) {\n\n\t\t\t\tconst geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda';\n\n\t\t\t\tif ( ! ( geometryFileName in files ) ) {\n\n\t\t\t\t\tconst meshObject = buildMeshObject( geometry );\n\t\t\t\t\tfiles[ geometryFileName ] = strToU8(\n\t\t\t\t\t\tbuildHeader() + '\\n' + meshObject.toString()\n\t\t\t\t\t);\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! ( material.uuid in materials ) ) {\n\n\t\t\t\t\tmaterials[ material.uuid ] = material;\n\n\t\t\t\t}\n\n\t\t\t\tchildNode = buildMesh(\n\t\t\t\t\tchild,\n\t\t\t\t\tgeometry,\n\t\t\t\t\tmaterials[ material.uuid ],\n\t\t\t\t\tusedNames\n\t\t\t\t);\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)',\n\t\t\t\t\tchild\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t} else if ( child.isCamera ) {\n\n\t\t\tchildNode = buildCamera( child, usedNames );\n\n\t\t} else {\n\n\t\t\tchildNode = buildXform( child, usedNames );\n\n\t\t}\n\n\t\tif ( childNode ) {\n\n\t\t\tparentNode.addChild( childNode );\n\t\t\tbuildHierarchy( child, childNode, materials, usedNames, files, options );\n\n\t\t}\n\n\t}\n\n}\n\nfunction buildXform( object, usedNames ) {\n\n\tconst name = getName( object, usedNames );\n\tconst transform = buildMatrix( object.matrix );\n\n\tif ( object.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tobject\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Xform' );\n\n\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\treturn node;\n\n}\n\nfunction buildMesh( object, geometry, material, usedNames ) {\n\n\tconst node = buildXform( object, usedNames );\n\n\tnode.addMetadata(\n\t\t'prepend references',\n\t\t`@./geometries/Geometry_${geometry.id}.usda@</Geometry>`\n\t);\n\tnode.addMetadata( 'prepend apiSchemas', '[\"MaterialBindingAPI\"]' );\n\n\tnode.addProperty(\n\t\t`rel material:binding = </Materials/Material_${material.id}>`\n\t);\n\n\treturn node;\n\n}\n\nfunction buildMatrix( matrix ) {\n\n\tconst array = matrix.elements;\n\n\treturn `( ${buildMatrixRow( array, 0 )}, ${buildMatrixRow(\n\t\tarray,\n\t\t4\n\t)}, ${buildMatrixRow( array, 8 )}, ${buildMatrixRow( array, 12 )} )`;\n\n}\n\nfunction buildMatrixRow( array, offset ) {\n\n\treturn `(${array[ offset + 0 ]}, ${array[ offset + 1 ]}, ${array[ offset + 2 ]}, ${\n\t\tarray[ offset + 3 ]\n\t})`;\n\n}\n\n// Mesh\n\nfunction buildMeshObject( geometry ) {\n\n\tconst node = new USDNode( 'Geometry' );\n\n\tconst meshNode = buildMeshNode( geometry );\n\tnode.addChild( meshNode );\n\n\treturn node;\n\n}\n\nfunction buildMeshNode( geometry ) {\n\n\tconst name = 'Geometry';\n\tconst attributes = geometry.attributes;\n\tconst count = attributes.position.count;\n\n\tconst node = new USDNode( name, 'Mesh' );\n\n\tnode.addProperty(\n\t\t`int[] faceVertexCounts = [${buildMeshVertexCount( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`int[] faceVertexIndices = [${buildMeshVertexIndices( geometry )}]`\n\t);\n\tnode.addProperty(\n\t\t`normal3f[] normals = [${buildVector3Array( attributes.normal, count )}]`,\n\t\t[ 'interpolation = \"vertex\"' ]\n\t);\n\tnode.addProperty(\n\t\t`point3f[] points = [${buildVector3Array( attributes.position, count )}]`\n\t);\n\n\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\tconst id = i > 0 ? i : '';\n\t\tconst attribute = attributes[ 'uv' + id ];\n\t\tif ( attribute !== undefined ) {\n\n\t\t\tnode.addProperty(\n\t\t\t\t`texCoord2f[] primvars:st${id} = [${buildVector2Array( attribute )}]`,\n\t\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t\t);\n\n\t\t}\n\n\t}\n\n\tconst colorAttribute = attributes.color;\n\tif ( colorAttribute !== undefined ) {\n\n\t\tnode.addProperty(\n\t\t\t`color3f[] primvars:displayColor = [${buildVector3Array(\n\t\t\t\tcolorAttribute,\n\t\t\t\tcount\n\t\t\t)}]`,\n\t\t\t[ 'interpolation = \"vertex\"' ]\n\t\t);\n\n\t}\n\n\tnode.addProperty( 'uniform token subdivisionScheme = \"none\"' );\n\n\treturn node;\n\n}\n\nfunction buildMeshVertexCount( geometry ) {\n\n\tconst count =\n\t\tgeometry.index !== null\n\t\t\t? geometry.index.count\n\t\t\t: geometry.attributes.position.count;\n\n\treturn Array( count / 3 )\n\t\t.fill( 3 )\n\t\t.join( ', ' );\n\n}\n\nfunction buildMeshVertexIndices( geometry ) {\n\n\tconst index = geometry.index;\n\tconst array = [];\n\n\tif ( index !== null ) {\n\n\t\tfor ( let i = 0; i < index.count; i ++ ) {\n\n\t\t\tarray.push( index.getX( i ) );\n\n\t\t}\n\n\t} else {\n\n\t\tconst length = geometry.attributes.position.count;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tarray.push( i );\n\n\t\t}\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector3Array( attribute, count ) {\n\n\tif ( attribute === undefined ) {\n\n\t\tconsole.warn( 'USDZExporter: Normals missing.' );\n\t\treturn Array( count ).fill( '(0, 0, 0)' ).join( ', ' );\n\n\t}\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\t\tconst z = attribute.getZ( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${y.toPrecision(\n\t\t\t\tPRECISION\n\t\t\t)}, ${z.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\nfunction buildVector2Array( attribute ) {\n\n\tconst array = [];\n\n\tfor ( let i = 0; i < attribute.count; i ++ ) {\n\n\t\tconst x = attribute.getX( i );\n\t\tconst y = attribute.getY( i );\n\n\t\tarray.push(\n\t\t\t`(${x.toPrecision( PRECISION )}, ${1 - y.toPrecision( PRECISION )})`\n\t\t);\n\n\t}\n\n\treturn array.join( ', ' );\n\n}\n\n// Materials\n\nfunction buildMaterials( materials, textures, quickLookCompatible = false ) {\n\n\tconst materialsNode = new USDNode( 'Materials' );\n\n\tfor ( const uuid in materials ) {\n\n\t\tconst material = materials[ uuid ];\n\n\t\tmaterialsNode.addChild(\n\t\t\tbuildMaterial( material, textures, quickLookCompatible )\n\t\t);\n\n\t}\n\n\treturn materialsNode;\n\n}\n\nfunction buildMaterial( material, textures, quickLookCompatible = false ) {\n\n\t// https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html\n\n\tconst materialNode = new USDNode( `Material_${material.id}`, 'Material' );\n\n\tfunction buildTextureNodes( texture, mapType, color ) {\n\n\t\tconst id = texture.source.id + '_' + texture.flipY;\n\n\t\ttextures[ id ] = texture;\n\n\t\tconst uv = texture.channel > 0 ? 'st' + texture.channel : 'st';\n\n\t\tconst WRAPPINGS = {\n\t\t\t1000: 'repeat', // RepeatWrapping\n\t\t\t1001: 'clamp', // ClampToEdgeWrapping\n\t\t\t1002: 'mirror', // MirroredRepeatWrapping\n\t\t};\n\n\t\tconst repeat = texture.repeat.clone();\n\t\tconst offset = texture.offset.clone();\n\t\tconst rotation = texture.rotation;\n\n\t\t// rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot\n\t\tconst xRotationOffset = Math.sin( rotation );\n\t\tconst yRotationOffset = Math.cos( rotation );\n\n\t\t// texture coordinates start in the opposite corner, need to correct\n\t\toffset.y = 1 - offset.y - repeat.y;\n\n\t\t// turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order.\n\t\t// Apple Feedback: \tFB10036297 and FB11442287\n\t\tif ( quickLookCompatible ) {\n\n\t\t\t// This is NOT correct yet in QuickLook, but comes close for a range of models.\n\t\t\t// It becomes more incorrect the bigger the offset is\n\n\t\t\toffset.x = offset.x / repeat.x;\n\t\t\toffset.y = offset.y / repeat.y;\n\n\t\t\toffset.x += xRotationOffset / repeat.x;\n\t\t\toffset.y += yRotationOffset - 1;\n\n\t\t} else {\n\n\t\t\t// results match glTF results exactly. verified correct in usdview.\n\t\t\toffset.x += xRotationOffset * repeat.x;\n\t\t\toffset.y += ( 1 - yRotationOffset ) * repeat.y;\n\n\t\t}\n\n\t\tconst primvarReaderNode = new USDNode( `PrimvarReader_${mapType}`, 'Shader' );\n\t\tprimvarReaderNode.addProperty(\n\t\t\t'uniform token info:id = \"UsdPrimvarReader_float2\"'\n\t\t);\n\t\tprimvarReaderNode.addProperty( 'float2 inputs:fallback = (0.0, 0.0)' );\n\t\tprimvarReaderNode.addProperty( `string inputs:varname = \"${uv}\"` );\n\t\tprimvarReaderNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst transform2dNode = new USDNode( `Transform2d_${mapType}`, 'Shader' );\n\t\ttransform2dNode.addProperty( 'uniform token info:id = \"UsdTransform2d\"' );\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:in.connect = </Materials/Material_${material.id}/PrimvarReader_${mapType}.outputs:result>`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float inputs:rotation = ${( rotation * ( 180 / Math.PI ) ).toFixed(\n\t\t\t\tPRECISION\n\t\t\t)}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:scale = ${buildVector2( repeat )}`\n\t\t);\n\t\ttransform2dNode.addProperty(\n\t\t\t`float2 inputs:translation = ${buildVector2( offset )}`\n\t\t);\n\t\ttransform2dNode.addProperty( 'float2 outputs:result' );\n\n\t\tconst textureNode = new USDNode(\n\t\t\t`Texture_${texture.id}_${mapType}`,\n\t\t\t'Shader'\n\t\t);\n\t\ttextureNode.addProperty( 'uniform token info:id = \"UsdUVTexture\"' );\n\t\ttextureNode.addProperty( `asset inputs:file = @textures/Texture_${id}.png@` );\n\t\ttextureNode.addProperty(\n\t\t\t`float2 inputs:st.connect = </Materials/Material_${material.id}/Transform2d_${mapType}.outputs:result>`\n\t\t);\n\n\t\tif ( color !== undefined ) {\n\n\t\t\ttextureNode.addProperty( `float4 inputs:scale = ${buildColor4( color )}` );\n\n\t\t}\n\n\t\tif ( mapType === 'normal' ) {\n\n\t\t\ttextureNode.addProperty( 'float4 inputs:scale = (2, 2, 2, 1)' );\n\t\t\ttextureNode.addProperty( 'float4 inputs:bias = (-1, -1, -1, 0)' );\n\n\t\t}\n\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:sourceColorSpace = \"${\n\t\t\t\ttexture.colorSpace === NoColorSpace ? 'raw' : 'sRGB'\n\t\t\t}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapS = \"${WRAPPINGS[ texture.wrapS ]}\"`\n\t\t);\n\t\ttextureNode.addProperty(\n\t\t\t`token inputs:wrapT = \"${WRAPPINGS[ texture.wrapT ]}\"`\n\t\t);\n\t\ttextureNode.addProperty( 'float outputs:r' );\n\t\ttextureNode.addProperty( 'float outputs:g' );\n\t\ttextureNode.addProperty( 'float outputs:b' );\n\t\ttextureNode.addProperty( 'float3 outputs:rgb' );\n\n\t\tif ( material.transparent || material.alphaTest > 0.0 ) {\n\n\t\t\ttextureNode.addProperty( 'float outputs:a' );\n\n\t\t}\n\n\t\treturn [ primvarReaderNode, transform2dNode, textureNode ];\n\n\t}\n\n\tif ( material.side === DoubleSide ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support double sided materials',\n\t\t\tmaterial\n\t\t);\n\n\t}\n\n\tconst previewSurfaceNode = new USDNode( 'PreviewSurface', 'Shader' );\n\tpreviewSurfaceNode.addProperty( 'uniform token info:id = \"UsdPreviewSurface\"' );\n\n\tif ( material.map !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:rgb>`\n\t\t);\n\n\t\tif ( material.transparent ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\n\t\t} else if ( material.alphaTest > 0.0 ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:a>`\n\t\t\t);\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:opacityThreshold = ${material.alphaTest}`\n\t\t\t);\n\n\t\t}\n\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.map,\n\t\t\t'diffuse',\n\t\t\tmaterial.color\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:diffuseColor = ${buildColor( material.color )}`\n\t\t);\n\n\t}\n\n\tif ( material.emissiveMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor.connect = </Materials/Material_${material.id}/Texture_${material.emissiveMap.id}_emissive.outputs:rgb>`\n\t\t);\n\n\t\tconst emissiveColor = new Color(\n\t\t\tmaterial.emissive.r * material.emissiveIntensity,\n\t\t\tmaterial.emissive.g * material.emissiveIntensity,\n\t\t\tmaterial.emissive.b * material.emissiveIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.emissiveMap,\n\t\t\t'emissive',\n\t\t\temissiveColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else if ( material.emissive.getHex() > 0 ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`color3f inputs:emissiveColor = ${buildColor( material.emissive )}`\n\t\t);\n\n\t}\n\n\tif ( material.normalMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`normal3f inputs:normal.connect = </Materials/Material_${material.id}/Texture_${material.normalMap.id}_normal.outputs:rgb>`\n\t\t);\n\n\t\tconst textureNodes = buildTextureNodes( material.normalMap, 'normal' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.aoMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:occlusion.connect = </Materials/Material_${material.id}/Texture_${material.aoMap.id}_occlusion.outputs:r>`\n\t\t);\n\n\t\tconst aoColor = new Color(\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity,\n\t\t\tmaterial.aoMapIntensity\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.aoMap,\n\t\t\t'occlusion',\n\t\t\taoColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t}\n\n\tif ( material.roughnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness.connect = </Materials/Material_${material.id}/Texture_${material.roughnessMap.id}_roughness.outputs:g>`\n\t\t);\n\n\t\tconst roughnessColor = new Color(\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness,\n\t\t\tmaterial.roughness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.roughnessMap,\n\t\t\t'roughness',\n\t\t\troughnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:roughness = ${material.roughness}`\n\t\t);\n\n\t}\n\n\tif ( material.metalnessMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic.connect = </Materials/Material_${material.id}/Texture_${material.metalnessMap.id}_metallic.outputs:b>`\n\t\t);\n\n\t\tconst metalnessColor = new Color(\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness,\n\t\t\tmaterial.metalness\n\t\t);\n\t\tconst textureNodes = buildTextureNodes(\n\t\t\tmaterial.metalnessMap,\n\t\t\t'metallic',\n\t\t\tmetalnessColor\n\t\t);\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:metallic = ${material.metalness}`\n\t\t);\n\n\t}\n\n\tif ( material.alphaMap !== null ) {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity.connect = </Materials/Material_${material.id}/Texture_${material.alphaMap.id}_opacity.outputs:r>`\n\t\t);\n\t\tpreviewSurfaceNode.addProperty( 'float inputs:opacityThreshold = 0.0001' );\n\n\t\tconst textureNodes = buildTextureNodes( material.alphaMap, 'opacity' );\n\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t} else {\n\n\t\tpreviewSurfaceNode.addProperty(\n\t\t\t`float inputs:opacity = ${material.opacity}`\n\t\t);\n\n\t}\n\n\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\tif ( material.clearcoatMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatMap.id}_clearcoat.outputs:r>`\n\t\t\t);\n\n\t\t\tconst clearcoatColor = new Color(\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat,\n\t\t\t\tmaterial.clearcoat\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatMap,\n\t\t\t\t'clearcoat',\n\t\t\t\tclearcoatColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoat = ${material.clearcoat}`\n\t\t\t);\n\n\t\t}\n\n\t\tif ( material.clearcoatRoughnessMap !== null ) {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`\n\t\t\t);\n\n\t\t\tconst clearcoatRoughnessColor = new Color(\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness,\n\t\t\t\tmaterial.clearcoatRoughness\n\t\t\t);\n\t\t\tconst textureNodes = buildTextureNodes(\n\t\t\t\tmaterial.clearcoatRoughnessMap,\n\t\t\t\t'clearcoatRoughness',\n\t\t\t\tclearcoatRoughnessColor\n\t\t\t);\n\t\t\ttextureNodes.forEach( ( node ) => materialNode.addChild( node ) );\n\n\t\t} else {\n\n\t\t\tpreviewSurfaceNode.addProperty(\n\t\t\t\t`float inputs:clearcoatRoughness = ${material.clearcoatRoughness}`\n\t\t\t);\n\n\t\t}\n\n\t\tpreviewSurfaceNode.addProperty( `float inputs:ior = ${material.ior}` );\n\n\t}\n\n\tpreviewSurfaceNode.addProperty( 'int inputs:useSpecularWorkflow = 0' );\n\tpreviewSurfaceNode.addProperty( 'token outputs:surface' );\n\n\tmaterialNode.addChild( previewSurfaceNode );\n\n\tmaterialNode.addProperty(\n\t\t`token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>`\n\t);\n\n\treturn materialNode;\n\n}\n\nfunction buildColor( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b})`;\n\n}\n\nfunction buildColor4( color ) {\n\n\treturn `(${color.r}, ${color.g}, ${color.b}, 1.0)`;\n\n}\n\nfunction buildVector2( vector ) {\n\n\treturn `(${vector.x}, ${vector.y})`;\n\n}\n\nfunction buildCamera( camera, usedNames ) {\n\n\tconst name = getName( camera, usedNames );\n\n\tconst transform = buildMatrix( camera.matrix );\n\n\tif ( camera.matrix.determinant() < 0 ) {\n\n\t\tconsole.warn(\n\t\t\t'THREE.USDZExporter: USDZ does not support negative scales',\n\t\t\tcamera\n\t\t);\n\n\t}\n\n\tconst node = new USDNode( name, 'Camera' );\n\tnode.addProperty( `matrix4d xformOp:transform = ${transform}` );\n\tnode.addProperty( 'uniform token[] xformOpOrder = [\"xformOp:transform\"]' );\n\n\tconst projection = camera.isOrthographicCamera\n\t\t? 'orthographic'\n\t\t: 'perspective';\n\tnode.addProperty( `token projection = \"${projection}\"` );\n\n\tconst clippingRange = `(${camera.near.toPrecision(\n\t\tPRECISION\n\t)}, ${camera.far.toPrecision( PRECISION )})`;\n\tnode.addProperty( `float2 clippingRange = ${clippingRange}` );\n\n\tlet horizontalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\thorizontalAperture = (\n\t\t\t( Math.abs( camera.left ) + Math.abs( camera.right ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\thorizontalAperture = camera.getFilmWidth().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float horizontalAperture = ${horizontalAperture}` );\n\n\tlet verticalAperture;\n\tif ( camera.isOrthographicCamera ) {\n\n\t\tverticalAperture = (\n\t\t\t( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) *\n\t\t\t10\n\t\t).toPrecision( PRECISION );\n\n\t} else {\n\n\t\tverticalAperture = camera.getFilmHeight().toPrecision( PRECISION );\n\n\t}\n\n\tnode.addProperty( `float verticalAperture = ${verticalAperture}` );\n\n\tif ( camera.isPerspectiveCamera ) {\n\n\t\tconst focalLength = camera.getFocalLength().toPrecision( PRECISION );\n\t\tnode.addProperty( `float focalLength = ${focalLength}` );\n\n\t\tconst focusDistance = camera.focus.toPrecision( PRECISION );\n\t\tnode.addProperty( `float focusDistance = ${focusDistance}` );\n\n\t}\n\n\treturn node;\n\n}\n\n/**\n * Export options of `USDZExporter`.\n *\n * @typedef {Object} USDZExporter~Options\n * @property {number} [maxTextureSize=1024] - The maximum texture size that is going to be exported.\n * @property {boolean} [includeAnchoringProperties=true] - Whether to include anchoring properties or not.\n * @property {boolean} [onlyVisible=true] - Export only visible 3D objects.\n * @property {Object} [ar] - If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment\n * can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`.\n * @property {boolean} [quickLookCompatible=false] - Whether to make the exported USDZ compatible to QuickLook\n * which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback).\n **/\n\n/**\n * onDone callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnDone\n * @param {ArrayBuffer} result - The generated USDZ.\n */\n\n/**\n * onError callback of `USDZExporter`.\n *\n * @callback USDZExporter~OnError\n * @param {Error} error - The error object.\n */\n\nexport { USDZExporter };\n"],"names":["USDNode","name","type","metadata","properties","key","value","property","child","indent","pad","formattedMetadata","item","lines","line","meta","l","m","children","bodyLines","i","bodyContent","USDZExporter","utils","scene","onDone","onError","options","usedNames","files","modelFileName","root","scenesNode","sceneName","sceneNode","output","materials","textures","buildHierarchy","materialsNode","buildMaterials","buildHeader","strToU8","id","texture","canvas","imageToCanvas","blob","resolve","offset","filename","file","headerSize","offsetMod64","padLength","padding","zipSync","getName","object","namesSet","image","flipY","maxTextureSize","scale","context","PRECISION","parentNode","childNode","geometry","material","geometryFileName","meshObject","buildMeshObject","buildMesh","buildCamera","buildXform","transform","buildMatrix","node","matrix","array","buildMatrixRow","meshNode","buildMeshNode","attributes","count","buildMeshVertexCount","buildMeshVertexIndices","buildVector3Array","attribute","buildVector2Array","colorAttribute","index","length","x","y","z","quickLookCompatible","uuid","buildMaterial","materialNode","buildTextureNodes","mapType","color","uv","WRAPPINGS","repeat","rotation","xRotationOffset","yRotationOffset","primvarReaderNode","transform2dNode","buildVector2","textureNode","buildColor4","NoColorSpace","DoubleSide","previewSurfaceNode","buildColor","emissiveColor","Color","aoColor","roughnessColor","metalnessColor","clearcoatColor","clearcoatRoughnessColor","vector","camera","projection","clippingRange","horizontalAperture","verticalAperture","focalLength","focusDistance"],"mappings":";AAWA,MAAMA,EAAQ;AAAA,EAEb,YAAaC,GAAMC,IAAO,IAAIC,IAAW,CAAA,GAAIC,IAAa,IAAK;AAE9D,SAAK,OAAOH,GACZ,KAAK,OAAOC,GACZ,KAAK,WAAWC,GAChB,KAAK,aAAaC,GAClB,KAAK,WAAW,CAAA;AAAA,EAEjB;AAAA,EAEA,YAAaC,GAAKC,GAAQ;AAEzB,SAAK,SAAS,KAAM,EAAE,KAAA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AAgBN,EAAO,MAAM,YAAa9D,CAAS;AACzD,IAAAa,EAAK,YAAa,yBAAyBuD,CAAa,EAAE;AAAA,EAE3D;AAEA,SAAOvD;AAER;","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- import { ar as r, as as o, r as l } from "./index-DYoZpNEJ.mjs";
1
+ import { ar as r, as as o, r as l } from "./index-E00NytVZ.mjs";
2
2
  const h = "" + new URL("banana.glb", import.meta.url).href;
3
3
  var d = Object.defineProperty, f = (s, n, a, i) => {
4
4
  for (var e = void 0, t = s.length - 1, c; t >= 0; t--)
@@ -47,4 +47,4 @@ f([
47
47
  export {
48
48
  _ as default
49
49
  };
50
- //# sourceMappingURL=banana-for-scale-Bio4mpMQ.mjs.map
50
+ //# sourceMappingURL=banana-for-scale-evc4Yb9f.mjs.map