ss-component-new 1.1.739 → 1.1.741

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 (80) hide show
  1. package/dist/iconfont-CG2Sal8B.cjs +1 -0
  2. package/dist/{iconfont-qPvAStie.js → iconfont-CfLywbZr.js} +228 -228
  3. package/dist/icons/svg//345/267/262/345/244/204/347/220/206.svg +1 -0
  4. package/dist/icons/svg//345/276/205/345/244/204/347/220/206.svg +1 -0
  5. package/dist/icons/svg//346/200/273/346/234/210/346/212/245.svg +1 -0
  6. package/dist/icons/svg//346/210/221/345/217/221/350/265/267.svg +1 -0
  7. package/dist/icons/svg//350/277/233/345/272/246/350/256/241/345/210/222.svg +1 -0
  8. package/dist/{index-C11jwWIH.js → index-58FSA1fk.js} +1 -1
  9. package/dist/{index-DkhU9Fyq.cjs → index-B23sbyqS.cjs} +1 -1
  10. package/dist/{index-QJ6R_1oH.js → index-B2jHfnBi.js} +1 -1
  11. package/dist/{index-DjvGgBth.cjs → index-BJSVns4w.cjs} +1 -1
  12. package/dist/{index-DHOqgbYN.cjs → index-BOnQNWrS.cjs} +1 -1
  13. package/dist/{index-DWuuoB7a.js → index-BPAaiDYS.js} +2 -2
  14. package/dist/{index-Cfk7SWHy.cjs → index-BguzPlFU.cjs} +1 -1
  15. package/dist/index-Bs3sACSy.cjs +4 -0
  16. package/dist/{index-sv-JcYde.js → index-BxmYY9oi.js} +1 -1
  17. package/dist/{index-Cx7Wv-gm.js → index-C-iXZX_6.js} +1064 -1050
  18. package/dist/{index-CdaMozHe.js → index-C5YXsqdb.js} +12 -12
  19. package/dist/{index-CoQ_M7fB.js → index-CBwFVBlN.js} +1 -1
  20. package/dist/{index-DWx1X-8j.cjs → index-CFW_J0mq.cjs} +1 -1
  21. package/dist/{index-C_ocMwXC.cjs → index-CHookp0n.cjs} +1 -1
  22. package/dist/{index-CDHE_eph.cjs → index-CJKZCT1m.cjs} +1 -1
  23. package/dist/{index-DcNDTCaI.cjs → index-CLSUzeGK.cjs} +1 -1
  24. package/dist/{index-dP3nnmsC.js → index-CPWusFs7.js} +378 -374
  25. package/dist/{index-fCNMafkz.cjs → index-CgkRi40i.cjs} +1 -1
  26. package/dist/{index-CrGEVGu0.cjs → index-ChEr-LD6.cjs} +1 -1
  27. package/dist/{index-DbNp8EFn.js → index-CioBNOFX.js} +1 -1
  28. package/dist/{index-DfZNL6PB.js → index-CrnjysBb.js} +1 -1
  29. package/dist/{index-tmfGfG-O.js → index-CsGu6WZW.js} +2 -2
  30. package/dist/{index-DSUAIjmi.cjs → index-Cu5G4oKN.cjs} +1 -1
  31. package/dist/{index-BocEL4Jl.js → index-DCok5HS5.js} +2 -2
  32. package/dist/{index-BfkgBnPo.js → index-DFOanwRw.js} +4 -4
  33. package/dist/{index-DLjUG_pe.cjs → index-DLzfn6r-.cjs} +1 -1
  34. package/dist/{index-CzB8c7O-.cjs → index-DZiy-zVX.cjs} +2 -2
  35. package/dist/{index-BOQAKRLJ.cjs → index-DvrfOuat.cjs} +1 -1
  36. package/dist/{index-BJqD21GP.cjs → index-DyHucKXC.cjs} +1 -1
  37. package/dist/{index-DG5OVpIW.cjs → index-HV3ortf1.cjs} +1 -1
  38. package/dist/{index-Cf72dK5y.js → index-Ps0cS0S_.js} +1 -1
  39. package/dist/{index-BA3Xvf7Z.cjs → index-QeRTl7fr.cjs} +1 -1
  40. package/dist/{index-CUmC3pQz.js → index-hmAJvmph.js} +4 -4
  41. package/dist/{index-CZW5RoOR.js → index-mFuKOeN3.js} +2 -2
  42. package/dist/{index-DFOiltcr.js → index-qwea9F5R.js} +2 -2
  43. package/dist/{index-BAEPzmDe.js → index-yMjUlsQi.js} +3 -3
  44. package/dist/{index.vue_vue_type_script_setup_true_lang-C02Udtum.js → index.vue_vue_type_script_setup_true_lang-Csfnc8XO.js} +1 -1
  45. package/dist/{index.vue_vue_type_script_setup_true_lang-JkfkJZII.cjs → index.vue_vue_type_script_setup_true_lang-Mwbkilwg.cjs} +1 -1
  46. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C22LuAyj.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CIBPRoRG.js} +1718 -1713
  47. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BFxsYhWZ.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cnqkd37w.cjs} +56 -56
  48. package/dist/{index.vue_vue_type_style_index_0_scoped_c80f0a23_lang-DjkPKUWJ.js → index.vue_vue_type_style_index_0_scoped_8bb4b740_lang-Au5fVfKN.js} +7 -7
  49. package/dist/{index.vue_vue_type_style_index_0_scoped_c80f0a23_lang-DK90dN5m.cjs → index.vue_vue_type_style_index_0_scoped_8bb4b740_lang-CN2oYxtZ.cjs} +1 -1
  50. package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-516uyV3e.cjs → index.vue_vue_type_style_index_0_scoped_c81d0427_lang--PhJifi0.cjs} +1 -1
  51. package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-CqT4MR7v.js → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-DtoSEF10.js} +4 -4
  52. package/dist/{main-DvIAfEIC.cjs → main-BO_aEmJX.cjs} +1 -1
  53. package/dist/{main-C2noB47h.js → main-CjUS4ycM.js} +2 -2
  54. package/dist/obj/model.mtl +42 -0
  55. package/dist/obj/model.obj +26110 -0
  56. package/dist/ss-component.cjs +1 -1
  57. package/dist/ss-component.css +2 -2
  58. package/dist/ss-component.js +8 -8
  59. package/dist/ss-component2.cjs +1 -1
  60. package/dist/ss-component2.js +8 -8
  61. package/dist/{threeModel-BT9NpER2.js → threeModel-Bq0jevec.js} +1 -1
  62. package/dist/{threeModel-BBQKVqka.cjs → threeModel-ChvlK5eB.cjs} +1 -1
  63. package/dist/threePreview-BISgU_nq.cjs +1 -0
  64. package/dist/threePreview-CezYo5_-.js +1960 -0
  65. package/dist/threeSceneView-DY4Gd-tt.js +693 -0
  66. package/dist/threeSceneView-DjveszMP.cjs +1 -0
  67. package/package.json +1 -1
  68. package/public/icons/svg//345/267/262/345/244/204/347/220/206.svg +1 -0
  69. package/public/icons/svg//345/276/205/345/244/204/347/220/206.svg +1 -0
  70. package/public/icons/svg//346/200/273/346/234/210/346/212/245.svg +1 -0
  71. package/public/icons/svg//346/210/221/345/217/221/350/265/267.svg +1 -0
  72. package/public/icons/svg//350/277/233/345/272/246/350/256/241/345/210/222.svg +1 -0
  73. package/public/obj/model.mtl +42 -0
  74. package/public/obj/model.obj +26110 -0
  75. package/dist/iconfont-CZ4r8Axf.cjs +0 -1
  76. package/dist/index-CF5qxKRT.cjs +0 -4
  77. package/dist/threePreview-CRHgbXLA.cjs +0 -1
  78. package/dist/threePreview-lVI_SBuS.js +0 -1972
  79. package/dist/threeSceneView-Bvl4g83Z.js +0 -889
  80. package/dist/threeSceneView-COPlmNqY.cjs +0 -1
@@ -1,1972 +0,0 @@
1
- import { ref as G, shallowRef as We, defineComponent as Ye, watch as te, onMounted as $e, nextTick as Je, onBeforeUnmount as Qe, resolveComponent as Ze, createElementBlock as ne, openBlock as se, createElementVNode as _, withDirectives as X, createCommentVNode as xe, createVNode as B, unref as N, toDisplayString as Re, withCtx as et, isRef as J, vModelRadio as Q, vShow as tt } from "vue";
2
- import { u as nt, a as st, b as rt, S as z } from "./iconfont-qPvAStie.js";
3
- import { ag as it, ah as ue, ai as Ce, q as ot, x as Y, F as Oe, aj as O, Q as ve, C as j, ak as k, b as $, Y as at, g as ct, D as lt, k as Z, V as K, al as ut, Z as Pe, am as ft, a8 as ke, z as dt, an as ht, ae as re, ao as pt, w as Fe, ap as mt, aq as gt, ar as Tt, as as fe, at as De, a6 as de, au as xt, a7 as Rt, t as Et, av as ie, a1 as At, ad as He, i as Lt, y as W, aw as _t, r as Mt, a2 as wt, e as Ue, a4 as yt, a3 as bt, ax as St, u as Nt, n as oe, P as It, l as Ct, U as Ot, a5 as vt, J as Pt, a0 as kt, ay as Ft, az as Ge, aA as Dt, aB as Ee, _ as Ae, aC as Le, $ as _e, N as Me, R as Ht, aD as Ut, B as je, aE as Gt, p as jt, O as Bt, o as Kt, h as Vt } from "./STLLoader-DofhZbOw.js";
4
- import { E as we } from "./index-DHX6rKjz.js";
5
- import { _ as Xt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
- function ye(f, t) {
7
- if (t === it)
8
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), f;
9
- if (t === ue || t === Ce) {
10
- let e = f.getIndex();
11
- if (e === null) {
12
- const r = [], a = f.getAttribute("position");
13
- if (a !== void 0) {
14
- for (let o = 0; o < a.count; o++)
15
- r.push(o);
16
- f.setIndex(r), e = f.getIndex();
17
- } else
18
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), f;
19
- }
20
- const i = e.count - 2, n = [];
21
- if (t === ue)
22
- for (let r = 1; r <= i; r++)
23
- n.push(e.getX(0)), n.push(e.getX(r)), n.push(e.getX(r + 1));
24
- else
25
- for (let r = 0; r < i; r++)
26
- r % 2 === 0 ? (n.push(e.getX(r)), n.push(e.getX(r + 1)), n.push(e.getX(r + 2))) : (n.push(e.getX(r + 2)), n.push(e.getX(r + 1)), n.push(e.getX(r)));
27
- n.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
28
- const s = f.clone();
29
- return s.setIndex(n), s.clearGroups(), s;
30
- } else
31
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), f;
32
- }
33
- class zt extends ot {
34
- /**
35
- * Constructs a new glTF loader.
36
- *
37
- * @param {LoadingManager} [manager] - The loading manager.
38
- */
39
- constructor(t) {
40
- super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
41
- return new Jt(e);
42
- }), this.register(function(e) {
43
- return new Qt(e);
44
- }), this.register(function(e) {
45
- return new cn(e);
46
- }), this.register(function(e) {
47
- return new ln(e);
48
- }), this.register(function(e) {
49
- return new un(e);
50
- }), this.register(function(e) {
51
- return new en(e);
52
- }), this.register(function(e) {
53
- return new tn(e);
54
- }), this.register(function(e) {
55
- return new nn(e);
56
- }), this.register(function(e) {
57
- return new sn(e);
58
- }), this.register(function(e) {
59
- return new $t(e);
60
- }), this.register(function(e) {
61
- return new rn(e);
62
- }), this.register(function(e) {
63
- return new Zt(e);
64
- }), this.register(function(e) {
65
- return new an(e);
66
- }), this.register(function(e) {
67
- return new on(e);
68
- }), this.register(function(e) {
69
- return new Wt(e);
70
- }), this.register(function(e) {
71
- return new fn(e);
72
- }), this.register(function(e) {
73
- return new dn(e);
74
- });
75
- }
76
- /**
77
- * Starts loading from the given URL and passes the loaded glTF asset
78
- * to the `onLoad()` callback.
79
- *
80
- * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
81
- * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
82
- * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
83
- * @param {onErrorCallback} onError - Executed when errors occur.
84
- */
85
- load(t, e, i, n) {
86
- const s = this;
87
- let r;
88
- if (this.resourcePath !== "")
89
- r = this.resourcePath;
90
- else if (this.path !== "") {
91
- const c = Y.extractUrlBase(t);
92
- r = Y.resolveURL(c, this.path);
93
- } else
94
- r = Y.extractUrlBase(t);
95
- this.manager.itemStart(t);
96
- const a = function(c) {
97
- n ? n(c) : console.error(c), s.manager.itemError(t), s.manager.itemEnd(t);
98
- }, o = new Oe(this.manager);
99
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
100
- try {
101
- s.parse(c, r, function(u) {
102
- e(u), s.manager.itemEnd(t);
103
- }, a);
104
- } catch (u) {
105
- a(u);
106
- }
107
- }, i, a);
108
- }
109
- /**
110
- * Sets the given Draco loader to this loader. Required for decoding assets
111
- * compressed with the `KHR_draco_mesh_compression` extension.
112
- *
113
- * @param {DRACOLoader} dracoLoader - The Draco loader to set.
114
- * @return {GLTFLoader} A reference to this loader.
115
- */
116
- setDRACOLoader(t) {
117
- return this.dracoLoader = t, this;
118
- }
119
- /**
120
- * Sets the given KTX2 loader to this loader. Required for loading KTX2
121
- * compressed textures.
122
- *
123
- * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
124
- * @return {GLTFLoader} A reference to this loader.
125
- */
126
- setKTX2Loader(t) {
127
- return this.ktx2Loader = t, this;
128
- }
129
- /**
130
- * Sets the given meshopt decoder. Required for decoding assets
131
- * compressed with the `EXT_meshopt_compression` extension.
132
- *
133
- * @param {Object} meshoptDecoder - The meshopt decoder to set.
134
- * @return {GLTFLoader} A reference to this loader.
135
- */
136
- setMeshoptDecoder(t) {
137
- return this.meshoptDecoder = t, this;
138
- }
139
- /**
140
- * Registers a plugin callback. This API is internally used to implement the various
141
- * glTF extensions but can also used by third-party code to add additional logic
142
- * to the loader.
143
- *
144
- * @param {function(parser:GLTFParser)} callback - The callback function to register.
145
- * @return {GLTFLoader} A reference to this loader.
146
- */
147
- register(t) {
148
- return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
149
- }
150
- /**
151
- * Unregisters a plugin callback.
152
- *
153
- * @param {Function} callback - The callback function to unregister.
154
- * @return {GLTFLoader} A reference to this loader.
155
- */
156
- unregister(t) {
157
- return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
158
- }
159
- /**
160
- * Parses the given FBX data and returns the resulting group.
161
- *
162
- * @param {string|ArrayBuffer} data - The raw glTF data.
163
- * @param {string} path - The URL base path.
164
- * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
165
- * @param {onErrorCallback} onError - Executed when errors occur.
166
- */
167
- parse(t, e, i, n) {
168
- let s;
169
- const r = {}, a = {}, o = new TextDecoder();
170
- if (typeof t == "string")
171
- s = JSON.parse(t);
172
- else if (t instanceof ArrayBuffer)
173
- if (o.decode(new Uint8Array(t, 0, 4)) === Be) {
174
- try {
175
- r[E.KHR_BINARY_GLTF] = new hn(t);
176
- } catch (l) {
177
- n && n(l);
178
- return;
179
- }
180
- s = JSON.parse(r[E.KHR_BINARY_GLTF].content);
181
- } else
182
- s = JSON.parse(o.decode(t));
183
- else
184
- s = t;
185
- if (s.asset === void 0 || s.asset.version[0] < 2) {
186
- n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
187
- return;
188
- }
189
- const c = new yn(s, {
190
- path: e || this.resourcePath || "",
191
- crossOrigin: this.crossOrigin,
192
- requestHeader: this.requestHeader,
193
- manager: this.manager,
194
- ktx2Loader: this.ktx2Loader,
195
- meshoptDecoder: this.meshoptDecoder
196
- });
197
- c.fileLoader.setRequestHeader(this.requestHeader);
198
- for (let u = 0; u < this.pluginCallbacks.length; u++) {
199
- const l = this.pluginCallbacks[u](c);
200
- l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, r[l.name] = !0;
201
- }
202
- if (s.extensionsUsed)
203
- for (let u = 0; u < s.extensionsUsed.length; ++u) {
204
- const l = s.extensionsUsed[u], d = s.extensionsRequired || [];
205
- switch (l) {
206
- case E.KHR_MATERIALS_UNLIT:
207
- r[l] = new Yt();
208
- break;
209
- case E.KHR_DRACO_MESH_COMPRESSION:
210
- r[l] = new pn(s, this.dracoLoader);
211
- break;
212
- case E.KHR_TEXTURE_TRANSFORM:
213
- r[l] = new mn();
214
- break;
215
- case E.KHR_MESH_QUANTIZATION:
216
- r[l] = new gn();
217
- break;
218
- default:
219
- d.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
220
- }
221
- }
222
- c.setExtensions(r), c.setPlugins(a), c.parse(i, n);
223
- }
224
- /**
225
- * Async version of {@link GLTFLoader#parse}.
226
- *
227
- * @async
228
- * @param {string|ArrayBuffer} data - The raw glTF data.
229
- * @param {string} path - The URL base path.
230
- * @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
231
- */
232
- parseAsync(t, e) {
233
- const i = this;
234
- return new Promise(function(n, s) {
235
- i.parse(t, e, n, s);
236
- });
237
- }
238
- }
239
- function qt() {
240
- let f = {};
241
- return {
242
- get: function(t) {
243
- return f[t];
244
- },
245
- add: function(t, e) {
246
- f[t] = e;
247
- },
248
- remove: function(t) {
249
- delete f[t];
250
- },
251
- removeAll: function() {
252
- f = {};
253
- }
254
- };
255
- }
256
- const E = {
257
- KHR_BINARY_GLTF: "KHR_binary_glTF",
258
- KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
259
- KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
260
- KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
261
- KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
262
- KHR_MATERIALS_IOR: "KHR_materials_ior",
263
- KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
264
- KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
265
- KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
266
- KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
267
- KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
268
- KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
269
- KHR_MATERIALS_VOLUME: "KHR_materials_volume",
270
- KHR_TEXTURE_BASISU: "KHR_texture_basisu",
271
- KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
272
- KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
273
- KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
274
- EXT_MATERIALS_BUMP: "EXT_materials_bump",
275
- EXT_TEXTURE_WEBP: "EXT_texture_webp",
276
- EXT_TEXTURE_AVIF: "EXT_texture_avif",
277
- EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
278
- EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
279
- };
280
- class Wt {
281
- constructor(t) {
282
- this.parser = t, this.name = E.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
283
- }
284
- _markDefs() {
285
- const t = this.parser, e = this.parser.json.nodes || [];
286
- for (let i = 0, n = e.length; i < n; i++) {
287
- const s = e[i];
288
- s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, s.extensions[this.name].light);
289
- }
290
- }
291
- _loadLight(t) {
292
- const e = this.parser, i = "light:" + t;
293
- let n = e.cache.get(i);
294
- if (n) return n;
295
- const s = e.json, o = ((s.extensions && s.extensions[this.name] || {}).lights || [])[t];
296
- let c;
297
- const u = new j(16777215);
298
- o.color !== void 0 && u.setRGB(o.color[0], o.color[1], o.color[2], k);
299
- const l = o.range !== void 0 ? o.range : 0;
300
- switch (o.type) {
301
- case "directional":
302
- c = new lt(u), c.target.position.set(0, 0, -1), c.add(c.target);
303
- break;
304
- case "point":
305
- c = new ct(u), c.distance = l;
306
- break;
307
- case "spot":
308
- c = new at(u), c.distance = l, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
309
- break;
310
- default:
311
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
312
- }
313
- return c.position.set(0, 0, 0), P(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + t), n = Promise.resolve(c), e.cache.add(i, n), n;
314
- }
315
- getDependency(t, e) {
316
- if (t === "light")
317
- return this._loadLight(e);
318
- }
319
- createNodeAttachment(t) {
320
- const e = this, i = this.parser, s = i.json.nodes[t], a = (s.extensions && s.extensions[this.name] || {}).light;
321
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
322
- return i._getNodeRef(e.cache, a, o);
323
- });
324
- }
325
- }
326
- class Yt {
327
- constructor() {
328
- this.name = E.KHR_MATERIALS_UNLIT;
329
- }
330
- getMaterialType() {
331
- return W;
332
- }
333
- extendParams(t, e, i) {
334
- const n = [];
335
- t.color = new j(1, 1, 1), t.opacity = 1;
336
- const s = e.pbrMetallicRoughness;
337
- if (s) {
338
- if (Array.isArray(s.baseColorFactor)) {
339
- const r = s.baseColorFactor;
340
- t.color.setRGB(r[0], r[1], r[2], k), t.opacity = r[3];
341
- }
342
- s.baseColorTexture !== void 0 && n.push(i.assignTexture(t, "map", s.baseColorTexture, $));
343
- }
344
- return Promise.all(n);
345
- }
346
- }
347
- class $t {
348
- constructor(t) {
349
- this.parser = t, this.name = E.KHR_MATERIALS_EMISSIVE_STRENGTH;
350
- }
351
- extendMaterialParams(t, e) {
352
- const n = this.parser.json.materials[t];
353
- if (!n.extensions || !n.extensions[this.name])
354
- return Promise.resolve();
355
- const s = n.extensions[this.name].emissiveStrength;
356
- return s !== void 0 && (e.emissiveIntensity = s), Promise.resolve();
357
- }
358
- }
359
- class Jt {
360
- constructor(t) {
361
- this.parser = t, this.name = E.KHR_MATERIALS_CLEARCOAT;
362
- }
363
- getMaterialType(t) {
364
- const i = this.parser.json.materials[t];
365
- return !i.extensions || !i.extensions[this.name] ? null : O;
366
- }
367
- extendMaterialParams(t, e) {
368
- const i = this.parser, n = i.json.materials[t];
369
- if (!n.extensions || !n.extensions[this.name])
370
- return Promise.resolve();
371
- const s = [], r = n.extensions[this.name];
372
- if (r.clearcoatFactor !== void 0 && (e.clearcoat = r.clearcoatFactor), r.clearcoatTexture !== void 0 && s.push(i.assignTexture(e, "clearcoatMap", r.clearcoatTexture)), r.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = r.clearcoatRoughnessFactor), r.clearcoatRoughnessTexture !== void 0 && s.push(i.assignTexture(e, "clearcoatRoughnessMap", r.clearcoatRoughnessTexture)), r.clearcoatNormalTexture !== void 0 && (s.push(i.assignTexture(e, "clearcoatNormalMap", r.clearcoatNormalTexture)), r.clearcoatNormalTexture.scale !== void 0)) {
373
- const a = r.clearcoatNormalTexture.scale;
374
- e.clearcoatNormalScale = new ve(a, a);
375
- }
376
- return Promise.all(s);
377
- }
378
- }
379
- class Qt {
380
- constructor(t) {
381
- this.parser = t, this.name = E.KHR_MATERIALS_DISPERSION;
382
- }
383
- getMaterialType(t) {
384
- const i = this.parser.json.materials[t];
385
- return !i.extensions || !i.extensions[this.name] ? null : O;
386
- }
387
- extendMaterialParams(t, e) {
388
- const n = this.parser.json.materials[t];
389
- if (!n.extensions || !n.extensions[this.name])
390
- return Promise.resolve();
391
- const s = n.extensions[this.name];
392
- return e.dispersion = s.dispersion !== void 0 ? s.dispersion : 0, Promise.resolve();
393
- }
394
- }
395
- class Zt {
396
- constructor(t) {
397
- this.parser = t, this.name = E.KHR_MATERIALS_IRIDESCENCE;
398
- }
399
- getMaterialType(t) {
400
- const i = this.parser.json.materials[t];
401
- return !i.extensions || !i.extensions[this.name] ? null : O;
402
- }
403
- extendMaterialParams(t, e) {
404
- const i = this.parser, n = i.json.materials[t];
405
- if (!n.extensions || !n.extensions[this.name])
406
- return Promise.resolve();
407
- const s = [], r = n.extensions[this.name];
408
- return r.iridescenceFactor !== void 0 && (e.iridescence = r.iridescenceFactor), r.iridescenceTexture !== void 0 && s.push(i.assignTexture(e, "iridescenceMap", r.iridescenceTexture)), r.iridescenceIor !== void 0 && (e.iridescenceIOR = r.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), r.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = r.iridescenceThicknessMinimum), r.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = r.iridescenceThicknessMaximum), r.iridescenceThicknessTexture !== void 0 && s.push(i.assignTexture(e, "iridescenceThicknessMap", r.iridescenceThicknessTexture)), Promise.all(s);
409
- }
410
- }
411
- class en {
412
- constructor(t) {
413
- this.parser = t, this.name = E.KHR_MATERIALS_SHEEN;
414
- }
415
- getMaterialType(t) {
416
- const i = this.parser.json.materials[t];
417
- return !i.extensions || !i.extensions[this.name] ? null : O;
418
- }
419
- extendMaterialParams(t, e) {
420
- const i = this.parser, n = i.json.materials[t];
421
- if (!n.extensions || !n.extensions[this.name])
422
- return Promise.resolve();
423
- const s = [];
424
- e.sheenColor = new j(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
425
- const r = n.extensions[this.name];
426
- if (r.sheenColorFactor !== void 0) {
427
- const a = r.sheenColorFactor;
428
- e.sheenColor.setRGB(a[0], a[1], a[2], k);
429
- }
430
- return r.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = r.sheenRoughnessFactor), r.sheenColorTexture !== void 0 && s.push(i.assignTexture(e, "sheenColorMap", r.sheenColorTexture, $)), r.sheenRoughnessTexture !== void 0 && s.push(i.assignTexture(e, "sheenRoughnessMap", r.sheenRoughnessTexture)), Promise.all(s);
431
- }
432
- }
433
- class tn {
434
- constructor(t) {
435
- this.parser = t, this.name = E.KHR_MATERIALS_TRANSMISSION;
436
- }
437
- getMaterialType(t) {
438
- const i = this.parser.json.materials[t];
439
- return !i.extensions || !i.extensions[this.name] ? null : O;
440
- }
441
- extendMaterialParams(t, e) {
442
- const i = this.parser, n = i.json.materials[t];
443
- if (!n.extensions || !n.extensions[this.name])
444
- return Promise.resolve();
445
- const s = [], r = n.extensions[this.name];
446
- return r.transmissionFactor !== void 0 && (e.transmission = r.transmissionFactor), r.transmissionTexture !== void 0 && s.push(i.assignTexture(e, "transmissionMap", r.transmissionTexture)), Promise.all(s);
447
- }
448
- }
449
- class nn {
450
- constructor(t) {
451
- this.parser = t, this.name = E.KHR_MATERIALS_VOLUME;
452
- }
453
- getMaterialType(t) {
454
- const i = this.parser.json.materials[t];
455
- return !i.extensions || !i.extensions[this.name] ? null : O;
456
- }
457
- extendMaterialParams(t, e) {
458
- const i = this.parser, n = i.json.materials[t];
459
- if (!n.extensions || !n.extensions[this.name])
460
- return Promise.resolve();
461
- const s = [], r = n.extensions[this.name];
462
- e.thickness = r.thicknessFactor !== void 0 ? r.thicknessFactor : 0, r.thicknessTexture !== void 0 && s.push(i.assignTexture(e, "thicknessMap", r.thicknessTexture)), e.attenuationDistance = r.attenuationDistance || 1 / 0;
463
- const a = r.attenuationColor || [1, 1, 1];
464
- return e.attenuationColor = new j().setRGB(a[0], a[1], a[2], k), Promise.all(s);
465
- }
466
- }
467
- class sn {
468
- constructor(t) {
469
- this.parser = t, this.name = E.KHR_MATERIALS_IOR;
470
- }
471
- getMaterialType(t) {
472
- const i = this.parser.json.materials[t];
473
- return !i.extensions || !i.extensions[this.name] ? null : O;
474
- }
475
- extendMaterialParams(t, e) {
476
- const n = this.parser.json.materials[t];
477
- if (!n.extensions || !n.extensions[this.name])
478
- return Promise.resolve();
479
- const s = n.extensions[this.name];
480
- return e.ior = s.ior !== void 0 ? s.ior : 1.5, Promise.resolve();
481
- }
482
- }
483
- class rn {
484
- constructor(t) {
485
- this.parser = t, this.name = E.KHR_MATERIALS_SPECULAR;
486
- }
487
- getMaterialType(t) {
488
- const i = this.parser.json.materials[t];
489
- return !i.extensions || !i.extensions[this.name] ? null : O;
490
- }
491
- extendMaterialParams(t, e) {
492
- const i = this.parser, n = i.json.materials[t];
493
- if (!n.extensions || !n.extensions[this.name])
494
- return Promise.resolve();
495
- const s = [], r = n.extensions[this.name];
496
- e.specularIntensity = r.specularFactor !== void 0 ? r.specularFactor : 1, r.specularTexture !== void 0 && s.push(i.assignTexture(e, "specularIntensityMap", r.specularTexture));
497
- const a = r.specularColorFactor || [1, 1, 1];
498
- return e.specularColor = new j().setRGB(a[0], a[1], a[2], k), r.specularColorTexture !== void 0 && s.push(i.assignTexture(e, "specularColorMap", r.specularColorTexture, $)), Promise.all(s);
499
- }
500
- }
501
- class on {
502
- constructor(t) {
503
- this.parser = t, this.name = E.EXT_MATERIALS_BUMP;
504
- }
505
- getMaterialType(t) {
506
- const i = this.parser.json.materials[t];
507
- return !i.extensions || !i.extensions[this.name] ? null : O;
508
- }
509
- extendMaterialParams(t, e) {
510
- const i = this.parser, n = i.json.materials[t];
511
- if (!n.extensions || !n.extensions[this.name])
512
- return Promise.resolve();
513
- const s = [], r = n.extensions[this.name];
514
- return e.bumpScale = r.bumpFactor !== void 0 ? r.bumpFactor : 1, r.bumpTexture !== void 0 && s.push(i.assignTexture(e, "bumpMap", r.bumpTexture)), Promise.all(s);
515
- }
516
- }
517
- class an {
518
- constructor(t) {
519
- this.parser = t, this.name = E.KHR_MATERIALS_ANISOTROPY;
520
- }
521
- getMaterialType(t) {
522
- const i = this.parser.json.materials[t];
523
- return !i.extensions || !i.extensions[this.name] ? null : O;
524
- }
525
- extendMaterialParams(t, e) {
526
- const i = this.parser, n = i.json.materials[t];
527
- if (!n.extensions || !n.extensions[this.name])
528
- return Promise.resolve();
529
- const s = [], r = n.extensions[this.name];
530
- return r.anisotropyStrength !== void 0 && (e.anisotropy = r.anisotropyStrength), r.anisotropyRotation !== void 0 && (e.anisotropyRotation = r.anisotropyRotation), r.anisotropyTexture !== void 0 && s.push(i.assignTexture(e, "anisotropyMap", r.anisotropyTexture)), Promise.all(s);
531
- }
532
- }
533
- class cn {
534
- constructor(t) {
535
- this.parser = t, this.name = E.KHR_TEXTURE_BASISU;
536
- }
537
- loadTexture(t) {
538
- const e = this.parser, i = e.json, n = i.textures[t];
539
- if (!n.extensions || !n.extensions[this.name])
540
- return null;
541
- const s = n.extensions[this.name], r = e.options.ktx2Loader;
542
- if (!r) {
543
- if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
544
- throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
545
- return null;
546
- }
547
- return e.loadTextureImage(t, s.source, r);
548
- }
549
- }
550
- class ln {
551
- constructor(t) {
552
- this.parser = t, this.name = E.EXT_TEXTURE_WEBP;
553
- }
554
- loadTexture(t) {
555
- const e = this.name, i = this.parser, n = i.json, s = n.textures[t];
556
- if (!s.extensions || !s.extensions[e])
557
- return null;
558
- const r = s.extensions[e], a = n.images[r.source];
559
- let o = i.textureLoader;
560
- if (a.uri) {
561
- const c = i.options.manager.getHandler(a.uri);
562
- c !== null && (o = c);
563
- }
564
- return i.loadTextureImage(t, r.source, o);
565
- }
566
- }
567
- class un {
568
- constructor(t) {
569
- this.parser = t, this.name = E.EXT_TEXTURE_AVIF;
570
- }
571
- loadTexture(t) {
572
- const e = this.name, i = this.parser, n = i.json, s = n.textures[t];
573
- if (!s.extensions || !s.extensions[e])
574
- return null;
575
- const r = s.extensions[e], a = n.images[r.source];
576
- let o = i.textureLoader;
577
- if (a.uri) {
578
- const c = i.options.manager.getHandler(a.uri);
579
- c !== null && (o = c);
580
- }
581
- return i.loadTextureImage(t, r.source, o);
582
- }
583
- }
584
- class fn {
585
- constructor(t) {
586
- this.name = E.EXT_MESHOPT_COMPRESSION, this.parser = t;
587
- }
588
- loadBufferView(t) {
589
- const e = this.parser.json, i = e.bufferViews[t];
590
- if (i.extensions && i.extensions[this.name]) {
591
- const n = i.extensions[this.name], s = this.parser.getDependency("buffer", n.buffer), r = this.parser.options.meshoptDecoder;
592
- if (!r || !r.supported) {
593
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
594
- throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
595
- return null;
596
- }
597
- return s.then(function(a) {
598
- const o = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, l = n.byteStride, d = new Uint8Array(a, o, c);
599
- return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(u, l, d, n.mode, n.filter).then(function(h) {
600
- return h.buffer;
601
- }) : r.ready.then(function() {
602
- const h = new ArrayBuffer(u * l);
603
- return r.decodeGltfBuffer(new Uint8Array(h), u, l, d, n.mode, n.filter), h;
604
- });
605
- });
606
- } else
607
- return null;
608
- }
609
- }
610
- class dn {
611
- constructor(t) {
612
- this.name = E.EXT_MESH_GPU_INSTANCING, this.parser = t;
613
- }
614
- createNodeMesh(t) {
615
- const e = this.parser.json, i = e.nodes[t];
616
- if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
617
- return null;
618
- const n = e.meshes[i.mesh];
619
- for (const c of n.primitives)
620
- if (c.mode !== C.TRIANGLES && c.mode !== C.TRIANGLE_STRIP && c.mode !== C.TRIANGLE_FAN && c.mode !== void 0)
621
- return null;
622
- const r = i.extensions[this.name].attributes, a = [], o = {};
623
- for (const c in r)
624
- a.push(this.parser.getDependency("accessor", r[c]).then((u) => (o[c] = u, o[c])));
625
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
626
- const u = c.pop(), l = u.isGroup ? u.children : [u], d = c[0].count, h = [];
627
- for (const p of l) {
628
- const R = new Z(), m = new K(), T = new Pe(), A = new K(1, 1, 1), M = new ut(p.geometry, p.material, d);
629
- for (let x = 0; x < d; x++)
630
- o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, x), o.ROTATION && T.fromBufferAttribute(o.ROTATION, x), o.SCALE && A.fromBufferAttribute(o.SCALE, x), M.setMatrixAt(x, R.compose(m, T, A));
631
- for (const x in o)
632
- if (x === "_COLOR_0") {
633
- const S = o[x];
634
- M.instanceColor = new ft(S.array, S.itemSize, S.normalized);
635
- } else x !== "TRANSLATION" && x !== "ROTATION" && x !== "SCALE" && p.geometry.setAttribute(x, o[x]);
636
- ke.prototype.copy.call(M, p), this.parser.assignFinalMaterial(M), h.push(M);
637
- }
638
- return u.isGroup ? (u.clear(), u.add(...h), u) : h[0];
639
- }));
640
- }
641
- }
642
- const Be = "glTF", q = 12, be = { JSON: 1313821514, BIN: 5130562 };
643
- class hn {
644
- constructor(t) {
645
- this.name = E.KHR_BINARY_GLTF, this.content = null, this.body = null;
646
- const e = new DataView(t, 0, q), i = new TextDecoder();
647
- if (this.header = {
648
- magic: i.decode(new Uint8Array(t.slice(0, 4))),
649
- version: e.getUint32(4, !0),
650
- length: e.getUint32(8, !0)
651
- }, this.header.magic !== Be)
652
- throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
653
- if (this.header.version < 2)
654
- throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
655
- const n = this.header.length - q, s = new DataView(t, q);
656
- let r = 0;
657
- for (; r < n; ) {
658
- const a = s.getUint32(r, !0);
659
- r += 4;
660
- const o = s.getUint32(r, !0);
661
- if (r += 4, o === be.JSON) {
662
- const c = new Uint8Array(t, q + r, a);
663
- this.content = i.decode(c);
664
- } else if (o === be.BIN) {
665
- const c = q + r;
666
- this.body = t.slice(c, c + a);
667
- }
668
- r += a;
669
- }
670
- if (this.content === null)
671
- throw new Error("THREE.GLTFLoader: JSON content not found.");
672
- }
673
- }
674
- class pn {
675
- constructor(t, e) {
676
- if (!e)
677
- throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
678
- this.name = E.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
679
- }
680
- decodePrimitive(t, e) {
681
- const i = this.json, n = this.dracoLoader, s = t.extensions[this.name].bufferView, r = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
682
- for (const u in r) {
683
- const l = he[u] || u.toLowerCase();
684
- a[l] = r[u];
685
- }
686
- for (const u in t.attributes) {
687
- const l = he[u] || u.toLowerCase();
688
- if (r[u] !== void 0) {
689
- const d = i.accessors[t.attributes[u]], h = V[d.componentType];
690
- c[l] = h.name, o[l] = d.normalized === !0;
691
- }
692
- }
693
- return e.getDependency("bufferView", s).then(function(u) {
694
- return new Promise(function(l, d) {
695
- n.decodeDracoFile(u, function(h) {
696
- for (const p in h.attributes) {
697
- const R = h.attributes[p], m = o[p];
698
- m !== void 0 && (R.normalized = m);
699
- }
700
- l(h);
701
- }, a, c, k, d);
702
- });
703
- });
704
- }
705
- }
706
- class mn {
707
- constructor() {
708
- this.name = E.KHR_TEXTURE_TRANSFORM;
709
- }
710
- extendTexture(t, e) {
711
- return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
712
- }
713
- }
714
- class gn {
715
- constructor() {
716
- this.name = E.KHR_MESH_QUANTIZATION;
717
- }
718
- }
719
- class Ke extends Ut {
720
- constructor(t, e, i, n) {
721
- super(t, e, i, n);
722
- }
723
- copySampleValue_(t) {
724
- const e = this.resultBuffer, i = this.sampleValues, n = this.valueSize, s = t * n * 3 + n;
725
- for (let r = 0; r !== n; r++)
726
- e[r] = i[s + r];
727
- return e;
728
- }
729
- interpolate_(t, e, i, n) {
730
- const s = this.resultBuffer, r = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, u = n - e, l = (i - e) / u, d = l * l, h = d * l, p = t * c, R = p - c, m = -2 * h + 3 * d, T = h - d, A = 1 - m, M = T - d + l;
731
- for (let x = 0; x !== a; x++) {
732
- const S = r[R + x + a], I = r[R + x + o] * u, L = r[p + x + a], v = r[p + x] * u;
733
- s[x] = A * S + M * I + m * L + T * v;
734
- }
735
- return s;
736
- }
737
- }
738
- const Tn = new Pe();
739
- class xn extends Ke {
740
- interpolate_(t, e, i, n) {
741
- const s = super.interpolate_(t, e, i, n);
742
- return Tn.fromArray(s).normalize().toArray(s), s;
743
- }
744
- }
745
- const C = {
746
- POINTS: 0,
747
- LINES: 1,
748
- LINE_LOOP: 2,
749
- LINE_STRIP: 3,
750
- TRIANGLES: 4,
751
- TRIANGLE_STRIP: 5,
752
- TRIANGLE_FAN: 6
753
- }, V = {
754
- 5120: Int8Array,
755
- 5121: Uint8Array,
756
- 5122: Int16Array,
757
- 5123: Uint16Array,
758
- 5125: Uint32Array,
759
- 5126: Float32Array
760
- }, Se = {
761
- 9728: De,
762
- 9729: fe,
763
- 9984: Tt,
764
- 9985: gt,
765
- 9986: mt,
766
- 9987: Fe
767
- }, Ne = {
768
- 33071: Rt,
769
- 33648: xt,
770
- 10497: de
771
- }, ae = {
772
- SCALAR: 1,
773
- VEC2: 2,
774
- VEC3: 3,
775
- VEC4: 4,
776
- MAT2: 4,
777
- MAT3: 9,
778
- MAT4: 16
779
- }, he = {
780
- POSITION: "position",
781
- NORMAL: "normal",
782
- TANGENT: "tangent",
783
- TEXCOORD_0: "uv",
784
- TEXCOORD_1: "uv1",
785
- TEXCOORD_2: "uv2",
786
- TEXCOORD_3: "uv3",
787
- COLOR_0: "color",
788
- WEIGHTS_0: "skinWeight",
789
- JOINTS_0: "skinIndex"
790
- }, D = {
791
- scale: "scale",
792
- translation: "position",
793
- rotation: "quaternion",
794
- weights: "morphTargetInfluences"
795
- }, Rn = {
796
- CUBICSPLINE: void 0,
797
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
798
- // keyframe track will be initialized with a default interpolation type, then modified.
799
- LINEAR: Ge,
800
- STEP: Ft
801
- }, ce = {
802
- OPAQUE: "OPAQUE",
803
- MASK: "MASK",
804
- BLEND: "BLEND"
805
- };
806
- function En(f) {
807
- return f.DefaultMaterial === void 0 && (f.DefaultMaterial = new He({
808
- color: 16777215,
809
- emissive: 0,
810
- metalness: 1,
811
- roughness: 1,
812
- transparent: !1,
813
- depthTest: !0,
814
- side: Ht
815
- })), f.DefaultMaterial;
816
- }
817
- function U(f, t, e) {
818
- for (const i in e.extensions)
819
- f[i] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = e.extensions[i]);
820
- }
821
- function P(f, t) {
822
- t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(f.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
823
- }
824
- function An(f, t, e) {
825
- let i = !1, n = !1, s = !1;
826
- for (let c = 0, u = t.length; c < u; c++) {
827
- const l = t[c];
828
- if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (n = !0), l.COLOR_0 !== void 0 && (s = !0), i && n && s) break;
829
- }
830
- if (!i && !n && !s) return Promise.resolve(f);
831
- const r = [], a = [], o = [];
832
- for (let c = 0, u = t.length; c < u; c++) {
833
- const l = t[c];
834
- if (i) {
835
- const d = l.POSITION !== void 0 ? e.getDependency("accessor", l.POSITION) : f.attributes.position;
836
- r.push(d);
837
- }
838
- if (n) {
839
- const d = l.NORMAL !== void 0 ? e.getDependency("accessor", l.NORMAL) : f.attributes.normal;
840
- a.push(d);
841
- }
842
- if (s) {
843
- const d = l.COLOR_0 !== void 0 ? e.getDependency("accessor", l.COLOR_0) : f.attributes.color;
844
- o.push(d);
845
- }
846
- }
847
- return Promise.all([
848
- Promise.all(r),
849
- Promise.all(a),
850
- Promise.all(o)
851
- ]).then(function(c) {
852
- const u = c[0], l = c[1], d = c[2];
853
- return i && (f.morphAttributes.position = u), n && (f.morphAttributes.normal = l), s && (f.morphAttributes.color = d), f.morphTargetsRelative = !0, f;
854
- });
855
- }
856
- function Ln(f, t) {
857
- if (f.updateMorphTargets(), t.weights !== void 0)
858
- for (let e = 0, i = t.weights.length; e < i; e++)
859
- f.morphTargetInfluences[e] = t.weights[e];
860
- if (t.extras && Array.isArray(t.extras.targetNames)) {
861
- const e = t.extras.targetNames;
862
- if (f.morphTargetInfluences.length === e.length) {
863
- f.morphTargetDictionary = {};
864
- for (let i = 0, n = e.length; i < n; i++)
865
- f.morphTargetDictionary[e[i]] = i;
866
- } else
867
- console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
868
- }
869
- }
870
- function _n(f) {
871
- let t;
872
- const e = f.extensions && f.extensions[E.KHR_DRACO_MESH_COMPRESSION];
873
- if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + le(e.attributes) : t = f.indices + ":" + le(f.attributes) + ":" + f.mode, f.targets !== void 0)
874
- for (let i = 0, n = f.targets.length; i < n; i++)
875
- t += ":" + le(f.targets[i]);
876
- return t;
877
- }
878
- function le(f) {
879
- let t = "";
880
- const e = Object.keys(f).sort();
881
- for (let i = 0, n = e.length; i < n; i++)
882
- t += e[i] + ":" + f[e[i]] + ";";
883
- return t;
884
- }
885
- function pe(f) {
886
- switch (f) {
887
- case Int8Array:
888
- return 1 / 127;
889
- case Uint8Array:
890
- return 1 / 255;
891
- case Int16Array:
892
- return 1 / 32767;
893
- case Uint16Array:
894
- return 1 / 65535;
895
- default:
896
- throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
897
- }
898
- }
899
- function Mn(f) {
900
- return f.search(/\.jpe?g($|\?)/i) > 0 || f.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : f.search(/\.webp($|\?)/i) > 0 || f.search(/^data\:image\/webp/) === 0 ? "image/webp" : f.search(/\.ktx2($|\?)/i) > 0 || f.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
901
- }
902
- const wn = new Z();
903
- class yn {
904
- constructor(t = {}, e = {}) {
905
- this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new qt(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
906
- let i = !1, n = -1, s = !1, r = -1;
907
- if (typeof navigator < "u") {
908
- const a = navigator.userAgent;
909
- i = /^((?!chrome|android).)*safari/i.test(a) === !0;
910
- const o = a.match(/Version\/(\d+)/);
911
- n = i && o ? parseInt(o[1], 10) : -1, s = a.indexOf("Firefox") > -1, r = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
912
- }
913
- typeof createImageBitmap > "u" || i && n < 17 || s && r < 98 ? this.textureLoader = new dt(this.options.manager) : this.textureLoader = new ht(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Oe(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
914
- }
915
- setExtensions(t) {
916
- this.extensions = t;
917
- }
918
- setPlugins(t) {
919
- this.plugins = t;
920
- }
921
- parse(t, e) {
922
- const i = this, n = this.json, s = this.extensions;
923
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(r) {
924
- return r._markDefs && r._markDefs();
925
- }), Promise.all(this._invokeAll(function(r) {
926
- return r.beforeRoot && r.beforeRoot();
927
- })).then(function() {
928
- return Promise.all([
929
- i.getDependencies("scene"),
930
- i.getDependencies("animation"),
931
- i.getDependencies("camera")
932
- ]);
933
- }).then(function(r) {
934
- const a = {
935
- scene: r[0][n.scene || 0],
936
- scenes: r[0],
937
- animations: r[1],
938
- cameras: r[2],
939
- asset: n.asset,
940
- parser: i,
941
- userData: {}
942
- };
943
- return U(s, a, n), P(a, n), Promise.all(i._invokeAll(function(o) {
944
- return o.afterRoot && o.afterRoot(a);
945
- })).then(function() {
946
- for (const o of a.scenes)
947
- o.updateMatrixWorld();
948
- t(a);
949
- });
950
- }).catch(e);
951
- }
952
- /**
953
- * Marks the special nodes/meshes in json for efficient parse.
954
- *
955
- * @private
956
- */
957
- _markDefs() {
958
- const t = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
959
- for (let n = 0, s = e.length; n < s; n++) {
960
- const r = e[n].joints;
961
- for (let a = 0, o = r.length; a < o; a++)
962
- t[r[a]].isBone = !0;
963
- }
964
- for (let n = 0, s = t.length; n < s; n++) {
965
- const r = t[n];
966
- r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (i[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
967
- }
968
- }
969
- /**
970
- * Counts references to shared node / Object3D resources. These resources
971
- * can be reused, or "instantiated", at multiple nodes in the scene
972
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
973
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
974
- * Textures) can be reused directly and are not marked here.
975
- *
976
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
977
- *
978
- * @private
979
- * @param {Object} cache
980
- * @param {Object3D} index
981
- */
982
- _addNodeRef(t, e) {
983
- e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
984
- }
985
- /**
986
- * Returns a reference to a shared resource, cloning it if necessary.
987
- *
988
- * @private
989
- * @param {Object} cache
990
- * @param {number} index
991
- * @param {Object} object
992
- * @return {Object}
993
- */
994
- _getNodeRef(t, e, i) {
995
- if (t.refs[e] <= 1) return i;
996
- const n = i.clone(), s = (r, a) => {
997
- const o = this.associations.get(r);
998
- o != null && this.associations.set(a, o);
999
- for (const [c, u] of r.children.entries())
1000
- s(u, a.children[c]);
1001
- };
1002
- return s(i, n), n.name += "_instance_" + t.uses[e]++, n;
1003
- }
1004
- _invokeOne(t) {
1005
- const e = Object.values(this.plugins);
1006
- e.push(this);
1007
- for (let i = 0; i < e.length; i++) {
1008
- const n = t(e[i]);
1009
- if (n) return n;
1010
- }
1011
- return null;
1012
- }
1013
- _invokeAll(t) {
1014
- const e = Object.values(this.plugins);
1015
- e.unshift(this);
1016
- const i = [];
1017
- for (let n = 0; n < e.length; n++) {
1018
- const s = t(e[n]);
1019
- s && i.push(s);
1020
- }
1021
- return i;
1022
- }
1023
- /**
1024
- * Requests the specified dependency asynchronously, with caching.
1025
- *
1026
- * @private
1027
- * @param {string} type
1028
- * @param {number} index
1029
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1030
- */
1031
- getDependency(t, e) {
1032
- const i = t + ":" + e;
1033
- let n = this.cache.get(i);
1034
- if (!n) {
1035
- switch (t) {
1036
- case "scene":
1037
- n = this.loadScene(e);
1038
- break;
1039
- case "node":
1040
- n = this._invokeOne(function(s) {
1041
- return s.loadNode && s.loadNode(e);
1042
- });
1043
- break;
1044
- case "mesh":
1045
- n = this._invokeOne(function(s) {
1046
- return s.loadMesh && s.loadMesh(e);
1047
- });
1048
- break;
1049
- case "accessor":
1050
- n = this.loadAccessor(e);
1051
- break;
1052
- case "bufferView":
1053
- n = this._invokeOne(function(s) {
1054
- return s.loadBufferView && s.loadBufferView(e);
1055
- });
1056
- break;
1057
- case "buffer":
1058
- n = this.loadBuffer(e);
1059
- break;
1060
- case "material":
1061
- n = this._invokeOne(function(s) {
1062
- return s.loadMaterial && s.loadMaterial(e);
1063
- });
1064
- break;
1065
- case "texture":
1066
- n = this._invokeOne(function(s) {
1067
- return s.loadTexture && s.loadTexture(e);
1068
- });
1069
- break;
1070
- case "skin":
1071
- n = this.loadSkin(e);
1072
- break;
1073
- case "animation":
1074
- n = this._invokeOne(function(s) {
1075
- return s.loadAnimation && s.loadAnimation(e);
1076
- });
1077
- break;
1078
- case "camera":
1079
- n = this.loadCamera(e);
1080
- break;
1081
- default:
1082
- if (n = this._invokeOne(function(s) {
1083
- return s != this && s.getDependency && s.getDependency(t, e);
1084
- }), !n)
1085
- throw new Error("Unknown type: " + t);
1086
- break;
1087
- }
1088
- this.cache.add(i, n);
1089
- }
1090
- return n;
1091
- }
1092
- /**
1093
- * Requests all dependencies of the specified type asynchronously, with caching.
1094
- *
1095
- * @private
1096
- * @param {string} type
1097
- * @return {Promise<Array<Object>>}
1098
- */
1099
- getDependencies(t) {
1100
- let e = this.cache.get(t);
1101
- if (!e) {
1102
- const i = this, n = this.json[t + (t === "mesh" ? "es" : "s")] || [];
1103
- e = Promise.all(n.map(function(s, r) {
1104
- return i.getDependency(t, r);
1105
- })), this.cache.add(t, e);
1106
- }
1107
- return e;
1108
- }
1109
- /**
1110
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1111
- *
1112
- * @private
1113
- * @param {number} bufferIndex
1114
- * @return {Promise<ArrayBuffer>}
1115
- */
1116
- loadBuffer(t) {
1117
- const e = this.json.buffers[t], i = this.fileLoader;
1118
- if (e.type && e.type !== "arraybuffer")
1119
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1120
- if (e.uri === void 0 && t === 0)
1121
- return Promise.resolve(this.extensions[E.KHR_BINARY_GLTF].body);
1122
- const n = this.options;
1123
- return new Promise(function(s, r) {
1124
- i.load(Y.resolveURL(e.uri, n.path), s, void 0, function() {
1125
- r(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1126
- });
1127
- });
1128
- }
1129
- /**
1130
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1131
- *
1132
- * @private
1133
- * @param {number} bufferViewIndex
1134
- * @return {Promise<ArrayBuffer>}
1135
- */
1136
- loadBufferView(t) {
1137
- const e = this.json.bufferViews[t];
1138
- return this.getDependency("buffer", e.buffer).then(function(i) {
1139
- const n = e.byteLength || 0, s = e.byteOffset || 0;
1140
- return i.slice(s, s + n);
1141
- });
1142
- }
1143
- /**
1144
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1145
- *
1146
- * @private
1147
- * @param {number} accessorIndex
1148
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1149
- */
1150
- loadAccessor(t) {
1151
- const e = this, i = this.json, n = this.json.accessors[t];
1152
- if (n.bufferView === void 0 && n.sparse === void 0) {
1153
- const r = ae[n.type], a = V[n.componentType], o = n.normalized === !0, c = new a(n.count * r);
1154
- return Promise.resolve(new re(c, r, o));
1155
- }
1156
- const s = [];
1157
- return n.bufferView !== void 0 ? s.push(this.getDependency("bufferView", n.bufferView)) : s.push(null), n.sparse !== void 0 && (s.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(s).then(function(r) {
1158
- const a = r[0], o = ae[n.type], c = V[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * o, d = n.byteOffset || 0, h = n.bufferView !== void 0 ? i.bufferViews[n.bufferView].byteStride : void 0, p = n.normalized === !0;
1159
- let R, m;
1160
- if (h && h !== l) {
1161
- const T = Math.floor(d / h), A = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + T + ":" + n.count;
1162
- let M = e.cache.get(A);
1163
- M || (R = new c(a, T * h, n.count * h / u), M = new pt(R, h / u), e.cache.add(A, M)), m = new Dt(M, o, d % h / u, p);
1164
- } else
1165
- a === null ? R = new c(n.count * o) : R = new c(a, d, n.count * o), m = new re(R, o, p);
1166
- if (n.sparse !== void 0) {
1167
- const T = ae.SCALAR, A = V[n.sparse.indices.componentType], M = n.sparse.indices.byteOffset || 0, x = n.sparse.values.byteOffset || 0, S = new A(r[1], M, n.sparse.count * T), I = new c(r[2], x, n.sparse.count * o);
1168
- a !== null && (m = new re(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
1169
- for (let L = 0, v = S.length; L < v; L++) {
1170
- const w = S[L];
1171
- if (m.setX(w, I[L * o]), o >= 2 && m.setY(w, I[L * o + 1]), o >= 3 && m.setZ(w, I[L * o + 2]), o >= 4 && m.setW(w, I[L * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1172
- }
1173
- m.normalized = p;
1174
- }
1175
- return m;
1176
- });
1177
- }
1178
- /**
1179
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1180
- *
1181
- * @private
1182
- * @param {number} textureIndex
1183
- * @return {Promise<THREE.Texture|null>}
1184
- */
1185
- loadTexture(t) {
1186
- const e = this.json, i = this.options, s = e.textures[t].source, r = e.images[s];
1187
- let a = this.textureLoader;
1188
- if (r.uri) {
1189
- const o = i.manager.getHandler(r.uri);
1190
- o !== null && (a = o);
1191
- }
1192
- return this.loadTextureImage(t, s, a);
1193
- }
1194
- loadTextureImage(t, e, i) {
1195
- const n = this, s = this.json, r = s.textures[t], a = s.images[e], o = (a.uri || a.bufferView) + ":" + r.sampler;
1196
- if (this.textureCache[o])
1197
- return this.textureCache[o];
1198
- const c = this.loadImageSource(e, i).then(function(u) {
1199
- u.flipY = !1, u.name = r.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
1200
- const d = (s.samplers || {})[r.sampler] || {};
1201
- return u.magFilter = Se[d.magFilter] || fe, u.minFilter = Se[d.minFilter] || Fe, u.wrapS = Ne[d.wrapS] || de, u.wrapT = Ne[d.wrapT] || de, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== De && u.minFilter !== fe, n.associations.set(u, { textures: t }), u;
1202
- }).catch(function() {
1203
- return null;
1204
- });
1205
- return this.textureCache[o] = c, c;
1206
- }
1207
- loadImageSource(t, e) {
1208
- const i = this, n = this.json, s = this.options;
1209
- if (this.sourceCache[t] !== void 0)
1210
- return this.sourceCache[t].then((l) => l.clone());
1211
- const r = n.images[t], a = self.URL || self.webkitURL;
1212
- let o = r.uri || "", c = !1;
1213
- if (r.bufferView !== void 0)
1214
- o = i.getDependency("bufferView", r.bufferView).then(function(l) {
1215
- c = !0;
1216
- const d = new Blob([l], { type: r.mimeType });
1217
- return o = a.createObjectURL(d), o;
1218
- });
1219
- else if (r.uri === void 0)
1220
- throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
1221
- const u = Promise.resolve(o).then(function(l) {
1222
- return new Promise(function(d, h) {
1223
- let p = d;
1224
- e.isImageBitmapLoader === !0 && (p = function(R) {
1225
- const m = new Ee(R);
1226
- m.needsUpdate = !0, d(m);
1227
- }), e.load(Y.resolveURL(l, s.path), p, void 0, h);
1228
- });
1229
- }).then(function(l) {
1230
- return c === !0 && a.revokeObjectURL(o), P(l, r), l.userData.mimeType = r.mimeType || Mn(r.uri), l;
1231
- }).catch(function(l) {
1232
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), l;
1233
- });
1234
- return this.sourceCache[t] = u, u;
1235
- }
1236
- /**
1237
- * Asynchronously assigns a texture to the given material parameters.
1238
- *
1239
- * @private
1240
- * @param {Object} materialParams
1241
- * @param {string} mapName
1242
- * @param {Object} mapDef
1243
- * @param {string} [colorSpace]
1244
- * @return {Promise<Texture>}
1245
- */
1246
- assignTexture(t, e, i, n) {
1247
- const s = this;
1248
- return this.getDependency("texture", i.index).then(function(r) {
1249
- if (!r) return null;
1250
- if (i.texCoord !== void 0 && i.texCoord > 0 && (r = r.clone(), r.channel = i.texCoord), s.extensions[E.KHR_TEXTURE_TRANSFORM]) {
1251
- const a = i.extensions !== void 0 ? i.extensions[E.KHR_TEXTURE_TRANSFORM] : void 0;
1252
- if (a) {
1253
- const o = s.associations.get(r);
1254
- r = s.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(r, a), s.associations.set(r, o);
1255
- }
1256
- }
1257
- return n !== void 0 && (r.colorSpace = n), t[e] = r, r;
1258
- });
1259
- }
1260
- /**
1261
- * Assigns final material to a Mesh, Line, or Points instance. The instance
1262
- * already has a material (generated from the glTF material options alone)
1263
- * but reuse of the same glTF material may require multiple threejs materials
1264
- * to accommodate different primitive types, defines, etc. New materials will
1265
- * be created if necessary, and reused from a cache.
1266
- *
1267
- * @private
1268
- * @param {Object3D} mesh Mesh, Line, or Points instance.
1269
- */
1270
- assignFinalMaterial(t) {
1271
- const e = t.geometry;
1272
- let i = t.material;
1273
- const n = e.attributes.tangent === void 0, s = e.attributes.color !== void 0, r = e.attributes.normal === void 0;
1274
- if (t.isPoints) {
1275
- const a = "PointsMaterial:" + i.uuid;
1276
- let o = this.cache.get(a);
1277
- o || (o = new Et(), ie.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, o.sizeAttenuation = !1, this.cache.add(a, o)), i = o;
1278
- } else if (t.isLine) {
1279
- const a = "LineBasicMaterial:" + i.uuid;
1280
- let o = this.cache.get(a);
1281
- o || (o = new At(), ie.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, this.cache.add(a, o)), i = o;
1282
- }
1283
- if (n || s || r) {
1284
- let a = "ClonedMaterial:" + i.uuid + ":";
1285
- n && (a += "derivative-tangents:"), s && (a += "vertex-colors:"), r && (a += "flat-shading:");
1286
- let o = this.cache.get(a);
1287
- o || (o = i.clone(), s && (o.vertexColors = !0), r && (o.flatShading = !0), n && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(i))), i = o;
1288
- }
1289
- t.material = i;
1290
- }
1291
- getMaterialType() {
1292
- return He;
1293
- }
1294
- /**
1295
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1296
- *
1297
- * @private
1298
- * @param {number} materialIndex
1299
- * @return {Promise<Material>}
1300
- */
1301
- loadMaterial(t) {
1302
- const e = this, i = this.json, n = this.extensions, s = i.materials[t];
1303
- let r;
1304
- const a = {}, o = s.extensions || {}, c = [];
1305
- if (o[E.KHR_MATERIALS_UNLIT]) {
1306
- const l = n[E.KHR_MATERIALS_UNLIT];
1307
- r = l.getMaterialType(), c.push(l.extendParams(a, s, e));
1308
- } else {
1309
- const l = s.pbrMetallicRoughness || {};
1310
- if (a.color = new j(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
1311
- const d = l.baseColorFactor;
1312
- a.color.setRGB(d[0], d[1], d[2], k), a.opacity = d[3];
1313
- }
1314
- l.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", l.baseColorTexture, $)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), r = this._invokeOne(function(d) {
1315
- return d.getMaterialType && d.getMaterialType(t);
1316
- }), c.push(Promise.all(this._invokeAll(function(d) {
1317
- return d.extendMaterialParams && d.extendMaterialParams(t, a);
1318
- })));
1319
- }
1320
- s.doubleSided === !0 && (a.side = Lt);
1321
- const u = s.alphaMode || ce.OPAQUE;
1322
- if (u === ce.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ce.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && r !== W && (c.push(e.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new ve(1, 1), s.normalTexture.scale !== void 0)) {
1323
- const l = s.normalTexture.scale;
1324
- a.normalScale.set(l, l);
1325
- }
1326
- if (s.occlusionTexture !== void 0 && r !== W && (c.push(e.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && r !== W) {
1327
- const l = s.emissiveFactor;
1328
- a.emissive = new j().setRGB(l[0], l[1], l[2], k);
1329
- }
1330
- return s.emissiveTexture !== void 0 && r !== W && c.push(e.assignTexture(a, "emissiveMap", s.emissiveTexture, $)), Promise.all(c).then(function() {
1331
- const l = new r(a);
1332
- return s.name && (l.name = s.name), P(l, s), e.associations.set(l, { materials: t }), s.extensions && U(n, l, s), l;
1333
- });
1334
- }
1335
- /**
1336
- * When Object3D instances are targeted by animation, they need unique names.
1337
- *
1338
- * @private
1339
- * @param {string} originalName
1340
- * @return {string}
1341
- */
1342
- createUniqueName(t) {
1343
- const e = _t.sanitizeNodeName(t || "");
1344
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1345
- }
1346
- /**
1347
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1348
- *
1349
- * Creates BufferGeometries from primitives.
1350
- *
1351
- * @private
1352
- * @param {Array<GLTF.Primitive>} primitives
1353
- * @return {Promise<Array<BufferGeometry>>}
1354
- */
1355
- loadGeometries(t) {
1356
- const e = this, i = this.extensions, n = this.primitiveCache;
1357
- function s(a) {
1358
- return i[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1359
- return Ie(o, a, e);
1360
- });
1361
- }
1362
- const r = [];
1363
- for (let a = 0, o = t.length; a < o; a++) {
1364
- const c = t[a], u = _n(c), l = n[u];
1365
- if (l)
1366
- r.push(l.promise);
1367
- else {
1368
- let d;
1369
- c.extensions && c.extensions[E.KHR_DRACO_MESH_COMPRESSION] ? d = s(c) : d = Ie(new Mt(), c, e), n[u] = { primitive: c, promise: d }, r.push(d);
1370
- }
1371
- }
1372
- return Promise.all(r);
1373
- }
1374
- /**
1375
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1376
- *
1377
- * @private
1378
- * @param {number} meshIndex
1379
- * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
1380
- */
1381
- loadMesh(t) {
1382
- const e = this, i = this.json, n = this.extensions, s = i.meshes[t], r = s.primitives, a = [];
1383
- for (let o = 0, c = r.length; o < c; o++) {
1384
- const u = r[o].material === void 0 ? En(this.cache) : this.getDependency("material", r[o].material);
1385
- a.push(u);
1386
- }
1387
- return a.push(e.loadGeometries(r)), Promise.all(a).then(function(o) {
1388
- const c = o.slice(0, o.length - 1), u = o[o.length - 1], l = [];
1389
- for (let h = 0, p = u.length; h < p; h++) {
1390
- const R = u[h], m = r[h];
1391
- let T;
1392
- const A = c[h];
1393
- if (m.mode === C.TRIANGLES || m.mode === C.TRIANGLE_STRIP || m.mode === C.TRIANGLE_FAN || m.mode === void 0)
1394
- T = s.isSkinnedMesh === !0 ? new wt(R, A) : new Ue(R, A), T.isSkinnedMesh === !0 && T.normalizeSkinWeights(), m.mode === C.TRIANGLE_STRIP ? T.geometry = ye(T.geometry, Ce) : m.mode === C.TRIANGLE_FAN && (T.geometry = ye(T.geometry, ue));
1395
- else if (m.mode === C.LINES)
1396
- T = new yt(R, A);
1397
- else if (m.mode === C.LINE_STRIP)
1398
- T = new bt(R, A);
1399
- else if (m.mode === C.LINE_LOOP)
1400
- T = new St(R, A);
1401
- else if (m.mode === C.POINTS)
1402
- T = new Nt(R, A);
1403
- else
1404
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
1405
- Object.keys(T.geometry.morphAttributes).length > 0 && Ln(T, s), T.name = e.createUniqueName(s.name || "mesh_" + t), P(T, s), m.extensions && U(n, T, m), e.assignFinalMaterial(T), l.push(T);
1406
- }
1407
- for (let h = 0, p = l.length; h < p; h++)
1408
- e.associations.set(l[h], {
1409
- meshes: t,
1410
- primitives: h
1411
- });
1412
- if (l.length === 1)
1413
- return s.extensions && U(n, l[0], s), l[0];
1414
- const d = new oe();
1415
- s.extensions && U(n, d, s), e.associations.set(d, { meshes: t });
1416
- for (let h = 0, p = l.length; h < p; h++)
1417
- d.add(l[h]);
1418
- return d;
1419
- });
1420
- }
1421
- /**
1422
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1423
- *
1424
- * @private
1425
- * @param {number} cameraIndex
1426
- * @return {Promise<THREE.Camera>}
1427
- */
1428
- loadCamera(t) {
1429
- let e;
1430
- const i = this.json.cameras[t], n = i[i.type];
1431
- if (!n) {
1432
- console.warn("THREE.GLTFLoader: Missing camera parameters.");
1433
- return;
1434
- }
1435
- return i.type === "perspective" ? e = new It(Ct.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : i.type === "orthographic" && (e = new Ot(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), i.name && (e.name = this.createUniqueName(i.name)), P(e, i), Promise.resolve(e);
1436
- }
1437
- /**
1438
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1439
- *
1440
- * @private
1441
- * @param {number} skinIndex
1442
- * @return {Promise<Skeleton>}
1443
- */
1444
- loadSkin(t) {
1445
- const e = this.json.skins[t], i = [];
1446
- for (let n = 0, s = e.joints.length; n < s; n++)
1447
- i.push(this._loadNodeShallow(e.joints[n]));
1448
- return e.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", e.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(n) {
1449
- const s = n.pop(), r = n, a = [], o = [];
1450
- for (let c = 0, u = r.length; c < u; c++) {
1451
- const l = r[c];
1452
- if (l) {
1453
- a.push(l);
1454
- const d = new Z();
1455
- s !== null && d.fromArray(s.array, c * 16), o.push(d);
1456
- } else
1457
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1458
- }
1459
- return new vt(a, o);
1460
- });
1461
- }
1462
- /**
1463
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1464
- *
1465
- * @private
1466
- * @param {number} animationIndex
1467
- * @return {Promise<AnimationClip>}
1468
- */
1469
- loadAnimation(t) {
1470
- const e = this.json, i = this, n = e.animations[t], s = n.name ? n.name : "animation_" + t, r = [], a = [], o = [], c = [], u = [];
1471
- for (let l = 0, d = n.channels.length; l < d; l++) {
1472
- const h = n.channels[l], p = n.samplers[h.sampler], R = h.target, m = R.node, T = n.parameters !== void 0 ? n.parameters[p.input] : p.input, A = n.parameters !== void 0 ? n.parameters[p.output] : p.output;
1473
- R.node !== void 0 && (r.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", T)), o.push(this.getDependency("accessor", A)), c.push(p), u.push(R));
1474
- }
1475
- return Promise.all([
1476
- Promise.all(r),
1477
- Promise.all(a),
1478
- Promise.all(o),
1479
- Promise.all(c),
1480
- Promise.all(u)
1481
- ]).then(function(l) {
1482
- const d = l[0], h = l[1], p = l[2], R = l[3], m = l[4], T = [];
1483
- for (let A = 0, M = d.length; A < M; A++) {
1484
- const x = d[A], S = h[A], I = p[A], L = R[A], v = m[A];
1485
- if (x === void 0) continue;
1486
- x.updateMatrix && x.updateMatrix();
1487
- const w = i._createAnimationTracks(x, S, I, L, v);
1488
- if (w)
1489
- for (let F = 0; F < w.length; F++)
1490
- T.push(w[F]);
1491
- }
1492
- return new Pt(s, void 0, T);
1493
- });
1494
- }
1495
- createNodeMesh(t) {
1496
- const e = this.json, i = this, n = e.nodes[t];
1497
- return n.mesh === void 0 ? null : i.getDependency("mesh", n.mesh).then(function(s) {
1498
- const r = i._getNodeRef(i.meshCache, n.mesh, s);
1499
- return n.weights !== void 0 && r.traverse(function(a) {
1500
- if (a.isMesh)
1501
- for (let o = 0, c = n.weights.length; o < c; o++)
1502
- a.morphTargetInfluences[o] = n.weights[o];
1503
- }), r;
1504
- });
1505
- }
1506
- /**
1507
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1508
- *
1509
- * @private
1510
- * @param {number} nodeIndex
1511
- * @return {Promise<Object3D>}
1512
- */
1513
- loadNode(t) {
1514
- const e = this.json, i = this, n = e.nodes[t], s = i._loadNodeShallow(t), r = [], a = n.children || [];
1515
- for (let c = 0, u = a.length; c < u; c++)
1516
- r.push(i.getDependency("node", a[c]));
1517
- const o = n.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", n.skin);
1518
- return Promise.all([
1519
- s,
1520
- Promise.all(r),
1521
- o
1522
- ]).then(function(c) {
1523
- const u = c[0], l = c[1], d = c[2];
1524
- d !== null && u.traverse(function(h) {
1525
- h.isSkinnedMesh && h.bind(d, wn);
1526
- });
1527
- for (let h = 0, p = l.length; h < p; h++)
1528
- u.add(l[h]);
1529
- return u;
1530
- });
1531
- }
1532
- // ._loadNodeShallow() parses a single node.
1533
- // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1534
- _loadNodeShallow(t) {
1535
- const e = this.json, i = this.extensions, n = this;
1536
- if (this.nodeCache[t] !== void 0)
1537
- return this.nodeCache[t];
1538
- const s = e.nodes[t], r = s.name ? n.createUniqueName(s.name) : "", a = [], o = n._invokeOne(function(c) {
1539
- return c.createNodeMesh && c.createNodeMesh(t);
1540
- });
1541
- return o && a.push(o), s.camera !== void 0 && a.push(n.getDependency("camera", s.camera).then(function(c) {
1542
- return n._getNodeRef(n.cameraCache, s.camera, c);
1543
- })), n._invokeAll(function(c) {
1544
- return c.createNodeAttachment && c.createNodeAttachment(t);
1545
- }).forEach(function(c) {
1546
- a.push(c);
1547
- }), this.nodeCache[t] = Promise.all(a).then(function(c) {
1548
- let u;
1549
- if (s.isBone === !0 ? u = new kt() : c.length > 1 ? u = new oe() : c.length === 1 ? u = c[0] : u = new ke(), u !== c[0])
1550
- for (let l = 0, d = c.length; l < d; l++)
1551
- u.add(c[l]);
1552
- if (s.name && (u.userData.name = s.name, u.name = r), P(u, s), s.extensions && U(i, u, s), s.matrix !== void 0) {
1553
- const l = new Z();
1554
- l.fromArray(s.matrix), u.applyMatrix4(l);
1555
- } else
1556
- s.translation !== void 0 && u.position.fromArray(s.translation), s.rotation !== void 0 && u.quaternion.fromArray(s.rotation), s.scale !== void 0 && u.scale.fromArray(s.scale);
1557
- if (!n.associations.has(u))
1558
- n.associations.set(u, {});
1559
- else if (s.mesh !== void 0 && n.meshCache.refs[s.mesh] > 1) {
1560
- const l = n.associations.get(u);
1561
- n.associations.set(u, { ...l });
1562
- }
1563
- return n.associations.get(u).nodes = t, u;
1564
- }), this.nodeCache[t];
1565
- }
1566
- /**
1567
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1568
- *
1569
- * @private
1570
- * @param {number} sceneIndex
1571
- * @return {Promise<Group>}
1572
- */
1573
- loadScene(t) {
1574
- const e = this.extensions, i = this.json.scenes[t], n = this, s = new oe();
1575
- i.name && (s.name = n.createUniqueName(i.name)), P(s, i), i.extensions && U(e, s, i);
1576
- const r = i.nodes || [], a = [];
1577
- for (let o = 0, c = r.length; o < c; o++)
1578
- a.push(n.getDependency("node", r[o]));
1579
- return Promise.all(a).then(function(o) {
1580
- for (let u = 0, l = o.length; u < l; u++)
1581
- s.add(o[u]);
1582
- const c = (u) => {
1583
- const l = /* @__PURE__ */ new Map();
1584
- for (const [d, h] of n.associations)
1585
- (d instanceof ie || d instanceof Ee) && l.set(d, h);
1586
- return u.traverse((d) => {
1587
- const h = n.associations.get(d);
1588
- h != null && l.set(d, h);
1589
- }), l;
1590
- };
1591
- return n.associations = c(s), s;
1592
- });
1593
- }
1594
- _createAnimationTracks(t, e, i, n, s) {
1595
- const r = [], a = t.name ? t.name : t.uuid, o = [];
1596
- D[s.path] === D.weights ? t.traverse(function(d) {
1597
- d.morphTargetInfluences && o.push(d.name ? d.name : d.uuid);
1598
- }) : o.push(a);
1599
- let c;
1600
- switch (D[s.path]) {
1601
- case D.weights:
1602
- c = Le;
1603
- break;
1604
- case D.rotation:
1605
- c = _e;
1606
- break;
1607
- case D.translation:
1608
- case D.scale:
1609
- c = Ae;
1610
- break;
1611
- default:
1612
- switch (i.itemSize) {
1613
- case 1:
1614
- c = Le;
1615
- break;
1616
- case 2:
1617
- case 3:
1618
- default:
1619
- c = Ae;
1620
- break;
1621
- }
1622
- break;
1623
- }
1624
- const u = n.interpolation !== void 0 ? Rn[n.interpolation] : Ge, l = this._getArrayFromAccessor(i);
1625
- for (let d = 0, h = o.length; d < h; d++) {
1626
- const p = new c(
1627
- o[d] + "." + D[s.path],
1628
- e.array,
1629
- l,
1630
- u
1631
- );
1632
- n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), r.push(p);
1633
- }
1634
- return r;
1635
- }
1636
- _getArrayFromAccessor(t) {
1637
- let e = t.array;
1638
- if (t.normalized) {
1639
- const i = pe(e.constructor), n = new Float32Array(e.length);
1640
- for (let s = 0, r = e.length; s < r; s++)
1641
- n[s] = e[s] * i;
1642
- e = n;
1643
- }
1644
- return e;
1645
- }
1646
- _createCubicSplineTrackInterpolant(t) {
1647
- t.createInterpolant = function(i) {
1648
- const n = this instanceof _e ? xn : Ke;
1649
- return new n(this.times, this.values, this.getValueSize() / 3, i);
1650
- }, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1651
- }
1652
- }
1653
- function bn(f, t, e) {
1654
- const i = t.attributes, n = new je();
1655
- if (i.POSITION !== void 0) {
1656
- const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
1657
- if (o !== void 0 && c !== void 0) {
1658
- if (n.set(
1659
- new K(o[0], o[1], o[2]),
1660
- new K(c[0], c[1], c[2])
1661
- ), a.normalized) {
1662
- const u = pe(V[a.componentType]);
1663
- n.min.multiplyScalar(u), n.max.multiplyScalar(u);
1664
- }
1665
- } else {
1666
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1667
- return;
1668
- }
1669
- } else
1670
- return;
1671
- const s = t.targets;
1672
- if (s !== void 0) {
1673
- const a = new K(), o = new K();
1674
- for (let c = 0, u = s.length; c < u; c++) {
1675
- const l = s[c];
1676
- if (l.POSITION !== void 0) {
1677
- const d = e.json.accessors[l.POSITION], h = d.min, p = d.max;
1678
- if (h !== void 0 && p !== void 0) {
1679
- if (o.setX(Math.max(Math.abs(h[0]), Math.abs(p[0]))), o.setY(Math.max(Math.abs(h[1]), Math.abs(p[1]))), o.setZ(Math.max(Math.abs(h[2]), Math.abs(p[2]))), d.normalized) {
1680
- const R = pe(V[d.componentType]);
1681
- o.multiplyScalar(R);
1682
- }
1683
- a.max(o);
1684
- } else
1685
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1686
- }
1687
- }
1688
- n.expandByVector(a);
1689
- }
1690
- f.boundingBox = n;
1691
- const r = new Gt();
1692
- n.getCenter(r.center), r.radius = n.min.distanceTo(n.max) / 2, f.boundingSphere = r;
1693
- }
1694
- function Ie(f, t, e) {
1695
- const i = t.attributes, n = [];
1696
- function s(r, a) {
1697
- return e.getDependency("accessor", r).then(function(o) {
1698
- f.setAttribute(a, o);
1699
- });
1700
- }
1701
- for (const r in i) {
1702
- const a = he[r] || r.toLowerCase();
1703
- a in f.attributes || n.push(s(i[r], a));
1704
- }
1705
- if (t.indices !== void 0 && !f.index) {
1706
- const r = e.getDependency("accessor", t.indices).then(function(a) {
1707
- f.setIndex(a);
1708
- });
1709
- n.push(r);
1710
- }
1711
- return Me.workingColorSpace !== k && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Me.workingColorSpace}" not supported.`), P(f, t), bn(f, t, e), Promise.all(n).then(function() {
1712
- return t.targets !== void 0 ? An(f, t.targets, e) : f;
1713
- });
1714
- }
1715
- function Sn() {
1716
- const f = G(!1), t = G(""), e = We([]), i = G(null), n = new jt(), s = new Bt(), r = new Kt(), a = new zt();
1717
- return {
1718
- isLoading: f,
1719
- loadingProgress: t,
1720
- loadedModels: e,
1721
- error: i,
1722
- loadModelsFromBlobs: async (c) => {
1723
- var h;
1724
- if (!c || c.length === 0) {
1725
- console.warn("loadModelsFromBlobs 加载的文件数组为空!");
1726
- return;
1727
- }
1728
- f.value = !0, t.value = "准备加载...", e.value = [], i.value = null;
1729
- const u = /* @__PURE__ */ new Map();
1730
- c.forEach((p) => {
1731
- p instanceof File && u.set(p.name.toLowerCase(), p);
1732
- });
1733
- const l = [], d = [];
1734
- try {
1735
- for (const p of c) {
1736
- const R = p.name || "unknown_file", m = (h = R.split(".").pop()) == null ? void 0 : h.toLowerCase();
1737
- if (m === "mtl") continue;
1738
- const T = URL.createObjectURL(p);
1739
- l.push(T);
1740
- let A = null;
1741
- const M = (x) => {
1742
- const S = x.lengthComputable ? x.loaded / x.total * 100 : 0;
1743
- t.value = `正在加载 ${R}... ${Math.round(S)}%`;
1744
- };
1745
- switch (t.value = `正在加载 ${R}... 0%`, m) {
1746
- case "obj":
1747
- const x = R.replace(/\.obj$/i, ".mtl").toLowerCase();
1748
- if (u.has(x)) {
1749
- const v = u.get(x), w = URL.createObjectURL(v);
1750
- l.push(w);
1751
- const F = await n.loadAsync(w);
1752
- F.preload(), s.setMaterials(F);
1753
- } else
1754
- s.setMaterials(null);
1755
- A = await s.loadAsync(T, M);
1756
- break;
1757
- case "stl":
1758
- const S = await r.loadAsync(T, M), I = new Vt({ color: 11184810, specular: 1118481, shininess: 200 });
1759
- A = new Ue(S, I);
1760
- break;
1761
- case "gltf":
1762
- case "glb":
1763
- A = (await a.loadAsync(T, M)).scene;
1764
- break;
1765
- default:
1766
- console.warn(`不支持的文件类型: .${m}`), t.value = `不支持的文件类型: ${R}`;
1767
- continue;
1768
- }
1769
- A && (A.userData.boundingBox = new je().setFromObject(A), d.push(A));
1770
- }
1771
- e.value = d, t.value = "加载完成!";
1772
- } catch (p) {
1773
- throw console.error("加载模型时出错:", p), i.value = `加载失败: ${p.message || "未知错误"}`, t.value = "加载失败!", e.value = [], p;
1774
- } finally {
1775
- f.value = !1, l.forEach((p) => URL.revokeObjectURL(p));
1776
- }
1777
- }
1778
- };
1779
- }
1780
- const Nn = { class: "obj-viewer-container" }, In = { class: "buttonGroup-topLeft" }, Cn = { class: "buttonGroup-left" }, On = { class: "left-panel" }, vn = { class: "panel-header" }, Pn = {
1781
- key: 0,
1782
- class: "clipping-content"
1783
- }, kn = { class: "radio-group" }, Fn = { class: "radio-label" }, Dn = { class: "radio-label" }, Hn = { class: "radio-label" }, Un = { class: "radio-label" }, Gn = {
1784
- key: 0,
1785
- class: "loading-overlay"
1786
- }, jn = /* @__PURE__ */ Ye({
1787
- __name: "threePreview",
1788
- props: {
1789
- fileBlobs: { default: () => [] }
1790
- },
1791
- setup(f) {
1792
- const t = f, e = G(null), i = G(!1), n = G(!1), s = G(""), {
1793
- currentModels: r,
1794
- initialCameraPosition: a,
1795
- initialTargetPosition: o,
1796
- initThreeJS: c,
1797
- handleResize: u,
1798
- getThreeJSObjects: l,
1799
- cleanup: d,
1800
- setModels: h
1801
- } = nt(e), {
1802
- isLoading: p,
1803
- loadingProgress: R,
1804
- loadedModels: m,
1805
- error: T,
1806
- loadModelsFromBlobs: A
1807
- } = Sn(), { isAnimating: M, toggleAnimation: x, stopAnimation: S } = st(l, r), { isClipping: I, activeClippingAxis: L, toggleClipping: v, updateClippingPlanes: w } = rt(
1808
- l,
1809
- r
1810
- );
1811
- te(() => t.fileBlobs, (y) => {
1812
- y && y.length > 0 && A(y).catch((g) => {
1813
- console.error("加载错误:", g);
1814
- });
1815
- }, {
1816
- immediate: !0,
1817
- deep: !0
1818
- }), te(m, (y) => {
1819
- y && y.length > 0 && h(y);
1820
- }), te(T, (y) => {
1821
- y && we.error(`模型加载失败: ${y}`);
1822
- });
1823
- const F = () => {
1824
- if (i.value || r.value.length === 0) return;
1825
- i.value = !0, M.value && S();
1826
- const { camera: y, controls: g } = l();
1827
- if (!y || !g) return;
1828
- g.enabled = !0;
1829
- const ee = (H) => H < 0.5 ? 4 * H * H * H : 1 - Math.pow(-2 * H + 2, 3) / 2, b = y.position.clone(), Xe = g.target.clone(), ze = 1500, qe = Date.now(), me = () => {
1830
- const H = Date.now() - qe, ge = Math.min(H / ze, 1), Te = ee(ge);
1831
- y.position.lerpVectors(b, a.value, Te), g.target.lerpVectors(Xe, o.value, Te), ge < 1 ? requestAnimationFrame(me) : i.value = !1;
1832
- };
1833
- me();
1834
- }, Ve = (y) => {
1835
- n.value = !0, s.value = y, I.value || v();
1836
- };
1837
- return $e(async () => {
1838
- await Je();
1839
- try {
1840
- c(), window.addEventListener("resize", u);
1841
- } catch (y) {
1842
- console.error("Three.js 初始化失败:", y), we.error("渲染引擎初始化失败!");
1843
- }
1844
- }), Qe(() => {
1845
- s.value = "", window.removeEventListener("resize", u), M.value && S(), d();
1846
- }), (y, g) => {
1847
- const ee = Ze("el-scrollbar");
1848
- return se(), ne("div", Nn, [
1849
- _("div", {
1850
- ref_key: "threejsContainer",
1851
- ref: e,
1852
- class: "threejs-container"
1853
- }, null, 512),
1854
- g[15] || (g[15] = _("div", { class: "buttonGroup-top" }, null, -1)),
1855
- _("div", In, [
1856
- B(z, {
1857
- name: "viewReset",
1858
- size: "24",
1859
- onClick: F,
1860
- title: "重置"
1861
- }),
1862
- B(z, {
1863
- name: "fangda",
1864
- size: "24",
1865
- title: "放大"
1866
- }),
1867
- B(z, {
1868
- name: "suoxiao",
1869
- size: "24",
1870
- title: "缩小"
1871
- }),
1872
- B(z, {
1873
- name: "lookAround",
1874
- size: "24",
1875
- onClick: N(x),
1876
- title: N(M) ? "停止动画" : "动画视图"
1877
- }, null, 8, ["onClick", "title"])
1878
- ]),
1879
- _("div", Cn, [
1880
- B(z, {
1881
- name: "clipping",
1882
- size: "24",
1883
- onClick: g[0] || (g[0] = (b) => Ve("剖面视图")),
1884
- active: n.value && s.value === "剖面视图",
1885
- title: "剖面视图"
1886
- }, null, 8, ["active"])
1887
- ]),
1888
- g[16] || (g[16] = _("div", { class: "buttonGroup-right" }, null, -1)),
1889
- g[17] || (g[17] = _("div", { class: "buttonGroup-bottom" }, null, -1)),
1890
- X(_("div", On, [
1891
- _("div", vn, [
1892
- _("span", null, Re(s.value), 1),
1893
- _("span", {
1894
- class: "close",
1895
- onClick: g[1] || (g[1] = (b) => n.value = !1)
1896
- }, " X ")
1897
- ]),
1898
- B(ee, { "max-height": "650px" }, {
1899
- default: et(() => [
1900
- s.value === "剖面视图" ? (se(), ne("div", Pn, [
1901
- _("div", kn, [
1902
- _("label", Fn, [
1903
- X(_("input", {
1904
- type: "radio",
1905
- name: "clipping-axis",
1906
- value: "none",
1907
- "onUpdate:modelValue": g[2] || (g[2] = (b) => J(L) ? L.value = b : null),
1908
- onChange: g[3] || (g[3] = //@ts-ignore
1909
- (...b) => N(w) && N(w)(...b))
1910
- }, null, 544), [
1911
- [Q, N(L)]
1912
- ]),
1913
- g[10] || (g[10] = _("span", { class: "radio-text" }, "无切割", -1))
1914
- ]),
1915
- _("label", Dn, [
1916
- X(_("input", {
1917
- type: "radio",
1918
- name: "clipping-axis",
1919
- value: "x",
1920
- "onUpdate:modelValue": g[4] || (g[4] = (b) => J(L) ? L.value = b : null),
1921
- onChange: g[5] || (g[5] = //@ts-ignore
1922
- (...b) => N(w) && N(w)(...b))
1923
- }, null, 544), [
1924
- [Q, N(L)]
1925
- ]),
1926
- g[11] || (g[11] = _("span", { class: "radio-text" }, "X轴切割", -1))
1927
- ]),
1928
- _("label", Hn, [
1929
- X(_("input", {
1930
- type: "radio",
1931
- name: "clipping-axis",
1932
- value: "y",
1933
- "onUpdate:modelValue": g[6] || (g[6] = (b) => J(L) ? L.value = b : null),
1934
- onChange: g[7] || (g[7] = //@ts-ignore
1935
- (...b) => N(w) && N(w)(...b))
1936
- }, null, 544), [
1937
- [Q, N(L)]
1938
- ]),
1939
- g[12] || (g[12] = _("span", { class: "radio-text" }, "Y轴切割", -1))
1940
- ]),
1941
- _("label", Un, [
1942
- X(_("input", {
1943
- type: "radio",
1944
- name: "clipping-axis",
1945
- value: "z",
1946
- "onUpdate:modelValue": g[8] || (g[8] = (b) => J(L) ? L.value = b : null),
1947
- onChange: g[9] || (g[9] = //@ts-ignore
1948
- (...b) => N(w) && N(w)(...b))
1949
- }, null, 544), [
1950
- [Q, N(L)]
1951
- ]),
1952
- g[13] || (g[13] = _("span", { class: "radio-text" }, "Z轴切割", -1))
1953
- ])
1954
- ])
1955
- ])) : xe("", !0)
1956
- ]),
1957
- _: 1
1958
- })
1959
- ], 512), [
1960
- [tt, n.value]
1961
- ]),
1962
- N(p) ? (se(), ne("div", Gn, [
1963
- g[14] || (g[14] = _("div", { class: "loading-spinner" }, null, -1)),
1964
- _("p", null, Re(N(R)), 1)
1965
- ])) : xe("", !0)
1966
- ]);
1967
- };
1968
- }
1969
- }), qn = /* @__PURE__ */ Xt(jn, [["__scopeId", "data-v-ef65c077"]]);
1970
- export {
1971
- qn as default
1972
- };