@roomle/web-sdk 3.6.0-alpha.2 → 3.6.0-alpha.3

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 (115) hide show
  1. package/lib/{BufferGeometry-BZdSmtHt.mjs → BufferGeometry-C1o0MiFL.mjs} +2 -2
  2. package/lib/{BufferGeometry-BZdSmtHt.mjs.map → BufferGeometry-C1o0MiFL.mjs.map} +1 -1
  3. package/lib/ConfiguratorKernel.js +2 -2
  4. package/lib/ConfiguratorKernel.wasm +0 -0
  5. package/lib/{GLTFExporter-DiE_HuI6.mjs → GLTFExporter-CXMBueJw.mjs} +510 -473
  6. package/lib/GLTFExporter-CXMBueJw.mjs.map +1 -0
  7. package/lib/{PointLightHelper-BvRpTX7D.mjs → PointLightHelper-ICWLqwjK.mjs} +3 -3
  8. package/lib/{PointLightHelper-BvRpTX7D.mjs.map → PointLightHelper-ICWLqwjK.mjs.map} +1 -1
  9. package/lib/RoomleCore.js +4 -4
  10. package/lib/RoomleCore.wasm +0 -0
  11. package/lib/RoomleToolsCore.wasm +0 -0
  12. package/lib/{SpotLightHelper-Byg39thi.mjs → SpotLightHelper-CW5lDGFp.mjs} +3 -3
  13. package/lib/{SpotLightHelper-Byg39thi.mjs.map → SpotLightHelper-CW5lDGFp.mjs.map} +1 -1
  14. package/lib/{USDZExporter-VBx9xybH.mjs → USDZExporter-CUp3dX08.mjs} +218 -211
  15. package/lib/USDZExporter-CUp3dX08.mjs.map +1 -0
  16. package/lib/asset-loader.worker.js +1 -1
  17. package/lib/{banana-for-scale-C9_AyZkI.mjs → banana-for-scale-CfQ8dnY2.mjs} +2 -2
  18. package/lib/{banana-for-scale-C9_AyZkI.mjs.map → banana-for-scale-CfQ8dnY2.mjs.map} +1 -1
  19. package/lib/component-dimensioning-C9AWhxvj.mjs +237 -0
  20. package/lib/component-dimensioning-C9AWhxvj.mjs.map +1 -0
  21. package/lib/{continuous-drawing-helper-BNHRsd4B.mjs → continuous-drawing-helper-B5BlbPPz.mjs} +2 -2
  22. package/lib/{continuous-drawing-helper-BNHRsd4B.mjs.map → continuous-drawing-helper-B5BlbPPz.mjs.map} +1 -1
  23. package/lib/{homag-intelligence-BraN723F.mjs → homag-intelligence-UFo9Z8FS.mjs} +42 -38
  24. package/lib/homag-intelligence-UFo9Z8FS.mjs.map +1 -0
  25. package/lib/{imos-ix-poc-export-helper-D7ubISCJ.mjs → imos-ix-poc-export-helper-CGSk-8yx.mjs} +2 -2
  26. package/lib/{imos-ix-poc-export-helper-D7ubISCJ.mjs.map → imos-ix-poc-export-helper-CGSk-8yx.mjs.map} +1 -1
  27. package/lib/{index-C-Prfui2.mjs → index-DIyMlQBA.mjs} +46178 -18733
  28. package/lib/index-DIyMlQBA.mjs.map +1 -0
  29. package/lib/{material-viewer-DyVGp6Xm.mjs → material-viewer-QTlidNBs.mjs} +7 -6
  30. package/lib/material-viewer-QTlidNBs.mjs.map +1 -0
  31. package/lib/roomle-sdk.d.ts +287 -132
  32. package/lib/roomle-sdk.js +29 -29
  33. package/lib/static/asset-loader.worker.js +1 -1
  34. package/lib/static/roomle-core-hsc/ConfiguratorKernel.js +2 -2
  35. package/lib/static/roomle-core-hsc/ConfiguratorKernel.wasm +0 -0
  36. package/lib/static/roomle-core-hsc/RoomleCore.js +4 -4
  37. package/lib/static/roomle-core-hsc/RoomleCore.wasm +0 -0
  38. package/lib/static/roomle-core-hsc/RoomleToolsCore.wasm +0 -0
  39. package/lib/static/roomle-core-hsc/configurableObject.d.ts +2 -2
  40. package/lib/static/roomle-core-hsc/configurableObject.js +6 -6
  41. package/lib/static/roomle-core-hsc/configurableObject.js.map +1 -1
  42. package/lib/static/roomle-core-hsc/configurationLoader.js +1 -5
  43. package/lib/static/roomle-core-hsc/configurationLoader.js.map +1 -1
  44. package/lib/static/roomle-core-hsc/configurationManager.d.ts +1 -0
  45. package/lib/static/roomle-core-hsc/configurationManager.js +6 -0
  46. package/lib/static/roomle-core-hsc/configurationManager.js.map +1 -1
  47. package/lib/static/roomle-core-hsc/configuratorCore.d.ts +1 -2
  48. package/lib/static/roomle-core-hsc/configuratorCoreInterface.d.ts +22 -29
  49. package/lib/static/roomle-core-hsc/embind/configuratorCore.d.ts +1 -2
  50. package/lib/static/roomle-core-hsc/embind/configuratorCoreInterface.d.ts +22 -29
  51. package/lib/static/roomle-core-hsc/embind/plannerCore.d.ts +1 -2
  52. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.d.ts +1 -1
  53. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js +1 -1
  54. package/lib/static/roomle-core-hsc/embind/plannerCoreCallback.js.map +1 -1
  55. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.d.ts +74 -81
  56. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js +1 -6
  57. package/lib/static/roomle-core-hsc/embind/plannerCoreInterface.js.map +1 -1
  58. package/lib/static/roomle-core-hsc/loader/configurableObject.d.ts +2 -2
  59. package/lib/static/roomle-core-hsc/loader/configurableObject.js +6 -6
  60. package/lib/static/roomle-core-hsc/loader/configurableObject.js.map +1 -1
  61. package/lib/static/roomle-core-hsc/loader/configurationLoader.js +1 -5
  62. package/lib/static/roomle-core-hsc/loader/configurationLoader.js.map +1 -1
  63. package/lib/static/roomle-core-hsc/loader/configurationManager.d.ts +1 -0
  64. package/lib/static/roomle-core-hsc/loader/configurationManager.js +6 -0
  65. package/lib/static/roomle-core-hsc/loader/configurationManager.js.map +1 -1
  66. package/lib/static/roomle-core-hsc/loader/planElementManager.d.ts +2 -2
  67. package/lib/static/roomle-core-hsc/loader/planElementManager.js.map +1 -1
  68. package/lib/static/roomle-core-hsc/package.json +1 -1
  69. package/lib/static/roomle-core-hsc/planElementManager.d.ts +2 -2
  70. package/lib/static/roomle-core-hsc/planElementManager.js.map +1 -1
  71. package/lib/static/roomle-core-hsc/plannerCore.d.ts +1 -2
  72. package/lib/static/roomle-core-hsc/plannerCoreCallback.d.ts +1 -1
  73. package/lib/static/roomle-core-hsc/plannerCoreCallback.js +1 -1
  74. package/lib/static/roomle-core-hsc/plannerCoreCallback.js.map +1 -1
  75. package/lib/static/roomle-core-hsc/plannerCoreInterface.d.ts +74 -81
  76. package/lib/static/roomle-core-hsc/plannerCoreInterface.js +1 -6
  77. package/lib/static/roomle-core-hsc/plannerCoreInterface.js.map +1 -1
  78. package/lib/static/roomle-core-hsc/src/embind/configuratorCore.d.ts +1 -2
  79. package/lib/static/roomle-core-hsc/src/embind/configuratorCoreInterface.d.ts +22 -29
  80. package/lib/static/roomle-core-hsc/src/embind/plannerCore.d.ts +1 -2
  81. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.d.ts +1 -1
  82. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js +1 -1
  83. package/lib/static/roomle-core-hsc/src/embind/plannerCoreCallback.js.map +1 -1
  84. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.d.ts +74 -81
  85. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js +1 -6
  86. package/lib/static/roomle-core-hsc/src/embind/plannerCoreInterface.js.map +1 -1
  87. package/lib/static/roomle-core-hsc/src/loader/configurableObject.d.ts +2 -2
  88. package/lib/static/roomle-core-hsc/src/loader/configurableObject.js +6 -6
  89. package/lib/static/roomle-core-hsc/src/loader/configurableObject.js.map +1 -1
  90. package/lib/static/roomle-core-hsc/src/loader/configurationLoader.js +1 -5
  91. package/lib/static/roomle-core-hsc/src/loader/configurationLoader.js.map +1 -1
  92. package/lib/static/roomle-core-hsc/src/loader/configurationManager.d.ts +1 -0
  93. package/lib/static/roomle-core-hsc/src/loader/configurationManager.js +6 -0
  94. package/lib/static/roomle-core-hsc/src/loader/configurationManager.js.map +1 -1
  95. package/lib/static/roomle-core-hsc/src/loader/planElementManager.d.ts +2 -2
  96. package/lib/static/roomle-core-hsc/src/loader/planElementManager.js.map +1 -1
  97. package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.js +2 -2
  98. package/lib/static/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
  99. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.js +4 -4
  100. package/lib/static/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
  101. package/lib/static/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
  102. package/lib/{stats-helper-UQlUyOTj.mjs → stats-helper-cTITQsAT.mjs} +2 -2
  103. package/lib/{stats-helper-UQlUyOTj.mjs.map → stats-helper-cTITQsAT.mjs.map} +1 -1
  104. package/lib/{tools-core-wkPFRdnH.mjs → tools-core-CCWbo8fD.mjs} +2 -2
  105. package/lib/{tools-core-wkPFRdnH.mjs.map → tools-core-CCWbo8fD.mjs.map} +1 -1
  106. package/package.json +3 -3
  107. package/lib/GLTFExporter-DiE_HuI6.mjs.map +0 -1
  108. package/lib/USDZExporter-VBx9xybH.mjs.map +0 -1
  109. package/lib/component-dimensioning-DHTSa-If.mjs +0 -229
  110. package/lib/component-dimensioning-DHTSa-If.mjs.map +0 -1
  111. package/lib/homag-intelligence-BraN723F.mjs.map +0 -1
  112. package/lib/index-C-Prfui2.mjs.map +0 -1
  113. package/lib/material-viewer-DyVGp6Xm.mjs.map +0 -1
  114. package/lib/three.webgpu-sHJcp001.mjs +0 -27625
  115. package/lib/three.webgpu-sHJcp001.mjs.map +0 -1
@@ -1,52 +1,52 @@
1
- import { fK as S, fL as A, j as O, f as C, bZ as D } from "./index-C-Prfui2.mjs";
1
+ import { aH as b, aI as k, j as A, f as v, aJ as D } from "./index-DIyMlQBA.mjs";
2
2
  class $ {
3
- constructor(n, e = "", r = [], o = []) {
4
- this.name = n, this.type = e, this.metadata = r, this.properties = o, this.children = [];
3
+ constructor(r, e = "", n = [], o = []) {
4
+ this.name = r, this.type = e, this.metadata = n, this.properties = o, this.children = [];
5
5
  }
6
- addMetadata(n, e) {
7
- this.metadata.push({ key: n, value: e });
6
+ addMetadata(r, e) {
7
+ this.metadata.push({ key: r, value: e });
8
8
  }
9
- addProperty(n, e = []) {
10
- this.properties.push({ property: n, metadata: e });
9
+ addProperty(r, e = []) {
10
+ this.properties.push({ property: r, metadata: e });
11
11
  }
12
- addChild(n) {
13
- this.children.push(n);
12
+ addChild(r) {
13
+ this.children.push(r);
14
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(`
15
+ toString(r = 0) {
16
+ const e = " ".repeat(r), n = this.metadata.map((c) => {
17
+ const y = c.key, f = c.value;
18
+ if (Array.isArray(f)) {
19
+ const p = [];
20
+ return p.push(`${y} = {`), f.forEach((g) => {
21
+ p.push(`${e} ${g}`);
22
+ }), p.push(`${e} }`), p.join(`
23
23
  `);
24
24
  } else
25
- return `${h} = ${p}`;
26
- }), o = r.length ? ` (
27
- ${r.map((c) => `${e} ${c}`).join(`
25
+ return `${y} = ${f}`;
26
+ }), o = n.length ? ` (
27
+ ${n.map((c) => `${e} ${c}`).join(`
28
28
  `)}
29
29
  ${e})` : "", s = this.properties.map((c) => {
30
- const h = c.property, p = c.metadata.length ? ` (
31
- ${c.metadata.map((u) => `${e} ${u}`).join(`
30
+ const y = c.property, f = c.metadata.length ? ` (
31
+ ${c.metadata.map((p) => `${e} ${p}`).join(`
32
32
  `)}
33
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("");
34
+ return `${e} ${y}${f}`;
35
+ }), i = this.children.map((c) => c.toString(r + 1)), a = [];
36
+ if (s.length > 0 && a.push(...s), i.length > 0) {
37
+ s.length > 0 && a.push("");
38
38
  for (let c = 0; c < i.length; c++)
39
- d.push(i[c]), c < i.length - 1 && d.push("");
39
+ a.push(i[c]), c < i.length - 1 && a.push("");
40
40
  }
41
- const a = d.join(`
41
+ const d = a.join(`
42
42
  `), l = this.type ? this.type + " " : "";
43
43
  return `${e}def ${l}"${this.name}"${o}
44
44
  ${e}{
45
- ${a}
45
+ ${d}
46
46
  ${e}}`;
47
47
  }
48
48
  }
49
- class W {
49
+ class Y {
50
50
  /**
51
51
  * Constructs a new USDZ exporter.
52
52
  */
@@ -61,8 +61,8 @@ class W {
61
61
  *
62
62
  * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils.
63
63
  */
64
- setTextureUtils(n) {
65
- this.textureUtils = n;
64
+ setTextureUtils(r) {
65
+ this.textureUtils = r;
66
66
  }
67
67
  /**
68
68
  * Parse the given 3D object and generates the USDZ output.
@@ -72,8 +72,8 @@ class W {
72
72
  * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens.
73
73
  * @param {USDZExporter~Options} options - The export options.
74
74
  */
75
- parse(n, e, r, o) {
76
- this.parseAsync(n, o).then(e).catch(r);
75
+ parse(r, e, n, o) {
76
+ this.parseAsync(r, o).then(e).catch(n);
77
77
  }
78
78
  /**
79
79
  * Async version of {@link USDZExporter#parse}.
@@ -83,7 +83,7 @@ class W {
83
83
  * @param {USDZExporter~Options} options - The export options.
84
84
  * @return {Promise<ArrayBuffer>} A Promise that resolved with the exported USDZ data.
85
85
  */
86
- async parseAsync(n, e = {}) {
86
+ async parseAsync(r, e = {}) {
87
87
  e = Object.assign(
88
88
  {
89
89
  ar: {
@@ -97,81 +97,81 @@ class W {
97
97
  },
98
98
  e
99
99
  );
100
- const r = /* @__PURE__ */ new Set(), o = {}, s = "model.usda";
100
+ const n = /* @__PURE__ */ new Set(), o = {}, s = "model.usda";
101
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");
102
+ const i = new $("Root", "Xform"), a = new $("Scenes", "Scope");
103
+ a.addMetadata("kind", '"sceneLibrary"'), i.addChild(a);
104
+ const d = "Scene", l = new $(d, "Xform");
105
105
  l.addMetadata("customData", [
106
106
  "bool preliminary_collidesWithEnvironment = 0",
107
- `string sceneName = "${a}"`
108
- ]), l.addMetadata("sceneName", `"${a}"`), e.includeAnchoringProperties && (l.addProperty(
107
+ `string sceneName = "${d}"`
108
+ ]), l.addMetadata("sceneName", `"${d}"`), e.includeAnchoringProperties && (l.addProperty(
109
109
  `token preliminary:anchoring:type = "${e.ar.anchoring.type}"`
110
110
  ), l.addProperty(
111
111
  `token preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"`
112
- )), d.addChild(l);
112
+ )), a.addChild(l);
113
113
  let c;
114
- const h = {}, p = {};
115
- T(n, l, h, r, o, e);
116
- const u = G(
117
- h,
118
- p,
114
+ const y = {}, f = {};
115
+ T(r, l, y, n, o, e);
116
+ const p = X(
117
+ y,
118
+ f,
119
119
  e.quickLookCompatible
120
120
  );
121
121
  c = E() + `
122
122
  ` + i.toString() + `
123
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) {
124
+ ` + p.toString(), o[s] = b(c), c = null;
125
+ for (const M in f) {
126
+ let x = f[M];
127
+ if (x.isCompressedTexture === !0) {
128
128
  if (this.textureUtils === null)
129
129
  throw new Error(
130
130
  "THREE.USDZExporter: setTextureUtils() must be called to process compressed textures."
131
131
  );
132
- P = await this.textureUtils.decompress(P);
132
+ x = await this.textureUtils.decompress(x);
133
133
  }
134
134
  const m = I(
135
- P.image,
136
- P.flipY,
135
+ x.image,
136
+ x.flipY,
137
137
  e.maxTextureSize
138
- ), g = await new Promise(
139
- (f) => m.toBlob(f, "image/png", 1)
138
+ ), P = await new Promise(
139
+ (h) => m.toBlob(h, "image/png", 1)
140
140
  );
141
- o[`textures/Texture_${x}.png`] = new Uint8Array(
142
- await g.arrayBuffer()
141
+ o[`textures/Texture_${M}.png`] = new Uint8Array(
142
+ await P.arrayBuffer()
143
143
  );
144
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 } }];
145
+ let g = 0;
146
+ for (const M in o) {
147
+ const x = o[M], m = 34 + M.length;
148
+ g += m;
149
+ const P = g & 63;
150
+ if (P !== 4) {
151
+ const h = 64 - P, U = new Uint8Array(h);
152
+ o[M] = [x, { extra: { 12345: U } }];
153
153
  }
154
- M = P.length;
154
+ g = x.length;
155
155
  }
156
- return A(o, { level: 0 });
156
+ return k(o, { level: 0 });
157
157
  }
158
158
  }
159
- function N(t, n) {
159
+ function N(t, r) {
160
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;
161
+ return e = e.replace(/[^A-Za-z0-9_]/g, ""), /^[0-9]/.test(e) && (e = "_" + e), e === "" && (t.isCamera ? e = "Camera" : e = "Object"), r.has(e) && (e = e + "_" + t.id), r.add(e), e;
162
162
  }
163
- function I(t, n, e) {
163
+ function I(t, r, e) {
164
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);
165
+ const n = e / Math.max(t.width, t.height), o = document.createElement("canvas");
166
+ o.width = t.width * Math.min(1, n), o.height = t.height * Math.min(1, n);
167
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;
168
+ return r === !0 && (s.translate(0, o.height), s.scale(1, -1)), s.drawImage(t, 0, 0, o.width, o.height), o;
169
169
  } else
170
170
  throw new Error(
171
171
  "THREE.USDZExporter: No valid image data found. Unable to process texture."
172
172
  );
173
173
  }
174
- const y = 7;
174
+ const u = 7;
175
175
  function E() {
176
176
  return `#usda 1.0
177
177
  (
@@ -184,192 +184,199 @@ function E() {
184
184
  )
185
185
  `;
186
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;
187
+ function T(t, r, e, n, o, s) {
188
+ for (let i = 0, a = t.children.length; i < a; i++) {
189
+ const d = t.children[i];
190
+ if (d.visible === !1 && s.onlyVisible === !0) continue;
191
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(
192
+ if (d.isMesh) {
193
+ const c = d.geometry, y = d.material;
194
+ if (y.isMeshStandardMaterial) {
195
+ const f = "geometries/Geometry_" + c.id + ".usda";
196
+ if (!(f in o)) {
197
+ const p = Z(c);
198
+ o[f] = b(
199
199
  E() + `
200
- ` + u.toString()
200
+ ` + p.toString()
201
201
  );
202
202
  }
203
- h.uuid in e || (e[h.uuid] = h), l = Z(
204
- a,
203
+ y.uuid in e || (e[y.uuid] = y), l = H(
204
+ d,
205
205
  c,
206
- e[h.uuid],
207
- r
206
+ e[y.uuid],
207
+ n
208
208
  );
209
209
  } else
210
210
  console.warn(
211
211
  "THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",
212
- a
212
+ d
213
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));
214
+ } else d.isCamera ? l = F(d, n) : l = R(d, n);
215
+ l && (r.addChild(l), T(d, l, e, n, o, s));
216
216
  }
217
217
  }
218
- function R(t, n) {
219
- const e = N(t, n), r = U(t.matrix);
218
+ function R(t, r) {
219
+ const e = N(t, r);
220
220
  t.matrix.determinant() < 0 && console.warn(
221
221
  "THREE.USDZExporter: USDZ does not support negative scales",
222
222
  t
223
223
  );
224
- const o = new $(e, "Xform");
225
- return o.addProperty(`matrix4d xformOp:transform = ${r}`), o.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]'), o;
224
+ const n = new $(e, "Xform");
225
+ if (t.pivot !== null) {
226
+ const o = t.position, s = t.quaternion, i = t.scale, a = t.pivot;
227
+ n.addProperty(`float3 xformOp:translate = (${o.x.toPrecision(u)}, ${o.y.toPrecision(u)}, ${o.z.toPrecision(u)})`), n.addProperty(`float3 xformOp:translate:pivot = (${a.x.toPrecision(u)}, ${a.y.toPrecision(u)}, ${a.z.toPrecision(u)})`), n.addProperty(`quatf xformOp:orient = (${s.w.toPrecision(u)}, ${s.x.toPrecision(u)}, ${s.y.toPrecision(u)}, ${s.z.toPrecision(u)})`), n.addProperty(`float3 xformOp:scale = (${i.x.toPrecision(u)}, ${i.y.toPrecision(u)}, ${i.z.toPrecision(u)})`), n.addProperty('uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]');
228
+ } else {
229
+ const o = O(t.matrix);
230
+ n.addProperty(`matrix4d xformOp:transform = ${o}`), n.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');
231
+ }
232
+ return n;
226
233
  }
227
- function Z(t, n, e, r) {
228
- const o = R(t, r);
234
+ function H(t, r, e, n) {
235
+ const o = R(t, n);
229
236
  return o.addMetadata(
230
237
  "prepend references",
231
- `@./geometries/Geometry_${n.id}.usda@</Geometry>`
238
+ `@./geometries/Geometry_${r.id}.usda@</Geometry>`
232
239
  ), o.addMetadata("prepend apiSchemas", '["MaterialBindingAPI"]'), o.addProperty(
233
240
  `rel material:binding = </Materials/Material_${e.id}>`
234
241
  ), o;
235
242
  }
236
- function U(t) {
237
- const n = t.elements;
238
- return `( ${_(n, 0)}, ${_(
239
- n,
243
+ function O(t) {
244
+ const r = t.elements;
245
+ return `( ${C(r, 0)}, ${C(
246
+ r,
240
247
  4
241
- )}, ${_(n, 8)}, ${_(n, 12)} )`;
248
+ )}, ${C(r, 8)}, ${C(r, 12)} )`;
242
249
  }
243
- function _(t, n) {
244
- return `(${t[n + 0]}, ${t[n + 1]}, ${t[n + 2]}, ${t[n + 3]})`;
250
+ function C(t, r) {
251
+ return `(${t[r + 0]}, ${t[r + 1]}, ${t[r + 2]}, ${t[r + 3]})`;
245
252
  }
246
- function H(t) {
247
- const n = new $("Geometry"), e = L(t);
248
- return n.addChild(e), n;
253
+ function Z(t) {
254
+ const r = new $("Geometry"), e = z(t);
255
+ return r.addChild(e), r;
249
256
  }
250
- function L(t) {
251
- const n = "Geometry", e = t.attributes, r = e.position.count, o = new $(n, "Mesh");
257
+ function z(t) {
258
+ const r = "Geometry", e = t.attributes, n = e.position.count, o = new $(r, "Mesh");
252
259
  o.addProperty(
253
- `int[] faceVertexCounts = [${j(t)}]`
260
+ `int[] faceVertexCounts = [${L(t)}]`
254
261
  ), o.addProperty(
255
262
  `int[] faceVertexIndices = [${V(t)}]`
256
263
  ), o.addProperty(
257
- `normal3f[] normals = [${b(e.normal, r)}]`,
264
+ `normal3f[] normals = [${_(e.normal, n)}]`,
258
265
  ['interpolation = "vertex"']
259
266
  ), o.addProperty(
260
- `point3f[] points = [${b(e.position, r)}]`
267
+ `point3f[] points = [${_(e.position, n)}]`
261
268
  );
262
269
  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)}]`,
270
+ const a = i > 0 ? i : "", d = e["uv" + a];
271
+ d !== void 0 && o.addProperty(
272
+ `texCoord2f[] primvars:st${a} = [${G(d)}]`,
266
273
  ['interpolation = "vertex"']
267
274
  );
268
275
  }
269
276
  const s = e.color;
270
277
  return s !== void 0 && o.addProperty(
271
- `color3f[] primvars:displayColor = [${b(
278
+ `color3f[] primvars:displayColor = [${_(
272
279
  s,
273
- r
280
+ n
274
281
  )}]`,
275
282
  ['interpolation = "vertex"']
276
283
  ), o.addProperty('uniform token subdivisionScheme = "none"'), o;
277
284
  }
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(", ");
285
+ function L(t) {
286
+ const r = t.index !== null ? t.index.count : t.attributes.position.count;
287
+ return Array(r / 3).fill(3).join(", ");
281
288
  }
282
289
  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));
290
+ const r = t.index, e = [];
291
+ if (r !== null)
292
+ for (let n = 0; n < r.count; n++)
293
+ e.push(r.getX(n));
287
294
  else {
288
- const r = t.attributes.position.count;
289
- for (let o = 0; o < r; o++)
295
+ const n = t.attributes.position.count;
296
+ for (let o = 0; o < n; o++)
290
297
  e.push(o);
291
298
  }
292
299
  return e.join(", ");
293
300
  }
294
- function b(t, n) {
301
+ function _(t, r) {
295
302
  if (t === void 0)
296
- return console.warn("USDZExporter: Normals missing."), Array(n).fill("(0, 0, 0)").join(", ");
303
+ return console.warn("USDZExporter: Normals missing."), Array(r).fill("(0, 0, 0)").join(", ");
297
304
  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);
305
+ for (let n = 0; n < t.count; n++) {
306
+ const o = t.getX(n), s = t.getY(n), i = t.getZ(n);
300
307
  e.push(
301
- `(${o.toPrecision(y)}, ${s.toPrecision(
302
- y
303
- )}, ${i.toPrecision(y)})`
308
+ `(${o.toPrecision(u)}, ${s.toPrecision(
309
+ u
310
+ )}, ${i.toPrecision(u)})`
304
311
  );
305
312
  }
306
313
  return e.join(", ");
307
314
  }
308
- function z(t) {
309
- const n = [];
315
+ function G(t) {
316
+ const r = [];
310
317
  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)})`
318
+ const n = t.getX(e), o = t.getY(e);
319
+ r.push(
320
+ `(${n.toPrecision(u)}, ${1 - o.toPrecision(u)})`
314
321
  );
315
322
  }
316
- return n.join(", ");
323
+ return r.join(", ");
317
324
  }
318
- function G(t, n, e = !1) {
319
- const r = new $("Materials");
325
+ function X(t, r, e = !1) {
326
+ const n = new $("Materials");
320
327
  for (const o in t) {
321
328
  const s = t[o];
322
- r.addChild(
323
- X(s, n, e)
329
+ n.addChild(
330
+ j(s, r, e)
324
331
  );
325
332
  }
326
- return r;
333
+ return n;
327
334
  }
328
- function X(t, n, e = !1) {
329
- const r = new $(`Material_${t.id}`, "Material");
330
- function o(i, d, a) {
335
+ function j(t, r, e = !1) {
336
+ const n = new $(`Material_${t.id}`, "Material");
337
+ function o(i, a, d) {
331
338
  const l = i.source.id + "_" + i.flipY;
332
- n[l] = i;
333
- const c = i.channel > 0 ? "st" + i.channel : "st", h = {
339
+ r[l] = i;
340
+ const c = i.channel > 0 ? "st" + i.channel : "st", y = {
334
341
  1e3: "repeat",
335
342
  // RepeatWrapping
336
343
  1001: "clamp",
337
344
  // ClampToEdgeWrapping
338
345
  1002: "mirror"
339
346
  // 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");
347
+ }, f = i.repeat.clone(), p = i.offset.clone(), g = i.rotation, M = Math.sin(g), x = Math.cos(g);
348
+ p.y = 1 - p.y - f.y, e ? (p.x = p.x / f.x, p.y = p.y / f.y, p.x += M / f.x, p.y += x - 1) : (p.x += M * f.x, p.y += (1 - x) * f.y);
349
+ const m = new $(`PrimvarReader_${a}`, "Shader");
343
350
  m.addProperty(
344
351
  'uniform token info:id = "UsdPrimvarReader_float2"'
345
352
  ), 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
353
+ const P = new $(`Transform2d_${a}`, "Shader");
354
+ P.addProperty('uniform token info:id = "UsdTransform2d"'), P.addProperty(
355
+ `float2 inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${a}.outputs:result>`
356
+ ), P.addProperty(
357
+ `float inputs:rotation = ${(g * (180 / Math.PI)).toFixed(
358
+ u
352
359
  )}`
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
+ ), P.addProperty(
361
+ `float2 inputs:scale = ${S(f)}`
362
+ ), P.addProperty(
363
+ `float2 inputs:translation = ${S(p)}`
364
+ ), P.addProperty("float2 outputs:result");
365
+ const h = new $(
366
+ `Texture_${i.id}_${a}`,
360
367
  "Shader"
361
368
  );
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(
369
+ return h.addProperty('uniform token info:id = "UsdUVTexture"'), h.addProperty(`asset inputs:file = @textures/Texture_${l}.png@`), h.addProperty(
370
+ `float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${a}.outputs:result>`
371
+ ), d !== void 0 && h.addProperty(`float4 inputs:scale = ${B(d)}`), a === "normal" && (h.addProperty("float4 inputs:scale = (2, 2, 2, 1)"), h.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")), h.addProperty(
365
372
  `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];
373
+ ), h.addProperty(
374
+ `token inputs:wrapS = "${y[i.wrapS]}"`
375
+ ), h.addProperty(
376
+ `token inputs:wrapT = "${y[i.wrapT]}"`
377
+ ), h.addProperty("float outputs:r"), h.addProperty("float outputs:g"), h.addProperty("float outputs:b"), h.addProperty("float3 outputs:rgb"), (t.transparent || t.alphaTest > 0) && h.addProperty("float outputs:a"), [m, P, h];
371
378
  }
372
- t.side === O && console.warn(
379
+ t.side === A && console.warn(
373
380
  "THREE.USDZExporter: USDZ does not support double sided materials",
374
381
  t
375
382
  );
@@ -386,13 +393,13 @@ function X(t, n, e = !1) {
386
393
  t.map,
387
394
  "diffuse",
388
395
  t.color
389
- ).forEach((d) => r.addChild(d))) : s.addProperty(
390
- `color3f inputs:diffuseColor = ${v(t.color)}`
396
+ ).forEach((a) => n.addChild(a))) : s.addProperty(
397
+ `color3f inputs:diffuseColor = ${w(t.color)}`
391
398
  ), t.emissiveMap !== null) {
392
399
  s.addProperty(
393
400
  `color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`
394
401
  );
395
- const i = new C(
402
+ const i = new v(
396
403
  t.emissive.r * t.emissiveIntensity,
397
404
  t.emissive.g * t.emissiveIntensity,
398
405
  t.emissive.b * t.emissiveIntensity
@@ -401,17 +408,17 @@ function X(t, n, e = !1) {
401
408
  t.emissiveMap,
402
409
  "emissive",
403
410
  i
404
- ).forEach((a) => r.addChild(a));
411
+ ).forEach((d) => n.addChild(d));
405
412
  } else t.emissive.getHex() > 0 && s.addProperty(
406
- `color3f inputs:emissiveColor = ${v(t.emissive)}`
413
+ `color3f inputs:emissiveColor = ${w(t.emissive)}`
407
414
  );
408
415
  if (t.normalMap !== null && (s.addProperty(
409
416
  `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) {
417
+ ), o(t.normalMap, "normal").forEach((a) => n.addChild(a))), t.aoMap !== null) {
411
418
  s.addProperty(
412
419
  `float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`
413
420
  );
414
- const i = new C(
421
+ const i = new v(
415
422
  t.aoMapIntensity,
416
423
  t.aoMapIntensity,
417
424
  t.aoMapIntensity
@@ -420,13 +427,13 @@ function X(t, n, e = !1) {
420
427
  t.aoMap,
421
428
  "occlusion",
422
429
  i
423
- ).forEach((a) => r.addChild(a));
430
+ ).forEach((d) => n.addChild(d));
424
431
  }
425
432
  if (t.roughnessMap !== null) {
426
433
  s.addProperty(
427
434
  `float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`
428
435
  );
429
- const i = new C(
436
+ const i = new v(
430
437
  t.roughness,
431
438
  t.roughness,
432
439
  t.roughness
@@ -435,7 +442,7 @@ function X(t, n, e = !1) {
435
442
  t.roughnessMap,
436
443
  "roughness",
437
444
  i
438
- ).forEach((a) => r.addChild(a));
445
+ ).forEach((d) => n.addChild(d));
439
446
  } else
440
447
  s.addProperty(
441
448
  `float inputs:roughness = ${t.roughness}`
@@ -444,7 +451,7 @@ function X(t, n, e = !1) {
444
451
  s.addProperty(
445
452
  `float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`
446
453
  );
447
- const i = new C(
454
+ const i = new v(
448
455
  t.metalness,
449
456
  t.metalness,
450
457
  t.metalness
@@ -453,21 +460,21 @@ function X(t, n, e = !1) {
453
460
  t.metalnessMap,
454
461
  "metallic",
455
462
  i
456
- ).forEach((a) => r.addChild(a));
463
+ ).forEach((d) => n.addChild(d));
457
464
  } else
458
465
  s.addProperty(
459
466
  `float inputs:metallic = ${t.metalness}`
460
467
  );
461
468
  if (t.alphaMap !== null ? (s.addProperty(
462
469
  `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(
470
+ ), s.addProperty("float inputs:opacityThreshold = 0.0001"), o(t.alphaMap, "opacity").forEach((a) => n.addChild(a))) : s.addProperty(
464
471
  `float inputs:opacity = ${t.opacity}`
465
472
  ), t.isMeshPhysicalMaterial) {
466
473
  if (t.clearcoatMap !== null) {
467
474
  s.addProperty(
468
475
  `float inputs:clearcoat.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatMap.id}_clearcoat.outputs:r>`
469
476
  );
470
- const i = new C(
477
+ const i = new v(
471
478
  t.clearcoat,
472
479
  t.clearcoat,
473
480
  t.clearcoat
@@ -476,7 +483,7 @@ function X(t, n, e = !1) {
476
483
  t.clearcoatMap,
477
484
  "clearcoat",
478
485
  i
479
- ).forEach((a) => r.addChild(a));
486
+ ).forEach((d) => n.addChild(d));
480
487
  } else
481
488
  s.addProperty(
482
489
  `float inputs:clearcoat = ${t.clearcoat}`
@@ -485,7 +492,7 @@ function X(t, n, e = !1) {
485
492
  s.addProperty(
486
493
  `float inputs:clearcoatRoughness.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`
487
494
  );
488
- const i = new C(
495
+ const i = new v(
489
496
  t.clearcoatRoughness,
490
497
  t.clearcoatRoughness,
491
498
  t.clearcoatRoughness
@@ -494,52 +501,52 @@ function X(t, n, e = !1) {
494
501
  t.clearcoatRoughnessMap,
495
502
  "clearcoatRoughness",
496
503
  i
497
- ).forEach((a) => r.addChild(a));
504
+ ).forEach((d) => n.addChild(d));
498
505
  } else
499
506
  s.addProperty(
500
507
  `float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`
501
508
  );
502
509
  s.addProperty(`float inputs:ior = ${t.ior}`);
503
510
  }
504
- return s.addProperty("int inputs:useSpecularWorkflow = 0"), s.addProperty("token outputs:surface"), r.addChild(s), r.addProperty(
511
+ return s.addProperty("int inputs:useSpecularWorkflow = 0"), s.addProperty("token outputs:surface"), n.addChild(s), n.addProperty(
505
512
  `token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>`
506
- ), r;
513
+ ), n;
507
514
  }
508
- function v(t) {
515
+ function w(t) {
509
516
  return `(${t.r}, ${t.g}, ${t.b})`;
510
517
  }
511
518
  function B(t) {
512
519
  return `(${t.r}, ${t.g}, ${t.b}, 1.0)`;
513
520
  }
514
- function w(t) {
521
+ function S(t) {
515
522
  return `(${t.x}, ${t.y})`;
516
523
  }
517
- function F(t, n) {
518
- const e = N(t, n), r = U(t.matrix);
524
+ function F(t, r) {
525
+ const e = N(t, r), n = O(t.matrix);
519
526
  t.matrix.determinant() < 0 && console.warn(
520
527
  "THREE.USDZExporter: USDZ does not support negative scales",
521
528
  t
522
529
  );
523
530
  const o = new $(e, "Camera");
524
- o.addProperty(`matrix4d xformOp:transform = ${r}`), o.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');
531
+ o.addProperty(`matrix4d xformOp:transform = ${n}`), o.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');
525
532
  const s = t.isOrthographicCamera ? "orthographic" : "perspective";
526
533
  o.addProperty(`token projection = "${s}"`);
527
534
  const i = `(${t.near.toPrecision(
528
- y
529
- )}, ${t.far.toPrecision(y)})`;
535
+ u
536
+ )}, ${t.far.toPrecision(u)})`;
530
537
  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
538
  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);
539
+ t.isOrthographicCamera ? a = ((Math.abs(t.left) + Math.abs(t.right)) * 10).toPrecision(u) : a = t.getFilmWidth().toPrecision(u), o.addProperty(`float horizontalAperture = ${a}`);
540
+ let d;
541
+ if (t.isOrthographicCamera ? d = ((Math.abs(t.top) + Math.abs(t.bottom)) * 10).toPrecision(u) : d = t.getFilmHeight().toPrecision(u), o.addProperty(`float verticalAperture = ${d}`), t.isPerspectiveCamera) {
542
+ const l = t.getFocalLength().toPrecision(u);
536
543
  o.addProperty(`float focalLength = ${l}`);
537
- const c = t.focus.toPrecision(y);
544
+ const c = t.focus.toPrecision(u);
538
545
  o.addProperty(`float focusDistance = ${c}`);
539
546
  }
540
547
  return o;
541
548
  }
542
549
  export {
543
- W as USDZExporter
550
+ Y as USDZExporter
544
551
  };
545
- //# sourceMappingURL=USDZExporter-VBx9xybH.mjs.map
552
+ //# sourceMappingURL=USDZExporter-CUp3dX08.mjs.map