ss-component-new 1.2.11 → 1.2.13

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