ss-component-new 1.2.23 → 1.2.25
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.
- package/dist/MTLLoader-AqmsmIp6.cjs +6 -0
- package/dist/MTLLoader-DJNdEDx2.js +609 -0
- package/dist/OrbitControls-Bj5caXhQ.js +419 -0
- package/dist/OrbitControls-rTIa-2s-.cjs +1 -0
- package/dist/{animationData-Bwh55Xw6.cjs → animationData-Bc9LlHz0.cjs} +1 -1
- package/dist/{animationData-D0TJ-9dd.js → animationData-Ca4l4roD.js} +4 -4
- package/dist/array-Baxi4C30.cjs +11 -0
- package/dist/array-Ca6KqnNx.js +1142 -0
- package/dist/{dataUtil-i5X2xhin.cjs → dataUtil-Cg2dZbrV.cjs} +1 -1
- package/dist/{dataUtil-gEKo7CEq.js → dataUtil-DUI9Vz64.js} +2 -2
- package/dist/{fileUtil-GIRXMs25.cjs → fileUtil-CTTbs0aJ.cjs} +1 -1
- package/dist/{fileUtil-CN00xr9W.js → fileUtil-CWt--rV-.js} +1 -1
- package/dist/{iconfont-C9-pGpAJ.cjs → iconfont-BaUxcJrk.cjs} +1 -1
- package/dist/{iconfont-DTSZW2AU.js → iconfont-D886hAXy.js} +2 -2
- package/dist/icons/svg//345/215/225/345/205/203/345/272/223.svg +1 -0
- package/dist/icons/svg//346/250/241/345/236/213/347/256/241/347/220/206.svg +1 -0
- package/dist/icons/svg//346/265/201/347/250/213/345/272/223.svg +1 -0
- package/dist/icons/svg//347/225/214/351/235/242/344/277/256/346/224/271.svg +1 -0
- package/dist/{index-BOJUyAaV.cjs → index-1z9RrjZc.cjs} +1 -1
- package/dist/{index-DSlPg3dk.cjs → index-9wWF5fgR.cjs} +1 -1
- package/dist/index-B-I7BsZI.js +2570 -0
- package/dist/{index-CqYUVCh5.js → index-B-p8m73c.js} +12 -12
- package/dist/{index-CK54pscx.cjs → index-B1qlTlfX.cjs} +1 -1
- package/dist/{index-BD5yZDAq.js → index-B5iT5NR0.js} +2 -2
- package/dist/{index-BkIFY0hK.cjs → index-B8MyAHnT.cjs} +1 -1
- package/dist/{index-7oJ8Ile4.js → index-BLW6fsom.js} +1 -1
- package/dist/{index-DbCNaQ87.cjs → index-BMK703KG.cjs} +1 -1
- package/dist/{index-eH9RMVXv.cjs → index-BNYCmfv9.cjs} +1 -1
- package/dist/{index-ThNNBX7h.js → index-BQkk6yoU.js} +1 -1
- package/dist/index-BQq7Cw_K.cjs +1 -0
- package/dist/{index-pmcRbjPd.cjs → index-BZENxsjL.cjs} +1 -1
- package/dist/{index-BNYeBPmi.cjs → index-BZoOaP9C.cjs} +1 -1
- package/dist/{index-G_cKl_J4.js → index-B_jnPuBE.js} +275 -270
- package/dist/{index-XXKsLOYd.js → index-Bke5IOmW.js} +2 -2
- package/dist/{index-DrWIUUZK.cjs → index-BtfS9ULE.cjs} +1 -1
- package/dist/{index-CvC2498b.js → index-BuLPXgWU.js} +5 -5
- package/dist/index-BxXOWAHT.cjs +1 -0
- package/dist/{index-2fqHNrPg.js → index-C8OFJprL.js} +4 -4
- package/dist/{index-CtXpoEg0.cjs → index-C9OPT3q5.cjs} +1 -1
- package/dist/{index-D8Y3imz9.cjs → index-CEV2ULrI.cjs} +1 -1
- package/dist/{index-BTTpV9o2.js → index-CTRrKUtw.js} +14 -14
- package/dist/{index-CptCatmL.js → index-CYmHP5Ky.js} +48 -32
- package/dist/{index-Dfwm0xPp.cjs → index-Cb0d2cT8.cjs} +1 -1
- package/dist/{index-Cl6HMOao.js → index-CeeMzEXY.js} +1 -1
- package/dist/{index-tttYIzsn.cjs → index-CjI5pDiU.cjs} +1 -1
- package/dist/{index-DEs8s152.js → index-CmUjrEkz.js} +6 -6
- package/dist/index-CtE7IIJq.js +7297 -0
- package/dist/{index-DSchKIyh.cjs → index-CxnH4vfV.cjs} +1 -1
- package/dist/index-CyY9deE5.cjs +1 -0
- package/dist/{index-DlIkbsRf.js → index-Cyk3pWtk.js} +6 -6
- package/dist/index-D-eD7QhS.js +654 -0
- package/dist/{index-NlkdTb--.js → index-D0odjY-X.js} +4 -4
- package/dist/{index-B0dydZDW.js → index-D1cjMjid.js} +1 -1
- package/dist/index-D5gT6DCZ.cjs +1 -0
- package/dist/{index-CvrBt7bU.js → index-D7GiDyDn.js} +6 -6
- package/dist/index-D88kGgy-.cjs +1 -0
- package/dist/{index-DMbCaqEC.cjs → index-DEExEFRs.cjs} +13 -13
- package/dist/{index-DllJulGH.cjs → index-DFMKBytS.cjs} +1 -1
- package/dist/{index-Dm_WlV6R.js → index-DNe_JGg0.js} +1 -1
- package/dist/{index-Bvk4OpkL.js → index-DTCPY-4V.js} +2 -2
- package/dist/{index-BTfg83yY.cjs → index-DTuCopl-.cjs} +1 -1
- package/dist/{index-BwEfrokO.js → index-DVSVJAdn.js} +2 -2
- package/dist/{index-7Ru3e632.cjs → index-DYr8VySV.cjs} +1 -1
- package/dist/{index-BQBxzTyE.js → index-DkA_gjlb.js} +2 -2
- package/dist/{index-7gU0r1We.cjs → index-Dkoh6zZr.cjs} +1 -1
- package/dist/{index-DNs9XPOG.js → index-DpE6q48b.js} +2 -2
- package/dist/{index-BVFL7Z_0.js → index-DqAAn-WP.js} +5 -5
- package/dist/{index-DHp714Ep.cjs → index-DrgssxCP.cjs} +1 -1
- package/dist/{index-Bt2MaT2G.js → index-J98IKvqx.js} +6 -6
- package/dist/{index-C6C5VWbs.cjs → index-PNi4RMPc.cjs} +1 -1
- package/dist/index-XXEzSATd.js +158 -0
- package/dist/{index-CADH_aSQ.cjs → index-clFmHtGU.cjs} +1 -1
- package/dist/{index-Be1LJMUR.js → index-pFuDv6dx.js} +2 -2
- package/dist/{index-BuSsSHAY.js → index-sk7jYyaG.js} +2301 -2282
- package/dist/{index-DQ3y1xkr.cjs → index-vmURlfDn.cjs} +1 -1
- package/dist/{index-BXEOQo2c.cjs → index-yyc7_nsV.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BCjeeJqj.cjs +5675 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CtycIAIT.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js} +41519 -48931
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-De0avjy5.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Dv39W1q4.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DhMDLOg8.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-OXHjy9ED.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-C4gG2WxT.cjs +56 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CEcxaThh.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CEIVtyL9.js} +10702 -10654
- package/dist/index.vue_vue_type_style_index_1_lang-D0ileuYo.cjs +32 -0
- package/dist/index.vue_vue_type_style_index_1_lang-DOP0uVOd.cjs +5 -0
- package/dist/index.vue_vue_type_style_index_1_lang-DSKzPKLD.js +8262 -0
- package/dist/{index.vue_vue_type_style_index_1_lang-DzZEPkuk.js → index.vue_vue_type_style_index_1_lang-DkkdpQbZ.js} +1368 -1456
- package/dist/{isString-CELwppr9.cjs → isString-BmAegMGI.cjs} +1 -1
- package/dist/{isString-DvY0kl3S.js → isString-CohCsKzS.js} +1 -1
- package/dist/{main-DQXqHTYg.js → main-B4gwcsBp.js} +5 -5
- package/dist/{main-yiUkyrA7.cjs → main-HIDJ5ncj.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +11 -11
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +12 -12
- package/dist/{threeModel-BiWZCOOI.js → threeModel-LJMbJaUb.js} +5 -5
- package/dist/{threeModel-Cva5i9Dy.cjs → threeModel-tRhkTPHD.cjs} +1 -1
- package/dist/threePreview-CeCm5KTT.cjs +1 -0
- package/dist/{threePreview-CjFKHY3_.js → threePreview-CqWnM1XW.js} +442 -541
- package/dist/{threeSceneView-DM8uof_D.cjs → threeSceneView-CTChIfwR.cjs} +1 -1
- package/dist/{threeSceneView-DPTQ_xR-.js → threeSceneView-D2mX_5N9.js} +11 -11
- package/dist/{threeSceneViewForCPMPIP-D5jl1r-h.cjs → threeSceneViewForCPMPIP-C_MBwi1O.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-Bqb44i-c.js → threeSceneViewForCPMPIP-CpVcogbP.js} +10 -10
- package/dist/{threeTrackPathView-BvxoafSz.js → threeTrackPathView-DMTpRQTP.js} +172 -354
- package/dist/threeTrackPathView-Deim_dX7.cjs +371 -0
- package/dist/threeViewerHost-BMrWNnGK.cjs +1 -0
- package/dist/{threeViewerHost-CKmZPGir.js → threeViewerHost-WXqI_L3g.js} +91 -78
- package/dist/{urdfTree-BxuavyNQ.js → urdfTree-BX92weHU.js} +1 -1
- package/dist/{urdfTree-wR2vnG4s.cjs → urdfTree-CbDb_7PZ.cjs} +1 -1
- package/dist/{workpieceTreePanel-C2BXrv3k.cjs → workpieceTreePanel-CbTolK6t.cjs} +1 -1
- package/dist/{workpieceTreePanel-CSKzSdIt.js → workpieceTreePanel-Q4S9btz3.js} +18 -18
- package/package.json +1 -1
- package/public/icons/svg//345/215/225/345/205/203/345/272/223.svg +1 -0
- package/public/icons/svg//346/250/241/345/236/213/347/256/241/347/220/206.svg +1 -0
- package/public/icons/svg//346/265/201/347/250/213/345/272/223.svg +1 -0
- package/public/icons/svg//347/225/214/351/235/242/344/277/256/346/224/271.svg +1 -0
- package/dist/MTLLoader-B8MnfNfT.cjs +0 -6
- package/dist/MTLLoader-BD3cbBAW.js +0 -657
- package/dist/OrbitControls-2UHRU9Fu.cjs +0 -1
- package/dist/OrbitControls-D1pz0uFI.js +0 -458
- package/dist/array-DMPAgNcb.cjs +0 -11
- package/dist/array-DTXrs6ZK.js +0 -1207
- package/dist/index-BLwwxnzs.cjs +0 -1
- package/dist/index-BVdolwlx.js +0 -7293
- package/dist/index-Bm3FE_ss.js +0 -504
- package/dist/index-BpTrDbkf.js +0 -22
- package/dist/index-C54wX50t.cjs +0 -1
- package/dist/index-CFriKZ-T.cjs +0 -1
- package/dist/index-CsOz5vsv.cjs +0 -1
- package/dist/index-D4pN9YmB.js +0 -144
- package/dist/index-DOhvzke2.js +0 -24
- package/dist/index-DPX3w6cO.js +0 -2643
- package/dist/index-DR9beXhk.cjs +0 -1
- package/dist/index-Do8zI4DM.cjs +0 -1
- package/dist/index-dwX_BHyo.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D6X3fCNs.cjs +0 -5677
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DLuOs1IZ.cjs +0 -56
- package/dist/index.vue_vue_type_style_index_1_lang-B0l6QIWy.js +0 -7806
- package/dist/index.vue_vue_type_style_index_1_lang-CC1o5rIu.cjs +0 -32
- package/dist/index.vue_vue_type_style_index_1_lang-Chzrrthw.cjs +0 -6
- package/dist/threePreview-BNvDY6xx.cjs +0 -1
- package/dist/threeTrackPathView-DgnuPrBe.cjs +0 -370
- package/dist/threeViewerHost-D80V4Cfh.cjs +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ref as K, shallowRef as
|
|
2
|
-
import { u as
|
|
3
|
-
import { J as
|
|
4
|
-
import { E as
|
|
5
|
-
import { M as
|
|
6
|
-
import { T as
|
|
7
|
-
import { _ as
|
|
8
|
-
function Le(
|
|
9
|
-
if (t ===
|
|
10
|
-
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),
|
|
11
|
-
if (t === ce || t ===
|
|
12
|
-
let e =
|
|
1
|
+
import { ref as K, shallowRef as Ue, defineComponent as je, watch as Z, onMounted as Ke, nextTick as Ve, onBeforeUnmount as Xe, resolveComponent as ze, createElementBlock as ee, openBlock as te, createElementVNode as _, withDirectives as X, createCommentVNode as he, createVNode as H, unref as y, renderSlot as pe, toDisplayString as me, withCtx as qe, isRef as Q, vModelRadio as $, vShow as We } from "vue";
|
|
2
|
+
import { u as Ye, a as Qe, b as $e } from "./iconfont-D886hAXy.js";
|
|
3
|
+
import { J as Je, K as ce, N as ye, O as Ze, Q as W, R as Se, U as O, Y as Ne, C as G, Z as D, f as Y, _ as et, n as tt, D as nt, r as J, V as j, $ as st, a0 as Ie, a1 as rt, a2 as Ce, a3 as it, a4 as ot, a5 as ne, a6 as at, a7 as Oe, a8 as ct, a9 as lt, aa as ut, ab as ve, ac as dt, ad as le, ae as ft, af as ht, ag as pt, ah as se, ai as mt, v as De, p as gt, aj as q, ak as At, w as Tt, al as xt, k as Fe, am as Rt, y as Et, an as Lt, ao as _t, u as re, P as wt, s as bt, ap as Mt, aq as yt, ar as St, as as Nt, at as It, au as ke, av as Ct, aw as ge, ax as Ae, ay as Te, az as xe, aA as Re, aB as Ot, aC as vt, B as Pe, aD as Dt, o as Ft } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js";
|
|
4
|
+
import { E as Ee } from "./index-DNe_JGg0.js";
|
|
5
|
+
import { M as kt, O as Pt, S as Ht } from "./MTLLoader-DJNdEDx2.js";
|
|
6
|
+
import { T as U } from "./svgIcon-D-_fXUBL.js";
|
|
7
|
+
import { _ as Bt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
|
+
function Le(d, t) {
|
|
9
|
+
if (t === Je)
|
|
10
|
+
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
|
11
|
+
if (t === ce || t === ye) {
|
|
12
|
+
let e = d.getIndex();
|
|
13
13
|
if (e === null) {
|
|
14
|
-
const r = [], a =
|
|
14
|
+
const r = [], a = d.getAttribute("position");
|
|
15
15
|
if (a !== void 0) {
|
|
16
16
|
for (let o = 0; o < a.count; o++)
|
|
17
17
|
r.push(o);
|
|
18
|
-
|
|
18
|
+
d.setIndex(r), e = d.getIndex();
|
|
19
19
|
} else
|
|
20
|
-
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),
|
|
20
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
|
|
21
21
|
}
|
|
22
22
|
const i = e.count - 2, n = [];
|
|
23
23
|
if (t === ce)
|
|
@@ -27,22 +27,17 @@ function Le(f, t) {
|
|
|
27
27
|
for (let r = 0; r < i; r++)
|
|
28
28
|
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)));
|
|
29
29
|
n.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
30
|
-
const s =
|
|
30
|
+
const s = d.clone();
|
|
31
31
|
return s.setIndex(n), s.clearGroups(), s;
|
|
32
32
|
} else
|
|
33
|
-
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t),
|
|
33
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), d;
|
|
34
34
|
}
|
|
35
|
-
class Gt extends
|
|
36
|
-
/**
|
|
37
|
-
* Constructs a new glTF loader.
|
|
38
|
-
*
|
|
39
|
-
* @param {LoadingManager} [manager] - The loading manager.
|
|
40
|
-
*/
|
|
35
|
+
class Gt extends Ze {
|
|
41
36
|
constructor(t) {
|
|
42
37
|
super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
|
|
43
|
-
return new zt(e);
|
|
44
|
-
}), this.register(function(e) {
|
|
45
38
|
return new Xt(e);
|
|
39
|
+
}), this.register(function(e) {
|
|
40
|
+
return new zt(e);
|
|
46
41
|
}), this.register(function(e) {
|
|
47
42
|
return new tn(e);
|
|
48
43
|
}), this.register(function(e) {
|
|
@@ -54,13 +49,13 @@ class Gt extends et {
|
|
|
54
49
|
}), this.register(function(e) {
|
|
55
50
|
return new Yt(e);
|
|
56
51
|
}), this.register(function(e) {
|
|
57
|
-
return new
|
|
52
|
+
return new Qt(e);
|
|
58
53
|
}), this.register(function(e) {
|
|
59
|
-
return new
|
|
54
|
+
return new $t(e);
|
|
60
55
|
}), this.register(function(e) {
|
|
61
56
|
return new Vt(e);
|
|
62
57
|
}), this.register(function(e) {
|
|
63
|
-
return new
|
|
58
|
+
return new Jt(e);
|
|
64
59
|
}), this.register(function(e) {
|
|
65
60
|
return new qt(e);
|
|
66
61
|
}), this.register(function(e) {
|
|
@@ -68,22 +63,13 @@ class Gt extends et {
|
|
|
68
63
|
}), this.register(function(e) {
|
|
69
64
|
return new Zt(e);
|
|
70
65
|
}), this.register(function(e) {
|
|
71
|
-
return new
|
|
66
|
+
return new jt(e);
|
|
72
67
|
}), this.register(function(e) {
|
|
73
68
|
return new rn(e);
|
|
74
69
|
}), this.register(function(e) {
|
|
75
70
|
return new on(e);
|
|
76
71
|
});
|
|
77
72
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Starts loading from the given URL and passes the loaded glTF asset
|
|
80
|
-
* to the `onLoad()` callback.
|
|
81
|
-
*
|
|
82
|
-
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
83
|
-
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
84
|
-
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
85
|
-
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
86
|
-
*/
|
|
87
73
|
load(t, e, i, n) {
|
|
88
74
|
const s = this;
|
|
89
75
|
let r;
|
|
@@ -97,7 +83,7 @@ class Gt extends et {
|
|
|
97
83
|
this.manager.itemStart(t);
|
|
98
84
|
const a = function(c) {
|
|
99
85
|
n ? n(c) : console.error(c), s.manager.itemError(t), s.manager.itemEnd(t);
|
|
100
|
-
}, o = new
|
|
86
|
+
}, o = new Se(this.manager);
|
|
101
87
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
|
|
102
88
|
try {
|
|
103
89
|
s.parse(c, r, function(u) {
|
|
@@ -108,78 +94,40 @@ class Gt extends et {
|
|
|
108
94
|
}
|
|
109
95
|
}, i, a);
|
|
110
96
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Sets the given Draco loader to this loader. Required for decoding assets
|
|
113
|
-
* compressed with the `KHR_draco_mesh_compression` extension.
|
|
114
|
-
*
|
|
115
|
-
* @param {DRACOLoader} dracoLoader - The Draco loader to set.
|
|
116
|
-
* @return {GLTFLoader} A reference to this loader.
|
|
117
|
-
*/
|
|
118
97
|
setDRACOLoader(t) {
|
|
119
98
|
return this.dracoLoader = t, this;
|
|
120
99
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* @return {GLTFLoader} A reference to this loader.
|
|
127
|
-
*/
|
|
100
|
+
setDDSLoader() {
|
|
101
|
+
throw new Error(
|
|
102
|
+
'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
|
|
103
|
+
);
|
|
104
|
+
}
|
|
128
105
|
setKTX2Loader(t) {
|
|
129
106
|
return this.ktx2Loader = t, this;
|
|
130
107
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Sets the given meshopt decoder. Required for decoding assets
|
|
133
|
-
* compressed with the `EXT_meshopt_compression` extension.
|
|
134
|
-
*
|
|
135
|
-
* @param {Object} meshoptDecoder - The meshopt decoder to set.
|
|
136
|
-
* @return {GLTFLoader} A reference to this loader.
|
|
137
|
-
*/
|
|
138
108
|
setMeshoptDecoder(t) {
|
|
139
109
|
return this.meshoptDecoder = t, this;
|
|
140
110
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Registers a plugin callback. This API is internally used to implement the various
|
|
143
|
-
* glTF extensions but can also used by third-party code to add additional logic
|
|
144
|
-
* to the loader.
|
|
145
|
-
*
|
|
146
|
-
* @param {function(parser:GLTFParser)} callback - The callback function to register.
|
|
147
|
-
* @return {GLTFLoader} A reference to this loader.
|
|
148
|
-
*/
|
|
149
111
|
register(t) {
|
|
150
112
|
return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
|
|
151
113
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Unregisters a plugin callback.
|
|
154
|
-
*
|
|
155
|
-
* @param {Function} callback - The callback function to unregister.
|
|
156
|
-
* @return {GLTFLoader} A reference to this loader.
|
|
157
|
-
*/
|
|
158
114
|
unregister(t) {
|
|
159
115
|
return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
|
|
160
116
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Parses the given FBX data and returns the resulting group.
|
|
163
|
-
*
|
|
164
|
-
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
165
|
-
* @param {string} path - The URL base path.
|
|
166
|
-
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
167
|
-
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
168
|
-
*/
|
|
169
117
|
parse(t, e, i, n) {
|
|
170
118
|
let s;
|
|
171
119
|
const r = {}, a = {}, o = new TextDecoder();
|
|
172
120
|
if (typeof t == "string")
|
|
173
121
|
s = JSON.parse(t);
|
|
174
122
|
else if (t instanceof ArrayBuffer)
|
|
175
|
-
if (o.decode(new Uint8Array(t, 0, 4)) ===
|
|
123
|
+
if (o.decode(new Uint8Array(t, 0, 4)) === He) {
|
|
176
124
|
try {
|
|
177
|
-
r[
|
|
125
|
+
r[x.KHR_BINARY_GLTF] = new an(t);
|
|
178
126
|
} catch (l) {
|
|
179
127
|
n && n(l);
|
|
180
128
|
return;
|
|
181
129
|
}
|
|
182
|
-
s = JSON.parse(r[
|
|
130
|
+
s = JSON.parse(r[x.KHR_BINARY_GLTF].content);
|
|
183
131
|
} else
|
|
184
132
|
s = JSON.parse(o.decode(t));
|
|
185
133
|
else
|
|
@@ -188,7 +136,7 @@ class Gt extends et {
|
|
|
188
136
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
189
137
|
return;
|
|
190
138
|
}
|
|
191
|
-
const c = new
|
|
139
|
+
const c = new Rn(s, {
|
|
192
140
|
path: e || this.resourcePath || "",
|
|
193
141
|
crossOrigin: this.crossOrigin,
|
|
194
142
|
requestHeader: this.requestHeader,
|
|
@@ -203,34 +151,26 @@ class Gt extends et {
|
|
|
203
151
|
}
|
|
204
152
|
if (s.extensionsUsed)
|
|
205
153
|
for (let u = 0; u < s.extensionsUsed.length; ++u) {
|
|
206
|
-
const l = s.extensionsUsed[u],
|
|
154
|
+
const l = s.extensionsUsed[u], f = s.extensionsRequired || [];
|
|
207
155
|
switch (l) {
|
|
208
|
-
case
|
|
156
|
+
case x.KHR_MATERIALS_UNLIT:
|
|
209
157
|
r[l] = new Kt();
|
|
210
158
|
break;
|
|
211
|
-
case
|
|
159
|
+
case x.KHR_DRACO_MESH_COMPRESSION:
|
|
212
160
|
r[l] = new cn(s, this.dracoLoader);
|
|
213
161
|
break;
|
|
214
|
-
case
|
|
162
|
+
case x.KHR_TEXTURE_TRANSFORM:
|
|
215
163
|
r[l] = new ln();
|
|
216
164
|
break;
|
|
217
|
-
case
|
|
165
|
+
case x.KHR_MESH_QUANTIZATION:
|
|
218
166
|
r[l] = new un();
|
|
219
167
|
break;
|
|
220
168
|
default:
|
|
221
|
-
|
|
169
|
+
f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
|
|
222
170
|
}
|
|
223
171
|
}
|
|
224
172
|
c.setExtensions(r), c.setPlugins(a), c.parse(i, n);
|
|
225
173
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Async version of {@link GLTFLoader#parse}.
|
|
228
|
-
*
|
|
229
|
-
* @async
|
|
230
|
-
* @param {string|ArrayBuffer} data - The raw glTF data.
|
|
231
|
-
* @param {string} path - The URL base path.
|
|
232
|
-
* @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
|
|
233
|
-
*/
|
|
234
174
|
parseAsync(t, e) {
|
|
235
175
|
const i = this;
|
|
236
176
|
return new Promise(function(n, s) {
|
|
@@ -238,24 +178,24 @@ class Gt extends et {
|
|
|
238
178
|
});
|
|
239
179
|
}
|
|
240
180
|
}
|
|
241
|
-
function
|
|
242
|
-
let
|
|
181
|
+
function Ut() {
|
|
182
|
+
let d = {};
|
|
243
183
|
return {
|
|
244
184
|
get: function(t) {
|
|
245
|
-
return
|
|
185
|
+
return d[t];
|
|
246
186
|
},
|
|
247
187
|
add: function(t, e) {
|
|
248
|
-
|
|
188
|
+
d[t] = e;
|
|
249
189
|
},
|
|
250
190
|
remove: function(t) {
|
|
251
|
-
delete
|
|
191
|
+
delete d[t];
|
|
252
192
|
},
|
|
253
193
|
removeAll: function() {
|
|
254
|
-
|
|
194
|
+
d = {};
|
|
255
195
|
}
|
|
256
196
|
};
|
|
257
197
|
}
|
|
258
|
-
const
|
|
198
|
+
const x = {
|
|
259
199
|
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
260
200
|
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
261
201
|
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
@@ -279,9 +219,9 @@ const R = {
|
|
|
279
219
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
280
220
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
281
221
|
};
|
|
282
|
-
class
|
|
222
|
+
class jt {
|
|
283
223
|
constructor(t) {
|
|
284
|
-
this.parser = t, this.name =
|
|
224
|
+
this.parser = t, this.name = x.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
285
225
|
}
|
|
286
226
|
_markDefs() {
|
|
287
227
|
const t = this.parser, e = this.parser.json.nodes || [];
|
|
@@ -297,22 +237,22 @@ class Bt {
|
|
|
297
237
|
const s = e.json, o = ((s.extensions && s.extensions[this.name] || {}).lights || [])[t];
|
|
298
238
|
let c;
|
|
299
239
|
const u = new G(16777215);
|
|
300
|
-
o.color !== void 0 && u.setRGB(o.color[0], o.color[1], o.color[2],
|
|
240
|
+
o.color !== void 0 && u.setRGB(o.color[0], o.color[1], o.color[2], D);
|
|
301
241
|
const l = o.range !== void 0 ? o.range : 0;
|
|
302
242
|
switch (o.type) {
|
|
303
243
|
case "directional":
|
|
304
|
-
c = new
|
|
244
|
+
c = new nt(u), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
305
245
|
break;
|
|
306
246
|
case "point":
|
|
307
|
-
c = new
|
|
247
|
+
c = new tt(u), c.distance = l;
|
|
308
248
|
break;
|
|
309
249
|
case "spot":
|
|
310
|
-
c = new
|
|
250
|
+
c = new et(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);
|
|
311
251
|
break;
|
|
312
252
|
default:
|
|
313
253
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
|
|
314
254
|
}
|
|
315
|
-
return c.position.set(0, 0, 0),
|
|
255
|
+
return c.position.set(0, 0, 0), c.decay = 2, 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;
|
|
316
256
|
}
|
|
317
257
|
getDependency(t, e) {
|
|
318
258
|
if (t === "light")
|
|
@@ -327,7 +267,7 @@ class Bt {
|
|
|
327
267
|
}
|
|
328
268
|
class Kt {
|
|
329
269
|
constructor() {
|
|
330
|
-
this.name =
|
|
270
|
+
this.name = x.KHR_MATERIALS_UNLIT;
|
|
331
271
|
}
|
|
332
272
|
getMaterialType() {
|
|
333
273
|
return q;
|
|
@@ -339,7 +279,7 @@ class Kt {
|
|
|
339
279
|
if (s) {
|
|
340
280
|
if (Array.isArray(s.baseColorFactor)) {
|
|
341
281
|
const r = s.baseColorFactor;
|
|
342
|
-
t.color.setRGB(r[0], r[1], r[2],
|
|
282
|
+
t.color.setRGB(r[0], r[1], r[2], D), t.opacity = r[3];
|
|
343
283
|
}
|
|
344
284
|
s.baseColorTexture !== void 0 && n.push(i.assignTexture(t, "map", s.baseColorTexture, Y));
|
|
345
285
|
}
|
|
@@ -348,7 +288,7 @@ class Kt {
|
|
|
348
288
|
}
|
|
349
289
|
class Vt {
|
|
350
290
|
constructor(t) {
|
|
351
|
-
this.parser = t, this.name =
|
|
291
|
+
this.parser = t, this.name = x.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
352
292
|
}
|
|
353
293
|
extendMaterialParams(t, e) {
|
|
354
294
|
const n = this.parser.json.materials[t];
|
|
@@ -358,9 +298,9 @@ class Vt {
|
|
|
358
298
|
return s !== void 0 && (e.emissiveIntensity = s), Promise.resolve();
|
|
359
299
|
}
|
|
360
300
|
}
|
|
361
|
-
class
|
|
301
|
+
class Xt {
|
|
362
302
|
constructor(t) {
|
|
363
|
-
this.parser = t, this.name =
|
|
303
|
+
this.parser = t, this.name = x.KHR_MATERIALS_CLEARCOAT;
|
|
364
304
|
}
|
|
365
305
|
getMaterialType(t) {
|
|
366
306
|
const i = this.parser.json.materials[t];
|
|
@@ -373,14 +313,14 @@ class zt {
|
|
|
373
313
|
const s = [], r = n.extensions[this.name];
|
|
374
314
|
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)) {
|
|
375
315
|
const a = r.clearcoatNormalTexture.scale;
|
|
376
|
-
e.clearcoatNormalScale = new
|
|
316
|
+
e.clearcoatNormalScale = new Ne(a, a);
|
|
377
317
|
}
|
|
378
318
|
return Promise.all(s);
|
|
379
319
|
}
|
|
380
320
|
}
|
|
381
|
-
class
|
|
321
|
+
class zt {
|
|
382
322
|
constructor(t) {
|
|
383
|
-
this.parser = t, this.name =
|
|
323
|
+
this.parser = t, this.name = x.KHR_MATERIALS_DISPERSION;
|
|
384
324
|
}
|
|
385
325
|
getMaterialType(t) {
|
|
386
326
|
const i = this.parser.json.materials[t];
|
|
@@ -396,7 +336,7 @@ class Xt {
|
|
|
396
336
|
}
|
|
397
337
|
class qt {
|
|
398
338
|
constructor(t) {
|
|
399
|
-
this.parser = t, this.name =
|
|
339
|
+
this.parser = t, this.name = x.KHR_MATERIALS_IRIDESCENCE;
|
|
400
340
|
}
|
|
401
341
|
getMaterialType(t) {
|
|
402
342
|
const i = this.parser.json.materials[t];
|
|
@@ -412,7 +352,7 @@ class qt {
|
|
|
412
352
|
}
|
|
413
353
|
class Wt {
|
|
414
354
|
constructor(t) {
|
|
415
|
-
this.parser = t, this.name =
|
|
355
|
+
this.parser = t, this.name = x.KHR_MATERIALS_SHEEN;
|
|
416
356
|
}
|
|
417
357
|
getMaterialType(t) {
|
|
418
358
|
const i = this.parser.json.materials[t];
|
|
@@ -427,14 +367,14 @@ class Wt {
|
|
|
427
367
|
const r = n.extensions[this.name];
|
|
428
368
|
if (r.sheenColorFactor !== void 0) {
|
|
429
369
|
const a = r.sheenColorFactor;
|
|
430
|
-
e.sheenColor.setRGB(a[0], a[1], a[2],
|
|
370
|
+
e.sheenColor.setRGB(a[0], a[1], a[2], D);
|
|
431
371
|
}
|
|
432
372
|
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);
|
|
433
373
|
}
|
|
434
374
|
}
|
|
435
375
|
class Yt {
|
|
436
376
|
constructor(t) {
|
|
437
|
-
this.parser = t, this.name =
|
|
377
|
+
this.parser = t, this.name = x.KHR_MATERIALS_TRANSMISSION;
|
|
438
378
|
}
|
|
439
379
|
getMaterialType(t) {
|
|
440
380
|
const i = this.parser.json.materials[t];
|
|
@@ -448,9 +388,9 @@ class Yt {
|
|
|
448
388
|
return r.transmissionFactor !== void 0 && (e.transmission = r.transmissionFactor), r.transmissionTexture !== void 0 && s.push(i.assignTexture(e, "transmissionMap", r.transmissionTexture)), Promise.all(s);
|
|
449
389
|
}
|
|
450
390
|
}
|
|
451
|
-
class
|
|
391
|
+
class Qt {
|
|
452
392
|
constructor(t) {
|
|
453
|
-
this.parser = t, this.name =
|
|
393
|
+
this.parser = t, this.name = x.KHR_MATERIALS_VOLUME;
|
|
454
394
|
}
|
|
455
395
|
getMaterialType(t) {
|
|
456
396
|
const i = this.parser.json.materials[t];
|
|
@@ -463,12 +403,12 @@ class $t {
|
|
|
463
403
|
const s = [], r = n.extensions[this.name];
|
|
464
404
|
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;
|
|
465
405
|
const a = r.attenuationColor || [1, 1, 1];
|
|
466
|
-
return e.attenuationColor = new G().setRGB(a[0], a[1], a[2],
|
|
406
|
+
return e.attenuationColor = new G().setRGB(a[0], a[1], a[2], D), Promise.all(s);
|
|
467
407
|
}
|
|
468
408
|
}
|
|
469
|
-
class
|
|
409
|
+
class $t {
|
|
470
410
|
constructor(t) {
|
|
471
|
-
this.parser = t, this.name =
|
|
411
|
+
this.parser = t, this.name = x.KHR_MATERIALS_IOR;
|
|
472
412
|
}
|
|
473
413
|
getMaterialType(t) {
|
|
474
414
|
const i = this.parser.json.materials[t];
|
|
@@ -482,9 +422,9 @@ class Jt {
|
|
|
482
422
|
return e.ior = s.ior !== void 0 ? s.ior : 1.5, Promise.resolve();
|
|
483
423
|
}
|
|
484
424
|
}
|
|
485
|
-
class
|
|
425
|
+
class Jt {
|
|
486
426
|
constructor(t) {
|
|
487
|
-
this.parser = t, this.name =
|
|
427
|
+
this.parser = t, this.name = x.KHR_MATERIALS_SPECULAR;
|
|
488
428
|
}
|
|
489
429
|
getMaterialType(t) {
|
|
490
430
|
const i = this.parser.json.materials[t];
|
|
@@ -497,12 +437,12 @@ class Qt {
|
|
|
497
437
|
const s = [], r = n.extensions[this.name];
|
|
498
438
|
e.specularIntensity = r.specularFactor !== void 0 ? r.specularFactor : 1, r.specularTexture !== void 0 && s.push(i.assignTexture(e, "specularIntensityMap", r.specularTexture));
|
|
499
439
|
const a = r.specularColorFactor || [1, 1, 1];
|
|
500
|
-
return e.specularColor = new G().setRGB(a[0], a[1], a[2],
|
|
440
|
+
return e.specularColor = new G().setRGB(a[0], a[1], a[2], D), r.specularColorTexture !== void 0 && s.push(i.assignTexture(e, "specularColorMap", r.specularColorTexture, Y)), Promise.all(s);
|
|
501
441
|
}
|
|
502
442
|
}
|
|
503
443
|
class Zt {
|
|
504
444
|
constructor(t) {
|
|
505
|
-
this.parser = t, this.name =
|
|
445
|
+
this.parser = t, this.name = x.EXT_MATERIALS_BUMP;
|
|
506
446
|
}
|
|
507
447
|
getMaterialType(t) {
|
|
508
448
|
const i = this.parser.json.materials[t];
|
|
@@ -518,7 +458,7 @@ class Zt {
|
|
|
518
458
|
}
|
|
519
459
|
class en {
|
|
520
460
|
constructor(t) {
|
|
521
|
-
this.parser = t, this.name =
|
|
461
|
+
this.parser = t, this.name = x.KHR_MATERIALS_ANISOTROPY;
|
|
522
462
|
}
|
|
523
463
|
getMaterialType(t) {
|
|
524
464
|
const i = this.parser.json.materials[t];
|
|
@@ -534,7 +474,7 @@ class en {
|
|
|
534
474
|
}
|
|
535
475
|
class tn {
|
|
536
476
|
constructor(t) {
|
|
537
|
-
this.parser = t, this.name =
|
|
477
|
+
this.parser = t, this.name = x.KHR_TEXTURE_BASISU;
|
|
538
478
|
}
|
|
539
479
|
loadTexture(t) {
|
|
540
480
|
const e = this.parser, i = e.json, n = i.textures[t];
|
|
@@ -551,7 +491,7 @@ class tn {
|
|
|
551
491
|
}
|
|
552
492
|
class nn {
|
|
553
493
|
constructor(t) {
|
|
554
|
-
this.parser = t, this.name =
|
|
494
|
+
this.parser = t, this.name = x.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
555
495
|
}
|
|
556
496
|
loadTexture(t) {
|
|
557
497
|
const e = this.name, i = this.parser, n = i.json, s = n.textures[t];
|
|
@@ -563,12 +503,25 @@ class nn {
|
|
|
563
503
|
const c = i.options.manager.getHandler(a.uri);
|
|
564
504
|
c !== null && (o = c);
|
|
565
505
|
}
|
|
566
|
-
return
|
|
506
|
+
return this.detectSupport().then(function(c) {
|
|
507
|
+
if (c) return i.loadTextureImage(t, r.source, o);
|
|
508
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
|
|
509
|
+
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
510
|
+
return i.loadTexture(t);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
detectSupport() {
|
|
514
|
+
return this.isSupported || (this.isSupported = new Promise(function(t) {
|
|
515
|
+
const e = new Image();
|
|
516
|
+
e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
|
|
517
|
+
t(e.height === 1);
|
|
518
|
+
};
|
|
519
|
+
})), this.isSupported;
|
|
567
520
|
}
|
|
568
521
|
}
|
|
569
522
|
class sn {
|
|
570
523
|
constructor(t) {
|
|
571
|
-
this.parser = t, this.name =
|
|
524
|
+
this.parser = t, this.name = x.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
572
525
|
}
|
|
573
526
|
loadTexture(t) {
|
|
574
527
|
const e = this.name, i = this.parser, n = i.json, s = n.textures[t];
|
|
@@ -580,12 +533,25 @@ class sn {
|
|
|
580
533
|
const c = i.options.manager.getHandler(a.uri);
|
|
581
534
|
c !== null && (o = c);
|
|
582
535
|
}
|
|
583
|
-
return
|
|
536
|
+
return this.detectSupport().then(function(c) {
|
|
537
|
+
if (c) return i.loadTextureImage(t, r.source, o);
|
|
538
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
|
|
539
|
+
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
540
|
+
return i.loadTexture(t);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
detectSupport() {
|
|
544
|
+
return this.isSupported || (this.isSupported = new Promise(function(t) {
|
|
545
|
+
const e = new Image();
|
|
546
|
+
e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
|
|
547
|
+
t(e.height === 1);
|
|
548
|
+
};
|
|
549
|
+
})), this.isSupported;
|
|
584
550
|
}
|
|
585
551
|
}
|
|
586
552
|
class rn {
|
|
587
553
|
constructor(t) {
|
|
588
|
-
this.name =
|
|
554
|
+
this.name = x.EXT_MESHOPT_COMPRESSION, this.parser = t;
|
|
589
555
|
}
|
|
590
556
|
loadBufferView(t) {
|
|
591
557
|
const e = this.parser.json, i = e.bufferViews[t];
|
|
@@ -597,12 +563,12 @@ class rn {
|
|
|
597
563
|
return null;
|
|
598
564
|
}
|
|
599
565
|
return s.then(function(a) {
|
|
600
|
-
const o = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, l = n.byteStride,
|
|
601
|
-
return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(u, l,
|
|
566
|
+
const o = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, l = n.byteStride, f = new Uint8Array(a, o, c);
|
|
567
|
+
return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(u, l, f, n.mode, n.filter).then(function(h) {
|
|
602
568
|
return h.buffer;
|
|
603
569
|
}) : r.ready.then(function() {
|
|
604
570
|
const h = new ArrayBuffer(u * l);
|
|
605
|
-
return r.decodeGltfBuffer(new Uint8Array(h), u, l,
|
|
571
|
+
return r.decodeGltfBuffer(new Uint8Array(h), u, l, f, n.mode, n.filter), h;
|
|
606
572
|
});
|
|
607
573
|
});
|
|
608
574
|
} else
|
|
@@ -611,7 +577,7 @@ class rn {
|
|
|
611
577
|
}
|
|
612
578
|
class on {
|
|
613
579
|
constructor(t) {
|
|
614
|
-
this.name =
|
|
580
|
+
this.name = x.EXT_MESH_GPU_INSTANCING, this.parser = t;
|
|
615
581
|
}
|
|
616
582
|
createNodeMesh(t) {
|
|
617
583
|
const e = this.parser.json, i = e.nodes[t];
|
|
@@ -625,46 +591,46 @@ class on {
|
|
|
625
591
|
for (const c in r)
|
|
626
592
|
a.push(this.parser.getDependency("accessor", r[c]).then((u) => (o[c] = u, o[c])));
|
|
627
593
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
|
|
628
|
-
const u = c.pop(), l = u.isGroup ? u.children : [u],
|
|
594
|
+
const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, h = [];
|
|
629
595
|
for (const p of l) {
|
|
630
|
-
const
|
|
631
|
-
for (let
|
|
632
|
-
o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION,
|
|
633
|
-
for (const
|
|
634
|
-
if (
|
|
635
|
-
const N = o[
|
|
636
|
-
|
|
637
|
-
} else
|
|
638
|
-
|
|
596
|
+
const T = new J(), m = new j(), g = new Ie(), R = new j(1, 1, 1), w = new st(p.geometry, p.material, f);
|
|
597
|
+
for (let A = 0; A < f; A++)
|
|
598
|
+
o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, A), o.ROTATION && g.fromBufferAttribute(o.ROTATION, A), o.SCALE && R.fromBufferAttribute(o.SCALE, A), w.setMatrixAt(A, T.compose(m, g, R));
|
|
599
|
+
for (const A in o)
|
|
600
|
+
if (A === "_COLOR_0") {
|
|
601
|
+
const N = o[A];
|
|
602
|
+
w.instanceColor = new rt(N.array, N.itemSize, N.normalized);
|
|
603
|
+
} else A !== "TRANSLATION" && A !== "ROTATION" && A !== "SCALE" && p.geometry.setAttribute(A, o[A]);
|
|
604
|
+
Ce.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), h.push(w);
|
|
639
605
|
}
|
|
640
606
|
return u.isGroup ? (u.clear(), u.add(...h), u) : h[0];
|
|
641
607
|
}));
|
|
642
608
|
}
|
|
643
609
|
}
|
|
644
|
-
const
|
|
610
|
+
const He = "glTF", z = 12, _e = { JSON: 1313821514, BIN: 5130562 };
|
|
645
611
|
class an {
|
|
646
612
|
constructor(t) {
|
|
647
|
-
this.name =
|
|
648
|
-
const e = new DataView(t, 0,
|
|
613
|
+
this.name = x.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
614
|
+
const e = new DataView(t, 0, z), i = new TextDecoder();
|
|
649
615
|
if (this.header = {
|
|
650
616
|
magic: i.decode(new Uint8Array(t.slice(0, 4))),
|
|
651
617
|
version: e.getUint32(4, !0),
|
|
652
618
|
length: e.getUint32(8, !0)
|
|
653
|
-
}, this.header.magic !==
|
|
619
|
+
}, this.header.magic !== He)
|
|
654
620
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
655
621
|
if (this.header.version < 2)
|
|
656
622
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
657
|
-
const n = this.header.length -
|
|
623
|
+
const n = this.header.length - z, s = new DataView(t, z);
|
|
658
624
|
let r = 0;
|
|
659
625
|
for (; r < n; ) {
|
|
660
626
|
const a = s.getUint32(r, !0);
|
|
661
627
|
r += 4;
|
|
662
628
|
const o = s.getUint32(r, !0);
|
|
663
|
-
if (r += 4, o ===
|
|
664
|
-
const c = new Uint8Array(t,
|
|
629
|
+
if (r += 4, o === _e.JSON) {
|
|
630
|
+
const c = new Uint8Array(t, z + r, a);
|
|
665
631
|
this.content = i.decode(c);
|
|
666
|
-
} else if (o ===
|
|
667
|
-
const c =
|
|
632
|
+
} else if (o === _e.BIN) {
|
|
633
|
+
const c = z + r;
|
|
668
634
|
this.body = t.slice(c, c + a);
|
|
669
635
|
}
|
|
670
636
|
r += a;
|
|
@@ -677,37 +643,37 @@ class cn {
|
|
|
677
643
|
constructor(t, e) {
|
|
678
644
|
if (!e)
|
|
679
645
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
680
|
-
this.name =
|
|
646
|
+
this.name = x.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
|
|
681
647
|
}
|
|
682
648
|
decodePrimitive(t, e) {
|
|
683
649
|
const i = this.json, n = this.dracoLoader, s = t.extensions[this.name].bufferView, r = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
|
|
684
650
|
for (const u in r) {
|
|
685
|
-
const l =
|
|
651
|
+
const l = ue[u] || u.toLowerCase();
|
|
686
652
|
a[l] = r[u];
|
|
687
653
|
}
|
|
688
654
|
for (const u in t.attributes) {
|
|
689
|
-
const l =
|
|
655
|
+
const l = ue[u] || u.toLowerCase();
|
|
690
656
|
if (r[u] !== void 0) {
|
|
691
|
-
const
|
|
692
|
-
c[l] = h.name, o[l] =
|
|
657
|
+
const f = i.accessors[t.attributes[u]], h = V[f.componentType];
|
|
658
|
+
c[l] = h.name, o[l] = f.normalized === !0;
|
|
693
659
|
}
|
|
694
660
|
}
|
|
695
661
|
return e.getDependency("bufferView", s).then(function(u) {
|
|
696
|
-
return new Promise(function(l,
|
|
662
|
+
return new Promise(function(l, f) {
|
|
697
663
|
n.decodeDracoFile(u, function(h) {
|
|
698
664
|
for (const p in h.attributes) {
|
|
699
|
-
const
|
|
700
|
-
m !== void 0 && (
|
|
665
|
+
const T = h.attributes[p], m = o[p];
|
|
666
|
+
m !== void 0 && (T.normalized = m);
|
|
701
667
|
}
|
|
702
668
|
l(h);
|
|
703
|
-
}, a, c,
|
|
669
|
+
}, a, c, D, f);
|
|
704
670
|
});
|
|
705
671
|
});
|
|
706
672
|
}
|
|
707
673
|
}
|
|
708
674
|
class ln {
|
|
709
675
|
constructor() {
|
|
710
|
-
this.name =
|
|
676
|
+
this.name = x.KHR_TEXTURE_TRANSFORM;
|
|
711
677
|
}
|
|
712
678
|
extendTexture(t, e) {
|
|
713
679
|
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;
|
|
@@ -715,10 +681,10 @@ class ln {
|
|
|
715
681
|
}
|
|
716
682
|
class un {
|
|
717
683
|
constructor() {
|
|
718
|
-
this.name =
|
|
684
|
+
this.name = x.KHR_MESH_QUANTIZATION;
|
|
719
685
|
}
|
|
720
686
|
}
|
|
721
|
-
class
|
|
687
|
+
class Be extends vt {
|
|
722
688
|
constructor(t, e, i, n) {
|
|
723
689
|
super(t, e, i, n);
|
|
724
690
|
}
|
|
@@ -729,19 +695,19 @@ class Ge extends vt {
|
|
|
729
695
|
return e;
|
|
730
696
|
}
|
|
731
697
|
interpolate_(t, e, i, n) {
|
|
732
|
-
const s = this.resultBuffer, r = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, u = n - e, l = (i - e) / u,
|
|
733
|
-
for (let
|
|
734
|
-
const N = r[
|
|
735
|
-
s[
|
|
698
|
+
const s = this.resultBuffer, r = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, u = n - e, l = (i - e) / u, f = l * l, h = f * l, p = t * c, T = p - c, m = -2 * h + 3 * f, g = h - f, R = 1 - m, w = g - f + l;
|
|
699
|
+
for (let A = 0; A !== a; A++) {
|
|
700
|
+
const N = r[T + A + a], I = r[T + A + o] * u, L = r[p + A + a], v = r[p + A] * u;
|
|
701
|
+
s[A] = R * N + w * I + m * L + g * v;
|
|
736
702
|
}
|
|
737
703
|
return s;
|
|
738
704
|
}
|
|
739
705
|
}
|
|
740
|
-
const
|
|
741
|
-
class
|
|
706
|
+
const dn = new Ie();
|
|
707
|
+
class fn extends Be {
|
|
742
708
|
interpolate_(t, e, i, n) {
|
|
743
709
|
const s = super.interpolate_(t, e, i, n);
|
|
744
|
-
return
|
|
710
|
+
return dn.fromArray(s).normalize().toArray(s), s;
|
|
745
711
|
}
|
|
746
712
|
}
|
|
747
713
|
const C = {
|
|
@@ -760,16 +726,16 @@ const C = {
|
|
|
760
726
|
5125: Uint32Array,
|
|
761
727
|
5126: Float32Array
|
|
762
728
|
}, we = {
|
|
763
|
-
9728:
|
|
764
|
-
9729:
|
|
765
|
-
9984:
|
|
766
|
-
9985:
|
|
767
|
-
9986:
|
|
768
|
-
9987:
|
|
769
|
-
},
|
|
729
|
+
9728: dt,
|
|
730
|
+
9729: ve,
|
|
731
|
+
9984: ut,
|
|
732
|
+
9985: lt,
|
|
733
|
+
9986: ct,
|
|
734
|
+
9987: Oe
|
|
735
|
+
}, be = {
|
|
770
736
|
33071: ht,
|
|
771
|
-
33648:
|
|
772
|
-
10497:
|
|
737
|
+
33648: ft,
|
|
738
|
+
10497: le
|
|
773
739
|
}, ie = {
|
|
774
740
|
SCALAR: 1,
|
|
775
741
|
VEC2: 2,
|
|
@@ -778,7 +744,7 @@ const C = {
|
|
|
778
744
|
MAT2: 4,
|
|
779
745
|
MAT3: 9,
|
|
780
746
|
MAT4: 16
|
|
781
|
-
},
|
|
747
|
+
}, ue = {
|
|
782
748
|
POSITION: "position",
|
|
783
749
|
NORMAL: "normal",
|
|
784
750
|
TANGENT: "tangent",
|
|
@@ -789,7 +755,7 @@ const C = {
|
|
|
789
755
|
COLOR_0: "color",
|
|
790
756
|
WEIGHTS_0: "skinWeight",
|
|
791
757
|
JOINTS_0: "skinIndex"
|
|
792
|
-
},
|
|
758
|
+
}, k = {
|
|
793
759
|
scale: "scale",
|
|
794
760
|
translation: "position",
|
|
795
761
|
rotation: "quaternion",
|
|
@@ -798,15 +764,15 @@ const C = {
|
|
|
798
764
|
CUBICSPLINE: void 0,
|
|
799
765
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
800
766
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
801
|
-
LINEAR:
|
|
767
|
+
LINEAR: ke,
|
|
802
768
|
STEP: It
|
|
803
769
|
}, oe = {
|
|
804
770
|
OPAQUE: "OPAQUE",
|
|
805
771
|
MASK: "MASK",
|
|
806
772
|
BLEND: "BLEND"
|
|
807
773
|
};
|
|
808
|
-
function pn(
|
|
809
|
-
return
|
|
774
|
+
function pn(d) {
|
|
775
|
+
return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new De({
|
|
810
776
|
color: 16777215,
|
|
811
777
|
emissive: 0,
|
|
812
778
|
metalness: 1,
|
|
@@ -814,36 +780,36 @@ function pn(f) {
|
|
|
814
780
|
transparent: !1,
|
|
815
781
|
depthTest: !0,
|
|
816
782
|
side: Ot
|
|
817
|
-
})),
|
|
783
|
+
})), d.DefaultMaterial;
|
|
818
784
|
}
|
|
819
|
-
function
|
|
785
|
+
function B(d, t, e) {
|
|
820
786
|
for (const i in e.extensions)
|
|
821
|
-
|
|
787
|
+
d[i] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = e.extensions[i]);
|
|
822
788
|
}
|
|
823
|
-
function
|
|
824
|
-
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(
|
|
789
|
+
function P(d, t) {
|
|
790
|
+
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(d.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
|
|
825
791
|
}
|
|
826
|
-
function mn(
|
|
792
|
+
function mn(d, t, e) {
|
|
827
793
|
let i = !1, n = !1, s = !1;
|
|
828
794
|
for (let c = 0, u = t.length; c < u; c++) {
|
|
829
795
|
const l = t[c];
|
|
830
796
|
if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (n = !0), l.COLOR_0 !== void 0 && (s = !0), i && n && s) break;
|
|
831
797
|
}
|
|
832
|
-
if (!i && !n && !s) return Promise.resolve(
|
|
798
|
+
if (!i && !n && !s) return Promise.resolve(d);
|
|
833
799
|
const r = [], a = [], o = [];
|
|
834
800
|
for (let c = 0, u = t.length; c < u; c++) {
|
|
835
801
|
const l = t[c];
|
|
836
802
|
if (i) {
|
|
837
|
-
const
|
|
838
|
-
r.push(
|
|
803
|
+
const f = l.POSITION !== void 0 ? e.getDependency("accessor", l.POSITION) : d.attributes.position;
|
|
804
|
+
r.push(f);
|
|
839
805
|
}
|
|
840
806
|
if (n) {
|
|
841
|
-
const
|
|
842
|
-
a.push(
|
|
807
|
+
const f = l.NORMAL !== void 0 ? e.getDependency("accessor", l.NORMAL) : d.attributes.normal;
|
|
808
|
+
a.push(f);
|
|
843
809
|
}
|
|
844
810
|
if (s) {
|
|
845
|
-
const
|
|
846
|
-
o.push(
|
|
811
|
+
const f = l.COLOR_0 !== void 0 ? e.getDependency("accessor", l.COLOR_0) : d.attributes.color;
|
|
812
|
+
o.push(f);
|
|
847
813
|
}
|
|
848
814
|
}
|
|
849
815
|
return Promise.all([
|
|
@@ -851,41 +817,41 @@ function mn(f, t, e) {
|
|
|
851
817
|
Promise.all(a),
|
|
852
818
|
Promise.all(o)
|
|
853
819
|
]).then(function(c) {
|
|
854
|
-
const u = c[0], l = c[1],
|
|
855
|
-
return i && (
|
|
820
|
+
const u = c[0], l = c[1], f = c[2];
|
|
821
|
+
return i && (d.morphAttributes.position = u), n && (d.morphAttributes.normal = l), s && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
|
|
856
822
|
});
|
|
857
823
|
}
|
|
858
|
-
function gn(
|
|
859
|
-
if (
|
|
824
|
+
function gn(d, t) {
|
|
825
|
+
if (d.updateMorphTargets(), t.weights !== void 0)
|
|
860
826
|
for (let e = 0, i = t.weights.length; e < i; e++)
|
|
861
|
-
|
|
827
|
+
d.morphTargetInfluences[e] = t.weights[e];
|
|
862
828
|
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
863
829
|
const e = t.extras.targetNames;
|
|
864
|
-
if (
|
|
865
|
-
|
|
830
|
+
if (d.morphTargetInfluences.length === e.length) {
|
|
831
|
+
d.morphTargetDictionary = {};
|
|
866
832
|
for (let i = 0, n = e.length; i < n; i++)
|
|
867
|
-
|
|
833
|
+
d.morphTargetDictionary[e[i]] = i;
|
|
868
834
|
} else
|
|
869
835
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
870
836
|
}
|
|
871
837
|
}
|
|
872
|
-
function
|
|
838
|
+
function An(d) {
|
|
873
839
|
let t;
|
|
874
|
-
const e =
|
|
875
|
-
if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + ae(e.attributes) : t =
|
|
876
|
-
for (let i = 0, n =
|
|
877
|
-
t += ":" + ae(
|
|
840
|
+
const e = d.extensions && d.extensions[x.KHR_DRACO_MESH_COMPRESSION];
|
|
841
|
+
if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + ae(e.attributes) : t = d.indices + ":" + ae(d.attributes) + ":" + d.mode, d.targets !== void 0)
|
|
842
|
+
for (let i = 0, n = d.targets.length; i < n; i++)
|
|
843
|
+
t += ":" + ae(d.targets[i]);
|
|
878
844
|
return t;
|
|
879
845
|
}
|
|
880
|
-
function ae(
|
|
846
|
+
function ae(d) {
|
|
881
847
|
let t = "";
|
|
882
|
-
const e = Object.keys(
|
|
848
|
+
const e = Object.keys(d).sort();
|
|
883
849
|
for (let i = 0, n = e.length; i < n; i++)
|
|
884
|
-
t += e[i] + ":" +
|
|
850
|
+
t += e[i] + ":" + d[e[i]] + ";";
|
|
885
851
|
return t;
|
|
886
852
|
}
|
|
887
|
-
function de(
|
|
888
|
-
switch (
|
|
853
|
+
function de(d) {
|
|
854
|
+
switch (d) {
|
|
889
855
|
case Int8Array:
|
|
890
856
|
return 1 / 127;
|
|
891
857
|
case Uint8Array:
|
|
@@ -898,21 +864,15 @@ function de(f) {
|
|
|
898
864
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
899
865
|
}
|
|
900
866
|
}
|
|
901
|
-
function
|
|
902
|
-
return
|
|
867
|
+
function Tn(d) {
|
|
868
|
+
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" : "image/png";
|
|
903
869
|
}
|
|
904
|
-
const
|
|
905
|
-
class
|
|
870
|
+
const xn = new J();
|
|
871
|
+
class Rn {
|
|
906
872
|
constructor(t = {}, e = {}) {
|
|
907
|
-
this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new
|
|
908
|
-
let i = !1, n =
|
|
909
|
-
|
|
910
|
-
const a = navigator.userAgent;
|
|
911
|
-
i = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
912
|
-
const o = a.match(/Version\/(\d+)/);
|
|
913
|
-
n = i && o ? parseInt(o[1], 10) : -1, s = a.indexOf("Firefox") > -1, r = s ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
914
|
-
}
|
|
915
|
-
typeof createImageBitmap > "u" || i && n < 17 || s && r < 98 ? this.textureLoader = new ot(this.options.manager) : this.textureLoader = new at(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ne(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
873
|
+
this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new Ut(), 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 = {};
|
|
874
|
+
let i = !1, n = !1, s = -1;
|
|
875
|
+
typeof navigator < "u" && (i = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, s = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || i || n && s < 98 ? this.textureLoader = new it(this.options.manager) : this.textureLoader = new ot(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Se(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
916
876
|
}
|
|
917
877
|
setExtensions(t) {
|
|
918
878
|
this.extensions = t;
|
|
@@ -942,7 +902,7 @@ class En {
|
|
|
942
902
|
parser: i,
|
|
943
903
|
userData: {}
|
|
944
904
|
};
|
|
945
|
-
return
|
|
905
|
+
return B(s, a, n), P(a, n), Promise.all(i._invokeAll(function(o) {
|
|
946
906
|
return o.afterRoot && o.afterRoot(a);
|
|
947
907
|
})).then(function() {
|
|
948
908
|
for (const o of a.scenes)
|
|
@@ -953,8 +913,6 @@ class En {
|
|
|
953
913
|
}
|
|
954
914
|
/**
|
|
955
915
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
956
|
-
*
|
|
957
|
-
* @private
|
|
958
916
|
*/
|
|
959
917
|
_markDefs() {
|
|
960
918
|
const t = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
|
|
@@ -976,23 +934,11 @@ class En {
|
|
|
976
934
|
* Textures) can be reused directly and are not marked here.
|
|
977
935
|
*
|
|
978
936
|
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
|
|
979
|
-
*
|
|
980
|
-
* @private
|
|
981
|
-
* @param {Object} cache
|
|
982
|
-
* @param {Object3D} index
|
|
983
937
|
*/
|
|
984
938
|
_addNodeRef(t, e) {
|
|
985
939
|
e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
|
|
986
940
|
}
|
|
987
|
-
/**
|
|
988
|
-
* Returns a reference to a shared resource, cloning it if necessary.
|
|
989
|
-
*
|
|
990
|
-
* @private
|
|
991
|
-
* @param {Object} cache
|
|
992
|
-
* @param {number} index
|
|
993
|
-
* @param {Object} object
|
|
994
|
-
* @return {Object}
|
|
995
|
-
*/
|
|
941
|
+
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
996
942
|
_getNodeRef(t, e, i) {
|
|
997
943
|
if (t.refs[e] <= 1) return i;
|
|
998
944
|
const n = i.clone(), s = (r, a) => {
|
|
@@ -1024,8 +970,6 @@ class En {
|
|
|
1024
970
|
}
|
|
1025
971
|
/**
|
|
1026
972
|
* Requests the specified dependency asynchronously, with caching.
|
|
1027
|
-
*
|
|
1028
|
-
* @private
|
|
1029
973
|
* @param {string} type
|
|
1030
974
|
* @param {number} index
|
|
1031
975
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
@@ -1093,8 +1037,6 @@ class En {
|
|
|
1093
1037
|
}
|
|
1094
1038
|
/**
|
|
1095
1039
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
1096
|
-
*
|
|
1097
|
-
* @private
|
|
1098
1040
|
* @param {string} type
|
|
1099
1041
|
* @return {Promise<Array<Object>>}
|
|
1100
1042
|
*/
|
|
@@ -1110,8 +1052,6 @@ class En {
|
|
|
1110
1052
|
}
|
|
1111
1053
|
/**
|
|
1112
1054
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
1113
|
-
*
|
|
1114
|
-
* @private
|
|
1115
1055
|
* @param {number} bufferIndex
|
|
1116
1056
|
* @return {Promise<ArrayBuffer>}
|
|
1117
1057
|
*/
|
|
@@ -1120,7 +1060,7 @@ class En {
|
|
|
1120
1060
|
if (e.type && e.type !== "arraybuffer")
|
|
1121
1061
|
throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
|
|
1122
1062
|
if (e.uri === void 0 && t === 0)
|
|
1123
|
-
return Promise.resolve(this.extensions[
|
|
1063
|
+
return Promise.resolve(this.extensions[x.KHR_BINARY_GLTF].body);
|
|
1124
1064
|
const n = this.options;
|
|
1125
1065
|
return new Promise(function(s, r) {
|
|
1126
1066
|
i.load(W.resolveURL(e.uri, n.path), s, void 0, function() {
|
|
@@ -1130,8 +1070,6 @@ class En {
|
|
|
1130
1070
|
}
|
|
1131
1071
|
/**
|
|
1132
1072
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
1133
|
-
*
|
|
1134
|
-
* @private
|
|
1135
1073
|
* @param {number} bufferViewIndex
|
|
1136
1074
|
* @return {Promise<ArrayBuffer>}
|
|
1137
1075
|
*/
|
|
@@ -1144,8 +1082,6 @@ class En {
|
|
|
1144
1082
|
}
|
|
1145
1083
|
/**
|
|
1146
1084
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
|
|
1147
|
-
*
|
|
1148
|
-
* @private
|
|
1149
1085
|
* @param {number} accessorIndex
|
|
1150
1086
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1151
1087
|
*/
|
|
@@ -1157,30 +1093,27 @@ class En {
|
|
|
1157
1093
|
}
|
|
1158
1094
|
const s = [];
|
|
1159
1095
|
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) {
|
|
1160
|
-
const a = r[0], o = ie[n.type], c = V[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * o,
|
|
1161
|
-
let
|
|
1096
|
+
const a = r[0], o = ie[n.type], c = V[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * o, f = n.byteOffset || 0, h = n.bufferView !== void 0 ? i.bufferViews[n.bufferView].byteStride : void 0, p = n.normalized === !0;
|
|
1097
|
+
let T, m;
|
|
1162
1098
|
if (h && h !== l) {
|
|
1163
|
-
const g = Math.floor(
|
|
1164
|
-
let
|
|
1165
|
-
|
|
1099
|
+
const g = Math.floor(f / h), R = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + g + ":" + n.count;
|
|
1100
|
+
let w = e.cache.get(R);
|
|
1101
|
+
w || (T = new c(a, g * h, n.count * h / u), w = new at(T, h / u), e.cache.add(R, w)), m = new Ct(w, o, f % h / u, p);
|
|
1166
1102
|
} else
|
|
1167
|
-
a === null ?
|
|
1103
|
+
a === null ? T = new c(n.count * o) : T = new c(a, f, n.count * o), m = new ne(T, o, p);
|
|
1168
1104
|
if (n.sparse !== void 0) {
|
|
1169
|
-
const g = ie.SCALAR,
|
|
1170
|
-
a !== null && (m = new ne(m.array.slice(), m.itemSize, m.normalized))
|
|
1171
|
-
for (let
|
|
1172
|
-
const
|
|
1173
|
-
if (m.setX(
|
|
1105
|
+
const g = ie.SCALAR, R = V[n.sparse.indices.componentType], w = n.sparse.indices.byteOffset || 0, A = n.sparse.values.byteOffset || 0, N = new R(r[1], w, n.sparse.count * g), I = new c(r[2], A, n.sparse.count * o);
|
|
1106
|
+
a !== null && (m = new ne(m.array.slice(), m.itemSize, m.normalized));
|
|
1107
|
+
for (let L = 0, v = N.length; L < v; L++) {
|
|
1108
|
+
const b = N[L];
|
|
1109
|
+
if (m.setX(b, I[L * o]), o >= 2 && m.setY(b, I[L * o + 1]), o >= 3 && m.setZ(b, I[L * o + 2]), o >= 4 && m.setW(b, I[L * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1174
1110
|
}
|
|
1175
|
-
m.normalized = p;
|
|
1176
1111
|
}
|
|
1177
1112
|
return m;
|
|
1178
1113
|
});
|
|
1179
1114
|
}
|
|
1180
1115
|
/**
|
|
1181
1116
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
|
|
1182
|
-
*
|
|
1183
|
-
* @private
|
|
1184
1117
|
* @param {number} textureIndex
|
|
1185
1118
|
* @return {Promise<THREE.Texture|null>}
|
|
1186
1119
|
*/
|
|
@@ -1199,8 +1132,8 @@ class En {
|
|
|
1199
1132
|
return this.textureCache[o];
|
|
1200
1133
|
const c = this.loadImageSource(e, i).then(function(u) {
|
|
1201
1134
|
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);
|
|
1202
|
-
const
|
|
1203
|
-
return u.magFilter = we[
|
|
1135
|
+
const f = (s.samplers || {})[r.sampler] || {};
|
|
1136
|
+
return u.magFilter = we[f.magFilter] || ve, u.minFilter = we[f.minFilter] || Oe, u.wrapS = be[f.wrapS] || le, u.wrapT = be[f.wrapT] || le, n.associations.set(u, { textures: t }), u;
|
|
1204
1137
|
}).catch(function() {
|
|
1205
1138
|
return null;
|
|
1206
1139
|
});
|
|
@@ -1215,21 +1148,21 @@ class En {
|
|
|
1215
1148
|
if (r.bufferView !== void 0)
|
|
1216
1149
|
o = i.getDependency("bufferView", r.bufferView).then(function(l) {
|
|
1217
1150
|
c = !0;
|
|
1218
|
-
const
|
|
1219
|
-
return o = a.createObjectURL(
|
|
1151
|
+
const f = new Blob([l], { type: r.mimeType });
|
|
1152
|
+
return o = a.createObjectURL(f), o;
|
|
1220
1153
|
});
|
|
1221
1154
|
else if (r.uri === void 0)
|
|
1222
1155
|
throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
|
|
1223
1156
|
const u = Promise.resolve(o).then(function(l) {
|
|
1224
|
-
return new Promise(function(
|
|
1225
|
-
let p =
|
|
1226
|
-
e.isImageBitmapLoader === !0 && (p = function(
|
|
1227
|
-
const m = new
|
|
1228
|
-
m.needsUpdate = !0,
|
|
1157
|
+
return new Promise(function(f, h) {
|
|
1158
|
+
let p = f;
|
|
1159
|
+
e.isImageBitmapLoader === !0 && (p = function(T) {
|
|
1160
|
+
const m = new ge(T);
|
|
1161
|
+
m.needsUpdate = !0, f(m);
|
|
1229
1162
|
}), e.load(W.resolveURL(l, s.path), p, void 0, h);
|
|
1230
1163
|
});
|
|
1231
1164
|
}).then(function(l) {
|
|
1232
|
-
return c === !0 && a.revokeObjectURL(o),
|
|
1165
|
+
return c === !0 && a.revokeObjectURL(o), l.userData.mimeType = r.mimeType || Tn(r.uri), l;
|
|
1233
1166
|
}).catch(function(l) {
|
|
1234
1167
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", o), l;
|
|
1235
1168
|
});
|
|
@@ -1237,23 +1170,20 @@ class En {
|
|
|
1237
1170
|
}
|
|
1238
1171
|
/**
|
|
1239
1172
|
* Asynchronously assigns a texture to the given material parameters.
|
|
1240
|
-
*
|
|
1241
|
-
* @private
|
|
1242
1173
|
* @param {Object} materialParams
|
|
1243
1174
|
* @param {string} mapName
|
|
1244
1175
|
* @param {Object} mapDef
|
|
1245
|
-
* @param {string} [colorSpace]
|
|
1246
1176
|
* @return {Promise<Texture>}
|
|
1247
1177
|
*/
|
|
1248
1178
|
assignTexture(t, e, i, n) {
|
|
1249
1179
|
const s = this;
|
|
1250
1180
|
return this.getDependency("texture", i.index).then(function(r) {
|
|
1251
1181
|
if (!r) return null;
|
|
1252
|
-
if (i.texCoord !== void 0 && i.texCoord > 0 && (r = r.clone(), r.channel = i.texCoord), s.extensions[
|
|
1253
|
-
const a = i.extensions !== void 0 ? i.extensions[
|
|
1182
|
+
if (i.texCoord !== void 0 && i.texCoord > 0 && (r = r.clone(), r.channel = i.texCoord), s.extensions[x.KHR_TEXTURE_TRANSFORM]) {
|
|
1183
|
+
const a = i.extensions !== void 0 ? i.extensions[x.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1254
1184
|
if (a) {
|
|
1255
1185
|
const o = s.associations.get(r);
|
|
1256
|
-
r = s.extensions[
|
|
1186
|
+
r = s.extensions[x.KHR_TEXTURE_TRANSFORM].extendTexture(r, a), s.associations.set(r, o);
|
|
1257
1187
|
}
|
|
1258
1188
|
}
|
|
1259
1189
|
return n !== void 0 && (r.colorSpace = n), t[e] = r, r;
|
|
@@ -1265,9 +1195,7 @@ class En {
|
|
|
1265
1195
|
* but reuse of the same glTF material may require multiple threejs materials
|
|
1266
1196
|
* to accommodate different primitive types, defines, etc. New materials will
|
|
1267
1197
|
* be created if necessary, and reused from a cache.
|
|
1268
|
-
*
|
|
1269
|
-
* @private
|
|
1270
|
-
* @param {Object3D} mesh Mesh, Line, or Points instance.
|
|
1198
|
+
* @param {Object3D} mesh Mesh, Line, or Points instance.
|
|
1271
1199
|
*/
|
|
1272
1200
|
assignFinalMaterial(t) {
|
|
1273
1201
|
const e = t.geometry;
|
|
@@ -1291,12 +1219,10 @@ class En {
|
|
|
1291
1219
|
t.material = i;
|
|
1292
1220
|
}
|
|
1293
1221
|
getMaterialType() {
|
|
1294
|
-
return
|
|
1222
|
+
return De;
|
|
1295
1223
|
}
|
|
1296
1224
|
/**
|
|
1297
1225
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
1298
|
-
*
|
|
1299
|
-
* @private
|
|
1300
1226
|
* @param {number} materialIndex
|
|
1301
1227
|
* @return {Promise<Material>}
|
|
1302
1228
|
*/
|
|
@@ -1304,45 +1230,39 @@ class En {
|
|
|
1304
1230
|
const e = this, i = this.json, n = this.extensions, s = i.materials[t];
|
|
1305
1231
|
let r;
|
|
1306
1232
|
const a = {}, o = s.extensions || {}, c = [];
|
|
1307
|
-
if (o[
|
|
1308
|
-
const l = n[
|
|
1233
|
+
if (o[x.KHR_MATERIALS_UNLIT]) {
|
|
1234
|
+
const l = n[x.KHR_MATERIALS_UNLIT];
|
|
1309
1235
|
r = l.getMaterialType(), c.push(l.extendParams(a, s, e));
|
|
1310
1236
|
} else {
|
|
1311
1237
|
const l = s.pbrMetallicRoughness || {};
|
|
1312
1238
|
if (a.color = new G(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
|
|
1313
|
-
const
|
|
1314
|
-
a.color.setRGB(
|
|
1239
|
+
const f = l.baseColorFactor;
|
|
1240
|
+
a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
|
|
1315
1241
|
}
|
|
1316
|
-
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(
|
|
1317
|
-
return
|
|
1318
|
-
}), c.push(Promise.all(this._invokeAll(function(
|
|
1319
|
-
return
|
|
1242
|
+
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) {
|
|
1243
|
+
return f.getMaterialType && f.getMaterialType(t);
|
|
1244
|
+
}), c.push(Promise.all(this._invokeAll(function(f) {
|
|
1245
|
+
return f.extendMaterialParams && f.extendMaterialParams(t, a);
|
|
1320
1246
|
})));
|
|
1321
1247
|
}
|
|
1322
1248
|
s.doubleSided === !0 && (a.side = gt);
|
|
1323
1249
|
const u = s.alphaMode || oe.OPAQUE;
|
|
1324
|
-
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
|
|
1250
|
+
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 Ne(1, 1), s.normalTexture.scale !== void 0)) {
|
|
1325
1251
|
const l = s.normalTexture.scale;
|
|
1326
1252
|
a.normalScale.set(l, l);
|
|
1327
1253
|
}
|
|
1328
1254
|
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) {
|
|
1329
1255
|
const l = s.emissiveFactor;
|
|
1330
|
-
a.emissive = new G().setRGB(l[0], l[1], l[2],
|
|
1256
|
+
a.emissive = new G().setRGB(l[0], l[1], l[2], D);
|
|
1331
1257
|
}
|
|
1332
1258
|
return s.emissiveTexture !== void 0 && r !== q && c.push(e.assignTexture(a, "emissiveMap", s.emissiveTexture, Y)), Promise.all(c).then(function() {
|
|
1333
1259
|
const l = new r(a);
|
|
1334
|
-
return s.name && (l.name = s.name),
|
|
1260
|
+
return s.name && (l.name = s.name), P(l, s), e.associations.set(l, { materials: t }), s.extensions && B(n, l, s), l;
|
|
1335
1261
|
});
|
|
1336
1262
|
}
|
|
1337
|
-
/**
|
|
1338
|
-
* When Object3D instances are targeted by animation, they need unique names.
|
|
1339
|
-
*
|
|
1340
|
-
* @private
|
|
1341
|
-
* @param {string} originalName
|
|
1342
|
-
* @return {string}
|
|
1343
|
-
*/
|
|
1263
|
+
/** When Object3D instances are targeted by animation, they need unique names. */
|
|
1344
1264
|
createUniqueName(t) {
|
|
1345
|
-
const e =
|
|
1265
|
+
const e = At.sanitizeNodeName(t || "");
|
|
1346
1266
|
return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
|
|
1347
1267
|
}
|
|
1348
1268
|
/**
|
|
@@ -1350,35 +1270,32 @@ class En {
|
|
|
1350
1270
|
*
|
|
1351
1271
|
* Creates BufferGeometries from primitives.
|
|
1352
1272
|
*
|
|
1353
|
-
* @private
|
|
1354
1273
|
* @param {Array<GLTF.Primitive>} primitives
|
|
1355
1274
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1356
1275
|
*/
|
|
1357
1276
|
loadGeometries(t) {
|
|
1358
1277
|
const e = this, i = this.extensions, n = this.primitiveCache;
|
|
1359
1278
|
function s(a) {
|
|
1360
|
-
return i[
|
|
1361
|
-
return
|
|
1279
|
+
return i[x.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
|
|
1280
|
+
return Me(o, a, e);
|
|
1362
1281
|
});
|
|
1363
1282
|
}
|
|
1364
1283
|
const r = [];
|
|
1365
1284
|
for (let a = 0, o = t.length; a < o; a++) {
|
|
1366
|
-
const c = t[a], u =
|
|
1285
|
+
const c = t[a], u = An(c), l = n[u];
|
|
1367
1286
|
if (l)
|
|
1368
1287
|
r.push(l.promise);
|
|
1369
1288
|
else {
|
|
1370
|
-
let
|
|
1371
|
-
c.extensions && c.extensions[
|
|
1289
|
+
let f;
|
|
1290
|
+
c.extensions && c.extensions[x.KHR_DRACO_MESH_COMPRESSION] ? f = s(c) : f = Me(new Tt(), c, e), n[u] = { primitive: c, promise: f }, r.push(f);
|
|
1372
1291
|
}
|
|
1373
1292
|
}
|
|
1374
1293
|
return Promise.all(r);
|
|
1375
1294
|
}
|
|
1376
1295
|
/**
|
|
1377
1296
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
1378
|
-
*
|
|
1379
|
-
* @private
|
|
1380
1297
|
* @param {number} meshIndex
|
|
1381
|
-
* @return {Promise<Group|Mesh|SkinnedMesh
|
|
1298
|
+
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1382
1299
|
*/
|
|
1383
1300
|
loadMesh(t) {
|
|
1384
1301
|
const e = this, i = this.json, n = this.extensions, s = i.meshes[t], r = s.primitives, a = [];
|
|
@@ -1389,22 +1306,22 @@ class En {
|
|
|
1389
1306
|
return a.push(e.loadGeometries(r)), Promise.all(a).then(function(o) {
|
|
1390
1307
|
const c = o.slice(0, o.length - 1), u = o[o.length - 1], l = [];
|
|
1391
1308
|
for (let h = 0, p = u.length; h < p; h++) {
|
|
1392
|
-
const
|
|
1309
|
+
const T = u[h], m = r[h];
|
|
1393
1310
|
let g;
|
|
1394
|
-
const
|
|
1311
|
+
const R = c[h];
|
|
1395
1312
|
if (m.mode === C.TRIANGLES || m.mode === C.TRIANGLE_STRIP || m.mode === C.TRIANGLE_FAN || m.mode === void 0)
|
|
1396
|
-
g = s.isSkinnedMesh === !0 ? new
|
|
1313
|
+
g = s.isSkinnedMesh === !0 ? new xt(T, R) : new Fe(T, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === C.TRIANGLE_STRIP ? g.geometry = Le(g.geometry, ye) : m.mode === C.TRIANGLE_FAN && (g.geometry = Le(g.geometry, ce));
|
|
1397
1314
|
else if (m.mode === C.LINES)
|
|
1398
|
-
g = new
|
|
1315
|
+
g = new Rt(T, R);
|
|
1399
1316
|
else if (m.mode === C.LINE_STRIP)
|
|
1400
|
-
g = new
|
|
1317
|
+
g = new Et(T, R);
|
|
1401
1318
|
else if (m.mode === C.LINE_LOOP)
|
|
1402
|
-
g = new
|
|
1319
|
+
g = new Lt(T, R);
|
|
1403
1320
|
else if (m.mode === C.POINTS)
|
|
1404
|
-
g = new
|
|
1321
|
+
g = new _t(T, R);
|
|
1405
1322
|
else
|
|
1406
1323
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
1407
|
-
Object.keys(g.geometry.morphAttributes).length > 0 && gn(g, s), g.name = e.createUniqueName(s.name || "mesh_" + t),
|
|
1324
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && gn(g, s), g.name = e.createUniqueName(s.name || "mesh_" + t), P(g, s), m.extensions && B(n, g, m), e.assignFinalMaterial(g), l.push(g);
|
|
1408
1325
|
}
|
|
1409
1326
|
for (let h = 0, p = l.length; h < p; h++)
|
|
1410
1327
|
e.associations.set(l[h], {
|
|
@@ -1412,18 +1329,16 @@ class En {
|
|
|
1412
1329
|
primitives: h
|
|
1413
1330
|
});
|
|
1414
1331
|
if (l.length === 1)
|
|
1415
|
-
return s.extensions &&
|
|
1416
|
-
const
|
|
1417
|
-
s.extensions &&
|
|
1332
|
+
return s.extensions && B(n, l[0], s), l[0];
|
|
1333
|
+
const f = new re();
|
|
1334
|
+
s.extensions && B(n, f, s), e.associations.set(f, { meshes: t });
|
|
1418
1335
|
for (let h = 0, p = l.length; h < p; h++)
|
|
1419
|
-
|
|
1420
|
-
return
|
|
1336
|
+
f.add(l[h]);
|
|
1337
|
+
return f;
|
|
1421
1338
|
});
|
|
1422
1339
|
}
|
|
1423
1340
|
/**
|
|
1424
1341
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
|
|
1425
|
-
*
|
|
1426
|
-
* @private
|
|
1427
1342
|
* @param {number} cameraIndex
|
|
1428
1343
|
* @return {Promise<THREE.Camera>}
|
|
1429
1344
|
*/
|
|
@@ -1434,12 +1349,10 @@ class En {
|
|
|
1434
1349
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1435
1350
|
return;
|
|
1436
1351
|
}
|
|
1437
|
-
return i.type === "perspective" ? e = new
|
|
1352
|
+
return i.type === "perspective" ? e = new wt(bt.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : i.type === "orthographic" && (e = new Mt(-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);
|
|
1438
1353
|
}
|
|
1439
1354
|
/**
|
|
1440
1355
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
1441
|
-
*
|
|
1442
|
-
* @private
|
|
1443
1356
|
* @param {number} skinIndex
|
|
1444
1357
|
* @return {Promise<Skeleton>}
|
|
1445
1358
|
*/
|
|
@@ -1453,26 +1366,24 @@ class En {
|
|
|
1453
1366
|
const l = r[c];
|
|
1454
1367
|
if (l) {
|
|
1455
1368
|
a.push(l);
|
|
1456
|
-
const
|
|
1457
|
-
s !== null &&
|
|
1369
|
+
const f = new J();
|
|
1370
|
+
s !== null && f.fromArray(s.array, c * 16), o.push(f);
|
|
1458
1371
|
} else
|
|
1459
1372
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
|
|
1460
1373
|
}
|
|
1461
|
-
return new
|
|
1374
|
+
return new yt(a, o);
|
|
1462
1375
|
});
|
|
1463
1376
|
}
|
|
1464
1377
|
/**
|
|
1465
1378
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
|
|
1466
|
-
*
|
|
1467
|
-
* @private
|
|
1468
1379
|
* @param {number} animationIndex
|
|
1469
1380
|
* @return {Promise<AnimationClip>}
|
|
1470
1381
|
*/
|
|
1471
1382
|
loadAnimation(t) {
|
|
1472
1383
|
const e = this.json, i = this, n = e.animations[t], s = n.name ? n.name : "animation_" + t, r = [], a = [], o = [], c = [], u = [];
|
|
1473
|
-
for (let l = 0,
|
|
1474
|
-
const h = n.channels[l], p = n.samplers[h.sampler],
|
|
1475
|
-
|
|
1384
|
+
for (let l = 0, f = n.channels.length; l < f; l++) {
|
|
1385
|
+
const h = n.channels[l], p = n.samplers[h.sampler], T = h.target, m = T.node, g = n.parameters !== void 0 ? n.parameters[p.input] : p.input, R = n.parameters !== void 0 ? n.parameters[p.output] : p.output;
|
|
1386
|
+
T.node !== void 0 && (r.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), o.push(this.getDependency("accessor", R)), c.push(p), u.push(T));
|
|
1476
1387
|
}
|
|
1477
1388
|
return Promise.all([
|
|
1478
1389
|
Promise.all(r),
|
|
@@ -1481,15 +1392,15 @@ class En {
|
|
|
1481
1392
|
Promise.all(c),
|
|
1482
1393
|
Promise.all(u)
|
|
1483
1394
|
]).then(function(l) {
|
|
1484
|
-
const
|
|
1485
|
-
for (let
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
|
|
1489
|
-
const
|
|
1490
|
-
if (
|
|
1491
|
-
for (let F = 0; F <
|
|
1492
|
-
g.push(
|
|
1395
|
+
const f = l[0], h = l[1], p = l[2], T = l[3], m = l[4], g = [];
|
|
1396
|
+
for (let R = 0, w = f.length; R < w; R++) {
|
|
1397
|
+
const A = f[R], N = h[R], I = p[R], L = T[R], v = m[R];
|
|
1398
|
+
if (A === void 0) continue;
|
|
1399
|
+
A.updateMatrix && A.updateMatrix();
|
|
1400
|
+
const b = i._createAnimationTracks(A, N, I, L, v);
|
|
1401
|
+
if (b)
|
|
1402
|
+
for (let F = 0; F < b.length; F++)
|
|
1403
|
+
g.push(b[F]);
|
|
1493
1404
|
}
|
|
1494
1405
|
return new St(s, void 0, g);
|
|
1495
1406
|
});
|
|
@@ -1507,8 +1418,6 @@ class En {
|
|
|
1507
1418
|
}
|
|
1508
1419
|
/**
|
|
1509
1420
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
|
|
1510
|
-
*
|
|
1511
|
-
* @private
|
|
1512
1421
|
* @param {number} nodeIndex
|
|
1513
1422
|
* @return {Promise<Object3D>}
|
|
1514
1423
|
*/
|
|
@@ -1522,9 +1431,9 @@ class En {
|
|
|
1522
1431
|
Promise.all(r),
|
|
1523
1432
|
o
|
|
1524
1433
|
]).then(function(c) {
|
|
1525
|
-
const u = c[0], l = c[1],
|
|
1526
|
-
|
|
1527
|
-
h.isSkinnedMesh && h.bind(
|
|
1434
|
+
const u = c[0], l = c[1], f = c[2];
|
|
1435
|
+
f !== null && u.traverse(function(h) {
|
|
1436
|
+
h.isSkinnedMesh && h.bind(f, xn);
|
|
1528
1437
|
});
|
|
1529
1438
|
for (let h = 0, p = l.length; h < p; h++)
|
|
1530
1439
|
u.add(l[h]);
|
|
@@ -1548,33 +1457,25 @@ class En {
|
|
|
1548
1457
|
a.push(c);
|
|
1549
1458
|
}), this.nodeCache[t] = Promise.all(a).then(function(c) {
|
|
1550
1459
|
let u;
|
|
1551
|
-
if (s.isBone === !0 ? u = new Nt() : c.length > 1 ? u = new re() : c.length === 1 ? u = c[0] : u = new
|
|
1552
|
-
for (let l = 0,
|
|
1460
|
+
if (s.isBone === !0 ? u = new Nt() : c.length > 1 ? u = new re() : c.length === 1 ? u = c[0] : u = new Ce(), u !== c[0])
|
|
1461
|
+
for (let l = 0, f = c.length; l < f; l++)
|
|
1553
1462
|
u.add(c[l]);
|
|
1554
|
-
if (s.name && (u.userData.name = s.name, u.name = r),
|
|
1555
|
-
const l = new
|
|
1463
|
+
if (s.name && (u.userData.name = s.name, u.name = r), P(u, s), s.extensions && B(i, u, s), s.matrix !== void 0) {
|
|
1464
|
+
const l = new J();
|
|
1556
1465
|
l.fromArray(s.matrix), u.applyMatrix4(l);
|
|
1557
1466
|
} else
|
|
1558
1467
|
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);
|
|
1559
|
-
|
|
1560
|
-
n.associations.set(u, {});
|
|
1561
|
-
else if (s.mesh !== void 0 && n.meshCache.refs[s.mesh] > 1) {
|
|
1562
|
-
const l = n.associations.get(u);
|
|
1563
|
-
n.associations.set(u, { ...l });
|
|
1564
|
-
}
|
|
1565
|
-
return n.associations.get(u).nodes = t, u;
|
|
1468
|
+
return n.associations.has(u) || n.associations.set(u, {}), n.associations.get(u).nodes = t, u;
|
|
1566
1469
|
}), this.nodeCache[t];
|
|
1567
1470
|
}
|
|
1568
1471
|
/**
|
|
1569
1472
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
|
|
1570
|
-
*
|
|
1571
|
-
* @private
|
|
1572
1473
|
* @param {number} sceneIndex
|
|
1573
1474
|
* @return {Promise<Group>}
|
|
1574
1475
|
*/
|
|
1575
1476
|
loadScene(t) {
|
|
1576
1477
|
const e = this.extensions, i = this.json.scenes[t], n = this, s = new re();
|
|
1577
|
-
i.name && (s.name = n.createUniqueName(i.name)),
|
|
1478
|
+
i.name && (s.name = n.createUniqueName(i.name)), P(s, i), i.extensions && B(e, s, i);
|
|
1578
1479
|
const r = i.nodes || [], a = [];
|
|
1579
1480
|
for (let o = 0, c = r.length; o < c; o++)
|
|
1580
1481
|
a.push(n.getDependency("node", r[o]));
|
|
@@ -1583,11 +1484,11 @@ class En {
|
|
|
1583
1484
|
s.add(o[u]);
|
|
1584
1485
|
const c = (u) => {
|
|
1585
1486
|
const l = /* @__PURE__ */ new Map();
|
|
1586
|
-
for (const [
|
|
1587
|
-
(
|
|
1588
|
-
return u.traverse((
|
|
1589
|
-
const h = n.associations.get(
|
|
1590
|
-
h != null && l.set(
|
|
1487
|
+
for (const [f, h] of n.associations)
|
|
1488
|
+
(f instanceof se || f instanceof ge) && l.set(f, h);
|
|
1489
|
+
return u.traverse((f) => {
|
|
1490
|
+
const h = n.associations.get(f);
|
|
1491
|
+
h != null && l.set(f, h);
|
|
1591
1492
|
}), l;
|
|
1592
1493
|
};
|
|
1593
1494
|
return n.associations = c(s), s;
|
|
@@ -1595,38 +1496,38 @@ class En {
|
|
|
1595
1496
|
}
|
|
1596
1497
|
_createAnimationTracks(t, e, i, n, s) {
|
|
1597
1498
|
const r = [], a = t.name ? t.name : t.uuid, o = [];
|
|
1598
|
-
|
|
1599
|
-
|
|
1499
|
+
k[s.path] === k.weights ? t.traverse(function(f) {
|
|
1500
|
+
f.morphTargetInfluences && o.push(f.name ? f.name : f.uuid);
|
|
1600
1501
|
}) : o.push(a);
|
|
1601
1502
|
let c;
|
|
1602
|
-
switch (
|
|
1603
|
-
case
|
|
1604
|
-
c =
|
|
1503
|
+
switch (k[s.path]) {
|
|
1504
|
+
case k.weights:
|
|
1505
|
+
c = Te;
|
|
1605
1506
|
break;
|
|
1606
|
-
case
|
|
1607
|
-
c = Ee;
|
|
1608
|
-
break;
|
|
1609
|
-
case D.translation:
|
|
1610
|
-
case D.scale:
|
|
1507
|
+
case k.rotation:
|
|
1611
1508
|
c = xe;
|
|
1612
1509
|
break;
|
|
1510
|
+
case k.position:
|
|
1511
|
+
case k.scale:
|
|
1512
|
+
c = Ae;
|
|
1513
|
+
break;
|
|
1613
1514
|
default:
|
|
1614
1515
|
switch (i.itemSize) {
|
|
1615
1516
|
case 1:
|
|
1616
|
-
c =
|
|
1517
|
+
c = Te;
|
|
1617
1518
|
break;
|
|
1618
1519
|
case 2:
|
|
1619
1520
|
case 3:
|
|
1620
1521
|
default:
|
|
1621
|
-
c =
|
|
1522
|
+
c = Ae;
|
|
1622
1523
|
break;
|
|
1623
1524
|
}
|
|
1624
1525
|
break;
|
|
1625
1526
|
}
|
|
1626
|
-
const u = n.interpolation !== void 0 ? hn[n.interpolation] :
|
|
1627
|
-
for (let
|
|
1527
|
+
const u = n.interpolation !== void 0 ? hn[n.interpolation] : ke, l = this._getArrayFromAccessor(i);
|
|
1528
|
+
for (let f = 0, h = o.length; f < h; f++) {
|
|
1628
1529
|
const p = new c(
|
|
1629
|
-
o[
|
|
1530
|
+
o[f] + "." + k[s.path],
|
|
1630
1531
|
e.array,
|
|
1631
1532
|
l,
|
|
1632
1533
|
u
|
|
@@ -1647,19 +1548,19 @@ class En {
|
|
|
1647
1548
|
}
|
|
1648
1549
|
_createCubicSplineTrackInterpolant(t) {
|
|
1649
1550
|
t.createInterpolant = function(i) {
|
|
1650
|
-
const n = this instanceof
|
|
1551
|
+
const n = this instanceof xe ? fn : Be;
|
|
1651
1552
|
return new n(this.times, this.values, this.getValueSize() / 3, i);
|
|
1652
1553
|
}, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1653
1554
|
}
|
|
1654
1555
|
}
|
|
1655
|
-
function
|
|
1656
|
-
const i = t.attributes, n = new
|
|
1556
|
+
function En(d, t, e) {
|
|
1557
|
+
const i = t.attributes, n = new Pe();
|
|
1657
1558
|
if (i.POSITION !== void 0) {
|
|
1658
1559
|
const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
|
|
1659
1560
|
if (o !== void 0 && c !== void 0) {
|
|
1660
1561
|
if (n.set(
|
|
1661
|
-
new
|
|
1662
|
-
new
|
|
1562
|
+
new j(o[0], o[1], o[2]),
|
|
1563
|
+
new j(c[0], c[1], c[2])
|
|
1663
1564
|
), a.normalized) {
|
|
1664
1565
|
const u = de(V[a.componentType]);
|
|
1665
1566
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
@@ -1672,15 +1573,15 @@ function An(f, t, e) {
|
|
|
1672
1573
|
return;
|
|
1673
1574
|
const s = t.targets;
|
|
1674
1575
|
if (s !== void 0) {
|
|
1675
|
-
const a = new
|
|
1576
|
+
const a = new j(), o = new j();
|
|
1676
1577
|
for (let c = 0, u = s.length; c < u; c++) {
|
|
1677
1578
|
const l = s[c];
|
|
1678
1579
|
if (l.POSITION !== void 0) {
|
|
1679
|
-
const
|
|
1580
|
+
const f = e.json.accessors[l.POSITION], h = f.min, p = f.max;
|
|
1680
1581
|
if (h !== void 0 && p !== void 0) {
|
|
1681
|
-
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]))),
|
|
1682
|
-
const
|
|
1683
|
-
o.multiplyScalar(
|
|
1582
|
+
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) {
|
|
1583
|
+
const T = de(V[f.componentType]);
|
|
1584
|
+
o.multiplyScalar(T);
|
|
1684
1585
|
}
|
|
1685
1586
|
a.max(o);
|
|
1686
1587
|
} else
|
|
@@ -1689,35 +1590,35 @@ function An(f, t, e) {
|
|
|
1689
1590
|
}
|
|
1690
1591
|
n.expandByVector(a);
|
|
1691
1592
|
}
|
|
1692
|
-
|
|
1693
|
-
const r = new
|
|
1694
|
-
n.getCenter(r.center), r.radius = n.min.distanceTo(n.max) / 2,
|
|
1593
|
+
d.boundingBox = n;
|
|
1594
|
+
const r = new Dt();
|
|
1595
|
+
n.getCenter(r.center), r.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = r;
|
|
1695
1596
|
}
|
|
1696
|
-
function
|
|
1597
|
+
function Me(d, t, e) {
|
|
1697
1598
|
const i = t.attributes, n = [];
|
|
1698
1599
|
function s(r, a) {
|
|
1699
1600
|
return e.getDependency("accessor", r).then(function(o) {
|
|
1700
|
-
|
|
1601
|
+
d.setAttribute(a, o);
|
|
1701
1602
|
});
|
|
1702
1603
|
}
|
|
1703
1604
|
for (const r in i) {
|
|
1704
|
-
const a =
|
|
1705
|
-
a in
|
|
1605
|
+
const a = ue[r] || r.toLowerCase();
|
|
1606
|
+
a in d.attributes || n.push(s(i[r], a));
|
|
1706
1607
|
}
|
|
1707
|
-
if (t.indices !== void 0 && !
|
|
1608
|
+
if (t.indices !== void 0 && !d.index) {
|
|
1708
1609
|
const r = e.getDependency("accessor", t.indices).then(function(a) {
|
|
1709
|
-
|
|
1610
|
+
d.setIndex(a);
|
|
1710
1611
|
});
|
|
1711
1612
|
n.push(r);
|
|
1712
1613
|
}
|
|
1713
|
-
return
|
|
1714
|
-
return t.targets !== void 0 ? mn(
|
|
1614
|
+
return Re.workingColorSpace !== D && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Re.workingColorSpace}" not supported.`), P(d, t), En(d, t, e), Promise.all(n).then(function() {
|
|
1615
|
+
return t.targets !== void 0 ? mn(d, t.targets, e) : d;
|
|
1715
1616
|
});
|
|
1716
1617
|
}
|
|
1717
|
-
function
|
|
1718
|
-
const
|
|
1618
|
+
function Ln() {
|
|
1619
|
+
const d = K(!1), t = K(""), e = Ue([]), i = K(null), n = new kt(), s = new Pt(), r = new Ht(), a = new Gt();
|
|
1719
1620
|
return {
|
|
1720
|
-
isLoading:
|
|
1621
|
+
isLoading: d,
|
|
1721
1622
|
loadingProgress: t,
|
|
1722
1623
|
loadedModels: e,
|
|
1723
1624
|
error: i,
|
|
@@ -1727,71 +1628,71 @@ function _n() {
|
|
|
1727
1628
|
console.warn("loadModelsFromBlobs 加载的文件数组为空!");
|
|
1728
1629
|
return;
|
|
1729
1630
|
}
|
|
1730
|
-
|
|
1631
|
+
d.value = !0, t.value = "准备加载...", e.value = [], i.value = null;
|
|
1731
1632
|
const u = /* @__PURE__ */ new Map();
|
|
1732
1633
|
c.forEach((p) => {
|
|
1733
1634
|
p instanceof File && u.set(p.name.toLowerCase(), p);
|
|
1734
1635
|
});
|
|
1735
|
-
const l = [],
|
|
1636
|
+
const l = [], f = [];
|
|
1736
1637
|
try {
|
|
1737
1638
|
for (const p of c) {
|
|
1738
|
-
const
|
|
1639
|
+
const T = p.name || "unknown_file", m = (h = T.split(".").pop()) == null ? void 0 : h.toLowerCase();
|
|
1739
1640
|
if (m === "mtl") continue;
|
|
1740
1641
|
const g = URL.createObjectURL(p);
|
|
1741
1642
|
l.push(g);
|
|
1742
|
-
let
|
|
1743
|
-
const
|
|
1744
|
-
const N =
|
|
1745
|
-
t.value = `正在加载 ${
|
|
1643
|
+
let R = null;
|
|
1644
|
+
const w = (A) => {
|
|
1645
|
+
const N = A.lengthComputable ? A.loaded / A.total * 100 : 0;
|
|
1646
|
+
t.value = `正在加载 ${T}... ${Math.round(N)}%`;
|
|
1746
1647
|
};
|
|
1747
|
-
switch (t.value = `正在加载 ${
|
|
1648
|
+
switch (t.value = `正在加载 ${T}... 0%`, m) {
|
|
1748
1649
|
case "obj":
|
|
1749
|
-
const
|
|
1750
|
-
if (u.has(
|
|
1751
|
-
const v = u.get(
|
|
1752
|
-
l.push(
|
|
1753
|
-
const F = await n.loadAsync(
|
|
1650
|
+
const A = T.replace(/\.obj$/i, ".mtl").toLowerCase();
|
|
1651
|
+
if (u.has(A)) {
|
|
1652
|
+
const v = u.get(A), b = URL.createObjectURL(v);
|
|
1653
|
+
l.push(b);
|
|
1654
|
+
const F = await n.loadAsync(b);
|
|
1754
1655
|
F.preload(), s.setMaterials(F);
|
|
1755
1656
|
} else
|
|
1756
1657
|
s.setMaterials(null);
|
|
1757
|
-
|
|
1658
|
+
R = await s.loadAsync(g, w);
|
|
1758
1659
|
break;
|
|
1759
1660
|
case "stl":
|
|
1760
|
-
const N = await r.loadAsync(g,
|
|
1761
|
-
|
|
1661
|
+
const N = await r.loadAsync(g, w), I = new Ft({ color: 11184810, specular: 1118481, shininess: 200 });
|
|
1662
|
+
R = new Fe(N, I);
|
|
1762
1663
|
break;
|
|
1763
1664
|
case "gltf":
|
|
1764
1665
|
case "glb":
|
|
1765
|
-
|
|
1666
|
+
R = (await a.loadAsync(g, w)).scene;
|
|
1766
1667
|
break;
|
|
1767
1668
|
default:
|
|
1768
|
-
console.warn(`不支持的文件类型: .${m}`), t.value = `不支持的文件类型: ${
|
|
1669
|
+
console.warn(`不支持的文件类型: .${m}`), t.value = `不支持的文件类型: ${T}`;
|
|
1769
1670
|
continue;
|
|
1770
1671
|
}
|
|
1771
|
-
|
|
1672
|
+
R && (R.userData.boundingBox = new Pe().setFromObject(R), f.push(R));
|
|
1772
1673
|
}
|
|
1773
|
-
e.value =
|
|
1674
|
+
e.value = f, t.value = "加载完成!";
|
|
1774
1675
|
} catch (p) {
|
|
1775
1676
|
throw console.error("加载模型时出错:", p), i.value = `加载失败: ${p.message || "未知错误"}`, t.value = "加载失败!", e.value = [], p;
|
|
1776
1677
|
} finally {
|
|
1777
|
-
|
|
1678
|
+
d.value = !1, l.forEach((p) => URL.revokeObjectURL(p));
|
|
1778
1679
|
}
|
|
1779
1680
|
}
|
|
1780
1681
|
};
|
|
1781
1682
|
}
|
|
1782
|
-
const
|
|
1683
|
+
const _n = { class: "obj-viewer-container" }, wn = { class: "buttonGroup-topLeft" }, bn = { class: "buttonGroup-left" }, Mn = { class: "buttonGroup-right" }, yn = { class: "left-panel" }, Sn = { class: "panel-header" }, Nn = {
|
|
1783
1684
|
key: 0,
|
|
1784
1685
|
class: "clipping-content"
|
|
1785
|
-
}, In = { class: "radio-group" }, Cn = { class: "radio-label" }, On = { class: "radio-label" }, vn = { class: "radio-label" },
|
|
1686
|
+
}, In = { class: "radio-group" }, Cn = { class: "radio-label" }, On = { class: "radio-label" }, vn = { class: "radio-label" }, Dn = { class: "radio-label" }, Fn = {
|
|
1786
1687
|
key: 0,
|
|
1787
1688
|
class: "loading-overlay"
|
|
1788
|
-
},
|
|
1689
|
+
}, kn = /* @__PURE__ */ je({
|
|
1789
1690
|
__name: "threePreview",
|
|
1790
1691
|
props: {
|
|
1791
1692
|
fileBlobs: { default: () => [] }
|
|
1792
1693
|
},
|
|
1793
|
-
setup(
|
|
1794
|
-
const t =
|
|
1694
|
+
setup(d) {
|
|
1695
|
+
const t = d, e = K(null), i = K(!1), n = K(""), {
|
|
1795
1696
|
currentModels: s,
|
|
1796
1697
|
resetView: r,
|
|
1797
1698
|
initThreeJS: a,
|
|
@@ -1799,178 +1700,178 @@ const Ln = { class: "obj-viewer-container" }, Mn = { class: "buttonGroup-topLeft
|
|
|
1799
1700
|
getThreeJSObjects: c,
|
|
1800
1701
|
cleanup: u,
|
|
1801
1702
|
setModels: l,
|
|
1802
|
-
axesHelperVisible:
|
|
1703
|
+
axesHelperVisible: f,
|
|
1803
1704
|
toggleAxesVisibility: h
|
|
1804
|
-
} =
|
|
1705
|
+
} = Ye(e), {
|
|
1805
1706
|
isLoading: p,
|
|
1806
|
-
loadingProgress:
|
|
1707
|
+
loadingProgress: T,
|
|
1807
1708
|
loadedModels: m,
|
|
1808
1709
|
error: g,
|
|
1809
|
-
loadModelsFromBlobs:
|
|
1810
|
-
} =
|
|
1710
|
+
loadModelsFromBlobs: R
|
|
1711
|
+
} = Ln(), { isAnimating: w, toggleAnimation: A, stopAnimation: N } = Qe(c, s), { isClipping: I, activeClippingAxis: L, toggleClipping: v, updateClippingPlanes: b } = $e(
|
|
1811
1712
|
c,
|
|
1812
1713
|
s
|
|
1813
1714
|
), F = () => {
|
|
1814
1715
|
h();
|
|
1815
1716
|
};
|
|
1816
|
-
Z(() => t.fileBlobs, (
|
|
1817
|
-
|
|
1818
|
-
console.error("加载错误:",
|
|
1717
|
+
Z(() => t.fileBlobs, (M) => {
|
|
1718
|
+
M && M.length > 0 && R(M).catch((E) => {
|
|
1719
|
+
console.error("加载错误:", E);
|
|
1819
1720
|
});
|
|
1820
1721
|
}, {
|
|
1821
1722
|
immediate: !0,
|
|
1822
1723
|
deep: !0
|
|
1823
|
-
}), Z(m, (
|
|
1824
|
-
|
|
1825
|
-
}), Z(g, (
|
|
1826
|
-
|
|
1724
|
+
}), Z(m, (M) => {
|
|
1725
|
+
M && M.length > 0 && l(M);
|
|
1726
|
+
}), Z(g, (M) => {
|
|
1727
|
+
M && Ee.error(`模型加载失败: ${M}`);
|
|
1827
1728
|
});
|
|
1828
|
-
const
|
|
1829
|
-
i.value = !0, n.value =
|
|
1729
|
+
const fe = (M) => {
|
|
1730
|
+
i.value = !0, n.value = M, M === "剖面视图" && !I.value && v();
|
|
1830
1731
|
};
|
|
1831
|
-
return
|
|
1832
|
-
await
|
|
1732
|
+
return Ke(async () => {
|
|
1733
|
+
await Ve();
|
|
1833
1734
|
try {
|
|
1834
1735
|
a(), window.addEventListener("resize", o);
|
|
1835
|
-
} catch (
|
|
1836
|
-
console.error("Three.js 初始化失败:",
|
|
1736
|
+
} catch (M) {
|
|
1737
|
+
console.error("Three.js 初始化失败:", M), Ee.error("渲染引擎初始化失败!");
|
|
1837
1738
|
}
|
|
1838
1739
|
}), Xe(() => {
|
|
1839
|
-
n.value = "", window.removeEventListener("resize", o),
|
|
1840
|
-
}), (
|
|
1841
|
-
const
|
|
1842
|
-
return te(), ee("div",
|
|
1843
|
-
|
|
1740
|
+
n.value = "", window.removeEventListener("resize", o), w.value && N(), u();
|
|
1741
|
+
}), (M, E) => {
|
|
1742
|
+
const Ge = ze("el-scrollbar");
|
|
1743
|
+
return te(), ee("div", _n, [
|
|
1744
|
+
_("div", {
|
|
1844
1745
|
ref_key: "threejsContainer",
|
|
1845
1746
|
ref: e,
|
|
1846
1747
|
class: "threejs-container"
|
|
1847
1748
|
}, null, 512),
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
H(
|
|
1749
|
+
E[15] || (E[15] = _("div", { class: "buttonGroup-top" }, null, -1)),
|
|
1750
|
+
_("div", wn, [
|
|
1751
|
+
H(U, {
|
|
1851
1752
|
name: "viewReset",
|
|
1852
1753
|
size: "24",
|
|
1853
|
-
onClick:
|
|
1754
|
+
onClick: y(r),
|
|
1854
1755
|
title: "重置"
|
|
1855
1756
|
}, null, 8, ["onClick"]),
|
|
1856
|
-
H(
|
|
1757
|
+
H(U, {
|
|
1857
1758
|
name: "fangda",
|
|
1858
1759
|
size: "24",
|
|
1859
1760
|
title: "放大"
|
|
1860
1761
|
}),
|
|
1861
|
-
H(
|
|
1762
|
+
H(U, {
|
|
1862
1763
|
name: "suoxiao",
|
|
1863
1764
|
size: "24",
|
|
1864
1765
|
title: "缩小"
|
|
1865
1766
|
}),
|
|
1866
|
-
H(
|
|
1767
|
+
H(U, {
|
|
1867
1768
|
name: "lookAround",
|
|
1868
1769
|
size: "24",
|
|
1869
|
-
onClick:
|
|
1870
|
-
title:
|
|
1770
|
+
onClick: y(A),
|
|
1771
|
+
title: y(w) ? "停止动画" : "动画视图"
|
|
1871
1772
|
}, null, 8, ["onClick", "title"]),
|
|
1872
|
-
H(
|
|
1773
|
+
H(U, {
|
|
1873
1774
|
name: "zuobiaoxi",
|
|
1874
1775
|
size: "24",
|
|
1875
|
-
active:
|
|
1776
|
+
active: y(f),
|
|
1876
1777
|
onClick: F,
|
|
1877
1778
|
title: "显隐坐标轴"
|
|
1878
1779
|
}, null, 8, ["active"])
|
|
1879
1780
|
]),
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
H(
|
|
1781
|
+
_("div", bn, [
|
|
1782
|
+
pe(M.$slots, "button-left", { switchRightPanel: fe }, void 0, !0),
|
|
1783
|
+
H(U, {
|
|
1883
1784
|
name: "clipping",
|
|
1884
1785
|
size: "24",
|
|
1885
|
-
onClick:
|
|
1786
|
+
onClick: E[0] || (E[0] = (S) => fe("剖面视图")),
|
|
1886
1787
|
active: i.value && n.value === "剖面视图",
|
|
1887
1788
|
title: "剖面视图"
|
|
1888
1789
|
}, null, 8, ["active"])
|
|
1889
1790
|
]),
|
|
1890
|
-
|
|
1891
|
-
|
|
1791
|
+
_("div", Mn, [
|
|
1792
|
+
pe(M.$slots, "button-right", {}, void 0, !0)
|
|
1892
1793
|
]),
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1794
|
+
E[16] || (E[16] = _("div", { class: "buttonGroup-bottom" }, null, -1)),
|
|
1795
|
+
X(_("div", yn, [
|
|
1796
|
+
_("div", Sn, [
|
|
1797
|
+
_("span", null, me(n.value), 1),
|
|
1798
|
+
_("span", {
|
|
1898
1799
|
class: "close",
|
|
1899
|
-
onClick:
|
|
1800
|
+
onClick: E[1] || (E[1] = (S) => i.value = !1)
|
|
1900
1801
|
}, " X ")
|
|
1901
1802
|
]),
|
|
1902
|
-
H(
|
|
1903
|
-
default:
|
|
1803
|
+
H(Ge, { "max-height": "650px" }, {
|
|
1804
|
+
default: qe(() => [
|
|
1904
1805
|
n.value === "剖面视图" ? (te(), ee("div", Nn, [
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1806
|
+
_("div", In, [
|
|
1807
|
+
_("label", Cn, [
|
|
1808
|
+
X(_("input", {
|
|
1908
1809
|
type: "radio",
|
|
1909
1810
|
name: "clipping-axis",
|
|
1910
1811
|
value: "none",
|
|
1911
|
-
"onUpdate:modelValue":
|
|
1912
|
-
onChange:
|
|
1913
|
-
(...S) => b
|
|
1812
|
+
"onUpdate:modelValue": E[2] || (E[2] = (S) => Q(L) ? L.value = S : null),
|
|
1813
|
+
onChange: E[3] || (E[3] = //@ts-ignore
|
|
1814
|
+
(...S) => y(b) && y(b)(...S))
|
|
1914
1815
|
}, null, 544), [
|
|
1915
|
-
[
|
|
1816
|
+
[$, y(L)]
|
|
1916
1817
|
]),
|
|
1917
|
-
|
|
1818
|
+
E[10] || (E[10] = _("span", { class: "radio-text" }, "无切割", -1))
|
|
1918
1819
|
]),
|
|
1919
|
-
|
|
1920
|
-
|
|
1820
|
+
_("label", On, [
|
|
1821
|
+
X(_("input", {
|
|
1921
1822
|
type: "radio",
|
|
1922
1823
|
name: "clipping-axis",
|
|
1923
1824
|
value: "x",
|
|
1924
|
-
"onUpdate:modelValue":
|
|
1925
|
-
onChange:
|
|
1926
|
-
(...S) => b
|
|
1825
|
+
"onUpdate:modelValue": E[4] || (E[4] = (S) => Q(L) ? L.value = S : null),
|
|
1826
|
+
onChange: E[5] || (E[5] = //@ts-ignore
|
|
1827
|
+
(...S) => y(b) && y(b)(...S))
|
|
1927
1828
|
}, null, 544), [
|
|
1928
|
-
[
|
|
1829
|
+
[$, y(L)]
|
|
1929
1830
|
]),
|
|
1930
|
-
|
|
1831
|
+
E[11] || (E[11] = _("span", { class: "radio-text" }, "X轴切割", -1))
|
|
1931
1832
|
]),
|
|
1932
|
-
|
|
1933
|
-
|
|
1833
|
+
_("label", vn, [
|
|
1834
|
+
X(_("input", {
|
|
1934
1835
|
type: "radio",
|
|
1935
1836
|
name: "clipping-axis",
|
|
1936
1837
|
value: "y",
|
|
1937
|
-
"onUpdate:modelValue":
|
|
1938
|
-
onChange:
|
|
1939
|
-
(...S) => b
|
|
1838
|
+
"onUpdate:modelValue": E[6] || (E[6] = (S) => Q(L) ? L.value = S : null),
|
|
1839
|
+
onChange: E[7] || (E[7] = //@ts-ignore
|
|
1840
|
+
(...S) => y(b) && y(b)(...S))
|
|
1940
1841
|
}, null, 544), [
|
|
1941
|
-
[
|
|
1842
|
+
[$, y(L)]
|
|
1942
1843
|
]),
|
|
1943
|
-
|
|
1844
|
+
E[12] || (E[12] = _("span", { class: "radio-text" }, "Y轴切割", -1))
|
|
1944
1845
|
]),
|
|
1945
|
-
|
|
1946
|
-
|
|
1846
|
+
_("label", Dn, [
|
|
1847
|
+
X(_("input", {
|
|
1947
1848
|
type: "radio",
|
|
1948
1849
|
name: "clipping-axis",
|
|
1949
1850
|
value: "z",
|
|
1950
|
-
"onUpdate:modelValue":
|
|
1951
|
-
onChange:
|
|
1952
|
-
(...S) => b
|
|
1851
|
+
"onUpdate:modelValue": E[8] || (E[8] = (S) => Q(L) ? L.value = S : null),
|
|
1852
|
+
onChange: E[9] || (E[9] = //@ts-ignore
|
|
1853
|
+
(...S) => y(b) && y(b)(...S))
|
|
1953
1854
|
}, null, 544), [
|
|
1954
|
-
[
|
|
1855
|
+
[$, y(L)]
|
|
1955
1856
|
]),
|
|
1956
|
-
|
|
1857
|
+
E[13] || (E[13] = _("span", { class: "radio-text" }, "Z轴切割", -1))
|
|
1957
1858
|
])
|
|
1958
1859
|
])
|
|
1959
|
-
])) :
|
|
1860
|
+
])) : he("", !0)
|
|
1960
1861
|
]),
|
|
1961
1862
|
_: 1
|
|
1962
1863
|
})
|
|
1963
1864
|
], 512), [
|
|
1964
|
-
[
|
|
1865
|
+
[We, i.value]
|
|
1965
1866
|
]),
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
])) :
|
|
1867
|
+
y(p) ? (te(), ee("div", Fn, [
|
|
1868
|
+
E[14] || (E[14] = _("div", { class: "loading-spinner" }, null, -1)),
|
|
1869
|
+
_("p", null, me(y(T)), 1)
|
|
1870
|
+
])) : he("", !0)
|
|
1970
1871
|
]);
|
|
1971
1872
|
};
|
|
1972
1873
|
}
|
|
1973
|
-
}), Vn = /* @__PURE__ */
|
|
1874
|
+
}), Vn = /* @__PURE__ */ Bt(kn, [["__scopeId", "data-v-0b2f8148"]]);
|
|
1974
1875
|
export {
|
|
1975
1876
|
Vn as default
|
|
1976
1877
|
};
|