@s25studio/sinth 1.0.0
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/LICENSE.md +92 -0
- package/README.md +111 -0
- package/THIRD-PARTY-NOTICES.md +127 -0
- package/dist/esm/BufferGeometryUtils-DBNyVaoE.js +99 -0
- package/dist/esm/createTextGeometry-C1mQrq4Z.js +8095 -0
- package/dist/esm/customAssetGeometry-MXHVov4w.js +1720 -0
- package/dist/esm/instanceTypes-zqDi1nZx.js +63 -0
- package/dist/esm/sinth.js +4069 -0
- package/dist/esm/svgAssetGeometry-CSnPWwR1.js +903 -0
- package/dist/sinth-1.0.0.min.js +677 -0
- package/dist/sinth.min.js +677 -0
- package/dist/three-1.0.0.min.js +4132 -0
- package/dist/three.min.js +4132 -0
- package/package.json +49 -0
|
@@ -0,0 +1,1720 @@
|
|
|
1
|
+
import { n as e, t } from "./BufferGeometryUtils-DBNyVaoE.js";
|
|
2
|
+
import * as n from "three";
|
|
3
|
+
import { AnimationClip as r, Bone as i, Box3 as a, BufferAttribute as o, BufferGeometry as s, ClampToEdgeWrapping as c, Color as l, ColorManagement as u, DirectionalLight as d, DoubleSide as f, FileLoader as p, Float32BufferAttribute as m, FrontSide as h, Group as g, ImageBitmapLoader as ee, InstancedBufferAttribute as te, InstancedMesh as ne, InterleavedBuffer as re, InterleavedBufferAttribute as ie, Interpolant as ae, InterpolateDiscrete as oe, InterpolateLinear as se, Line as ce, LineBasicMaterial as _, LineLoop as le, LineSegments as v, LinearFilter as y, LinearMipmapLinearFilter as ue, LinearMipmapNearestFilter as de, LinearSRGBColorSpace as b, Loader as fe, LoaderUtils as x, Material as S, MathUtils as pe, Matrix4 as C, Mesh as w, MeshBasicMaterial as T, MeshPhongMaterial as me, MeshPhysicalMaterial as E, MeshStandardMaterial as D, MirroredRepeatWrapping as he, NearestFilter as ge, NearestMipmapLinearFilter as _e, NearestMipmapNearestFilter as ve, NumberKeyframeTrack as ye, Object3D as O, OrthographicCamera as be, PerspectiveCamera as xe, PointLight as Se, Points as k, PointsMaterial as A, PropertyBinding as Ce, Quaternion as we, QuaternionKeyframeTrack as Te, RepeatWrapping as j, SRGBColorSpace as M, Skeleton as Ee, SkinnedMesh as De, Sphere as Oe, SpotLight as ke, Texture as Ae, TextureLoader as je, TriangleFanDrawMode as Me, TriangleStripDrawMode as Ne, Vector2 as Pe, Vector3 as N, VectorKeyframeTrack as Fe } from "three";
|
|
4
|
+
//#region node_modules/three/examples/jsm/loaders/OBJLoader.js
|
|
5
|
+
var Ie = /^[og]\s*(.+)?/, Le = /^mtllib /, Re = /^usemtl /, ze = /^usemap /, Be = /\s+/, P = new N(), F = new N(), Ve = new N(), He = new N(), I = new N(), L = new l();
|
|
6
|
+
function Ue() {
|
|
7
|
+
let e = {
|
|
8
|
+
objects: [],
|
|
9
|
+
object: {},
|
|
10
|
+
vertices: [],
|
|
11
|
+
normals: [],
|
|
12
|
+
colors: [],
|
|
13
|
+
uvs: [],
|
|
14
|
+
materials: {},
|
|
15
|
+
materialLibraries: [],
|
|
16
|
+
startObject: function(e, t) {
|
|
17
|
+
if (this.object && this.object.fromDeclaration === !1) {
|
|
18
|
+
this.object.name = e, this.object.fromDeclaration = t !== !1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let n = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
|
|
22
|
+
if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = {
|
|
23
|
+
name: e || "",
|
|
24
|
+
fromDeclaration: t !== !1,
|
|
25
|
+
geometry: {
|
|
26
|
+
vertices: [],
|
|
27
|
+
normals: [],
|
|
28
|
+
colors: [],
|
|
29
|
+
uvs: [],
|
|
30
|
+
hasUVIndices: !1
|
|
31
|
+
},
|
|
32
|
+
materials: [],
|
|
33
|
+
smooth: !0,
|
|
34
|
+
startMaterial: function(e, t) {
|
|
35
|
+
let n = this._finalize(!1);
|
|
36
|
+
n && (n.inherited || n.groupCount <= 0) && this.materials.splice(n.index, 1);
|
|
37
|
+
let r = {
|
|
38
|
+
index: this.materials.length,
|
|
39
|
+
name: e || "",
|
|
40
|
+
mtllib: Array.isArray(t) && t.length > 0 ? t[t.length - 1] : "",
|
|
41
|
+
smooth: n === void 0 ? this.smooth : n.smooth,
|
|
42
|
+
groupStart: n === void 0 ? 0 : n.groupEnd,
|
|
43
|
+
groupEnd: -1,
|
|
44
|
+
groupCount: -1,
|
|
45
|
+
inherited: !1,
|
|
46
|
+
clone: function(e) {
|
|
47
|
+
let t = {
|
|
48
|
+
index: typeof e == "number" ? e : this.index,
|
|
49
|
+
name: this.name,
|
|
50
|
+
mtllib: this.mtllib,
|
|
51
|
+
smooth: this.smooth,
|
|
52
|
+
groupStart: 0,
|
|
53
|
+
groupEnd: -1,
|
|
54
|
+
groupCount: -1,
|
|
55
|
+
inherited: !1
|
|
56
|
+
};
|
|
57
|
+
return t.clone = this.clone.bind(t), t;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return this.materials.push(r), r;
|
|
61
|
+
},
|
|
62
|
+
currentMaterial: function() {
|
|
63
|
+
if (this.materials.length > 0) return this.materials[this.materials.length - 1];
|
|
64
|
+
},
|
|
65
|
+
_finalize: function(e) {
|
|
66
|
+
let t = this.currentMaterial();
|
|
67
|
+
if (t && t.groupEnd === -1 && (t.groupEnd = this.geometry.vertices.length / 3, t.groupCount = t.groupEnd - t.groupStart, t.inherited = !1), e && this.materials.length > 1) for (let e = this.materials.length - 1; e >= 0; e--) this.materials[e].groupCount <= 0 && this.materials.splice(e, 1);
|
|
68
|
+
return e && this.materials.length === 0 && this.materials.push({
|
|
69
|
+
name: "",
|
|
70
|
+
smooth: this.smooth
|
|
71
|
+
}), t;
|
|
72
|
+
}
|
|
73
|
+
}, n && n.name && typeof n.clone == "function") {
|
|
74
|
+
let e = n.clone(0);
|
|
75
|
+
e.inherited = !0, this.object.materials.push(e);
|
|
76
|
+
}
|
|
77
|
+
this.objects.push(this.object);
|
|
78
|
+
},
|
|
79
|
+
finalize: function() {
|
|
80
|
+
this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
|
|
81
|
+
},
|
|
82
|
+
parseVertexIndex: function(e, t) {
|
|
83
|
+
let n = parseInt(e, 10);
|
|
84
|
+
return (n >= 0 ? n - 1 : n + t / 3) * 3;
|
|
85
|
+
},
|
|
86
|
+
parseNormalIndex: function(e, t) {
|
|
87
|
+
let n = parseInt(e, 10);
|
|
88
|
+
return (n >= 0 ? n - 1 : n + t / 3) * 3;
|
|
89
|
+
},
|
|
90
|
+
parseUVIndex: function(e, t) {
|
|
91
|
+
let n = parseInt(e, 10);
|
|
92
|
+
return (n >= 0 ? n - 1 : n + t / 2) * 2;
|
|
93
|
+
},
|
|
94
|
+
addVertex: function(e, t, n) {
|
|
95
|
+
let r = this.vertices, i = this.object.geometry.vertices;
|
|
96
|
+
i.push(r[e + 0], r[e + 1], r[e + 2]), i.push(r[t + 0], r[t + 1], r[t + 2]), i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
97
|
+
},
|
|
98
|
+
addVertexPoint: function(e) {
|
|
99
|
+
let t = this.vertices;
|
|
100
|
+
this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
|
|
101
|
+
},
|
|
102
|
+
addVertexLine: function(e) {
|
|
103
|
+
let t = this.vertices;
|
|
104
|
+
this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
|
|
105
|
+
},
|
|
106
|
+
addNormal: function(e, t, n) {
|
|
107
|
+
let r = this.normals, i = this.object.geometry.normals;
|
|
108
|
+
i.push(r[e + 0], r[e + 1], r[e + 2]), i.push(r[t + 0], r[t + 1], r[t + 2]), i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
109
|
+
},
|
|
110
|
+
addFaceNormal: function(e, t, n) {
|
|
111
|
+
let r = this.vertices, i = this.object.geometry.normals;
|
|
112
|
+
P.fromArray(r, e), F.fromArray(r, t), Ve.fromArray(r, n), I.subVectors(Ve, F), He.subVectors(P, F), I.cross(He), I.normalize(), i.push(I.x, I.y, I.z), i.push(I.x, I.y, I.z), i.push(I.x, I.y, I.z);
|
|
113
|
+
},
|
|
114
|
+
addColor: function(e, t, n) {
|
|
115
|
+
let r = this.colors, i = this.object.geometry.colors;
|
|
116
|
+
r[e] !== void 0 && i.push(r[e + 0], r[e + 1], r[e + 2]), r[t] !== void 0 && i.push(r[t + 0], r[t + 1], r[t + 2]), r[n] !== void 0 && i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
117
|
+
},
|
|
118
|
+
addUV: function(e, t, n) {
|
|
119
|
+
let r = this.uvs, i = this.object.geometry.uvs;
|
|
120
|
+
i.push(r[e + 0], r[e + 1]), i.push(r[t + 0], r[t + 1]), i.push(r[n + 0], r[n + 1]);
|
|
121
|
+
},
|
|
122
|
+
addDefaultUV: function() {
|
|
123
|
+
let e = this.object.geometry.uvs;
|
|
124
|
+
e.push(0, 0), e.push(0, 0), e.push(0, 0);
|
|
125
|
+
},
|
|
126
|
+
addUVLine: function(e) {
|
|
127
|
+
let t = this.uvs;
|
|
128
|
+
this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
|
|
129
|
+
},
|
|
130
|
+
addFace: function(e, t, n, r, i, a, o, s, c) {
|
|
131
|
+
let l = this.vertices.length, u = this.parseVertexIndex(e, l), d = this.parseVertexIndex(t, l), f = this.parseVertexIndex(n, l);
|
|
132
|
+
if (this.addVertex(u, d, f), this.addColor(u, d, f), o !== void 0 && o !== "") {
|
|
133
|
+
let e = this.normals.length;
|
|
134
|
+
u = this.parseNormalIndex(o, e), d = this.parseNormalIndex(s, e), f = this.parseNormalIndex(c, e), this.addNormal(u, d, f);
|
|
135
|
+
} else this.addFaceNormal(u, d, f);
|
|
136
|
+
if (r !== void 0 && r !== "") {
|
|
137
|
+
let e = this.uvs.length;
|
|
138
|
+
u = this.parseUVIndex(r, e), d = this.parseUVIndex(i, e), f = this.parseUVIndex(a, e), this.addUV(u, d, f), this.object.geometry.hasUVIndices = !0;
|
|
139
|
+
} else this.addDefaultUV();
|
|
140
|
+
},
|
|
141
|
+
addPointGeometry: function(e) {
|
|
142
|
+
this.object.geometry.type = "Points";
|
|
143
|
+
let t = this.vertices.length;
|
|
144
|
+
for (let n = 0, r = e.length; n < r; n++) {
|
|
145
|
+
let r = this.parseVertexIndex(e[n], t);
|
|
146
|
+
this.addVertexPoint(r), this.addColor(r);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
addLineGeometry: function(e, t) {
|
|
150
|
+
this.object.geometry.type = "Line";
|
|
151
|
+
let n = this.vertices.length, r = this.uvs.length;
|
|
152
|
+
for (let t = 0, r = e.length; t < r; t++) this.addVertexLine(this.parseVertexIndex(e[t], n));
|
|
153
|
+
for (let e = 0, n = t.length; e < n; e++) this.addUVLine(this.parseUVIndex(t[e], r));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return e.startObject("", !1), e;
|
|
157
|
+
}
|
|
158
|
+
var We = class extends fe {
|
|
159
|
+
constructor(e) {
|
|
160
|
+
super(e), this.materials = null;
|
|
161
|
+
}
|
|
162
|
+
load(e, t, n, r) {
|
|
163
|
+
let i = this, a = new p(this.manager);
|
|
164
|
+
a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(n) {
|
|
165
|
+
try {
|
|
166
|
+
t(i.parse(n));
|
|
167
|
+
} catch (t) {
|
|
168
|
+
r ? r(t) : console.error(t), i.manager.itemError(e);
|
|
169
|
+
}
|
|
170
|
+
}, n, r);
|
|
171
|
+
}
|
|
172
|
+
setMaterials(e) {
|
|
173
|
+
return this.materials = e, this;
|
|
174
|
+
}
|
|
175
|
+
parse(e) {
|
|
176
|
+
let t = new Ue();
|
|
177
|
+
e.indexOf("\r\n") !== -1 && (e = e.replace(/\r\n/g, "\n")), e.indexOf("\\\n") !== -1 && (e = e.replace(/\\\n/g, ""));
|
|
178
|
+
let n = e.split("\n"), r = [];
|
|
179
|
+
for (let e = 0, i = n.length; e < i; e++) {
|
|
180
|
+
let i = n[e].trimStart();
|
|
181
|
+
if (i.length === 0) continue;
|
|
182
|
+
let a = i.charAt(0);
|
|
183
|
+
if (a !== "#") if (a === "v") {
|
|
184
|
+
let e = i.split(Be);
|
|
185
|
+
switch (e[0]) {
|
|
186
|
+
case "v":
|
|
187
|
+
t.vertices.push(parseFloat(e[1]), parseFloat(e[2]), parseFloat(e[3])), e.length >= 7 ? (L.setRGB(parseFloat(e[4]), parseFloat(e[5]), parseFloat(e[6]), M), t.colors.push(L.r, L.g, L.b)) : t.colors.push(void 0, void 0, void 0);
|
|
188
|
+
break;
|
|
189
|
+
case "vn":
|
|
190
|
+
t.normals.push(parseFloat(e[1]), parseFloat(e[2]), parseFloat(e[3]));
|
|
191
|
+
break;
|
|
192
|
+
case "vt":
|
|
193
|
+
t.uvs.push(parseFloat(e[1]), parseFloat(e[2]));
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
} else if (a === "f") {
|
|
197
|
+
let e = i.slice(1).trim().split(Be), n = [];
|
|
198
|
+
for (let t = 0, r = e.length; t < r; t++) {
|
|
199
|
+
let r = e[t];
|
|
200
|
+
if (r.length > 0) {
|
|
201
|
+
let e = r.split("/");
|
|
202
|
+
n.push(e);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
let r = n[0];
|
|
206
|
+
for (let e = 1, i = n.length - 1; e < i; e++) {
|
|
207
|
+
let i = n[e], a = n[e + 1];
|
|
208
|
+
t.addFace(r[0], i[0], a[0], r[1], i[1], a[1], r[2], i[2], a[2]);
|
|
209
|
+
}
|
|
210
|
+
} else if (a === "l") {
|
|
211
|
+
let e = i.substring(1).trim().split(" "), n = [], r = [];
|
|
212
|
+
if (i.indexOf("/") === -1) n = e;
|
|
213
|
+
else for (let t = 0, i = e.length; t < i; t++) {
|
|
214
|
+
let i = e[t].split("/");
|
|
215
|
+
i[0] !== "" && n.push(i[0]), i[1] !== "" && r.push(i[1]);
|
|
216
|
+
}
|
|
217
|
+
t.addLineGeometry(n, r);
|
|
218
|
+
} else if (a === "p") {
|
|
219
|
+
let e = i.slice(1).trim().split(" ");
|
|
220
|
+
t.addPointGeometry(e);
|
|
221
|
+
} else if ((r = Ie.exec(i)) !== null) {
|
|
222
|
+
let e = (" " + r[0].slice(1).trim()).slice(1);
|
|
223
|
+
t.startObject(e);
|
|
224
|
+
} else if (Re.test(i)) t.object.startMaterial(i.substring(7).trim(), t.materialLibraries);
|
|
225
|
+
else if (Le.test(i)) t.materialLibraries.push(i.substring(7).trim());
|
|
226
|
+
else if (ze.test(i)) console.warn("THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.");
|
|
227
|
+
else if (a === "s") {
|
|
228
|
+
if (r = i.split(" "), r.length > 1) {
|
|
229
|
+
let e = r[1].trim().toLowerCase();
|
|
230
|
+
t.object.smooth = e !== "0" && e !== "off";
|
|
231
|
+
} else t.object.smooth = !0;
|
|
232
|
+
let e = t.object.currentMaterial();
|
|
233
|
+
e && (e.smooth = t.object.smooth);
|
|
234
|
+
} else {
|
|
235
|
+
if (i === "\0") continue;
|
|
236
|
+
console.warn("THREE.OBJLoader: Unexpected line: \"" + i + "\"");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
t.finalize();
|
|
240
|
+
let i = new g();
|
|
241
|
+
if (i.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0)) for (let e = 0, n = t.objects.length; e < n; e++) {
|
|
242
|
+
let n = t.objects[e], r = n.geometry, a = n.materials, o = r.type === "Line", c = r.type === "Points", l = !1;
|
|
243
|
+
if (r.vertices.length === 0) continue;
|
|
244
|
+
let u = new s();
|
|
245
|
+
u.setAttribute("position", new m(r.vertices, 3)), r.normals.length > 0 && u.setAttribute("normal", new m(r.normals, 3)), r.colors.length > 0 && (l = !0, u.setAttribute("color", new m(r.colors, 3))), r.hasUVIndices === !0 && u.setAttribute("uv", new m(r.uvs, 2));
|
|
246
|
+
let d = [];
|
|
247
|
+
for (let e = 0, n = a.length; e < n; e++) {
|
|
248
|
+
let n = a[e], r = n.name + "_" + n.smooth + "_" + l, i = t.materials[r];
|
|
249
|
+
if (this.materials !== null) {
|
|
250
|
+
if (i = this.materials.create(n.name), o && i && !(i instanceof _)) {
|
|
251
|
+
let e = new _();
|
|
252
|
+
S.prototype.copy.call(e, i), e.color.copy(i.color), i = e;
|
|
253
|
+
} else if (c && i && !(i instanceof A)) {
|
|
254
|
+
let e = new A({
|
|
255
|
+
size: 10,
|
|
256
|
+
sizeAttenuation: !1
|
|
257
|
+
});
|
|
258
|
+
S.prototype.copy.call(e, i), e.color.copy(i.color), e.map = i.map, i = e;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
i === void 0 && (i = o ? new _() : c ? new A({
|
|
262
|
+
size: 1,
|
|
263
|
+
sizeAttenuation: !1
|
|
264
|
+
}) : new me(), i.name = n.name, i.flatShading = !n.smooth, i.vertexColors = l, t.materials[r] = i), d.push(i);
|
|
265
|
+
}
|
|
266
|
+
let f;
|
|
267
|
+
if (d.length > 1) {
|
|
268
|
+
for (let e = 0, t = a.length; e < t; e++) {
|
|
269
|
+
let t = a[e];
|
|
270
|
+
u.addGroup(t.groupStart, t.groupCount, e);
|
|
271
|
+
}
|
|
272
|
+
f = o ? new v(u, d) : c ? new k(u, d) : new w(u, d);
|
|
273
|
+
} else f = o ? new v(u, d[0]) : c ? new k(u, d[0]) : new w(u, d[0]);
|
|
274
|
+
f.name = n.name, i.add(f);
|
|
275
|
+
}
|
|
276
|
+
else if (t.vertices.length > 0) {
|
|
277
|
+
let e = new A({
|
|
278
|
+
size: 1,
|
|
279
|
+
sizeAttenuation: !1
|
|
280
|
+
}), n = new s();
|
|
281
|
+
n.setAttribute("position", new m(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (n.setAttribute("color", new m(t.colors, 3)), e.vertexColors = !0);
|
|
282
|
+
let r = new k(n, e);
|
|
283
|
+
i.add(r);
|
|
284
|
+
}
|
|
285
|
+
return i;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region node_modules/three/examples/jsm/utils/SkeletonUtils.js
|
|
290
|
+
function Ge(e) {
|
|
291
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = e.clone();
|
|
292
|
+
return Ke(e, r, function(e, r) {
|
|
293
|
+
t.set(r, e), n.set(e, r);
|
|
294
|
+
}), r.traverse(function(e) {
|
|
295
|
+
if (!e.isSkinnedMesh) return;
|
|
296
|
+
let r = e, i = t.get(e), a = i.skeleton.bones;
|
|
297
|
+
r.skeleton = i.skeleton.clone(), r.bindMatrix.copy(i.bindMatrix), r.skeleton.bones = a.map(function(e) {
|
|
298
|
+
return n.get(e);
|
|
299
|
+
}), r.bind(r.skeleton, r.bindMatrix);
|
|
300
|
+
}), r;
|
|
301
|
+
}
|
|
302
|
+
function Ke(e, t, n) {
|
|
303
|
+
n(e, t);
|
|
304
|
+
for (let r = 0; r < e.children.length; r++) Ke(e.children[r], t.children[r], n);
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region node_modules/three/examples/jsm/loaders/GLTFLoader.js
|
|
308
|
+
var qe = class extends fe {
|
|
309
|
+
constructor(e) {
|
|
310
|
+
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
|
|
311
|
+
return new Qe(e);
|
|
312
|
+
}), this.register(function(e) {
|
|
313
|
+
return new $e(e);
|
|
314
|
+
}), this.register(function(e) {
|
|
315
|
+
return new ct(e);
|
|
316
|
+
}), this.register(function(e) {
|
|
317
|
+
return new lt(e);
|
|
318
|
+
}), this.register(function(e) {
|
|
319
|
+
return new ut(e);
|
|
320
|
+
}), this.register(function(e) {
|
|
321
|
+
return new tt(e);
|
|
322
|
+
}), this.register(function(e) {
|
|
323
|
+
return new nt(e);
|
|
324
|
+
}), this.register(function(e) {
|
|
325
|
+
return new rt(e);
|
|
326
|
+
}), this.register(function(e) {
|
|
327
|
+
return new it(e);
|
|
328
|
+
}), this.register(function(e) {
|
|
329
|
+
return new Ze(e);
|
|
330
|
+
}), this.register(function(e) {
|
|
331
|
+
return new at(e);
|
|
332
|
+
}), this.register(function(e) {
|
|
333
|
+
return new et(e);
|
|
334
|
+
}), this.register(function(e) {
|
|
335
|
+
return new st(e);
|
|
336
|
+
}), this.register(function(e) {
|
|
337
|
+
return new ot(e);
|
|
338
|
+
}), this.register(function(e) {
|
|
339
|
+
return new Ye(e);
|
|
340
|
+
}), this.register(function(e) {
|
|
341
|
+
return new dt(e, z.EXT_MESHOPT_COMPRESSION);
|
|
342
|
+
}), this.register(function(e) {
|
|
343
|
+
return new dt(e, z.KHR_MESHOPT_COMPRESSION);
|
|
344
|
+
}), this.register(function(e) {
|
|
345
|
+
return new ft(e);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
load(e, t, n, r) {
|
|
349
|
+
let i = this, a;
|
|
350
|
+
if (this.resourcePath !== "") a = this.resourcePath;
|
|
351
|
+
else if (this.path !== "") {
|
|
352
|
+
let t = x.extractUrlBase(e);
|
|
353
|
+
a = x.resolveURL(t, this.path);
|
|
354
|
+
} else a = x.extractUrlBase(e);
|
|
355
|
+
this.manager.itemStart(e);
|
|
356
|
+
let o = function(t) {
|
|
357
|
+
r ? r(t) : console.error(t), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
358
|
+
}, s = new p(this.manager);
|
|
359
|
+
s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(e, function(n) {
|
|
360
|
+
try {
|
|
361
|
+
i.parse(n, a, function(n) {
|
|
362
|
+
t(n), i.manager.itemEnd(e);
|
|
363
|
+
}, o);
|
|
364
|
+
} catch (e) {
|
|
365
|
+
o(e);
|
|
366
|
+
}
|
|
367
|
+
}, n, o);
|
|
368
|
+
}
|
|
369
|
+
setDRACOLoader(e) {
|
|
370
|
+
return this.dracoLoader = e, this;
|
|
371
|
+
}
|
|
372
|
+
setKTX2Loader(e) {
|
|
373
|
+
return this.ktx2Loader = e, this;
|
|
374
|
+
}
|
|
375
|
+
setMeshoptDecoder(e) {
|
|
376
|
+
return this.meshoptDecoder = e, this;
|
|
377
|
+
}
|
|
378
|
+
register(e) {
|
|
379
|
+
return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
|
|
380
|
+
}
|
|
381
|
+
unregister(e) {
|
|
382
|
+
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
383
|
+
}
|
|
384
|
+
parse(e, t, n, r) {
|
|
385
|
+
let i, a = {}, o = {}, s = new TextDecoder();
|
|
386
|
+
if (typeof e == "string") i = JSON.parse(e);
|
|
387
|
+
else if (e instanceof ArrayBuffer) if (s.decode(new Uint8Array(e, 0, 4)) === pt) {
|
|
388
|
+
try {
|
|
389
|
+
a[z.KHR_BINARY_GLTF] = new ht(e);
|
|
390
|
+
} catch (e) {
|
|
391
|
+
r && r(e);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
i = JSON.parse(a[z.KHR_BINARY_GLTF].content);
|
|
395
|
+
} else i = JSON.parse(s.decode(e));
|
|
396
|
+
else i = e;
|
|
397
|
+
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
398
|
+
r && r(/* @__PURE__ */ Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
let c = new jt(i, {
|
|
402
|
+
path: t || this.resourcePath || "",
|
|
403
|
+
crossOrigin: this.crossOrigin,
|
|
404
|
+
requestHeader: this.requestHeader,
|
|
405
|
+
manager: this.manager,
|
|
406
|
+
ktx2Loader: this.ktx2Loader,
|
|
407
|
+
meshoptDecoder: this.meshoptDecoder
|
|
408
|
+
});
|
|
409
|
+
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
410
|
+
for (let e = 0; e < this.pluginCallbacks.length; e++) {
|
|
411
|
+
let t = this.pluginCallbacks[e](c);
|
|
412
|
+
t.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), o[t.name] = t, a[t.name] = !0;
|
|
413
|
+
}
|
|
414
|
+
if (i.extensionsUsed) for (let e = 0; e < i.extensionsUsed.length; ++e) {
|
|
415
|
+
let t = i.extensionsUsed[e], n = i.extensionsRequired || [];
|
|
416
|
+
switch (t) {
|
|
417
|
+
case z.KHR_MATERIALS_UNLIT:
|
|
418
|
+
a[t] = new Xe();
|
|
419
|
+
break;
|
|
420
|
+
case z.KHR_DRACO_MESH_COMPRESSION:
|
|
421
|
+
a[t] = new gt(i, this.dracoLoader);
|
|
422
|
+
break;
|
|
423
|
+
case z.KHR_TEXTURE_TRANSFORM:
|
|
424
|
+
a[t] = new _t();
|
|
425
|
+
break;
|
|
426
|
+
case z.KHR_MESH_QUANTIZATION:
|
|
427
|
+
a[t] = new vt();
|
|
428
|
+
break;
|
|
429
|
+
default: n.indexOf(t) >= 0 && o[t] === void 0 && console.warn("THREE.GLTFLoader: Unknown extension \"" + t + "\".");
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
c.setExtensions(a), c.setPlugins(o), c.parse(n, r);
|
|
433
|
+
}
|
|
434
|
+
parseAsync(e, t) {
|
|
435
|
+
let n = this;
|
|
436
|
+
return new Promise(function(r, i) {
|
|
437
|
+
n.parse(e, t, r, i);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
function Je() {
|
|
442
|
+
let e = {};
|
|
443
|
+
return {
|
|
444
|
+
get: function(t) {
|
|
445
|
+
return e[t];
|
|
446
|
+
},
|
|
447
|
+
add: function(t, n) {
|
|
448
|
+
e[t] = n;
|
|
449
|
+
},
|
|
450
|
+
remove: function(t) {
|
|
451
|
+
delete e[t];
|
|
452
|
+
},
|
|
453
|
+
removeAll: function() {
|
|
454
|
+
e = {};
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function R(e, t, n) {
|
|
459
|
+
let r = e.json.materials[t];
|
|
460
|
+
return r.extensions && r.extensions[n] ? r.extensions[n] : null;
|
|
461
|
+
}
|
|
462
|
+
var z = {
|
|
463
|
+
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
464
|
+
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
465
|
+
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
466
|
+
KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
|
|
467
|
+
KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
|
|
468
|
+
KHR_MATERIALS_IOR: "KHR_materials_ior",
|
|
469
|
+
KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
|
|
470
|
+
KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
|
|
471
|
+
KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
|
|
472
|
+
KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
|
|
473
|
+
KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
|
|
474
|
+
KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
|
|
475
|
+
KHR_MATERIALS_VOLUME: "KHR_materials_volume",
|
|
476
|
+
KHR_TEXTURE_BASISU: "KHR_texture_basisu",
|
|
477
|
+
KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
|
|
478
|
+
KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
|
|
479
|
+
KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
|
|
480
|
+
EXT_MATERIALS_BUMP: "EXT_materials_bump",
|
|
481
|
+
EXT_TEXTURE_WEBP: "EXT_texture_webp",
|
|
482
|
+
EXT_TEXTURE_AVIF: "EXT_texture_avif",
|
|
483
|
+
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
484
|
+
KHR_MESHOPT_COMPRESSION: "KHR_meshopt_compression",
|
|
485
|
+
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
486
|
+
}, Ye = class {
|
|
487
|
+
constructor(e) {
|
|
488
|
+
this.parser = e, this.name = z.KHR_LIGHTS_PUNCTUAL, this.cache = {
|
|
489
|
+
refs: {},
|
|
490
|
+
uses: {}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
_markDefs() {
|
|
494
|
+
let e = this.parser, t = this.parser.json.nodes || [];
|
|
495
|
+
for (let n = 0, r = t.length; n < r; n++) {
|
|
496
|
+
let r = t[n];
|
|
497
|
+
r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
_loadLight(e) {
|
|
501
|
+
let t = this.parser, n = "light:" + e, r = t.cache.get(n);
|
|
502
|
+
if (r) return r;
|
|
503
|
+
let i = t.json, a = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e], o, s = new l(16777215);
|
|
504
|
+
a.color !== void 0 && s.setRGB(a.color[0], a.color[1], a.color[2], b);
|
|
505
|
+
let c = a.range === void 0 ? 0 : a.range;
|
|
506
|
+
switch (a.type) {
|
|
507
|
+
case "directional":
|
|
508
|
+
o = new d(s), o.target.position.set(0, 0, -1), o.add(o.target);
|
|
509
|
+
break;
|
|
510
|
+
case "point":
|
|
511
|
+
o = new Se(s), o.distance = c;
|
|
512
|
+
break;
|
|
513
|
+
case "spot":
|
|
514
|
+
o = new ke(s), o.distance = c, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle === void 0 ? 0 : a.spot.innerConeAngle, a.spot.outerConeAngle = a.spot.outerConeAngle === void 0 ? Math.PI / 4 : a.spot.outerConeAngle, o.angle = a.spot.outerConeAngle, o.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, o.target.position.set(0, 0, -1), o.add(o.target);
|
|
515
|
+
break;
|
|
516
|
+
default: throw Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
|
|
517
|
+
}
|
|
518
|
+
return o.position.set(0, 0, 0), J(o, a), a.intensity !== void 0 && (o.intensity = a.intensity), o.name = t.createUniqueName(a.name || "light_" + e), r = Promise.resolve(o), t.cache.add(n, r), r;
|
|
519
|
+
}
|
|
520
|
+
getDependency(e, t) {
|
|
521
|
+
if (e === "light") return this._loadLight(t);
|
|
522
|
+
}
|
|
523
|
+
createNodeAttachment(e) {
|
|
524
|
+
let t = this, n = this.parser, r = n.json.nodes[e], i = (r.extensions && r.extensions[this.name] || {}).light;
|
|
525
|
+
return i === void 0 ? null : this._loadLight(i).then(function(e) {
|
|
526
|
+
return n._getNodeRef(t.cache, i, e);
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}, Xe = class {
|
|
530
|
+
constructor() {
|
|
531
|
+
this.name = z.KHR_MATERIALS_UNLIT;
|
|
532
|
+
}
|
|
533
|
+
getMaterialType() {
|
|
534
|
+
return T;
|
|
535
|
+
}
|
|
536
|
+
extendParams(e, t, n) {
|
|
537
|
+
let r = [];
|
|
538
|
+
e.color = new l(1, 1, 1), e.opacity = 1;
|
|
539
|
+
let i = t.pbrMetallicRoughness;
|
|
540
|
+
if (i) {
|
|
541
|
+
if (Array.isArray(i.baseColorFactor)) {
|
|
542
|
+
let t = i.baseColorFactor;
|
|
543
|
+
e.color.setRGB(t[0], t[1], t[2], b), e.opacity = t[3];
|
|
544
|
+
}
|
|
545
|
+
i.baseColorTexture !== void 0 && r.push(n.assignTexture(e, "map", i.baseColorTexture, M));
|
|
546
|
+
}
|
|
547
|
+
return Promise.all(r);
|
|
548
|
+
}
|
|
549
|
+
}, Ze = class {
|
|
550
|
+
constructor(e) {
|
|
551
|
+
this.parser = e, this.name = z.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
552
|
+
}
|
|
553
|
+
extendMaterialParams(e, t) {
|
|
554
|
+
let n = R(this.parser, e, this.name);
|
|
555
|
+
return n === null || n.emissiveStrength !== void 0 && (t.emissiveIntensity = n.emissiveStrength), Promise.resolve();
|
|
556
|
+
}
|
|
557
|
+
}, Qe = class {
|
|
558
|
+
constructor(e) {
|
|
559
|
+
this.parser = e, this.name = z.KHR_MATERIALS_CLEARCOAT;
|
|
560
|
+
}
|
|
561
|
+
getMaterialType(e) {
|
|
562
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
563
|
+
}
|
|
564
|
+
extendMaterialParams(e, t) {
|
|
565
|
+
let n = R(this.parser, e, this.name);
|
|
566
|
+
if (n === null) return Promise.resolve();
|
|
567
|
+
let r = [];
|
|
568
|
+
if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(this.parser.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
|
|
569
|
+
let e = n.clearcoatNormalTexture.scale;
|
|
570
|
+
t.clearcoatNormalScale = new Pe(e, e);
|
|
571
|
+
}
|
|
572
|
+
return Promise.all(r);
|
|
573
|
+
}
|
|
574
|
+
}, $e = class {
|
|
575
|
+
constructor(e) {
|
|
576
|
+
this.parser = e, this.name = z.KHR_MATERIALS_DISPERSION;
|
|
577
|
+
}
|
|
578
|
+
getMaterialType(e) {
|
|
579
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
580
|
+
}
|
|
581
|
+
extendMaterialParams(e, t) {
|
|
582
|
+
let n = R(this.parser, e, this.name);
|
|
583
|
+
return n === null || (t.dispersion = n.dispersion === void 0 ? 0 : n.dispersion), Promise.resolve();
|
|
584
|
+
}
|
|
585
|
+
}, et = class {
|
|
586
|
+
constructor(e) {
|
|
587
|
+
this.parser = e, this.name = z.KHR_MATERIALS_IRIDESCENCE;
|
|
588
|
+
}
|
|
589
|
+
getMaterialType(e) {
|
|
590
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
591
|
+
}
|
|
592
|
+
extendMaterialParams(e, t) {
|
|
593
|
+
let n = R(this.parser, e, this.name);
|
|
594
|
+
if (n === null) return Promise.resolve();
|
|
595
|
+
let r = [];
|
|
596
|
+
return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(this.parser.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
|
|
597
|
+
}
|
|
598
|
+
}, tt = class {
|
|
599
|
+
constructor(e) {
|
|
600
|
+
this.parser = e, this.name = z.KHR_MATERIALS_SHEEN;
|
|
601
|
+
}
|
|
602
|
+
getMaterialType(e) {
|
|
603
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
604
|
+
}
|
|
605
|
+
extendMaterialParams(e, t) {
|
|
606
|
+
let n = R(this.parser, e, this.name);
|
|
607
|
+
if (n === null) return Promise.resolve();
|
|
608
|
+
let r = [];
|
|
609
|
+
if (t.sheenColor = new l(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1, n.sheenColorFactor !== void 0) {
|
|
610
|
+
let e = n.sheenColorFactor;
|
|
611
|
+
t.sheenColor.setRGB(e[0], e[1], e[2], b);
|
|
612
|
+
}
|
|
613
|
+
return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenColorMap", n.sheenColorTexture, M)), n.sheenRoughnessTexture !== void 0 && r.push(this.parser.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
|
|
614
|
+
}
|
|
615
|
+
}, nt = class {
|
|
616
|
+
constructor(e) {
|
|
617
|
+
this.parser = e, this.name = z.KHR_MATERIALS_TRANSMISSION;
|
|
618
|
+
}
|
|
619
|
+
getMaterialType(e) {
|
|
620
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
621
|
+
}
|
|
622
|
+
extendMaterialParams(e, t) {
|
|
623
|
+
let n = R(this.parser, e, this.name);
|
|
624
|
+
if (n === null) return Promise.resolve();
|
|
625
|
+
let r = [];
|
|
626
|
+
return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(this.parser.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
|
|
627
|
+
}
|
|
628
|
+
}, rt = class {
|
|
629
|
+
constructor(e) {
|
|
630
|
+
this.parser = e, this.name = z.KHR_MATERIALS_VOLUME;
|
|
631
|
+
}
|
|
632
|
+
getMaterialType(e) {
|
|
633
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
634
|
+
}
|
|
635
|
+
extendMaterialParams(e, t) {
|
|
636
|
+
let n = R(this.parser, e, this.name);
|
|
637
|
+
if (n === null) return Promise.resolve();
|
|
638
|
+
let r = [];
|
|
639
|
+
t.thickness = n.thicknessFactor === void 0 ? 0 : n.thicknessFactor, n.thicknessTexture !== void 0 && r.push(this.parser.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || Infinity;
|
|
640
|
+
let i = n.attenuationColor || [
|
|
641
|
+
1,
|
|
642
|
+
1,
|
|
643
|
+
1
|
|
644
|
+
];
|
|
645
|
+
return t.attenuationColor = new l().setRGB(i[0], i[1], i[2], b), Promise.all(r);
|
|
646
|
+
}
|
|
647
|
+
}, it = class {
|
|
648
|
+
constructor(e) {
|
|
649
|
+
this.parser = e, this.name = z.KHR_MATERIALS_IOR;
|
|
650
|
+
}
|
|
651
|
+
getMaterialType(e) {
|
|
652
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
653
|
+
}
|
|
654
|
+
extendMaterialParams(e, t) {
|
|
655
|
+
let n = R(this.parser, e, this.name);
|
|
656
|
+
return n === null ? Promise.resolve() : (t.ior = n.ior === void 0 ? 1.5 : n.ior, t.ior === 0 && (t.ior = 1e3), Promise.resolve());
|
|
657
|
+
}
|
|
658
|
+
}, at = class {
|
|
659
|
+
constructor(e) {
|
|
660
|
+
this.parser = e, this.name = z.KHR_MATERIALS_SPECULAR;
|
|
661
|
+
}
|
|
662
|
+
getMaterialType(e) {
|
|
663
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
664
|
+
}
|
|
665
|
+
extendMaterialParams(e, t) {
|
|
666
|
+
let n = R(this.parser, e, this.name);
|
|
667
|
+
if (n === null) return Promise.resolve();
|
|
668
|
+
let r = [];
|
|
669
|
+
t.specularIntensity = n.specularFactor === void 0 ? 1 : n.specularFactor, n.specularTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularIntensityMap", n.specularTexture));
|
|
670
|
+
let i = n.specularColorFactor || [
|
|
671
|
+
1,
|
|
672
|
+
1,
|
|
673
|
+
1
|
|
674
|
+
];
|
|
675
|
+
return t.specularColor = new l().setRGB(i[0], i[1], i[2], b), n.specularColorTexture !== void 0 && r.push(this.parser.assignTexture(t, "specularColorMap", n.specularColorTexture, M)), Promise.all(r);
|
|
676
|
+
}
|
|
677
|
+
}, ot = class {
|
|
678
|
+
constructor(e) {
|
|
679
|
+
this.parser = e, this.name = z.EXT_MATERIALS_BUMP;
|
|
680
|
+
}
|
|
681
|
+
getMaterialType(e) {
|
|
682
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
683
|
+
}
|
|
684
|
+
extendMaterialParams(e, t) {
|
|
685
|
+
let n = R(this.parser, e, this.name);
|
|
686
|
+
if (n === null) return Promise.resolve();
|
|
687
|
+
let r = [];
|
|
688
|
+
return t.bumpScale = n.bumpFactor === void 0 ? 1 : n.bumpFactor, n.bumpTexture !== void 0 && r.push(this.parser.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
|
|
689
|
+
}
|
|
690
|
+
}, st = class {
|
|
691
|
+
constructor(e) {
|
|
692
|
+
this.parser = e, this.name = z.KHR_MATERIALS_ANISOTROPY;
|
|
693
|
+
}
|
|
694
|
+
getMaterialType(e) {
|
|
695
|
+
return R(this.parser, e, this.name) === null ? null : E;
|
|
696
|
+
}
|
|
697
|
+
extendMaterialParams(e, t) {
|
|
698
|
+
let n = R(this.parser, e, this.name);
|
|
699
|
+
if (n === null) return Promise.resolve();
|
|
700
|
+
let r = [];
|
|
701
|
+
return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(this.parser.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
|
|
702
|
+
}
|
|
703
|
+
}, ct = class {
|
|
704
|
+
constructor(e) {
|
|
705
|
+
this.parser = e, this.name = z.KHR_TEXTURE_BASISU;
|
|
706
|
+
}
|
|
707
|
+
loadTexture(e) {
|
|
708
|
+
let t = this.parser, n = t.json, r = n.textures[e];
|
|
709
|
+
if (!r.extensions || !r.extensions[this.name]) return null;
|
|
710
|
+
let i = r.extensions[this.name], a = t.options.ktx2Loader;
|
|
711
|
+
if (!a) {
|
|
712
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
713
|
+
return null;
|
|
714
|
+
}
|
|
715
|
+
return t.loadTextureImage(e, i.source, a);
|
|
716
|
+
}
|
|
717
|
+
}, lt = class {
|
|
718
|
+
constructor(e) {
|
|
719
|
+
this.parser = e, this.name = z.EXT_TEXTURE_WEBP;
|
|
720
|
+
}
|
|
721
|
+
loadTexture(e) {
|
|
722
|
+
let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
|
|
723
|
+
if (!i.extensions || !i.extensions[t]) return null;
|
|
724
|
+
let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
|
|
725
|
+
if (o.uri) {
|
|
726
|
+
let e = n.options.manager.getHandler(o.uri);
|
|
727
|
+
e !== null && (s = e);
|
|
728
|
+
}
|
|
729
|
+
return n.loadTextureImage(e, a.source, s);
|
|
730
|
+
}
|
|
731
|
+
}, ut = class {
|
|
732
|
+
constructor(e) {
|
|
733
|
+
this.parser = e, this.name = z.EXT_TEXTURE_AVIF;
|
|
734
|
+
}
|
|
735
|
+
loadTexture(e) {
|
|
736
|
+
let t = this.name, n = this.parser, r = n.json, i = r.textures[e];
|
|
737
|
+
if (!i.extensions || !i.extensions[t]) return null;
|
|
738
|
+
let a = i.extensions[t], o = r.images[a.source], s = n.textureLoader;
|
|
739
|
+
if (o.uri) {
|
|
740
|
+
let e = n.options.manager.getHandler(o.uri);
|
|
741
|
+
e !== null && (s = e);
|
|
742
|
+
}
|
|
743
|
+
return n.loadTextureImage(e, a.source, s);
|
|
744
|
+
}
|
|
745
|
+
}, dt = class {
|
|
746
|
+
constructor(e, t) {
|
|
747
|
+
this.name = t, this.parser = e;
|
|
748
|
+
}
|
|
749
|
+
loadBufferView(e) {
|
|
750
|
+
let t = this.parser.json, n = t.bufferViews[e];
|
|
751
|
+
if (n.extensions && n.extensions[this.name]) {
|
|
752
|
+
let e = n.extensions[this.name], r = this.parser.getDependency("buffer", e.buffer), i = this.parser.options.meshoptDecoder;
|
|
753
|
+
if (!i || !i.supported) {
|
|
754
|
+
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
return r.then(function(t) {
|
|
758
|
+
let n = e.byteOffset || 0, r = e.byteLength || 0, a = e.count, o = e.byteStride, s = new Uint8Array(t, n, r);
|
|
759
|
+
return i.decodeGltfBufferAsync ? i.decodeGltfBufferAsync(a, o, s, e.mode, e.filter).then(function(e) {
|
|
760
|
+
return e.buffer;
|
|
761
|
+
}) : i.ready.then(function() {
|
|
762
|
+
let t = new ArrayBuffer(a * o);
|
|
763
|
+
return i.decodeGltfBuffer(new Uint8Array(t), a, o, s, e.mode, e.filter), t;
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
} else return null;
|
|
767
|
+
}
|
|
768
|
+
}, ft = class {
|
|
769
|
+
constructor(e) {
|
|
770
|
+
this.name = z.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
771
|
+
}
|
|
772
|
+
createNodeMesh(e) {
|
|
773
|
+
let t = this.parser.json, n = t.nodes[e];
|
|
774
|
+
if (!n.extensions || !n.extensions[this.name] || n.mesh === void 0) return null;
|
|
775
|
+
let r = t.meshes[n.mesh];
|
|
776
|
+
for (let e of r.primitives) if (e.mode !== V.TRIANGLES && e.mode !== V.TRIANGLE_STRIP && e.mode !== V.TRIANGLE_FAN && e.mode !== void 0) return null;
|
|
777
|
+
let i = n.extensions[this.name].attributes, a = [], o = {};
|
|
778
|
+
for (let e in i) a.push(this.parser.getDependency("accessor", i[e]).then((t) => (o[e] = t, o[e])));
|
|
779
|
+
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((e) => {
|
|
780
|
+
let t = e.pop(), n = t.isGroup ? t.children : [t], r = e[0].count, i = [];
|
|
781
|
+
for (let e of n) {
|
|
782
|
+
let t = new C(), n = new N(), a = new we(), s = new N(1, 1, 1), c = new ne(e.geometry, e.material, r);
|
|
783
|
+
for (let e = 0; e < r; e++) o.TRANSLATION && n.fromBufferAttribute(o.TRANSLATION, e), o.ROTATION && a.fromBufferAttribute(o.ROTATION, e), o.SCALE && s.fromBufferAttribute(o.SCALE, e), c.setMatrixAt(e, t.compose(n, a, s));
|
|
784
|
+
for (let t in o) if (t === "_COLOR_0") {
|
|
785
|
+
let e = o[t];
|
|
786
|
+
c.instanceColor = new te(e.array, e.itemSize, e.normalized);
|
|
787
|
+
} else t !== "TRANSLATION" && t !== "ROTATION" && t !== "SCALE" && e.geometry.setAttribute(t, o[t]);
|
|
788
|
+
O.prototype.copy.call(c, e), this.parser.assignFinalMaterial(c), i.push(c);
|
|
789
|
+
}
|
|
790
|
+
return t.isGroup ? (t.clear(), t.add(...i), t) : i[0];
|
|
791
|
+
}));
|
|
792
|
+
}
|
|
793
|
+
}, pt = "glTF", B = 12, mt = {
|
|
794
|
+
JSON: 1313821514,
|
|
795
|
+
BIN: 5130562
|
|
796
|
+
}, ht = class {
|
|
797
|
+
constructor(e) {
|
|
798
|
+
this.name = z.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
799
|
+
let t = new DataView(e, 0, B), n = new TextDecoder();
|
|
800
|
+
if (this.header = {
|
|
801
|
+
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
802
|
+
version: t.getUint32(4, !0),
|
|
803
|
+
length: t.getUint32(8, !0)
|
|
804
|
+
}, this.header.magic !== pt) throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
805
|
+
if (this.header.version < 2) throw Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
806
|
+
let r = this.header.length - B, i = new DataView(e, B), a = 0;
|
|
807
|
+
for (; a < r;) {
|
|
808
|
+
let t = i.getUint32(a, !0);
|
|
809
|
+
a += 4;
|
|
810
|
+
let r = i.getUint32(a, !0);
|
|
811
|
+
if (a += 4, r === mt.JSON) {
|
|
812
|
+
let r = new Uint8Array(e, B + a, t);
|
|
813
|
+
this.content = n.decode(r);
|
|
814
|
+
} else if (r === mt.BIN) {
|
|
815
|
+
let n = B + a;
|
|
816
|
+
this.body = e.slice(n, n + t);
|
|
817
|
+
}
|
|
818
|
+
a += t;
|
|
819
|
+
}
|
|
820
|
+
if (this.content === null) throw Error("THREE.GLTFLoader: JSON content not found.");
|
|
821
|
+
}
|
|
822
|
+
}, gt = class {
|
|
823
|
+
constructor(e, t) {
|
|
824
|
+
if (!t) throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
825
|
+
this.name = z.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
826
|
+
}
|
|
827
|
+
decodePrimitive(e, t) {
|
|
828
|
+
let n = this.json, r = this.dracoLoader, i = e.extensions[this.name].bufferView, a = e.extensions[this.name].attributes, o = {}, s = {}, c = {};
|
|
829
|
+
for (let e in a) {
|
|
830
|
+
let t = W[e] || e.toLowerCase();
|
|
831
|
+
o[t] = a[e];
|
|
832
|
+
}
|
|
833
|
+
for (let t in e.attributes) {
|
|
834
|
+
let r = W[t] || t.toLowerCase();
|
|
835
|
+
if (a[t] !== void 0) {
|
|
836
|
+
let i = n.accessors[e.attributes[t]];
|
|
837
|
+
c[r] = H[i.componentType].name, s[r] = i.normalized === !0;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return t.getDependency("bufferView", i).then(function(e) {
|
|
841
|
+
return new Promise(function(t, n) {
|
|
842
|
+
r.decodeDracoFile(e, function(e) {
|
|
843
|
+
for (let t in e.attributes) {
|
|
844
|
+
let n = e.attributes[t], r = s[t];
|
|
845
|
+
r !== void 0 && (n.normalized = r);
|
|
846
|
+
}
|
|
847
|
+
t(e);
|
|
848
|
+
}, o, c, b, n);
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}, _t = class {
|
|
853
|
+
constructor() {
|
|
854
|
+
this.name = z.KHR_TEXTURE_TRANSFORM;
|
|
855
|
+
}
|
|
856
|
+
extendTexture(e, t) {
|
|
857
|
+
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 ? e : (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0, e);
|
|
858
|
+
}
|
|
859
|
+
}, vt = class {
|
|
860
|
+
constructor() {
|
|
861
|
+
this.name = z.KHR_MESH_QUANTIZATION;
|
|
862
|
+
}
|
|
863
|
+
}, yt = class extends ae {
|
|
864
|
+
constructor(e, t, n, r) {
|
|
865
|
+
super(e, t, n, r);
|
|
866
|
+
}
|
|
867
|
+
copySampleValue_(e) {
|
|
868
|
+
let t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r * 3 + r;
|
|
869
|
+
for (let e = 0; e !== r; e++) t[e] = n[i + e];
|
|
870
|
+
return t;
|
|
871
|
+
}
|
|
872
|
+
interpolate_(e, t, n, r) {
|
|
873
|
+
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = o * 2, c = o * 3, l = r - t, u = (n - t) / l, d = u * u, f = d * u, p = e * c, m = p - c, h = -2 * f + 3 * d, g = f - d, ee = 1 - h, te = g - d + u;
|
|
874
|
+
for (let e = 0; e !== o; e++) {
|
|
875
|
+
let t = a[m + e + o], n = a[m + e + s] * l, r = a[p + e + o], c = a[p + e] * l;
|
|
876
|
+
i[e] = ee * t + te * n + h * r + g * c;
|
|
877
|
+
}
|
|
878
|
+
return i;
|
|
879
|
+
}
|
|
880
|
+
}, bt = new we(), xt = class extends yt {
|
|
881
|
+
interpolate_(e, t, n, r) {
|
|
882
|
+
let i = super.interpolate_(e, t, n, r);
|
|
883
|
+
return bt.fromArray(i).normalize().toArray(i), i;
|
|
884
|
+
}
|
|
885
|
+
}, V = {
|
|
886
|
+
FLOAT: 5126,
|
|
887
|
+
FLOAT_MAT3: 35675,
|
|
888
|
+
FLOAT_MAT4: 35676,
|
|
889
|
+
FLOAT_VEC2: 35664,
|
|
890
|
+
FLOAT_VEC3: 35665,
|
|
891
|
+
FLOAT_VEC4: 35666,
|
|
892
|
+
LINEAR: 9729,
|
|
893
|
+
REPEAT: 10497,
|
|
894
|
+
SAMPLER_2D: 35678,
|
|
895
|
+
POINTS: 0,
|
|
896
|
+
LINES: 1,
|
|
897
|
+
LINE_LOOP: 2,
|
|
898
|
+
LINE_STRIP: 3,
|
|
899
|
+
TRIANGLES: 4,
|
|
900
|
+
TRIANGLE_STRIP: 5,
|
|
901
|
+
TRIANGLE_FAN: 6,
|
|
902
|
+
UNSIGNED_BYTE: 5121,
|
|
903
|
+
UNSIGNED_SHORT: 5123
|
|
904
|
+
}, H = {
|
|
905
|
+
5120: Int8Array,
|
|
906
|
+
5121: Uint8Array,
|
|
907
|
+
5122: Int16Array,
|
|
908
|
+
5123: Uint16Array,
|
|
909
|
+
5125: Uint32Array,
|
|
910
|
+
5126: Float32Array
|
|
911
|
+
}, St = {
|
|
912
|
+
9728: ge,
|
|
913
|
+
9729: y,
|
|
914
|
+
9984: ve,
|
|
915
|
+
9985: de,
|
|
916
|
+
9986: _e,
|
|
917
|
+
9987: ue
|
|
918
|
+
}, Ct = {
|
|
919
|
+
33071: c,
|
|
920
|
+
33648: he,
|
|
921
|
+
10497: j
|
|
922
|
+
}, U = {
|
|
923
|
+
SCALAR: 1,
|
|
924
|
+
VEC2: 2,
|
|
925
|
+
VEC3: 3,
|
|
926
|
+
VEC4: 4,
|
|
927
|
+
MAT2: 4,
|
|
928
|
+
MAT3: 9,
|
|
929
|
+
MAT4: 16
|
|
930
|
+
}, W = {
|
|
931
|
+
POSITION: "position",
|
|
932
|
+
NORMAL: "normal",
|
|
933
|
+
TANGENT: "tangent",
|
|
934
|
+
TEXCOORD_0: "uv",
|
|
935
|
+
TEXCOORD_1: "uv1",
|
|
936
|
+
TEXCOORD_2: "uv2",
|
|
937
|
+
TEXCOORD_3: "uv3",
|
|
938
|
+
COLOR_0: "color",
|
|
939
|
+
WEIGHTS_0: "skinWeight",
|
|
940
|
+
JOINTS_0: "skinIndex"
|
|
941
|
+
}, G = {
|
|
942
|
+
scale: "scale",
|
|
943
|
+
translation: "position",
|
|
944
|
+
rotation: "quaternion",
|
|
945
|
+
weights: "morphTargetInfluences"
|
|
946
|
+
}, wt = {
|
|
947
|
+
CUBICSPLINE: void 0,
|
|
948
|
+
LINEAR: se,
|
|
949
|
+
STEP: oe
|
|
950
|
+
}, K = {
|
|
951
|
+
OPAQUE: "OPAQUE",
|
|
952
|
+
MASK: "MASK",
|
|
953
|
+
BLEND: "BLEND"
|
|
954
|
+
};
|
|
955
|
+
function Tt(e) {
|
|
956
|
+
return e.DefaultMaterial === void 0 && (e.DefaultMaterial = new D({
|
|
957
|
+
color: 16777215,
|
|
958
|
+
emissive: 0,
|
|
959
|
+
metalness: 1,
|
|
960
|
+
roughness: 1,
|
|
961
|
+
transparent: !1,
|
|
962
|
+
depthTest: !0,
|
|
963
|
+
side: h
|
|
964
|
+
})), e.DefaultMaterial;
|
|
965
|
+
}
|
|
966
|
+
function q(e, t, n) {
|
|
967
|
+
for (let r in n.extensions) e[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = n.extensions[r]);
|
|
968
|
+
}
|
|
969
|
+
function J(e, t) {
|
|
970
|
+
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
|
|
971
|
+
}
|
|
972
|
+
function Et(e, t, n) {
|
|
973
|
+
let r = !1, i = !1, a = !1;
|
|
974
|
+
for (let e = 0, n = t.length; e < n; e++) {
|
|
975
|
+
let n = t[e];
|
|
976
|
+
if (n.POSITION !== void 0 && (r = !0), n.NORMAL !== void 0 && (i = !0), n.COLOR_0 !== void 0 && (a = !0), r && i && a) break;
|
|
977
|
+
}
|
|
978
|
+
if (!r && !i && !a) return Promise.resolve(e);
|
|
979
|
+
let o = [], s = [], c = [];
|
|
980
|
+
for (let l = 0, u = t.length; l < u; l++) {
|
|
981
|
+
let u = t[l];
|
|
982
|
+
if (r) {
|
|
983
|
+
let t = u.POSITION === void 0 ? e.attributes.position : n.getDependency("accessor", u.POSITION);
|
|
984
|
+
o.push(t);
|
|
985
|
+
}
|
|
986
|
+
if (i) {
|
|
987
|
+
let t = u.NORMAL === void 0 ? e.attributes.normal : n.getDependency("accessor", u.NORMAL);
|
|
988
|
+
s.push(t);
|
|
989
|
+
}
|
|
990
|
+
if (a) {
|
|
991
|
+
let t = u.COLOR_0 === void 0 ? e.attributes.color : n.getDependency("accessor", u.COLOR_0);
|
|
992
|
+
c.push(t);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return Promise.all([
|
|
996
|
+
Promise.all(o),
|
|
997
|
+
Promise.all(s),
|
|
998
|
+
Promise.all(c)
|
|
999
|
+
]).then(function(t) {
|
|
1000
|
+
let n = t[0], o = t[1], s = t[2];
|
|
1001
|
+
return r && (e.morphAttributes.position = n), i && (e.morphAttributes.normal = o), a && (e.morphAttributes.color = s), e.morphTargetsRelative = !0, e;
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
function Dt(e, t) {
|
|
1005
|
+
if (e.updateMorphTargets(), t.weights !== void 0) for (let n = 0, r = t.weights.length; n < r; n++) e.morphTargetInfluences[n] = t.weights[n];
|
|
1006
|
+
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
1007
|
+
let n = t.extras.targetNames;
|
|
1008
|
+
if (e.morphTargetInfluences.length === n.length) {
|
|
1009
|
+
e.morphTargetDictionary = {};
|
|
1010
|
+
for (let t = 0, r = n.length; t < r; t++) e.morphTargetDictionary[n[t]] = t;
|
|
1011
|
+
} else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function Ot(e) {
|
|
1015
|
+
let t, n = e.extensions && e.extensions[z.KHR_DRACO_MESH_COMPRESSION];
|
|
1016
|
+
if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + Y(n.attributes) : e.indices + ":" + Y(e.attributes) + ":" + e.mode, e.targets !== void 0) for (let n = 0, r = e.targets.length; n < r; n++) t += ":" + Y(e.targets[n]);
|
|
1017
|
+
return t;
|
|
1018
|
+
}
|
|
1019
|
+
function Y(e) {
|
|
1020
|
+
let t = "", n = Object.keys(e).sort();
|
|
1021
|
+
for (let r = 0, i = n.length; r < i; r++) t += n[r] + ":" + e[n[r]] + ";";
|
|
1022
|
+
return t;
|
|
1023
|
+
}
|
|
1024
|
+
function X(e) {
|
|
1025
|
+
switch (e) {
|
|
1026
|
+
case Int8Array: return 1 / 127;
|
|
1027
|
+
case Uint8Array: return 1 / 255;
|
|
1028
|
+
case Int16Array: return 1 / 32767;
|
|
1029
|
+
case Uint16Array: return 1 / 65535;
|
|
1030
|
+
default: throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function kt(e) {
|
|
1034
|
+
return e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : e.search(/\.webp($|\?)/i) > 0 || e.search(/^data\:image\/webp/) === 0 ? "image/webp" : e.search(/\.ktx2($|\?)/i) > 0 || e.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1035
|
+
}
|
|
1036
|
+
var At = new C(), jt = class {
|
|
1037
|
+
constructor(e = {}, t = {}) {
|
|
1038
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Je(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
|
|
1039
|
+
refs: {},
|
|
1040
|
+
uses: {}
|
|
1041
|
+
}, this.cameraCache = {
|
|
1042
|
+
refs: {},
|
|
1043
|
+
uses: {}
|
|
1044
|
+
}, this.lightCache = {
|
|
1045
|
+
refs: {},
|
|
1046
|
+
uses: {}
|
|
1047
|
+
}, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
1048
|
+
let n = !1, r = -1, i = !1, a = -1;
|
|
1049
|
+
if (typeof navigator < "u" && navigator.userAgent !== void 0) {
|
|
1050
|
+
let e = navigator.userAgent;
|
|
1051
|
+
n = /^((?!chrome|android).)*safari/i.test(e) === !0;
|
|
1052
|
+
let t = e.match(/Version\/(\d+)/);
|
|
1053
|
+
r = n && t ? parseInt(t[1], 10) : -1, i = e.indexOf("Firefox") > -1, a = i ? e.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1054
|
+
}
|
|
1055
|
+
typeof createImageBitmap > "u" || n && r < 17 || i && a < 98 ? this.textureLoader = new je(this.options.manager) : this.textureLoader = new ee(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new p(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1056
|
+
}
|
|
1057
|
+
setExtensions(e) {
|
|
1058
|
+
this.extensions = e;
|
|
1059
|
+
}
|
|
1060
|
+
setPlugins(e) {
|
|
1061
|
+
this.plugins = e;
|
|
1062
|
+
}
|
|
1063
|
+
parse(e, t) {
|
|
1064
|
+
let n = this, r = this.json, i = this.extensions;
|
|
1065
|
+
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(e) {
|
|
1066
|
+
return e._markDefs && e._markDefs();
|
|
1067
|
+
}), Promise.all(this._invokeAll(function(e) {
|
|
1068
|
+
return e.beforeRoot && e.beforeRoot();
|
|
1069
|
+
})).then(function() {
|
|
1070
|
+
return Promise.all([
|
|
1071
|
+
n.getDependencies("scene"),
|
|
1072
|
+
n.getDependencies("animation"),
|
|
1073
|
+
n.getDependencies("camera")
|
|
1074
|
+
]);
|
|
1075
|
+
}).then(function(t) {
|
|
1076
|
+
let a = {
|
|
1077
|
+
scene: t[0][r.scene || 0],
|
|
1078
|
+
scenes: t[0],
|
|
1079
|
+
animations: t[1],
|
|
1080
|
+
cameras: t[2],
|
|
1081
|
+
asset: r.asset,
|
|
1082
|
+
parser: n,
|
|
1083
|
+
userData: {}
|
|
1084
|
+
};
|
|
1085
|
+
return q(i, a, r), J(a, r), Promise.all(n._invokeAll(function(e) {
|
|
1086
|
+
return e.afterRoot && e.afterRoot(a);
|
|
1087
|
+
})).then(function() {
|
|
1088
|
+
for (let e of a.scenes) e.updateMatrixWorld();
|
|
1089
|
+
e(a);
|
|
1090
|
+
});
|
|
1091
|
+
}).catch(t);
|
|
1092
|
+
}
|
|
1093
|
+
_markDefs() {
|
|
1094
|
+
let e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
|
|
1095
|
+
for (let n = 0, r = t.length; n < r; n++) {
|
|
1096
|
+
let r = t[n].joints;
|
|
1097
|
+
for (let t = 0, n = r.length; t < n; t++) e[r[t]].isBone = !0;
|
|
1098
|
+
}
|
|
1099
|
+
for (let t = 0, r = e.length; t < r; t++) {
|
|
1100
|
+
let r = e[t];
|
|
1101
|
+
r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (n[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
_addNodeRef(e, t) {
|
|
1105
|
+
t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
|
|
1106
|
+
}
|
|
1107
|
+
_getNodeRef(e, t, n) {
|
|
1108
|
+
if (e.refs[t] <= 1) return n;
|
|
1109
|
+
let r = n.clone(), i = (e, t) => {
|
|
1110
|
+
let n = this.associations.get(e);
|
|
1111
|
+
n != null && this.associations.set(t, n);
|
|
1112
|
+
for (let [n, r] of e.children.entries()) i(r, t.children[n]);
|
|
1113
|
+
};
|
|
1114
|
+
return i(n, r), r.name += "_instance_" + e.uses[t]++, r;
|
|
1115
|
+
}
|
|
1116
|
+
_invokeOne(e) {
|
|
1117
|
+
let t = Object.values(this.plugins);
|
|
1118
|
+
t.push(this);
|
|
1119
|
+
for (let n = 0; n < t.length; n++) {
|
|
1120
|
+
let r = e(t[n]);
|
|
1121
|
+
if (r) return r;
|
|
1122
|
+
}
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
_invokeAll(e) {
|
|
1126
|
+
let t = Object.values(this.plugins);
|
|
1127
|
+
t.unshift(this);
|
|
1128
|
+
let n = [];
|
|
1129
|
+
for (let r = 0; r < t.length; r++) {
|
|
1130
|
+
let i = e(t[r]);
|
|
1131
|
+
i && n.push(i);
|
|
1132
|
+
}
|
|
1133
|
+
return n;
|
|
1134
|
+
}
|
|
1135
|
+
getDependency(e, t) {
|
|
1136
|
+
let n = e + ":" + t, r = this.cache.get(n);
|
|
1137
|
+
if (!r) {
|
|
1138
|
+
switch (e) {
|
|
1139
|
+
case "scene":
|
|
1140
|
+
r = this.loadScene(t);
|
|
1141
|
+
break;
|
|
1142
|
+
case "node":
|
|
1143
|
+
r = this._invokeOne(function(e) {
|
|
1144
|
+
return e.loadNode && e.loadNode(t);
|
|
1145
|
+
});
|
|
1146
|
+
break;
|
|
1147
|
+
case "mesh":
|
|
1148
|
+
r = this._invokeOne(function(e) {
|
|
1149
|
+
return e.loadMesh && e.loadMesh(t);
|
|
1150
|
+
});
|
|
1151
|
+
break;
|
|
1152
|
+
case "accessor":
|
|
1153
|
+
r = this.loadAccessor(t);
|
|
1154
|
+
break;
|
|
1155
|
+
case "bufferView":
|
|
1156
|
+
r = this._invokeOne(function(e) {
|
|
1157
|
+
return e.loadBufferView && e.loadBufferView(t);
|
|
1158
|
+
});
|
|
1159
|
+
break;
|
|
1160
|
+
case "buffer":
|
|
1161
|
+
r = this.loadBuffer(t);
|
|
1162
|
+
break;
|
|
1163
|
+
case "material":
|
|
1164
|
+
r = this._invokeOne(function(e) {
|
|
1165
|
+
return e.loadMaterial && e.loadMaterial(t);
|
|
1166
|
+
});
|
|
1167
|
+
break;
|
|
1168
|
+
case "texture":
|
|
1169
|
+
r = this._invokeOne(function(e) {
|
|
1170
|
+
return e.loadTexture && e.loadTexture(t);
|
|
1171
|
+
});
|
|
1172
|
+
break;
|
|
1173
|
+
case "skin":
|
|
1174
|
+
r = this.loadSkin(t);
|
|
1175
|
+
break;
|
|
1176
|
+
case "animation":
|
|
1177
|
+
r = this._invokeOne(function(e) {
|
|
1178
|
+
return e.loadAnimation && e.loadAnimation(t);
|
|
1179
|
+
});
|
|
1180
|
+
break;
|
|
1181
|
+
case "camera":
|
|
1182
|
+
r = this.loadCamera(t);
|
|
1183
|
+
break;
|
|
1184
|
+
default:
|
|
1185
|
+
if (r = this._invokeOne(function(n) {
|
|
1186
|
+
return n != this && n.getDependency && n.getDependency(e, t);
|
|
1187
|
+
}), !r) throw Error("Unknown type: " + e);
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
this.cache.add(n, r);
|
|
1191
|
+
}
|
|
1192
|
+
return r;
|
|
1193
|
+
}
|
|
1194
|
+
getDependencies(e) {
|
|
1195
|
+
let t = this.cache.get(e);
|
|
1196
|
+
if (!t) {
|
|
1197
|
+
let n = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1198
|
+
t = Promise.all(r.map(function(t, r) {
|
|
1199
|
+
return n.getDependency(e, r);
|
|
1200
|
+
})), this.cache.add(e, t);
|
|
1201
|
+
}
|
|
1202
|
+
return t;
|
|
1203
|
+
}
|
|
1204
|
+
loadBuffer(e) {
|
|
1205
|
+
let t = this.json.buffers[e], n = this.fileLoader;
|
|
1206
|
+
if (t.type && t.type !== "arraybuffer") throw Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1207
|
+
if (t.uri === void 0 && e === 0) return Promise.resolve(this.extensions[z.KHR_BINARY_GLTF].body);
|
|
1208
|
+
let r = this.options;
|
|
1209
|
+
return new Promise(function(e, i) {
|
|
1210
|
+
n.load(x.resolveURL(t.uri, r.path), e, void 0, function() {
|
|
1211
|
+
i(/* @__PURE__ */ Error("THREE.GLTFLoader: Failed to load buffer \"" + t.uri + "\"."));
|
|
1212
|
+
});
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
loadBufferView(e) {
|
|
1216
|
+
let t = this.json.bufferViews[e];
|
|
1217
|
+
return this.getDependency("buffer", t.buffer).then(function(e) {
|
|
1218
|
+
let n = t.byteLength || 0, r = t.byteOffset || 0;
|
|
1219
|
+
return e.slice(r, r + n);
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
loadAccessor(e) {
|
|
1223
|
+
let t = this, n = this.json, r = this.json.accessors[e];
|
|
1224
|
+
if (r.bufferView === void 0 && r.sparse === void 0) {
|
|
1225
|
+
let e = U[r.type], t = H[r.componentType], n = r.normalized === !0, i = new t(r.count * e);
|
|
1226
|
+
return Promise.resolve(new o(i, e, n));
|
|
1227
|
+
}
|
|
1228
|
+
let i = [];
|
|
1229
|
+
return r.bufferView === void 0 ? i.push(null) : i.push(this.getDependency("bufferView", r.bufferView)), r.sparse !== void 0 && (i.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(i).then(function(e) {
|
|
1230
|
+
let i = e[0], a = U[r.type], s = H[r.componentType], c = s.BYTES_PER_ELEMENT, l = c * a, u = r.byteOffset || 0, d = r.bufferView === void 0 ? void 0 : n.bufferViews[r.bufferView].byteStride, f = r.normalized === !0, p, m;
|
|
1231
|
+
if (d && d !== l) {
|
|
1232
|
+
let e = Math.floor(u / d), n = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + e + ":" + r.count, o = t.cache.get(n);
|
|
1233
|
+
o || (p = new s(i, e * d, r.count * d / c), o = new re(p, d / c), t.cache.add(n, o)), m = new ie(o, a, u % d / c, f);
|
|
1234
|
+
} else p = i === null ? new s(r.count * a) : new s(i, u, r.count * a), m = new o(p, a, f);
|
|
1235
|
+
if (r.sparse !== void 0) {
|
|
1236
|
+
let t = U.SCALAR, n = H[r.sparse.indices.componentType], c = r.sparse.indices.byteOffset || 0, l = r.sparse.values.byteOffset || 0, u = new n(e[1], c, r.sparse.count * t), d = new s(e[2], l, r.sparse.count * a);
|
|
1237
|
+
i !== null && (m = new o(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
1238
|
+
for (let e = 0, t = u.length; e < t; e++) {
|
|
1239
|
+
let t = u[e];
|
|
1240
|
+
if (m.setX(t, d[e * a]), a >= 2 && m.setY(t, d[e * a + 1]), a >= 3 && m.setZ(t, d[e * a + 2]), a >= 4 && m.setW(t, d[e * a + 3]), a >= 5) throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1241
|
+
}
|
|
1242
|
+
m.normalized = f;
|
|
1243
|
+
}
|
|
1244
|
+
return m;
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
loadTexture(e) {
|
|
1248
|
+
let t = this.json, n = this.options, r = t.textures[e].source, i = t.images[r], a = this.textureLoader;
|
|
1249
|
+
if (i.uri) {
|
|
1250
|
+
let e = n.manager.getHandler(i.uri);
|
|
1251
|
+
e !== null && (a = e);
|
|
1252
|
+
}
|
|
1253
|
+
return this.loadTextureImage(e, r, a);
|
|
1254
|
+
}
|
|
1255
|
+
loadTextureImage(e, t, n) {
|
|
1256
|
+
let r = this, i = this.json, a = i.textures[e], o = i.images[t], s = (o.uri || o.bufferView) + ":" + a.sampler;
|
|
1257
|
+
if (this.textureCache[s]) return this.textureCache[s];
|
|
1258
|
+
let c = this.loadImageSource(t, n).then(function(t) {
|
|
1259
|
+
t.flipY = !1, t.name = a.name || o.name || "", t.name === "" && typeof o.uri == "string" && o.uri.startsWith("data:image/") === !1 && (t.name = o.uri);
|
|
1260
|
+
let n = (i.samplers || {})[a.sampler] || {};
|
|
1261
|
+
return t.magFilter = St[n.magFilter] || y, t.minFilter = St[n.minFilter] || ue, t.wrapS = Ct[n.wrapS] || j, t.wrapT = Ct[n.wrapT] || j, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== ge && t.minFilter !== y, r.associations.set(t, { textures: e }), t;
|
|
1262
|
+
}).catch(function() {
|
|
1263
|
+
return null;
|
|
1264
|
+
});
|
|
1265
|
+
return this.textureCache[s] = c, c;
|
|
1266
|
+
}
|
|
1267
|
+
loadImageSource(e, t) {
|
|
1268
|
+
let n = this, r = this.json, i = this.options;
|
|
1269
|
+
if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
|
|
1270
|
+
let a = r.images[e], o = self.URL || self.webkitURL, s = a.uri || "", c = !1;
|
|
1271
|
+
if (a.bufferView !== void 0) s = n.getDependency("bufferView", a.bufferView).then(function(e) {
|
|
1272
|
+
c = !0;
|
|
1273
|
+
let t = new Blob([e], { type: a.mimeType });
|
|
1274
|
+
return s = o.createObjectURL(t), s;
|
|
1275
|
+
});
|
|
1276
|
+
else if (a.uri === void 0) throw Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1277
|
+
let l = Promise.resolve(s).then(function(e) {
|
|
1278
|
+
return new Promise(function(n, r) {
|
|
1279
|
+
let a = n;
|
|
1280
|
+
t.isImageBitmapLoader === !0 && (a = function(e) {
|
|
1281
|
+
let t = new Ae(e);
|
|
1282
|
+
t.needsUpdate = !0, n(t);
|
|
1283
|
+
}), t.load(x.resolveURL(e, i.path), a, void 0, r);
|
|
1284
|
+
});
|
|
1285
|
+
}).then(function(e) {
|
|
1286
|
+
return c === !0 && o.revokeObjectURL(s), J(e, a), e.userData.mimeType = a.mimeType || kt(a.uri), e;
|
|
1287
|
+
}).catch(function(e) {
|
|
1288
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", s), e;
|
|
1289
|
+
});
|
|
1290
|
+
return this.sourceCache[e] = l, l;
|
|
1291
|
+
}
|
|
1292
|
+
assignTexture(e, t, n, r) {
|
|
1293
|
+
let i = this;
|
|
1294
|
+
return this.getDependency("texture", n.index).then(function(a) {
|
|
1295
|
+
if (!a) return null;
|
|
1296
|
+
if (n.texCoord !== void 0 && n.texCoord > 0 && (a = a.clone(), a.channel = n.texCoord), i.extensions[z.KHR_TEXTURE_TRANSFORM]) {
|
|
1297
|
+
let e = n.extensions === void 0 ? void 0 : n.extensions[z.KHR_TEXTURE_TRANSFORM];
|
|
1298
|
+
if (e) {
|
|
1299
|
+
let t = i.associations.get(a);
|
|
1300
|
+
a = i.extensions[z.KHR_TEXTURE_TRANSFORM].extendTexture(a, e), i.associations.set(a, t);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
return r !== void 0 && (a.colorSpace = r), e[t] = a, a;
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
assignFinalMaterial(e) {
|
|
1307
|
+
let t = e.geometry, n = e.material, r = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, a = t.attributes.normal === void 0;
|
|
1308
|
+
if (e.isPoints) {
|
|
1309
|
+
let e = "PointsMaterial:" + n.uuid, t = this.cache.get(e);
|
|
1310
|
+
t || (t = new A(), S.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, t.sizeAttenuation = !1, this.cache.add(e, t)), n = t;
|
|
1311
|
+
} else if (e.isLine) {
|
|
1312
|
+
let e = "LineBasicMaterial:" + n.uuid, t = this.cache.get(e);
|
|
1313
|
+
t || (t = new _(), S.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, this.cache.add(e, t)), n = t;
|
|
1314
|
+
}
|
|
1315
|
+
if (r || i || a) {
|
|
1316
|
+
let e = "ClonedMaterial:" + n.uuid + ":";
|
|
1317
|
+
r && (e += "derivative-tangents:"), i && (e += "vertex-colors:"), a && (e += "flat-shading:");
|
|
1318
|
+
let t = this.cache.get(e);
|
|
1319
|
+
t || (t = n.clone(), i && (t.vertexColors = !0), a && (t.flatShading = !0), r && (t.normalScale && (t.normalScale.y *= -1), t.clearcoatNormalScale && (t.clearcoatNormalScale.y *= -1)), this.cache.add(e, t), this.associations.set(t, this.associations.get(n))), n = t;
|
|
1320
|
+
}
|
|
1321
|
+
e.material = n;
|
|
1322
|
+
}
|
|
1323
|
+
getMaterialType() {
|
|
1324
|
+
return D;
|
|
1325
|
+
}
|
|
1326
|
+
loadMaterial(e) {
|
|
1327
|
+
let t = this, n = this.json, r = this.extensions, i = n.materials[e], a, o = {}, s = i.extensions || {}, c = [];
|
|
1328
|
+
if (s[z.KHR_MATERIALS_UNLIT]) {
|
|
1329
|
+
let e = r[z.KHR_MATERIALS_UNLIT];
|
|
1330
|
+
a = e.getMaterialType(), c.push(e.extendParams(o, i, t));
|
|
1331
|
+
} else {
|
|
1332
|
+
let n = i.pbrMetallicRoughness || {};
|
|
1333
|
+
if (o.color = new l(1, 1, 1), o.opacity = 1, Array.isArray(n.baseColorFactor)) {
|
|
1334
|
+
let e = n.baseColorFactor;
|
|
1335
|
+
o.color.setRGB(e[0], e[1], e[2], b), o.opacity = e[3];
|
|
1336
|
+
}
|
|
1337
|
+
n.baseColorTexture !== void 0 && c.push(t.assignTexture(o, "map", n.baseColorTexture, M)), o.metalness = n.metallicFactor === void 0 ? 1 : n.metallicFactor, o.roughness = n.roughnessFactor === void 0 ? 1 : n.roughnessFactor, n.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(o, "metalnessMap", n.metallicRoughnessTexture)), c.push(t.assignTexture(o, "roughnessMap", n.metallicRoughnessTexture))), a = this._invokeOne(function(t) {
|
|
1338
|
+
return t.getMaterialType && t.getMaterialType(e);
|
|
1339
|
+
}), c.push(Promise.all(this._invokeAll(function(t) {
|
|
1340
|
+
return t.extendMaterialParams && t.extendMaterialParams(e, o);
|
|
1341
|
+
})));
|
|
1342
|
+
}
|
|
1343
|
+
i.doubleSided === !0 && (o.side = f);
|
|
1344
|
+
let u = i.alphaMode || K.OPAQUE;
|
|
1345
|
+
if (u === K.BLEND ? (o.transparent = !0, o.depthWrite = !1) : (o.transparent = !1, u === K.MASK && (o.alphaTest = i.alphaCutoff === void 0 ? .5 : i.alphaCutoff)), i.normalTexture !== void 0 && a !== T && (c.push(t.assignTexture(o, "normalMap", i.normalTexture)), o.normalScale = new Pe(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1346
|
+
let e = i.normalTexture.scale;
|
|
1347
|
+
o.normalScale.set(e, e);
|
|
1348
|
+
}
|
|
1349
|
+
if (i.occlusionTexture !== void 0 && a !== T && (c.push(t.assignTexture(o, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (o.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && a !== T) {
|
|
1350
|
+
let e = i.emissiveFactor;
|
|
1351
|
+
o.emissive = new l().setRGB(e[0], e[1], e[2], b);
|
|
1352
|
+
}
|
|
1353
|
+
return i.emissiveTexture !== void 0 && a !== T && c.push(t.assignTexture(o, "emissiveMap", i.emissiveTexture, M)), Promise.all(c).then(function() {
|
|
1354
|
+
let n = new a(o);
|
|
1355
|
+
return i.name && (n.name = i.name), J(n, i), t.associations.set(n, { materials: e }), i.extensions && q(r, n, i), n;
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
createUniqueName(e) {
|
|
1359
|
+
let t = Ce.sanitizeNodeName(e || "");
|
|
1360
|
+
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1361
|
+
}
|
|
1362
|
+
loadGeometries(e) {
|
|
1363
|
+
let t = this, n = this.extensions, r = this.primitiveCache;
|
|
1364
|
+
function i(e) {
|
|
1365
|
+
return n[z.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then(function(n) {
|
|
1366
|
+
return Nt(n, e, t);
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
let a = [];
|
|
1370
|
+
for (let n = 0, o = e.length; n < o; n++) {
|
|
1371
|
+
let o = e[n], c = Ot(o), l = r[c];
|
|
1372
|
+
if (l) a.push(l.promise);
|
|
1373
|
+
else {
|
|
1374
|
+
let e;
|
|
1375
|
+
e = o.extensions && o.extensions[z.KHR_DRACO_MESH_COMPRESSION] ? i(o) : Nt(new s(), o, t), r[c] = {
|
|
1376
|
+
primitive: o,
|
|
1377
|
+
promise: e
|
|
1378
|
+
}, a.push(e);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
return Promise.all(a);
|
|
1382
|
+
}
|
|
1383
|
+
loadMesh(t) {
|
|
1384
|
+
let n = this, r = this.json, i = this.extensions, a = r.meshes[t], o = a.primitives, s = [];
|
|
1385
|
+
for (let e = 0, t = o.length; e < t; e++) {
|
|
1386
|
+
let t = o[e].material === void 0 ? Tt(this.cache) : this.getDependency("material", o[e].material);
|
|
1387
|
+
s.push(t);
|
|
1388
|
+
}
|
|
1389
|
+
return s.push(n.loadGeometries(o)), Promise.all(s).then(function(r) {
|
|
1390
|
+
let s = r.slice(0, r.length - 1), c = r[r.length - 1], l = [];
|
|
1391
|
+
for (let r = 0, u = c.length; r < u; r++) {
|
|
1392
|
+
let u = c[r], d = o[r], f, p = s[r];
|
|
1393
|
+
if (d.mode === V.TRIANGLES || d.mode === V.TRIANGLE_STRIP || d.mode === V.TRIANGLE_FAN || d.mode === void 0) f = a.isSkinnedMesh === !0 ? new De(u, p) : new w(u, p), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), d.mode === V.TRIANGLE_STRIP ? f.geometry = e(f.geometry, Ne) : d.mode === V.TRIANGLE_FAN && (f.geometry = e(f.geometry, Me));
|
|
1394
|
+
else if (d.mode === V.LINES) f = new v(u, p);
|
|
1395
|
+
else if (d.mode === V.LINE_STRIP) f = new ce(u, p);
|
|
1396
|
+
else if (d.mode === V.LINE_LOOP) f = new le(u, p);
|
|
1397
|
+
else if (d.mode === V.POINTS) f = new k(u, p);
|
|
1398
|
+
else throw Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
|
|
1399
|
+
Object.keys(f.geometry.morphAttributes).length > 0 && Dt(f, a), f.name = n.createUniqueName(a.name || "mesh_" + t), J(f, a), d.extensions && q(i, f, d), n.assignFinalMaterial(f), l.push(f);
|
|
1400
|
+
}
|
|
1401
|
+
for (let e = 0, r = l.length; e < r; e++) n.associations.set(l[e], {
|
|
1402
|
+
meshes: t,
|
|
1403
|
+
primitives: e
|
|
1404
|
+
});
|
|
1405
|
+
if (l.length === 1) return a.extensions && q(i, l[0], a), l[0];
|
|
1406
|
+
let u = new g();
|
|
1407
|
+
a.extensions && q(i, u, a), n.associations.set(u, { meshes: t });
|
|
1408
|
+
for (let e = 0, t = l.length; e < t; e++) u.add(l[e]);
|
|
1409
|
+
return u;
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
loadCamera(e) {
|
|
1413
|
+
let t, n = this.json.cameras[e], r = n[n.type];
|
|
1414
|
+
if (!r) {
|
|
1415
|
+
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
return n.type === "perspective" ? t = new xe(pe.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : n.type === "orthographic" && (t = new be(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), n.name && (t.name = this.createUniqueName(n.name)), J(t, n), Promise.resolve(t);
|
|
1419
|
+
}
|
|
1420
|
+
loadSkin(e) {
|
|
1421
|
+
let t = this.json.skins[e], n = [];
|
|
1422
|
+
for (let e = 0, r = t.joints.length; e < r; e++) n.push(this._loadNodeShallow(t.joints[e]));
|
|
1423
|
+
return t.inverseBindMatrices === void 0 ? n.push(null) : n.push(this.getDependency("accessor", t.inverseBindMatrices)), Promise.all(n).then(function(e) {
|
|
1424
|
+
let n = e.pop(), r = e, i = [], a = [];
|
|
1425
|
+
for (let e = 0, o = r.length; e < o; e++) {
|
|
1426
|
+
let o = r[e];
|
|
1427
|
+
if (o) {
|
|
1428
|
+
i.push(o);
|
|
1429
|
+
let t = new C();
|
|
1430
|
+
n !== null && t.fromArray(n.array, e * 16), a.push(t);
|
|
1431
|
+
} else console.warn("THREE.GLTFLoader: Joint \"%s\" could not be found.", t.joints[e]);
|
|
1432
|
+
}
|
|
1433
|
+
return new Ee(i, a);
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
loadAnimation(e) {
|
|
1437
|
+
let t = this.json, n = this, i = t.animations[e], a = i.name ? i.name : "animation_" + e, o = [], s = [], c = [], l = [], u = [];
|
|
1438
|
+
for (let e = 0, t = i.channels.length; e < t; e++) {
|
|
1439
|
+
let t = i.channels[e], n = i.samplers[t.sampler], r = t.target, a = r.node, d = i.parameters === void 0 ? n.input : i.parameters[n.input], f = i.parameters === void 0 ? n.output : i.parameters[n.output];
|
|
1440
|
+
r.node !== void 0 && (o.push(this.getDependency("node", a)), s.push(this.getDependency("accessor", d)), c.push(this.getDependency("accessor", f)), l.push(n), u.push(r));
|
|
1441
|
+
}
|
|
1442
|
+
return Promise.all([
|
|
1443
|
+
Promise.all(o),
|
|
1444
|
+
Promise.all(s),
|
|
1445
|
+
Promise.all(c),
|
|
1446
|
+
Promise.all(l),
|
|
1447
|
+
Promise.all(u)
|
|
1448
|
+
]).then(function(e) {
|
|
1449
|
+
let t = e[0], o = e[1], s = e[2], c = e[3], l = e[4], u = [];
|
|
1450
|
+
for (let e = 0, r = t.length; e < r; e++) {
|
|
1451
|
+
let r = t[e], i = o[e], a = s[e], d = c[e], f = l[e];
|
|
1452
|
+
if (r === void 0) continue;
|
|
1453
|
+
r.updateMatrix && r.updateMatrix();
|
|
1454
|
+
let p = n._createAnimationTracks(r, i, a, d, f);
|
|
1455
|
+
if (p) for (let e = 0; e < p.length; e++) u.push(p[e]);
|
|
1456
|
+
}
|
|
1457
|
+
let d = new r(a, void 0, u);
|
|
1458
|
+
return J(d, i), d;
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
createNodeMesh(e) {
|
|
1462
|
+
let t = this.json, n = this, r = t.nodes[e];
|
|
1463
|
+
return r.mesh === void 0 ? null : n.getDependency("mesh", r.mesh).then(function(e) {
|
|
1464
|
+
let t = n._getNodeRef(n.meshCache, r.mesh, e);
|
|
1465
|
+
return r.weights !== void 0 && t.traverse(function(e) {
|
|
1466
|
+
if (e.isMesh) for (let t = 0, n = r.weights.length; t < n; t++) e.morphTargetInfluences[t] = r.weights[t];
|
|
1467
|
+
}), t;
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
loadNode(e) {
|
|
1471
|
+
let t = this.json, n = this, r = t.nodes[e], i = n._loadNodeShallow(e), a = [], o = r.children || [];
|
|
1472
|
+
for (let e = 0, t = o.length; e < t; e++) a.push(n.getDependency("node", o[e]));
|
|
1473
|
+
let s = r.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", r.skin);
|
|
1474
|
+
return Promise.all([
|
|
1475
|
+
i,
|
|
1476
|
+
Promise.all(a),
|
|
1477
|
+
s
|
|
1478
|
+
]).then(function(e) {
|
|
1479
|
+
let t = e[0], n = e[1], r = e[2];
|
|
1480
|
+
r !== null && t.traverse(function(e) {
|
|
1481
|
+
e.isSkinnedMesh && e.bind(r, At);
|
|
1482
|
+
});
|
|
1483
|
+
for (let e = 0, r = n.length; e < r; e++) t.add(n[e]);
|
|
1484
|
+
if (t.userData.pivot !== void 0 && n.length > 0) {
|
|
1485
|
+
let e = t.userData.pivot, r = n[0];
|
|
1486
|
+
t.pivot = new N().fromArray(e), t.position.x -= e[0], t.position.y -= e[1], t.position.z -= e[2], r.position.set(0, 0, 0), delete t.userData.pivot;
|
|
1487
|
+
}
|
|
1488
|
+
return t;
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
_loadNodeShallow(e) {
|
|
1492
|
+
let t = this.json, n = this.extensions, r = this;
|
|
1493
|
+
if (this.nodeCache[e] !== void 0) return this.nodeCache[e];
|
|
1494
|
+
let a = t.nodes[e], o = a.name ? r.createUniqueName(a.name) : "", s = [], c = r._invokeOne(function(t) {
|
|
1495
|
+
return t.createNodeMesh && t.createNodeMesh(e);
|
|
1496
|
+
});
|
|
1497
|
+
return c && s.push(c), a.camera !== void 0 && s.push(r.getDependency("camera", a.camera).then(function(e) {
|
|
1498
|
+
return r._getNodeRef(r.cameraCache, a.camera, e);
|
|
1499
|
+
})), r._invokeAll(function(t) {
|
|
1500
|
+
return t.createNodeAttachment && t.createNodeAttachment(e);
|
|
1501
|
+
}).forEach(function(e) {
|
|
1502
|
+
s.push(e);
|
|
1503
|
+
}), this.nodeCache[e] = Promise.all(s).then(function(t) {
|
|
1504
|
+
let s;
|
|
1505
|
+
if (s = a.isBone === !0 ? new i() : t.length > 1 ? new g() : t.length === 1 ? t[0] : new O(), s !== t[0]) for (let e = 0, n = t.length; e < n; e++) s.add(t[e]);
|
|
1506
|
+
if (a.name && (s.userData.name = a.name, s.name = o), J(s, a), a.extensions && q(n, s, a), a.matrix !== void 0) {
|
|
1507
|
+
let e = new C();
|
|
1508
|
+
e.fromArray(a.matrix), s.applyMatrix4(e);
|
|
1509
|
+
} else a.translation !== void 0 && s.position.fromArray(a.translation), a.rotation !== void 0 && s.quaternion.fromArray(a.rotation), a.scale !== void 0 && s.scale.fromArray(a.scale);
|
|
1510
|
+
if (!r.associations.has(s)) r.associations.set(s, {});
|
|
1511
|
+
else if (a.mesh !== void 0 && r.meshCache.refs[a.mesh] > 1) {
|
|
1512
|
+
let e = r.associations.get(s);
|
|
1513
|
+
r.associations.set(s, { ...e });
|
|
1514
|
+
}
|
|
1515
|
+
return r.associations.get(s).nodes = e, s;
|
|
1516
|
+
}), this.nodeCache[e];
|
|
1517
|
+
}
|
|
1518
|
+
loadScene(e) {
|
|
1519
|
+
let t = this.extensions, n = this.json.scenes[e], r = this, i = new g();
|
|
1520
|
+
n.name && (i.name = r.createUniqueName(n.name)), J(i, n), n.extensions && q(t, i, n);
|
|
1521
|
+
let a = n.nodes || [], o = [];
|
|
1522
|
+
for (let e = 0, t = a.length; e < t; e++) o.push(r.getDependency("node", a[e]));
|
|
1523
|
+
return Promise.all(o).then(function(e) {
|
|
1524
|
+
for (let t = 0, n = e.length; t < n; t++) {
|
|
1525
|
+
let n = e[t];
|
|
1526
|
+
n.parent === null ? i.add(n) : i.add(Ge(n));
|
|
1527
|
+
}
|
|
1528
|
+
return r.associations = ((e) => {
|
|
1529
|
+
let t = /* @__PURE__ */ new Map();
|
|
1530
|
+
for (let [e, n] of r.associations) (e instanceof S || e instanceof Ae) && t.set(e, n);
|
|
1531
|
+
return e.traverse((e) => {
|
|
1532
|
+
let n = r.associations.get(e);
|
|
1533
|
+
n != null && t.set(e, n);
|
|
1534
|
+
}), t;
|
|
1535
|
+
})(i), i;
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
_createAnimationTracks(e, t, n, r, i) {
|
|
1539
|
+
let a = [], o = e.name ? e.name : e.uuid, s = [];
|
|
1540
|
+
function c(e) {
|
|
1541
|
+
e.morphTargetInfluences && s.push(e.name ? e.name : e.uuid);
|
|
1542
|
+
}
|
|
1543
|
+
G[i.path] === G.weights ? (c(e), e.isGroup && e.children.forEach(c)) : s.push(o);
|
|
1544
|
+
let l;
|
|
1545
|
+
switch (G[i.path]) {
|
|
1546
|
+
case G.weights:
|
|
1547
|
+
l = ye;
|
|
1548
|
+
break;
|
|
1549
|
+
case G.rotation:
|
|
1550
|
+
l = Te;
|
|
1551
|
+
break;
|
|
1552
|
+
case G.translation:
|
|
1553
|
+
case G.scale:
|
|
1554
|
+
l = Fe;
|
|
1555
|
+
break;
|
|
1556
|
+
default:
|
|
1557
|
+
switch (n.itemSize) {
|
|
1558
|
+
case 1:
|
|
1559
|
+
l = ye;
|
|
1560
|
+
break;
|
|
1561
|
+
default:
|
|
1562
|
+
l = Fe;
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
let u = r.interpolation === void 0 ? se : wt[r.interpolation], d = this._getArrayFromAccessor(n);
|
|
1568
|
+
for (let e = 0, n = s.length; e < n; e++) {
|
|
1569
|
+
let n = new l(s[e] + "." + G[i.path], t.array, d, u);
|
|
1570
|
+
r.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(n), a.push(n);
|
|
1571
|
+
}
|
|
1572
|
+
return a;
|
|
1573
|
+
}
|
|
1574
|
+
_getArrayFromAccessor(e) {
|
|
1575
|
+
let t = e.array;
|
|
1576
|
+
if (e.normalized) {
|
|
1577
|
+
let e = X(t.constructor), n = new Float32Array(t.length);
|
|
1578
|
+
for (let r = 0, i = t.length; r < i; r++) n[r] = t[r] * e;
|
|
1579
|
+
t = n;
|
|
1580
|
+
}
|
|
1581
|
+
return t;
|
|
1582
|
+
}
|
|
1583
|
+
_createCubicSplineTrackInterpolant(e) {
|
|
1584
|
+
e.createInterpolant = function(e) {
|
|
1585
|
+
return new (this instanceof Te ? xt : yt)(this.times, this.values, this.getValueSize() / 3, e);
|
|
1586
|
+
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
function Mt(e, t, n) {
|
|
1590
|
+
let r = t.attributes, i = new a();
|
|
1591
|
+
if (r.POSITION !== void 0) {
|
|
1592
|
+
let e = n.json.accessors[r.POSITION], t = e.min, a = e.max;
|
|
1593
|
+
if (t !== void 0 && a !== void 0) {
|
|
1594
|
+
if (i.set(new N(t[0], t[1], t[2]), new N(a[0], a[1], a[2])), e.normalized) {
|
|
1595
|
+
let t = X(H[e.componentType]);
|
|
1596
|
+
i.min.multiplyScalar(t), i.max.multiplyScalar(t);
|
|
1597
|
+
}
|
|
1598
|
+
} else {
|
|
1599
|
+
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
} else return;
|
|
1603
|
+
let o = t.targets;
|
|
1604
|
+
if (o !== void 0) {
|
|
1605
|
+
let e = new N(), t = new N();
|
|
1606
|
+
for (let r = 0, i = o.length; r < i; r++) {
|
|
1607
|
+
let i = o[r];
|
|
1608
|
+
if (i.POSITION !== void 0) {
|
|
1609
|
+
let r = n.json.accessors[i.POSITION], a = r.min, o = r.max;
|
|
1610
|
+
if (a !== void 0 && o !== void 0) {
|
|
1611
|
+
if (t.setX(Math.max(Math.abs(a[0]), Math.abs(o[0]))), t.setY(Math.max(Math.abs(a[1]), Math.abs(o[1]))), t.setZ(Math.max(Math.abs(a[2]), Math.abs(o[2]))), r.normalized) {
|
|
1612
|
+
let e = X(H[r.componentType]);
|
|
1613
|
+
t.multiplyScalar(e);
|
|
1614
|
+
}
|
|
1615
|
+
e.max(t);
|
|
1616
|
+
} else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
i.expandByVector(e);
|
|
1620
|
+
}
|
|
1621
|
+
e.boundingBox = i;
|
|
1622
|
+
let s = new Oe();
|
|
1623
|
+
i.getCenter(s.center), s.radius = i.min.distanceTo(i.max) / 2, e.boundingSphere = s;
|
|
1624
|
+
}
|
|
1625
|
+
function Nt(e, t, n) {
|
|
1626
|
+
let r = t.attributes, i = [];
|
|
1627
|
+
function a(t, r) {
|
|
1628
|
+
return n.getDependency("accessor", t).then(function(t) {
|
|
1629
|
+
e.setAttribute(r, t);
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
for (let t in r) {
|
|
1633
|
+
let n = W[t] || t.toLowerCase();
|
|
1634
|
+
n in e.attributes || i.push(a(r[t], n));
|
|
1635
|
+
}
|
|
1636
|
+
if (t.indices !== void 0 && !e.index) {
|
|
1637
|
+
let r = n.getDependency("accessor", t.indices).then(function(t) {
|
|
1638
|
+
e.setIndex(t);
|
|
1639
|
+
});
|
|
1640
|
+
i.push(r);
|
|
1641
|
+
}
|
|
1642
|
+
return u.workingColorSpace !== b && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u.workingColorSpace}" not supported.`), J(e, t), Mt(e, t, n), Promise.all(i).then(function() {
|
|
1643
|
+
return t.targets === void 0 ? e : Et(e, t.targets, n);
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
//#endregion
|
|
1647
|
+
//#region src/assets/customAssetGeometry.ts
|
|
1648
|
+
var Pt = new We(), Ft = new qe();
|
|
1649
|
+
async function It(e) {
|
|
1650
|
+
let t = zt(e);
|
|
1651
|
+
return t === "glb" || t === "gltf" ? Ut(e) : t === "obj" ? Bt(e) : Vt(e);
|
|
1652
|
+
}
|
|
1653
|
+
async function Lt(e) {
|
|
1654
|
+
let t = await e.arrayBuffer(), n = zt(e.name);
|
|
1655
|
+
return n === "glb" || n === "gltf" ? Q(t) : n === "obj" ? Z(new TextDecoder().decode(t), e.name) : Ht(t, e.name);
|
|
1656
|
+
}
|
|
1657
|
+
function Rt(e, { assetScale: t, assetNormalize: r }) {
|
|
1658
|
+
e.computeBoundingBox();
|
|
1659
|
+
let i = e.boundingBox;
|
|
1660
|
+
if (!i) {
|
|
1661
|
+
e.scale(t, t, t);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
let a = new n.Vector3(), o = new n.Vector3();
|
|
1665
|
+
if (i.getCenter(a), i.getSize(o), e.translate(-a.x, -a.y, -a.z), r) {
|
|
1666
|
+
let t = Math.max(o.x, o.y, o.z);
|
|
1667
|
+
if (t > 0) {
|
|
1668
|
+
let n = 1 / t;
|
|
1669
|
+
e.scale(n, n, n);
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
e.scale(t, t, t), e.computeVertexNormals(), e.computeBoundingBox(), e.computeBoundingSphere();
|
|
1673
|
+
}
|
|
1674
|
+
function zt(e) {
|
|
1675
|
+
return e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase() ?? "";
|
|
1676
|
+
}
|
|
1677
|
+
async function Bt(e) {
|
|
1678
|
+
let t = await fetch(e);
|
|
1679
|
+
if (!t.ok) throw Error(`Unable to load OBJ asset: ${t.status} ${t.statusText}\n${e}`);
|
|
1680
|
+
return Z(await t.text(), e);
|
|
1681
|
+
}
|
|
1682
|
+
async function Vt(e) {
|
|
1683
|
+
let t = await fetch(e);
|
|
1684
|
+
if (!t.ok) throw Error(`Unable to load asset: ${t.status} ${t.statusText}\n${e}`);
|
|
1685
|
+
return Ht(await t.arrayBuffer(), e);
|
|
1686
|
+
}
|
|
1687
|
+
function Z(e, t) {
|
|
1688
|
+
if (!/(^|\n)\s*(v|vn|vt|f|o|g)\s+/m.test(e)) throw Error(`The asset did not contain a valid OBJ file:\n${t}`);
|
|
1689
|
+
return $(Pt.parse(e), "OBJ file does not contain mesh geometry.");
|
|
1690
|
+
}
|
|
1691
|
+
async function Ht(e, t) {
|
|
1692
|
+
if (new TextDecoder().decode(e.slice(0, 32)).startsWith("glTF")) return Q(e);
|
|
1693
|
+
let n = new TextDecoder().decode(e), r = /(^|\n)\s*(v|vn|vt|f|o|g)\s+/m.test(n), i = n.trim().startsWith("{") && n.includes("\"asset\"") && n.includes("\"version\"");
|
|
1694
|
+
if (r) return Z(n, t);
|
|
1695
|
+
if (i) return Q(e);
|
|
1696
|
+
throw Error(`Unable to detect asset format. Use a .obj, .glb, or .gltf file.\n${t}`);
|
|
1697
|
+
}
|
|
1698
|
+
async function Q(e) {
|
|
1699
|
+
return $((await new Promise((t, n) => {
|
|
1700
|
+
Ft.parse(e, "", t, n);
|
|
1701
|
+
})).scene, "GLB/GLTF file does not contain mesh geometry.");
|
|
1702
|
+
}
|
|
1703
|
+
async function Ut(e) {
|
|
1704
|
+
return $((await Ft.loadAsync(e)).scene, "GLB/GLTF file does not contain mesh geometry.");
|
|
1705
|
+
}
|
|
1706
|
+
function $(e, r) {
|
|
1707
|
+
let i = [];
|
|
1708
|
+
if (e.updateMatrixWorld(!0), e.traverse((e) => {
|
|
1709
|
+
if (!("isMesh" in e) || !e.isMesh || !("geometry" in e) || !(e.geometry instanceof n.BufferGeometry)) return;
|
|
1710
|
+
let t = e.geometry.clone();
|
|
1711
|
+
t.applyMatrix4(e.matrixWorld), i.push(t);
|
|
1712
|
+
}), i.length === 0) throw Error(r);
|
|
1713
|
+
let a = i.length === 1 ? i[0] : t(i, !1);
|
|
1714
|
+
if (i.forEach((e) => {
|
|
1715
|
+
e !== a && e.dispose();
|
|
1716
|
+
}), !a) throw Error("Unable to merge custom asset geometry.");
|
|
1717
|
+
return a;
|
|
1718
|
+
}
|
|
1719
|
+
//#endregion
|
|
1720
|
+
export { It as loadCustomAssetGeometry, Lt as loadCustomAssetGeometryFromFile, Rt as prepareCustomAssetGeometry };
|