@j-kyoda/vue-three-vrm 0.6.4 → 0.7.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/dist/vue-three-vrm.es.js +691 -699
- package/dist/vue-three-vrm.umd.js +2 -2
- package/package.json +2 -4
package/dist/vue-three-vrm.es.js
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
1
|
+
import { getCurrentInstance as ze, useTemplateRef as Xe, watch as F, onMounted as $, createElementBlock as De, openBlock as fe, ref as Z, Fragment as Ye, createVNode as ee, createBlock as We } from "vue";
|
|
2
2
|
import * as N from "three";
|
|
3
|
-
import { TrianglesDrawMode as
|
|
4
|
-
import { VRMHumanBoneName as be, VRMExpressionPresetName as Re, VRMLoaderPlugin as
|
|
5
|
-
class
|
|
3
|
+
import { TrianglesDrawMode as Ze, TriangleFanDrawMode as ce, TriangleStripDrawMode as Ce, Loader as qe, LoaderUtils as X, FileLoader as Ie, MeshPhysicalMaterial as O, Vector2 as S, Color as H, LinearSRGBColorSpace as C, SRGBColorSpace as Y, SpotLight as Qe, PointLight as $e, DirectionalLight as Je, Matrix4 as q, Vector3 as M, Quaternion as Q, InstancedMesh as et, InstancedBufferAttribute as tt, Object3D as ve, TextureLoader as st, ImageBitmapLoader as nt, BufferAttribute as te, InterleavedBuffer as it, InterleavedBufferAttribute as ot, LinearMipmapLinearFilter as ke, NearestMipmapLinearFilter as rt, LinearMipmapNearestFilter as at, NearestMipmapNearestFilter as ct, LinearFilter as le, NearestFilter as je, RepeatWrapping as he, MirroredRepeatWrapping as lt, ClampToEdgeWrapping as ht, PointsMaterial as ut, Material as se, LineBasicMaterial as dt, MeshStandardMaterial as Fe, DoubleSide as pt, MeshBasicMaterial as z, PropertyBinding as ft, BufferGeometry as mt, SkinnedMesh as _t, Mesh as gt, LineSegments as Tt, Line as yt, LineLoop as xt, Points as Et, Group as ne, PerspectiveCamera as bt, MathUtils as He, OrthographicCamera as Rt, Skeleton as Mt, AnimationClip as wt, Bone as St, InterpolateDiscrete as At, InterpolateLinear as Ge, Texture as _e, VectorKeyframeTrack as ge, NumberKeyframeTrack as Te, QuaternionKeyframeTrack as ye, ColorManagement as xe, FrontSide as Lt, Interpolant as Pt, Box3 as Nt, Sphere as Ot, Controls as Dt, MOUSE as U, TOUCH as G, Spherical as Ee, Ray as Ct, Plane as It } from "three";
|
|
4
|
+
import { VRMHumanBoneName as be, VRMExpressionPresetName as Re, VRMLoaderPlugin as vt, VRMUtils as kt } from "@pixiv/three-vrm";
|
|
5
|
+
class Ue {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.status = 0, this.url = null, this.data = null;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
async fetchJSON(e) {
|
|
9
|
+
const t = await fetch(e);
|
|
10
|
+
return t.ok ? await t.json() : null;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
async fetchPose(e) {
|
|
13
|
+
const t = await this.fetchJSON(e);
|
|
14
|
+
return t == null ? null : "pose" in t ? t.pose : t;
|
|
14
15
|
}
|
|
15
|
-
async
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return n.status != 200 ? (this.status = 3, null) : n.data ? (this.data = n.data, this.status = 2, this.data) : (this.status = 3, null);
|
|
19
|
-
}
|
|
20
|
-
async loadPose(e, t) {
|
|
21
|
-
const n = await this.loadUrl(e, t);
|
|
22
|
-
return n == null ? null : "pose" in n ? (this.data = n.pose, this.data) : this.data;
|
|
23
|
-
}
|
|
24
|
-
async loadExpression(e, t) {
|
|
25
|
-
const n = await this.loadUrl(e, t);
|
|
26
|
-
return n == null ? null : "expressions" in n ? (this.data = n.expressions, this.data) : this.data;
|
|
16
|
+
async fetchExpression(e) {
|
|
17
|
+
const t = await this.fetchJSON(e);
|
|
18
|
+
return t == null ? null : "expressions" in t ? t.expressions : t;
|
|
27
19
|
}
|
|
28
20
|
}
|
|
29
|
-
class
|
|
21
|
+
class jt {
|
|
30
22
|
constructor() {
|
|
31
23
|
this.vrm = null;
|
|
32
24
|
}
|
|
@@ -74,9 +66,9 @@ class Ft {
|
|
|
74
66
|
z: t.rotation.z
|
|
75
67
|
} : null;
|
|
76
68
|
}
|
|
77
|
-
setBoneRotate(e, t,
|
|
69
|
+
setBoneRotate(e, t, s, n) {
|
|
78
70
|
const i = this.getBoneNode(e);
|
|
79
|
-
i && (i.rotation.x = t, i.rotation.y =
|
|
71
|
+
i && (i.rotation.x = t, i.rotation.y = s, i.rotation.z = n);
|
|
80
72
|
}
|
|
81
73
|
getBonePosition(e) {
|
|
82
74
|
const t = this.getBoneNode(e);
|
|
@@ -86,9 +78,9 @@ class Ft {
|
|
|
86
78
|
z: t.position.z
|
|
87
79
|
} : null;
|
|
88
80
|
}
|
|
89
|
-
setBonePosition(e, t,
|
|
81
|
+
setBonePosition(e, t, s, n) {
|
|
90
82
|
const i = this.getBoneNode(e);
|
|
91
|
-
i && (i.position.x = t, i.position.y =
|
|
83
|
+
i && (i.position.x = t, i.position.y = s, i.position.z = n);
|
|
92
84
|
}
|
|
93
85
|
getMetaVersion() {
|
|
94
86
|
return this.vrm ? this.vrm.meta.metaVersion : null;
|
|
@@ -120,8 +112,8 @@ class Ft {
|
|
|
120
112
|
if (this.vrm) {
|
|
121
113
|
let e = {};
|
|
122
114
|
const t = this.getExpressionNames();
|
|
123
|
-
for (const
|
|
124
|
-
e[
|
|
115
|
+
for (const s in t)
|
|
116
|
+
e[s] = this.getExpression(s);
|
|
125
117
|
return e;
|
|
126
118
|
}
|
|
127
119
|
return null;
|
|
@@ -150,8 +142,8 @@ class Me {
|
|
|
150
142
|
*/
|
|
151
143
|
static isColorSpaceAvailable(e) {
|
|
152
144
|
try {
|
|
153
|
-
const t = document.createElement("canvas"),
|
|
154
|
-
return
|
|
145
|
+
const t = document.createElement("canvas"), s = window.WebGL2RenderingContext && t.getContext("webgl2");
|
|
146
|
+
return s.drawingBufferColorSpace = e, s.drawingBufferColorSpace === e;
|
|
155
147
|
} catch {
|
|
156
148
|
return !1;
|
|
157
149
|
}
|
|
@@ -170,13 +162,13 @@ class Me {
|
|
|
170
162
|
const t = {
|
|
171
163
|
1: "WebGL",
|
|
172
164
|
2: "WebGL 2"
|
|
173
|
-
},
|
|
165
|
+
}, s = {
|
|
174
166
|
1: window.WebGLRenderingContext,
|
|
175
167
|
2: window.WebGL2RenderingContext
|
|
176
168
|
};
|
|
177
|
-
let
|
|
169
|
+
let n = 'Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>';
|
|
178
170
|
const i = document.createElement("div");
|
|
179
|
-
return i.id = "webglmessage", i.style.fontFamily = "monospace", i.style.fontSize = "13px", i.style.fontWeight = "normal", i.style.textAlign = "center", i.style.background = "#fff", i.style.color = "#000", i.style.padding = "1.5em", i.style.width = "400px", i.style.margin = "5em auto 0",
|
|
171
|
+
return i.id = "webglmessage", i.style.fontFamily = "monospace", i.style.fontSize = "13px", i.style.fontWeight = "normal", i.style.textAlign = "center", i.style.background = "#fff", i.style.color = "#000", i.style.padding = "1.5em", i.style.width = "400px", i.style.margin = "5em auto 0", s[e] ? n = n.replace("$0", "graphics card") : n = n.replace("$0", "browser"), n = n.replace("$1", t[e]), i.innerHTML = n, i;
|
|
180
172
|
}
|
|
181
173
|
// @deprecated, r168
|
|
182
174
|
static isWebGLAvailable() {
|
|
@@ -193,9 +185,9 @@ class Me {
|
|
|
193
185
|
}
|
|
194
186
|
}
|
|
195
187
|
function we(l, e) {
|
|
196
|
-
if (e ===
|
|
188
|
+
if (e === Ze)
|
|
197
189
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), l;
|
|
198
|
-
if (e === ce || e ===
|
|
190
|
+
if (e === ce || e === Ce) {
|
|
199
191
|
let t = l.getIndex();
|
|
200
192
|
if (t === null) {
|
|
201
193
|
const o = [], r = l.getAttribute("position");
|
|
@@ -206,20 +198,20 @@ function we(l, e) {
|
|
|
206
198
|
} else
|
|
207
199
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), l;
|
|
208
200
|
}
|
|
209
|
-
const
|
|
201
|
+
const s = t.count - 2, n = [];
|
|
210
202
|
if (e === ce)
|
|
211
|
-
for (let o = 1; o <=
|
|
212
|
-
|
|
203
|
+
for (let o = 1; o <= s; o++)
|
|
204
|
+
n.push(t.getX(0)), n.push(t.getX(o)), n.push(t.getX(o + 1));
|
|
213
205
|
else
|
|
214
|
-
for (let o = 0; o <
|
|
215
|
-
o % 2 === 0 ? (
|
|
216
|
-
|
|
206
|
+
for (let o = 0; o < s; o++)
|
|
207
|
+
o % 2 === 0 ? (n.push(t.getX(o)), n.push(t.getX(o + 1)), n.push(t.getX(o + 2))) : (n.push(t.getX(o + 2)), n.push(t.getX(o + 1)), n.push(t.getX(o)));
|
|
208
|
+
n.length / 3 !== s && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
217
209
|
const i = l.clone();
|
|
218
|
-
return i.setIndex(
|
|
210
|
+
return i.setIndex(n), i.clearGroups(), i;
|
|
219
211
|
} else
|
|
220
212
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), l;
|
|
221
213
|
}
|
|
222
|
-
class ue extends
|
|
214
|
+
class ue extends qe {
|
|
223
215
|
/**
|
|
224
216
|
* Constructs a new glTF loader.
|
|
225
217
|
*
|
|
@@ -227,15 +219,17 @@ class ue extends Qe {
|
|
|
227
219
|
*/
|
|
228
220
|
constructor(e) {
|
|
229
221
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
222
|
+
return new Kt(t);
|
|
223
|
+
}), this.register(function(t) {
|
|
230
224
|
return new Bt(t);
|
|
231
225
|
}), this.register(function(t) {
|
|
232
|
-
return new
|
|
226
|
+
return new $t(t);
|
|
233
227
|
}), this.register(function(t) {
|
|
234
228
|
return new Jt(t);
|
|
235
229
|
}), this.register(function(t) {
|
|
236
230
|
return new es(t);
|
|
237
231
|
}), this.register(function(t) {
|
|
238
|
-
return new
|
|
232
|
+
return new zt(t);
|
|
239
233
|
}), this.register(function(t) {
|
|
240
234
|
return new Xt(t);
|
|
241
235
|
}), this.register(function(t) {
|
|
@@ -243,23 +237,21 @@ class ue extends Qe {
|
|
|
243
237
|
}), this.register(function(t) {
|
|
244
238
|
return new Wt(t);
|
|
245
239
|
}), this.register(function(t) {
|
|
246
|
-
return new
|
|
240
|
+
return new Ut(t);
|
|
247
241
|
}), this.register(function(t) {
|
|
248
|
-
return new
|
|
242
|
+
return new Zt(t);
|
|
249
243
|
}), this.register(function(t) {
|
|
250
|
-
return new
|
|
244
|
+
return new Vt(t);
|
|
251
245
|
}), this.register(function(t) {
|
|
252
|
-
return new
|
|
246
|
+
return new Qt(t);
|
|
253
247
|
}), this.register(function(t) {
|
|
254
|
-
return new
|
|
248
|
+
return new qt(t);
|
|
255
249
|
}), this.register(function(t) {
|
|
256
|
-
return new
|
|
250
|
+
return new Ht(t);
|
|
257
251
|
}), this.register(function(t) {
|
|
258
|
-
return new
|
|
252
|
+
return new ts(t);
|
|
259
253
|
}), this.register(function(t) {
|
|
260
254
|
return new ss(t);
|
|
261
|
-
}), this.register(function(t) {
|
|
262
|
-
return new ns(t);
|
|
263
255
|
});
|
|
264
256
|
}
|
|
265
257
|
/**
|
|
@@ -271,7 +263,7 @@ class ue extends Qe {
|
|
|
271
263
|
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
272
264
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
273
265
|
*/
|
|
274
|
-
load(e, t,
|
|
266
|
+
load(e, t, s, n) {
|
|
275
267
|
const i = this;
|
|
276
268
|
let o;
|
|
277
269
|
if (this.resourcePath !== "")
|
|
@@ -283,17 +275,17 @@ class ue extends Qe {
|
|
|
283
275
|
o = X.extractUrlBase(e);
|
|
284
276
|
this.manager.itemStart(e);
|
|
285
277
|
const r = function(c) {
|
|
286
|
-
|
|
287
|
-
}, a = new
|
|
278
|
+
n ? n(c) : console.error(c), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
279
|
+
}, a = new Ie(this.manager);
|
|
288
280
|
a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) {
|
|
289
281
|
try {
|
|
290
|
-
i.parse(c, o, function(
|
|
291
|
-
t(
|
|
282
|
+
i.parse(c, o, function(u) {
|
|
283
|
+
t(u), i.manager.itemEnd(e);
|
|
292
284
|
}, r);
|
|
293
|
-
} catch (
|
|
294
|
-
r(
|
|
285
|
+
} catch (u) {
|
|
286
|
+
r(u);
|
|
295
287
|
}
|
|
296
|
-
},
|
|
288
|
+
}, s, r);
|
|
297
289
|
}
|
|
298
290
|
/**
|
|
299
291
|
* Sets the given Draco loader to this loader. Required for decoding assets
|
|
@@ -353,17 +345,17 @@ class ue extends Qe {
|
|
|
353
345
|
* @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
|
|
354
346
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
355
347
|
*/
|
|
356
|
-
parse(e, t,
|
|
348
|
+
parse(e, t, s, n) {
|
|
357
349
|
let i;
|
|
358
350
|
const o = {}, r = {}, a = new TextDecoder();
|
|
359
351
|
if (typeof e == "string")
|
|
360
352
|
i = JSON.parse(e);
|
|
361
353
|
else if (e instanceof ArrayBuffer)
|
|
362
|
-
if (a.decode(new Uint8Array(e, 0, 4)) ===
|
|
354
|
+
if (a.decode(new Uint8Array(e, 0, 4)) === Ke) {
|
|
363
355
|
try {
|
|
364
|
-
o[y.KHR_BINARY_GLTF] = new
|
|
365
|
-
} catch (
|
|
366
|
-
|
|
356
|
+
o[y.KHR_BINARY_GLTF] = new ns(e);
|
|
357
|
+
} catch (h) {
|
|
358
|
+
n && n(h);
|
|
367
359
|
return;
|
|
368
360
|
}
|
|
369
361
|
i = JSON.parse(o[y.KHR_BINARY_GLTF].content);
|
|
@@ -372,10 +364,10 @@ class ue extends Qe {
|
|
|
372
364
|
else
|
|
373
365
|
i = e;
|
|
374
366
|
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
375
|
-
|
|
367
|
+
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
376
368
|
return;
|
|
377
369
|
}
|
|
378
|
-
const c = new
|
|
370
|
+
const c = new _s(i, {
|
|
379
371
|
path: t || this.resourcePath || "",
|
|
380
372
|
crossOrigin: this.crossOrigin,
|
|
381
373
|
requestHeader: this.requestHeader,
|
|
@@ -384,31 +376,31 @@ class ue extends Qe {
|
|
|
384
376
|
meshoptDecoder: this.meshoptDecoder
|
|
385
377
|
});
|
|
386
378
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
387
|
-
for (let
|
|
388
|
-
const
|
|
389
|
-
|
|
379
|
+
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
380
|
+
const h = this.pluginCallbacks[u](c);
|
|
381
|
+
h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), r[h.name] = h, o[h.name] = !0;
|
|
390
382
|
}
|
|
391
383
|
if (i.extensionsUsed)
|
|
392
|
-
for (let
|
|
393
|
-
const
|
|
394
|
-
switch (
|
|
384
|
+
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
385
|
+
const h = i.extensionsUsed[u], d = i.extensionsRequired || [];
|
|
386
|
+
switch (h) {
|
|
395
387
|
case y.KHR_MATERIALS_UNLIT:
|
|
396
|
-
o[
|
|
388
|
+
o[h] = new Gt();
|
|
397
389
|
break;
|
|
398
390
|
case y.KHR_DRACO_MESH_COMPRESSION:
|
|
399
|
-
o[
|
|
391
|
+
o[h] = new is(i, this.dracoLoader);
|
|
400
392
|
break;
|
|
401
393
|
case y.KHR_TEXTURE_TRANSFORM:
|
|
402
|
-
o[
|
|
394
|
+
o[h] = new os();
|
|
403
395
|
break;
|
|
404
396
|
case y.KHR_MESH_QUANTIZATION:
|
|
405
|
-
o[
|
|
397
|
+
o[h] = new rs();
|
|
406
398
|
break;
|
|
407
399
|
default:
|
|
408
|
-
d.indexOf(
|
|
400
|
+
d.indexOf(h) >= 0 && r[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
|
|
409
401
|
}
|
|
410
402
|
}
|
|
411
|
-
c.setExtensions(o), c.setPlugins(r), c.parse(
|
|
403
|
+
c.setExtensions(o), c.setPlugins(r), c.parse(s, n);
|
|
412
404
|
}
|
|
413
405
|
/**
|
|
414
406
|
* Async version of {@link GLTFLoader#parse}.
|
|
@@ -419,13 +411,13 @@ class ue extends Qe {
|
|
|
419
411
|
* @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
|
|
420
412
|
*/
|
|
421
413
|
parseAsync(e, t) {
|
|
422
|
-
const
|
|
423
|
-
return new Promise(function(
|
|
424
|
-
|
|
414
|
+
const s = this;
|
|
415
|
+
return new Promise(function(n, i) {
|
|
416
|
+
s.parse(e, t, n, i);
|
|
425
417
|
});
|
|
426
418
|
}
|
|
427
419
|
}
|
|
428
|
-
function
|
|
420
|
+
function Ft() {
|
|
429
421
|
let l = {};
|
|
430
422
|
return {
|
|
431
423
|
get: function(e) {
|
|
@@ -466,49 +458,49 @@ const y = {
|
|
|
466
458
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
467
459
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
468
460
|
};
|
|
469
|
-
class
|
|
461
|
+
class Ht {
|
|
470
462
|
constructor(e) {
|
|
471
463
|
this.parser = e, this.name = y.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
472
464
|
}
|
|
473
465
|
_markDefs() {
|
|
474
466
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
475
|
-
for (let
|
|
476
|
-
const i = t[
|
|
467
|
+
for (let s = 0, n = t.length; s < n; s++) {
|
|
468
|
+
const i = t[s];
|
|
477
469
|
i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, i.extensions[this.name].light);
|
|
478
470
|
}
|
|
479
471
|
}
|
|
480
472
|
_loadLight(e) {
|
|
481
|
-
const t = this.parser,
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
473
|
+
const t = this.parser, s = "light:" + e;
|
|
474
|
+
let n = t.cache.get(s);
|
|
475
|
+
if (n) return n;
|
|
484
476
|
const i = t.json, a = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
485
477
|
let c;
|
|
486
|
-
const
|
|
487
|
-
a.color !== void 0 &&
|
|
488
|
-
const
|
|
478
|
+
const u = new H(16777215);
|
|
479
|
+
a.color !== void 0 && u.setRGB(a.color[0], a.color[1], a.color[2], C);
|
|
480
|
+
const h = a.range !== void 0 ? a.range : 0;
|
|
489
481
|
switch (a.type) {
|
|
490
482
|
case "directional":
|
|
491
|
-
c = new
|
|
483
|
+
c = new Je(u), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
492
484
|
break;
|
|
493
485
|
case "point":
|
|
494
|
-
c = new
|
|
486
|
+
c = new $e(u), c.distance = h;
|
|
495
487
|
break;
|
|
496
488
|
case "spot":
|
|
497
|
-
c = new
|
|
489
|
+
c = new Qe(u), c.distance = h, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, c.angle = a.spot.outerConeAngle, c.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
498
490
|
break;
|
|
499
491
|
default:
|
|
500
492
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
|
|
501
493
|
}
|
|
502
|
-
return c.position.set(0, 0, 0), D(c, a), a.intensity !== void 0 && (c.intensity = a.intensity), c.name = t.createUniqueName(a.name || "light_" + e),
|
|
494
|
+
return c.position.set(0, 0, 0), D(c, a), a.intensity !== void 0 && (c.intensity = a.intensity), c.name = t.createUniqueName(a.name || "light_" + e), n = Promise.resolve(c), t.cache.add(s, n), n;
|
|
503
495
|
}
|
|
504
496
|
getDependency(e, t) {
|
|
505
497
|
if (e === "light")
|
|
506
498
|
return this._loadLight(t);
|
|
507
499
|
}
|
|
508
500
|
createNodeAttachment(e) {
|
|
509
|
-
const t = this,
|
|
501
|
+
const t = this, s = this.parser, i = s.json.nodes[e], r = (i.extensions && i.extensions[this.name] || {}).light;
|
|
510
502
|
return r === void 0 ? null : this._loadLight(r).then(function(a) {
|
|
511
|
-
return
|
|
503
|
+
return s._getNodeRef(t.cache, r, a);
|
|
512
504
|
});
|
|
513
505
|
}
|
|
514
506
|
}
|
|
@@ -519,8 +511,8 @@ class Gt {
|
|
|
519
511
|
getMaterialType() {
|
|
520
512
|
return z;
|
|
521
513
|
}
|
|
522
|
-
extendParams(e, t,
|
|
523
|
-
const
|
|
514
|
+
extendParams(e, t, s) {
|
|
515
|
+
const n = [];
|
|
524
516
|
e.color = new H(1, 1, 1), e.opacity = 1;
|
|
525
517
|
const i = t.pbrMetallicRoughness;
|
|
526
518
|
if (i) {
|
|
@@ -528,328 +520,328 @@ class Gt {
|
|
|
528
520
|
const o = i.baseColorFactor;
|
|
529
521
|
e.color.setRGB(o[0], o[1], o[2], C), e.opacity = o[3];
|
|
530
522
|
}
|
|
531
|
-
i.baseColorTexture !== void 0 &&
|
|
523
|
+
i.baseColorTexture !== void 0 && n.push(s.assignTexture(e, "map", i.baseColorTexture, Y));
|
|
532
524
|
}
|
|
533
|
-
return Promise.all(
|
|
525
|
+
return Promise.all(n);
|
|
534
526
|
}
|
|
535
527
|
}
|
|
536
|
-
class
|
|
528
|
+
class Ut {
|
|
537
529
|
constructor(e) {
|
|
538
530
|
this.parser = e, this.name = y.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
539
531
|
}
|
|
540
532
|
extendMaterialParams(e, t) {
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
533
|
+
const n = this.parser.json.materials[e];
|
|
534
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
543
535
|
return Promise.resolve();
|
|
544
|
-
const i =
|
|
536
|
+
const i = n.extensions[this.name].emissiveStrength;
|
|
545
537
|
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
546
538
|
}
|
|
547
539
|
}
|
|
548
|
-
class
|
|
540
|
+
class Kt {
|
|
549
541
|
constructor(e) {
|
|
550
542
|
this.parser = e, this.name = y.KHR_MATERIALS_CLEARCOAT;
|
|
551
543
|
}
|
|
552
544
|
getMaterialType(e) {
|
|
553
|
-
const
|
|
554
|
-
return !
|
|
545
|
+
const s = this.parser.json.materials[e];
|
|
546
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
555
547
|
}
|
|
556
548
|
extendMaterialParams(e, t) {
|
|
557
|
-
const
|
|
558
|
-
if (!
|
|
549
|
+
const s = this.parser, n = s.json.materials[e];
|
|
550
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
559
551
|
return Promise.resolve();
|
|
560
|
-
const i = [], o =
|
|
561
|
-
if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && i.push(
|
|
552
|
+
const i = [], o = n.extensions[this.name];
|
|
553
|
+
if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && i.push(s.assignTexture(t, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && i.push(s.assignTexture(t, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (i.push(s.assignTexture(t, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) {
|
|
562
554
|
const r = o.clearcoatNormalTexture.scale;
|
|
563
555
|
t.clearcoatNormalScale = new S(r, r);
|
|
564
556
|
}
|
|
565
557
|
return Promise.all(i);
|
|
566
558
|
}
|
|
567
559
|
}
|
|
568
|
-
class
|
|
560
|
+
class Bt {
|
|
569
561
|
constructor(e) {
|
|
570
562
|
this.parser = e, this.name = y.KHR_MATERIALS_DISPERSION;
|
|
571
563
|
}
|
|
572
564
|
getMaterialType(e) {
|
|
573
|
-
const
|
|
574
|
-
return !
|
|
565
|
+
const s = this.parser.json.materials[e];
|
|
566
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
575
567
|
}
|
|
576
568
|
extendMaterialParams(e, t) {
|
|
577
|
-
const
|
|
578
|
-
if (!
|
|
569
|
+
const n = this.parser.json.materials[e];
|
|
570
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
579
571
|
return Promise.resolve();
|
|
580
|
-
const i =
|
|
572
|
+
const i = n.extensions[this.name];
|
|
581
573
|
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
582
574
|
}
|
|
583
575
|
}
|
|
584
|
-
class
|
|
576
|
+
class Vt {
|
|
585
577
|
constructor(e) {
|
|
586
578
|
this.parser = e, this.name = y.KHR_MATERIALS_IRIDESCENCE;
|
|
587
579
|
}
|
|
588
580
|
getMaterialType(e) {
|
|
589
|
-
const
|
|
590
|
-
return !
|
|
581
|
+
const s = this.parser.json.materials[e];
|
|
582
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
591
583
|
}
|
|
592
584
|
extendMaterialParams(e, t) {
|
|
593
|
-
const
|
|
594
|
-
if (!
|
|
585
|
+
const s = this.parser, n = s.json.materials[e];
|
|
586
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
595
587
|
return Promise.resolve();
|
|
596
|
-
const i = [], o =
|
|
597
|
-
return o.iridescenceFactor !== void 0 && (t.iridescence = o.iridescenceFactor), o.iridescenceTexture !== void 0 && i.push(
|
|
588
|
+
const i = [], o = n.extensions[this.name];
|
|
589
|
+
return o.iridescenceFactor !== void 0 && (t.iridescence = o.iridescenceFactor), o.iridescenceTexture !== void 0 && i.push(s.assignTexture(t, "iridescenceMap", o.iridescenceTexture)), o.iridescenceIor !== void 0 && (t.iridescenceIOR = o.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), o.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = o.iridescenceThicknessMinimum), o.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = o.iridescenceThicknessMaximum), o.iridescenceThicknessTexture !== void 0 && i.push(s.assignTexture(t, "iridescenceThicknessMap", o.iridescenceThicknessTexture)), Promise.all(i);
|
|
598
590
|
}
|
|
599
591
|
}
|
|
600
|
-
class
|
|
592
|
+
class zt {
|
|
601
593
|
constructor(e) {
|
|
602
594
|
this.parser = e, this.name = y.KHR_MATERIALS_SHEEN;
|
|
603
595
|
}
|
|
604
596
|
getMaterialType(e) {
|
|
605
|
-
const
|
|
606
|
-
return !
|
|
597
|
+
const s = this.parser.json.materials[e];
|
|
598
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
607
599
|
}
|
|
608
600
|
extendMaterialParams(e, t) {
|
|
609
|
-
const
|
|
610
|
-
if (!
|
|
601
|
+
const s = this.parser, n = s.json.materials[e];
|
|
602
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
611
603
|
return Promise.resolve();
|
|
612
604
|
const i = [];
|
|
613
605
|
t.sheenColor = new H(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
614
|
-
const o =
|
|
606
|
+
const o = n.extensions[this.name];
|
|
615
607
|
if (o.sheenColorFactor !== void 0) {
|
|
616
608
|
const r = o.sheenColorFactor;
|
|
617
609
|
t.sheenColor.setRGB(r[0], r[1], r[2], C);
|
|
618
610
|
}
|
|
619
|
-
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && i.push(
|
|
611
|
+
return o.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = o.sheenRoughnessFactor), o.sheenColorTexture !== void 0 && i.push(s.assignTexture(t, "sheenColorMap", o.sheenColorTexture, Y)), o.sheenRoughnessTexture !== void 0 && i.push(s.assignTexture(t, "sheenRoughnessMap", o.sheenRoughnessTexture)), Promise.all(i);
|
|
620
612
|
}
|
|
621
613
|
}
|
|
622
|
-
class
|
|
614
|
+
class Xt {
|
|
623
615
|
constructor(e) {
|
|
624
616
|
this.parser = e, this.name = y.KHR_MATERIALS_TRANSMISSION;
|
|
625
617
|
}
|
|
626
618
|
getMaterialType(e) {
|
|
627
|
-
const
|
|
628
|
-
return !
|
|
619
|
+
const s = this.parser.json.materials[e];
|
|
620
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
629
621
|
}
|
|
630
622
|
extendMaterialParams(e, t) {
|
|
631
|
-
const
|
|
632
|
-
if (!
|
|
623
|
+
const s = this.parser, n = s.json.materials[e];
|
|
624
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
633
625
|
return Promise.resolve();
|
|
634
|
-
const i = [], o =
|
|
635
|
-
return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && i.push(
|
|
626
|
+
const i = [], o = n.extensions[this.name];
|
|
627
|
+
return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && i.push(s.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(i);
|
|
636
628
|
}
|
|
637
629
|
}
|
|
638
|
-
class
|
|
630
|
+
class Yt {
|
|
639
631
|
constructor(e) {
|
|
640
632
|
this.parser = e, this.name = y.KHR_MATERIALS_VOLUME;
|
|
641
633
|
}
|
|
642
634
|
getMaterialType(e) {
|
|
643
|
-
const
|
|
644
|
-
return !
|
|
635
|
+
const s = this.parser.json.materials[e];
|
|
636
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
645
637
|
}
|
|
646
638
|
extendMaterialParams(e, t) {
|
|
647
|
-
const
|
|
648
|
-
if (!
|
|
639
|
+
const s = this.parser, n = s.json.materials[e];
|
|
640
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
649
641
|
return Promise.resolve();
|
|
650
|
-
const i = [], o =
|
|
651
|
-
t.thickness = o.thicknessFactor !== void 0 ? o.thicknessFactor : 0, o.thicknessTexture !== void 0 && i.push(
|
|
642
|
+
const i = [], o = n.extensions[this.name];
|
|
643
|
+
t.thickness = o.thicknessFactor !== void 0 ? o.thicknessFactor : 0, o.thicknessTexture !== void 0 && i.push(s.assignTexture(t, "thicknessMap", o.thicknessTexture)), t.attenuationDistance = o.attenuationDistance || 1 / 0;
|
|
652
644
|
const r = o.attenuationColor || [1, 1, 1];
|
|
653
645
|
return t.attenuationColor = new H().setRGB(r[0], r[1], r[2], C), Promise.all(i);
|
|
654
646
|
}
|
|
655
647
|
}
|
|
656
|
-
class
|
|
648
|
+
class Wt {
|
|
657
649
|
constructor(e) {
|
|
658
650
|
this.parser = e, this.name = y.KHR_MATERIALS_IOR;
|
|
659
651
|
}
|
|
660
652
|
getMaterialType(e) {
|
|
661
|
-
const
|
|
662
|
-
return !
|
|
653
|
+
const s = this.parser.json.materials[e];
|
|
654
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
663
655
|
}
|
|
664
656
|
extendMaterialParams(e, t) {
|
|
665
|
-
const
|
|
666
|
-
if (!
|
|
657
|
+
const n = this.parser.json.materials[e];
|
|
658
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
667
659
|
return Promise.resolve();
|
|
668
|
-
const i =
|
|
660
|
+
const i = n.extensions[this.name];
|
|
669
661
|
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
670
662
|
}
|
|
671
663
|
}
|
|
672
|
-
class
|
|
664
|
+
class Zt {
|
|
673
665
|
constructor(e) {
|
|
674
666
|
this.parser = e, this.name = y.KHR_MATERIALS_SPECULAR;
|
|
675
667
|
}
|
|
676
668
|
getMaterialType(e) {
|
|
677
|
-
const
|
|
678
|
-
return !
|
|
669
|
+
const s = this.parser.json.materials[e];
|
|
670
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
679
671
|
}
|
|
680
672
|
extendMaterialParams(e, t) {
|
|
681
|
-
const
|
|
682
|
-
if (!
|
|
673
|
+
const s = this.parser, n = s.json.materials[e];
|
|
674
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
683
675
|
return Promise.resolve();
|
|
684
|
-
const i = [], o =
|
|
685
|
-
t.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && i.push(
|
|
676
|
+
const i = [], o = n.extensions[this.name];
|
|
677
|
+
t.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && i.push(s.assignTexture(t, "specularIntensityMap", o.specularTexture));
|
|
686
678
|
const r = o.specularColorFactor || [1, 1, 1];
|
|
687
|
-
return t.specularColor = new H().setRGB(r[0], r[1], r[2], C), o.specularColorTexture !== void 0 && i.push(
|
|
679
|
+
return t.specularColor = new H().setRGB(r[0], r[1], r[2], C), o.specularColorTexture !== void 0 && i.push(s.assignTexture(t, "specularColorMap", o.specularColorTexture, Y)), Promise.all(i);
|
|
688
680
|
}
|
|
689
681
|
}
|
|
690
|
-
class
|
|
682
|
+
class qt {
|
|
691
683
|
constructor(e) {
|
|
692
684
|
this.parser = e, this.name = y.EXT_MATERIALS_BUMP;
|
|
693
685
|
}
|
|
694
686
|
getMaterialType(e) {
|
|
695
|
-
const
|
|
696
|
-
return !
|
|
687
|
+
const s = this.parser.json.materials[e];
|
|
688
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
697
689
|
}
|
|
698
690
|
extendMaterialParams(e, t) {
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
691
|
+
const s = this.parser, n = s.json.materials[e];
|
|
692
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
701
693
|
return Promise.resolve();
|
|
702
|
-
const i = [], o =
|
|
703
|
-
return t.bumpScale = o.bumpFactor !== void 0 ? o.bumpFactor : 1, o.bumpTexture !== void 0 && i.push(
|
|
694
|
+
const i = [], o = n.extensions[this.name];
|
|
695
|
+
return t.bumpScale = o.bumpFactor !== void 0 ? o.bumpFactor : 1, o.bumpTexture !== void 0 && i.push(s.assignTexture(t, "bumpMap", o.bumpTexture)), Promise.all(i);
|
|
704
696
|
}
|
|
705
697
|
}
|
|
706
|
-
class
|
|
698
|
+
class Qt {
|
|
707
699
|
constructor(e) {
|
|
708
700
|
this.parser = e, this.name = y.KHR_MATERIALS_ANISOTROPY;
|
|
709
701
|
}
|
|
710
702
|
getMaterialType(e) {
|
|
711
|
-
const
|
|
712
|
-
return !
|
|
703
|
+
const s = this.parser.json.materials[e];
|
|
704
|
+
return !s.extensions || !s.extensions[this.name] ? null : O;
|
|
713
705
|
}
|
|
714
706
|
extendMaterialParams(e, t) {
|
|
715
|
-
const
|
|
716
|
-
if (!
|
|
707
|
+
const s = this.parser, n = s.json.materials[e];
|
|
708
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
717
709
|
return Promise.resolve();
|
|
718
|
-
const i = [], o =
|
|
719
|
-
return o.anisotropyStrength !== void 0 && (t.anisotropy = o.anisotropyStrength), o.anisotropyRotation !== void 0 && (t.anisotropyRotation = o.anisotropyRotation), o.anisotropyTexture !== void 0 && i.push(
|
|
710
|
+
const i = [], o = n.extensions[this.name];
|
|
711
|
+
return o.anisotropyStrength !== void 0 && (t.anisotropy = o.anisotropyStrength), o.anisotropyRotation !== void 0 && (t.anisotropyRotation = o.anisotropyRotation), o.anisotropyTexture !== void 0 && i.push(s.assignTexture(t, "anisotropyMap", o.anisotropyTexture)), Promise.all(i);
|
|
720
712
|
}
|
|
721
713
|
}
|
|
722
|
-
class
|
|
714
|
+
class $t {
|
|
723
715
|
constructor(e) {
|
|
724
716
|
this.parser = e, this.name = y.KHR_TEXTURE_BASISU;
|
|
725
717
|
}
|
|
726
718
|
loadTexture(e) {
|
|
727
|
-
const t = this.parser,
|
|
728
|
-
if (!
|
|
719
|
+
const t = this.parser, s = t.json, n = s.textures[e];
|
|
720
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
729
721
|
return null;
|
|
730
|
-
const i =
|
|
722
|
+
const i = n.extensions[this.name], o = t.options.ktx2Loader;
|
|
731
723
|
if (!o) {
|
|
732
|
-
if (
|
|
724
|
+
if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
|
|
733
725
|
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
734
726
|
return null;
|
|
735
727
|
}
|
|
736
728
|
return t.loadTextureImage(e, i.source, o);
|
|
737
729
|
}
|
|
738
730
|
}
|
|
739
|
-
class
|
|
731
|
+
class Jt {
|
|
740
732
|
constructor(e) {
|
|
741
733
|
this.parser = e, this.name = y.EXT_TEXTURE_WEBP;
|
|
742
734
|
}
|
|
743
735
|
loadTexture(e) {
|
|
744
|
-
const t = this.name,
|
|
736
|
+
const t = this.name, s = this.parser, n = s.json, i = n.textures[e];
|
|
745
737
|
if (!i.extensions || !i.extensions[t])
|
|
746
738
|
return null;
|
|
747
|
-
const o = i.extensions[t], r =
|
|
748
|
-
let a =
|
|
739
|
+
const o = i.extensions[t], r = n.images[o.source];
|
|
740
|
+
let a = s.textureLoader;
|
|
749
741
|
if (r.uri) {
|
|
750
|
-
const c =
|
|
742
|
+
const c = s.options.manager.getHandler(r.uri);
|
|
751
743
|
c !== null && (a = c);
|
|
752
744
|
}
|
|
753
|
-
return
|
|
745
|
+
return s.loadTextureImage(e, o.source, a);
|
|
754
746
|
}
|
|
755
747
|
}
|
|
756
|
-
class
|
|
748
|
+
class es {
|
|
757
749
|
constructor(e) {
|
|
758
750
|
this.parser = e, this.name = y.EXT_TEXTURE_AVIF;
|
|
759
751
|
}
|
|
760
752
|
loadTexture(e) {
|
|
761
|
-
const t = this.name,
|
|
753
|
+
const t = this.name, s = this.parser, n = s.json, i = n.textures[e];
|
|
762
754
|
if (!i.extensions || !i.extensions[t])
|
|
763
755
|
return null;
|
|
764
|
-
const o = i.extensions[t], r =
|
|
765
|
-
let a =
|
|
756
|
+
const o = i.extensions[t], r = n.images[o.source];
|
|
757
|
+
let a = s.textureLoader;
|
|
766
758
|
if (r.uri) {
|
|
767
|
-
const c =
|
|
759
|
+
const c = s.options.manager.getHandler(r.uri);
|
|
768
760
|
c !== null && (a = c);
|
|
769
761
|
}
|
|
770
|
-
return
|
|
762
|
+
return s.loadTextureImage(e, o.source, a);
|
|
771
763
|
}
|
|
772
764
|
}
|
|
773
|
-
class
|
|
765
|
+
class ts {
|
|
774
766
|
constructor(e) {
|
|
775
767
|
this.name = y.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
776
768
|
}
|
|
777
769
|
loadBufferView(e) {
|
|
778
|
-
const t = this.parser.json,
|
|
779
|
-
if (
|
|
780
|
-
const
|
|
770
|
+
const t = this.parser.json, s = t.bufferViews[e];
|
|
771
|
+
if (s.extensions && s.extensions[this.name]) {
|
|
772
|
+
const n = s.extensions[this.name], i = this.parser.getDependency("buffer", n.buffer), o = this.parser.options.meshoptDecoder;
|
|
781
773
|
if (!o || !o.supported) {
|
|
782
774
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
|
|
783
775
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
784
776
|
return null;
|
|
785
777
|
}
|
|
786
778
|
return i.then(function(r) {
|
|
787
|
-
const a =
|
|
788
|
-
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(
|
|
779
|
+
const a = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, h = n.byteStride, d = new Uint8Array(r, a, c);
|
|
780
|
+
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, h, d, n.mode, n.filter).then(function(p) {
|
|
789
781
|
return p.buffer;
|
|
790
782
|
}) : o.ready.then(function() {
|
|
791
|
-
const p = new ArrayBuffer(
|
|
792
|
-
return o.decodeGltfBuffer(new Uint8Array(p),
|
|
783
|
+
const p = new ArrayBuffer(u * h);
|
|
784
|
+
return o.decodeGltfBuffer(new Uint8Array(p), u, h, d, n.mode, n.filter), p;
|
|
793
785
|
});
|
|
794
786
|
});
|
|
795
787
|
} else
|
|
796
788
|
return null;
|
|
797
789
|
}
|
|
798
790
|
}
|
|
799
|
-
class
|
|
791
|
+
class ss {
|
|
800
792
|
constructor(e) {
|
|
801
793
|
this.name = y.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
802
794
|
}
|
|
803
795
|
createNodeMesh(e) {
|
|
804
|
-
const t = this.parser.json,
|
|
805
|
-
if (!
|
|
796
|
+
const t = this.parser.json, s = t.nodes[e];
|
|
797
|
+
if (!s.extensions || !s.extensions[this.name] || s.mesh === void 0)
|
|
806
798
|
return null;
|
|
807
|
-
const
|
|
808
|
-
for (const c of
|
|
799
|
+
const n = t.meshes[s.mesh];
|
|
800
|
+
for (const c of n.primitives)
|
|
809
801
|
if (c.mode !== L.TRIANGLES && c.mode !== L.TRIANGLE_STRIP && c.mode !== L.TRIANGLE_FAN && c.mode !== void 0)
|
|
810
802
|
return null;
|
|
811
|
-
const o =
|
|
803
|
+
const o = s.extensions[this.name].attributes, r = [], a = {};
|
|
812
804
|
for (const c in o)
|
|
813
|
-
r.push(this.parser.getDependency("accessor", o[c]).then((
|
|
805
|
+
r.push(this.parser.getDependency("accessor", o[c]).then((u) => (a[c] = u, a[c])));
|
|
814
806
|
return r.length < 1 ? null : (r.push(this.parser.createNodeMesh(e)), Promise.all(r).then((c) => {
|
|
815
|
-
const
|
|
816
|
-
for (const m of
|
|
817
|
-
const g = new q(), f = new M(), _ = new Q(), x = new M(1, 1, 1), b = new
|
|
807
|
+
const u = c.pop(), h = u.isGroup ? u.children : [u], d = c[0].count, p = [];
|
|
808
|
+
for (const m of h) {
|
|
809
|
+
const g = new q(), f = new M(), _ = new Q(), x = new M(1, 1, 1), b = new et(m.geometry, m.material, d);
|
|
818
810
|
for (let T = 0; T < d; T++)
|
|
819
811
|
a.TRANSLATION && f.fromBufferAttribute(a.TRANSLATION, T), a.ROTATION && _.fromBufferAttribute(a.ROTATION, T), a.SCALE && x.fromBufferAttribute(a.SCALE, T), b.setMatrixAt(T, g.compose(f, _, x));
|
|
820
812
|
for (const T in a)
|
|
821
813
|
if (T === "_COLOR_0") {
|
|
822
814
|
const A = a[T];
|
|
823
|
-
b.instanceColor = new
|
|
815
|
+
b.instanceColor = new tt(A.array, A.itemSize, A.normalized);
|
|
824
816
|
} else T !== "TRANSLATION" && T !== "ROTATION" && T !== "SCALE" && m.geometry.setAttribute(T, a[T]);
|
|
825
|
-
|
|
817
|
+
ve.prototype.copy.call(b, m), this.parser.assignFinalMaterial(b), p.push(b);
|
|
826
818
|
}
|
|
827
|
-
return
|
|
819
|
+
return u.isGroup ? (u.clear(), u.add(...p), u) : p[0];
|
|
828
820
|
}));
|
|
829
821
|
}
|
|
830
822
|
}
|
|
831
|
-
const
|
|
832
|
-
class
|
|
823
|
+
const Ke = "glTF", V = 12, Se = { JSON: 1313821514, BIN: 5130562 };
|
|
824
|
+
class ns {
|
|
833
825
|
constructor(e) {
|
|
834
826
|
this.name = y.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
835
|
-
const t = new DataView(e, 0, V),
|
|
827
|
+
const t = new DataView(e, 0, V), s = new TextDecoder();
|
|
836
828
|
if (this.header = {
|
|
837
|
-
magic:
|
|
829
|
+
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
838
830
|
version: t.getUint32(4, !0),
|
|
839
831
|
length: t.getUint32(8, !0)
|
|
840
|
-
}, this.header.magic !==
|
|
832
|
+
}, this.header.magic !== Ke)
|
|
841
833
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
842
834
|
if (this.header.version < 2)
|
|
843
835
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
844
|
-
const
|
|
836
|
+
const n = this.header.length - V, i = new DataView(e, V);
|
|
845
837
|
let o = 0;
|
|
846
|
-
for (; o <
|
|
838
|
+
for (; o < n; ) {
|
|
847
839
|
const r = i.getUint32(o, !0);
|
|
848
840
|
o += 4;
|
|
849
841
|
const a = i.getUint32(o, !0);
|
|
850
842
|
if (o += 4, a === Se.JSON) {
|
|
851
843
|
const c = new Uint8Array(e, V + o, r);
|
|
852
|
-
this.content =
|
|
844
|
+
this.content = s.decode(c);
|
|
853
845
|
} else if (a === Se.BIN) {
|
|
854
846
|
const c = V + o;
|
|
855
847
|
this.body = e.slice(c, c + r);
|
|
@@ -860,39 +852,39 @@ class is {
|
|
|
860
852
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
861
853
|
}
|
|
862
854
|
}
|
|
863
|
-
class
|
|
855
|
+
class is {
|
|
864
856
|
constructor(e, t) {
|
|
865
857
|
if (!t)
|
|
866
858
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
867
859
|
this.name = y.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
868
860
|
}
|
|
869
861
|
decodePrimitive(e, t) {
|
|
870
|
-
const
|
|
871
|
-
for (const
|
|
872
|
-
const
|
|
873
|
-
r[
|
|
862
|
+
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, r = {}, a = {}, c = {};
|
|
863
|
+
for (const u in o) {
|
|
864
|
+
const h = de[u] || u.toLowerCase();
|
|
865
|
+
r[h] = o[u];
|
|
874
866
|
}
|
|
875
|
-
for (const
|
|
876
|
-
const
|
|
877
|
-
if (o[
|
|
878
|
-
const d =
|
|
879
|
-
c[
|
|
867
|
+
for (const u in e.attributes) {
|
|
868
|
+
const h = de[u] || u.toLowerCase();
|
|
869
|
+
if (o[u] !== void 0) {
|
|
870
|
+
const d = s.accessors[e.attributes[u]], p = K[d.componentType];
|
|
871
|
+
c[h] = p.name, a[h] = d.normalized === !0;
|
|
880
872
|
}
|
|
881
873
|
}
|
|
882
|
-
return t.getDependency("bufferView", i).then(function(
|
|
883
|
-
return new Promise(function(
|
|
884
|
-
|
|
874
|
+
return t.getDependency("bufferView", i).then(function(u) {
|
|
875
|
+
return new Promise(function(h, d) {
|
|
876
|
+
n.decodeDracoFile(u, function(p) {
|
|
885
877
|
for (const m in p.attributes) {
|
|
886
878
|
const g = p.attributes[m], f = a[m];
|
|
887
879
|
f !== void 0 && (g.normalized = f);
|
|
888
880
|
}
|
|
889
|
-
|
|
881
|
+
h(p);
|
|
890
882
|
}, r, c, C, d);
|
|
891
883
|
});
|
|
892
884
|
});
|
|
893
885
|
}
|
|
894
886
|
}
|
|
895
|
-
class
|
|
887
|
+
class os {
|
|
896
888
|
constructor() {
|
|
897
889
|
this.name = y.KHR_TEXTURE_TRANSFORM;
|
|
898
890
|
}
|
|
@@ -900,35 +892,35 @@ class rs {
|
|
|
900
892
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (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;
|
|
901
893
|
}
|
|
902
894
|
}
|
|
903
|
-
class
|
|
895
|
+
class rs {
|
|
904
896
|
constructor() {
|
|
905
897
|
this.name = y.KHR_MESH_QUANTIZATION;
|
|
906
898
|
}
|
|
907
899
|
}
|
|
908
|
-
class
|
|
909
|
-
constructor(e, t,
|
|
910
|
-
super(e, t,
|
|
900
|
+
class Be extends Pt {
|
|
901
|
+
constructor(e, t, s, n) {
|
|
902
|
+
super(e, t, s, n);
|
|
911
903
|
}
|
|
912
904
|
copySampleValue_(e) {
|
|
913
|
-
const t = this.resultBuffer,
|
|
914
|
-
for (let o = 0; o !==
|
|
915
|
-
t[o] =
|
|
905
|
+
const t = this.resultBuffer, s = this.sampleValues, n = this.valueSize, i = e * n * 3 + n;
|
|
906
|
+
for (let o = 0; o !== n; o++)
|
|
907
|
+
t[o] = s[i + o];
|
|
916
908
|
return t;
|
|
917
909
|
}
|
|
918
|
-
interpolate_(e, t,
|
|
919
|
-
const i = this.resultBuffer, o = this.sampleValues, r = this.valueSize, a = r * 2, c = r * 3,
|
|
910
|
+
interpolate_(e, t, s, n) {
|
|
911
|
+
const i = this.resultBuffer, o = this.sampleValues, r = this.valueSize, a = r * 2, c = r * 3, u = n - t, h = (s - t) / u, d = h * h, p = d * h, m = e * c, g = m - c, f = -2 * p + 3 * d, _ = p - d, x = 1 - f, b = _ - d + h;
|
|
920
912
|
for (let T = 0; T !== r; T++) {
|
|
921
|
-
const A = o[g + T + r], I = o[g + T + a] *
|
|
913
|
+
const A = o[g + T + r], I = o[g + T + a] * u, P = o[m + T + r], B = o[m + T] * u;
|
|
922
914
|
i[T] = x * A + b * I + f * P + _ * B;
|
|
923
915
|
}
|
|
924
916
|
return i;
|
|
925
917
|
}
|
|
926
918
|
}
|
|
927
|
-
const
|
|
928
|
-
class
|
|
929
|
-
interpolate_(e, t,
|
|
930
|
-
const i = super.interpolate_(e, t,
|
|
931
|
-
return
|
|
919
|
+
const as = new Q();
|
|
920
|
+
class cs extends Be {
|
|
921
|
+
interpolate_(e, t, s, n) {
|
|
922
|
+
const i = super.interpolate_(e, t, s, n);
|
|
923
|
+
return as.fromArray(i).normalize().toArray(i), i;
|
|
932
924
|
}
|
|
933
925
|
}
|
|
934
926
|
const L = {
|
|
@@ -947,15 +939,15 @@ const L = {
|
|
|
947
939
|
5125: Uint32Array,
|
|
948
940
|
5126: Float32Array
|
|
949
941
|
}, Ae = {
|
|
950
|
-
9728:
|
|
942
|
+
9728: je,
|
|
951
943
|
9729: le,
|
|
952
|
-
9984:
|
|
953
|
-
9985:
|
|
954
|
-
9986:
|
|
955
|
-
9987:
|
|
944
|
+
9984: ct,
|
|
945
|
+
9985: at,
|
|
946
|
+
9986: rt,
|
|
947
|
+
9987: ke
|
|
956
948
|
}, Le = {
|
|
957
|
-
33071:
|
|
958
|
-
33648:
|
|
949
|
+
33071: ht,
|
|
950
|
+
33648: lt,
|
|
959
951
|
10497: he
|
|
960
952
|
}, ie = {
|
|
961
953
|
SCALAR: 1,
|
|
@@ -981,55 +973,55 @@ const L = {
|
|
|
981
973
|
translation: "position",
|
|
982
974
|
rotation: "quaternion",
|
|
983
975
|
weights: "morphTargetInfluences"
|
|
984
|
-
},
|
|
976
|
+
}, ls = {
|
|
985
977
|
CUBICSPLINE: void 0,
|
|
986
978
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
987
979
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
988
980
|
LINEAR: Ge,
|
|
989
|
-
STEP:
|
|
981
|
+
STEP: At
|
|
990
982
|
}, oe = {
|
|
991
983
|
OPAQUE: "OPAQUE",
|
|
992
984
|
MASK: "MASK",
|
|
993
985
|
BLEND: "BLEND"
|
|
994
986
|
};
|
|
995
|
-
function
|
|
996
|
-
return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new
|
|
987
|
+
function hs(l) {
|
|
988
|
+
return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new Fe({
|
|
997
989
|
color: 16777215,
|
|
998
990
|
emissive: 0,
|
|
999
991
|
metalness: 1,
|
|
1000
992
|
roughness: 1,
|
|
1001
993
|
transparent: !1,
|
|
1002
994
|
depthTest: !0,
|
|
1003
|
-
side:
|
|
995
|
+
side: Lt
|
|
1004
996
|
})), l.DefaultMaterial;
|
|
1005
997
|
}
|
|
1006
998
|
function j(l, e, t) {
|
|
1007
|
-
for (const
|
|
1008
|
-
l[
|
|
999
|
+
for (const s in t.extensions)
|
|
1000
|
+
l[s] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[s] = t.extensions[s]);
|
|
1009
1001
|
}
|
|
1010
1002
|
function D(l, e) {
|
|
1011
1003
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(l.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1012
1004
|
}
|
|
1013
|
-
function
|
|
1014
|
-
let
|
|
1015
|
-
for (let c = 0,
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1005
|
+
function us(l, e, t) {
|
|
1006
|
+
let s = !1, n = !1, i = !1;
|
|
1007
|
+
for (let c = 0, u = e.length; c < u; c++) {
|
|
1008
|
+
const h = e[c];
|
|
1009
|
+
if (h.POSITION !== void 0 && (s = !0), h.NORMAL !== void 0 && (n = !0), h.COLOR_0 !== void 0 && (i = !0), s && n && i) break;
|
|
1018
1010
|
}
|
|
1019
|
-
if (!
|
|
1011
|
+
if (!s && !n && !i) return Promise.resolve(l);
|
|
1020
1012
|
const o = [], r = [], a = [];
|
|
1021
|
-
for (let c = 0,
|
|
1022
|
-
const
|
|
1023
|
-
if (
|
|
1024
|
-
const d =
|
|
1013
|
+
for (let c = 0, u = e.length; c < u; c++) {
|
|
1014
|
+
const h = e[c];
|
|
1015
|
+
if (s) {
|
|
1016
|
+
const d = h.POSITION !== void 0 ? t.getDependency("accessor", h.POSITION) : l.attributes.position;
|
|
1025
1017
|
o.push(d);
|
|
1026
1018
|
}
|
|
1027
|
-
if (
|
|
1028
|
-
const d =
|
|
1019
|
+
if (n) {
|
|
1020
|
+
const d = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : l.attributes.normal;
|
|
1029
1021
|
r.push(d);
|
|
1030
1022
|
}
|
|
1031
1023
|
if (i) {
|
|
1032
|
-
const d =
|
|
1024
|
+
const d = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : l.attributes.color;
|
|
1033
1025
|
a.push(d);
|
|
1034
1026
|
}
|
|
1035
1027
|
}
|
|
@@ -1038,37 +1030,37 @@ function ds(l, e, t) {
|
|
|
1038
1030
|
Promise.all(r),
|
|
1039
1031
|
Promise.all(a)
|
|
1040
1032
|
]).then(function(c) {
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1033
|
+
const u = c[0], h = c[1], d = c[2];
|
|
1034
|
+
return s && (l.morphAttributes.position = u), n && (l.morphAttributes.normal = h), i && (l.morphAttributes.color = d), l.morphTargetsRelative = !0, l;
|
|
1043
1035
|
});
|
|
1044
1036
|
}
|
|
1045
|
-
function
|
|
1037
|
+
function ds(l, e) {
|
|
1046
1038
|
if (l.updateMorphTargets(), e.weights !== void 0)
|
|
1047
|
-
for (let t = 0,
|
|
1039
|
+
for (let t = 0, s = e.weights.length; t < s; t++)
|
|
1048
1040
|
l.morphTargetInfluences[t] = e.weights[t];
|
|
1049
1041
|
if (e.extras && Array.isArray(e.extras.targetNames)) {
|
|
1050
1042
|
const t = e.extras.targetNames;
|
|
1051
1043
|
if (l.morphTargetInfluences.length === t.length) {
|
|
1052
1044
|
l.morphTargetDictionary = {};
|
|
1053
|
-
for (let
|
|
1054
|
-
l.morphTargetDictionary[t[
|
|
1045
|
+
for (let s = 0, n = t.length; s < n; s++)
|
|
1046
|
+
l.morphTargetDictionary[t[s]] = s;
|
|
1055
1047
|
} else
|
|
1056
1048
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1057
1049
|
}
|
|
1058
1050
|
}
|
|
1059
|
-
function
|
|
1051
|
+
function ps(l) {
|
|
1060
1052
|
let e;
|
|
1061
1053
|
const t = l.extensions && l.extensions[y.KHR_DRACO_MESH_COMPRESSION];
|
|
1062
1054
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + re(t.attributes) : e = l.indices + ":" + re(l.attributes) + ":" + l.mode, l.targets !== void 0)
|
|
1063
|
-
for (let
|
|
1064
|
-
e += ":" + re(l.targets[
|
|
1055
|
+
for (let s = 0, n = l.targets.length; s < n; s++)
|
|
1056
|
+
e += ":" + re(l.targets[s]);
|
|
1065
1057
|
return e;
|
|
1066
1058
|
}
|
|
1067
1059
|
function re(l) {
|
|
1068
1060
|
let e = "";
|
|
1069
1061
|
const t = Object.keys(l).sort();
|
|
1070
|
-
for (let
|
|
1071
|
-
e += t[
|
|
1062
|
+
for (let s = 0, n = t.length; s < n; s++)
|
|
1063
|
+
e += t[s] + ":" + l[t[s]] + ";";
|
|
1072
1064
|
return e;
|
|
1073
1065
|
}
|
|
1074
1066
|
function pe(l) {
|
|
@@ -1085,21 +1077,21 @@ function pe(l) {
|
|
|
1085
1077
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1086
1078
|
}
|
|
1087
1079
|
}
|
|
1088
|
-
function
|
|
1080
|
+
function fs(l) {
|
|
1089
1081
|
return l.search(/\.jpe?g($|\?)/i) > 0 || l.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : l.search(/\.webp($|\?)/i) > 0 || l.search(/^data\:image\/webp/) === 0 ? "image/webp" : l.search(/\.ktx2($|\?)/i) > 0 || l.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1090
1082
|
}
|
|
1091
|
-
const
|
|
1092
|
-
class
|
|
1083
|
+
const ms = new q();
|
|
1084
|
+
class _s {
|
|
1093
1085
|
constructor(e = {}, t = {}) {
|
|
1094
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1095
|
-
let
|
|
1086
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Ft(), 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 = {};
|
|
1087
|
+
let s = !1, n = -1, i = !1, o = -1;
|
|
1096
1088
|
if (typeof navigator < "u") {
|
|
1097
1089
|
const r = navigator.userAgent;
|
|
1098
|
-
|
|
1090
|
+
s = /^((?!chrome|android).)*safari/i.test(r) === !0;
|
|
1099
1091
|
const a = r.match(/Version\/(\d+)/);
|
|
1100
|
-
|
|
1092
|
+
n = s && a ? parseInt(a[1], 10) : -1, i = r.indexOf("Firefox") > -1, o = i ? r.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1101
1093
|
}
|
|
1102
|
-
typeof createImageBitmap > "u" ||
|
|
1094
|
+
typeof createImageBitmap > "u" || s && n < 17 || i && o < 98 ? this.textureLoader = new st(this.options.manager) : this.textureLoader = new nt(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Ie(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1103
1095
|
}
|
|
1104
1096
|
setExtensions(e) {
|
|
1105
1097
|
this.extensions = e;
|
|
@@ -1108,28 +1100,28 @@ class gs {
|
|
|
1108
1100
|
this.plugins = e;
|
|
1109
1101
|
}
|
|
1110
1102
|
parse(e, t) {
|
|
1111
|
-
const
|
|
1103
|
+
const s = this, n = this.json, i = this.extensions;
|
|
1112
1104
|
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(o) {
|
|
1113
1105
|
return o._markDefs && o._markDefs();
|
|
1114
1106
|
}), Promise.all(this._invokeAll(function(o) {
|
|
1115
1107
|
return o.beforeRoot && o.beforeRoot();
|
|
1116
1108
|
})).then(function() {
|
|
1117
1109
|
return Promise.all([
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1110
|
+
s.getDependencies("scene"),
|
|
1111
|
+
s.getDependencies("animation"),
|
|
1112
|
+
s.getDependencies("camera")
|
|
1121
1113
|
]);
|
|
1122
1114
|
}).then(function(o) {
|
|
1123
1115
|
const r = {
|
|
1124
|
-
scene: o[0][
|
|
1116
|
+
scene: o[0][n.scene || 0],
|
|
1125
1117
|
scenes: o[0],
|
|
1126
1118
|
animations: o[1],
|
|
1127
1119
|
cameras: o[2],
|
|
1128
|
-
asset:
|
|
1129
|
-
parser:
|
|
1120
|
+
asset: n.asset,
|
|
1121
|
+
parser: s,
|
|
1130
1122
|
userData: {}
|
|
1131
1123
|
};
|
|
1132
|
-
return j(i, r,
|
|
1124
|
+
return j(i, r, n), D(r, n), Promise.all(s._invokeAll(function(a) {
|
|
1133
1125
|
return a.afterRoot && a.afterRoot(r);
|
|
1134
1126
|
})).then(function() {
|
|
1135
1127
|
for (const a of r.scenes)
|
|
@@ -1144,15 +1136,15 @@ class gs {
|
|
|
1144
1136
|
* @private
|
|
1145
1137
|
*/
|
|
1146
1138
|
_markDefs() {
|
|
1147
|
-
const e = this.json.nodes || [], t = this.json.skins || [],
|
|
1148
|
-
for (let
|
|
1149
|
-
const o = t[
|
|
1139
|
+
const e = this.json.nodes || [], t = this.json.skins || [], s = this.json.meshes || [];
|
|
1140
|
+
for (let n = 0, i = t.length; n < i; n++) {
|
|
1141
|
+
const o = t[n].joints;
|
|
1150
1142
|
for (let r = 0, a = o.length; r < a; r++)
|
|
1151
1143
|
e[o[r]].isBone = !0;
|
|
1152
1144
|
}
|
|
1153
|
-
for (let
|
|
1154
|
-
const o = e[
|
|
1155
|
-
o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (
|
|
1145
|
+
for (let n = 0, i = e.length; n < i; n++) {
|
|
1146
|
+
const o = e[n];
|
|
1147
|
+
o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (s[o.mesh].isSkinnedMesh = !0)), o.camera !== void 0 && this._addNodeRef(this.cameraCache, o.camera);
|
|
1156
1148
|
}
|
|
1157
1149
|
}
|
|
1158
1150
|
/**
|
|
@@ -1180,34 +1172,34 @@ class gs {
|
|
|
1180
1172
|
* @param {Object} object
|
|
1181
1173
|
* @return {Object}
|
|
1182
1174
|
*/
|
|
1183
|
-
_getNodeRef(e, t,
|
|
1184
|
-
if (e.refs[t] <= 1) return
|
|
1185
|
-
const
|
|
1175
|
+
_getNodeRef(e, t, s) {
|
|
1176
|
+
if (e.refs[t] <= 1) return s;
|
|
1177
|
+
const n = s.clone(), i = (o, r) => {
|
|
1186
1178
|
const a = this.associations.get(o);
|
|
1187
1179
|
a != null && this.associations.set(r, a);
|
|
1188
|
-
for (const [c,
|
|
1189
|
-
i(
|
|
1180
|
+
for (const [c, u] of o.children.entries())
|
|
1181
|
+
i(u, r.children[c]);
|
|
1190
1182
|
};
|
|
1191
|
-
return i(
|
|
1183
|
+
return i(s, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
1192
1184
|
}
|
|
1193
1185
|
_invokeOne(e) {
|
|
1194
1186
|
const t = Object.values(this.plugins);
|
|
1195
1187
|
t.push(this);
|
|
1196
|
-
for (let
|
|
1197
|
-
const
|
|
1198
|
-
if (
|
|
1188
|
+
for (let s = 0; s < t.length; s++) {
|
|
1189
|
+
const n = e(t[s]);
|
|
1190
|
+
if (n) return n;
|
|
1199
1191
|
}
|
|
1200
1192
|
return null;
|
|
1201
1193
|
}
|
|
1202
1194
|
_invokeAll(e) {
|
|
1203
1195
|
const t = Object.values(this.plugins);
|
|
1204
1196
|
t.unshift(this);
|
|
1205
|
-
const
|
|
1206
|
-
for (let
|
|
1207
|
-
const i = e(t[
|
|
1208
|
-
i &&
|
|
1197
|
+
const s = [];
|
|
1198
|
+
for (let n = 0; n < t.length; n++) {
|
|
1199
|
+
const i = e(t[n]);
|
|
1200
|
+
i && s.push(i);
|
|
1209
1201
|
}
|
|
1210
|
-
return
|
|
1202
|
+
return s;
|
|
1211
1203
|
}
|
|
1212
1204
|
/**
|
|
1213
1205
|
* Requests the specified dependency asynchronously, with caching.
|
|
@@ -1218,65 +1210,65 @@ class gs {
|
|
|
1218
1210
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
1219
1211
|
*/
|
|
1220
1212
|
getDependency(e, t) {
|
|
1221
|
-
const
|
|
1222
|
-
let
|
|
1223
|
-
if (!
|
|
1213
|
+
const s = e + ":" + t;
|
|
1214
|
+
let n = this.cache.get(s);
|
|
1215
|
+
if (!n) {
|
|
1224
1216
|
switch (e) {
|
|
1225
1217
|
case "scene":
|
|
1226
|
-
|
|
1218
|
+
n = this.loadScene(t);
|
|
1227
1219
|
break;
|
|
1228
1220
|
case "node":
|
|
1229
|
-
|
|
1221
|
+
n = this._invokeOne(function(i) {
|
|
1230
1222
|
return i.loadNode && i.loadNode(t);
|
|
1231
1223
|
});
|
|
1232
1224
|
break;
|
|
1233
1225
|
case "mesh":
|
|
1234
|
-
|
|
1226
|
+
n = this._invokeOne(function(i) {
|
|
1235
1227
|
return i.loadMesh && i.loadMesh(t);
|
|
1236
1228
|
});
|
|
1237
1229
|
break;
|
|
1238
1230
|
case "accessor":
|
|
1239
|
-
|
|
1231
|
+
n = this.loadAccessor(t);
|
|
1240
1232
|
break;
|
|
1241
1233
|
case "bufferView":
|
|
1242
|
-
|
|
1234
|
+
n = this._invokeOne(function(i) {
|
|
1243
1235
|
return i.loadBufferView && i.loadBufferView(t);
|
|
1244
1236
|
});
|
|
1245
1237
|
break;
|
|
1246
1238
|
case "buffer":
|
|
1247
|
-
|
|
1239
|
+
n = this.loadBuffer(t);
|
|
1248
1240
|
break;
|
|
1249
1241
|
case "material":
|
|
1250
|
-
|
|
1242
|
+
n = this._invokeOne(function(i) {
|
|
1251
1243
|
return i.loadMaterial && i.loadMaterial(t);
|
|
1252
1244
|
});
|
|
1253
1245
|
break;
|
|
1254
1246
|
case "texture":
|
|
1255
|
-
|
|
1247
|
+
n = this._invokeOne(function(i) {
|
|
1256
1248
|
return i.loadTexture && i.loadTexture(t);
|
|
1257
1249
|
});
|
|
1258
1250
|
break;
|
|
1259
1251
|
case "skin":
|
|
1260
|
-
|
|
1252
|
+
n = this.loadSkin(t);
|
|
1261
1253
|
break;
|
|
1262
1254
|
case "animation":
|
|
1263
|
-
|
|
1255
|
+
n = this._invokeOne(function(i) {
|
|
1264
1256
|
return i.loadAnimation && i.loadAnimation(t);
|
|
1265
1257
|
});
|
|
1266
1258
|
break;
|
|
1267
1259
|
case "camera":
|
|
1268
|
-
|
|
1260
|
+
n = this.loadCamera(t);
|
|
1269
1261
|
break;
|
|
1270
1262
|
default:
|
|
1271
|
-
if (
|
|
1263
|
+
if (n = this._invokeOne(function(i) {
|
|
1272
1264
|
return i != this && i.getDependency && i.getDependency(e, t);
|
|
1273
|
-
}), !
|
|
1265
|
+
}), !n)
|
|
1274
1266
|
throw new Error("Unknown type: " + e);
|
|
1275
1267
|
break;
|
|
1276
1268
|
}
|
|
1277
|
-
this.cache.add(
|
|
1269
|
+
this.cache.add(s, n);
|
|
1278
1270
|
}
|
|
1279
|
-
return
|
|
1271
|
+
return n;
|
|
1280
1272
|
}
|
|
1281
1273
|
/**
|
|
1282
1274
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
@@ -1288,9 +1280,9 @@ class gs {
|
|
|
1288
1280
|
getDependencies(e) {
|
|
1289
1281
|
let t = this.cache.get(e);
|
|
1290
1282
|
if (!t) {
|
|
1291
|
-
const
|
|
1292
|
-
t = Promise.all(
|
|
1293
|
-
return
|
|
1283
|
+
const s = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1284
|
+
t = Promise.all(n.map(function(i, o) {
|
|
1285
|
+
return s.getDependency(e, o);
|
|
1294
1286
|
})), this.cache.add(e, t);
|
|
1295
1287
|
}
|
|
1296
1288
|
return t;
|
|
@@ -1303,14 +1295,14 @@ class gs {
|
|
|
1303
1295
|
* @return {Promise<ArrayBuffer>}
|
|
1304
1296
|
*/
|
|
1305
1297
|
loadBuffer(e) {
|
|
1306
|
-
const t = this.json.buffers[e],
|
|
1298
|
+
const t = this.json.buffers[e], s = this.fileLoader;
|
|
1307
1299
|
if (t.type && t.type !== "arraybuffer")
|
|
1308
1300
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1309
1301
|
if (t.uri === void 0 && e === 0)
|
|
1310
1302
|
return Promise.resolve(this.extensions[y.KHR_BINARY_GLTF].body);
|
|
1311
|
-
const
|
|
1303
|
+
const n = this.options;
|
|
1312
1304
|
return new Promise(function(i, o) {
|
|
1313
|
-
|
|
1305
|
+
s.load(X.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
1314
1306
|
o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1315
1307
|
});
|
|
1316
1308
|
});
|
|
@@ -1324,9 +1316,9 @@ class gs {
|
|
|
1324
1316
|
*/
|
|
1325
1317
|
loadBufferView(e) {
|
|
1326
1318
|
const t = this.json.bufferViews[e];
|
|
1327
|
-
return this.getDependency("buffer", t.buffer).then(function(
|
|
1328
|
-
const
|
|
1329
|
-
return
|
|
1319
|
+
return this.getDependency("buffer", t.buffer).then(function(s) {
|
|
1320
|
+
const n = t.byteLength || 0, i = t.byteOffset || 0;
|
|
1321
|
+
return s.slice(i, i + n);
|
|
1330
1322
|
});
|
|
1331
1323
|
}
|
|
1332
1324
|
/**
|
|
@@ -1337,23 +1329,23 @@ class gs {
|
|
|
1337
1329
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1338
1330
|
*/
|
|
1339
1331
|
loadAccessor(e) {
|
|
1340
|
-
const t = this,
|
|
1341
|
-
if (
|
|
1342
|
-
const o = ie[
|
|
1332
|
+
const t = this, s = this.json, n = this.json.accessors[e];
|
|
1333
|
+
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1334
|
+
const o = ie[n.type], r = K[n.componentType], a = n.normalized === !0, c = new r(n.count * o);
|
|
1343
1335
|
return Promise.resolve(new te(c, o, a));
|
|
1344
1336
|
}
|
|
1345
1337
|
const i = [];
|
|
1346
|
-
return
|
|
1347
|
-
const r = o[0], a = ie[
|
|
1338
|
+
return n.bufferView !== void 0 ? i.push(this.getDependency("bufferView", n.bufferView)) : i.push(null), n.sparse !== void 0 && (i.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(i).then(function(o) {
|
|
1339
|
+
const r = o[0], a = ie[n.type], c = K[n.componentType], u = c.BYTES_PER_ELEMENT, h = u * a, d = n.byteOffset || 0, p = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, m = n.normalized === !0;
|
|
1348
1340
|
let g, f;
|
|
1349
|
-
if (p && p !==
|
|
1350
|
-
const _ = Math.floor(d / p), x = "InterleavedBuffer:" +
|
|
1341
|
+
if (p && p !== h) {
|
|
1342
|
+
const _ = Math.floor(d / p), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + _ + ":" + n.count;
|
|
1351
1343
|
let b = t.cache.get(x);
|
|
1352
|
-
b || (g = new c(r, _ * p,
|
|
1344
|
+
b || (g = new c(r, _ * p, n.count * p / u), b = new it(g, p / u), t.cache.add(x, b)), f = new ot(b, a, d % p / u, m);
|
|
1353
1345
|
} else
|
|
1354
|
-
r === null ? g = new c(
|
|
1355
|
-
if (
|
|
1356
|
-
const _ = ie.SCALAR, x = K[
|
|
1346
|
+
r === null ? g = new c(n.count * a) : g = new c(r, d, n.count * a), f = new te(g, a, m);
|
|
1347
|
+
if (n.sparse !== void 0) {
|
|
1348
|
+
const _ = ie.SCALAR, x = K[n.sparse.indices.componentType], b = n.sparse.indices.byteOffset || 0, T = n.sparse.values.byteOffset || 0, A = new x(o[1], b, n.sparse.count * _), I = new c(o[2], T, n.sparse.count * a);
|
|
1357
1349
|
r !== null && (f = new te(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
1358
1350
|
for (let P = 0, B = A.length; P < B; P++) {
|
|
1359
1351
|
const v = A[P];
|
|
@@ -1372,55 +1364,55 @@ class gs {
|
|
|
1372
1364
|
* @return {Promise<THREE.Texture|null>}
|
|
1373
1365
|
*/
|
|
1374
1366
|
loadTexture(e) {
|
|
1375
|
-
const t = this.json,
|
|
1367
|
+
const t = this.json, s = this.options, i = t.textures[e].source, o = t.images[i];
|
|
1376
1368
|
let r = this.textureLoader;
|
|
1377
1369
|
if (o.uri) {
|
|
1378
|
-
const a =
|
|
1370
|
+
const a = s.manager.getHandler(o.uri);
|
|
1379
1371
|
a !== null && (r = a);
|
|
1380
1372
|
}
|
|
1381
1373
|
return this.loadTextureImage(e, i, r);
|
|
1382
1374
|
}
|
|
1383
|
-
loadTextureImage(e, t,
|
|
1384
|
-
const
|
|
1375
|
+
loadTextureImage(e, t, s) {
|
|
1376
|
+
const n = this, i = this.json, o = i.textures[e], r = i.images[t], a = (r.uri || r.bufferView) + ":" + o.sampler;
|
|
1385
1377
|
if (this.textureCache[a])
|
|
1386
1378
|
return this.textureCache[a];
|
|
1387
|
-
const c = this.loadImageSource(t,
|
|
1388
|
-
|
|
1379
|
+
const c = this.loadImageSource(t, s).then(function(u) {
|
|
1380
|
+
u.flipY = !1, u.name = o.name || r.name || "", u.name === "" && typeof r.uri == "string" && r.uri.startsWith("data:image/") === !1 && (u.name = r.uri);
|
|
1389
1381
|
const d = (i.samplers || {})[o.sampler] || {};
|
|
1390
|
-
return
|
|
1382
|
+
return u.magFilter = Ae[d.magFilter] || le, u.minFilter = Ae[d.minFilter] || ke, u.wrapS = Le[d.wrapS] || he, u.wrapT = Le[d.wrapT] || he, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== je && u.minFilter !== le, n.associations.set(u, { textures: e }), u;
|
|
1391
1383
|
}).catch(function() {
|
|
1392
1384
|
return null;
|
|
1393
1385
|
});
|
|
1394
1386
|
return this.textureCache[a] = c, c;
|
|
1395
1387
|
}
|
|
1396
1388
|
loadImageSource(e, t) {
|
|
1397
|
-
const
|
|
1389
|
+
const s = this, n = this.json, i = this.options;
|
|
1398
1390
|
if (this.sourceCache[e] !== void 0)
|
|
1399
|
-
return this.sourceCache[e].then((
|
|
1400
|
-
const o =
|
|
1391
|
+
return this.sourceCache[e].then((h) => h.clone());
|
|
1392
|
+
const o = n.images[e], r = self.URL || self.webkitURL;
|
|
1401
1393
|
let a = o.uri || "", c = !1;
|
|
1402
1394
|
if (o.bufferView !== void 0)
|
|
1403
|
-
a =
|
|
1395
|
+
a = s.getDependency("bufferView", o.bufferView).then(function(h) {
|
|
1404
1396
|
c = !0;
|
|
1405
|
-
const d = new Blob([
|
|
1397
|
+
const d = new Blob([h], { type: o.mimeType });
|
|
1406
1398
|
return a = r.createObjectURL(d), a;
|
|
1407
1399
|
});
|
|
1408
1400
|
else if (o.uri === void 0)
|
|
1409
1401
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1410
|
-
const
|
|
1402
|
+
const u = Promise.resolve(a).then(function(h) {
|
|
1411
1403
|
return new Promise(function(d, p) {
|
|
1412
1404
|
let m = d;
|
|
1413
1405
|
t.isImageBitmapLoader === !0 && (m = function(g) {
|
|
1414
1406
|
const f = new _e(g);
|
|
1415
1407
|
f.needsUpdate = !0, d(f);
|
|
1416
|
-
}), t.load(X.resolveURL(
|
|
1408
|
+
}), t.load(X.resolveURL(h, i.path), m, void 0, p);
|
|
1417
1409
|
});
|
|
1418
|
-
}).then(function(
|
|
1419
|
-
return c === !0 && r.revokeObjectURL(a), D(
|
|
1420
|
-
}).catch(function(
|
|
1421
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture", a),
|
|
1410
|
+
}).then(function(h) {
|
|
1411
|
+
return c === !0 && r.revokeObjectURL(a), D(h, o), h.userData.mimeType = o.mimeType || fs(o.uri), h;
|
|
1412
|
+
}).catch(function(h) {
|
|
1413
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", a), h;
|
|
1422
1414
|
});
|
|
1423
|
-
return this.sourceCache[e] =
|
|
1415
|
+
return this.sourceCache[e] = u, u;
|
|
1424
1416
|
}
|
|
1425
1417
|
/**
|
|
1426
1418
|
* Asynchronously assigns a texture to the given material parameters.
|
|
@@ -1432,18 +1424,18 @@ class gs {
|
|
|
1432
1424
|
* @param {string} [colorSpace]
|
|
1433
1425
|
* @return {Promise<Texture>}
|
|
1434
1426
|
*/
|
|
1435
|
-
assignTexture(e, t,
|
|
1427
|
+
assignTexture(e, t, s, n) {
|
|
1436
1428
|
const i = this;
|
|
1437
|
-
return this.getDependency("texture",
|
|
1429
|
+
return this.getDependency("texture", s.index).then(function(o) {
|
|
1438
1430
|
if (!o) return null;
|
|
1439
|
-
if (
|
|
1440
|
-
const r =
|
|
1431
|
+
if (s.texCoord !== void 0 && s.texCoord > 0 && (o = o.clone(), o.channel = s.texCoord), i.extensions[y.KHR_TEXTURE_TRANSFORM]) {
|
|
1432
|
+
const r = s.extensions !== void 0 ? s.extensions[y.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1441
1433
|
if (r) {
|
|
1442
1434
|
const a = i.associations.get(o);
|
|
1443
1435
|
o = i.extensions[y.KHR_TEXTURE_TRANSFORM].extendTexture(o, r), i.associations.set(o, a);
|
|
1444
1436
|
}
|
|
1445
1437
|
}
|
|
1446
|
-
return
|
|
1438
|
+
return n !== void 0 && (o.colorSpace = n), e[t] = o, o;
|
|
1447
1439
|
});
|
|
1448
1440
|
}
|
|
1449
1441
|
/**
|
|
@@ -1458,27 +1450,27 @@ class gs {
|
|
|
1458
1450
|
*/
|
|
1459
1451
|
assignFinalMaterial(e) {
|
|
1460
1452
|
const t = e.geometry;
|
|
1461
|
-
let
|
|
1462
|
-
const
|
|
1453
|
+
let s = e.material;
|
|
1454
|
+
const n = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, o = t.attributes.normal === void 0;
|
|
1463
1455
|
if (e.isPoints) {
|
|
1464
|
-
const r = "PointsMaterial:" +
|
|
1456
|
+
const r = "PointsMaterial:" + s.uuid;
|
|
1465
1457
|
let a = this.cache.get(r);
|
|
1466
|
-
a || (a = new
|
|
1458
|
+
a || (a = new ut(), se.prototype.copy.call(a, s), a.color.copy(s.color), a.map = s.map, a.sizeAttenuation = !1, this.cache.add(r, a)), s = a;
|
|
1467
1459
|
} else if (e.isLine) {
|
|
1468
|
-
const r = "LineBasicMaterial:" +
|
|
1460
|
+
const r = "LineBasicMaterial:" + s.uuid;
|
|
1469
1461
|
let a = this.cache.get(r);
|
|
1470
|
-
a || (a = new
|
|
1462
|
+
a || (a = new dt(), se.prototype.copy.call(a, s), a.color.copy(s.color), a.map = s.map, this.cache.add(r, a)), s = a;
|
|
1471
1463
|
}
|
|
1472
|
-
if (
|
|
1473
|
-
let r = "ClonedMaterial:" +
|
|
1474
|
-
|
|
1464
|
+
if (n || i || o) {
|
|
1465
|
+
let r = "ClonedMaterial:" + s.uuid + ":";
|
|
1466
|
+
n && (r += "derivative-tangents:"), i && (r += "vertex-colors:"), o && (r += "flat-shading:");
|
|
1475
1467
|
let a = this.cache.get(r);
|
|
1476
|
-
a || (a =
|
|
1468
|
+
a || (a = s.clone(), i && (a.vertexColors = !0), o && (a.flatShading = !0), n && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(r, a), this.associations.set(a, this.associations.get(s))), s = a;
|
|
1477
1469
|
}
|
|
1478
|
-
e.material =
|
|
1470
|
+
e.material = s;
|
|
1479
1471
|
}
|
|
1480
1472
|
getMaterialType() {
|
|
1481
|
-
return
|
|
1473
|
+
return Fe;
|
|
1482
1474
|
}
|
|
1483
1475
|
/**
|
|
1484
1476
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1488,37 +1480,37 @@ class gs {
|
|
|
1488
1480
|
* @return {Promise<Material>}
|
|
1489
1481
|
*/
|
|
1490
1482
|
loadMaterial(e) {
|
|
1491
|
-
const t = this,
|
|
1483
|
+
const t = this, s = this.json, n = this.extensions, i = s.materials[e];
|
|
1492
1484
|
let o;
|
|
1493
1485
|
const r = {}, a = i.extensions || {}, c = [];
|
|
1494
1486
|
if (a[y.KHR_MATERIALS_UNLIT]) {
|
|
1495
|
-
const
|
|
1496
|
-
o =
|
|
1487
|
+
const h = n[y.KHR_MATERIALS_UNLIT];
|
|
1488
|
+
o = h.getMaterialType(), c.push(h.extendParams(r, i, t));
|
|
1497
1489
|
} else {
|
|
1498
|
-
const
|
|
1499
|
-
if (r.color = new H(1, 1, 1), r.opacity = 1, Array.isArray(
|
|
1500
|
-
const d =
|
|
1490
|
+
const h = i.pbrMetallicRoughness || {};
|
|
1491
|
+
if (r.color = new H(1, 1, 1), r.opacity = 1, Array.isArray(h.baseColorFactor)) {
|
|
1492
|
+
const d = h.baseColorFactor;
|
|
1501
1493
|
r.color.setRGB(d[0], d[1], d[2], C), r.opacity = d[3];
|
|
1502
1494
|
}
|
|
1503
|
-
|
|
1495
|
+
h.baseColorTexture !== void 0 && c.push(t.assignTexture(r, "map", h.baseColorTexture, Y)), r.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, r.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(r, "metalnessMap", h.metallicRoughnessTexture)), c.push(t.assignTexture(r, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(d) {
|
|
1504
1496
|
return d.getMaterialType && d.getMaterialType(e);
|
|
1505
1497
|
}), c.push(Promise.all(this._invokeAll(function(d) {
|
|
1506
1498
|
return d.extendMaterialParams && d.extendMaterialParams(e, r);
|
|
1507
1499
|
})));
|
|
1508
1500
|
}
|
|
1509
|
-
i.doubleSided === !0 && (r.side =
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
const
|
|
1513
|
-
r.normalScale.set(
|
|
1501
|
+
i.doubleSided === !0 && (r.side = pt);
|
|
1502
|
+
const u = i.alphaMode || oe.OPAQUE;
|
|
1503
|
+
if (u === oe.BLEND ? (r.transparent = !0, r.depthWrite = !1) : (r.transparent = !1, u === oe.MASK && (r.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== z && (c.push(t.assignTexture(r, "normalMap", i.normalTexture)), r.normalScale = new S(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1504
|
+
const h = i.normalTexture.scale;
|
|
1505
|
+
r.normalScale.set(h, h);
|
|
1514
1506
|
}
|
|
1515
1507
|
if (i.occlusionTexture !== void 0 && o !== z && (c.push(t.assignTexture(r, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (r.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== z) {
|
|
1516
|
-
const
|
|
1517
|
-
r.emissive = new H().setRGB(
|
|
1508
|
+
const h = i.emissiveFactor;
|
|
1509
|
+
r.emissive = new H().setRGB(h[0], h[1], h[2], C);
|
|
1518
1510
|
}
|
|
1519
1511
|
return i.emissiveTexture !== void 0 && o !== z && c.push(t.assignTexture(r, "emissiveMap", i.emissiveTexture, Y)), Promise.all(c).then(function() {
|
|
1520
|
-
const
|
|
1521
|
-
return i.name && (
|
|
1512
|
+
const h = new o(r);
|
|
1513
|
+
return i.name && (h.name = i.name), D(h, i), t.associations.set(h, { materials: e }), i.extensions && j(n, h, i), h;
|
|
1522
1514
|
});
|
|
1523
1515
|
}
|
|
1524
1516
|
/**
|
|
@@ -1529,7 +1521,7 @@ class gs {
|
|
|
1529
1521
|
* @return {string}
|
|
1530
1522
|
*/
|
|
1531
1523
|
createUniqueName(e) {
|
|
1532
|
-
const t =
|
|
1524
|
+
const t = ft.sanitizeNodeName(e || "");
|
|
1533
1525
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1534
1526
|
}
|
|
1535
1527
|
/**
|
|
@@ -1542,20 +1534,20 @@ class gs {
|
|
|
1542
1534
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1543
1535
|
*/
|
|
1544
1536
|
loadGeometries(e) {
|
|
1545
|
-
const t = this,
|
|
1537
|
+
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
1546
1538
|
function i(r) {
|
|
1547
|
-
return
|
|
1539
|
+
return s[y.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r, t).then(function(a) {
|
|
1548
1540
|
return Pe(a, r, t);
|
|
1549
1541
|
});
|
|
1550
1542
|
}
|
|
1551
1543
|
const o = [];
|
|
1552
1544
|
for (let r = 0, a = e.length; r < a; r++) {
|
|
1553
|
-
const c = e[r],
|
|
1554
|
-
if (
|
|
1555
|
-
o.push(
|
|
1545
|
+
const c = e[r], u = ps(c), h = n[u];
|
|
1546
|
+
if (h)
|
|
1547
|
+
o.push(h.promise);
|
|
1556
1548
|
else {
|
|
1557
1549
|
let d;
|
|
1558
|
-
c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = Pe(new
|
|
1550
|
+
c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = Pe(new mt(), c, t), n[u] = { primitive: c, promise: d }, o.push(d);
|
|
1559
1551
|
}
|
|
1560
1552
|
}
|
|
1561
1553
|
return Promise.all(o);
|
|
@@ -1568,42 +1560,42 @@ class gs {
|
|
|
1568
1560
|
* @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
|
|
1569
1561
|
*/
|
|
1570
1562
|
loadMesh(e) {
|
|
1571
|
-
const t = this,
|
|
1563
|
+
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, r = [];
|
|
1572
1564
|
for (let a = 0, c = o.length; a < c; a++) {
|
|
1573
|
-
const
|
|
1574
|
-
r.push(
|
|
1565
|
+
const u = o[a].material === void 0 ? hs(this.cache) : this.getDependency("material", o[a].material);
|
|
1566
|
+
r.push(u);
|
|
1575
1567
|
}
|
|
1576
1568
|
return r.push(t.loadGeometries(o)), Promise.all(r).then(function(a) {
|
|
1577
|
-
const c = a.slice(0, a.length - 1),
|
|
1578
|
-
for (let p = 0, m =
|
|
1579
|
-
const g =
|
|
1569
|
+
const c = a.slice(0, a.length - 1), u = a[a.length - 1], h = [];
|
|
1570
|
+
for (let p = 0, m = u.length; p < m; p++) {
|
|
1571
|
+
const g = u[p], f = o[p];
|
|
1580
1572
|
let _;
|
|
1581
1573
|
const x = c[p];
|
|
1582
1574
|
if (f.mode === L.TRIANGLES || f.mode === L.TRIANGLE_STRIP || f.mode === L.TRIANGLE_FAN || f.mode === void 0)
|
|
1583
|
-
_ = i.isSkinnedMesh === !0 ? new
|
|
1575
|
+
_ = i.isSkinnedMesh === !0 ? new _t(g, x) : new gt(g, x), _.isSkinnedMesh === !0 && _.normalizeSkinWeights(), f.mode === L.TRIANGLE_STRIP ? _.geometry = we(_.geometry, Ce) : f.mode === L.TRIANGLE_FAN && (_.geometry = we(_.geometry, ce));
|
|
1584
1576
|
else if (f.mode === L.LINES)
|
|
1585
|
-
_ = new
|
|
1577
|
+
_ = new Tt(g, x);
|
|
1586
1578
|
else if (f.mode === L.LINE_STRIP)
|
|
1587
|
-
_ = new
|
|
1579
|
+
_ = new yt(g, x);
|
|
1588
1580
|
else if (f.mode === L.LINE_LOOP)
|
|
1589
|
-
_ = new
|
|
1581
|
+
_ = new xt(g, x);
|
|
1590
1582
|
else if (f.mode === L.POINTS)
|
|
1591
|
-
_ = new
|
|
1583
|
+
_ = new Et(g, x);
|
|
1592
1584
|
else
|
|
1593
1585
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + f.mode);
|
|
1594
|
-
Object.keys(_.geometry.morphAttributes).length > 0 &&
|
|
1586
|
+
Object.keys(_.geometry.morphAttributes).length > 0 && ds(_, i), _.name = t.createUniqueName(i.name || "mesh_" + e), D(_, i), f.extensions && j(n, _, f), t.assignFinalMaterial(_), h.push(_);
|
|
1595
1587
|
}
|
|
1596
|
-
for (let p = 0, m =
|
|
1597
|
-
t.associations.set(
|
|
1588
|
+
for (let p = 0, m = h.length; p < m; p++)
|
|
1589
|
+
t.associations.set(h[p], {
|
|
1598
1590
|
meshes: e,
|
|
1599
1591
|
primitives: p
|
|
1600
1592
|
});
|
|
1601
|
-
if (
|
|
1602
|
-
return i.extensions && j(
|
|
1593
|
+
if (h.length === 1)
|
|
1594
|
+
return i.extensions && j(n, h[0], i), h[0];
|
|
1603
1595
|
const d = new ne();
|
|
1604
|
-
i.extensions && j(
|
|
1605
|
-
for (let p = 0, m =
|
|
1606
|
-
d.add(
|
|
1596
|
+
i.extensions && j(n, d, i), t.associations.set(d, { meshes: e });
|
|
1597
|
+
for (let p = 0, m = h.length; p < m; p++)
|
|
1598
|
+
d.add(h[p]);
|
|
1607
1599
|
return d;
|
|
1608
1600
|
});
|
|
1609
1601
|
}
|
|
@@ -1616,12 +1608,12 @@ class gs {
|
|
|
1616
1608
|
*/
|
|
1617
1609
|
loadCamera(e) {
|
|
1618
1610
|
let t;
|
|
1619
|
-
const
|
|
1620
|
-
if (!
|
|
1611
|
+
const s = this.json.cameras[e], n = s[s.type];
|
|
1612
|
+
if (!n) {
|
|
1621
1613
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1622
1614
|
return;
|
|
1623
1615
|
}
|
|
1624
|
-
return
|
|
1616
|
+
return s.type === "perspective" ? t = new bt(He.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : s.type === "orthographic" && (t = new Rt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), s.name && (t.name = this.createUniqueName(s.name)), D(t, s), Promise.resolve(t);
|
|
1625
1617
|
}
|
|
1626
1618
|
/**
|
|
1627
1619
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1631,21 +1623,21 @@ class gs {
|
|
|
1631
1623
|
* @return {Promise<Skeleton>}
|
|
1632
1624
|
*/
|
|
1633
1625
|
loadSkin(e) {
|
|
1634
|
-
const t = this.json.skins[e],
|
|
1635
|
-
for (let
|
|
1636
|
-
|
|
1637
|
-
return t.inverseBindMatrices !== void 0 ?
|
|
1638
|
-
const i =
|
|
1639
|
-
for (let c = 0,
|
|
1640
|
-
const
|
|
1641
|
-
if (
|
|
1642
|
-
r.push(
|
|
1626
|
+
const t = this.json.skins[e], s = [];
|
|
1627
|
+
for (let n = 0, i = t.joints.length; n < i; n++)
|
|
1628
|
+
s.push(this._loadNodeShallow(t.joints[n]));
|
|
1629
|
+
return t.inverseBindMatrices !== void 0 ? s.push(this.getDependency("accessor", t.inverseBindMatrices)) : s.push(null), Promise.all(s).then(function(n) {
|
|
1630
|
+
const i = n.pop(), o = n, r = [], a = [];
|
|
1631
|
+
for (let c = 0, u = o.length; c < u; c++) {
|
|
1632
|
+
const h = o[c];
|
|
1633
|
+
if (h) {
|
|
1634
|
+
r.push(h);
|
|
1643
1635
|
const d = new q();
|
|
1644
1636
|
i !== null && d.fromArray(i.array, c * 16), a.push(d);
|
|
1645
1637
|
} else
|
|
1646
1638
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
1647
1639
|
}
|
|
1648
|
-
return new
|
|
1640
|
+
return new Mt(r, a);
|
|
1649
1641
|
});
|
|
1650
1642
|
}
|
|
1651
1643
|
/**
|
|
@@ -1656,39 +1648,39 @@ class gs {
|
|
|
1656
1648
|
* @return {Promise<AnimationClip>}
|
|
1657
1649
|
*/
|
|
1658
1650
|
loadAnimation(e) {
|
|
1659
|
-
const t = this.json,
|
|
1660
|
-
for (let
|
|
1661
|
-
const p =
|
|
1662
|
-
g.node !== void 0 && (o.push(this.getDependency("node", f)), r.push(this.getDependency("accessor", _)), a.push(this.getDependency("accessor", x)), c.push(m),
|
|
1651
|
+
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], r = [], a = [], c = [], u = [];
|
|
1652
|
+
for (let h = 0, d = n.channels.length; h < d; h++) {
|
|
1653
|
+
const p = n.channels[h], m = n.samplers[p.sampler], g = p.target, f = g.node, _ = n.parameters !== void 0 ? n.parameters[m.input] : m.input, x = n.parameters !== void 0 ? n.parameters[m.output] : m.output;
|
|
1654
|
+
g.node !== void 0 && (o.push(this.getDependency("node", f)), r.push(this.getDependency("accessor", _)), a.push(this.getDependency("accessor", x)), c.push(m), u.push(g));
|
|
1663
1655
|
}
|
|
1664
1656
|
return Promise.all([
|
|
1665
1657
|
Promise.all(o),
|
|
1666
1658
|
Promise.all(r),
|
|
1667
1659
|
Promise.all(a),
|
|
1668
1660
|
Promise.all(c),
|
|
1669
|
-
Promise.all(
|
|
1670
|
-
]).then(function(
|
|
1671
|
-
const d =
|
|
1661
|
+
Promise.all(u)
|
|
1662
|
+
]).then(function(h) {
|
|
1663
|
+
const d = h[0], p = h[1], m = h[2], g = h[3], f = h[4], _ = [];
|
|
1672
1664
|
for (let x = 0, b = d.length; x < b; x++) {
|
|
1673
1665
|
const T = d[x], A = p[x], I = m[x], P = g[x], B = f[x];
|
|
1674
1666
|
if (T === void 0) continue;
|
|
1675
1667
|
T.updateMatrix && T.updateMatrix();
|
|
1676
|
-
const v =
|
|
1668
|
+
const v = s._createAnimationTracks(T, A, I, P, B);
|
|
1677
1669
|
if (v)
|
|
1678
1670
|
for (let J = 0; J < v.length; J++)
|
|
1679
1671
|
_.push(v[J]);
|
|
1680
1672
|
}
|
|
1681
|
-
return new
|
|
1673
|
+
return new wt(i, void 0, _);
|
|
1682
1674
|
});
|
|
1683
1675
|
}
|
|
1684
1676
|
createNodeMesh(e) {
|
|
1685
|
-
const t = this.json,
|
|
1686
|
-
return
|
|
1687
|
-
const o =
|
|
1688
|
-
return
|
|
1677
|
+
const t = this.json, s = this, n = t.nodes[e];
|
|
1678
|
+
return n.mesh === void 0 ? null : s.getDependency("mesh", n.mesh).then(function(i) {
|
|
1679
|
+
const o = s._getNodeRef(s.meshCache, n.mesh, i);
|
|
1680
|
+
return n.weights !== void 0 && o.traverse(function(r) {
|
|
1689
1681
|
if (r.isMesh)
|
|
1690
|
-
for (let a = 0, c =
|
|
1691
|
-
r.morphTargetInfluences[a] =
|
|
1682
|
+
for (let a = 0, c = n.weights.length; a < c; a++)
|
|
1683
|
+
r.morphTargetInfluences[a] = n.weights[a];
|
|
1692
1684
|
}), o;
|
|
1693
1685
|
});
|
|
1694
1686
|
}
|
|
@@ -1700,56 +1692,56 @@ class gs {
|
|
|
1700
1692
|
* @return {Promise<Object3D>}
|
|
1701
1693
|
*/
|
|
1702
1694
|
loadNode(e) {
|
|
1703
|
-
const t = this.json,
|
|
1704
|
-
for (let c = 0,
|
|
1705
|
-
o.push(
|
|
1706
|
-
const a =
|
|
1695
|
+
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [], r = n.children || [];
|
|
1696
|
+
for (let c = 0, u = r.length; c < u; c++)
|
|
1697
|
+
o.push(s.getDependency("node", r[c]));
|
|
1698
|
+
const a = n.skin === void 0 ? Promise.resolve(null) : s.getDependency("skin", n.skin);
|
|
1707
1699
|
return Promise.all([
|
|
1708
1700
|
i,
|
|
1709
1701
|
Promise.all(o),
|
|
1710
1702
|
a
|
|
1711
1703
|
]).then(function(c) {
|
|
1712
|
-
const
|
|
1713
|
-
d !== null &&
|
|
1714
|
-
p.isSkinnedMesh && p.bind(d,
|
|
1704
|
+
const u = c[0], h = c[1], d = c[2];
|
|
1705
|
+
d !== null && u.traverse(function(p) {
|
|
1706
|
+
p.isSkinnedMesh && p.bind(d, ms);
|
|
1715
1707
|
});
|
|
1716
|
-
for (let p = 0, m =
|
|
1717
|
-
|
|
1718
|
-
return
|
|
1708
|
+
for (let p = 0, m = h.length; p < m; p++)
|
|
1709
|
+
u.add(h[p]);
|
|
1710
|
+
return u;
|
|
1719
1711
|
});
|
|
1720
1712
|
}
|
|
1721
1713
|
// ._loadNodeShallow() parses a single node.
|
|
1722
1714
|
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1723
1715
|
_loadNodeShallow(e) {
|
|
1724
|
-
const t = this.json,
|
|
1716
|
+
const t = this.json, s = this.extensions, n = this;
|
|
1725
1717
|
if (this.nodeCache[e] !== void 0)
|
|
1726
1718
|
return this.nodeCache[e];
|
|
1727
|
-
const i = t.nodes[e], o = i.name ?
|
|
1719
|
+
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "", r = [], a = n._invokeOne(function(c) {
|
|
1728
1720
|
return c.createNodeMesh && c.createNodeMesh(e);
|
|
1729
1721
|
});
|
|
1730
|
-
return a && r.push(a), i.camera !== void 0 && r.push(
|
|
1731
|
-
return
|
|
1732
|
-
})),
|
|
1722
|
+
return a && r.push(a), i.camera !== void 0 && r.push(n.getDependency("camera", i.camera).then(function(c) {
|
|
1723
|
+
return n._getNodeRef(n.cameraCache, i.camera, c);
|
|
1724
|
+
})), n._invokeAll(function(c) {
|
|
1733
1725
|
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
1734
1726
|
}).forEach(function(c) {
|
|
1735
1727
|
r.push(c);
|
|
1736
1728
|
}), this.nodeCache[e] = Promise.all(r).then(function(c) {
|
|
1737
|
-
let
|
|
1738
|
-
if (i.isBone === !0 ?
|
|
1739
|
-
for (let
|
|
1740
|
-
|
|
1741
|
-
if (i.name && (
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1729
|
+
let u;
|
|
1730
|
+
if (i.isBone === !0 ? u = new St() : c.length > 1 ? u = new ne() : c.length === 1 ? u = c[0] : u = new ve(), u !== c[0])
|
|
1731
|
+
for (let h = 0, d = c.length; h < d; h++)
|
|
1732
|
+
u.add(c[h]);
|
|
1733
|
+
if (i.name && (u.userData.name = i.name, u.name = o), D(u, i), i.extensions && j(s, u, i), i.matrix !== void 0) {
|
|
1734
|
+
const h = new q();
|
|
1735
|
+
h.fromArray(i.matrix), u.applyMatrix4(h);
|
|
1744
1736
|
} else
|
|
1745
|
-
i.translation !== void 0 &&
|
|
1746
|
-
if (!
|
|
1747
|
-
|
|
1748
|
-
else if (i.mesh !== void 0 &&
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1737
|
+
i.translation !== void 0 && u.position.fromArray(i.translation), i.rotation !== void 0 && u.quaternion.fromArray(i.rotation), i.scale !== void 0 && u.scale.fromArray(i.scale);
|
|
1738
|
+
if (!n.associations.has(u))
|
|
1739
|
+
n.associations.set(u, {});
|
|
1740
|
+
else if (i.mesh !== void 0 && n.meshCache.refs[i.mesh] > 1) {
|
|
1741
|
+
const h = n.associations.get(u);
|
|
1742
|
+
n.associations.set(u, { ...h });
|
|
1751
1743
|
}
|
|
1752
|
-
return
|
|
1744
|
+
return n.associations.get(u).nodes = e, u;
|
|
1753
1745
|
}), this.nodeCache[e];
|
|
1754
1746
|
}
|
|
1755
1747
|
/**
|
|
@@ -1760,27 +1752,27 @@ class gs {
|
|
|
1760
1752
|
* @return {Promise<Group>}
|
|
1761
1753
|
*/
|
|
1762
1754
|
loadScene(e) {
|
|
1763
|
-
const t = this.extensions,
|
|
1764
|
-
|
|
1765
|
-
const o =
|
|
1755
|
+
const t = this.extensions, s = this.json.scenes[e], n = this, i = new ne();
|
|
1756
|
+
s.name && (i.name = n.createUniqueName(s.name)), D(i, s), s.extensions && j(t, i, s);
|
|
1757
|
+
const o = s.nodes || [], r = [];
|
|
1766
1758
|
for (let a = 0, c = o.length; a < c; a++)
|
|
1767
|
-
r.push(
|
|
1759
|
+
r.push(n.getDependency("node", o[a]));
|
|
1768
1760
|
return Promise.all(r).then(function(a) {
|
|
1769
|
-
for (let
|
|
1770
|
-
i.add(a[
|
|
1771
|
-
const c = (
|
|
1772
|
-
const
|
|
1773
|
-
for (const [d, p] of
|
|
1774
|
-
(d instanceof se || d instanceof _e) &&
|
|
1775
|
-
return
|
|
1776
|
-
const p =
|
|
1777
|
-
p != null &&
|
|
1778
|
-
}),
|
|
1761
|
+
for (let u = 0, h = a.length; u < h; u++)
|
|
1762
|
+
i.add(a[u]);
|
|
1763
|
+
const c = (u) => {
|
|
1764
|
+
const h = /* @__PURE__ */ new Map();
|
|
1765
|
+
for (const [d, p] of n.associations)
|
|
1766
|
+
(d instanceof se || d instanceof _e) && h.set(d, p);
|
|
1767
|
+
return u.traverse((d) => {
|
|
1768
|
+
const p = n.associations.get(d);
|
|
1769
|
+
p != null && h.set(d, p);
|
|
1770
|
+
}), h;
|
|
1779
1771
|
};
|
|
1780
|
-
return
|
|
1772
|
+
return n.associations = c(i), i;
|
|
1781
1773
|
});
|
|
1782
1774
|
}
|
|
1783
|
-
_createAnimationTracks(e, t,
|
|
1775
|
+
_createAnimationTracks(e, t, s, n, i) {
|
|
1784
1776
|
const o = [], r = e.name ? e.name : e.uuid, a = [];
|
|
1785
1777
|
k[i.path] === k.weights ? e.traverse(function(d) {
|
|
1786
1778
|
d.morphTargetInfluences && a.push(d.name ? d.name : d.uuid);
|
|
@@ -1798,7 +1790,7 @@ class gs {
|
|
|
1798
1790
|
c = ge;
|
|
1799
1791
|
break;
|
|
1800
1792
|
default:
|
|
1801
|
-
switch (
|
|
1793
|
+
switch (s.itemSize) {
|
|
1802
1794
|
case 1:
|
|
1803
1795
|
c = Te;
|
|
1804
1796
|
break;
|
|
@@ -1810,46 +1802,46 @@ class gs {
|
|
|
1810
1802
|
}
|
|
1811
1803
|
break;
|
|
1812
1804
|
}
|
|
1813
|
-
const
|
|
1805
|
+
const u = n.interpolation !== void 0 ? ls[n.interpolation] : Ge, h = this._getArrayFromAccessor(s);
|
|
1814
1806
|
for (let d = 0, p = a.length; d < p; d++) {
|
|
1815
1807
|
const m = new c(
|
|
1816
1808
|
a[d] + "." + k[i.path],
|
|
1817
1809
|
t.array,
|
|
1818
|
-
|
|
1819
|
-
|
|
1810
|
+
h,
|
|
1811
|
+
u
|
|
1820
1812
|
);
|
|
1821
|
-
|
|
1813
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(m), o.push(m);
|
|
1822
1814
|
}
|
|
1823
1815
|
return o;
|
|
1824
1816
|
}
|
|
1825
1817
|
_getArrayFromAccessor(e) {
|
|
1826
1818
|
let t = e.array;
|
|
1827
1819
|
if (e.normalized) {
|
|
1828
|
-
const
|
|
1820
|
+
const s = pe(t.constructor), n = new Float32Array(t.length);
|
|
1829
1821
|
for (let i = 0, o = t.length; i < o; i++)
|
|
1830
|
-
|
|
1831
|
-
t =
|
|
1822
|
+
n[i] = t[i] * s;
|
|
1823
|
+
t = n;
|
|
1832
1824
|
}
|
|
1833
1825
|
return t;
|
|
1834
1826
|
}
|
|
1835
1827
|
_createCubicSplineTrackInterpolant(e) {
|
|
1836
|
-
e.createInterpolant = function(
|
|
1837
|
-
const
|
|
1838
|
-
return new
|
|
1828
|
+
e.createInterpolant = function(s) {
|
|
1829
|
+
const n = this instanceof ye ? cs : Be;
|
|
1830
|
+
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
1839
1831
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1840
1832
|
}
|
|
1841
1833
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const
|
|
1844
|
-
if (
|
|
1845
|
-
const r = t.json.accessors[
|
|
1834
|
+
function gs(l, e, t) {
|
|
1835
|
+
const s = e.attributes, n = new Nt();
|
|
1836
|
+
if (s.POSITION !== void 0) {
|
|
1837
|
+
const r = t.json.accessors[s.POSITION], a = r.min, c = r.max;
|
|
1846
1838
|
if (a !== void 0 && c !== void 0) {
|
|
1847
|
-
if (
|
|
1839
|
+
if (n.set(
|
|
1848
1840
|
new M(a[0], a[1], a[2]),
|
|
1849
1841
|
new M(c[0], c[1], c[2])
|
|
1850
1842
|
), r.normalized) {
|
|
1851
|
-
const
|
|
1852
|
-
|
|
1843
|
+
const u = pe(K[r.componentType]);
|
|
1844
|
+
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
1853
1845
|
}
|
|
1854
1846
|
} else {
|
|
1855
1847
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1860,10 +1852,10 @@ function Ts(l, e, t) {
|
|
|
1860
1852
|
const i = e.targets;
|
|
1861
1853
|
if (i !== void 0) {
|
|
1862
1854
|
const r = new M(), a = new M();
|
|
1863
|
-
for (let c = 0,
|
|
1864
|
-
const
|
|
1865
|
-
if (
|
|
1866
|
-
const d = t.json.accessors[
|
|
1855
|
+
for (let c = 0, u = i.length; c < u; c++) {
|
|
1856
|
+
const h = i[c];
|
|
1857
|
+
if (h.POSITION !== void 0) {
|
|
1858
|
+
const d = t.json.accessors[h.POSITION], p = d.min, m = d.max;
|
|
1867
1859
|
if (p !== void 0 && m !== void 0) {
|
|
1868
1860
|
if (a.setX(Math.max(Math.abs(p[0]), Math.abs(m[0]))), a.setY(Math.max(Math.abs(p[1]), Math.abs(m[1]))), a.setZ(Math.max(Math.abs(p[2]), Math.abs(m[2]))), d.normalized) {
|
|
1869
1861
|
const g = pe(K[d.componentType]);
|
|
@@ -1874,34 +1866,34 @@ function Ts(l, e, t) {
|
|
|
1874
1866
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1875
1867
|
}
|
|
1876
1868
|
}
|
|
1877
|
-
|
|
1869
|
+
n.expandByVector(r);
|
|
1878
1870
|
}
|
|
1879
|
-
l.boundingBox =
|
|
1880
|
-
const o = new
|
|
1881
|
-
|
|
1871
|
+
l.boundingBox = n;
|
|
1872
|
+
const o = new Ot();
|
|
1873
|
+
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, l.boundingSphere = o;
|
|
1882
1874
|
}
|
|
1883
1875
|
function Pe(l, e, t) {
|
|
1884
|
-
const
|
|
1876
|
+
const s = e.attributes, n = [];
|
|
1885
1877
|
function i(o, r) {
|
|
1886
1878
|
return t.getDependency("accessor", o).then(function(a) {
|
|
1887
1879
|
l.setAttribute(r, a);
|
|
1888
1880
|
});
|
|
1889
1881
|
}
|
|
1890
|
-
for (const o in
|
|
1882
|
+
for (const o in s) {
|
|
1891
1883
|
const r = de[o] || o.toLowerCase();
|
|
1892
|
-
r in l.attributes ||
|
|
1884
|
+
r in l.attributes || n.push(i(s[o], r));
|
|
1893
1885
|
}
|
|
1894
1886
|
if (e.indices !== void 0 && !l.index) {
|
|
1895
1887
|
const o = t.getDependency("accessor", e.indices).then(function(r) {
|
|
1896
1888
|
l.setIndex(r);
|
|
1897
1889
|
});
|
|
1898
|
-
|
|
1890
|
+
n.push(o);
|
|
1899
1891
|
}
|
|
1900
|
-
return xe.workingColorSpace !== C && "COLOR_0" in
|
|
1901
|
-
return e.targets !== void 0 ?
|
|
1892
|
+
return xe.workingColorSpace !== C && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${xe.workingColorSpace}" not supported.`), D(l, e), gs(l, e, t), Promise.all(n).then(function() {
|
|
1893
|
+
return e.targets !== void 0 ? us(l, e.targets, t) : l;
|
|
1902
1894
|
});
|
|
1903
1895
|
}
|
|
1904
|
-
const Ne = { type: "change" }, me = { type: "start" },
|
|
1896
|
+
const Ne = { type: "change" }, me = { type: "start" }, Ve = { type: "end" }, W = new Ct(), Oe = new It(), Ts = Math.cos(70 * He.DEG2RAD), R = new M(), w = 2 * Math.PI, E = {
|
|
1905
1897
|
NONE: -1,
|
|
1906
1898
|
ROTATE: 0,
|
|
1907
1899
|
DOLLY: 1,
|
|
@@ -1911,7 +1903,7 @@ const Ne = { type: "change" }, me = { type: "start" }, ze = { type: "end" }, W =
|
|
|
1911
1903
|
TOUCH_DOLLY_PAN: 5,
|
|
1912
1904
|
TOUCH_DOLLY_ROTATE: 6
|
|
1913
1905
|
}, ae = 1e-6;
|
|
1914
|
-
class
|
|
1906
|
+
class ys extends Dt {
|
|
1915
1907
|
/**
|
|
1916
1908
|
* Constructs a new controls instance.
|
|
1917
1909
|
*
|
|
@@ -1919,7 +1911,7 @@ class xs extends Ct {
|
|
|
1919
1911
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
1920
1912
|
*/
|
|
1921
1913
|
constructor(e, t = null) {
|
|
1922
|
-
super(e, t), this.state = E.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT:
|
|
1914
|
+
super(e, t), this.state = E.NONE, this.target = new M(), this.cursor = new M(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: U.ROTATE, MIDDLE: U.DOLLY, RIGHT: U.PAN }, this.touches = { ONE: G.ROTATE, TWO: G.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new M(), this._lastQuaternion = new Q(), this._lastTargetPosition = new M(), this._quat = new Q().setFromUnitVectors(e.up, new M(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Ee(), this._sphericalDelta = new Ee(), this._scale = 1, this._panOffset = new M(), this._rotateStart = new S(), this._rotateEnd = new S(), this._rotateDelta = new S(), this._panStart = new S(), this._panEnd = new S(), this._panDelta = new S(), this._dollyStart = new S(), this._dollyEnd = new S(), this._dollyDelta = new S(), this._dollyDirection = new M(), this._mouse = new S(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = Es.bind(this), this._onPointerDown = xs.bind(this), this._onPointerUp = bs.bind(this), this._onContextMenu = Ps.bind(this), this._onMouseWheel = ws.bind(this), this._onKeyDown = Ss.bind(this), this._onTouchStart = As.bind(this), this._onTouchMove = Ls.bind(this), this._onMouseDown = Rs.bind(this), this._onMouseMove = Ms.bind(this), this._interceptControlDown = Ns.bind(this), this._interceptControlUp = Os.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
1923
1915
|
}
|
|
1924
1916
|
connect(e) {
|
|
1925
1917
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
|
|
@@ -1985,8 +1977,8 @@ class xs extends Ct {
|
|
|
1985
1977
|
update(e = null) {
|
|
1986
1978
|
const t = this.object.position;
|
|
1987
1979
|
R.copy(t).sub(this.target), R.applyQuaternion(this._quat), this._spherical.setFromVector3(R), this.autoRotate && this.state === E.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
1988
|
-
let
|
|
1989
|
-
isFinite(
|
|
1980
|
+
let s = this.minAzimuthAngle, n = this.maxAzimuthAngle;
|
|
1981
|
+
isFinite(s) && isFinite(n) && (s < -Math.PI ? s += w : s > Math.PI && (s -= w), n < -Math.PI ? n += w : n > Math.PI && (n -= w), s <= n ? this._spherical.theta = Math.max(s, Math.min(n, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (s + n) / 2 ? Math.max(s, this._spherical.theta) : Math.min(n, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
1990
1982
|
let i = !1;
|
|
1991
1983
|
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera)
|
|
1992
1984
|
this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
@@ -2010,7 +2002,7 @@ class xs extends Ct {
|
|
|
2010
2002
|
c.unproject(this.object), this.object.position.sub(c).add(r), this.object.updateMatrixWorld(), o = R.length();
|
|
2011
2003
|
} else
|
|
2012
2004
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
2013
|
-
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (W.origin.copy(this.object.position), W.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(W.direction)) <
|
|
2005
|
+
o !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position) : (W.origin.copy(this.object.position), W.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(W.direction)) < Ts ? this.object.lookAt(this.target) : (Oe.setFromNormalAndCoplanarPoint(this.object.up, this.target), W.intersectPlane(Oe, this.target))));
|
|
2014
2006
|
} else if (this.object.isOrthographicCamera) {
|
|
2015
2007
|
const o = this.object.zoom;
|
|
2016
2008
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
@@ -2038,13 +2030,13 @@ class xs extends Ct {
|
|
|
2038
2030
|
}
|
|
2039
2031
|
// deltaX and deltaY are in pixels; right and down are positive
|
|
2040
2032
|
_pan(e, t) {
|
|
2041
|
-
const
|
|
2033
|
+
const s = this.domElement;
|
|
2042
2034
|
if (this.object.isPerspectiveCamera) {
|
|
2043
|
-
const
|
|
2044
|
-
R.copy(
|
|
2035
|
+
const n = this.object.position;
|
|
2036
|
+
R.copy(n).sub(this.target);
|
|
2045
2037
|
let i = R.length();
|
|
2046
|
-
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i /
|
|
2047
|
-
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom /
|
|
2038
|
+
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / s.clientHeight, this.object.matrix), this._panUp(2 * t * i / s.clientHeight, this.object.matrix);
|
|
2039
|
+
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
2048
2040
|
}
|
|
2049
2041
|
_dollyOut(e) {
|
|
2050
2042
|
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
@@ -2056,8 +2048,8 @@ class xs extends Ct {
|
|
|
2056
2048
|
if (!this.zoomToCursor)
|
|
2057
2049
|
return;
|
|
2058
2050
|
this._performCursorZoom = !0;
|
|
2059
|
-
const
|
|
2060
|
-
this._mouse.x =
|
|
2051
|
+
const s = this.domElement.getBoundingClientRect(), n = e - s.left, i = t - s.top, o = s.width, r = s.height;
|
|
2052
|
+
this._mouse.x = n / o * 2 - 1, this._mouse.y = -(i / r) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
2061
2053
|
}
|
|
2062
2054
|
_clampDistance(e) {
|
|
2063
2055
|
return Math.max(this.minDistance, Math.min(this.maxDistance, e));
|
|
@@ -2110,20 +2102,20 @@ class xs extends Ct {
|
|
|
2110
2102
|
if (this._pointers.length === 1)
|
|
2111
2103
|
this._rotateStart.set(e.pageX, e.pageY);
|
|
2112
2104
|
else {
|
|
2113
|
-
const t = this._getSecondPointerPosition(e),
|
|
2114
|
-
this._rotateStart.set(
|
|
2105
|
+
const t = this._getSecondPointerPosition(e), s = 0.5 * (e.pageX + t.x), n = 0.5 * (e.pageY + t.y);
|
|
2106
|
+
this._rotateStart.set(s, n);
|
|
2115
2107
|
}
|
|
2116
2108
|
}
|
|
2117
2109
|
_handleTouchStartPan(e) {
|
|
2118
2110
|
if (this._pointers.length === 1)
|
|
2119
2111
|
this._panStart.set(e.pageX, e.pageY);
|
|
2120
2112
|
else {
|
|
2121
|
-
const t = this._getSecondPointerPosition(e),
|
|
2122
|
-
this._panStart.set(
|
|
2113
|
+
const t = this._getSecondPointerPosition(e), s = 0.5 * (e.pageX + t.x), n = 0.5 * (e.pageY + t.y);
|
|
2114
|
+
this._panStart.set(s, n);
|
|
2123
2115
|
}
|
|
2124
2116
|
}
|
|
2125
2117
|
_handleTouchStartDolly(e) {
|
|
2126
|
-
const t = this._getSecondPointerPosition(e),
|
|
2118
|
+
const t = this._getSecondPointerPosition(e), s = e.pageX - t.x, n = e.pageY - t.y, i = Math.sqrt(s * s + n * n);
|
|
2127
2119
|
this._dollyStart.set(0, i);
|
|
2128
2120
|
}
|
|
2129
2121
|
_handleTouchStartDollyPan(e) {
|
|
@@ -2136,8 +2128,8 @@ class xs extends Ct {
|
|
|
2136
2128
|
if (this._pointers.length == 1)
|
|
2137
2129
|
this._rotateEnd.set(e.pageX, e.pageY);
|
|
2138
2130
|
else {
|
|
2139
|
-
const
|
|
2140
|
-
this._rotateEnd.set(
|
|
2131
|
+
const s = this._getSecondPointerPosition(e), n = 0.5 * (e.pageX + s.x), i = 0.5 * (e.pageY + s.y);
|
|
2132
|
+
this._rotateEnd.set(n, i);
|
|
2141
2133
|
}
|
|
2142
2134
|
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
2143
2135
|
const t = this.domElement;
|
|
@@ -2147,13 +2139,13 @@ class xs extends Ct {
|
|
|
2147
2139
|
if (this._pointers.length === 1)
|
|
2148
2140
|
this._panEnd.set(e.pageX, e.pageY);
|
|
2149
2141
|
else {
|
|
2150
|
-
const t = this._getSecondPointerPosition(e),
|
|
2151
|
-
this._panEnd.set(
|
|
2142
|
+
const t = this._getSecondPointerPosition(e), s = 0.5 * (e.pageX + t.x), n = 0.5 * (e.pageY + t.y);
|
|
2143
|
+
this._panEnd.set(s, n);
|
|
2152
2144
|
}
|
|
2153
2145
|
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
2154
2146
|
}
|
|
2155
2147
|
_handleTouchMoveDolly(e) {
|
|
2156
|
-
const t = this._getSecondPointerPosition(e),
|
|
2148
|
+
const t = this._getSecondPointerPosition(e), s = e.pageX - t.x, n = e.pageY - t.y, i = Math.sqrt(s * s + n * n);
|
|
2157
2149
|
this._dollyEnd.set(0, i), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
2158
2150
|
const o = (e.pageX + t.x) * 0.5, r = (e.pageY + t.y) * 0.5;
|
|
2159
2151
|
this._updateZoomParameters(o, r);
|
|
@@ -2191,32 +2183,32 @@ class xs extends Ct {
|
|
|
2191
2183
|
}
|
|
2192
2184
|
//
|
|
2193
2185
|
_customWheelEvent(e) {
|
|
2194
|
-
const t = e.deltaMode,
|
|
2186
|
+
const t = e.deltaMode, s = {
|
|
2195
2187
|
clientX: e.clientX,
|
|
2196
2188
|
clientY: e.clientY,
|
|
2197
2189
|
deltaY: e.deltaY
|
|
2198
2190
|
};
|
|
2199
2191
|
switch (t) {
|
|
2200
2192
|
case 1:
|
|
2201
|
-
|
|
2193
|
+
s.deltaY *= 16;
|
|
2202
2194
|
break;
|
|
2203
2195
|
case 2:
|
|
2204
|
-
|
|
2196
|
+
s.deltaY *= 100;
|
|
2205
2197
|
break;
|
|
2206
2198
|
}
|
|
2207
|
-
return e.ctrlKey && !this._controlActive && (
|
|
2199
|
+
return e.ctrlKey && !this._controlActive && (s.deltaY *= 10), s;
|
|
2208
2200
|
}
|
|
2209
2201
|
}
|
|
2210
|
-
function
|
|
2202
|
+
function xs(l) {
|
|
2211
2203
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(l.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(l) && (this._addPointer(l), l.pointerType === "touch" ? this._onTouchStart(l) : this._onMouseDown(l)));
|
|
2212
2204
|
}
|
|
2213
|
-
function
|
|
2205
|
+
function Es(l) {
|
|
2214
2206
|
this.enabled !== !1 && (l.pointerType === "touch" ? this._onTouchMove(l) : this._onMouseMove(l));
|
|
2215
2207
|
}
|
|
2216
|
-
function
|
|
2208
|
+
function bs(l) {
|
|
2217
2209
|
switch (this._removePointer(l), this._pointers.length) {
|
|
2218
2210
|
case 0:
|
|
2219
|
-
this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
2211
|
+
this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(Ve), this.state = E.NONE;
|
|
2220
2212
|
break;
|
|
2221
2213
|
case 1:
|
|
2222
2214
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -2224,7 +2216,7 @@ function Rs(l) {
|
|
|
2224
2216
|
break;
|
|
2225
2217
|
}
|
|
2226
2218
|
}
|
|
2227
|
-
function
|
|
2219
|
+
function Rs(l) {
|
|
2228
2220
|
let e;
|
|
2229
2221
|
switch (l.button) {
|
|
2230
2222
|
case 0:
|
|
@@ -2240,11 +2232,11 @@ function Ms(l) {
|
|
|
2240
2232
|
e = -1;
|
|
2241
2233
|
}
|
|
2242
2234
|
switch (e) {
|
|
2243
|
-
case
|
|
2235
|
+
case U.DOLLY:
|
|
2244
2236
|
if (this.enableZoom === !1) return;
|
|
2245
2237
|
this._handleMouseDownDolly(l), this.state = E.DOLLY;
|
|
2246
2238
|
break;
|
|
2247
|
-
case
|
|
2239
|
+
case U.ROTATE:
|
|
2248
2240
|
if (l.ctrlKey || l.metaKey || l.shiftKey) {
|
|
2249
2241
|
if (this.enablePan === !1) return;
|
|
2250
2242
|
this._handleMouseDownPan(l), this.state = E.PAN;
|
|
@@ -2253,7 +2245,7 @@ function Ms(l) {
|
|
|
2253
2245
|
this._handleMouseDownRotate(l), this.state = E.ROTATE;
|
|
2254
2246
|
}
|
|
2255
2247
|
break;
|
|
2256
|
-
case
|
|
2248
|
+
case U.PAN:
|
|
2257
2249
|
if (l.ctrlKey || l.metaKey || l.shiftKey) {
|
|
2258
2250
|
if (this.enableRotate === !1) return;
|
|
2259
2251
|
this._handleMouseDownRotate(l), this.state = E.ROTATE;
|
|
@@ -2267,7 +2259,7 @@ function Ms(l) {
|
|
|
2267
2259
|
}
|
|
2268
2260
|
this.state !== E.NONE && this.dispatchEvent(me);
|
|
2269
2261
|
}
|
|
2270
|
-
function
|
|
2262
|
+
function Ms(l) {
|
|
2271
2263
|
switch (this.state) {
|
|
2272
2264
|
case E.ROTATE:
|
|
2273
2265
|
if (this.enableRotate === !1) return;
|
|
@@ -2283,21 +2275,21 @@ function ws(l) {
|
|
|
2283
2275
|
break;
|
|
2284
2276
|
}
|
|
2285
2277
|
}
|
|
2286
|
-
function
|
|
2287
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(me), this._handleMouseWheel(this._customWheelEvent(l)), this.dispatchEvent(
|
|
2278
|
+
function ws(l) {
|
|
2279
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(me), this._handleMouseWheel(this._customWheelEvent(l)), this.dispatchEvent(Ve));
|
|
2288
2280
|
}
|
|
2289
|
-
function
|
|
2281
|
+
function Ss(l) {
|
|
2290
2282
|
this.enabled !== !1 && this._handleKeyDown(l);
|
|
2291
2283
|
}
|
|
2292
|
-
function
|
|
2284
|
+
function As(l) {
|
|
2293
2285
|
switch (this._trackPointer(l), this._pointers.length) {
|
|
2294
2286
|
case 1:
|
|
2295
2287
|
switch (this.touches.ONE) {
|
|
2296
|
-
case
|
|
2288
|
+
case G.ROTATE:
|
|
2297
2289
|
if (this.enableRotate === !1) return;
|
|
2298
2290
|
this._handleTouchStartRotate(l), this.state = E.TOUCH_ROTATE;
|
|
2299
2291
|
break;
|
|
2300
|
-
case
|
|
2292
|
+
case G.PAN:
|
|
2301
2293
|
if (this.enablePan === !1) return;
|
|
2302
2294
|
this._handleTouchStartPan(l), this.state = E.TOUCH_PAN;
|
|
2303
2295
|
break;
|
|
@@ -2307,11 +2299,11 @@ function Ls(l) {
|
|
|
2307
2299
|
break;
|
|
2308
2300
|
case 2:
|
|
2309
2301
|
switch (this.touches.TWO) {
|
|
2310
|
-
case
|
|
2302
|
+
case G.DOLLY_PAN:
|
|
2311
2303
|
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
2312
2304
|
this._handleTouchStartDollyPan(l), this.state = E.TOUCH_DOLLY_PAN;
|
|
2313
2305
|
break;
|
|
2314
|
-
case
|
|
2306
|
+
case G.DOLLY_ROTATE:
|
|
2315
2307
|
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
2316
2308
|
this._handleTouchStartDollyRotate(l), this.state = E.TOUCH_DOLLY_ROTATE;
|
|
2317
2309
|
break;
|
|
@@ -2324,7 +2316,7 @@ function Ls(l) {
|
|
|
2324
2316
|
}
|
|
2325
2317
|
this.state !== E.NONE && this.dispatchEvent(me);
|
|
2326
2318
|
}
|
|
2327
|
-
function
|
|
2319
|
+
function Ls(l) {
|
|
2328
2320
|
switch (this._trackPointer(l), this.state) {
|
|
2329
2321
|
case E.TOUCH_ROTATE:
|
|
2330
2322
|
if (this.enableRotate === !1) return;
|
|
@@ -2346,21 +2338,21 @@ function Ps(l) {
|
|
|
2346
2338
|
this.state = E.NONE;
|
|
2347
2339
|
}
|
|
2348
2340
|
}
|
|
2349
|
-
function
|
|
2341
|
+
function Ps(l) {
|
|
2350
2342
|
this.enabled !== !1 && l.preventDefault();
|
|
2351
2343
|
}
|
|
2352
|
-
function
|
|
2344
|
+
function Ns(l) {
|
|
2353
2345
|
l.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
2354
2346
|
}
|
|
2355
|
-
function
|
|
2347
|
+
function Os(l) {
|
|
2356
2348
|
l.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
|
|
2357
2349
|
}
|
|
2358
|
-
const
|
|
2350
|
+
const Ds = (l, e) => {
|
|
2359
2351
|
const t = l.__vccOpts || l;
|
|
2360
|
-
for (const [
|
|
2361
|
-
t[
|
|
2352
|
+
for (const [s, n] of e)
|
|
2353
|
+
t[s] = n;
|
|
2362
2354
|
return t;
|
|
2363
|
-
},
|
|
2355
|
+
}, Cs = {
|
|
2364
2356
|
__name: "ThreeFrame",
|
|
2365
2357
|
props: {
|
|
2366
2358
|
animation: {
|
|
@@ -2386,25 +2378,25 @@ const Cs = (l, e) => {
|
|
|
2386
2378
|
},
|
|
2387
2379
|
emits: ["init", "animate"],
|
|
2388
2380
|
setup(l, { emit: e }) {
|
|
2389
|
-
const t = e,
|
|
2390
|
-
let o = null, r = null, a = null, c = null,
|
|
2391
|
-
const
|
|
2381
|
+
const t = e, s = l, n = "dom" + ze().uid, i = Xe(n);
|
|
2382
|
+
let o = null, r = null, a = null, c = null, u = null;
|
|
2383
|
+
const h = () => {
|
|
2392
2384
|
t("animate", {
|
|
2393
2385
|
GLTFLoader: ue,
|
|
2394
2386
|
THREE: N,
|
|
2395
2387
|
VRMExpressionPresetName: Re,
|
|
2396
2388
|
VRMHumanBoneName: be,
|
|
2397
2389
|
camera: a,
|
|
2398
|
-
controls:
|
|
2390
|
+
controls: u,
|
|
2399
2391
|
renderer: c,
|
|
2400
2392
|
scene: r
|
|
2401
|
-
}), o != null && (cancelAnimationFrame(o), o = null),
|
|
2393
|
+
}), o != null && (cancelAnimationFrame(o), o = null), s.animation && (o = requestAnimationFrame(h)), c.render(r, a);
|
|
2402
2394
|
}, d = () => {
|
|
2403
|
-
o != null && (cancelAnimationFrame(o), o = null), o = requestAnimationFrame(
|
|
2395
|
+
o != null && (cancelAnimationFrame(o), o = null), o = requestAnimationFrame(h);
|
|
2404
2396
|
}, p = () => {
|
|
2405
2397
|
o != null && (cancelAnimationFrame(o), o = null);
|
|
2406
2398
|
};
|
|
2407
|
-
F(() =>
|
|
2399
|
+
F(() => s.animation, (g) => {
|
|
2408
2400
|
g == !0 ? d() : p();
|
|
2409
2401
|
});
|
|
2410
2402
|
const m = () => {
|
|
@@ -2417,15 +2409,15 @@ const Cs = (l, e) => {
|
|
|
2417
2409
|
f / _,
|
|
2418
2410
|
0.1,
|
|
2419
2411
|
1e3
|
|
2420
|
-
), a.position.set(0, 1.25, 1),
|
|
2412
|
+
), a.position.set(0, 1.25, 1), s.useOrbitControls && (u = new ys(a, g), u.screenSpacePanning = !0, u.target.set(0, 1.25, 0), u.update()), s.useGridHelper) {
|
|
2421
2413
|
const T = new N.GridHelper(10, 10);
|
|
2422
2414
|
r.add(T), T.visible = !0;
|
|
2423
2415
|
}
|
|
2424
|
-
if (
|
|
2416
|
+
if (s.useAxesHelper) {
|
|
2425
2417
|
const T = new N.AxesHelper(5);
|
|
2426
2418
|
r.add(T);
|
|
2427
2419
|
}
|
|
2428
|
-
if (
|
|
2420
|
+
if (s.useDefaultLight) {
|
|
2429
2421
|
const T = new N.DirectionalLight(16777215);
|
|
2430
2422
|
T.intensity = 3, T.position.set(1, 1, 1).normalize(), r.add(T);
|
|
2431
2423
|
const A = new N.AmbientLight(4210752);
|
|
@@ -2437,7 +2429,7 @@ const Cs = (l, e) => {
|
|
|
2437
2429
|
VRMExpressionPresetName: Re,
|
|
2438
2430
|
VRMHumanBoneName: be,
|
|
2439
2431
|
camera: a,
|
|
2440
|
-
controls:
|
|
2432
|
+
controls: u,
|
|
2441
2433
|
renderer: c,
|
|
2442
2434
|
scene: r
|
|
2443
2435
|
});
|
|
@@ -2454,11 +2446,11 @@ const Cs = (l, e) => {
|
|
|
2454
2446
|
};
|
|
2455
2447
|
window.addEventListener("resize", g), m();
|
|
2456
2448
|
}), (g, f) => (fe(), De("div", {
|
|
2457
|
-
ref:
|
|
2449
|
+
ref: n,
|
|
2458
2450
|
class: "box"
|
|
2459
2451
|
}));
|
|
2460
2452
|
}
|
|
2461
|
-
},
|
|
2453
|
+
}, Us = /* @__PURE__ */ Ds(Cs, [["__scopeId", "data-v-e91ca0ac"]]), Is = {
|
|
2462
2454
|
__name: "VroidExpression",
|
|
2463
2455
|
props: {
|
|
2464
2456
|
command: {
|
|
@@ -2477,27 +2469,27 @@ const Cs = (l, e) => {
|
|
|
2477
2469
|
},
|
|
2478
2470
|
emits: ["loading", "loaded"],
|
|
2479
2471
|
setup(l, { emit: e }) {
|
|
2480
|
-
const t =
|
|
2481
|
-
if (!
|
|
2472
|
+
const t = e, s = l, n = async (o) => {
|
|
2473
|
+
if (!o)
|
|
2482
2474
|
return;
|
|
2483
|
-
|
|
2484
|
-
const
|
|
2485
|
-
let
|
|
2486
|
-
|
|
2487
|
-
},
|
|
2488
|
-
|
|
2489
|
-
let
|
|
2490
|
-
|
|
2475
|
+
t("loading", s.name, s.command);
|
|
2476
|
+
const a = await new Ue().fetchExpression(o);
|
|
2477
|
+
let c = !1;
|
|
2478
|
+
a && (c = !0), t("loaded", s.name, s.command, c, a);
|
|
2479
|
+
}, i = (o) => {
|
|
2480
|
+
t("loading", s.name, s.command);
|
|
2481
|
+
let r = !1;
|
|
2482
|
+
o && (r = !0), t("loaded", s.name, s.command, r, o);
|
|
2491
2483
|
};
|
|
2492
2484
|
return $(async () => {
|
|
2493
|
-
s.data != null ?
|
|
2485
|
+
s.data != null ? i(s.data) : n(s.url);
|
|
2494
2486
|
}), F(() => s.data, () => {
|
|
2495
|
-
s.data != null &&
|
|
2487
|
+
s.data != null && i(s.data);
|
|
2496
2488
|
}), F(() => s.url, () => {
|
|
2497
|
-
s.url &&
|
|
2498
|
-
}), (
|
|
2489
|
+
s.url && n(s.url);
|
|
2490
|
+
}), (o, r) => null;
|
|
2499
2491
|
}
|
|
2500
|
-
},
|
|
2492
|
+
}, vs = {
|
|
2501
2493
|
__name: "VroidPose",
|
|
2502
2494
|
props: {
|
|
2503
2495
|
command: {
|
|
@@ -2516,27 +2508,27 @@ const Cs = (l, e) => {
|
|
|
2516
2508
|
},
|
|
2517
2509
|
emits: ["loading", "loaded"],
|
|
2518
2510
|
setup(l, { emit: e }) {
|
|
2519
|
-
const t =
|
|
2520
|
-
if (!
|
|
2511
|
+
const t = e, s = l, n = async (o) => {
|
|
2512
|
+
if (!o)
|
|
2521
2513
|
return;
|
|
2522
|
-
|
|
2523
|
-
const
|
|
2524
|
-
let
|
|
2525
|
-
|
|
2526
|
-
},
|
|
2527
|
-
|
|
2528
|
-
let
|
|
2529
|
-
|
|
2514
|
+
t("loading", s.name, s.command);
|
|
2515
|
+
const a = await new Ue().fetchPose(o);
|
|
2516
|
+
let c = !1;
|
|
2517
|
+
a && (c = !0), t("loaded", s.name, s.command, c, a);
|
|
2518
|
+
}, i = (o) => {
|
|
2519
|
+
t("loading", s.name, s.command);
|
|
2520
|
+
let r = !1;
|
|
2521
|
+
o && (r = !0), t("loaded", s.name, s.command, r, o);
|
|
2530
2522
|
};
|
|
2531
2523
|
return $(async () => {
|
|
2532
|
-
s.data != null ?
|
|
2524
|
+
s.data != null ? i(s.data) : n(s.url);
|
|
2533
2525
|
}), F(() => s.data, () => {
|
|
2534
|
-
s.data != null &&
|
|
2526
|
+
s.data != null && i(s.data);
|
|
2535
2527
|
}), F(() => s.url, () => {
|
|
2536
|
-
s.url &&
|
|
2537
|
-
}), (
|
|
2528
|
+
s.url && n(s.url);
|
|
2529
|
+
}), (o, r) => null;
|
|
2538
2530
|
}
|
|
2539
|
-
},
|
|
2531
|
+
}, ks = {
|
|
2540
2532
|
__name: "VroidVrm",
|
|
2541
2533
|
props: {
|
|
2542
2534
|
url: {
|
|
@@ -2555,33 +2547,33 @@ const Cs = (l, e) => {
|
|
|
2555
2547
|
},
|
|
2556
2548
|
emits: ["loading", "loaded"],
|
|
2557
2549
|
setup(l, { emit: e }) {
|
|
2558
|
-
const t = e,
|
|
2550
|
+
const t = e, s = l, n = async (r) => {
|
|
2559
2551
|
const a = new ue();
|
|
2560
|
-
return a.register((c) => new
|
|
2561
|
-
const
|
|
2562
|
-
return
|
|
2552
|
+
return a.register((c) => new vt(c)), await a.loadAsync(r).then((c) => {
|
|
2553
|
+
const u = c.userData.vrm;
|
|
2554
|
+
return kt.rotateVRM0(u), u;
|
|
2563
2555
|
});
|
|
2564
2556
|
}, i = async (r) => {
|
|
2565
2557
|
if (!r)
|
|
2566
2558
|
return;
|
|
2567
|
-
t("loading",
|
|
2568
|
-
const a = await
|
|
2559
|
+
t("loading", s.name, s.command);
|
|
2560
|
+
const a = await n(r);
|
|
2569
2561
|
let c = !1;
|
|
2570
|
-
a && (c = !0), t("loaded",
|
|
2562
|
+
a && (c = !0), t("loaded", s.name, s.command, c, a);
|
|
2571
2563
|
}, o = (r) => {
|
|
2572
|
-
t("loading",
|
|
2564
|
+
t("loading", s.name, s.command);
|
|
2573
2565
|
let a = !1;
|
|
2574
|
-
r && (a = !0), t("loaded",
|
|
2566
|
+
r && (a = !0), t("loaded", s.name, s.command, a, r);
|
|
2575
2567
|
};
|
|
2576
2568
|
return $(async () => {
|
|
2577
|
-
|
|
2578
|
-
}), F(() =>
|
|
2579
|
-
|
|
2580
|
-
}), F(() =>
|
|
2581
|
-
|
|
2569
|
+
s.data != null ? o(s.data) : i(s.url);
|
|
2570
|
+
}), F(() => s.data, () => {
|
|
2571
|
+
s.data != null && o(s.data);
|
|
2572
|
+
}), F(() => s.url, () => {
|
|
2573
|
+
s.url && i(s.url);
|
|
2582
2574
|
}), (r, a) => null;
|
|
2583
2575
|
}
|
|
2584
|
-
},
|
|
2576
|
+
}, js = {
|
|
2585
2577
|
__name: "VroidModel",
|
|
2586
2578
|
props: {
|
|
2587
2579
|
name: {
|
|
@@ -2620,55 +2612,55 @@ const Cs = (l, e) => {
|
|
|
2620
2612
|
},
|
|
2621
2613
|
emits: ["loading", "loaded"],
|
|
2622
2614
|
setup(l, { emit: e }) {
|
|
2623
|
-
const t = e,
|
|
2624
|
-
const p = Object.keys(
|
|
2625
|
-
|
|
2626
|
-
const m = Object.keys(
|
|
2627
|
-
p == 0 && m && t("loading",
|
|
2628
|
-
},
|
|
2629
|
-
const g = Object.keys(
|
|
2630
|
-
p && (d == "load_expression" && (o.value = m), d == "load_pose" && (r.value = m), d == "load_vrm" && (a.value = m), i[
|
|
2631
|
-
const f = Object.keys(
|
|
2615
|
+
const t = e, s = l, n = {}, i = {}, o = Z(null), r = Z(null), a = Z(null), c = (h, d) => {
|
|
2616
|
+
const p = Object.keys(n).length;
|
|
2617
|
+
n[h] = d;
|
|
2618
|
+
const m = Object.keys(n).length;
|
|
2619
|
+
p == 0 && m && t("loading", s.name);
|
|
2620
|
+
}, u = (h, d, p, m) => {
|
|
2621
|
+
const g = Object.keys(n).length;
|
|
2622
|
+
p && (d == "load_expression" && (o.value = m), d == "load_pose" && (r.value = m), d == "load_vrm" && (a.value = m), i[h] = d), delete n[h];
|
|
2623
|
+
const f = Object.keys(n).length;
|
|
2632
2624
|
if (g && f == 0) {
|
|
2633
2625
|
const _ = {};
|
|
2634
2626
|
for (const b in i) {
|
|
2635
2627
|
const T = i[b];
|
|
2636
2628
|
T == "load_expression" && (_.expression = o.value), T == "load_pose" && (_.pose = r.value), T == "load_vrm" && (_.vrm = a.value);
|
|
2637
2629
|
}
|
|
2638
|
-
t("loaded",
|
|
2630
|
+
t("loaded", s.name, _);
|
|
2639
2631
|
const x = Object.keys(i);
|
|
2640
2632
|
for (const b of x)
|
|
2641
2633
|
delete i[b];
|
|
2642
2634
|
}
|
|
2643
2635
|
};
|
|
2644
|
-
return (
|
|
2645
|
-
ee(
|
|
2636
|
+
return (h, d) => (fe(), De(Ye, null, [
|
|
2637
|
+
ee(Is, {
|
|
2646
2638
|
command: "load_expression",
|
|
2647
|
-
name:
|
|
2648
|
-
url:
|
|
2649
|
-
data:
|
|
2639
|
+
name: s.expression_name,
|
|
2640
|
+
url: s.expression_url,
|
|
2641
|
+
data: s.expression_data,
|
|
2650
2642
|
onLoading: c,
|
|
2651
|
-
onLoaded:
|
|
2643
|
+
onLoaded: u
|
|
2652
2644
|
}, null, 8, ["name", "url", "data"]),
|
|
2653
|
-
ee(
|
|
2645
|
+
ee(vs, {
|
|
2654
2646
|
command: "load_pose",
|
|
2655
|
-
name:
|
|
2656
|
-
url:
|
|
2657
|
-
data:
|
|
2647
|
+
name: s.pose_name,
|
|
2648
|
+
url: s.pose_url,
|
|
2649
|
+
data: s.pose_data,
|
|
2658
2650
|
onLoading: c,
|
|
2659
|
-
onLoaded:
|
|
2651
|
+
onLoaded: u
|
|
2660
2652
|
}, null, 8, ["name", "url", "data"]),
|
|
2661
|
-
ee(
|
|
2653
|
+
ee(ks, {
|
|
2662
2654
|
command: "load_vrm",
|
|
2663
|
-
name:
|
|
2664
|
-
url:
|
|
2665
|
-
data:
|
|
2655
|
+
name: s.vrm_name,
|
|
2656
|
+
url: s.vrm_url,
|
|
2657
|
+
data: s.vrm_data,
|
|
2666
2658
|
onLoading: c,
|
|
2667
|
-
onLoaded:
|
|
2659
|
+
onLoaded: u
|
|
2668
2660
|
}, null, 8, ["name", "url", "data"])
|
|
2669
2661
|
], 64));
|
|
2670
2662
|
}
|
|
2671
|
-
},
|
|
2663
|
+
}, Ks = {
|
|
2672
2664
|
__name: "VroidControl",
|
|
2673
2665
|
props: {
|
|
2674
2666
|
model_name: {
|
|
@@ -2714,14 +2706,14 @@ const Cs = (l, e) => {
|
|
|
2714
2706
|
},
|
|
2715
2707
|
emits: ["loading", "loaded"],
|
|
2716
2708
|
setup(l, { emit: e }) {
|
|
2717
|
-
const t = e,
|
|
2718
|
-
|
|
2719
|
-
const
|
|
2709
|
+
const t = e, s = Z(null);
|
|
2710
|
+
s.value = new jt();
|
|
2711
|
+
const n = (o) => {
|
|
2720
2712
|
t("loading", o);
|
|
2721
2713
|
}, i = (o, r) => {
|
|
2722
|
-
"vrm" in r &&
|
|
2714
|
+
"vrm" in r && s.value.setModel(r.vrm), "pose" in r && (s.value.setPose(r.pose), s.value.updatePose()), "expression" in r && (s.value.importExpression(r.expression), s.value.updateExpression()), t("loaded", o, s.value);
|
|
2723
2715
|
};
|
|
2724
|
-
return (o, r) => (fe(),
|
|
2716
|
+
return (o, r) => (fe(), We(js, {
|
|
2725
2717
|
name: l.model_name,
|
|
2726
2718
|
expression_name: l.expression_name,
|
|
2727
2719
|
expression_url: l.expression_url,
|
|
@@ -2732,18 +2724,18 @@ const Cs = (l, e) => {
|
|
|
2732
2724
|
vrm_name: l.vrm_name,
|
|
2733
2725
|
vrm_url: l.vrm_url,
|
|
2734
2726
|
vrm_data: l.vrm_data,
|
|
2735
|
-
onLoading:
|
|
2727
|
+
onLoading: n,
|
|
2736
2728
|
onLoaded: i
|
|
2737
2729
|
}, null, 8, ["name", "expression_name", "expression_url", "expression_data", "pose_name", "pose_url", "pose_data", "vrm_name", "vrm_url", "vrm_data"]));
|
|
2738
2730
|
}
|
|
2739
2731
|
};
|
|
2740
2732
|
export {
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2733
|
+
Ue as ResourceLoader,
|
|
2734
|
+
Us as ThreeFrame,
|
|
2735
|
+
jt as VrmModel,
|
|
2736
|
+
Ks as VroidControl,
|
|
2737
|
+
Is as VroidExpression,
|
|
2738
|
+
js as VroidModel,
|
|
2739
|
+
vs as VroidPose,
|
|
2740
|
+
ks as VroidVrm
|
|
2749
2741
|
};
|