ss-component-new 1.3.658 → 1.3.660

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 (83) hide show
  1. package/dist/_plugin-vue_export-helper-BZ_eTSzz.js +16638 -0
  2. package/dist/config.js +1 -1
  3. package/dist/{index-ChNfRlIP.js → index-BofWylNB.js} +42 -18
  4. package/dist/index-C5rFKP3J.js +1042 -0
  5. package/dist/index-CLw1Ncst.js +181 -0
  6. package/dist/index-Cz0F1nRr.js +8236 -0
  7. package/dist/index-p2dYw5GI.js +49 -0
  8. package/dist/{index.vue_vue_type_script_setup_true_lang-DwbHXtUp.js → index.vue_vue_type_script_setup_true_lang-DRzriV-s.js} +2 -2
  9. package/dist/ss-component.css +2 -8
  10. package/dist/ss-component.js +214 -67
  11. package/dist/ss-component2.js +15 -75
  12. package/dist/ss-component3.js +785 -9
  13. package/package.json +4 -4
  14. package/public/config.js +1 -1
  15. package/dist/MTLLoader-DI0avKtj.js +0 -657
  16. package/dist/URDFLoader-PUxvYFDe.js +0 -2304
  17. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  18. package/dist/animationData-05aVUytq.js +0 -83
  19. package/dist/array-ZM04o_us.js +0 -1044
  20. package/dist/clone-Ddn1p6-1.js +0 -8
  21. package/dist/eleIcon-BWVKfp5t.js +0 -29
  22. package/dist/iconfont-BNdGaGPn.js +0 -1018
  23. package/dist/icons/svg/Update.svg +0 -1
  24. package/dist/icons/svg/functionList.svg +0 -1
  25. package/dist/icons/svg/uploadCopy.svg +0 -1
  26. package/dist/index-9ruiIh9Q.js +0 -30
  27. package/dist/index-BAenzdfB.js +0 -83
  28. package/dist/index-BDhIWgKn.js +0 -658
  29. package/dist/index-BFqUz4pN.js +0 -52
  30. package/dist/index-BIAWyba9.js +0 -2623
  31. package/dist/index-BKJ5SfU0.js +0 -98
  32. package/dist/index-BMr09Ruf.js +0 -107
  33. package/dist/index-BOGJMjxF.js +0 -117
  34. package/dist/index-BP1mKUQP.js +0 -627
  35. package/dist/index-BczRQX8N.js +0 -407
  36. package/dist/index-BnrvtCYj.js +0 -55
  37. package/dist/index-Bpr501oZ.js +0 -78
  38. package/dist/index-Bs7vFXNW.js +0 -93
  39. package/dist/index-BvbZiTVB.js +0 -342
  40. package/dist/index-Bvvz41NY.js +0 -44
  41. package/dist/index-C2YKgxwc.js +0 -61990
  42. package/dist/index-C9DBY1gg.js +0 -103
  43. package/dist/index-CFFbhR3G.js +0 -996
  44. package/dist/index-COr2mcbl.js +0 -48
  45. package/dist/index-CV_jQDcg.js +0 -9
  46. package/dist/index-CXe4q28L.js +0 -447
  47. package/dist/index-CsxH-GEh.js +0 -24847
  48. package/dist/index-D-5v1Jx7.js +0 -93
  49. package/dist/index-D4LcEpQ7.js +0 -619
  50. package/dist/index-DGObzWyL.js +0 -8984
  51. package/dist/index-DJ59jXR0.js +0 -28483
  52. package/dist/index-DJrzqi4-.js +0 -209
  53. package/dist/index-D_kI6aHR.js +0 -98
  54. package/dist/index-Ddhx18T9.js +0 -864
  55. package/dist/index-Dr9Wt5nC.js +0 -84
  56. package/dist/index-Dwt0Wlg_.js +0 -201
  57. package/dist/index-EGwObkob.js +0 -468
  58. package/dist/index-WPJbEuld.js +0 -62
  59. package/dist/index-YVR3acYT.js +0 -61
  60. package/dist/index-dD-mKgue.js +0 -27
  61. package/dist/index-lHjuVdOp.js +0 -11773
  62. package/dist/index-uF-ibwG0.js +0 -9
  63. package/dist/index.vue_vue_type_style_index_0_scoped_39e1db95_lang-CG9X8aa2.js +0 -137728
  64. package/dist/isString-CoCw_sp3.js +0 -8
  65. package/dist/localIcon-CoJHw5ss.js +0 -76
  66. package/dist/main-Bs7Y7gDm.js +0 -502
  67. package/dist/menuIndex-Dt0NyAyE.js +0 -159
  68. package/dist/request-DiogHwkN.js +0 -9465
  69. package/dist/threeModel-C3x2TmUN.js +0 -1108
  70. package/dist/threePreview-BHLSA5YS.js +0 -2259
  71. package/dist/threeSceneView-mfAIunaw.js +0 -1289
  72. package/dist/threeSceneViewForCPMPIP-DrnsTNPv.js +0 -538
  73. package/dist/threeTrackPathView-BR8-g2Tr.js +0 -620
  74. package/dist/threeViewerHost-DbJCLcbz.js +0 -233
  75. package/dist/urdfTree-IEJgkVzs.js +0 -254
  76. package/dist/workpieceTreePanel-aZV2ut3W.js +0 -555
  77. package/public/icons/svg/Update.svg +0 -1
  78. package/public/icons/svg/functionList.svg +0 -1
  79. package/public/icons/svg/uploadCopy.svg +0 -1
  80. /package/dist/icons/svg/{tableClose.svg → table-close.svg} +0 -0
  81. /package/dist/icons/svg/{tableExpand.svg → table-expand.svg} +0 -0
  82. /package/public/icons/svg/{tableClose.svg → table-close.svg} +0 -0
  83. /package/public/icons/svg/{tableExpand.svg → table-expand.svg} +0 -0
@@ -1,2304 +0,0 @@
1
- import { S as Ln } from "./MTLLoader-DI0avKtj.js";
2
- import { b7 as vn, az as Rn, R as lt, an as At, U as In, V as pe, n as he, aJ as dt, S as Mn, aw as Tt, C as ut, p as Le, aQ as ft, b8 as Sn, k as ve, aZ as Se, c as me, ap as On, l as Gn, a4 as Fn, P as ht, aO as Pn, i as qn, ar as jn, j as Un, D as zn, s as pt, at as Et, aW as mt, aY as Hn, u as Bn, Y as we, aR as Dn, a2 as bt, aL as Vn, h as Ce, w as Jn, aM as Wn, aP as Kn, aF as Oe, aH as gt, b9 as Yn, ba as Xn, bb as yt, bc as $n, bd as Zn, be as Qn, bf as ei, a0 as ti, bg as ni, bh as ii, E as si } from "./index.vue_vue_type_style_index_0_scoped_39e1db95_lang-CG9X8aa2.js";
3
- class wt extends vn {
4
- /**
5
- * Constructs a new TGA loader.
6
- *
7
- * @param {LoadingManager} [manager] - The loading manager.
8
- */
9
- constructor(O) {
10
- super(O);
11
- }
12
- /**
13
- * Parses the given TGA texture data.
14
- *
15
- * @param {ArrayBuffer} buffer - The raw texture data.
16
- * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
17
- */
18
- parse(O) {
19
- function Q(f) {
20
- switch (f.image_type) {
21
- // check indexed type
22
- case Ae:
23
- case ee:
24
- if (f.colormap_length > 256 || f.colormap_size !== 24 || f.colormap_type !== 1)
25
- throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");
26
- break;
27
- // check colormap type
28
- case $:
29
- case ie:
30
- case be:
31
- case ye:
32
- if (f.colormap_type)
33
- throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");
34
- break;
35
- // What the need of a file without data ?
36
- case Ne:
37
- throw new Error("THREE.TGALoader: No data.");
38
- // Invalid type ?
39
- default:
40
- throw new Error("THREE.TGALoader: Invalid type " + f.image_type);
41
- }
42
- if (f.width <= 0 || f.height <= 0)
43
- throw new Error("THREE.TGALoader: Invalid image size.");
44
- if (f.pixel_size !== 8 && f.pixel_size !== 16 && f.pixel_size !== 24 && f.pixel_size !== 32)
45
- throw new Error("THREE.TGALoader: Invalid pixel size " + f.pixel_size);
46
- }
47
- function R(f, K, V, H, X) {
48
- let j, B;
49
- const v = V.pixel_size >> 3, _ = V.width * V.height * v;
50
- if (K && (B = X.subarray(H, H += V.colormap_length * (V.colormap_size >> 3))), f) {
51
- j = new Uint8Array(_);
52
- let A, h, T, J = 0;
53
- const le = new Uint8Array(v);
54
- for (; J < _; )
55
- if (A = X[H++], h = (A & 127) + 1, A & 128) {
56
- for (T = 0; T < v; ++T)
57
- le[T] = X[H++];
58
- for (T = 0; T < h; ++T)
59
- j.set(le, J + T * v);
60
- J += v * h;
61
- } else {
62
- for (h *= v, T = 0; T < h; ++T)
63
- j[J + T] = X[H++];
64
- J += h;
65
- }
66
- } else
67
- j = X.subarray(
68
- H,
69
- H += K ? V.width * V.height : _
70
- );
71
- return {
72
- pixel_data: j,
73
- palettes: B
74
- };
75
- }
76
- function se(f, K, V, H, X, j, B, v, _) {
77
- const A = _;
78
- let h, T = 0, J, le;
79
- const Te = L.width;
80
- for (le = K; le !== H; le += V)
81
- for (J = X; J !== B; J += j, T++)
82
- h = v[T], f[(J + Te * le) * 4 + 3] = 255, f[(J + Te * le) * 4 + 2] = A[h * 3 + 0], f[(J + Te * le) * 4 + 1] = A[h * 3 + 1], f[(J + Te * le) * 4 + 0] = A[h * 3 + 2];
83
- return f;
84
- }
85
- function C(f, K, V, H, X, j, B, v) {
86
- let _, A = 0, h, T;
87
- const J = L.width;
88
- for (T = K; T !== H; T += V)
89
- for (h = X; h !== B; h += j, A += 2)
90
- _ = v[A + 0] + (v[A + 1] << 8), f[(h + J * T) * 4 + 0] = (_ & 31744) >> 7, f[(h + J * T) * 4 + 1] = (_ & 992) >> 2, f[(h + J * T) * 4 + 2] = (_ & 31) << 3, f[(h + J * T) * 4 + 3] = _ & 32768 ? 0 : 255;
91
- return f;
92
- }
93
- function oe(f, K, V, H, X, j, B, v) {
94
- let _ = 0, A, h;
95
- const T = L.width;
96
- for (h = K; h !== H; h += V)
97
- for (A = X; A !== B; A += j, _ += 3)
98
- f[(A + T * h) * 4 + 3] = 255, f[(A + T * h) * 4 + 2] = v[_ + 0], f[(A + T * h) * 4 + 1] = v[_ + 1], f[(A + T * h) * 4 + 0] = v[_ + 2];
99
- return f;
100
- }
101
- function I(f, K, V, H, X, j, B, v) {
102
- let _ = 0, A, h;
103
- const T = L.width;
104
- for (h = K; h !== H; h += V)
105
- for (A = X; A !== B; A += j, _ += 4)
106
- f[(A + T * h) * 4 + 2] = v[_ + 0], f[(A + T * h) * 4 + 1] = v[_ + 1], f[(A + T * h) * 4 + 0] = v[_ + 2], f[(A + T * h) * 4 + 3] = v[_ + 3];
107
- return f;
108
- }
109
- function Y(f, K, V, H, X, j, B, v) {
110
- let _, A = 0, h, T;
111
- const J = L.width;
112
- for (T = K; T !== H; T += V)
113
- for (h = X; h !== B; h += j, A++)
114
- _ = v[A], f[(h + J * T) * 4 + 0] = _, f[(h + J * T) * 4 + 1] = _, f[(h + J * T) * 4 + 2] = _, f[(h + J * T) * 4 + 3] = 255;
115
- return f;
116
- }
117
- function ne(f, K, V, H, X, j, B, v) {
118
- let _ = 0, A, h;
119
- const T = L.width;
120
- for (h = K; h !== H; h += V)
121
- for (A = X; A !== B; A += j, _ += 2)
122
- f[(A + T * h) * 4 + 0] = v[_ + 0], f[(A + T * h) * 4 + 1] = v[_ + 0], f[(A + T * h) * 4 + 2] = v[_ + 0], f[(A + T * h) * 4 + 3] = v[_ + 1];
123
- return f;
124
- }
125
- function ke(f, K, V, H, X) {
126
- let j, B, v, _, A, h;
127
- switch ((L.flags & M) >> P) {
128
- default:
129
- case D:
130
- j = 0, v = 1, A = K, B = 0, _ = 1, h = V;
131
- break;
132
- case U:
133
- j = 0, v = 1, A = K, B = V - 1, _ = -1, h = -1;
134
- break;
135
- case S:
136
- j = K - 1, v = -1, A = -1, B = 0, _ = 1, h = V;
137
- break;
138
- case b:
139
- j = K - 1, v = -1, A = -1, B = V - 1, _ = -1, h = -1;
140
- break;
141
- }
142
- if (q)
143
- switch (L.pixel_size) {
144
- case 8:
145
- Y(f, B, _, h, j, v, A, H);
146
- break;
147
- case 16:
148
- ne(f, B, _, h, j, v, A, H);
149
- break;
150
- default:
151
- throw new Error("THREE.TGALoader: Format not supported.");
152
- }
153
- else
154
- switch (L.pixel_size) {
155
- case 8:
156
- se(f, B, _, h, j, v, A, H, X);
157
- break;
158
- case 16:
159
- C(f, B, _, h, j, v, A, H);
160
- break;
161
- case 24:
162
- oe(f, B, _, h, j, v, A, H);
163
- break;
164
- case 32:
165
- I(f, B, _, h, j, v, A, H);
166
- break;
167
- default:
168
- throw new Error("THREE.TGALoader: Format not supported.");
169
- }
170
- return f;
171
- }
172
- const Ne = 0, Ae = 1, $ = 2, ie = 3, ee = 9, be = 10, ye = 11, M = 48, P = 4, U = 0, b = 1, D = 2, S = 3;
173
- if (O.length < 19) throw new Error("THREE.TGALoader: Not enough data to contain header.");
174
- let p = 0;
175
- const d = new Uint8Array(O), L = {
176
- id_length: d[p++],
177
- colormap_type: d[p++],
178
- image_type: d[p++],
179
- colormap_index: d[p++] | d[p++] << 8,
180
- colormap_length: d[p++] | d[p++] << 8,
181
- colormap_size: d[p++],
182
- origin: [
183
- d[p++] | d[p++] << 8,
184
- d[p++] | d[p++] << 8
185
- ],
186
- width: d[p++] | d[p++] << 8,
187
- height: d[p++] | d[p++] << 8,
188
- pixel_size: d[p++],
189
- flags: d[p++]
190
- };
191
- if (Q(L), L.id_length + p > O.length)
192
- throw new Error("THREE.TGALoader: No data.");
193
- p += L.id_length;
194
- let x = !1, k = !1, q = !1;
195
- switch (L.image_type) {
196
- case ee:
197
- x = !0, k = !0;
198
- break;
199
- case Ae:
200
- k = !0;
201
- break;
202
- case be:
203
- x = !0;
204
- break;
205
- case $:
206
- break;
207
- case ye:
208
- x = !0, q = !0;
209
- break;
210
- case ie:
211
- q = !0;
212
- break;
213
- }
214
- const ae = new Uint8Array(L.width * L.height * 4), te = R(x, k, L, p, d);
215
- return ke(ae, L.width, L.height, te.pixel_data, te.palettes), {
216
- data: ae,
217
- width: L.width,
218
- height: L.height,
219
- flipY: !0,
220
- generateMipmaps: !0,
221
- minFilter: Rn
222
- };
223
- }
224
- }
225
- class oi extends lt {
226
- /**
227
- * Starts loading from the given URL and passes the loaded Collada asset
228
- * to the `onLoad()` callback.
229
- *
230
- * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
231
- * @param {function({scene:Group,animations:Array<AnimationClip>,kinematics:Object})} onLoad - Executed when the loading process has been finished.
232
- * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
233
- * @param {onErrorCallback} onError - Executed when errors occur.
234
- */
235
- load(O, Q, R, se) {
236
- const C = this, oe = C.path === "" ? At.extractUrlBase(O) : C.path, I = new In(C.manager);
237
- I.setPath(C.path), I.setRequestHeader(C.requestHeader), I.setWithCredentials(C.withCredentials), I.load(O, function(Y) {
238
- try {
239
- Q(C.parse(Y, oe));
240
- } catch (ne) {
241
- se ? se(ne) : console.error(ne), C.manager.itemError(O);
242
- }
243
- }, R, se);
244
- }
245
- /**
246
- * Parses the given Collada data and returns a result oject holding the parsed scene,
247
- * an array of animation clips and kinematics.
248
- *
249
- * @param {string} text - The raw Collada data as a string.
250
- * @param {string} path - The asset path.
251
- * @return {{scene:Group,animations:Array<AnimationClip>,kinematics:Object}} An object representing the parsed asset.
252
- */
253
- parse(O, Q) {
254
- function R(t, e) {
255
- const i = [], n = t.childNodes;
256
- for (let s = 0, o = n.length; s < o; s++) {
257
- const r = n[s];
258
- r.nodeName === e && i.push(r);
259
- }
260
- return i;
261
- }
262
- function se(t) {
263
- if (t.length === 0) return [];
264
- const e = t.trim().split(/\s+/), i = new Array(e.length);
265
- for (let n = 0, s = e.length; n < s; n++)
266
- i[n] = e[n];
267
- return i;
268
- }
269
- function C(t) {
270
- if (t.length === 0) return [];
271
- const e = t.trim().split(/\s+/), i = new Array(e.length);
272
- for (let n = 0, s = e.length; n < s; n++)
273
- i[n] = parseFloat(e[n]);
274
- return i;
275
- }
276
- function oe(t) {
277
- if (t.length === 0) return [];
278
- const e = t.trim().split(/\s+/), i = new Array(e.length);
279
- for (let n = 0, s = e.length; n < s; n++)
280
- i[n] = parseInt(e[n]);
281
- return i;
282
- }
283
- function I(t) {
284
- return t.substring(1);
285
- }
286
- function Y() {
287
- return "three_default_" + _n++;
288
- }
289
- function ne(t) {
290
- return Object.keys(t).length === 0;
291
- }
292
- function ke(t) {
293
- return {
294
- unit: Ne(R(t, "unit")[0]),
295
- upAxis: Ae(R(t, "up_axis")[0])
296
- };
297
- }
298
- function Ne(t) {
299
- return t !== void 0 && t.hasAttribute("meter") === !0 ? parseFloat(t.getAttribute("meter")) : 1;
300
- }
301
- function Ae(t) {
302
- return t !== void 0 ? t.textContent : "Y_UP";
303
- }
304
- function $(t, e, i, n) {
305
- const s = R(t, e)[0];
306
- if (s !== void 0) {
307
- const o = R(s, i);
308
- for (let r = 0; r < o.length; r++)
309
- n(o[r]);
310
- }
311
- }
312
- function ie(t, e) {
313
- for (const i in t) {
314
- const n = t[i];
315
- n.build = e(t[i]);
316
- }
317
- }
318
- function ee(t, e) {
319
- return t.build !== void 0 || (t.build = e(t)), t.build;
320
- }
321
- function be(t) {
322
- const e = {
323
- sources: {},
324
- samplers: {},
325
- channels: {}
326
- };
327
- let i = !1;
328
- for (let n = 0, s = t.childNodes.length; n < s; n++) {
329
- const o = t.childNodes[n];
330
- if (o.nodeType !== 1) continue;
331
- let r;
332
- switch (o.nodeName) {
333
- case "source":
334
- r = o.getAttribute("id"), e.sources[r] = Ge(o);
335
- break;
336
- case "sampler":
337
- r = o.getAttribute("id"), e.samplers[r] = ye(o);
338
- break;
339
- case "channel":
340
- r = o.getAttribute("target"), e.channels[r] = M(o);
341
- break;
342
- case "animation":
343
- be(o), i = !0;
344
- break;
345
- default:
346
- console.log(o);
347
- }
348
- }
349
- i === !1 && (E.animations[t.getAttribute("id") || Le.generateUUID()] = e);
350
- }
351
- function ye(t) {
352
- const e = {
353
- inputs: {}
354
- };
355
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
356
- const s = t.childNodes[i];
357
- if (s.nodeType === 1)
358
- switch (s.nodeName) {
359
- case "input":
360
- const o = I(s.getAttribute("source")), r = s.getAttribute("semantic");
361
- e.inputs[r] = o;
362
- break;
363
- }
364
- }
365
- return e;
366
- }
367
- function M(t) {
368
- const e = {};
369
- let n = t.getAttribute("target").split("/");
370
- const s = n.shift();
371
- let o = n.shift();
372
- const r = o.indexOf("(") !== -1, u = o.indexOf(".") !== -1;
373
- if (u)
374
- n = o.split("."), o = n.shift(), e.member = n.shift();
375
- else if (r) {
376
- const c = o.split("(");
377
- o = c.shift();
378
- for (let l = 0; l < c.length; l++)
379
- c[l] = parseInt(c[l].replace(/\)/, ""));
380
- e.indices = c;
381
- }
382
- return e.id = s, e.sid = o, e.arraySyntax = r, e.memberSyntax = u, e.sampler = I(t.getAttribute("source")), e;
383
- }
384
- function P(t) {
385
- const e = [], i = t.channels, n = t.samplers, s = t.sources;
386
- for (const o in i)
387
- if (i.hasOwnProperty(o)) {
388
- const r = i[o], u = n[r.sampler], c = u.inputs.INPUT, l = u.inputs.OUTPUT, y = s[c], a = s[l], g = b(r, y, a);
389
- L(g, e);
390
- }
391
- return e;
392
- }
393
- function U(t) {
394
- return ee(E.animations[t], P);
395
- }
396
- function b(t, e, i) {
397
- const n = E.nodes[t.id], s = xe(n.id), o = n.transforms[t.sid], r = n.matrix.clone().transpose();
398
- let u, c, l, y, a, g;
399
- const m = {};
400
- switch (o) {
401
- case "matrix":
402
- for (l = 0, y = e.array.length; l < y; l++)
403
- if (u = e.array[l], c = l * i.stride, m[u] === void 0 && (m[u] = {}), t.arraySyntax === !0) {
404
- const W = i.array[c], z = t.indices[0] + 4 * t.indices[1];
405
- m[u][z] = W;
406
- } else
407
- for (a = 0, g = i.stride; a < g; a++)
408
- m[u][a] = i.array[c + a];
409
- break;
410
- case "translate":
411
- console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', o);
412
- break;
413
- case "rotate":
414
- console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', o);
415
- break;
416
- case "scale":
417
- console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', o);
418
- break;
419
- }
420
- const N = D(m, r);
421
- return {
422
- name: s.uuid,
423
- keyframes: N
424
- };
425
- }
426
- function D(t, e) {
427
- const i = [];
428
- for (const s in t)
429
- i.push({ time: parseFloat(s), value: t[s] });
430
- i.sort(n);
431
- for (let s = 0; s < 16; s++)
432
- x(i, s, e.elements[s]);
433
- return i;
434
- function n(s, o) {
435
- return s.time - o.time;
436
- }
437
- }
438
- const S = new pe(), p = new pe(), d = new Et();
439
- function L(t, e) {
440
- const i = t.keyframes, n = t.name, s = [], o = [], r = [], u = [];
441
- for (let c = 0, l = i.length; c < l; c++) {
442
- const y = i[c], a = y.time, g = y.value;
443
- ce.fromArray(g).transpose(), ce.decompose(S, d, p), s.push(a), o.push(S.x, S.y, S.z), r.push(d.x, d.y, d.z, d.w), u.push(p.x, p.y, p.z);
444
- }
445
- return o.length > 0 && e.push(new mt(n + ".position", s, o)), r.length > 0 && e.push(new Hn(n + ".quaternion", s, r)), u.length > 0 && e.push(new mt(n + ".scale", s, u)), e;
446
- }
447
- function x(t, e, i) {
448
- let n, s = !0, o, r;
449
- for (o = 0, r = t.length; o < r; o++)
450
- n = t[o], n.value[e] === void 0 ? n.value[e] = null : s = !1;
451
- if (s === !0)
452
- for (o = 0, r = t.length; o < r; o++)
453
- n = t[o], n.value[e] = i;
454
- else
455
- k(t, e);
456
- }
457
- function k(t, e) {
458
- let i, n;
459
- for (let s = 0, o = t.length; s < o; s++) {
460
- const r = t[s];
461
- if (r.value[e] === null) {
462
- if (i = q(t, s, e), n = ae(t, s, e), i === null) {
463
- r.value[e] = n.value[e];
464
- continue;
465
- }
466
- if (n === null) {
467
- r.value[e] = i.value[e];
468
- continue;
469
- }
470
- te(r, i, n, e);
471
- }
472
- }
473
- }
474
- function q(t, e, i) {
475
- for (; e >= 0; ) {
476
- const n = t[e];
477
- if (n.value[i] !== null) return n;
478
- e--;
479
- }
480
- return null;
481
- }
482
- function ae(t, e, i) {
483
- for (; e < t.length; ) {
484
- const n = t[e];
485
- if (n.value[i] !== null) return n;
486
- e++;
487
- }
488
- return null;
489
- }
490
- function te(t, e, i, n) {
491
- if (i.time - e.time === 0) {
492
- t.value[n] = e.value[n];
493
- return;
494
- }
495
- t.value[n] = (t.time - e.time) * (i.value[n] - e.value[n]) / (i.time - e.time) + e.value[n];
496
- }
497
- function f(t) {
498
- const e = {
499
- name: t.getAttribute("id") || "default",
500
- start: parseFloat(t.getAttribute("start") || 0),
501
- end: parseFloat(t.getAttribute("end") || 0),
502
- animations: []
503
- };
504
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
505
- const s = t.childNodes[i];
506
- if (s.nodeType === 1)
507
- switch (s.nodeName) {
508
- case "instance_animation":
509
- e.animations.push(I(s.getAttribute("url")));
510
- break;
511
- }
512
- }
513
- E.clips[t.getAttribute("id")] = e;
514
- }
515
- function K(t) {
516
- const e = [], i = t.name, n = t.end - t.start || -1, s = t.animations;
517
- for (let o = 0, r = s.length; o < r; o++) {
518
- const u = U(s[o]);
519
- for (let c = 0, l = u.length; c < l; c++)
520
- e.push(u[c]);
521
- }
522
- return new ft(i, n, e);
523
- }
524
- function V(t) {
525
- return ee(E.clips[t], K);
526
- }
527
- function H(t) {
528
- const e = {};
529
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
530
- const s = t.childNodes[i];
531
- if (s.nodeType === 1)
532
- switch (s.nodeName) {
533
- case "skin":
534
- e.id = I(s.getAttribute("source")), e.skin = X(s);
535
- break;
536
- case "morph":
537
- e.id = I(s.getAttribute("source")), console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");
538
- break;
539
- }
540
- }
541
- E.controllers[t.getAttribute("id")] = e;
542
- }
543
- function X(t) {
544
- const e = {
545
- sources: {}
546
- };
547
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
548
- const s = t.childNodes[i];
549
- if (s.nodeType === 1)
550
- switch (s.nodeName) {
551
- case "bind_shape_matrix":
552
- e.bindShapeMatrix = C(s.textContent);
553
- break;
554
- case "source":
555
- const o = s.getAttribute("id");
556
- e.sources[o] = Ge(s);
557
- break;
558
- case "joints":
559
- e.joints = j(s);
560
- break;
561
- case "vertex_weights":
562
- e.vertexWeights = B(s);
563
- break;
564
- }
565
- }
566
- return e;
567
- }
568
- function j(t) {
569
- const e = {
570
- inputs: {}
571
- };
572
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
573
- const s = t.childNodes[i];
574
- if (s.nodeType === 1)
575
- switch (s.nodeName) {
576
- case "input":
577
- const o = s.getAttribute("semantic"), r = I(s.getAttribute("source"));
578
- e.inputs[o] = r;
579
- break;
580
- }
581
- }
582
- return e;
583
- }
584
- function B(t) {
585
- const e = {
586
- inputs: {}
587
- };
588
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
589
- const s = t.childNodes[i];
590
- if (s.nodeType === 1)
591
- switch (s.nodeName) {
592
- case "input":
593
- const o = s.getAttribute("semantic"), r = I(s.getAttribute("source")), u = parseInt(s.getAttribute("offset"));
594
- e.inputs[o] = { id: r, offset: u };
595
- break;
596
- case "vcount":
597
- e.vcount = oe(s.textContent);
598
- break;
599
- case "v":
600
- e.v = oe(s.textContent);
601
- break;
602
- }
603
- }
604
- return e;
605
- }
606
- function v(t) {
607
- const e = {
608
- id: t.id
609
- }, i = E.geometries[e.id];
610
- return t.skin !== void 0 && (e.skin = _(t.skin), i.sources.skinIndices = e.skin.indices, i.sources.skinWeights = e.skin.weights), e;
611
- }
612
- function _(t) {
613
- const i = {
614
- joints: [],
615
- // this must be an array to preserve the joint order
616
- indices: {
617
- array: [],
618
- stride: 4
619
- },
620
- weights: {
621
- array: [],
622
- stride: 4
623
- }
624
- }, n = t.sources, s = t.vertexWeights, o = s.vcount, r = s.v, u = s.inputs.JOINT.offset, c = s.inputs.WEIGHT.offset, l = t.sources[t.joints.inputs.JOINT], y = t.sources[t.joints.inputs.INV_BIND_MATRIX], a = n[s.inputs.WEIGHT.id].array;
625
- let g = 0, m, N, w;
626
- for (m = 0, w = o.length; m < w; m++) {
627
- const z = o[m], G = [];
628
- for (N = 0; N < z; N++) {
629
- const F = r[g + u], fe = r[g + c], re = a[fe];
630
- G.push({ index: F, weight: re }), g += 2;
631
- }
632
- for (G.sort(W), N = 0; N < 4; N++) {
633
- const F = G[N];
634
- F !== void 0 ? (i.indices.array.push(F.index), i.weights.array.push(F.weight)) : (i.indices.array.push(0), i.weights.array.push(0));
635
- }
636
- }
637
- for (t.bindShapeMatrix ? i.bindMatrix = new he().fromArray(t.bindShapeMatrix).transpose() : i.bindMatrix = new he().identity(), m = 0, w = l.array.length; m < w; m++) {
638
- const z = l.array[m], G = new he().fromArray(y.array, m * y.stride).transpose();
639
- i.joints.push({ name: z, boneInverse: G });
640
- }
641
- return i;
642
- function W(z, G) {
643
- return G.weight - z.weight;
644
- }
645
- }
646
- function A(t) {
647
- return ee(E.controllers[t], v);
648
- }
649
- function h(t) {
650
- const e = {
651
- init_from: R(t, "init_from")[0].textContent
652
- };
653
- E.images[t.getAttribute("id")] = e;
654
- }
655
- function T(t) {
656
- return t.build !== void 0 ? t.build : t.init_from;
657
- }
658
- function J(t) {
659
- const e = E.images[t];
660
- return e !== void 0 ? ee(e, T) : (console.warn("THREE.ColladaLoader: Couldn't find image with ID:", t), null);
661
- }
662
- function le(t) {
663
- const e = {};
664
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
665
- const s = t.childNodes[i];
666
- if (s.nodeType === 1)
667
- switch (s.nodeName) {
668
- case "profile_COMMON":
669
- e.profile = Te(s);
670
- break;
671
- }
672
- }
673
- E.effects[t.getAttribute("id")] = e;
674
- }
675
- function Te(t) {
676
- const e = {
677
- surfaces: {},
678
- samplers: {}
679
- };
680
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
681
- const s = t.childNodes[i];
682
- if (s.nodeType === 1)
683
- switch (s.nodeName) {
684
- case "newparam":
685
- xt(s, e);
686
- break;
687
- case "technique":
688
- e.technique = Lt(s);
689
- break;
690
- case "extra":
691
- e.extra = He(s);
692
- break;
693
- }
694
- }
695
- return e;
696
- }
697
- function xt(t, e) {
698
- const i = t.getAttribute("sid");
699
- for (let n = 0, s = t.childNodes.length; n < s; n++) {
700
- const o = t.childNodes[n];
701
- if (o.nodeType === 1)
702
- switch (o.nodeName) {
703
- case "surface":
704
- e.surfaces[i] = _t(o);
705
- break;
706
- case "sampler2D":
707
- e.samplers[i] = Ct(o);
708
- break;
709
- }
710
- }
711
- }
712
- function _t(t) {
713
- const e = {};
714
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
715
- const s = t.childNodes[i];
716
- if (s.nodeType === 1)
717
- switch (s.nodeName) {
718
- case "init_from":
719
- e.init_from = s.textContent;
720
- break;
721
- }
722
- }
723
- return e;
724
- }
725
- function Ct(t) {
726
- const e = {};
727
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
728
- const s = t.childNodes[i];
729
- if (s.nodeType === 1)
730
- switch (s.nodeName) {
731
- case "source":
732
- e.source = s.textContent;
733
- break;
734
- }
735
- }
736
- return e;
737
- }
738
- function Lt(t) {
739
- const e = {};
740
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
741
- const s = t.childNodes[i];
742
- if (s.nodeType === 1)
743
- switch (s.nodeName) {
744
- case "constant":
745
- case "lambert":
746
- case "blinn":
747
- case "phong":
748
- e.type = s.nodeName, e.parameters = vt(s);
749
- break;
750
- case "extra":
751
- e.extra = He(s);
752
- break;
753
- }
754
- }
755
- return e;
756
- }
757
- function vt(t) {
758
- const e = {};
759
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
760
- const s = t.childNodes[i];
761
- if (s.nodeType === 1)
762
- switch (s.nodeName) {
763
- case "emission":
764
- case "diffuse":
765
- case "specular":
766
- case "bump":
767
- case "ambient":
768
- case "shininess":
769
- case "transparency":
770
- e[s.nodeName] = Ue(s);
771
- break;
772
- case "transparent":
773
- e[s.nodeName] = {
774
- opaque: s.hasAttribute("opaque") ? s.getAttribute("opaque") : "A_ONE",
775
- data: Ue(s)
776
- };
777
- break;
778
- }
779
- }
780
- return e;
781
- }
782
- function Ue(t) {
783
- const e = {};
784
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
785
- const s = t.childNodes[i];
786
- if (s.nodeType === 1)
787
- switch (s.nodeName) {
788
- case "color":
789
- e[s.nodeName] = C(s.textContent);
790
- break;
791
- case "float":
792
- e[s.nodeName] = parseFloat(s.textContent);
793
- break;
794
- case "texture":
795
- e[s.nodeName] = { id: s.getAttribute("texture"), extra: ze(s) };
796
- break;
797
- }
798
- }
799
- return e;
800
- }
801
- function ze(t) {
802
- const e = {
803
- technique: {}
804
- };
805
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
806
- const s = t.childNodes[i];
807
- if (s.nodeType === 1)
808
- switch (s.nodeName) {
809
- case "extra":
810
- Rt(s, e);
811
- break;
812
- }
813
- }
814
- return e;
815
- }
816
- function Rt(t, e) {
817
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
818
- const s = t.childNodes[i];
819
- if (s.nodeType === 1)
820
- switch (s.nodeName) {
821
- case "technique":
822
- It(s, e);
823
- break;
824
- }
825
- }
826
- }
827
- function It(t, e) {
828
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
829
- const s = t.childNodes[i];
830
- if (s.nodeType === 1)
831
- switch (s.nodeName) {
832
- case "repeatU":
833
- case "repeatV":
834
- case "offsetU":
835
- case "offsetV":
836
- e.technique[s.nodeName] = parseFloat(s.textContent);
837
- break;
838
- case "wrapU":
839
- case "wrapV":
840
- s.textContent.toUpperCase() === "TRUE" ? e.technique[s.nodeName] = 1 : s.textContent.toUpperCase() === "FALSE" ? e.technique[s.nodeName] = 0 : e.technique[s.nodeName] = parseInt(s.textContent);
841
- break;
842
- case "bump":
843
- e[s.nodeName] = Be(s);
844
- break;
845
- }
846
- }
847
- }
848
- function He(t) {
849
- const e = {};
850
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
851
- const s = t.childNodes[i];
852
- if (s.nodeType === 1)
853
- switch (s.nodeName) {
854
- case "technique":
855
- e.technique = Mt(s);
856
- break;
857
- }
858
- }
859
- return e;
860
- }
861
- function Mt(t) {
862
- const e = {};
863
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
864
- const s = t.childNodes[i];
865
- if (s.nodeType === 1)
866
- switch (s.nodeName) {
867
- case "double_sided":
868
- e[s.nodeName] = parseInt(s.textContent);
869
- break;
870
- case "bump":
871
- e[s.nodeName] = Be(s);
872
- break;
873
- }
874
- }
875
- return e;
876
- }
877
- function Be(t) {
878
- const e = {};
879
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
880
- const s = t.childNodes[i];
881
- if (s.nodeType === 1)
882
- switch (s.nodeName) {
883
- case "texture":
884
- e[s.nodeName] = { id: s.getAttribute("texture"), texcoord: s.getAttribute("texcoord"), extra: ze(s) };
885
- break;
886
- }
887
- }
888
- return e;
889
- }
890
- function De(t) {
891
- return t;
892
- }
893
- function St(t) {
894
- return ee(E.effects[t], De);
895
- }
896
- function Ot(t) {
897
- const e = {
898
- name: t.getAttribute("name")
899
- };
900
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
901
- const s = t.childNodes[i];
902
- if (s.nodeType === 1)
903
- switch (s.nodeName) {
904
- case "instance_effect":
905
- e.url = I(s.getAttribute("url"));
906
- break;
907
- }
908
- }
909
- E.materials[t.getAttribute("id")] = e;
910
- }
911
- function Gt(t) {
912
- let e, i = t.slice((t.lastIndexOf(".") - 1 >>> 0) + 2);
913
- switch (i = i.toLowerCase(), i) {
914
- case "tga":
915
- e = qe;
916
- break;
917
- default:
918
- e = rt;
919
- }
920
- return e;
921
- }
922
- function Ve(t) {
923
- const e = St(t.url), i = e.profile.technique;
924
- let n;
925
- switch (i.type) {
926
- case "phong":
927
- case "blinn":
928
- n = new ve();
929
- break;
930
- case "lambert":
931
- n = new Sn();
932
- break;
933
- default:
934
- n = new dt();
935
- break;
936
- }
937
- n.name = t.name || "";
938
- function s(c, l = null) {
939
- const y = e.profile.samplers[c.id];
940
- let a = null;
941
- if (y !== void 0) {
942
- const g = e.profile.surfaces[y.source];
943
- a = J(g.init_from);
944
- } else
945
- console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."), a = J(c.id);
946
- if (a !== null) {
947
- const g = Gt(a);
948
- if (g !== void 0) {
949
- const m = g.load(a), N = c.extra;
950
- if (N !== void 0 && N.technique !== void 0 && ne(N.technique) === !1) {
951
- const w = N.technique;
952
- m.wrapS = w.wrapU ? Oe : gt, m.wrapT = w.wrapV ? Oe : gt, m.offset.set(w.offsetU || 0, w.offsetV || 0), m.repeat.set(w.repeatU || 1, w.repeatV || 1);
953
- } else
954
- m.wrapS = Oe, m.wrapT = Oe;
955
- return l !== null && (m.colorSpace = l), m;
956
- } else
957
- return console.warn("THREE.ColladaLoader: Loader for texture %s not found.", a), null;
958
- } else
959
- return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:", c.id), null;
960
- }
961
- const o = i.parameters;
962
- for (const c in o) {
963
- const l = o[c];
964
- switch (c) {
965
- case "diffuse":
966
- l.color && n.color.fromArray(l.color), l.texture && (n.map = s(l.texture, me));
967
- break;
968
- case "specular":
969
- l.color && n.specular && n.specular.fromArray(l.color), l.texture && (n.specularMap = s(l.texture));
970
- break;
971
- case "bump":
972
- l.texture && (n.normalMap = s(l.texture));
973
- break;
974
- case "ambient":
975
- l.texture && (n.lightMap = s(l.texture, me));
976
- break;
977
- case "shininess":
978
- l.float && n.shininess && (n.shininess = l.float);
979
- break;
980
- case "emission":
981
- l.color && n.emissive && n.emissive.fromArray(l.color), l.texture && (n.emissiveMap = s(l.texture, me));
982
- break;
983
- }
984
- }
985
- Se.colorSpaceToWorking(n.color, me), n.specular && Se.colorSpaceToWorking(n.specular, me), n.emissive && Se.colorSpaceToWorking(n.emissive, me);
986
- let r = o.transparent, u = o.transparency;
987
- if (u === void 0 && r && (u = {
988
- float: 1
989
- }), r === void 0 && u && (r = {
990
- opaque: "A_ONE",
991
- data: {
992
- color: [1, 1, 1, 1]
993
- }
994
- }), r && u)
995
- if (r.data.texture)
996
- n.transparent = !0;
997
- else {
998
- const c = r.data.color;
999
- switch (r.opaque) {
1000
- case "A_ONE":
1001
- n.opacity = c[3] * u.float;
1002
- break;
1003
- case "RGB_ZERO":
1004
- n.opacity = 1 - c[0] * u.float;
1005
- break;
1006
- case "A_ZERO":
1007
- n.opacity = 1 - c[3] * u.float;
1008
- break;
1009
- case "RGB_ONE":
1010
- n.opacity = c[0] * u.float;
1011
- break;
1012
- default:
1013
- console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.', r.opaque);
1014
- }
1015
- n.opacity < 1 && (n.transparent = !0);
1016
- }
1017
- if (i.extra !== void 0 && i.extra.technique !== void 0) {
1018
- const c = i.extra.technique;
1019
- for (const l in c) {
1020
- const y = c[l];
1021
- switch (l) {
1022
- case "double_sided":
1023
- n.side = y === 1 ? Gn : Fn;
1024
- break;
1025
- case "bump":
1026
- n.normalMap = s(y.texture), n.normalScale = new On(1, 1);
1027
- break;
1028
- }
1029
- }
1030
- }
1031
- return n;
1032
- }
1033
- function Ft(t) {
1034
- return ee(E.materials[t], Ve);
1035
- }
1036
- function Pt(t) {
1037
- const e = {
1038
- name: t.getAttribute("name")
1039
- };
1040
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
1041
- const s = t.childNodes[i];
1042
- if (s.nodeType === 1)
1043
- switch (s.nodeName) {
1044
- case "optics":
1045
- e.optics = qt(s);
1046
- break;
1047
- }
1048
- }
1049
- E.cameras[t.getAttribute("id")] = e;
1050
- }
1051
- function qt(t) {
1052
- for (let e = 0; e < t.childNodes.length; e++) {
1053
- const i = t.childNodes[e];
1054
- switch (i.nodeName) {
1055
- case "technique_common":
1056
- return jt(i);
1057
- }
1058
- }
1059
- return {};
1060
- }
1061
- function jt(t) {
1062
- const e = {};
1063
- for (let i = 0; i < t.childNodes.length; i++) {
1064
- const n = t.childNodes[i];
1065
- switch (n.nodeName) {
1066
- case "perspective":
1067
- case "orthographic":
1068
- e.technique = n.nodeName, e.parameters = Ut(n);
1069
- break;
1070
- }
1071
- }
1072
- return e;
1073
- }
1074
- function Ut(t) {
1075
- const e = {};
1076
- for (let i = 0; i < t.childNodes.length; i++) {
1077
- const n = t.childNodes[i];
1078
- switch (n.nodeName) {
1079
- case "xfov":
1080
- case "yfov":
1081
- case "xmag":
1082
- case "ymag":
1083
- case "znear":
1084
- case "zfar":
1085
- case "aspect_ratio":
1086
- e[n.nodeName] = parseFloat(n.textContent);
1087
- break;
1088
- }
1089
- }
1090
- return e;
1091
- }
1092
- function Je(t) {
1093
- let e;
1094
- switch (t.optics.technique) {
1095
- case "perspective":
1096
- e = new ht(
1097
- t.optics.parameters.yfov,
1098
- t.optics.parameters.aspect_ratio,
1099
- t.optics.parameters.znear,
1100
- t.optics.parameters.zfar
1101
- );
1102
- break;
1103
- case "orthographic":
1104
- let i = t.optics.parameters.ymag, n = t.optics.parameters.xmag;
1105
- const s = t.optics.parameters.aspect_ratio;
1106
- n = n === void 0 ? i * s : n, i = i === void 0 ? n / s : i, n *= 0.5, i *= 0.5, e = new Pn(
1107
- -n,
1108
- n,
1109
- i,
1110
- -i,
1111
- // left, right, top, bottom
1112
- t.optics.parameters.znear,
1113
- t.optics.parameters.zfar
1114
- );
1115
- break;
1116
- default:
1117
- e = new ht();
1118
- break;
1119
- }
1120
- return e.name = t.name || "", e;
1121
- }
1122
- function zt(t) {
1123
- const e = E.cameras[t];
1124
- return e !== void 0 ? ee(e, Je) : (console.warn("THREE.ColladaLoader: Couldn't find camera with ID:", t), null);
1125
- }
1126
- function Ht(t) {
1127
- let e = {};
1128
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
1129
- const s = t.childNodes[i];
1130
- if (s.nodeType === 1)
1131
- switch (s.nodeName) {
1132
- case "technique_common":
1133
- e = Bt(s);
1134
- break;
1135
- }
1136
- }
1137
- E.lights[t.getAttribute("id")] = e;
1138
- }
1139
- function Bt(t) {
1140
- const e = {};
1141
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
1142
- const s = t.childNodes[i];
1143
- if (s.nodeType === 1)
1144
- switch (s.nodeName) {
1145
- case "directional":
1146
- case "point":
1147
- case "spot":
1148
- case "ambient":
1149
- e.technique = s.nodeName, e.parameters = Dt(s);
1150
- }
1151
- }
1152
- return e;
1153
- }
1154
- function Dt(t) {
1155
- const e = {};
1156
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
1157
- const s = t.childNodes[i];
1158
- if (s.nodeType === 1)
1159
- switch (s.nodeName) {
1160
- case "color":
1161
- const o = C(s.textContent);
1162
- e.color = new ut().fromArray(o), Se.colorSpaceToWorking(e.color, me);
1163
- break;
1164
- case "falloff_angle":
1165
- e.falloffAngle = parseFloat(s.textContent);
1166
- break;
1167
- case "quadratic_attenuation":
1168
- const r = parseFloat(s.textContent);
1169
- e.distance = r ? Math.sqrt(1 / r) : 0;
1170
- break;
1171
- }
1172
- }
1173
- return e;
1174
- }
1175
- function We(t) {
1176
- let e;
1177
- switch (t.technique) {
1178
- case "directional":
1179
- e = new zn();
1180
- break;
1181
- case "point":
1182
- e = new Un();
1183
- break;
1184
- case "spot":
1185
- e = new jn();
1186
- break;
1187
- case "ambient":
1188
- e = new qn();
1189
- break;
1190
- }
1191
- return t.parameters.color && e.color.copy(t.parameters.color), t.parameters.distance && (e.distance = t.parameters.distance), e;
1192
- }
1193
- function Vt(t) {
1194
- const e = E.lights[t];
1195
- return e !== void 0 ? ee(e, We) : (console.warn("THREE.ColladaLoader: Couldn't find light with ID:", t), null);
1196
- }
1197
- function Jt(t) {
1198
- const e = {
1199
- name: t.getAttribute("name"),
1200
- sources: {},
1201
- vertices: {},
1202
- primitives: []
1203
- }, i = R(t, "mesh")[0];
1204
- if (i !== void 0) {
1205
- for (let n = 0; n < i.childNodes.length; n++) {
1206
- const s = i.childNodes[n];
1207
- if (s.nodeType !== 1) continue;
1208
- const o = s.getAttribute("id");
1209
- switch (s.nodeName) {
1210
- case "source":
1211
- e.sources[o] = Ge(s);
1212
- break;
1213
- case "vertices":
1214
- e.vertices = Wt(s);
1215
- break;
1216
- case "polygons":
1217
- console.warn("THREE.ColladaLoader: Unsupported primitive type: ", s.nodeName);
1218
- break;
1219
- case "lines":
1220
- case "linestrips":
1221
- case "polylist":
1222
- case "triangles":
1223
- e.primitives.push(Kt(s));
1224
- break;
1225
- default:
1226
- console.log(s);
1227
- }
1228
- }
1229
- E.geometries[t.getAttribute("id")] = e;
1230
- }
1231
- }
1232
- function Ge(t) {
1233
- const e = {
1234
- array: [],
1235
- stride: 3
1236
- };
1237
- for (let i = 0; i < t.childNodes.length; i++) {
1238
- const n = t.childNodes[i];
1239
- if (n.nodeType === 1)
1240
- switch (n.nodeName) {
1241
- case "float_array":
1242
- e.array = C(n.textContent);
1243
- break;
1244
- case "Name_array":
1245
- e.array = se(n.textContent);
1246
- break;
1247
- case "technique_common":
1248
- const s = R(n, "accessor")[0];
1249
- s !== void 0 && (e.stride = parseInt(s.getAttribute("stride")));
1250
- break;
1251
- }
1252
- }
1253
- return e;
1254
- }
1255
- function Wt(t) {
1256
- const e = {};
1257
- for (let i = 0; i < t.childNodes.length; i++) {
1258
- const n = t.childNodes[i];
1259
- n.nodeType === 1 && (e[n.getAttribute("semantic")] = I(n.getAttribute("source")));
1260
- }
1261
- return e;
1262
- }
1263
- function Kt(t) {
1264
- const e = {
1265
- type: t.nodeName,
1266
- material: t.getAttribute("material"),
1267
- count: parseInt(t.getAttribute("count")),
1268
- inputs: {},
1269
- stride: 0,
1270
- hasUV: !1
1271
- };
1272
- for (let i = 0, n = t.childNodes.length; i < n; i++) {
1273
- const s = t.childNodes[i];
1274
- if (s.nodeType === 1)
1275
- switch (s.nodeName) {
1276
- case "input":
1277
- const o = I(s.getAttribute("source")), r = s.getAttribute("semantic"), u = parseInt(s.getAttribute("offset")), c = parseInt(s.getAttribute("set")), l = c > 0 ? r + c : r;
1278
- e.inputs[l] = { id: o, offset: u }, e.stride = Math.max(e.stride, u + 1), r === "TEXCOORD" && (e.hasUV = !0);
1279
- break;
1280
- case "vcount":
1281
- e.vcount = oe(s.textContent);
1282
- break;
1283
- case "p":
1284
- e.p = oe(s.textContent);
1285
- break;
1286
- }
1287
- }
1288
- return e;
1289
- }
1290
- function Yt(t) {
1291
- const e = {};
1292
- for (let i = 0; i < t.length; i++) {
1293
- const n = t[i];
1294
- e[n.type] === void 0 && (e[n.type] = []), e[n.type].push(n);
1295
- }
1296
- return e;
1297
- }
1298
- function Xt(t) {
1299
- let e = 0;
1300
- for (let i = 0, n = t.length; i < n; i++)
1301
- t[i].hasUV === !0 && e++;
1302
- e > 0 && e < t.length && (t.uvsNeedsFix = !0);
1303
- }
1304
- function Ke(t) {
1305
- const e = {}, i = t.sources, n = t.vertices, s = t.primitives;
1306
- if (s.length === 0) return {};
1307
- const o = Yt(s);
1308
- for (const r in o) {
1309
- const u = o[r];
1310
- Xt(u), e[r] = $t(u, i, n);
1311
- }
1312
- return e;
1313
- }
1314
- function $t(t, e, i) {
1315
- const n = {}, s = { array: [], stride: 0 }, o = { array: [], stride: 0 }, r = { array: [], stride: 0 }, u = { array: [], stride: 0 }, c = { array: [], stride: 0 }, l = { array: [], stride: 4 }, y = { array: [], stride: 4 }, a = new Bn(), g = [];
1316
- let m = 0;
1317
- for (let N = 0; N < t.length; N++) {
1318
- const w = t[N], W = w.inputs;
1319
- let z = 0;
1320
- switch (w.type) {
1321
- case "lines":
1322
- case "linestrips":
1323
- z = w.count * 2;
1324
- break;
1325
- case "triangles":
1326
- z = w.count * 3;
1327
- break;
1328
- case "polylist":
1329
- for (let G = 0; G < w.count; G++) {
1330
- const F = w.vcount[G];
1331
- switch (F) {
1332
- case 3:
1333
- z += 3;
1334
- break;
1335
- case 4:
1336
- z += 6;
1337
- break;
1338
- default:
1339
- z += (F - 2) * 3;
1340
- break;
1341
- }
1342
- }
1343
- break;
1344
- default:
1345
- console.warn("THREE.ColladaLoader: Unknown primitive type:", w.type);
1346
- }
1347
- a.addGroup(m, z, N), m += z, w.material && g.push(w.material);
1348
- for (const G in W) {
1349
- const F = W[G];
1350
- switch (G) {
1351
- case "VERTEX":
1352
- for (const fe in i) {
1353
- const re = i[fe];
1354
- switch (fe) {
1355
- case "POSITION":
1356
- const _e = s.array.length;
1357
- if (de(w, e[re], F.offset, s.array), s.stride = e[re].stride, e.skinWeights && e.skinIndices && (de(w, e.skinIndices, F.offset, l.array), de(w, e.skinWeights, F.offset, y.array)), w.hasUV === !1 && t.uvsNeedsFix === !0) {
1358
- const Cn = (s.array.length - _e) / s.stride;
1359
- for (let ct = 0; ct < Cn; ct++)
1360
- r.array.push(0, 0);
1361
- }
1362
- break;
1363
- case "NORMAL":
1364
- de(w, e[re], F.offset, o.array), o.stride = e[re].stride;
1365
- break;
1366
- case "COLOR":
1367
- de(w, e[re], F.offset, c.array), c.stride = e[re].stride;
1368
- break;
1369
- case "TEXCOORD":
1370
- de(w, e[re], F.offset, r.array), r.stride = e[re].stride;
1371
- break;
1372
- case "TEXCOORD1":
1373
- de(w, e[re], F.offset, u.array), r.stride = e[re].stride;
1374
- break;
1375
- default:
1376
- console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.', fe);
1377
- }
1378
- }
1379
- break;
1380
- case "NORMAL":
1381
- de(w, e[F.id], F.offset, o.array), o.stride = e[F.id].stride;
1382
- break;
1383
- case "COLOR":
1384
- de(w, e[F.id], F.offset, c.array, !0), c.stride = e[F.id].stride;
1385
- break;
1386
- case "TEXCOORD":
1387
- de(w, e[F.id], F.offset, r.array), r.stride = e[F.id].stride;
1388
- break;
1389
- case "TEXCOORD1":
1390
- de(w, e[F.id], F.offset, u.array), u.stride = e[F.id].stride;
1391
- break;
1392
- }
1393
- }
1394
- }
1395
- return s.array.length > 0 && a.setAttribute("position", new we(s.array, s.stride)), o.array.length > 0 && a.setAttribute("normal", new we(o.array, o.stride)), c.array.length > 0 && a.setAttribute("color", new we(c.array, c.stride)), r.array.length > 0 && a.setAttribute("uv", new we(r.array, r.stride)), u.array.length > 0 && a.setAttribute("uv1", new we(u.array, u.stride)), l.array.length > 0 && a.setAttribute("skinIndex", new we(l.array, l.stride)), y.array.length > 0 && a.setAttribute("skinWeight", new we(y.array, y.stride)), n.data = a, n.type = t[0].type, n.materialKeys = g, n;
1396
- }
1397
- function de(t, e, i, n, s = !1) {
1398
- const o = t.p, r = t.stride, u = t.vcount;
1399
- function c(a) {
1400
- let g = o[a + i] * y;
1401
- const m = g + y;
1402
- for (; g < m; g++)
1403
- n.push(l[g]);
1404
- if (s) {
1405
- const N = n.length - y - 1;
1406
- Re.setRGB(
1407
- n[N + 0],
1408
- n[N + 1],
1409
- n[N + 2],
1410
- me
1411
- ), n[N + 0] = Re.r, n[N + 1] = Re.g, n[N + 2] = Re.b;
1412
- }
1413
- }
1414
- const l = e.array, y = e.stride;
1415
- if (t.vcount !== void 0) {
1416
- let a = 0;
1417
- for (let g = 0, m = u.length; g < m; g++) {
1418
- const N = u[g];
1419
- if (N === 4) {
1420
- const w = a + r * 0, W = a + r * 1, z = a + r * 2, G = a + r * 3;
1421
- c(w), c(W), c(G), c(W), c(z), c(G);
1422
- } else if (N === 3) {
1423
- const w = a + r * 0, W = a + r * 1, z = a + r * 2;
1424
- c(w), c(W), c(z);
1425
- } else if (N > 4)
1426
- for (let w = 1, W = N - 2; w <= W; w++) {
1427
- const z = a + r * 0, G = a + r * w, F = a + r * (w + 1);
1428
- c(z), c(G), c(F);
1429
- }
1430
- a += r * N;
1431
- }
1432
- } else
1433
- for (let a = 0, g = o.length; a < g; a += r)
1434
- c(a);
1435
- }
1436
- function Ye(t) {
1437
- return ee(E.geometries[t], Ke);
1438
- }
1439
- function Zt(t) {
1440
- const e = {
1441
- name: t.getAttribute("name") || "",
1442
- joints: {},
1443
- links: []
1444
- };
1445
- for (let i = 0; i < t.childNodes.length; i++) {
1446
- const n = t.childNodes[i];
1447
- if (n.nodeType === 1)
1448
- switch (n.nodeName) {
1449
- case "technique_common":
1450
- tn(n, e);
1451
- break;
1452
- }
1453
- }
1454
- E.kinematicsModels[t.getAttribute("id")] = e;
1455
- }
1456
- function Qt(t) {
1457
- return t.build !== void 0 ? t.build : t;
1458
- }
1459
- function en(t) {
1460
- return ee(E.kinematicsModels[t], Qt);
1461
- }
1462
- function tn(t, e) {
1463
- for (let i = 0; i < t.childNodes.length; i++) {
1464
- const n = t.childNodes[i];
1465
- if (n.nodeType === 1)
1466
- switch (n.nodeName) {
1467
- case "joint":
1468
- e.joints[n.getAttribute("sid")] = nn(n);
1469
- break;
1470
- case "link":
1471
- e.links.push(Xe(n));
1472
- break;
1473
- }
1474
- }
1475
- }
1476
- function nn(t) {
1477
- let e;
1478
- for (let i = 0; i < t.childNodes.length; i++) {
1479
- const n = t.childNodes[i];
1480
- if (n.nodeType === 1)
1481
- switch (n.nodeName) {
1482
- case "prismatic":
1483
- case "revolute":
1484
- e = sn(n);
1485
- break;
1486
- }
1487
- }
1488
- return e;
1489
- }
1490
- function sn(t) {
1491
- const e = {
1492
- sid: t.getAttribute("sid"),
1493
- name: t.getAttribute("name") || "",
1494
- axis: new pe(),
1495
- limits: {
1496
- min: 0,
1497
- max: 0
1498
- },
1499
- type: t.nodeName,
1500
- static: !1,
1501
- zeroPosition: 0,
1502
- middlePosition: 0
1503
- };
1504
- for (let i = 0; i < t.childNodes.length; i++) {
1505
- const n = t.childNodes[i];
1506
- if (n.nodeType === 1)
1507
- switch (n.nodeName) {
1508
- case "axis":
1509
- const s = C(n.textContent);
1510
- e.axis.fromArray(s);
1511
- break;
1512
- case "limits":
1513
- const o = n.getElementsByTagName("max")[0], r = n.getElementsByTagName("min")[0];
1514
- e.limits.max = parseFloat(o.textContent), e.limits.min = parseFloat(r.textContent);
1515
- break;
1516
- }
1517
- }
1518
- return e.limits.min >= e.limits.max && (e.static = !0), e.middlePosition = (e.limits.min + e.limits.max) / 2, e;
1519
- }
1520
- function Xe(t) {
1521
- const e = {
1522
- sid: t.getAttribute("sid"),
1523
- name: t.getAttribute("name") || "",
1524
- attachments: [],
1525
- transforms: []
1526
- };
1527
- for (let i = 0; i < t.childNodes.length; i++) {
1528
- const n = t.childNodes[i];
1529
- if (n.nodeType === 1)
1530
- switch (n.nodeName) {
1531
- case "attachment_full":
1532
- e.attachments.push(on(n));
1533
- break;
1534
- case "matrix":
1535
- case "translate":
1536
- case "rotate":
1537
- e.transforms.push($e(n));
1538
- break;
1539
- }
1540
- }
1541
- return e;
1542
- }
1543
- function on(t) {
1544
- const e = {
1545
- joint: t.getAttribute("joint").split("/").pop(),
1546
- transforms: [],
1547
- links: []
1548
- };
1549
- for (let i = 0; i < t.childNodes.length; i++) {
1550
- const n = t.childNodes[i];
1551
- if (n.nodeType === 1)
1552
- switch (n.nodeName) {
1553
- case "link":
1554
- e.links.push(Xe(n));
1555
- break;
1556
- case "matrix":
1557
- case "translate":
1558
- case "rotate":
1559
- e.transforms.push($e(n));
1560
- break;
1561
- }
1562
- }
1563
- return e;
1564
- }
1565
- function $e(t) {
1566
- const e = {
1567
- type: t.nodeName
1568
- }, i = C(t.textContent);
1569
- switch (e.type) {
1570
- case "matrix":
1571
- e.obj = new he(), e.obj.fromArray(i).transpose();
1572
- break;
1573
- case "translate":
1574
- e.obj = new pe(), e.obj.fromArray(i);
1575
- break;
1576
- case "rotate":
1577
- e.obj = new pe(), e.obj.fromArray(i), e.angle = Le.degToRad(i[3]);
1578
- break;
1579
- }
1580
- return e;
1581
- }
1582
- function rn(t) {
1583
- const e = {
1584
- name: t.getAttribute("name") || "",
1585
- rigidBodies: {}
1586
- };
1587
- for (let i = 0; i < t.childNodes.length; i++) {
1588
- const n = t.childNodes[i];
1589
- if (n.nodeType === 1)
1590
- switch (n.nodeName) {
1591
- case "rigid_body":
1592
- e.rigidBodies[n.getAttribute("name")] = {}, an(n, e.rigidBodies[n.getAttribute("name")]);
1593
- break;
1594
- }
1595
- }
1596
- E.physicsModels[t.getAttribute("id")] = e;
1597
- }
1598
- function an(t, e) {
1599
- for (let i = 0; i < t.childNodes.length; i++) {
1600
- const n = t.childNodes[i];
1601
- if (n.nodeType === 1)
1602
- switch (n.nodeName) {
1603
- case "technique_common":
1604
- cn(n, e);
1605
- break;
1606
- }
1607
- }
1608
- }
1609
- function cn(t, e) {
1610
- for (let i = 0; i < t.childNodes.length; i++) {
1611
- const n = t.childNodes[i];
1612
- if (n.nodeType === 1)
1613
- switch (n.nodeName) {
1614
- case "inertia":
1615
- e.inertia = C(n.textContent);
1616
- break;
1617
- case "mass":
1618
- e.mass = C(n.textContent)[0];
1619
- break;
1620
- }
1621
- }
1622
- }
1623
- function ln(t) {
1624
- const e = {
1625
- bindJointAxis: []
1626
- };
1627
- for (let i = 0; i < t.childNodes.length; i++) {
1628
- const n = t.childNodes[i];
1629
- if (n.nodeType === 1)
1630
- switch (n.nodeName) {
1631
- case "bind_joint_axis":
1632
- e.bindJointAxis.push(dn(n));
1633
- break;
1634
- }
1635
- }
1636
- E.kinematicsScenes[I(t.getAttribute("url"))] = e;
1637
- }
1638
- function dn(t) {
1639
- const e = {
1640
- target: t.getAttribute("target").split("/").pop()
1641
- };
1642
- for (let i = 0; i < t.childNodes.length; i++) {
1643
- const n = t.childNodes[i];
1644
- if (n.nodeType === 1)
1645
- switch (n.nodeName) {
1646
- case "axis":
1647
- const s = n.getElementsByTagName("param")[0];
1648
- e.axis = s.textContent;
1649
- const o = e.axis.split("inst_").pop().split("axis")[0];
1650
- e.jointIndex = o.substring(0, o.length - 1);
1651
- break;
1652
- }
1653
- }
1654
- return e;
1655
- }
1656
- function un(t) {
1657
- return t.build !== void 0 ? t.build : t;
1658
- }
1659
- function fn(t) {
1660
- return ee(E.kinematicsScenes[t], un);
1661
- }
1662
- function hn() {
1663
- const t = Object.keys(E.kinematicsModels)[0], e = Object.keys(E.kinematicsScenes)[0], i = Object.keys(E.visualScenes)[0];
1664
- if (t === void 0 || e === void 0) return;
1665
- const n = en(t), s = fn(e), o = it(i), r = s.bindJointAxis, u = {};
1666
- for (let y = 0, a = r.length; y < a; y++) {
1667
- const g = r[y], m = Z.querySelector('[sid="' + g.target + '"]');
1668
- if (m) {
1669
- const N = m.parentElement;
1670
- c(g.jointIndex, N);
1671
- }
1672
- }
1673
- function c(y, a) {
1674
- const g = a.getAttribute("name"), m = n.joints[y];
1675
- o.traverse(function(N) {
1676
- N.name === g && (u[y] = {
1677
- object: N,
1678
- transforms: pn(a),
1679
- joint: m,
1680
- position: m.zeroPosition
1681
- });
1682
- });
1683
- }
1684
- const l = new he();
1685
- at = {
1686
- joints: n && n.joints,
1687
- getJointValue: function(y) {
1688
- const a = u[y];
1689
- if (a)
1690
- return a.position;
1691
- console.warn("THREE.ColladaLoader: Joint " + y + " doesn't exist.");
1692
- },
1693
- setJointValue: function(y, a) {
1694
- const g = u[y];
1695
- if (g) {
1696
- const m = g.joint;
1697
- if (a > m.limits.max || a < m.limits.min)
1698
- console.warn("THREE.ColladaLoader: Joint " + y + " value " + a + " outside of limits (min: " + m.limits.min + ", max: " + m.limits.max + ").");
1699
- else if (m.static)
1700
- console.warn("THREE.ColladaLoader: Joint " + y + " is static.");
1701
- else {
1702
- const N = g.object, w = m.axis, W = g.transforms;
1703
- ce.identity();
1704
- for (let z = 0; z < W.length; z++) {
1705
- const G = W[z];
1706
- if (G.sid && G.sid.indexOf(y) !== -1)
1707
- switch (m.type) {
1708
- case "revolute":
1709
- ce.multiply(l.makeRotationAxis(w, Le.degToRad(a)));
1710
- break;
1711
- case "prismatic":
1712
- ce.multiply(l.makeTranslation(w.x * a, w.y * a, w.z * a));
1713
- break;
1714
- default:
1715
- console.warn("THREE.ColladaLoader: Unknown joint type: " + m.type);
1716
- break;
1717
- }
1718
- else
1719
- switch (G.type) {
1720
- case "matrix":
1721
- ce.multiply(G.obj);
1722
- break;
1723
- case "translate":
1724
- ce.multiply(l.makeTranslation(G.obj.x, G.obj.y, G.obj.z));
1725
- break;
1726
- case "scale":
1727
- ce.scale(G.obj);
1728
- break;
1729
- case "rotate":
1730
- ce.multiply(l.makeRotationAxis(G.obj, G.angle));
1731
- break;
1732
- }
1733
- }
1734
- N.matrix.copy(ce), N.matrix.decompose(N.position, N.quaternion, N.scale), u[y].position = a;
1735
- }
1736
- } else
1737
- console.log("THREE.ColladaLoader: " + y + " does not exist.");
1738
- }
1739
- };
1740
- }
1741
- function pn(t) {
1742
- const e = [], i = Z.querySelector('[id="' + t.id + '"]');
1743
- for (let n = 0; n < i.childNodes.length; n++) {
1744
- const s = i.childNodes[n];
1745
- if (s.nodeType !== 1) continue;
1746
- let o, r;
1747
- switch (s.nodeName) {
1748
- case "matrix":
1749
- o = C(s.textContent);
1750
- const u = new he().fromArray(o).transpose();
1751
- e.push({
1752
- sid: s.getAttribute("sid"),
1753
- type: s.nodeName,
1754
- obj: u
1755
- });
1756
- break;
1757
- case "translate":
1758
- case "scale":
1759
- o = C(s.textContent), r = new pe().fromArray(o), e.push({
1760
- sid: s.getAttribute("sid"),
1761
- type: s.nodeName,
1762
- obj: r
1763
- });
1764
- break;
1765
- case "rotate":
1766
- o = C(s.textContent), r = new pe().fromArray(o);
1767
- const c = Le.degToRad(o[3]);
1768
- e.push({
1769
- sid: s.getAttribute("sid"),
1770
- type: s.nodeName,
1771
- obj: r,
1772
- angle: c
1773
- });
1774
- break;
1775
- }
1776
- }
1777
- return e;
1778
- }
1779
- function mn(t) {
1780
- const e = t.getElementsByTagName("node");
1781
- for (let i = 0; i < e.length; i++) {
1782
- const n = e[i];
1783
- n.hasAttribute("id") === !1 && n.setAttribute("id", Y());
1784
- }
1785
- }
1786
- const ce = new he(), Ee = new pe();
1787
- function Fe(t) {
1788
- const e = {
1789
- name: t.getAttribute("name") || "",
1790
- type: t.getAttribute("type"),
1791
- id: t.getAttribute("id"),
1792
- sid: t.getAttribute("sid"),
1793
- matrix: new he(),
1794
- nodes: [],
1795
- instanceCameras: [],
1796
- instanceControllers: [],
1797
- instanceLights: [],
1798
- instanceGeometries: [],
1799
- instanceNodes: [],
1800
- transforms: {}
1801
- };
1802
- for (let i = 0; i < t.childNodes.length; i++) {
1803
- const n = t.childNodes[i];
1804
- if (n.nodeType !== 1) continue;
1805
- let s;
1806
- switch (n.nodeName) {
1807
- case "node":
1808
- e.nodes.push(n.getAttribute("id")), Fe(n);
1809
- break;
1810
- case "instance_camera":
1811
- e.instanceCameras.push(I(n.getAttribute("url")));
1812
- break;
1813
- case "instance_controller":
1814
- e.instanceControllers.push(Ze(n));
1815
- break;
1816
- case "instance_light":
1817
- e.instanceLights.push(I(n.getAttribute("url")));
1818
- break;
1819
- case "instance_geometry":
1820
- e.instanceGeometries.push(Ze(n));
1821
- break;
1822
- case "instance_node":
1823
- e.instanceNodes.push(I(n.getAttribute("url")));
1824
- break;
1825
- case "matrix":
1826
- s = C(n.textContent), e.matrix.multiply(ce.fromArray(s).transpose()), e.transforms[n.getAttribute("sid")] = n.nodeName;
1827
- break;
1828
- case "translate":
1829
- s = C(n.textContent), Ee.fromArray(s), e.matrix.multiply(ce.makeTranslation(Ee.x, Ee.y, Ee.z)), e.transforms[n.getAttribute("sid")] = n.nodeName;
1830
- break;
1831
- case "rotate":
1832
- s = C(n.textContent);
1833
- const o = Le.degToRad(s[3]);
1834
- e.matrix.multiply(ce.makeRotationAxis(Ee.fromArray(s), o)), e.transforms[n.getAttribute("sid")] = n.nodeName;
1835
- break;
1836
- case "scale":
1837
- s = C(n.textContent), e.matrix.scale(Ee.fromArray(s)), e.transforms[n.getAttribute("sid")] = n.nodeName;
1838
- break;
1839
- case "extra":
1840
- break;
1841
- default:
1842
- console.log(n);
1843
- }
1844
- }
1845
- return tt(e.id) ? console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.", e.id) : E.nodes[e.id] = e, e;
1846
- }
1847
- function Ze(t) {
1848
- const e = {
1849
- id: I(t.getAttribute("url")),
1850
- materials: {},
1851
- skeletons: []
1852
- };
1853
- for (let i = 0; i < t.childNodes.length; i++) {
1854
- const n = t.childNodes[i];
1855
- switch (n.nodeName) {
1856
- case "bind_material":
1857
- const s = n.getElementsByTagName("instance_material");
1858
- for (let o = 0; o < s.length; o++) {
1859
- const r = s[o], u = r.getAttribute("symbol"), c = r.getAttribute("target");
1860
- e.materials[u] = I(c);
1861
- }
1862
- break;
1863
- case "skeleton":
1864
- e.skeletons.push(I(n.textContent));
1865
- break;
1866
- }
1867
- }
1868
- return e;
1869
- }
1870
- function bn(t, e) {
1871
- const i = [], n = [];
1872
- let s, o, r;
1873
- for (s = 0; s < t.length; s++) {
1874
- const l = t[s];
1875
- let y;
1876
- if (tt(l))
1877
- y = xe(l), Qe(y, e, i);
1878
- else if (Nn(l)) {
1879
- const g = E.visualScenes[l].children;
1880
- for (let m = 0; m < g.length; m++) {
1881
- const N = g[m];
1882
- if (N.type === "JOINT") {
1883
- const w = xe(N.id);
1884
- Qe(w, e, i);
1885
- }
1886
- }
1887
- } else
1888
- console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:", l);
1889
- }
1890
- for (s = 0; s < e.length; s++)
1891
- for (o = 0; o < i.length; o++)
1892
- if (r = i[o], r.bone.name === e[s].name) {
1893
- n[s] = r, r.processed = !0;
1894
- break;
1895
- }
1896
- for (s = 0; s < i.length; s++)
1897
- r = i[s], r.processed === !1 && (n.push(r), r.processed = !0);
1898
- const u = [], c = [];
1899
- for (s = 0; s < n.length; s++)
1900
- r = n[s], u.push(r.bone), c.push(r.boneInverse);
1901
- return new Kn(u, c);
1902
- }
1903
- function Qe(t, e, i) {
1904
- t.traverse(function(n) {
1905
- if (n.isBone === !0) {
1906
- let s;
1907
- for (let o = 0; o < e.length; o++) {
1908
- const r = e[o];
1909
- if (r.name === n.name) {
1910
- s = r.boneInverse;
1911
- break;
1912
- }
1913
- }
1914
- s === void 0 && (s = new he()), i.push({ bone: n, boneInverse: s, processed: !1 });
1915
- }
1916
- });
1917
- }
1918
- function gn(t) {
1919
- const e = [], i = t.matrix, n = t.nodes, s = t.type, o = t.instanceCameras, r = t.instanceControllers, u = t.instanceLights, c = t.instanceGeometries, l = t.instanceNodes;
1920
- for (let a = 0, g = n.length; a < g; a++)
1921
- e.push(xe(n[a]));
1922
- for (let a = 0, g = o.length; a < g; a++) {
1923
- const m = zt(o[a]);
1924
- m !== null && e.push(m.clone());
1925
- }
1926
- for (let a = 0, g = r.length; a < g; a++) {
1927
- const m = r[a], N = A(m.id), w = Ye(N.id), W = et(w, m.materials), z = m.skeletons, G = N.skin.joints, F = bn(z, G);
1928
- for (let fe = 0, re = W.length; fe < re; fe++) {
1929
- const _e = W[fe];
1930
- _e.isSkinnedMesh && (_e.bind(F, N.skin.bindMatrix), _e.normalizeSkinWeights()), e.push(_e);
1931
- }
1932
- }
1933
- for (let a = 0, g = u.length; a < g; a++) {
1934
- const m = Vt(u[a]);
1935
- m !== null && e.push(m.clone());
1936
- }
1937
- for (let a = 0, g = c.length; a < g; a++) {
1938
- const m = c[a], N = Ye(m.id), w = et(N, m.materials);
1939
- for (let W = 0, z = w.length; W < z; W++)
1940
- e.push(w[W]);
1941
- }
1942
- for (let a = 0, g = l.length; a < g; a++)
1943
- e.push(xe(l[a]).clone());
1944
- let y;
1945
- if (n.length === 0 && e.length === 1)
1946
- y = e[0];
1947
- else {
1948
- y = s === "JOINT" ? new Dn() : new pt();
1949
- for (let a = 0; a < e.length; a++)
1950
- y.add(e[a]);
1951
- }
1952
- return y.name = s === "JOINT" ? t.sid : t.name, y.matrix.copy(i), y.matrix.decompose(y.position, y.quaternion, y.scale), y;
1953
- }
1954
- const yn = new dt({
1955
- name: lt.DEFAULT_MATERIAL_NAME,
1956
- color: 16711935
1957
- });
1958
- function wn(t, e) {
1959
- const i = [];
1960
- for (let n = 0, s = t.length; n < s; n++) {
1961
- const o = e[t[n]];
1962
- o === void 0 ? (console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.", t[n]), i.push(yn)) : i.push(Ft(o));
1963
- }
1964
- return i;
1965
- }
1966
- function et(t, e) {
1967
- const i = [];
1968
- for (const n in t) {
1969
- const s = t[n], o = wn(s.materialKeys, e);
1970
- if (o.length === 0 && (n === "lines" || n === "linestrips" ? o.push(new bt()) : o.push(new ve())), n === "lines" || n === "linestrips")
1971
- for (let l = 0, y = o.length; l < y; l++) {
1972
- const a = o[l];
1973
- if (a.isMeshPhongMaterial === !0 || a.isMeshLambertMaterial === !0) {
1974
- const g = new bt();
1975
- g.color.copy(a.color), g.opacity = a.opacity, g.transparent = a.transparent, o[l] = g;
1976
- }
1977
- }
1978
- const r = s.data.attributes.skinIndex !== void 0, u = o.length === 1 ? o[0] : o;
1979
- let c;
1980
- switch (n) {
1981
- case "lines":
1982
- c = new Wn(s.data, u);
1983
- break;
1984
- case "linestrips":
1985
- c = new Jn(s.data, u);
1986
- break;
1987
- case "triangles":
1988
- case "polylist":
1989
- r ? c = new Vn(s.data, u) : c = new Ce(s.data, u);
1990
- break;
1991
- }
1992
- i.push(c);
1993
- }
1994
- return i;
1995
- }
1996
- function tt(t) {
1997
- return E.nodes[t] !== void 0;
1998
- }
1999
- function xe(t) {
2000
- return ee(E.nodes[t], gn);
2001
- }
2002
- function kn(t) {
2003
- const e = {
2004
- name: t.getAttribute("name"),
2005
- children: []
2006
- };
2007
- mn(t);
2008
- const i = R(t, "node");
2009
- for (let n = 0; n < i.length; n++)
2010
- e.children.push(Fe(i[n]));
2011
- E.visualScenes[t.getAttribute("id")] = e;
2012
- }
2013
- function nt(t) {
2014
- const e = new pt();
2015
- e.name = t.name;
2016
- const i = t.children;
2017
- for (let n = 0; n < i.length; n++) {
2018
- const s = i[n];
2019
- e.add(xe(s.id));
2020
- }
2021
- return e;
2022
- }
2023
- function Nn(t) {
2024
- return E.visualScenes[t] !== void 0;
2025
- }
2026
- function it(t) {
2027
- return ee(E.visualScenes[t], nt);
2028
- }
2029
- function An(t) {
2030
- const e = R(t, "instance_visual_scene")[0];
2031
- return it(I(e.getAttribute("url")));
2032
- }
2033
- function Tn() {
2034
- const t = E.clips;
2035
- if (ne(t) === !0) {
2036
- if (ne(E.animations) === !1) {
2037
- const e = [];
2038
- for (const i in E.animations) {
2039
- const n = U(i);
2040
- for (let s = 0, o = n.length; s < o; s++)
2041
- e.push(n[s]);
2042
- }
2043
- Ie.push(new ft("default", -1, e));
2044
- }
2045
- } else
2046
- for (const e in t)
2047
- Ie.push(V(e));
2048
- }
2049
- function En(t) {
2050
- let e = "";
2051
- const i = [t];
2052
- for (; i.length; ) {
2053
- const n = i.shift();
2054
- n.nodeType === Node.TEXT_NODE ? e += n.textContent : (e += `
2055
- `, i.push(...n.childNodes));
2056
- }
2057
- return e.trim();
2058
- }
2059
- if (O.length === 0)
2060
- return { scene: new Mn() };
2061
- const st = new DOMParser().parseFromString(O, "application/xml"), Z = R(st, "COLLADA")[0], Pe = st.getElementsByTagName("parsererror")[0];
2062
- if (Pe !== void 0) {
2063
- const t = R(Pe, "div")[0];
2064
- let e;
2065
- return t ? e = t.textContent : e = En(Pe), console.error(`THREE.ColladaLoader: Failed to parse collada file.
2066
- `, e), null;
2067
- }
2068
- const xn = Z.getAttribute("version");
2069
- console.debug("THREE.ColladaLoader: File version", xn);
2070
- const ot = ke(R(Z, "asset")[0]), rt = new Tt(this.manager);
2071
- rt.setPath(this.resourcePath || Q).setCrossOrigin(this.crossOrigin);
2072
- let qe;
2073
- wt && (qe = new wt(this.manager), qe.setPath(this.resourcePath || Q));
2074
- const Re = new ut(), Ie = [];
2075
- let at = {}, _n = 0;
2076
- const E = {
2077
- animations: {},
2078
- clips: {},
2079
- controllers: {},
2080
- images: {},
2081
- effects: {},
2082
- materials: {},
2083
- cameras: {},
2084
- lights: {},
2085
- geometries: {},
2086
- nodes: {},
2087
- visualScenes: {},
2088
- kinematicsModels: {},
2089
- physicsModels: {},
2090
- kinematicsScenes: {}
2091
- };
2092
- $(Z, "library_animations", "animation", be), $(Z, "library_animation_clips", "animation_clip", f), $(Z, "library_controllers", "controller", H), $(Z, "library_images", "image", h), $(Z, "library_effects", "effect", le), $(Z, "library_materials", "material", Ot), $(Z, "library_cameras", "camera", Pt), $(Z, "library_lights", "light", Ht), $(Z, "library_geometries", "geometry", Jt), $(Z, "library_nodes", "node", Fe), $(Z, "library_visual_scenes", "visual_scene", kn), $(Z, "library_kinematics_models", "kinematics_model", Zt), $(Z, "library_physics_models", "physics_model", rn), $(Z, "scene", "instance_kinematics_scene", ln), ie(E.animations, P), ie(E.clips, K), ie(E.controllers, v), ie(E.images, T), ie(E.effects, De), ie(E.materials, Ve), ie(E.cameras, Je), ie(E.lights, We), ie(E.geometries, Ke), ie(E.visualScenes, nt), Tn(), hn();
2093
- const Me = An(R(Z, "scene")[0]);
2094
- return Me.animations = Ie, ot.upAxis === "Z_UP" && (console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."), Me.rotation.set(-Math.PI / 2, 0, 0)), Me.scale.multiplyScalar(ot.unit), {
2095
- get animations() {
2096
- return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."), Ie;
2097
- },
2098
- kinematics: at,
2099
- library: E,
2100
- scene: Me
2101
- };
2102
- }
2103
- }
2104
- const je = new Et(), kt = new si();
2105
- function ge(ue) {
2106
- return ue ? ue.trim().split(/\s+/g).map((O) => parseFloat(O)) : [0, 0, 0];
2107
- }
2108
- function Nt(ue, O, Q = !1) {
2109
- Q || ue.rotation.set(0, 0, 0), kt.set(O[0], O[1], O[2], "ZYX"), je.setFromEuler(kt), je.multiply(ue.quaternion), ue.quaternion.copy(je);
2110
- }
2111
- class ci {
2112
- constructor(O) {
2113
- this.manager = O || Yn, this.loadMeshCb = this.defaultMeshLoader.bind(this), this.parseVisual = !0, this.parseCollision = !1, this.packages = "", this.workingPath = "", this.fetchOptions = {};
2114
- }
2115
- /* Public API */
2116
- loadAsync(O) {
2117
- return new Promise((Q, R) => {
2118
- this.load(O, Q, null, R);
2119
- });
2120
- }
2121
- // urdf: The path to the URDF within the package OR absolute
2122
- // onComplete: Callback that is passed the model once loaded
2123
- load(O, Q, R, se) {
2124
- const C = this.manager, oe = At.extractUrlBase(O), I = this.manager.resolveURL(O);
2125
- C.itemStart(I), fetch(I, this.fetchOptions).then((Y) => {
2126
- if (Y.ok)
2127
- return R && R(null), Y.text();
2128
- throw new Error(`URDFLoader: Failed to load url '${I}' with error code ${Y.status} : ${Y.statusText}.`);
2129
- }).then((Y) => {
2130
- const ne = this.parse(Y, this.workingPath || oe);
2131
- Q(ne), C.itemEnd(I);
2132
- }).catch((Y) => {
2133
- se ? se(Y) : console.error("URDFLoader: Error loading file.", Y), C.itemError(I), C.itemEnd(I);
2134
- });
2135
- }
2136
- parse(O, Q = this.workingPath) {
2137
- const R = this.packages, se = this.loadMeshCb, C = this.parseVisual, oe = this.parseCollision, I = this.manager, Y = {}, ne = {}, ke = {};
2138
- function Ne(M) {
2139
- if (!/^package:\/\//.test(M))
2140
- return Q ? Q + M : M;
2141
- const [P, U] = M.replace(/^package:\/\//, "").split(/\/(.+)/);
2142
- if (typeof R == "string")
2143
- return R.endsWith(P) ? R + "/" + U : R + "/" + P + "/" + U;
2144
- if (typeof R == "function")
2145
- return R(P) + "/" + U;
2146
- if (typeof R == "object")
2147
- return P in R ? R[P] + "/" + U : (console.error(`URDFLoader : ${P} not found in provided package list.`), null);
2148
- }
2149
- function Ae(M) {
2150
- let P;
2151
- M instanceof Document ? P = [...M.children] : M instanceof Element ? P = [M] : P = [...new DOMParser().parseFromString(M, "text/xml").children];
2152
- const U = P.filter((b) => b.nodeName === "robot").pop();
2153
- return $(U);
2154
- }
2155
- function $(M) {
2156
- const P = [...M.children], U = P.filter((x) => x.nodeName.toLowerCase() === "link"), b = P.filter((x) => x.nodeName.toLowerCase() === "joint"), D = P.filter((x) => x.nodeName.toLowerCase() === "material"), S = new Xn();
2157
- S.robotName = M.getAttribute("name"), S.urdfRobotNode = M, D.forEach((x) => {
2158
- const k = x.getAttribute("name");
2159
- ke[k] = be(x);
2160
- });
2161
- const p = {}, d = {};
2162
- U.forEach((x) => {
2163
- const k = x.getAttribute("name"), q = M.querySelector(`child[link="${k}"]`) === null;
2164
- Y[k] = ee(x, p, d, q ? S : null);
2165
- }), b.forEach((x) => {
2166
- const k = x.getAttribute("name");
2167
- ne[k] = ie(x);
2168
- }), S.joints = ne, S.links = Y, S.colliders = d, S.visual = p;
2169
- const L = Object.values(ne);
2170
- return L.forEach((x) => {
2171
- x instanceof yt && ne[x.mimicJoint].mimicJoints.push(x);
2172
- }), L.forEach((x) => {
2173
- const k = /* @__PURE__ */ new Set(), q = (ae) => {
2174
- if (k.has(ae))
2175
- throw new Error("URDFLoader: Detected an infinite loop of mimic joints.");
2176
- k.add(ae), ae.mimicJoints.forEach((te) => {
2177
- q(te);
2178
- });
2179
- };
2180
- q(x);
2181
- }), S.frames = {
2182
- ...d,
2183
- ...p,
2184
- ...Y,
2185
- ...ne
2186
- }, S;
2187
- }
2188
- function ie(M) {
2189
- const P = [...M.children], U = M.getAttribute("type");
2190
- let b;
2191
- const D = P.find((k) => k.nodeName.toLowerCase() === "mimic");
2192
- D ? (b = new yt(), b.mimicJoint = D.getAttribute("joint"), b.multiplier = parseFloat(D.getAttribute("multiplier") || 1), b.offset = parseFloat(D.getAttribute("offset") || 0)) : b = new $n(), b.urdfNode = M, b.name = M.getAttribute("name"), b.urdfName = b.name, b.jointType = U;
2193
- let S = null, p = null, d = [0, 0, 0], L = [0, 0, 0];
2194
- P.forEach((k) => {
2195
- const q = k.nodeName.toLowerCase();
2196
- q === "origin" ? (d = ge(k.getAttribute("xyz")), L = ge(k.getAttribute("rpy"))) : q === "child" ? p = Y[k.getAttribute("link")] : q === "parent" ? S = Y[k.getAttribute("link")] : q === "limit" && (b.limit.lower = parseFloat(k.getAttribute("lower") || b.limit.lower), b.limit.upper = parseFloat(k.getAttribute("upper") || b.limit.upper), b.limit.effort = parseFloat(k.getAttribute("effort") || b.limit.effort), b.limit.velocity = parseFloat(k.getAttribute("velocity") || b.limit.velocity));
2197
- }), S.add(b), b.add(p), Nt(b, L), b.position.set(d[0], d[1], d[2]);
2198
- const x = P.filter((k) => k.nodeName.toLowerCase() === "axis")[0];
2199
- if (x) {
2200
- const k = x.getAttribute("xyz").split(/\s+/g).map((q) => parseFloat(q));
2201
- b.axis = new pe(k[0], k[1], k[2]), b.axis.normalize();
2202
- }
2203
- return b;
2204
- }
2205
- function ee(M, P, U, b = null) {
2206
- b === null && (b = new Zn());
2207
- const D = [...M.children];
2208
- b.name = M.getAttribute("name"), b.urdfName = b.name, b.urdfNode = M;
2209
- const S = D.find((p) => p.nodeName.toLowerCase() === "inertial");
2210
- return S && [...S.children].forEach((p) => {
2211
- const d = p.nodeName.toLowerCase();
2212
- d === "origin" ? (b.inertial.origin.xyz = ge(p.getAttribute("xyz")), b.inertial.origin.rpy = ge(p.getAttribute("rpy"))) : d === "mass" ? b.inertial.mass = parseFloat(p.getAttribute("value")) || 0 : d === "inertia" && (b.inertial.inertia.ixx = parseFloat(p.getAttribute("ixx")) || 0, b.inertial.inertia.ixy = parseFloat(p.getAttribute("ixy")) || 0, b.inertial.inertia.ixz = parseFloat(p.getAttribute("ixz")) || 0, b.inertial.inertia.iyy = parseFloat(p.getAttribute("iyy")) || 0, b.inertial.inertia.iyz = parseFloat(p.getAttribute("iyz")) || 0, b.inertial.inertia.izz = parseFloat(p.getAttribute("izz")) || 0);
2213
- }), C && D.filter((d) => d.nodeName.toLowerCase() === "visual").forEach((d) => {
2214
- const L = ye(d, ke);
2215
- if (b.add(L), d.hasAttribute("name")) {
2216
- const x = d.getAttribute("name");
2217
- L.name = x, L.urdfName = x, P[x] = L;
2218
- }
2219
- }), oe && D.filter((d) => d.nodeName.toLowerCase() === "collision").forEach((d) => {
2220
- const L = ye(d);
2221
- if (b.add(L), d.hasAttribute("name")) {
2222
- const x = d.getAttribute("name");
2223
- L.name = x, L.urdfName = x, U[x] = L;
2224
- }
2225
- }), b;
2226
- }
2227
- function be(M) {
2228
- const P = [...M.children], U = new ve();
2229
- return U.name = M.getAttribute("name") || "", P.forEach((b) => {
2230
- const D = b.nodeName.toLowerCase();
2231
- if (D === "color") {
2232
- const S = b.getAttribute("rgba").split(/\s/g).map((p) => parseFloat(p));
2233
- U.color.setRGB(S[0], S[1], S[2]), U.opacity = S[3], U.transparent = S[3] < 1, U.depthWrite = !U.transparent;
2234
- } else if (D === "texture") {
2235
- const S = b.getAttribute("filename");
2236
- if (S) {
2237
- const p = new Tt(I), d = Ne(S);
2238
- U.map = p.load(d), U.map.colorSpace = me;
2239
- }
2240
- }
2241
- }), U;
2242
- }
2243
- function ye(M, P = {}) {
2244
- const U = M.nodeName.toLowerCase() === "collision", b = [...M.children];
2245
- let D = null;
2246
- const S = b.filter((d) => d.nodeName.toLowerCase() === "material")[0];
2247
- if (S) {
2248
- const d = S.getAttribute("name");
2249
- d && d in P ? D = P[d] : D = be(S);
2250
- } else
2251
- D = new ve();
2252
- const p = U ? new Qn() : new ei();
2253
- return p.urdfNode = M, b.forEach((d) => {
2254
- const L = d.nodeName.toLowerCase();
2255
- if (L === "geometry") {
2256
- const x = d.children[0].nodeName.toLowerCase();
2257
- if (x === "mesh") {
2258
- const k = d.children[0].getAttribute("filename"), q = Ne(k);
2259
- if (q !== null) {
2260
- const ae = d.children[0].getAttribute("scale");
2261
- if (ae) {
2262
- const te = ge(ae);
2263
- p.scale.set(te[0], te[1], te[2]);
2264
- }
2265
- se(q, I, (te, f) => {
2266
- f ? console.error("URDFLoader: Error loading mesh.", f) : te && (te instanceof Ce && (te.material = D), te.position.set(0, 0, 0), te.quaternion.identity(), p.add(te));
2267
- });
2268
- }
2269
- } else if (x === "box") {
2270
- const k = new Ce();
2271
- k.geometry = new ti(1, 1, 1), k.material = D;
2272
- const q = ge(d.children[0].getAttribute("size"));
2273
- k.scale.set(q[0], q[1], q[2]), p.add(k);
2274
- } else if (x === "sphere") {
2275
- const k = new Ce();
2276
- k.geometry = new ni(1, 30, 30), k.material = D;
2277
- const q = parseFloat(d.children[0].getAttribute("radius")) || 0;
2278
- k.scale.set(q, q, q), p.add(k);
2279
- } else if (x === "cylinder") {
2280
- const k = new Ce();
2281
- k.geometry = new ii(1, 1, 1, 30), k.material = D;
2282
- const q = parseFloat(d.children[0].getAttribute("radius")) || 0, ae = parseFloat(d.children[0].getAttribute("length")) || 0;
2283
- k.scale.set(q, ae, q), k.rotation.set(Math.PI / 2, 0, 0), p.add(k);
2284
- }
2285
- } else if (L === "origin") {
2286
- const x = ge(d.getAttribute("xyz")), k = ge(d.getAttribute("rpy"));
2287
- p.position.set(x[0], x[1], x[2]), p.rotation.set(0, 0, 0), Nt(p, k);
2288
- }
2289
- }), p;
2290
- }
2291
- return Ae(O);
2292
- }
2293
- // Default mesh loading function
2294
- defaultMeshLoader(O, Q, R) {
2295
- /\.stl$/i.test(O) ? new Ln(Q).load(O, (C) => {
2296
- const oe = new Ce(C, new ve());
2297
- R(oe);
2298
- }, null, (C) => R(null, C)) : /\.dae$/i.test(O) ? new oi(Q).load(O, (C) => R(C.scene), null, (C) => R(null, C)) : console.warn(`URDFLoader: Could not load model at ${O}.
2299
- No loader available`);
2300
- }
2301
- }
2302
- export {
2303
- ci as U
2304
- };