@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,5 +1,5 @@
1
- import { f as $, aV as J, as as v, bs as ee, aA as S, bD as se, et as B, fv as te, bZ as ne, dv as k, aT as ie, eR as re, j as oe, fe as z, eU as ae, aM as K, aJ as ce, bP as ue, bO as le, bN as fe, aS as he, bM as pe, bL as de, bJ as xe, bK as ye, bI as ge, eV as Te } from "./index-C-Prfui2.mjs";
2
- const Y = {
1
+ import { f as $, aK as Z, as as z, aL as ee, ay as b, aM as se, aN as B, aO as te, aJ as ne, aP as H, aQ as ie, aR as re, j as oe, aS as D, aT as ae, aU as Y, aV as ce, aW as le, aX as ue, aY as he, aZ as fe, a_ as pe, a$ as de, b0 as xe, b1 as ye, b2 as ge, b3 as Te } from "./index-DIyMlQBA.mjs";
2
+ const K = {
3
3
  POSITION: [
4
4
  "byte",
5
5
  "byte normalized",
@@ -27,35 +27,35 @@ const Y = {
27
27
  "unsigned short"
28
28
  ]
29
29
  };
30
- class H {
30
+ class O {
31
31
  /**
32
32
  * Constructs a new glTF exporter.
33
33
  */
34
34
  constructor() {
35
35
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(e) {
36
- return new Le(e);
37
- }), this.register(function(e) {
38
36
  return new _e(e);
39
37
  }), this.register(function(e) {
40
- return new Oe(e);
38
+ return new be(e);
41
39
  }), this.register(function(e) {
42
40
  return new ve(e);
41
+ }), this.register(function(e) {
42
+ return new Oe(e);
43
43
  }), this.register(function(e) {
44
44
  return new ze(e);
45
45
  }), this.register(function(e) {
46
46
  return new De(e);
47
- }), this.register(function(e) {
48
- return new Ue(e);
49
47
  }), this.register(function(e) {
50
48
  return new Ce(e);
49
+ }), this.register(function(e) {
50
+ return new Ue(e);
51
51
  }), this.register(function(e) {
52
52
  return new Fe(e);
53
+ }), this.register(function(e) {
54
+ return new Pe(e);
53
55
  }), this.register(function(e) {
54
56
  return new Be(e);
55
57
  }), this.register(function(e) {
56
58
  return new Ge(e);
57
- }), this.register(function(e) {
58
- return new Pe(e);
59
59
  }), this.register(function(e) {
60
60
  return new ke(e);
61
61
  }), this.register(function(e) {
@@ -102,11 +102,11 @@ class H {
102
102
  * @param {GLTFExporter~OnError} onError - A callback function that is executed when an error happens.
103
103
  * @param {GLTFExporter~Options} options - options
104
104
  */
105
- parse(e, s, n, t) {
106
- const i = new Se(), r = [];
105
+ parse(e, s, r, t) {
106
+ const n = new Le(), i = [];
107
107
  for (let o = 0, c = this.pluginCallbacks.length; o < c; o++)
108
- r.push(this.pluginCallbacks[o](i));
109
- i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(e, s, t).catch(n);
108
+ i.push(this.pluginCallbacks[o](n));
109
+ n.setPlugins(i), n.setTextureUtils(this.textureUtils), n.writeAsync(e, s, t).catch(r);
110
110
  }
111
111
  /**
112
112
  * Async version of {@link GLTFExporter#parse}.
@@ -116,13 +116,13 @@ class H {
116
116
  * @return {Promise<ArrayBuffer|string>} A Promise that resolved with the exported glTF data.
117
117
  */
118
118
  parseAsync(e, s) {
119
- const n = this;
120
- return new Promise(function(t, i) {
121
- n.parse(e, t, i, s);
119
+ const r = this;
120
+ return new Promise(function(t, n) {
121
+ r.parse(e, t, n, s);
122
122
  });
123
123
  }
124
124
  }
125
- const g = {
125
+ const T = {
126
126
  POINTS: 0,
127
127
  LINES: 1,
128
128
  LINE_LOOP: 2,
@@ -146,63 +146,63 @@ const g = {
146
146
  CLAMP_TO_EDGE: 33071,
147
147
  MIRRORED_REPEAT: 33648,
148
148
  REPEAT: 10497
149
- }, G = "KHR_mesh_quantization", R = {};
150
- R[ue] = g.NEAREST;
151
- R[le] = g.NEAREST_MIPMAP_NEAREST;
152
- R[fe] = g.NEAREST_MIPMAP_LINEAR;
153
- R[he] = g.LINEAR;
154
- R[pe] = g.LINEAR_MIPMAP_NEAREST;
155
- R[de] = g.LINEAR_MIPMAP_LINEAR;
156
- R[xe] = g.CLAMP_TO_EDGE;
157
- R[ye] = g.REPEAT;
158
- R[ge] = g.MIRRORED_REPEAT;
159
- const j = {
149
+ }, G = "KHR_mesh_quantization", N = {};
150
+ N[le] = T.NEAREST;
151
+ N[ue] = T.NEAREST_MIPMAP_NEAREST;
152
+ N[he] = T.NEAREST_MIPMAP_LINEAR;
153
+ N[fe] = T.LINEAR;
154
+ N[pe] = T.LINEAR_MIPMAP_NEAREST;
155
+ N[de] = T.LINEAR_MIPMAP_LINEAR;
156
+ N[xe] = T.CLAMP_TO_EDGE;
157
+ N[ye] = T.REPEAT;
158
+ N[ge] = T.MIRRORED_REPEAT;
159
+ const W = {
160
160
  scale: "scale",
161
161
  position: "translation",
162
162
  quaternion: "rotation",
163
163
  morphTargetInfluences: "weights"
164
- }, we = new $(), q = 12, me = 1179937895, Me = 2, W = 8, Ae = 1313821514, Ee = 5130562;
165
- function F(a, e) {
166
- return a.length === e.length && a.every(function(s, n) {
167
- return s === e[n];
164
+ }, we = new $(), q = 12, me = 1179937895, Me = 2, X = 8, Ae = 1313821514, Ee = 5130562;
165
+ function L(a, e) {
166
+ return a.length === e.length && a.every(function(s, r) {
167
+ return s === e[r];
168
168
  });
169
169
  }
170
170
  function Ie(a) {
171
171
  return new TextEncoder().encode(a).buffer;
172
172
  }
173
173
  function Re(a) {
174
- return F(a.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
174
+ return L(a.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
175
175
  }
176
- function be(a, e, s) {
177
- const n = {
176
+ function Ne(a, e, s) {
177
+ const r = {
178
178
  min: new Array(a.itemSize).fill(Number.POSITIVE_INFINITY),
179
179
  max: new Array(a.itemSize).fill(Number.NEGATIVE_INFINITY)
180
180
  };
181
181
  for (let t = e; t < e + s; t++)
182
- for (let i = 0; i < a.itemSize; i++) {
183
- let r;
184
- a.itemSize > 4 ? r = a.array[t * a.itemSize + i] : (i === 0 ? r = a.getX(t) : i === 1 ? r = a.getY(t) : i === 2 ? r = a.getZ(t) : i === 3 && (r = a.getW(t)), a.normalized === !0 && (r = k.normalize(r, a.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
182
+ for (let n = 0; n < a.itemSize; n++) {
183
+ let i;
184
+ a.itemSize > 4 ? i = a.array[t * a.itemSize + n] : (n === 0 ? i = a.getX(t) : n === 1 ? i = a.getY(t) : n === 2 ? i = a.getZ(t) : n === 3 && (i = a.getW(t)), a.normalized === !0 && (i = H.normalize(i, a.array))), r.min[n] = Math.min(r.min[n], i), r.max[n] = Math.max(r.max[n], i);
185
185
  }
186
- return n;
186
+ return r;
187
187
  }
188
- function Z(a) {
188
+ function j(a) {
189
189
  return Math.ceil(a / 4) * 4;
190
190
  }
191
- function P(a, e = 0) {
192
- const s = Z(a.byteLength);
191
+ function k(a, e = 0) {
192
+ const s = j(a.byteLength);
193
193
  if (s !== a.byteLength) {
194
- const n = new Uint8Array(s);
195
- if (n.set(new Uint8Array(a)), e !== 0)
194
+ const r = new Uint8Array(s);
195
+ if (r.set(new Uint8Array(a)), e !== 0)
196
196
  for (let t = a.byteLength; t < s; t++)
197
- n[t] = e;
198
- return n.buffer;
197
+ r[t] = e;
198
+ return r.buffer;
199
199
  }
200
200
  return a;
201
201
  }
202
- function X() {
202
+ function J() {
203
203
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
204
204
  }
205
- function Ne(a, e) {
205
+ function Se(a, e) {
206
206
  if (typeof OffscreenCanvas < "u" && a instanceof OffscreenCanvas) {
207
207
  let s;
208
208
  return e === "image/jpeg" ? s = 0.92 : e === "image/webp" && (s = 0.8), a.convertToBlob({
@@ -212,7 +212,7 @@ function Ne(a, e) {
212
212
  } else
213
213
  return new Promise((s) => a.toBlob(s, e));
214
214
  }
215
- class Se {
215
+ class Le {
216
216
  constructor() {
217
217
  this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
218
218
  asset: {
@@ -241,7 +241,7 @@ class Se {
241
241
  * @param {Function} onDone Callback on completed
242
242
  * @param {Object} options options
243
243
  */
244
- async writeAsync(e, s, n = {}) {
244
+ async writeAsync(e, s, r = {}) {
245
245
  this.options = Object.assign({
246
246
  // default options
247
247
  binary: !1,
@@ -250,40 +250,40 @@ class Se {
250
250
  maxTextureSize: 1 / 0,
251
251
  animations: [],
252
252
  includeCustomExtensions: !1
253
- }, n), this.options.animations.length > 0 && (this.options.trs = !0), await this.processInputAsync(e), await Promise.all(this.pending);
254
- const t = this, i = t.buffers, r = t.json;
255
- n = t.options;
256
- const o = t.extensionsUsed, c = t.extensionsRequired, l = new Blob(i, { type: "application/octet-stream" }), h = Object.keys(o), u = Object.keys(c);
257
- if (h.length > 0 && (r.extensionsUsed = h), u.length > 0 && (r.extensionsRequired = u), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = l.size), n.binary === !0) {
258
- const T = new FileReader();
259
- T.readAsArrayBuffer(l), T.onloadend = function() {
260
- const f = P(T.result), d = new DataView(new ArrayBuffer(W));
261
- d.setUint32(0, f.byteLength, !0), d.setUint32(4, Ee, !0);
262
- const x = P(Ie(JSON.stringify(r)), 32), y = new DataView(new ArrayBuffer(W));
263
- y.setUint32(0, x.byteLength, !0), y.setUint32(4, Ae, !0);
264
- const M = new ArrayBuffer(q), b = new DataView(M);
265
- b.setUint32(0, me, !0), b.setUint32(4, Me, !0);
266
- const O = q + y.byteLength + x.byteLength + d.byteLength + f.byteLength;
267
- b.setUint32(8, O, !0);
268
- const p = new Blob([
269
- M,
270
- y,
271
- x,
253
+ }, r), this.options.animations.length > 0 && (this.options.trs = !0), await this.processInputAsync(e), await Promise.all(this.pending);
254
+ const t = this, n = t.buffers, i = t.json;
255
+ r = t.options;
256
+ const o = t.extensionsUsed, c = t.extensionsRequired, u = new Blob(n, { type: "application/octet-stream" }), f = Object.keys(o), l = Object.keys(c);
257
+ if (f.length > 0 && (i.extensionsUsed = f), l.length > 0 && (i.extensionsRequired = l), i.buffers && i.buffers.length > 0 && (i.buffers[0].byteLength = u.size), r.binary === !0) {
258
+ const g = new FileReader();
259
+ g.readAsArrayBuffer(u), g.onloadend = function() {
260
+ const h = k(g.result), x = new DataView(new ArrayBuffer(X));
261
+ x.setUint32(0, h.byteLength, !0), x.setUint32(4, Ee, !0);
262
+ const p = k(Ie(JSON.stringify(i)), 32), d = new DataView(new ArrayBuffer(X));
263
+ d.setUint32(0, p.byteLength, !0), d.setUint32(4, Ae, !0);
264
+ const m = new ArrayBuffer(q), A = new DataView(m);
265
+ A.setUint32(0, me, !0), A.setUint32(4, Me, !0);
266
+ const _ = q + d.byteLength + p.byteLength + x.byteLength + h.byteLength;
267
+ A.setUint32(8, _, !0);
268
+ const y = new Blob([
269
+ m,
272
270
  d,
273
- f
271
+ p,
272
+ x,
273
+ h
274
274
  ], { type: "application/octet-stream" }), w = new FileReader();
275
- w.readAsArrayBuffer(p), w.onloadend = function() {
275
+ w.readAsArrayBuffer(y), w.onloadend = function() {
276
276
  s(w.result);
277
277
  };
278
278
  };
279
- } else if (r.buffers && r.buffers.length > 0) {
280
- const T = new FileReader();
281
- T.readAsDataURL(l), T.onloadend = function() {
282
- const f = T.result;
283
- r.buffers[0].uri = f, s(r);
279
+ } else if (i.buffers && i.buffers.length > 0) {
280
+ const g = new FileReader();
281
+ g.readAsDataURL(u), g.onloadend = function() {
282
+ const h = g.result;
283
+ i.buffers[0].uri = h, s(i);
284
284
  };
285
285
  } else
286
- s(r);
286
+ s(i);
287
287
  }
288
288
  /**
289
289
  * Serializes a userData.
@@ -293,18 +293,18 @@ class Se {
293
293
  */
294
294
  serializeUserData(e, s) {
295
295
  if (Object.keys(e.userData).length === 0) return;
296
- const n = this.options, t = this.extensionsUsed;
296
+ const r = this.options, t = this.extensionsUsed;
297
297
  try {
298
- const i = JSON.parse(JSON.stringify(e.userData));
299
- if (n.includeCustomExtensions && i.gltfExtensions) {
298
+ const n = JSON.parse(JSON.stringify(e.userData));
299
+ if (r.includeCustomExtensions && n.gltfExtensions) {
300
300
  s.extensions === void 0 && (s.extensions = {});
301
- for (const r in i.gltfExtensions)
302
- s.extensions[r] = i.gltfExtensions[r], t[r] = !0;
303
- delete i.gltfExtensions;
301
+ for (const i in n.gltfExtensions)
302
+ s.extensions[i] = n.gltfExtensions[i], t[i] = !0;
303
+ delete n.gltfExtensions;
304
304
  }
305
- Object.keys(i).length > 0 && (s.extras = i);
306
- } catch (i) {
307
- console.warn("THREE.GLTFExporter: userData of '" + e.name + "' won't be serialized because of JSON.stringify error - " + i.message);
305
+ Object.keys(n).length > 0 && (s.extras = n);
306
+ } catch (n) {
307
+ console.warn("THREE.GLTFExporter: userData of '" + e.name + "' won't be serialized because of JSON.stringify error - " + n.message);
308
308
  }
309
309
  }
310
310
  /**
@@ -329,9 +329,9 @@ class Se {
329
329
  */
330
330
  isNormalizedNormalAttribute(e) {
331
331
  if (this.cache.attributesNormalized.has(e)) return !1;
332
- const n = new v();
333
- for (let t = 0, i = e.count; t < i; t++)
334
- if (Math.abs(n.fromBufferAttribute(e, t).length() - 1) > 5e-4) return !1;
332
+ const r = new z();
333
+ for (let t = 0, n = e.count; t < n; t++)
334
+ if (Math.abs(r.fromBufferAttribute(e, t).length() - 1) > 5e-4) return !1;
335
335
  return !0;
336
336
  }
337
337
  /**
@@ -344,10 +344,10 @@ class Se {
344
344
  createNormalizedNormalAttribute(e) {
345
345
  const s = this.cache;
346
346
  if (s.attributesNormalized.has(e)) return s.attributesNormalized.get(e);
347
- const n = e.clone(), t = new v();
348
- for (let i = 0, r = n.count; i < r; i++)
349
- t.fromBufferAttribute(n, i), t.x === 0 && t.y === 0 && t.z === 0 ? t.setX(1) : t.normalize(), n.setXYZ(i, t.x, t.y, t.z);
350
- return s.attributesNormalized.set(e, n), n;
347
+ const r = e.clone(), t = new z();
348
+ for (let n = 0, i = r.count; n < i; n++)
349
+ t.fromBufferAttribute(r, n), t.x === 0 && t.y === 0 && t.z === 0 ? t.setX(1) : t.normalize(), r.setXYZ(n, t.x, t.y, t.z);
350
+ return s.attributesNormalized.set(e, r), r;
351
351
  }
352
352
  /**
353
353
  * Applies a texture transform, if present, to the map definition. Requires
@@ -357,42 +357,42 @@ class Se {
357
357
  * @param {THREE.Texture} texture
358
358
  */
359
359
  applyTextureTransform(e, s) {
360
- let n = !1;
360
+ let r = !1;
361
361
  const t = {};
362
- (s.offset.x !== 0 || s.offset.y !== 0) && (t.offset = s.offset.toArray(), n = !0), s.rotation !== 0 && (t.rotation = s.rotation, n = !0), (s.repeat.x !== 1 || s.repeat.y !== 1) && (t.scale = s.repeat.toArray(), n = !0), n && (e.extensions = e.extensions || {}, e.extensions.KHR_texture_transform = t, this.extensionsUsed.KHR_texture_transform = !0);
362
+ (s.offset.x !== 0 || s.offset.y !== 0) && (t.offset = s.offset.toArray(), r = !0), s.rotation !== 0 && (t.rotation = s.rotation, r = !0), (s.repeat.x !== 1 || s.repeat.y !== 1) && (t.scale = s.repeat.toArray(), r = !0), r && (e.extensions = e.extensions || {}, e.extensions.KHR_texture_transform = t, this.extensionsUsed.KHR_texture_transform = !0);
363
363
  }
364
364
  async buildMetalRoughTextureAsync(e, s) {
365
365
  if (e === s) return e;
366
- function n(f) {
367
- return f.colorSpace === ce ? function(x) {
368
- return x < 0.04045 ? x * 0.0773993808 : Math.pow(x * 0.9478672986 + 0.0521327014, 2.4);
369
- } : function(x) {
370
- return x;
366
+ function r(h) {
367
+ return h.colorSpace === ce ? function(p) {
368
+ return p < 0.04045 ? p * 0.0773993808 : Math.pow(p * 0.9478672986 + 0.0521327014, 2.4);
369
+ } : function(p) {
370
+ return p;
371
371
  };
372
372
  }
373
373
  e instanceof B && (e = await this.decompressTextureAsync(e)), s instanceof B && (s = await this.decompressTextureAsync(s));
374
- const t = e ? e.image : null, i = s ? s.image : null, r = Math.max(t ? t.width : 0, i ? i.width : 0), o = Math.max(t ? t.height : 0, i ? i.height : 0), c = X();
375
- c.width = r, c.height = o;
376
- const l = c.getContext("2d", {
374
+ const t = e ? e.image : null, n = s ? s.image : null, i = Math.max(t ? t.width : 0, n ? n.width : 0), o = Math.max(t ? t.height : 0, n ? n.height : 0), c = J();
375
+ c.width = i, c.height = o;
376
+ const u = c.getContext("2d", {
377
377
  willReadFrequently: !0
378
378
  });
379
- l.fillStyle = "#00ffff", l.fillRect(0, 0, r, o);
380
- const h = l.getImageData(0, 0, r, o);
379
+ u.fillStyle = "#00ffff", u.fillRect(0, 0, i, o);
380
+ const f = u.getImageData(0, 0, i, o);
381
381
  if (t) {
382
- l.drawImage(t, 0, 0, r, o);
383
- const f = n(e), d = l.getImageData(0, 0, r, o).data;
384
- for (let x = 2; x < d.length; x += 4)
385
- h.data[x] = f(d[x] / 256) * 256;
382
+ u.drawImage(t, 0, 0, i, o);
383
+ const h = r(e), x = u.getImageData(0, 0, i, o).data;
384
+ for (let p = 2; p < x.length; p += 4)
385
+ f.data[p] = h(x[p] / 256) * 256;
386
386
  }
387
- if (i) {
388
- l.drawImage(i, 0, 0, r, o);
389
- const f = n(s), d = l.getImageData(0, 0, r, o).data;
390
- for (let x = 1; x < d.length; x += 4)
391
- h.data[x] = f(d[x] / 256) * 256;
387
+ if (n) {
388
+ u.drawImage(n, 0, 0, i, o);
389
+ const h = r(s), x = u.getImageData(0, 0, i, o).data;
390
+ for (let p = 1; p < x.length; p += 4)
391
+ f.data[p] = h(x[p] / 256) * 256;
392
392
  }
393
- l.putImageData(h, 0, 0);
394
- const T = (e || s).clone();
395
- return T.source = new te(c), T.colorSpace = ne, T.channel = (e || s).channel, e && s && e.channel !== s.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), T;
393
+ u.putImageData(f, 0, 0);
394
+ const g = (e || s).clone();
395
+ return g.source = new te(c), g.colorSpace = ne, g.channel = (e || s).channel, e && s && e.channel !== s.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), g;
396
396
  }
397
397
  async decompressTextureAsync(e, s = 1 / 0) {
398
398
  if (this.textureUtils === null)
@@ -405,8 +405,8 @@ class Se {
405
405
  * @return {0}
406
406
  */
407
407
  processBuffer(e) {
408
- const s = this.json, n = this.buffers;
409
- return s.buffers || (s.buffers = [{ byteLength: 0 }]), n.push(e), 0;
408
+ const s = this.json, r = this.buffers;
409
+ return s.buffers || (s.buffers = [{ byteLength: 0 }]), r.push(e), 0;
410
410
  }
411
411
  /**
412
412
  * Process and generate a BufferView
@@ -417,40 +417,40 @@ class Se {
417
417
  * @param {number} [target] Target usage of the BufferView
418
418
  * @return {Object}
419
419
  */
420
- processBufferView(e, s, n, t, i) {
421
- const r = this.json;
422
- r.bufferViews || (r.bufferViews = []);
420
+ processBufferView(e, s, r, t, n) {
421
+ const i = this.json;
422
+ i.bufferViews || (i.bufferViews = []);
423
423
  let o;
424
424
  switch (s) {
425
- case g.BYTE:
426
- case g.UNSIGNED_BYTE:
425
+ case T.BYTE:
426
+ case T.UNSIGNED_BYTE:
427
427
  o = 1;
428
428
  break;
429
- case g.SHORT:
430
- case g.UNSIGNED_SHORT:
429
+ case T.SHORT:
430
+ case T.UNSIGNED_SHORT:
431
431
  o = 2;
432
432
  break;
433
433
  default:
434
434
  o = 4;
435
435
  }
436
436
  let c = e.itemSize * o;
437
- i === g.ARRAY_BUFFER && (c = Math.ceil(c / 4) * 4);
438
- const l = Z(t * c), h = new DataView(new ArrayBuffer(l));
439
- let u = 0;
440
- for (let d = n; d < n + t; d++) {
441
- for (let x = 0; x < e.itemSize; x++) {
442
- let y;
443
- e.itemSize > 4 ? y = e.array[d * e.itemSize + x] : (x === 0 ? y = e.getX(d) : x === 1 ? y = e.getY(d) : x === 2 ? y = e.getZ(d) : x === 3 && (y = e.getW(d)), e.normalized === !0 && (y = k.normalize(y, e.array))), s === g.FLOAT ? h.setFloat32(u, y, !0) : s === g.INT ? h.setInt32(u, y, !0) : s === g.UNSIGNED_INT ? h.setUint32(u, y, !0) : s === g.SHORT ? h.setInt16(u, y, !0) : s === g.UNSIGNED_SHORT ? h.setUint16(u, y, !0) : s === g.BYTE ? h.setInt8(u, y) : s === g.UNSIGNED_BYTE && h.setUint8(u, y), u += o;
437
+ n === T.ARRAY_BUFFER && (c = Math.ceil(c / 4) * 4);
438
+ const u = j(t * c), f = new DataView(new ArrayBuffer(u));
439
+ let l = 0;
440
+ for (let x = r; x < r + t; x++) {
441
+ for (let p = 0; p < e.itemSize; p++) {
442
+ let d;
443
+ e.itemSize > 4 ? d = e.array[x * e.itemSize + p] : (p === 0 ? d = e.getX(x) : p === 1 ? d = e.getY(x) : p === 2 ? d = e.getZ(x) : p === 3 && (d = e.getW(x)), e.normalized === !0 && (d = H.normalize(d, e.array))), s === T.FLOAT ? f.setFloat32(l, d, !0) : s === T.INT ? f.setInt32(l, d, !0) : s === T.UNSIGNED_INT ? f.setUint32(l, d, !0) : s === T.SHORT ? f.setInt16(l, d, !0) : s === T.UNSIGNED_SHORT ? f.setUint16(l, d, !0) : s === T.BYTE ? f.setInt8(l, d) : s === T.UNSIGNED_BYTE && f.setUint8(l, d), l += o;
444
444
  }
445
- u % c !== 0 && (u += c - u % c);
445
+ l % c !== 0 && (l += c - l % c);
446
446
  }
447
- const T = {
448
- buffer: this.processBuffer(h.buffer),
447
+ const g = {
448
+ buffer: this.processBuffer(f.buffer),
449
449
  byteOffset: this.byteOffset,
450
- byteLength: l
450
+ byteLength: u
451
451
  };
452
- return i !== void 0 && (T.target = i), i === g.ARRAY_BUFFER && (T.byteStride = c), this.byteOffset += l, r.bufferViews.push(T), {
453
- id: r.bufferViews.length - 1,
452
+ return n !== void 0 && (g.target = n), n === T.ARRAY_BUFFER && (g.byteStride = c), this.byteOffset += u, i.bufferViews.push(g), {
453
+ id: i.bufferViews.length - 1,
454
454
  byteLength: 0
455
455
  };
456
456
  }
@@ -460,16 +460,16 @@ class Se {
460
460
  * @return {Promise<number>} An integer
461
461
  */
462
462
  processBufferViewImage(e) {
463
- const s = this, n = s.json;
464
- return n.bufferViews || (n.bufferViews = []), new Promise(function(t) {
465
- const i = new FileReader();
466
- i.readAsArrayBuffer(e), i.onloadend = function() {
467
- const r = P(i.result), o = {
468
- buffer: s.processBuffer(r),
463
+ const s = this, r = s.json;
464
+ return r.bufferViews || (r.bufferViews = []), new Promise(function(t) {
465
+ const n = new FileReader();
466
+ n.readAsArrayBuffer(e), n.onloadend = function() {
467
+ const i = k(n.result), o = {
468
+ buffer: s.processBuffer(i),
469
469
  byteOffset: s.byteOffset,
470
- byteLength: r.byteLength
470
+ byteLength: i.byteLength
471
471
  };
472
- s.byteOffset += r.byteLength, t(n.bufferViews.push(o) - 1);
472
+ s.byteOffset += i.byteLength, t(r.bufferViews.push(o) - 1);
473
473
  };
474
474
  });
475
475
  }
@@ -481,8 +481,8 @@ class Se {
481
481
  * @param {number} [count=Infinity]
482
482
  * @return {?number} Index of the processed accessor on the "accessors" array
483
483
  */
484
- processAccessor(e, s, n, t) {
485
- const i = this.json, r = {
484
+ processAccessor(e, s, r, t) {
485
+ const n = this.json, i = {
486
486
  1: "SCALAR",
487
487
  2: "VEC2",
488
488
  3: "VEC3",
@@ -492,35 +492,35 @@ class Se {
492
492
  };
493
493
  let o;
494
494
  if (e.array.constructor === Float32Array)
495
- o = g.FLOAT;
495
+ o = T.FLOAT;
496
496
  else if (e.array.constructor === Int32Array)
497
- o = g.INT;
497
+ o = T.INT;
498
498
  else if (e.array.constructor === Uint32Array)
499
- o = g.UNSIGNED_INT;
499
+ o = T.UNSIGNED_INT;
500
500
  else if (e.array.constructor === Int16Array)
501
- o = g.SHORT;
501
+ o = T.SHORT;
502
502
  else if (e.array.constructor === Uint16Array)
503
- o = g.UNSIGNED_SHORT;
503
+ o = T.UNSIGNED_SHORT;
504
504
  else if (e.array.constructor === Int8Array)
505
- o = g.BYTE;
505
+ o = T.BYTE;
506
506
  else if (e.array.constructor === Uint8Array)
507
- o = g.UNSIGNED_BYTE;
507
+ o = T.UNSIGNED_BYTE;
508
508
  else
509
509
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + e.array.constructor.name);
510
- if (n === void 0 && (n = 0), (t === void 0 || t === 1 / 0) && (t = e.count), t === 0) return null;
511
- const c = be(e, n, t);
512
- let l;
513
- s !== void 0 && (l = e === s.index ? g.ELEMENT_ARRAY_BUFFER : g.ARRAY_BUFFER);
514
- const h = this.processBufferView(e, o, n, t, l), u = {
515
- bufferView: h.id,
516
- byteOffset: h.byteOffset,
510
+ if (r === void 0 && (r = 0), (t === void 0 || t === 1 / 0) && (t = e.count), t === 0) return null;
511
+ const c = Ne(e, r, t);
512
+ let u;
513
+ s !== void 0 && (u = e === s.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
514
+ const f = this.processBufferView(e, o, r, t, u), l = {
515
+ bufferView: f.id,
516
+ byteOffset: f.byteOffset,
517
517
  componentType: o,
518
518
  count: t,
519
519
  max: c.max,
520
520
  min: c.min,
521
- type: r[e.itemSize]
521
+ type: i[e.itemSize]
522
522
  };
523
- return e.normalized === !0 && (u.normalized = !0), i.accessors || (i.accessors = []), i.accessors.push(u) - 1;
523
+ return e.normalized === !0 && (l.normalized = !0), n.accessors || (n.accessors = []), n.accessors.push(l) - 1;
524
524
  }
525
525
  /**
526
526
  * Process image
@@ -530,35 +530,35 @@ class Se {
530
530
  * @param {string} mimeType export format
531
531
  * @return {number} Index of the processed texture in the "images" array
532
532
  */
533
- processImage(e, s, n, t = "image/png") {
533
+ processImage(e, s, r, t = "image/png") {
534
534
  if (e !== null) {
535
- const i = this, r = i.cache, o = i.json, c = i.options, l = i.pending;
536
- r.images.has(e) || r.images.set(e, {});
537
- const h = r.images.get(e), u = t + ":flipY/" + n.toString();
538
- if (h[u] !== void 0) return h[u];
535
+ const n = this, i = n.cache, o = n.json, c = n.options, u = n.pending;
536
+ i.images.has(e) || i.images.set(e, {});
537
+ const f = i.images.get(e), l = t + ":flipY/" + r.toString();
538
+ if (f[l] !== void 0) return f[l];
539
539
  o.images || (o.images = []);
540
- const T = { mimeType: t }, f = X();
541
- f.width = Math.min(e.width, c.maxTextureSize), f.height = Math.min(e.height, c.maxTextureSize);
542
- const d = f.getContext("2d", {
540
+ const g = { mimeType: t }, h = J();
541
+ h.width = Math.min(e.width, c.maxTextureSize), h.height = Math.min(e.height, c.maxTextureSize);
542
+ const x = h.getContext("2d", {
543
543
  willReadFrequently: !0
544
544
  });
545
- if (n === !0 && (d.translate(0, f.height), d.scale(1, -1)), e.data !== void 0) {
545
+ if (r === !0 && (x.translate(0, h.height), x.scale(1, -1)), e.data !== void 0) {
546
546
  s !== ie && console.error("GLTFExporter: Only RGBAFormat is supported.", s), (e.width > c.maxTextureSize || e.height > c.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", e);
547
- const y = new Uint8ClampedArray(e.height * e.width * 4);
548
- for (let M = 0; M < y.length; M += 4)
549
- y[M + 0] = e.data[M + 0], y[M + 1] = e.data[M + 1], y[M + 2] = e.data[M + 2], y[M + 3] = e.data[M + 3];
550
- d.putImageData(new ImageData(y, e.width, e.height), 0, 0);
547
+ const d = new Uint8ClampedArray(e.height * e.width * 4);
548
+ for (let m = 0; m < d.length; m += 4)
549
+ d[m + 0] = e.data[m + 0], d[m + 1] = e.data[m + 1], d[m + 2] = e.data[m + 2], d[m + 3] = e.data[m + 3];
550
+ x.putImageData(new ImageData(d, e.width, e.height), 0, 0);
551
551
  } else if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap || typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas)
552
- d.drawImage(e, 0, 0, f.width, f.height);
552
+ x.drawImage(e, 0, 0, h.width, h.height);
553
553
  else
554
554
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
555
- c.binary === !0 ? l.push(
556
- Ne(f, t).then((y) => i.processBufferViewImage(y)).then((y) => {
557
- T.bufferView = y;
555
+ c.binary === !0 ? u.push(
556
+ Se(h, t).then((d) => n.processBufferViewImage(d)).then((d) => {
557
+ g.bufferView = d;
558
558
  })
559
- ) : T.uri = re.getDataURL(f, t);
560
- const x = o.images.push(T) - 1;
561
- return h[u] = x, x;
559
+ ) : g.uri = re.getDataURL(h, t);
560
+ const p = o.images.push(g) - 1;
561
+ return f[l] = p, p;
562
562
  } else
563
563
  throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");
564
564
  }
@@ -570,13 +570,13 @@ class Se {
570
570
  processSampler(e) {
571
571
  const s = this.json;
572
572
  s.samplers || (s.samplers = []);
573
- const n = {
574
- magFilter: R[e.magFilter],
575
- minFilter: R[e.minFilter],
576
- wrapS: R[e.wrapS],
577
- wrapT: R[e.wrapT]
573
+ const r = {
574
+ magFilter: N[e.magFilter],
575
+ minFilter: N[e.minFilter],
576
+ wrapS: N[e.wrapS],
577
+ wrapT: N[e.wrapT]
578
578
  };
579
- return s.samplers.push(n) - 1;
579
+ return s.samplers.push(r) - 1;
580
580
  }
581
581
  /**
582
582
  * Process texture
@@ -584,19 +584,19 @@ class Se {
584
584
  * @return {Promise<number>} Index of the processed texture in the "textures" array
585
585
  */
586
586
  async processTextureAsync(e) {
587
- const n = this.options, t = this.cache, i = this.json;
587
+ const r = this.options, t = this.cache, n = this.json;
588
588
  if (t.textures.has(e)) return t.textures.get(e);
589
- i.textures || (i.textures = []), e instanceof B && (e = await this.decompressTextureAsync(e, n.maxTextureSize));
590
- let r = e.userData.mimeType;
591
- r === "image/webp" && (r = "image/png");
589
+ n.textures || (n.textures = []), e instanceof B && (e = await this.decompressTextureAsync(e, r.maxTextureSize));
590
+ let i = e.userData.mimeType;
591
+ i === "image/webp" && (i = "image/png");
592
592
  const o = {
593
593
  sampler: this.processSampler(e),
594
- source: this.processImage(e.image, e.format, e.flipY, r)
594
+ source: this.processImage(e.image, e.format, e.flipY, i)
595
595
  };
596
- e.name && (o.name = e.name), await this._invokeAllAsync(async function(l) {
597
- l.writeTexture && await l.writeTexture(e, o);
596
+ e.name && (o.name = e.name), await this._invokeAllAsync(async function(u) {
597
+ u.writeTexture && await u.writeTexture(e, o);
598
598
  });
599
- const c = i.textures.push(o) - 1;
599
+ const c = n.textures.push(o) - 1;
600
600
  return t.textures.set(e, c), c;
601
601
  }
602
602
  /**
@@ -605,15 +605,15 @@ class Se {
605
605
  * @return {Promise<?number>} Index of the processed material in the "materials" array
606
606
  */
607
607
  async processMaterialAsync(e) {
608
- const s = this.cache, n = this.json;
608
+ const s = this.cache, r = this.json;
609
609
  if (s.materials.has(e)) return s.materials.get(e);
610
610
  if (e.isShaderMaterial)
611
611
  return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null;
612
- n.materials || (n.materials = []);
612
+ r.materials || (r.materials = []);
613
613
  const t = { pbrMetallicRoughness: {} };
614
614
  e.isMeshStandardMaterial !== !0 && e.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
615
- const i = e.color.toArray().concat([e.opacity]);
616
- if (F(i, [1, 1, 1, 1]) || (t.pbrMetallicRoughness.baseColorFactor = i), e.isMeshStandardMaterial ? (t.pbrMetallicRoughness.metallicFactor = e.metalness, t.pbrMetallicRoughness.roughnessFactor = e.roughness) : (t.pbrMetallicRoughness.metallicFactor = 0, t.pbrMetallicRoughness.roughnessFactor = 1), e.metalnessMap || e.roughnessMap) {
615
+ const n = e.color.toArray().concat([e.opacity]);
616
+ if (L(n, [1, 1, 1, 1]) || (t.pbrMetallicRoughness.baseColorFactor = n), e.isMeshStandardMaterial ? (t.pbrMetallicRoughness.metallicFactor = e.metalness, t.pbrMetallicRoughness.roughnessFactor = e.roughness) : (t.pbrMetallicRoughness.metallicFactor = 0, t.pbrMetallicRoughness.roughnessFactor = 1), e.metalnessMap || e.roughnessMap) {
617
617
  const o = await this.buildMetalRoughTextureAsync(e.metalnessMap, e.roughnessMap), c = {
618
618
  index: await this.processTextureAsync(o),
619
619
  texCoord: o.channel
@@ -630,11 +630,11 @@ class Se {
630
630
  if (e.emissive) {
631
631
  const o = e.emissive;
632
632
  if (Math.max(o.r, o.g, o.b) > 0 && (t.emissiveFactor = e.emissive.toArray()), e.emissiveMap) {
633
- const l = {
633
+ const u = {
634
634
  index: await this.processTextureAsync(e.emissiveMap),
635
635
  texCoord: e.emissiveMap.channel
636
636
  };
637
- this.applyTextureTransform(l, e.emissiveMap), t.emissiveTexture = l;
637
+ this.applyTextureTransform(u, e.emissiveMap), t.emissiveTexture = u;
638
638
  }
639
639
  }
640
640
  if (e.normalMap) {
@@ -654,8 +654,8 @@ class Se {
654
654
  e.transparent ? t.alphaMode = "BLEND" : e.alphaTest > 0 && (t.alphaMode = "MASK", t.alphaCutoff = e.alphaTest), e.side === oe && (t.doubleSided = !0), e.name !== "" && (t.name = e.name), this.serializeUserData(e, t), await this._invokeAllAsync(async function(o) {
655
655
  o.writeMaterialAsync && await o.writeMaterialAsync(e, t);
656
656
  });
657
- const r = n.materials.push(t) - 1;
658
- return s.materials.set(e, r), r;
657
+ const i = r.materials.push(t) - 1;
658
+ return s.materials.set(e, i), i;
659
659
  }
660
660
  /**
661
661
  * Process mesh
@@ -663,18 +663,18 @@ class Se {
663
663
  * @return {Promise<?number>} Index of the processed mesh in the "meshes" array
664
664
  */
665
665
  async processMeshAsync(e) {
666
- const s = this.cache, n = this.json, t = [e.geometry.uuid];
666
+ const s = this.cache, r = this.json, t = [e.geometry.uuid];
667
667
  if (Array.isArray(e.material))
668
- for (let p = 0, w = e.material.length; p < w; p++)
669
- t.push(e.material[p].uuid);
668
+ for (let y = 0, w = e.material.length; y < w; y++)
669
+ t.push(e.material[y].uuid);
670
670
  else
671
671
  t.push(e.material.uuid);
672
- const i = t.join(":");
673
- if (s.meshes.has(i)) return s.meshes.get(i);
674
- const r = e.geometry;
672
+ const n = t.join(":");
673
+ if (s.meshes.has(n)) return s.meshes.get(n);
674
+ const i = e.geometry;
675
675
  let o;
676
- e.isLineSegments ? o = g.LINES : e.isLineLoop ? o = g.LINE_LOOP : e.isLine ? o = g.LINE_STRIP : e.isPoints ? o = g.POINTS : o = e.material.wireframe ? g.LINES : g.TRIANGLES;
677
- const c = {}, l = {}, h = [], u = [], T = {
676
+ e.isLineSegments ? o = T.LINES : e.isLineLoop ? o = T.LINE_LOOP : e.isLine ? o = T.LINE_STRIP : e.isPoints ? o = T.POINTS : o = e.material.wireframe ? T.LINES : T.TRIANGLES;
677
+ const c = {}, u = {}, f = [], l = [], g = {
678
678
  uv: "TEXCOORD_0",
679
679
  uv1: "TEXCOORD_1",
680
680
  uv2: "TEXCOORD_2",
@@ -682,79 +682,79 @@ class Se {
682
682
  color: "COLOR_0",
683
683
  skinWeight: "WEIGHTS_0",
684
684
  skinIndex: "JOINTS_0"
685
- }, f = r.getAttribute("normal");
686
- f !== void 0 && !this.isNormalizedNormalAttribute(f) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), r.setAttribute("normal", this.createNormalizedNormalAttribute(f)));
687
- let d = null;
688
- for (let p in r.attributes) {
689
- if (p.slice(0, 5) === "morph") continue;
690
- const w = r.attributes[p];
691
- if (p = T[p] || p.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(p) || (p = "_" + p), s.attributes.has(this.getUID(w))) {
692
- l[p] = s.attributes.get(this.getUID(w));
685
+ }, h = i.getAttribute("normal");
686
+ h !== void 0 && !this.isNormalizedNormalAttribute(h) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), i.setAttribute("normal", this.createNormalizedNormalAttribute(h)));
687
+ let x = null;
688
+ for (let y in i.attributes) {
689
+ if (y.slice(0, 5) === "morph") continue;
690
+ const w = i.attributes[y];
691
+ if (y = g[y] || y.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(y) || (y = "_" + y), s.attributes.has(this.getUID(w))) {
692
+ u[y] = s.attributes.get(this.getUID(w));
693
693
  continue;
694
694
  }
695
- d = null;
696
- const m = w.array;
697
- p === "JOINTS_0" && !(m instanceof Uint16Array) && !(m instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), d = new S(new Uint16Array(m), w.itemSize, w.normalized)) : (m instanceof Uint32Array || m instanceof Int32Array) && !p.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${p}" converted to type FLOAT.`), d = H.Utils.toFloat32BufferAttribute(w));
698
- const I = this.processAccessor(d || w, r);
699
- I !== null && (p.startsWith("_") || this.detectMeshQuantization(p, w), l[p] = I, s.attributes.set(this.getUID(w), I));
695
+ x = null;
696
+ const M = w.array;
697
+ y === "JOINTS_0" && !(M instanceof Uint16Array) && !(M instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), x = O.Utils.toTypedBufferAttribute(w, Uint16Array)) : (M instanceof Uint32Array || M instanceof Int32Array) && !y.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${y}" converted to type FLOAT.`), x = O.Utils.toTypedBufferAttribute(w, Float32Array));
698
+ const R = this.processAccessor(x || w, i);
699
+ R !== null && (y.startsWith("_") || this.detectMeshQuantization(y, w), u[y] = R, s.attributes.set(this.getUID(w), R));
700
700
  }
701
- if (f !== void 0 && r.setAttribute("normal", f), Object.keys(l).length === 0) return null;
701
+ if (h !== void 0 && i.setAttribute("normal", h), Object.keys(u).length === 0) return null;
702
702
  if (e.morphTargetInfluences !== void 0 && e.morphTargetInfluences.length > 0) {
703
- const p = [], w = [], A = {};
703
+ const y = [], w = [], E = {};
704
704
  if (e.morphTargetDictionary !== void 0)
705
- for (const m in e.morphTargetDictionary)
706
- A[e.morphTargetDictionary[m]] = m;
707
- for (let m = 0; m < e.morphTargetInfluences.length; ++m) {
708
- const I = {};
705
+ for (const M in e.morphTargetDictionary)
706
+ E[e.morphTargetDictionary[M]] = M;
707
+ for (let M = 0; M < e.morphTargetInfluences.length; ++M) {
708
+ const R = {};
709
709
  let V = !1;
710
- for (const _ in r.morphAttributes) {
711
- if (_ !== "position" && _ !== "normal") {
710
+ for (const U in i.morphAttributes) {
711
+ if (U !== "position" && U !== "normal") {
712
712
  V || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), V = !0);
713
713
  continue;
714
714
  }
715
- const N = r.morphAttributes[_][m], D = _.toUpperCase(), U = r.attributes[_];
716
- if (s.attributes.has(this.getUID(N, !0))) {
717
- I[D] = s.attributes.get(this.getUID(N, !0));
715
+ const S = i.morphAttributes[U][M], P = U.toUpperCase(), F = i.attributes[U];
716
+ if (s.attributes.has(this.getUID(S, !0))) {
717
+ R[P] = s.attributes.get(this.getUID(S, !0));
718
718
  continue;
719
719
  }
720
- const C = N.clone();
721
- if (!r.morphTargetsRelative)
722
- for (let E = 0, Q = N.count; E < Q; E++)
723
- for (let L = 0; L < N.itemSize; L++)
724
- L === 0 && C.setX(E, N.getX(E) - U.getX(E)), L === 1 && C.setY(E, N.getY(E) - U.getY(E)), L === 2 && C.setZ(E, N.getZ(E) - U.getZ(E)), L === 3 && C.setW(E, N.getW(E) - U.getW(E));
725
- I[D] = this.processAccessor(C, r), s.attributes.set(this.getUID(U, !0), I[D]);
720
+ const v = S.clone();
721
+ if (!i.morphTargetsRelative)
722
+ for (let I = 0, Q = S.count; I < Q; I++)
723
+ for (let C = 0; C < S.itemSize; C++)
724
+ C === 0 && v.setX(I, S.getX(I) - F.getX(I)), C === 1 && v.setY(I, S.getY(I) - F.getY(I)), C === 2 && v.setZ(I, S.getZ(I) - F.getZ(I)), C === 3 && v.setW(I, S.getW(I) - F.getW(I));
725
+ R[P] = this.processAccessor(v, i), s.attributes.set(this.getUID(F, !0), R[P]);
726
726
  }
727
- u.push(I), p.push(e.morphTargetInfluences[m]), e.morphTargetDictionary !== void 0 && w.push(A[m]);
727
+ l.push(R), y.push(e.morphTargetInfluences[M]), e.morphTargetDictionary !== void 0 && w.push(E[M]);
728
728
  }
729
- c.weights = p, w.length > 0 && (c.extras = {}, c.extras.targetNames = w);
729
+ c.weights = y, w.length > 0 && (c.extras = {}, c.extras.targetNames = w);
730
730
  }
731
- const x = Array.isArray(e.material);
732
- if (x && r.groups.length === 0) return null;
733
- let y = !1;
734
- if (x && r.index === null) {
735
- const p = [];
736
- for (let w = 0, A = r.attributes.position.count; w < A; w++)
737
- p[w] = w;
738
- r.setIndex(p), y = !0;
731
+ const p = Array.isArray(e.material);
732
+ if (p && i.groups.length === 0) return null;
733
+ let d = !1;
734
+ if (p && i.index === null) {
735
+ const y = [];
736
+ for (let w = 0, E = i.attributes.position.count; w < E; w++)
737
+ y[w] = w;
738
+ i.setIndex(y), d = !0;
739
739
  }
740
- const M = x ? e.material : [e.material], b = x ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
741
- for (let p = 0, w = b.length; p < w; p++) {
742
- const A = {
740
+ const m = p ? e.material : [e.material], A = p ? i.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
741
+ for (let y = 0, w = A.length; y < w; y++) {
742
+ const E = {
743
743
  mode: o,
744
- attributes: l
744
+ attributes: u
745
745
  };
746
- if (this.serializeUserData(r, A), u.length > 0 && (A.targets = u), r.index !== null) {
747
- let I = this.getUID(r.index);
748
- (b[p].start !== void 0 || b[p].count !== void 0) && (I += ":" + b[p].start + ":" + b[p].count), s.attributes.has(I) ? A.indices = s.attributes.get(I) : (A.indices = this.processAccessor(r.index, r, b[p].start, b[p].count), s.attributes.set(I, A.indices)), A.indices === null && delete A.indices;
746
+ if (this.serializeUserData(i, E), l.length > 0 && (E.targets = l), i.index !== null) {
747
+ let R = this.getUID(i.index);
748
+ (A[y].start !== void 0 || A[y].count !== void 0) && (R += ":" + A[y].start + ":" + A[y].count), s.attributes.has(R) ? E.indices = s.attributes.get(R) : (E.indices = this.processAccessor(i.index, i, A[y].start, A[y].count), s.attributes.set(R, E.indices)), E.indices === null && delete E.indices;
749
749
  }
750
- const m = await this.processMaterialAsync(M[b[p].materialIndex]);
751
- m !== null && (A.material = m), h.push(A);
750
+ const M = await this.processMaterialAsync(m[A[y].materialIndex]);
751
+ M !== null && (E.material = M), f.push(E);
752
752
  }
753
- y === !0 && r.setIndex(null), c.primitives = h, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(p) {
754
- p.writeMesh && p.writeMesh(e, c);
753
+ d === !0 && i.setIndex(null), c.primitives = f, r.meshes || (r.meshes = []), await this._invokeAllAsync(function(y) {
754
+ y.writeMesh && y.writeMesh(e, c);
755
755
  });
756
- const O = n.meshes.push(c) - 1;
757
- return s.meshes.set(i, O), O;
756
+ const _ = r.meshes.push(c) - 1;
757
+ return s.meshes.set(n, _), _;
758
758
  }
759
759
  /**
760
760
  * If a vertex attribute with a
@@ -769,26 +769,26 @@ class Se {
769
769
  */
770
770
  detectMeshQuantization(e, s) {
771
771
  if (this.extensionsUsed[G]) return;
772
- let n;
772
+ let r;
773
773
  switch (s.array.constructor) {
774
774
  case Int8Array:
775
- n = "byte";
775
+ r = "byte";
776
776
  break;
777
777
  case Uint8Array:
778
- n = "unsigned byte";
778
+ r = "unsigned byte";
779
779
  break;
780
780
  case Int16Array:
781
- n = "short";
781
+ r = "short";
782
782
  break;
783
783
  case Uint16Array:
784
- n = "unsigned short";
784
+ r = "unsigned short";
785
785
  break;
786
786
  default:
787
787
  return;
788
788
  }
789
- s.normalized && (n += " normalized");
789
+ s.normalized && (r += " normalized");
790
790
  const t = e.split("_", 1)[0];
791
- Y[t] && Y[t].includes(n) && (this.extensionsUsed[G] = !0, this.extensionsRequired[G] = !0);
791
+ K[t] && K[t].includes(r) && (this.extensionsUsed[G] = !0, this.extensionsRequired[G] = !0);
792
792
  }
793
793
  /**
794
794
  * Process camera
@@ -798,17 +798,17 @@ class Se {
798
798
  processCamera(e) {
799
799
  const s = this.json;
800
800
  s.cameras || (s.cameras = []);
801
- const n = e.isOrthographicCamera, t = {
802
- type: n ? "orthographic" : "perspective"
801
+ const r = e.isOrthographicCamera, t = {
802
+ type: r ? "orthographic" : "perspective"
803
803
  };
804
- return n ? t.orthographic = {
804
+ return r ? t.orthographic = {
805
805
  xmag: e.right * 2,
806
806
  ymag: e.top * 2,
807
807
  zfar: e.far <= 0 ? 1e-3 : e.far,
808
808
  znear: e.near < 0 ? 0 : e.near
809
809
  } : t.perspective = {
810
810
  aspectRatio: e.aspect,
811
- yfov: k.degToRad(e.fov),
811
+ yfov: H.degToRad(e.fov),
812
812
  zfar: e.far <= 0 ? 1e-3 : e.far,
813
813
  znear: e.near < 0 ? 0 : e.near
814
814
  }, e.name !== "" && (t.name = e.type), s.cameras.push(t) - 1;
@@ -824,56 +824,56 @@ class Se {
824
824
  * @return {?number}
825
825
  */
826
826
  processAnimation(e, s) {
827
- const n = this.json, t = this.nodeMap;
828
- n.animations || (n.animations = []), e = H.Utils.mergeMorphTargetTracks(e.clone(), s);
829
- const i = e.tracks, r = [], o = [];
830
- for (let l = 0; l < i.length; ++l) {
831
- const h = i[l], u = z.parseTrackName(h.name);
832
- let T = z.findNode(s, u.nodeName);
833
- const f = j[u.propertyName];
834
- if (u.objectName === "bones" && (T.isSkinnedMesh === !0 ? T = T.skeleton.getBoneByName(u.objectIndex) : T = void 0), !T || !f) {
835
- console.warn('THREE.GLTFExporter: Could not export animation track "%s".', h.name);
827
+ const r = this.json, t = this.nodeMap;
828
+ r.animations || (r.animations = []), e = O.Utils.mergeMorphTargetTracks(e.clone(), s);
829
+ const n = e.tracks, i = [], o = [];
830
+ for (let u = 0; u < n.length; ++u) {
831
+ const f = n[u], l = D.parseTrackName(f.name);
832
+ let g = D.findNode(s, l.nodeName);
833
+ const h = W[l.propertyName];
834
+ if (l.objectName === "bones" && (g.isSkinnedMesh === !0 ? g = g.skeleton.getBoneByName(l.objectIndex) : g = void 0), !g || !h) {
835
+ console.warn('THREE.GLTFExporter: Could not export animation track "%s".', f.name);
836
836
  continue;
837
837
  }
838
- const d = 1;
839
- let x = h.values.length / h.times.length;
840
- f === j.morphTargetInfluences && (x /= T.morphTargetInfluences.length);
841
- let y;
842
- h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (y = "CUBICSPLINE", x /= 3) : h.getInterpolation() === ae ? y = "STEP" : y = "LINEAR", o.push({
843
- input: this.processAccessor(new S(h.times, d)),
844
- output: this.processAccessor(new S(h.values, x)),
845
- interpolation: y
846
- }), r.push({
838
+ const x = 1;
839
+ let p = f.values.length / f.times.length;
840
+ h === W.morphTargetInfluences && (p /= g.morphTargetInfluences.length);
841
+ let d;
842
+ f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (d = "CUBICSPLINE", p /= 3) : f.getInterpolation() === ae ? d = "STEP" : d = "LINEAR", o.push({
843
+ input: this.processAccessor(new b(f.times, x)),
844
+ output: this.processAccessor(new b(f.values, p)),
845
+ interpolation: d
846
+ }), i.push({
847
847
  sampler: o.length - 1,
848
848
  target: {
849
- node: t.get(T),
850
- path: f
849
+ node: t.get(g),
850
+ path: h
851
851
  }
852
852
  });
853
853
  }
854
854
  const c = {
855
- name: e.name || "clip_" + n.animations.length,
855
+ name: e.name || "clip_" + r.animations.length,
856
856
  samplers: o,
857
- channels: r
857
+ channels: i
858
858
  };
859
- return this.serializeUserData(e, c), n.animations.push(c), n.animations.length - 1;
859
+ return this.serializeUserData(e, c), r.animations.push(c), r.animations.length - 1;
860
860
  }
861
861
  /**
862
862
  * @param {THREE.Object3D} object
863
863
  * @return {?number}
864
864
  */
865
865
  processSkin(e) {
866
- const s = this.json, n = this.nodeMap, t = s.nodes[n.get(e)], i = e.skeleton;
866
+ const s = this.json, r = this.nodeMap, t = s.nodes[r.get(e)], n = e.skeleton;
867
+ if (n === void 0) return null;
868
+ const i = e.skeleton.bones[0];
867
869
  if (i === void 0) return null;
868
- const r = e.skeleton.bones[0];
869
- if (r === void 0) return null;
870
- const o = [], c = new Float32Array(i.bones.length * 16), l = new J();
871
- for (let u = 0; u < i.bones.length; ++u)
872
- o.push(n.get(i.bones[u])), l.copy(i.boneInverses[u]), l.multiply(e.bindMatrix).toArray(c, u * 16);
870
+ const o = [], c = new Float32Array(n.bones.length * 16), u = new Z();
871
+ for (let l = 0; l < n.bones.length; ++l)
872
+ o.push(r.get(n.bones[l])), u.copy(n.boneInverses[l]), u.multiply(e.bindMatrix).toArray(c, l * 16);
873
873
  return s.skins === void 0 && (s.skins = []), s.skins.push({
874
- inverseBindMatrices: this.processAccessor(new S(c, 16)),
874
+ inverseBindMatrices: this.processAccessor(new b(c, 16)),
875
875
  joints: o,
876
- skeleton: n.get(r)
876
+ skeleton: r.get(i)
877
877
  }), t.skin = s.skins.length - 1;
878
878
  }
879
879
  /**
@@ -882,63 +882,100 @@ class Se {
882
882
  * @return {Promise<number>} Index of the node in the nodes list
883
883
  */
884
884
  async processNodeAsync(e) {
885
- const s = this.json, n = this.options, t = this.nodeMap;
886
- s.nodes || (s.nodes = []);
887
- const i = {};
888
- if (n.trs) {
889
- const o = e.quaternion.toArray(), c = e.position.toArray(), l = e.scale.toArray();
890
- F(o, [0, 0, 0, 1]) || (i.rotation = o), F(c, [0, 0, 0]) || (i.translation = c), F(l, [1, 1, 1]) || (i.scale = l);
885
+ const s = this.json, r = this.options, t = this.nodeMap;
886
+ if (s.nodes || (s.nodes = []), e.pivot !== null)
887
+ return await this._processNodeWithPivotAsync(e);
888
+ const n = {};
889
+ if (r.trs) {
890
+ const o = e.quaternion.toArray(), c = e.position.toArray(), u = e.scale.toArray();
891
+ L(o, [0, 0, 0, 1]) || (n.rotation = o), L(c, [0, 0, 0]) || (n.translation = c), L(u, [1, 1, 1]) || (n.scale = u);
891
892
  } else
892
- e.matrixAutoUpdate && e.updateMatrix(), Re(e.matrix) === !1 && (i.matrix = e.matrix.elements);
893
- if (e.name !== "" && (i.name = String(e.name)), this.serializeUserData(e, i), e.isMesh || e.isLine || e.isPoints) {
893
+ e.matrixAutoUpdate && e.updateMatrix(), Re(e.matrix) === !1 && (n.matrix = e.matrix.elements);
894
+ if (e.name !== "" && (n.name = String(e.name)), this.serializeUserData(e, n), e.isMesh || e.isLine || e.isPoints) {
894
895
  const o = await this.processMeshAsync(e);
895
- o !== null && (i.mesh = o);
896
- } else e.isCamera && (i.camera = this.processCamera(e));
896
+ o !== null && (n.mesh = o);
897
+ } else e.isCamera && (n.camera = this.processCamera(e));
897
898
  e.isSkinnedMesh && this.skins.push(e);
898
- const r = s.nodes.push(i) - 1;
899
- if (t.set(e, r), e.children.length > 0) {
899
+ const i = s.nodes.push(n) - 1;
900
+ if (t.set(e, i), e.children.length > 0) {
900
901
  const o = [];
901
- for (let c = 0, l = e.children.length; c < l; c++) {
902
- const h = e.children[c];
903
- if (h.visible || n.onlyVisible === !1) {
904
- const u = await this.processNodeAsync(h);
905
- u !== null && o.push(u);
902
+ for (let c = 0, u = e.children.length; c < u; c++) {
903
+ const f = e.children[c];
904
+ if (f.visible || r.onlyVisible === !1) {
905
+ const l = await this.processNodeAsync(f);
906
+ l !== null && o.push(l);
906
907
  }
907
908
  }
908
- o.length > 0 && (i.children = o);
909
+ o.length > 0 && (n.children = o);
909
910
  }
910
911
  return await this._invokeAllAsync(function(o) {
911
- o.writeNode && o.writeNode(e, i);
912
- }), r;
912
+ o.writeNode && o.writeNode(e, n);
913
+ }), i;
914
+ }
915
+ /**
916
+ * Process Object3D node with pivot using container approach
917
+ * @param {THREE.Object3D} object Object3D with pivot
918
+ * @return {Promise<number>} Index of the container node
919
+ */
920
+ async _processNodeWithPivotAsync(e) {
921
+ const s = this.json, r = this.options, t = this.nodeMap, n = e.pivot, i = {}, o = e.quaternion.toArray(), c = [
922
+ e.position.x + n.x,
923
+ e.position.y + n.y,
924
+ e.position.z + n.z
925
+ ], u = e.scale.toArray();
926
+ L(o, [0, 0, 0, 1]) || (i.rotation = o), L(c, [0, 0, 0]) || (i.translation = c), L(u, [1, 1, 1]) || (i.scale = u), i.extras = { pivot: n.toArray() }, e.name !== "" && (i.name = String(e.name)), this.serializeUserData(e, i);
927
+ const f = s.nodes.push(i) - 1;
928
+ t.set(e, f);
929
+ const l = {}, g = [-n.x, -n.y, -n.z];
930
+ if (L(g, [0, 0, 0]) || (l.translation = g), e.isMesh || e.isLine || e.isPoints) {
931
+ const p = await this.processMeshAsync(e);
932
+ p !== null && (l.mesh = p);
933
+ } else e.isCamera && (l.camera = this.processCamera(e));
934
+ e.isSkinnedMesh && this.skins.push(e);
935
+ const x = [s.nodes.push(l) - 1];
936
+ if (e.children.length > 0) {
937
+ const p = [];
938
+ for (let d = 0, m = e.children.length; d < m; d++) {
939
+ const A = e.children[d];
940
+ if (A.visible || r.onlyVisible === !1) {
941
+ const _ = await this.processNodeAsync(A);
942
+ _ !== null && p.push(_);
943
+ }
944
+ }
945
+ p.length > 0 && (l.children = p);
946
+ }
947
+ return i.children = x, await this._invokeAllAsync(function(p) {
948
+ p.writeNode && p.writeNode(e, i);
949
+ }), f;
913
950
  }
914
951
  /**
915
952
  * Process Scene
916
953
  * @param {Scene} scene Scene to process
917
954
  */
918
955
  async processSceneAsync(e) {
919
- const s = this.json, n = this.options;
956
+ const s = this.json, r = this.options;
920
957
  s.scenes || (s.scenes = [], s.scene = 0);
921
958
  const t = {};
922
959
  e.name !== "" && (t.name = e.name), s.scenes.push(t);
923
- const i = [];
924
- for (let r = 0, o = e.children.length; r < o; r++) {
925
- const c = e.children[r];
926
- if (c.visible || n.onlyVisible === !1) {
927
- const l = await this.processNodeAsync(c);
928
- l !== null && i.push(l);
960
+ const n = [];
961
+ for (let i = 0, o = e.children.length; i < o; i++) {
962
+ const c = e.children[i];
963
+ if (c.visible || r.onlyVisible === !1) {
964
+ const u = await this.processNodeAsync(c);
965
+ u !== null && n.push(u);
929
966
  }
930
967
  }
931
- i.length > 0 && (t.nodes = i), this.serializeUserData(e, t);
968
+ n.length > 0 && (t.nodes = n), this.serializeUserData(e, t);
932
969
  }
933
970
  /**
934
971
  * Creates a Scene to hold a list of objects and parse it
935
972
  * @param {Array<THREE.Object3D>} objects List of objects to process
936
973
  */
937
974
  async processObjectsAsync(e) {
938
- const s = new K();
975
+ const s = new Y();
939
976
  s.name = "AuxScene";
940
- for (let n = 0; n < e.length; n++)
941
- s.children.push(e[n]);
977
+ for (let r = 0; r < e.length; r++)
978
+ s.children.push(e[r]);
942
979
  await this.processSceneAsync(s);
943
980
  }
944
981
  /**
@@ -949,10 +986,10 @@ class Se {
949
986
  e = e instanceof Array ? e : [e], await this._invokeAllAsync(function(t) {
950
987
  t.beforeParse && t.beforeParse(e);
951
988
  });
952
- const n = [];
989
+ const r = [];
953
990
  for (let t = 0; t < e.length; t++)
954
- e[t] instanceof K ? await this.processSceneAsync(e[t]) : n.push(e[t]);
955
- n.length > 0 && await this.processObjectsAsync(n);
991
+ e[t] instanceof Y ? await this.processSceneAsync(e[t]) : r.push(e[t]);
992
+ r.length > 0 && await this.processObjectsAsync(r);
956
993
  for (let t = 0; t < this.skins.length; ++t)
957
994
  this.processSkin(this.skins[t]);
958
995
  for (let t = 0; t < s.animations.length; ++t)
@@ -962,11 +999,11 @@ class Se {
962
999
  });
963
1000
  }
964
1001
  async _invokeAllAsync(e) {
965
- for (let s = 0, n = this.plugins.length; s < n; s++)
1002
+ for (let s = 0, r = this.plugins.length; s < r; s++)
966
1003
  await e(this.plugins[s]);
967
1004
  }
968
1005
  }
969
- class Le {
1006
+ class _e {
970
1007
  constructor(e) {
971
1008
  this.writer = e, this.name = "KHR_lights_punctual";
972
1009
  }
@@ -976,13 +1013,13 @@ class Le {
976
1013
  console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.", e);
977
1014
  return;
978
1015
  }
979
- const n = this.writer, t = n.json, i = n.extensionsUsed, r = {};
980
- e.name && (r.name = e.name), r.color = e.color.toArray(), r.intensity = e.intensity, e.isDirectionalLight ? r.type = "directional" : e.isPointLight ? (r.type = "point", e.distance > 0 && (r.range = e.distance)) : e.isSpotLight && (r.type = "spot", e.distance > 0 && (r.range = e.distance), r.spot = {}, r.spot.innerConeAngle = (1 - e.penumbra) * e.angle, r.spot.outerConeAngle = e.angle), e.decay !== void 0 && e.decay !== 2 && console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."), e.target && (e.target.parent !== e || e.target.position.x !== 0 || e.target.position.y !== 0 || e.target.position.z !== -1) && console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."), i[this.name] || (t.extensions = t.extensions || {}, t.extensions[this.name] = { lights: [] }, i[this.name] = !0);
1016
+ const r = this.writer, t = r.json, n = r.extensionsUsed, i = {};
1017
+ e.name && (i.name = e.name), i.color = e.color.toArray(), i.intensity = e.intensity, e.isDirectionalLight ? i.type = "directional" : e.isPointLight ? (i.type = "point", e.distance > 0 && (i.range = e.distance)) : e.isSpotLight && (i.type = "spot", e.distance > 0 && (i.range = e.distance), i.spot = {}, i.spot.innerConeAngle = (1 - e.penumbra) * e.angle, i.spot.outerConeAngle = e.angle), e.decay !== void 0 && e.decay !== 2 && console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."), e.target && (e.target.parent !== e || e.target.position.x !== 0 || e.target.position.y !== 0 || e.target.position.z !== -1) && console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."), n[this.name] || (t.extensions = t.extensions || {}, t.extensions[this.name] = { lights: [] }, n[this.name] = !0);
981
1018
  const o = t.extensions[this.name].lights;
982
- o.push(r), s.extensions = s.extensions || {}, s.extensions[this.name] = { light: o.length - 1 };
1019
+ o.push(i), s.extensions = s.extensions || {}, s.extensions[this.name] = { light: o.length - 1 };
983
1020
  }
984
1021
  }
985
- class _e {
1022
+ class be {
986
1023
  constructor(e) {
987
1024
  this.writer = e, this.name = "KHR_materials_unlit";
988
1025
  }
@@ -992,45 +1029,45 @@ class _e {
992
1029
  s.extensions = s.extensions || {}, s.extensions[this.name] = {}, t[this.name] = !0, s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 0.9;
993
1030
  }
994
1031
  }
995
- class Ue {
1032
+ class Ce {
996
1033
  constructor(e) {
997
1034
  this.writer = e, this.name = "KHR_materials_clearcoat";
998
1035
  }
999
1036
  async writeMaterialAsync(e, s) {
1000
1037
  if (!e.isMeshPhysicalMaterial || e.clearcoat === 0) return;
1001
- const n = this.writer, t = n.extensionsUsed, i = {};
1002
- if (i.clearcoatFactor = e.clearcoat, e.clearcoatMap) {
1003
- const r = {
1004
- index: await n.processTextureAsync(e.clearcoatMap),
1038
+ const r = this.writer, t = r.extensionsUsed, n = {};
1039
+ if (n.clearcoatFactor = e.clearcoat, e.clearcoatMap) {
1040
+ const i = {
1041
+ index: await r.processTextureAsync(e.clearcoatMap),
1005
1042
  texCoord: e.clearcoatMap.channel
1006
1043
  };
1007
- n.applyTextureTransform(r, e.clearcoatMap), i.clearcoatTexture = r;
1044
+ r.applyTextureTransform(i, e.clearcoatMap), n.clearcoatTexture = i;
1008
1045
  }
1009
- if (i.clearcoatRoughnessFactor = e.clearcoatRoughness, e.clearcoatRoughnessMap) {
1010
- const r = {
1011
- index: await n.processTextureAsync(e.clearcoatRoughnessMap),
1046
+ if (n.clearcoatRoughnessFactor = e.clearcoatRoughness, e.clearcoatRoughnessMap) {
1047
+ const i = {
1048
+ index: await r.processTextureAsync(e.clearcoatRoughnessMap),
1012
1049
  texCoord: e.clearcoatRoughnessMap.channel
1013
1050
  };
1014
- n.applyTextureTransform(r, e.clearcoatRoughnessMap), i.clearcoatRoughnessTexture = r;
1051
+ r.applyTextureTransform(i, e.clearcoatRoughnessMap), n.clearcoatRoughnessTexture = i;
1015
1052
  }
1016
1053
  if (e.clearcoatNormalMap) {
1017
- const r = {
1018
- index: await n.processTextureAsync(e.clearcoatNormalMap),
1054
+ const i = {
1055
+ index: await r.processTextureAsync(e.clearcoatNormalMap),
1019
1056
  texCoord: e.clearcoatNormalMap.channel
1020
1057
  };
1021
- e.clearcoatNormalScale.x !== 1 && (r.scale = e.clearcoatNormalScale.x), n.applyTextureTransform(r, e.clearcoatNormalMap), i.clearcoatNormalTexture = r;
1058
+ e.clearcoatNormalScale.x !== 1 && (i.scale = e.clearcoatNormalScale.x), r.applyTextureTransform(i, e.clearcoatNormalMap), n.clearcoatNormalTexture = i;
1022
1059
  }
1023
- s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1060
+ s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1024
1061
  }
1025
1062
  }
1026
- class Ce {
1063
+ class Ue {
1027
1064
  constructor(e) {
1028
1065
  this.writer = e, this.name = "KHR_materials_dispersion";
1029
1066
  }
1030
1067
  async writeMaterialAsync(e, s) {
1031
1068
  if (!e.isMeshPhysicalMaterial || e.dispersion === 0) return;
1032
- const t = this.writer.extensionsUsed, i = {};
1033
- i.dispersion = e.dispersion, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1069
+ const t = this.writer.extensionsUsed, n = {};
1070
+ n.dispersion = e.dispersion, s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1034
1071
  }
1035
1072
  }
1036
1073
  class Fe {
@@ -1039,56 +1076,56 @@ class Fe {
1039
1076
  }
1040
1077
  async writeMaterialAsync(e, s) {
1041
1078
  if (!e.isMeshPhysicalMaterial || e.iridescence === 0) return;
1042
- const n = this.writer, t = n.extensionsUsed, i = {};
1043
- if (i.iridescenceFactor = e.iridescence, e.iridescenceMap) {
1044
- const r = {
1045
- index: await n.processTextureAsync(e.iridescenceMap),
1079
+ const r = this.writer, t = r.extensionsUsed, n = {};
1080
+ if (n.iridescenceFactor = e.iridescence, e.iridescenceMap) {
1081
+ const i = {
1082
+ index: await r.processTextureAsync(e.iridescenceMap),
1046
1083
  texCoord: e.iridescenceMap.channel
1047
1084
  };
1048
- n.applyTextureTransform(r, e.iridescenceMap), i.iridescenceTexture = r;
1085
+ r.applyTextureTransform(i, e.iridescenceMap), n.iridescenceTexture = i;
1049
1086
  }
1050
- if (i.iridescenceIor = e.iridescenceIOR, i.iridescenceThicknessMinimum = e.iridescenceThicknessRange[0], i.iridescenceThicknessMaximum = e.iridescenceThicknessRange[1], e.iridescenceThicknessMap) {
1051
- const r = {
1052
- index: await n.processTextureAsync(e.iridescenceThicknessMap),
1087
+ if (n.iridescenceIor = e.iridescenceIOR, n.iridescenceThicknessMinimum = e.iridescenceThicknessRange[0], n.iridescenceThicknessMaximum = e.iridescenceThicknessRange[1], e.iridescenceThicknessMap) {
1088
+ const i = {
1089
+ index: await r.processTextureAsync(e.iridescenceThicknessMap),
1053
1090
  texCoord: e.iridescenceThicknessMap.channel
1054
1091
  };
1055
- n.applyTextureTransform(r, e.iridescenceThicknessMap), i.iridescenceThicknessTexture = r;
1092
+ r.applyTextureTransform(i, e.iridescenceThicknessMap), n.iridescenceThicknessTexture = i;
1056
1093
  }
1057
- s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1094
+ s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1058
1095
  }
1059
1096
  }
1060
- class Oe {
1097
+ class ve {
1061
1098
  constructor(e) {
1062
1099
  this.writer = e, this.name = "KHR_materials_transmission";
1063
1100
  }
1064
1101
  async writeMaterialAsync(e, s) {
1065
1102
  if (!e.isMeshPhysicalMaterial || e.transmission === 0) return;
1066
- const n = this.writer, t = n.extensionsUsed, i = {};
1067
- if (i.transmissionFactor = e.transmission, e.transmissionMap) {
1068
- const r = {
1069
- index: await n.processTextureAsync(e.transmissionMap),
1103
+ const r = this.writer, t = r.extensionsUsed, n = {};
1104
+ if (n.transmissionFactor = e.transmission, e.transmissionMap) {
1105
+ const i = {
1106
+ index: await r.processTextureAsync(e.transmissionMap),
1070
1107
  texCoord: e.transmissionMap.channel
1071
1108
  };
1072
- n.applyTextureTransform(r, e.transmissionMap), i.transmissionTexture = r;
1109
+ r.applyTextureTransform(i, e.transmissionMap), n.transmissionTexture = i;
1073
1110
  }
1074
- s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1111
+ s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1075
1112
  }
1076
1113
  }
1077
- class ve {
1114
+ class Oe {
1078
1115
  constructor(e) {
1079
1116
  this.writer = e, this.name = "KHR_materials_volume";
1080
1117
  }
1081
1118
  async writeMaterialAsync(e, s) {
1082
1119
  if (!e.isMeshPhysicalMaterial || e.transmission === 0) return;
1083
- const n = this.writer, t = n.extensionsUsed, i = {};
1084
- if (i.thicknessFactor = e.thickness, e.thicknessMap) {
1085
- const r = {
1086
- index: await n.processTextureAsync(e.thicknessMap),
1120
+ const r = this.writer, t = r.extensionsUsed, n = {};
1121
+ if (n.thicknessFactor = e.thickness, e.thicknessMap) {
1122
+ const i = {
1123
+ index: await r.processTextureAsync(e.thicknessMap),
1087
1124
  texCoord: e.thicknessMap.channel
1088
1125
  };
1089
- n.applyTextureTransform(r, e.thicknessMap), i.thicknessTexture = r;
1126
+ r.applyTextureTransform(i, e.thicknessMap), n.thicknessTexture = i;
1090
1127
  }
1091
- e.attenuationDistance !== 1 / 0 && (i.attenuationDistance = e.attenuationDistance), i.attenuationColor = e.attenuationColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1128
+ e.attenuationDistance !== 1 / 0 && (n.attenuationDistance = e.attenuationDistance), n.attenuationColor = e.attenuationColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1092
1129
  }
1093
1130
  }
1094
1131
  class ze {
@@ -1097,8 +1134,8 @@ class ze {
1097
1134
  }
1098
1135
  async writeMaterialAsync(e, s) {
1099
1136
  if (!e.isMeshPhysicalMaterial || e.ior === 1.5) return;
1100
- const t = this.writer.extensionsUsed, i = {};
1101
- i.ior = e.ior, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1137
+ const t = this.writer.extensionsUsed, n = {};
1138
+ n.ior = e.ior, s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1102
1139
  }
1103
1140
  }
1104
1141
  class De {
@@ -1107,70 +1144,70 @@ class De {
1107
1144
  }
1108
1145
  async writeMaterialAsync(e, s) {
1109
1146
  if (!e.isMeshPhysicalMaterial || e.specularIntensity === 1 && e.specularColor.equals(we) && !e.specularIntensityMap && !e.specularColorMap) return;
1110
- const n = this.writer, t = n.extensionsUsed, i = {};
1147
+ const r = this.writer, t = r.extensionsUsed, n = {};
1111
1148
  if (e.specularIntensityMap) {
1112
- const r = {
1113
- index: await n.processTextureAsync(e.specularIntensityMap),
1149
+ const i = {
1150
+ index: await r.processTextureAsync(e.specularIntensityMap),
1114
1151
  texCoord: e.specularIntensityMap.channel
1115
1152
  };
1116
- n.applyTextureTransform(r, e.specularIntensityMap), i.specularTexture = r;
1153
+ r.applyTextureTransform(i, e.specularIntensityMap), n.specularTexture = i;
1117
1154
  }
1118
1155
  if (e.specularColorMap) {
1119
- const r = {
1120
- index: await n.processTextureAsync(e.specularColorMap),
1156
+ const i = {
1157
+ index: await r.processTextureAsync(e.specularColorMap),
1121
1158
  texCoord: e.specularColorMap.channel
1122
1159
  };
1123
- n.applyTextureTransform(r, e.specularColorMap), i.specularColorTexture = r;
1160
+ r.applyTextureTransform(i, e.specularColorMap), n.specularColorTexture = i;
1124
1161
  }
1125
- i.specularFactor = e.specularIntensity, i.specularColorFactor = e.specularColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1162
+ n.specularFactor = e.specularIntensity, n.specularColorFactor = e.specularColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1126
1163
  }
1127
1164
  }
1128
- class Be {
1165
+ class Pe {
1129
1166
  constructor(e) {
1130
1167
  this.writer = e, this.name = "KHR_materials_sheen";
1131
1168
  }
1132
1169
  async writeMaterialAsync(e, s) {
1133
1170
  if (!e.isMeshPhysicalMaterial || e.sheen == 0) return;
1134
- const n = this.writer, t = n.extensionsUsed, i = {};
1171
+ const r = this.writer, t = r.extensionsUsed, n = {};
1135
1172
  if (e.sheenRoughnessMap) {
1136
- const r = {
1137
- index: await n.processTextureAsync(e.sheenRoughnessMap),
1173
+ const i = {
1174
+ index: await r.processTextureAsync(e.sheenRoughnessMap),
1138
1175
  texCoord: e.sheenRoughnessMap.channel
1139
1176
  };
1140
- n.applyTextureTransform(r, e.sheenRoughnessMap), i.sheenRoughnessTexture = r;
1177
+ r.applyTextureTransform(i, e.sheenRoughnessMap), n.sheenRoughnessTexture = i;
1141
1178
  }
1142
1179
  if (e.sheenColorMap) {
1143
- const r = {
1144
- index: await n.processTextureAsync(e.sheenColorMap),
1180
+ const i = {
1181
+ index: await r.processTextureAsync(e.sheenColorMap),
1145
1182
  texCoord: e.sheenColorMap.channel
1146
1183
  };
1147
- n.applyTextureTransform(r, e.sheenColorMap), i.sheenColorTexture = r;
1184
+ r.applyTextureTransform(i, e.sheenColorMap), n.sheenColorTexture = i;
1148
1185
  }
1149
- i.sheenRoughnessFactor = e.sheenRoughness, i.sheenColorFactor = e.sheenColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1186
+ n.sheenRoughnessFactor = e.sheenRoughness, n.sheenColorFactor = e.sheenColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1150
1187
  }
1151
1188
  }
1152
- class Ge {
1189
+ class Be {
1153
1190
  constructor(e) {
1154
1191
  this.writer = e, this.name = "KHR_materials_anisotropy";
1155
1192
  }
1156
1193
  async writeMaterialAsync(e, s) {
1157
1194
  if (!e.isMeshPhysicalMaterial || e.anisotropy == 0) return;
1158
- const n = this.writer, t = n.extensionsUsed, i = {};
1195
+ const r = this.writer, t = r.extensionsUsed, n = {};
1159
1196
  if (e.anisotropyMap) {
1160
- const r = { index: await n.processTextureAsync(e.anisotropyMap) };
1161
- n.applyTextureTransform(r, e.anisotropyMap), i.anisotropyTexture = r;
1197
+ const i = { index: await r.processTextureAsync(e.anisotropyMap) };
1198
+ r.applyTextureTransform(i, e.anisotropyMap), n.anisotropyTexture = i;
1162
1199
  }
1163
- i.anisotropyStrength = e.anisotropy, i.anisotropyRotation = e.anisotropyRotation, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1200
+ n.anisotropyStrength = e.anisotropy, n.anisotropyRotation = e.anisotropyRotation, s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1164
1201
  }
1165
1202
  }
1166
- class Pe {
1203
+ class Ge {
1167
1204
  constructor(e) {
1168
1205
  this.writer = e, this.name = "KHR_materials_emissive_strength";
1169
1206
  }
1170
1207
  async writeMaterialAsync(e, s) {
1171
1208
  if (!e.isMeshStandardMaterial || e.emissiveIntensity === 1) return;
1172
- const t = this.writer.extensionsUsed, i = {};
1173
- i.emissiveStrength = e.emissiveIntensity, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1209
+ const t = this.writer.extensionsUsed, n = {};
1210
+ n.emissiveStrength = e.emissiveIntensity, s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1174
1211
  }
1175
1212
  }
1176
1213
  class ke {
@@ -1179,15 +1216,15 @@ class ke {
1179
1216
  }
1180
1217
  async writeMaterialAsync(e, s) {
1181
1218
  if (!e.isMeshStandardMaterial || e.bumpScale === 1 && !e.bumpMap) return;
1182
- const n = this.writer, t = n.extensionsUsed, i = {};
1219
+ const r = this.writer, t = r.extensionsUsed, n = {};
1183
1220
  if (e.bumpMap) {
1184
- const r = {
1185
- index: await n.processTextureAsync(e.bumpMap),
1221
+ const i = {
1222
+ index: await r.processTextureAsync(e.bumpMap),
1186
1223
  texCoord: e.bumpMap.channel
1187
1224
  };
1188
- n.applyTextureTransform(r, e.bumpMap), i.bumpTexture = r;
1225
+ r.applyTextureTransform(i, e.bumpMap), n.bumpTexture = i;
1189
1226
  }
1190
- i.bumpFactor = e.bumpScale, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
1227
+ n.bumpFactor = e.bumpScale, s.extensions = s.extensions || {}, s.extensions[this.name] = n, t[this.name] = !0;
1191
1228
  }
1192
1229
  }
1193
1230
  class He {
@@ -1196,91 +1233,91 @@ class He {
1196
1233
  }
1197
1234
  writeNode(e, s) {
1198
1235
  if (!e.isInstancedMesh) return;
1199
- const n = this.writer, t = e, i = new Float32Array(t.count * 3), r = new Float32Array(t.count * 4), o = new Float32Array(t.count * 3), c = new J(), l = new v(), h = new ee(), u = new v();
1200
- for (let f = 0; f < t.count; f++)
1201
- t.getMatrixAt(f, c), c.decompose(l, h, u), l.toArray(i, f * 3), h.toArray(r, f * 4), u.toArray(o, f * 3);
1202
- const T = {
1203
- TRANSLATION: n.processAccessor(new S(i, 3)),
1204
- ROTATION: n.processAccessor(new S(r, 4)),
1205
- SCALE: n.processAccessor(new S(o, 3))
1236
+ const r = this.writer, t = e, n = new Float32Array(t.count * 3), i = new Float32Array(t.count * 4), o = new Float32Array(t.count * 3), c = new Z(), u = new z(), f = new ee(), l = new z();
1237
+ for (let h = 0; h < t.count; h++)
1238
+ t.getMatrixAt(h, c), c.decompose(u, f, l), u.toArray(n, h * 3), f.toArray(i, h * 4), l.toArray(o, h * 3);
1239
+ const g = {
1240
+ TRANSLATION: r.processAccessor(new b(n, 3)),
1241
+ ROTATION: r.processAccessor(new b(i, 4)),
1242
+ SCALE: r.processAccessor(new b(o, 3))
1206
1243
  };
1207
- t.instanceColor && (T._COLOR_0 = n.processAccessor(t.instanceColor)), s.extensions = s.extensions || {}, s.extensions[this.name] = { attributes: T }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
1244
+ t.instanceColor && (g._COLOR_0 = r.processAccessor(t.instanceColor)), s.extensions = s.extensions || {}, s.extensions[this.name] = { attributes: g }, r.extensionsUsed[this.name] = !0, r.extensionsRequired[this.name] = !0;
1208
1245
  }
1209
1246
  }
1210
- H.Utils = {
1247
+ O.Utils = {
1211
1248
  insertKeyframe: function(a, e) {
1212
- const n = a.getValueSize(), t = new a.TimeBufferType(a.times.length + 1), i = new a.ValueBufferType(a.values.length + n), r = a.createInterpolant(new a.ValueBufferType(n));
1249
+ const r = a.getValueSize(), t = new a.TimeBufferType(a.times.length + 1), n = new a.ValueBufferType(a.values.length + r), i = a.createInterpolant(new a.ValueBufferType(r));
1213
1250
  let o;
1214
1251
  if (a.times.length === 0) {
1215
1252
  t[0] = e;
1216
- for (let c = 0; c < n; c++)
1217
- i[c] = 0;
1253
+ for (let c = 0; c < r; c++)
1254
+ n[c] = 0;
1218
1255
  o = 0;
1219
1256
  } else if (e < a.times[0]) {
1220
1257
  if (Math.abs(a.times[0] - e) < 1e-3) return 0;
1221
- t[0] = e, t.set(a.times, 1), i.set(r.evaluate(e), 0), i.set(a.values, n), o = 0;
1258
+ t[0] = e, t.set(a.times, 1), n.set(i.evaluate(e), 0), n.set(a.values, r), o = 0;
1222
1259
  } else if (e > a.times[a.times.length - 1]) {
1223
1260
  if (Math.abs(a.times[a.times.length - 1] - e) < 1e-3)
1224
1261
  return a.times.length - 1;
1225
- t[t.length - 1] = e, t.set(a.times, 0), i.set(a.values, 0), i.set(r.evaluate(e), a.values.length), o = t.length - 1;
1262
+ t[t.length - 1] = e, t.set(a.times, 0), n.set(a.values, 0), n.set(i.evaluate(e), a.values.length), o = t.length - 1;
1226
1263
  } else
1227
1264
  for (let c = 0; c < a.times.length; c++) {
1228
1265
  if (Math.abs(a.times[c] - e) < 1e-3) return c;
1229
1266
  if (a.times[c] < e && a.times[c + 1] > e) {
1230
- t.set(a.times.slice(0, c + 1), 0), t[c + 1] = e, t.set(a.times.slice(c + 1), c + 2), i.set(a.values.slice(0, (c + 1) * n), 0), i.set(r.evaluate(e), (c + 1) * n), i.set(a.values.slice((c + 1) * n), (c + 2) * n), o = c + 1;
1267
+ t.set(a.times.slice(0, c + 1), 0), t[c + 1] = e, t.set(a.times.slice(c + 1), c + 2), n.set(a.values.slice(0, (c + 1) * r), 0), n.set(i.evaluate(e), (c + 1) * r), n.set(a.values.slice((c + 1) * r), (c + 2) * r), o = c + 1;
1231
1268
  break;
1232
1269
  }
1233
1270
  }
1234
- return a.times = t, a.values = i, o;
1271
+ return a.times = t, a.values = n, o;
1235
1272
  },
1236
1273
  mergeMorphTargetTracks: function(a, e) {
1237
- const s = [], n = {}, t = a.tracks;
1238
- for (let i = 0; i < t.length; ++i) {
1239
- let r = t[i];
1240
- const o = z.parseTrackName(r.name), c = z.findNode(e, o.nodeName);
1274
+ const s = [], r = {}, t = a.tracks;
1275
+ for (let n = 0; n < t.length; ++n) {
1276
+ let i = t[n];
1277
+ const o = D.parseTrackName(i.name), c = D.findNode(e, o.nodeName);
1241
1278
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
1242
- s.push(r);
1279
+ s.push(i);
1243
1280
  continue;
1244
1281
  }
1245
- if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
1246
- if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
1282
+ if (i.createInterpolant !== i.InterpolantFactoryMethodDiscrete && i.createInterpolant !== i.InterpolantFactoryMethodLinear) {
1283
+ if (i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
1247
1284
  throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
1248
- console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(Te);
1285
+ console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), i = i.clone(), i.setInterpolation(Te);
1249
1286
  }
1250
- const l = c.morphTargetInfluences.length, h = c.morphTargetDictionary[o.propertyIndex];
1251
- if (h === void 0)
1287
+ const u = c.morphTargetInfluences.length, f = c.morphTargetDictionary[o.propertyIndex];
1288
+ if (f === void 0)
1252
1289
  throw new Error("THREE.GLTFExporter: Morph target name not found: " + o.propertyIndex);
1253
- let u;
1254
- if (n[c.uuid] === void 0) {
1255
- u = r.clone();
1256
- const f = new u.ValueBufferType(l * u.times.length);
1257
- for (let d = 0; d < u.times.length; d++)
1258
- f[d * l + h] = u.values[d];
1259
- u.name = (o.nodeName || "") + ".morphTargetInfluences", u.values = f, n[c.uuid] = u, s.push(u);
1290
+ let l;
1291
+ if (r[c.uuid] === void 0) {
1292
+ l = i.clone();
1293
+ const h = new l.ValueBufferType(u * l.times.length);
1294
+ for (let x = 0; x < l.times.length; x++)
1295
+ h[x * u + f] = l.values[x];
1296
+ l.name = (o.nodeName || "") + ".morphTargetInfluences", l.values = h, r[c.uuid] = l, s.push(l);
1260
1297
  continue;
1261
1298
  }
1262
- const T = r.createInterpolant(new r.ValueBufferType(1));
1263
- u = n[c.uuid];
1264
- for (let f = 0; f < u.times.length; f++)
1265
- u.values[f * l + h] = T.evaluate(u.times[f]);
1266
- for (let f = 0; f < r.times.length; f++) {
1267
- const d = this.insertKeyframe(u, r.times[f]);
1268
- u.values[d * l + h] = r.values[f];
1299
+ const g = i.createInterpolant(new i.ValueBufferType(1));
1300
+ l = r[c.uuid];
1301
+ for (let h = 0; h < l.times.length; h++)
1302
+ l.values[h * u + f] = g.evaluate(l.times[h]);
1303
+ for (let h = 0; h < i.times.length; h++) {
1304
+ const x = this.insertKeyframe(l, i.times[h]);
1305
+ l.values[x * u + f] = i.values[h];
1269
1306
  }
1270
1307
  }
1271
1308
  return a.tracks = s, a;
1272
1309
  },
1273
- toFloat32BufferAttribute: function(a) {
1274
- const e = new S(new Float32Array(a.count * a.itemSize), a.itemSize, !1);
1310
+ toTypedBufferAttribute: function(a, e) {
1311
+ const s = new b(new e(a.count * a.itemSize), a.itemSize, !1);
1275
1312
  if (!a.normalized && !a.isInterleavedBufferAttribute)
1276
- return e.array.set(a.array), e;
1277
- for (let s = 0, n = a.count; s < n; s++)
1278
- for (let t = 0; t < a.itemSize; t++)
1279
- e.setComponent(s, t, a.getComponent(s, t));
1280
- return e;
1313
+ return s.array.set(a.array), s;
1314
+ for (let r = 0, t = a.count; r < t; r++)
1315
+ for (let n = 0; n < a.itemSize; n++)
1316
+ s.setComponent(r, n, a.getComponent(r, n));
1317
+ return s;
1281
1318
  }
1282
1319
  };
1283
1320
  export {
1284
- H as GLTFExporter
1321
+ O as GLTFExporter
1285
1322
  };
1286
- //# sourceMappingURL=GLTFExporter-DiE_HuI6.mjs.map
1323
+ //# sourceMappingURL=GLTFExporter-CXMBueJw.mjs.map