@j-kyoda/vue-three-vrm 0.8.0 → 0.8.2
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/README.md +1 -1
- package/dist/vue-three-vrm.es.js +332 -325
- package/dist/vue-three-vrm.umd.js +1 -1
- package/package.json +1 -1
package/dist/vue-three-vrm.es.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
1
|
+
import { getCurrentInstance as Ve, useTemplateRef as Xe, watch as F, onMounted as $, createElementBlock as Ce, openBlock as me, 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 Ze, TriangleFanDrawMode as ce, TriangleStripDrawMode as
|
|
4
|
-
import { VRMHumanBoneName as
|
|
5
|
-
class
|
|
3
|
+
import { TrianglesDrawMode as Ze, TriangleFanDrawMode as ce, TriangleStripDrawMode as Ie, Loader as qe, LoaderUtils as X, FileLoader as ve, 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 ke, TextureLoader as st, ImageBitmapLoader as nt, BufferAttribute as te, InterleavedBuffer as it, InterleavedBufferAttribute as ot, LinearMipmapLinearFilter as je, NearestMipmapLinearFilter as rt, LinearMipmapNearestFilter as at, NearestMipmapNearestFilter as ct, LinearFilter as le, NearestFilter as Fe, RepeatWrapping as he, MirroredRepeatWrapping as lt, ClampToEdgeWrapping as ht, PointsMaterial as ut, Material as se, LineBasicMaterial as dt, MeshStandardMaterial as He, DoubleSide as pt, MeshBasicMaterial as V, 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 Ge, OrthographicCamera as Rt, Skeleton as Mt, AnimationClip as wt, Bone as St, InterpolateDiscrete as At, InterpolateLinear as Ue, Texture as ge, VectorKeyframeTrack as Te, NumberKeyframeTrack as ye, QuaternionKeyframeTrack as xe, ColorManagement as Ee, FrontSide as Lt, Interpolant as Pt, Box3 as Nt, Sphere as Ot, Controls as Dt, MOUSE as U, TOUCH as G, Spherical as be, Ray as Ct, Plane as It } from "three";
|
|
4
|
+
import { VRMHumanBoneName as Re, VRMExpressionPresetName as Me, VRMLoaderPlugin as vt, VRMUtils as kt } from "@pixiv/three-vrm";
|
|
5
|
+
class ue {
|
|
6
6
|
constructor() {
|
|
7
7
|
}
|
|
8
8
|
async fetchJSON(e) {
|
|
9
9
|
const t = await fetch(e);
|
|
10
10
|
return t.ok ? await t.json() : null;
|
|
11
11
|
}
|
|
12
|
+
normalizePose(e) {
|
|
13
|
+
return e == null ? null : "pose" in e ? e.pose : e;
|
|
14
|
+
}
|
|
12
15
|
async fetchPose(e) {
|
|
13
16
|
const t = await this.fetchJSON(e);
|
|
14
|
-
return
|
|
17
|
+
return this.normalizePose(t);
|
|
15
18
|
}
|
|
16
19
|
async fetchExpression(e) {
|
|
17
20
|
const t = await this.fetchJSON(e);
|
|
@@ -94,6 +97,9 @@ class jt {
|
|
|
94
97
|
updateExpression() {
|
|
95
98
|
return this.vrm ? this.vrm.expressionManager.update() : null;
|
|
96
99
|
}
|
|
100
|
+
resetExpression() {
|
|
101
|
+
return this.vrm ? this.vrm.expressionManager.resetValues() : null;
|
|
102
|
+
}
|
|
97
103
|
getExpressionNames() {
|
|
98
104
|
if (this.vrm) {
|
|
99
105
|
let e = [];
|
|
@@ -119,7 +125,7 @@ class jt {
|
|
|
119
125
|
return null;
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
|
-
class
|
|
128
|
+
class we {
|
|
123
129
|
/**
|
|
124
130
|
* Returns `true` if WebGL 2 is available.
|
|
125
131
|
*
|
|
@@ -184,16 +190,16 @@ class Me {
|
|
|
184
190
|
return console.warn("getWebGLErrorMessage() has been deprecated and will be removed in r178. Use getWebGL2ErrorMessage() instead."), this._getErrorMessage(1);
|
|
185
191
|
}
|
|
186
192
|
}
|
|
187
|
-
function
|
|
193
|
+
function Se(l, e) {
|
|
188
194
|
if (e === Ze)
|
|
189
195
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), l;
|
|
190
|
-
if (e === ce || e ===
|
|
196
|
+
if (e === ce || e === Ie) {
|
|
191
197
|
let t = l.getIndex();
|
|
192
198
|
if (t === null) {
|
|
193
|
-
const o = [],
|
|
194
|
-
if (
|
|
195
|
-
for (let
|
|
196
|
-
o.push(
|
|
199
|
+
const o = [], a = l.getAttribute("position");
|
|
200
|
+
if (a !== void 0) {
|
|
201
|
+
for (let r = 0; r < a.count; r++)
|
|
202
|
+
o.push(r);
|
|
197
203
|
l.setIndex(o), t = l.getIndex();
|
|
198
204
|
} else
|
|
199
205
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), l;
|
|
@@ -211,7 +217,7 @@ function we(l, e) {
|
|
|
211
217
|
} else
|
|
212
218
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), l;
|
|
213
219
|
}
|
|
214
|
-
class
|
|
220
|
+
class de extends qe {
|
|
215
221
|
/**
|
|
216
222
|
* Constructs a new glTF loader.
|
|
217
223
|
*
|
|
@@ -229,7 +235,7 @@ class ue extends qe {
|
|
|
229
235
|
}), this.register(function(t) {
|
|
230
236
|
return new es(t);
|
|
231
237
|
}), this.register(function(t) {
|
|
232
|
-
return new
|
|
238
|
+
return new Vt(t);
|
|
233
239
|
}), this.register(function(t) {
|
|
234
240
|
return new Xt(t);
|
|
235
241
|
}), this.register(function(t) {
|
|
@@ -241,7 +247,7 @@ class ue extends qe {
|
|
|
241
247
|
}), this.register(function(t) {
|
|
242
248
|
return new Zt(t);
|
|
243
249
|
}), this.register(function(t) {
|
|
244
|
-
return new
|
|
250
|
+
return new zt(t);
|
|
245
251
|
}), this.register(function(t) {
|
|
246
252
|
return new Qt(t);
|
|
247
253
|
}), this.register(function(t) {
|
|
@@ -274,18 +280,18 @@ class ue extends qe {
|
|
|
274
280
|
} else
|
|
275
281
|
o = X.extractUrlBase(e);
|
|
276
282
|
this.manager.itemStart(e);
|
|
277
|
-
const
|
|
283
|
+
const a = function(c) {
|
|
278
284
|
n ? n(c) : console.error(c), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
279
|
-
},
|
|
280
|
-
|
|
285
|
+
}, r = new ve(this.manager);
|
|
286
|
+
r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, function(c) {
|
|
281
287
|
try {
|
|
282
288
|
i.parse(c, o, function(u) {
|
|
283
289
|
t(u), i.manager.itemEnd(e);
|
|
284
|
-
},
|
|
290
|
+
}, a);
|
|
285
291
|
} catch (u) {
|
|
286
|
-
|
|
292
|
+
a(u);
|
|
287
293
|
}
|
|
288
|
-
}, s,
|
|
294
|
+
}, s, a);
|
|
289
295
|
}
|
|
290
296
|
/**
|
|
291
297
|
* Sets the given Draco loader to this loader. Required for decoding assets
|
|
@@ -347,11 +353,11 @@ class ue extends qe {
|
|
|
347
353
|
*/
|
|
348
354
|
parse(e, t, s, n) {
|
|
349
355
|
let i;
|
|
350
|
-
const o = {},
|
|
356
|
+
const o = {}, a = {}, r = new TextDecoder();
|
|
351
357
|
if (typeof e == "string")
|
|
352
358
|
i = JSON.parse(e);
|
|
353
359
|
else if (e instanceof ArrayBuffer)
|
|
354
|
-
if (
|
|
360
|
+
if (r.decode(new Uint8Array(e, 0, 4)) === Ke) {
|
|
355
361
|
try {
|
|
356
362
|
o[y.KHR_BINARY_GLTF] = new ns(e);
|
|
357
363
|
} catch (h) {
|
|
@@ -360,7 +366,7 @@ class ue extends qe {
|
|
|
360
366
|
}
|
|
361
367
|
i = JSON.parse(o[y.KHR_BINARY_GLTF].content);
|
|
362
368
|
} else
|
|
363
|
-
i = JSON.parse(
|
|
369
|
+
i = JSON.parse(r.decode(e));
|
|
364
370
|
else
|
|
365
371
|
i = e;
|
|
366
372
|
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
@@ -378,7 +384,7 @@ class ue extends qe {
|
|
|
378
384
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
379
385
|
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
380
386
|
const h = this.pluginCallbacks[u](c);
|
|
381
|
-
h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),
|
|
387
|
+
h.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[h.name] = h, o[h.name] = !0;
|
|
382
388
|
}
|
|
383
389
|
if (i.extensionsUsed)
|
|
384
390
|
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
@@ -397,10 +403,10 @@ class ue extends qe {
|
|
|
397
403
|
o[h] = new rs();
|
|
398
404
|
break;
|
|
399
405
|
default:
|
|
400
|
-
d.indexOf(h) >= 0 &&
|
|
406
|
+
d.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
|
|
401
407
|
}
|
|
402
408
|
}
|
|
403
|
-
c.setExtensions(o), c.setPlugins(
|
|
409
|
+
c.setExtensions(o), c.setPlugins(a), c.parse(s, n);
|
|
404
410
|
}
|
|
405
411
|
/**
|
|
406
412
|
* Async version of {@link GLTFLoader#parse}.
|
|
@@ -473,12 +479,12 @@ class Ht {
|
|
|
473
479
|
const t = this.parser, s = "light:" + e;
|
|
474
480
|
let n = t.cache.get(s);
|
|
475
481
|
if (n) return n;
|
|
476
|
-
const i = t.json,
|
|
482
|
+
const i = t.json, r = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
477
483
|
let c;
|
|
478
484
|
const u = new H(16777215);
|
|
479
|
-
|
|
480
|
-
const h =
|
|
481
|
-
switch (
|
|
485
|
+
r.color !== void 0 && u.setRGB(r.color[0], r.color[1], r.color[2], C);
|
|
486
|
+
const h = r.range !== void 0 ? r.range : 0;
|
|
487
|
+
switch (r.type) {
|
|
482
488
|
case "directional":
|
|
483
489
|
c = new Je(u), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
484
490
|
break;
|
|
@@ -486,21 +492,21 @@ class Ht {
|
|
|
486
492
|
c = new $e(u), c.distance = h;
|
|
487
493
|
break;
|
|
488
494
|
case "spot":
|
|
489
|
-
c = new Qe(u), c.distance = h,
|
|
495
|
+
c = new Qe(u), c.distance = h, r.spot = r.spot || {}, r.spot.innerConeAngle = r.spot.innerConeAngle !== void 0 ? r.spot.innerConeAngle : 0, r.spot.outerConeAngle = r.spot.outerConeAngle !== void 0 ? r.spot.outerConeAngle : Math.PI / 4, c.angle = r.spot.outerConeAngle, c.penumbra = 1 - r.spot.innerConeAngle / r.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
490
496
|
break;
|
|
491
497
|
default:
|
|
492
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " +
|
|
498
|
+
throw new Error("THREE.GLTFLoader: Unexpected light type: " + r.type);
|
|
493
499
|
}
|
|
494
|
-
return c.position.set(0, 0, 0), D(c,
|
|
500
|
+
return c.position.set(0, 0, 0), D(c, r), r.intensity !== void 0 && (c.intensity = r.intensity), c.name = t.createUniqueName(r.name || "light_" + e), n = Promise.resolve(c), t.cache.add(s, n), n;
|
|
495
501
|
}
|
|
496
502
|
getDependency(e, t) {
|
|
497
503
|
if (e === "light")
|
|
498
504
|
return this._loadLight(t);
|
|
499
505
|
}
|
|
500
506
|
createNodeAttachment(e) {
|
|
501
|
-
const t = this, s = this.parser, i = s.json.nodes[e],
|
|
502
|
-
return
|
|
503
|
-
return s._getNodeRef(t.cache,
|
|
507
|
+
const t = this, s = this.parser, i = s.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
508
|
+
return a === void 0 ? null : this._loadLight(a).then(function(r) {
|
|
509
|
+
return s._getNodeRef(t.cache, a, r);
|
|
504
510
|
});
|
|
505
511
|
}
|
|
506
512
|
}
|
|
@@ -509,7 +515,7 @@ class Gt {
|
|
|
509
515
|
this.name = y.KHR_MATERIALS_UNLIT;
|
|
510
516
|
}
|
|
511
517
|
getMaterialType() {
|
|
512
|
-
return
|
|
518
|
+
return V;
|
|
513
519
|
}
|
|
514
520
|
extendParams(e, t, s) {
|
|
515
521
|
const n = [];
|
|
@@ -551,8 +557,8 @@ class Kt {
|
|
|
551
557
|
return Promise.resolve();
|
|
552
558
|
const i = [], o = n.extensions[this.name];
|
|
553
559
|
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)) {
|
|
554
|
-
const
|
|
555
|
-
t.clearcoatNormalScale = new S(
|
|
560
|
+
const a = o.clearcoatNormalTexture.scale;
|
|
561
|
+
t.clearcoatNormalScale = new S(a, a);
|
|
556
562
|
}
|
|
557
563
|
return Promise.all(i);
|
|
558
564
|
}
|
|
@@ -573,7 +579,7 @@ class Bt {
|
|
|
573
579
|
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
574
580
|
}
|
|
575
581
|
}
|
|
576
|
-
class
|
|
582
|
+
class zt {
|
|
577
583
|
constructor(e) {
|
|
578
584
|
this.parser = e, this.name = y.KHR_MATERIALS_IRIDESCENCE;
|
|
579
585
|
}
|
|
@@ -589,7 +595,7 @@ class Vt {
|
|
|
589
595
|
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);
|
|
590
596
|
}
|
|
591
597
|
}
|
|
592
|
-
class
|
|
598
|
+
class Vt {
|
|
593
599
|
constructor(e) {
|
|
594
600
|
this.parser = e, this.name = y.KHR_MATERIALS_SHEEN;
|
|
595
601
|
}
|
|
@@ -605,8 +611,8 @@ class zt {
|
|
|
605
611
|
t.sheenColor = new H(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
606
612
|
const o = n.extensions[this.name];
|
|
607
613
|
if (o.sheenColorFactor !== void 0) {
|
|
608
|
-
const
|
|
609
|
-
t.sheenColor.setRGB(
|
|
614
|
+
const a = o.sheenColorFactor;
|
|
615
|
+
t.sheenColor.setRGB(a[0], a[1], a[2], C);
|
|
610
616
|
}
|
|
611
617
|
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);
|
|
612
618
|
}
|
|
@@ -641,8 +647,8 @@ class Yt {
|
|
|
641
647
|
return Promise.resolve();
|
|
642
648
|
const i = [], o = n.extensions[this.name];
|
|
643
649
|
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;
|
|
644
|
-
const
|
|
645
|
-
return t.attenuationColor = new H().setRGB(
|
|
650
|
+
const a = o.attenuationColor || [1, 1, 1];
|
|
651
|
+
return t.attenuationColor = new H().setRGB(a[0], a[1], a[2], C), Promise.all(i);
|
|
646
652
|
}
|
|
647
653
|
}
|
|
648
654
|
class Wt {
|
|
@@ -675,8 +681,8 @@ class Zt {
|
|
|
675
681
|
return Promise.resolve();
|
|
676
682
|
const i = [], o = n.extensions[this.name];
|
|
677
683
|
t.specularIntensity = o.specularFactor !== void 0 ? o.specularFactor : 1, o.specularTexture !== void 0 && i.push(s.assignTexture(t, "specularIntensityMap", o.specularTexture));
|
|
678
|
-
const
|
|
679
|
-
return t.specularColor = new H().setRGB(
|
|
684
|
+
const a = o.specularColorFactor || [1, 1, 1];
|
|
685
|
+
return t.specularColor = new H().setRGB(a[0], a[1], a[2], C), o.specularColorTexture !== void 0 && i.push(s.assignTexture(t, "specularColorMap", o.specularColorTexture, Y)), Promise.all(i);
|
|
680
686
|
}
|
|
681
687
|
}
|
|
682
688
|
class qt {
|
|
@@ -736,13 +742,13 @@ class Jt {
|
|
|
736
742
|
const t = this.name, s = this.parser, n = s.json, i = n.textures[e];
|
|
737
743
|
if (!i.extensions || !i.extensions[t])
|
|
738
744
|
return null;
|
|
739
|
-
const o = i.extensions[t],
|
|
740
|
-
let
|
|
741
|
-
if (
|
|
742
|
-
const c = s.options.manager.getHandler(
|
|
743
|
-
c !== null && (
|
|
745
|
+
const o = i.extensions[t], a = n.images[o.source];
|
|
746
|
+
let r = s.textureLoader;
|
|
747
|
+
if (a.uri) {
|
|
748
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
749
|
+
c !== null && (r = c);
|
|
744
750
|
}
|
|
745
|
-
return s.loadTextureImage(e, o.source,
|
|
751
|
+
return s.loadTextureImage(e, o.source, r);
|
|
746
752
|
}
|
|
747
753
|
}
|
|
748
754
|
class es {
|
|
@@ -753,13 +759,13 @@ class es {
|
|
|
753
759
|
const t = this.name, s = this.parser, n = s.json, i = n.textures[e];
|
|
754
760
|
if (!i.extensions || !i.extensions[t])
|
|
755
761
|
return null;
|
|
756
|
-
const o = i.extensions[t],
|
|
757
|
-
let
|
|
758
|
-
if (
|
|
759
|
-
const c = s.options.manager.getHandler(
|
|
760
|
-
c !== null && (
|
|
762
|
+
const o = i.extensions[t], a = n.images[o.source];
|
|
763
|
+
let r = s.textureLoader;
|
|
764
|
+
if (a.uri) {
|
|
765
|
+
const c = s.options.manager.getHandler(a.uri);
|
|
766
|
+
c !== null && (r = c);
|
|
761
767
|
}
|
|
762
|
-
return s.loadTextureImage(e, o.source,
|
|
768
|
+
return s.loadTextureImage(e, o.source, r);
|
|
763
769
|
}
|
|
764
770
|
}
|
|
765
771
|
class ts {
|
|
@@ -775,8 +781,8 @@ class ts {
|
|
|
775
781
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
776
782
|
return null;
|
|
777
783
|
}
|
|
778
|
-
return i.then(function(
|
|
779
|
-
const
|
|
784
|
+
return i.then(function(a) {
|
|
785
|
+
const r = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, h = n.byteStride, d = new Uint8Array(a, r, c);
|
|
780
786
|
return o.decodeGltfBufferAsync ? o.decodeGltfBufferAsync(u, h, d, n.mode, n.filter).then(function(p) {
|
|
781
787
|
return p.buffer;
|
|
782
788
|
}) : o.ready.then(function() {
|
|
@@ -800,31 +806,31 @@ class ss {
|
|
|
800
806
|
for (const c of n.primitives)
|
|
801
807
|
if (c.mode !== L.TRIANGLES && c.mode !== L.TRIANGLE_STRIP && c.mode !== L.TRIANGLE_FAN && c.mode !== void 0)
|
|
802
808
|
return null;
|
|
803
|
-
const o = s.extensions[this.name].attributes,
|
|
809
|
+
const o = s.extensions[this.name].attributes, a = [], r = {};
|
|
804
810
|
for (const c in o)
|
|
805
|
-
|
|
806
|
-
return
|
|
811
|
+
a.push(this.parser.getDependency("accessor", o[c]).then((u) => (r[c] = u, r[c])));
|
|
812
|
+
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
807
813
|
const u = c.pop(), h = u.isGroup ? u.children : [u], d = c[0].count, p = [];
|
|
808
814
|
for (const m of h) {
|
|
809
815
|
const g = new q(), f = new M(), _ = new Q(), x = new M(1, 1, 1), b = new et(m.geometry, m.material, d);
|
|
810
816
|
for (let T = 0; T < d; T++)
|
|
811
|
-
|
|
812
|
-
for (const T in
|
|
817
|
+
r.TRANSLATION && f.fromBufferAttribute(r.TRANSLATION, T), r.ROTATION && _.fromBufferAttribute(r.ROTATION, T), r.SCALE && x.fromBufferAttribute(r.SCALE, T), b.setMatrixAt(T, g.compose(f, _, x));
|
|
818
|
+
for (const T in r)
|
|
813
819
|
if (T === "_COLOR_0") {
|
|
814
|
-
const A =
|
|
820
|
+
const A = r[T];
|
|
815
821
|
b.instanceColor = new tt(A.array, A.itemSize, A.normalized);
|
|
816
|
-
} else T !== "TRANSLATION" && T !== "ROTATION" && T !== "SCALE" && m.geometry.setAttribute(T,
|
|
817
|
-
|
|
822
|
+
} else T !== "TRANSLATION" && T !== "ROTATION" && T !== "SCALE" && m.geometry.setAttribute(T, r[T]);
|
|
823
|
+
ke.prototype.copy.call(b, m), this.parser.assignFinalMaterial(b), p.push(b);
|
|
818
824
|
}
|
|
819
825
|
return u.isGroup ? (u.clear(), u.add(...p), u) : p[0];
|
|
820
826
|
}));
|
|
821
827
|
}
|
|
822
828
|
}
|
|
823
|
-
const Ke = "glTF",
|
|
829
|
+
const Ke = "glTF", z = 12, Ae = { JSON: 1313821514, BIN: 5130562 };
|
|
824
830
|
class ns {
|
|
825
831
|
constructor(e) {
|
|
826
832
|
this.name = y.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
827
|
-
const t = new DataView(e, 0,
|
|
833
|
+
const t = new DataView(e, 0, z), s = new TextDecoder();
|
|
828
834
|
if (this.header = {
|
|
829
835
|
magic: s.decode(new Uint8Array(e.slice(0, 4))),
|
|
830
836
|
version: t.getUint32(4, !0),
|
|
@@ -833,20 +839,20 @@ class ns {
|
|
|
833
839
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
834
840
|
if (this.header.version < 2)
|
|
835
841
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
836
|
-
const n = this.header.length -
|
|
842
|
+
const n = this.header.length - z, i = new DataView(e, z);
|
|
837
843
|
let o = 0;
|
|
838
844
|
for (; o < n; ) {
|
|
839
|
-
const r = i.getUint32(o, !0);
|
|
840
|
-
o += 4;
|
|
841
845
|
const a = i.getUint32(o, !0);
|
|
842
|
-
|
|
843
|
-
|
|
846
|
+
o += 4;
|
|
847
|
+
const r = i.getUint32(o, !0);
|
|
848
|
+
if (o += 4, r === Ae.JSON) {
|
|
849
|
+
const c = new Uint8Array(e, z + o, a);
|
|
844
850
|
this.content = s.decode(c);
|
|
845
|
-
} else if (
|
|
846
|
-
const c =
|
|
847
|
-
this.body = e.slice(c, c +
|
|
851
|
+
} else if (r === Ae.BIN) {
|
|
852
|
+
const c = z + o;
|
|
853
|
+
this.body = e.slice(c, c + a);
|
|
848
854
|
}
|
|
849
|
-
o +=
|
|
855
|
+
o += a;
|
|
850
856
|
}
|
|
851
857
|
if (this.content === null)
|
|
852
858
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
@@ -859,27 +865,27 @@ class is {
|
|
|
859
865
|
this.name = y.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
860
866
|
}
|
|
861
867
|
decodePrimitive(e, t) {
|
|
862
|
-
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes,
|
|
868
|
+
const s = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, r = {}, c = {};
|
|
863
869
|
for (const u in o) {
|
|
864
|
-
const h =
|
|
865
|
-
|
|
870
|
+
const h = pe[u] || u.toLowerCase();
|
|
871
|
+
a[h] = o[u];
|
|
866
872
|
}
|
|
867
873
|
for (const u in e.attributes) {
|
|
868
|
-
const h =
|
|
874
|
+
const h = pe[u] || u.toLowerCase();
|
|
869
875
|
if (o[u] !== void 0) {
|
|
870
876
|
const d = s.accessors[e.attributes[u]], p = K[d.componentType];
|
|
871
|
-
c[h] = p.name,
|
|
877
|
+
c[h] = p.name, r[h] = d.normalized === !0;
|
|
872
878
|
}
|
|
873
879
|
}
|
|
874
880
|
return t.getDependency("bufferView", i).then(function(u) {
|
|
875
881
|
return new Promise(function(h, d) {
|
|
876
882
|
n.decodeDracoFile(u, function(p) {
|
|
877
883
|
for (const m in p.attributes) {
|
|
878
|
-
const g = p.attributes[m], f =
|
|
884
|
+
const g = p.attributes[m], f = r[m];
|
|
879
885
|
f !== void 0 && (g.normalized = f);
|
|
880
886
|
}
|
|
881
887
|
h(p);
|
|
882
|
-
},
|
|
888
|
+
}, a, c, C, d);
|
|
883
889
|
});
|
|
884
890
|
});
|
|
885
891
|
}
|
|
@@ -908,9 +914,9 @@ class Be extends Pt {
|
|
|
908
914
|
return t;
|
|
909
915
|
}
|
|
910
916
|
interpolate_(e, t, s, n) {
|
|
911
|
-
const i = this.resultBuffer, o = this.sampleValues,
|
|
912
|
-
for (let T = 0; T !==
|
|
913
|
-
const A = o[g + T +
|
|
917
|
+
const i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, r = a * 2, c = a * 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;
|
|
918
|
+
for (let T = 0; T !== a; T++) {
|
|
919
|
+
const A = o[g + T + a], I = o[g + T + r] * u, P = o[m + T + a], B = o[m + T] * u;
|
|
914
920
|
i[T] = x * A + b * I + f * P + _ * B;
|
|
915
921
|
}
|
|
916
922
|
return i;
|
|
@@ -938,14 +944,14 @@ const L = {
|
|
|
938
944
|
5123: Uint16Array,
|
|
939
945
|
5125: Uint32Array,
|
|
940
946
|
5126: Float32Array
|
|
941
|
-
},
|
|
942
|
-
9728:
|
|
947
|
+
}, Le = {
|
|
948
|
+
9728: Fe,
|
|
943
949
|
9729: le,
|
|
944
950
|
9984: ct,
|
|
945
951
|
9985: at,
|
|
946
952
|
9986: rt,
|
|
947
|
-
9987:
|
|
948
|
-
},
|
|
953
|
+
9987: je
|
|
954
|
+
}, Pe = {
|
|
949
955
|
33071: ht,
|
|
950
956
|
33648: lt,
|
|
951
957
|
10497: he
|
|
@@ -957,7 +963,7 @@ const L = {
|
|
|
957
963
|
MAT2: 4,
|
|
958
964
|
MAT3: 9,
|
|
959
965
|
MAT4: 16
|
|
960
|
-
},
|
|
966
|
+
}, pe = {
|
|
961
967
|
POSITION: "position",
|
|
962
968
|
NORMAL: "normal",
|
|
963
969
|
TANGENT: "tangent",
|
|
@@ -977,7 +983,7 @@ const L = {
|
|
|
977
983
|
CUBICSPLINE: void 0,
|
|
978
984
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
979
985
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
980
|
-
LINEAR:
|
|
986
|
+
LINEAR: Ue,
|
|
981
987
|
STEP: At
|
|
982
988
|
}, oe = {
|
|
983
989
|
OPAQUE: "OPAQUE",
|
|
@@ -985,7 +991,7 @@ const L = {
|
|
|
985
991
|
BLEND: "BLEND"
|
|
986
992
|
};
|
|
987
993
|
function hs(l) {
|
|
988
|
-
return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new
|
|
994
|
+
return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new He({
|
|
989
995
|
color: 16777215,
|
|
990
996
|
emissive: 0,
|
|
991
997
|
metalness: 1,
|
|
@@ -1009,7 +1015,7 @@ function us(l, e, t) {
|
|
|
1009
1015
|
if (h.POSITION !== void 0 && (s = !0), h.NORMAL !== void 0 && (n = !0), h.COLOR_0 !== void 0 && (i = !0), s && n && i) break;
|
|
1010
1016
|
}
|
|
1011
1017
|
if (!s && !n && !i) return Promise.resolve(l);
|
|
1012
|
-
const o = [],
|
|
1018
|
+
const o = [], a = [], r = [];
|
|
1013
1019
|
for (let c = 0, u = e.length; c < u; c++) {
|
|
1014
1020
|
const h = e[c];
|
|
1015
1021
|
if (s) {
|
|
@@ -1018,17 +1024,17 @@ function us(l, e, t) {
|
|
|
1018
1024
|
}
|
|
1019
1025
|
if (n) {
|
|
1020
1026
|
const d = h.NORMAL !== void 0 ? t.getDependency("accessor", h.NORMAL) : l.attributes.normal;
|
|
1021
|
-
|
|
1027
|
+
a.push(d);
|
|
1022
1028
|
}
|
|
1023
1029
|
if (i) {
|
|
1024
1030
|
const d = h.COLOR_0 !== void 0 ? t.getDependency("accessor", h.COLOR_0) : l.attributes.color;
|
|
1025
|
-
|
|
1031
|
+
r.push(d);
|
|
1026
1032
|
}
|
|
1027
1033
|
}
|
|
1028
1034
|
return Promise.all([
|
|
1029
1035
|
Promise.all(o),
|
|
1030
|
-
Promise.all(
|
|
1031
|
-
Promise.all(
|
|
1036
|
+
Promise.all(a),
|
|
1037
|
+
Promise.all(r)
|
|
1032
1038
|
]).then(function(c) {
|
|
1033
1039
|
const u = c[0], h = c[1], d = c[2];
|
|
1034
1040
|
return s && (l.morphAttributes.position = u), n && (l.morphAttributes.normal = h), i && (l.morphAttributes.color = d), l.morphTargetsRelative = !0, l;
|
|
@@ -1063,7 +1069,7 @@ function re(l) {
|
|
|
1063
1069
|
e += t[s] + ":" + l[t[s]] + ";";
|
|
1064
1070
|
return e;
|
|
1065
1071
|
}
|
|
1066
|
-
function
|
|
1072
|
+
function fe(l) {
|
|
1067
1073
|
switch (l) {
|
|
1068
1074
|
case Int8Array:
|
|
1069
1075
|
return 1 / 127;
|
|
@@ -1086,12 +1092,12 @@ class _s {
|
|
|
1086
1092
|
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
1093
|
let s = !1, n = -1, i = !1, o = -1;
|
|
1088
1094
|
if (typeof navigator < "u") {
|
|
1089
|
-
const
|
|
1090
|
-
s = /^((?!chrome|android).)*safari/i.test(
|
|
1091
|
-
const
|
|
1092
|
-
n = s &&
|
|
1095
|
+
const a = navigator.userAgent;
|
|
1096
|
+
s = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
1097
|
+
const r = a.match(/Version\/(\d+)/);
|
|
1098
|
+
n = s && r ? parseInt(r[1], 10) : -1, i = a.indexOf("Firefox") > -1, o = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1093
1099
|
}
|
|
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
|
|
1100
|
+
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 ve(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1095
1101
|
}
|
|
1096
1102
|
setExtensions(e) {
|
|
1097
1103
|
this.extensions = e;
|
|
@@ -1112,7 +1118,7 @@ class _s {
|
|
|
1112
1118
|
s.getDependencies("camera")
|
|
1113
1119
|
]);
|
|
1114
1120
|
}).then(function(o) {
|
|
1115
|
-
const
|
|
1121
|
+
const a = {
|
|
1116
1122
|
scene: o[0][n.scene || 0],
|
|
1117
1123
|
scenes: o[0],
|
|
1118
1124
|
animations: o[1],
|
|
@@ -1121,12 +1127,12 @@ class _s {
|
|
|
1121
1127
|
parser: s,
|
|
1122
1128
|
userData: {}
|
|
1123
1129
|
};
|
|
1124
|
-
return j(i,
|
|
1125
|
-
return
|
|
1130
|
+
return j(i, a, n), D(a, n), Promise.all(s._invokeAll(function(r) {
|
|
1131
|
+
return r.afterRoot && r.afterRoot(a);
|
|
1126
1132
|
})).then(function() {
|
|
1127
|
-
for (const
|
|
1128
|
-
|
|
1129
|
-
e(
|
|
1133
|
+
for (const r of a.scenes)
|
|
1134
|
+
r.updateMatrixWorld();
|
|
1135
|
+
e(a);
|
|
1130
1136
|
});
|
|
1131
1137
|
}).catch(t);
|
|
1132
1138
|
}
|
|
@@ -1139,8 +1145,8 @@ class _s {
|
|
|
1139
1145
|
const e = this.json.nodes || [], t = this.json.skins || [], s = this.json.meshes || [];
|
|
1140
1146
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
1141
1147
|
const o = t[n].joints;
|
|
1142
|
-
for (let
|
|
1143
|
-
e[o[
|
|
1148
|
+
for (let a = 0, r = o.length; a < r; a++)
|
|
1149
|
+
e[o[a]].isBone = !0;
|
|
1144
1150
|
}
|
|
1145
1151
|
for (let n = 0, i = e.length; n < i; n++) {
|
|
1146
1152
|
const o = e[n];
|
|
@@ -1174,11 +1180,11 @@ class _s {
|
|
|
1174
1180
|
*/
|
|
1175
1181
|
_getNodeRef(e, t, s) {
|
|
1176
1182
|
if (e.refs[t] <= 1) return s;
|
|
1177
|
-
const n = s.clone(), i = (o,
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1183
|
+
const n = s.clone(), i = (o, a) => {
|
|
1184
|
+
const r = this.associations.get(o);
|
|
1185
|
+
r != null && this.associations.set(a, r);
|
|
1180
1186
|
for (const [c, u] of o.children.entries())
|
|
1181
|
-
i(u,
|
|
1187
|
+
i(u, a.children[c]);
|
|
1182
1188
|
};
|
|
1183
1189
|
return i(s, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
1184
1190
|
}
|
|
@@ -1331,25 +1337,25 @@ class _s {
|
|
|
1331
1337
|
loadAccessor(e) {
|
|
1332
1338
|
const t = this, s = this.json, n = this.json.accessors[e];
|
|
1333
1339
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1334
|
-
const o = ie[n.type],
|
|
1335
|
-
return Promise.resolve(new te(c, o,
|
|
1340
|
+
const o = ie[n.type], a = K[n.componentType], r = n.normalized === !0, c = new a(n.count * o);
|
|
1341
|
+
return Promise.resolve(new te(c, o, r));
|
|
1336
1342
|
}
|
|
1337
1343
|
const i = [];
|
|
1338
1344
|
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
|
|
1345
|
+
const a = o[0], r = ie[n.type], c = K[n.componentType], u = c.BYTES_PER_ELEMENT, h = u * r, d = n.byteOffset || 0, p = n.bufferView !== void 0 ? s.bufferViews[n.bufferView].byteStride : void 0, m = n.normalized === !0;
|
|
1340
1346
|
let g, f;
|
|
1341
1347
|
if (p && p !== h) {
|
|
1342
1348
|
const _ = Math.floor(d / p), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + _ + ":" + n.count;
|
|
1343
1349
|
let b = t.cache.get(x);
|
|
1344
|
-
b || (g = new c(
|
|
1350
|
+
b || (g = new c(a, _ * p, n.count * p / u), b = new it(g, p / u), t.cache.add(x, b)), f = new ot(b, r, d % p / u, m);
|
|
1345
1351
|
} else
|
|
1346
|
-
|
|
1352
|
+
a === null ? g = new c(n.count * r) : g = new c(a, d, n.count * r), f = new te(g, r, m);
|
|
1347
1353
|
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 *
|
|
1349
|
-
|
|
1354
|
+
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 * r);
|
|
1355
|
+
a !== null && (f = new te(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
1350
1356
|
for (let P = 0, B = A.length; P < B; P++) {
|
|
1351
1357
|
const v = A[P];
|
|
1352
|
-
if (f.setX(v, I[P *
|
|
1358
|
+
if (f.setX(v, I[P * r]), r >= 2 && f.setY(v, I[P * r + 1]), r >= 3 && f.setZ(v, I[P * r + 2]), r >= 4 && f.setW(v, I[P * r + 3]), r >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1353
1359
|
}
|
|
1354
1360
|
f.normalized = m;
|
|
1355
1361
|
}
|
|
@@ -1365,52 +1371,52 @@ class _s {
|
|
|
1365
1371
|
*/
|
|
1366
1372
|
loadTexture(e) {
|
|
1367
1373
|
const t = this.json, s = this.options, i = t.textures[e].source, o = t.images[i];
|
|
1368
|
-
let
|
|
1374
|
+
let a = this.textureLoader;
|
|
1369
1375
|
if (o.uri) {
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1376
|
+
const r = s.manager.getHandler(o.uri);
|
|
1377
|
+
r !== null && (a = r);
|
|
1372
1378
|
}
|
|
1373
|
-
return this.loadTextureImage(e, i,
|
|
1379
|
+
return this.loadTextureImage(e, i, a);
|
|
1374
1380
|
}
|
|
1375
1381
|
loadTextureImage(e, t, s) {
|
|
1376
|
-
const n = this, i = this.json, o = i.textures[e],
|
|
1377
|
-
if (this.textureCache[
|
|
1378
|
-
return this.textureCache[
|
|
1382
|
+
const n = this, i = this.json, o = i.textures[e], a = i.images[t], r = (a.uri || a.bufferView) + ":" + o.sampler;
|
|
1383
|
+
if (this.textureCache[r])
|
|
1384
|
+
return this.textureCache[r];
|
|
1379
1385
|
const c = this.loadImageSource(t, s).then(function(u) {
|
|
1380
|
-
u.flipY = !1, u.name = o.name ||
|
|
1386
|
+
u.flipY = !1, u.name = o.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
1381
1387
|
const d = (i.samplers || {})[o.sampler] || {};
|
|
1382
|
-
return u.magFilter =
|
|
1388
|
+
return u.magFilter = Le[d.magFilter] || le, u.minFilter = Le[d.minFilter] || je, u.wrapS = Pe[d.wrapS] || he, u.wrapT = Pe[d.wrapT] || he, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== Fe && u.minFilter !== le, n.associations.set(u, { textures: e }), u;
|
|
1383
1389
|
}).catch(function() {
|
|
1384
1390
|
return null;
|
|
1385
1391
|
});
|
|
1386
|
-
return this.textureCache[
|
|
1392
|
+
return this.textureCache[r] = c, c;
|
|
1387
1393
|
}
|
|
1388
1394
|
loadImageSource(e, t) {
|
|
1389
1395
|
const s = this, n = this.json, i = this.options;
|
|
1390
1396
|
if (this.sourceCache[e] !== void 0)
|
|
1391
1397
|
return this.sourceCache[e].then((h) => h.clone());
|
|
1392
|
-
const o = n.images[e],
|
|
1393
|
-
let
|
|
1398
|
+
const o = n.images[e], a = self.URL || self.webkitURL;
|
|
1399
|
+
let r = o.uri || "", c = !1;
|
|
1394
1400
|
if (o.bufferView !== void 0)
|
|
1395
|
-
|
|
1401
|
+
r = s.getDependency("bufferView", o.bufferView).then(function(h) {
|
|
1396
1402
|
c = !0;
|
|
1397
1403
|
const d = new Blob([h], { type: o.mimeType });
|
|
1398
|
-
return
|
|
1404
|
+
return r = a.createObjectURL(d), r;
|
|
1399
1405
|
});
|
|
1400
1406
|
else if (o.uri === void 0)
|
|
1401
1407
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1402
|
-
const u = Promise.resolve(
|
|
1408
|
+
const u = Promise.resolve(r).then(function(h) {
|
|
1403
1409
|
return new Promise(function(d, p) {
|
|
1404
1410
|
let m = d;
|
|
1405
1411
|
t.isImageBitmapLoader === !0 && (m = function(g) {
|
|
1406
|
-
const f = new
|
|
1412
|
+
const f = new ge(g);
|
|
1407
1413
|
f.needsUpdate = !0, d(f);
|
|
1408
1414
|
}), t.load(X.resolveURL(h, i.path), m, void 0, p);
|
|
1409
1415
|
});
|
|
1410
1416
|
}).then(function(h) {
|
|
1411
|
-
return c === !0 &&
|
|
1417
|
+
return c === !0 && a.revokeObjectURL(r), D(h, o), h.userData.mimeType = o.mimeType || fs(o.uri), h;
|
|
1412
1418
|
}).catch(function(h) {
|
|
1413
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture",
|
|
1419
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", r), h;
|
|
1414
1420
|
});
|
|
1415
1421
|
return this.sourceCache[e] = u, u;
|
|
1416
1422
|
}
|
|
@@ -1429,10 +1435,10 @@ class _s {
|
|
|
1429
1435
|
return this.getDependency("texture", s.index).then(function(o) {
|
|
1430
1436
|
if (!o) return null;
|
|
1431
1437
|
if (s.texCoord !== void 0 && s.texCoord > 0 && (o = o.clone(), o.channel = s.texCoord), i.extensions[y.KHR_TEXTURE_TRANSFORM]) {
|
|
1432
|
-
const
|
|
1433
|
-
if (
|
|
1434
|
-
const
|
|
1435
|
-
o = i.extensions[y.KHR_TEXTURE_TRANSFORM].extendTexture(o,
|
|
1438
|
+
const a = s.extensions !== void 0 ? s.extensions[y.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1439
|
+
if (a) {
|
|
1440
|
+
const r = i.associations.get(o);
|
|
1441
|
+
o = i.extensions[y.KHR_TEXTURE_TRANSFORM].extendTexture(o, a), i.associations.set(o, r);
|
|
1436
1442
|
}
|
|
1437
1443
|
}
|
|
1438
1444
|
return n !== void 0 && (o.colorSpace = n), e[t] = o, o;
|
|
@@ -1453,24 +1459,24 @@ class _s {
|
|
|
1453
1459
|
let s = e.material;
|
|
1454
1460
|
const n = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, o = t.attributes.normal === void 0;
|
|
1455
1461
|
if (e.isPoints) {
|
|
1456
|
-
const
|
|
1457
|
-
let
|
|
1458
|
-
|
|
1462
|
+
const a = "PointsMaterial:" + s.uuid;
|
|
1463
|
+
let r = this.cache.get(a);
|
|
1464
|
+
r || (r = new ut(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, r.sizeAttenuation = !1, this.cache.add(a, r)), s = r;
|
|
1459
1465
|
} else if (e.isLine) {
|
|
1460
|
-
const
|
|
1461
|
-
let
|
|
1462
|
-
|
|
1466
|
+
const a = "LineBasicMaterial:" + s.uuid;
|
|
1467
|
+
let r = this.cache.get(a);
|
|
1468
|
+
r || (r = new dt(), se.prototype.copy.call(r, s), r.color.copy(s.color), r.map = s.map, this.cache.add(a, r)), s = r;
|
|
1463
1469
|
}
|
|
1464
1470
|
if (n || i || o) {
|
|
1465
|
-
let
|
|
1466
|
-
n && (
|
|
1467
|
-
let
|
|
1468
|
-
|
|
1471
|
+
let a = "ClonedMaterial:" + s.uuid + ":";
|
|
1472
|
+
n && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), o && (a += "flat-shading:");
|
|
1473
|
+
let r = this.cache.get(a);
|
|
1474
|
+
r || (r = s.clone(), i && (r.vertexColors = !0), o && (r.flatShading = !0), n && (r.normalScale && (r.normalScale.y *= -1), r.clearcoatNormalScale && (r.clearcoatNormalScale.y *= -1)), this.cache.add(a, r), this.associations.set(r, this.associations.get(s))), s = r;
|
|
1469
1475
|
}
|
|
1470
1476
|
e.material = s;
|
|
1471
1477
|
}
|
|
1472
1478
|
getMaterialType() {
|
|
1473
|
-
return
|
|
1479
|
+
return He;
|
|
1474
1480
|
}
|
|
1475
1481
|
/**
|
|
1476
1482
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1482,34 +1488,34 @@ class _s {
|
|
|
1482
1488
|
loadMaterial(e) {
|
|
1483
1489
|
const t = this, s = this.json, n = this.extensions, i = s.materials[e];
|
|
1484
1490
|
let o;
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1491
|
+
const a = {}, r = i.extensions || {}, c = [];
|
|
1492
|
+
if (r[y.KHR_MATERIALS_UNLIT]) {
|
|
1487
1493
|
const h = n[y.KHR_MATERIALS_UNLIT];
|
|
1488
|
-
o = h.getMaterialType(), c.push(h.extendParams(
|
|
1494
|
+
o = h.getMaterialType(), c.push(h.extendParams(a, i, t));
|
|
1489
1495
|
} else {
|
|
1490
1496
|
const h = i.pbrMetallicRoughness || {};
|
|
1491
|
-
if (
|
|
1497
|
+
if (a.color = new H(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
|
|
1492
1498
|
const d = h.baseColorFactor;
|
|
1493
|
-
|
|
1499
|
+
a.color.setRGB(d[0], d[1], d[2], C), a.opacity = d[3];
|
|
1494
1500
|
}
|
|
1495
|
-
h.baseColorTexture !== void 0 && c.push(t.assignTexture(
|
|
1501
|
+
h.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", h.baseColorTexture, Y)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(d) {
|
|
1496
1502
|
return d.getMaterialType && d.getMaterialType(e);
|
|
1497
1503
|
}), c.push(Promise.all(this._invokeAll(function(d) {
|
|
1498
|
-
return d.extendMaterialParams && d.extendMaterialParams(e,
|
|
1504
|
+
return d.extendMaterialParams && d.extendMaterialParams(e, a);
|
|
1499
1505
|
})));
|
|
1500
1506
|
}
|
|
1501
|
-
i.doubleSided === !0 && (
|
|
1507
|
+
i.doubleSided === !0 && (a.side = pt);
|
|
1502
1508
|
const u = i.alphaMode || oe.OPAQUE;
|
|
1503
|
-
if (u === oe.BLEND ? (
|
|
1509
|
+
if (u === oe.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === oe.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && o !== V && (c.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new S(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1504
1510
|
const h = i.normalTexture.scale;
|
|
1505
|
-
|
|
1511
|
+
a.normalScale.set(h, h);
|
|
1506
1512
|
}
|
|
1507
|
-
if (i.occlusionTexture !== void 0 && o !==
|
|
1513
|
+
if (i.occlusionTexture !== void 0 && o !== V && (c.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && o !== V) {
|
|
1508
1514
|
const h = i.emissiveFactor;
|
|
1509
|
-
|
|
1515
|
+
a.emissive = new H().setRGB(h[0], h[1], h[2], C);
|
|
1510
1516
|
}
|
|
1511
|
-
return i.emissiveTexture !== void 0 && o !==
|
|
1512
|
-
const h = new o(
|
|
1517
|
+
return i.emissiveTexture !== void 0 && o !== V && c.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, Y)), Promise.all(c).then(function() {
|
|
1518
|
+
const h = new o(a);
|
|
1513
1519
|
return i.name && (h.name = i.name), D(h, i), t.associations.set(h, { materials: e }), i.extensions && j(n, h, i), h;
|
|
1514
1520
|
});
|
|
1515
1521
|
}
|
|
@@ -1535,19 +1541,19 @@ class _s {
|
|
|
1535
1541
|
*/
|
|
1536
1542
|
loadGeometries(e) {
|
|
1537
1543
|
const t = this, s = this.extensions, n = this.primitiveCache;
|
|
1538
|
-
function i(
|
|
1539
|
-
return s[y.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(
|
|
1540
|
-
return
|
|
1544
|
+
function i(a) {
|
|
1545
|
+
return s[y.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(r) {
|
|
1546
|
+
return Ne(r, a, t);
|
|
1541
1547
|
});
|
|
1542
1548
|
}
|
|
1543
1549
|
const o = [];
|
|
1544
|
-
for (let
|
|
1545
|
-
const c = e[
|
|
1550
|
+
for (let a = 0, r = e.length; a < r; a++) {
|
|
1551
|
+
const c = e[a], u = ps(c), h = n[u];
|
|
1546
1552
|
if (h)
|
|
1547
1553
|
o.push(h.promise);
|
|
1548
1554
|
else {
|
|
1549
1555
|
let d;
|
|
1550
|
-
c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d =
|
|
1556
|
+
c.extensions && c.extensions[y.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = Ne(new mt(), c, t), n[u] = { primitive: c, promise: d }, o.push(d);
|
|
1551
1557
|
}
|
|
1552
1558
|
}
|
|
1553
1559
|
return Promise.all(o);
|
|
@@ -1560,19 +1566,19 @@ class _s {
|
|
|
1560
1566
|
* @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
|
|
1561
1567
|
*/
|
|
1562
1568
|
loadMesh(e) {
|
|
1563
|
-
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives,
|
|
1564
|
-
for (let
|
|
1565
|
-
const u = o[
|
|
1566
|
-
|
|
1569
|
+
const t = this, s = this.json, n = this.extensions, i = s.meshes[e], o = i.primitives, a = [];
|
|
1570
|
+
for (let r = 0, c = o.length; r < c; r++) {
|
|
1571
|
+
const u = o[r].material === void 0 ? hs(this.cache) : this.getDependency("material", o[r].material);
|
|
1572
|
+
a.push(u);
|
|
1567
1573
|
}
|
|
1568
|
-
return
|
|
1569
|
-
const c =
|
|
1574
|
+
return a.push(t.loadGeometries(o)), Promise.all(a).then(function(r) {
|
|
1575
|
+
const c = r.slice(0, r.length - 1), u = r[r.length - 1], h = [];
|
|
1570
1576
|
for (let p = 0, m = u.length; p < m; p++) {
|
|
1571
1577
|
const g = u[p], f = o[p];
|
|
1572
1578
|
let _;
|
|
1573
1579
|
const x = c[p];
|
|
1574
1580
|
if (f.mode === L.TRIANGLES || f.mode === L.TRIANGLE_STRIP || f.mode === L.TRIANGLE_FAN || f.mode === void 0)
|
|
1575
|
-
_ = i.isSkinnedMesh === !0 ? new _t(g, x) : new gt(g, x), _.isSkinnedMesh === !0 && _.normalizeSkinWeights(), f.mode === L.TRIANGLE_STRIP ? _.geometry =
|
|
1581
|
+
_ = i.isSkinnedMesh === !0 ? new _t(g, x) : new gt(g, x), _.isSkinnedMesh === !0 && _.normalizeSkinWeights(), f.mode === L.TRIANGLE_STRIP ? _.geometry = Se(_.geometry, Ie) : f.mode === L.TRIANGLE_FAN && (_.geometry = Se(_.geometry, ce));
|
|
1576
1582
|
else if (f.mode === L.LINES)
|
|
1577
1583
|
_ = new Tt(g, x);
|
|
1578
1584
|
else if (f.mode === L.LINE_STRIP)
|
|
@@ -1613,7 +1619,7 @@ class _s {
|
|
|
1613
1619
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1614
1620
|
return;
|
|
1615
1621
|
}
|
|
1616
|
-
return s.type === "perspective" ? t = new bt(
|
|
1622
|
+
return s.type === "perspective" ? t = new bt(Ge.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);
|
|
1617
1623
|
}
|
|
1618
1624
|
/**
|
|
1619
1625
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1627,17 +1633,17 @@ class _s {
|
|
|
1627
1633
|
for (let n = 0, i = t.joints.length; n < i; n++)
|
|
1628
1634
|
s.push(this._loadNodeShallow(t.joints[n]));
|
|
1629
1635
|
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,
|
|
1636
|
+
const i = n.pop(), o = n, a = [], r = [];
|
|
1631
1637
|
for (let c = 0, u = o.length; c < u; c++) {
|
|
1632
1638
|
const h = o[c];
|
|
1633
1639
|
if (h) {
|
|
1634
|
-
|
|
1640
|
+
a.push(h);
|
|
1635
1641
|
const d = new q();
|
|
1636
|
-
i !== null && d.fromArray(i.array, c * 16),
|
|
1642
|
+
i !== null && d.fromArray(i.array, c * 16), r.push(d);
|
|
1637
1643
|
} else
|
|
1638
1644
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
1639
1645
|
}
|
|
1640
|
-
return new Mt(
|
|
1646
|
+
return new Mt(a, r);
|
|
1641
1647
|
});
|
|
1642
1648
|
}
|
|
1643
1649
|
/**
|
|
@@ -1648,15 +1654,15 @@ class _s {
|
|
|
1648
1654
|
* @return {Promise<AnimationClip>}
|
|
1649
1655
|
*/
|
|
1650
1656
|
loadAnimation(e) {
|
|
1651
|
-
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [],
|
|
1657
|
+
const t = this.json, s = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, o = [], a = [], r = [], c = [], u = [];
|
|
1652
1658
|
for (let h = 0, d = n.channels.length; h < d; h++) {
|
|
1653
1659
|
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)),
|
|
1660
|
+
g.node !== void 0 && (o.push(this.getDependency("node", f)), a.push(this.getDependency("accessor", _)), r.push(this.getDependency("accessor", x)), c.push(m), u.push(g));
|
|
1655
1661
|
}
|
|
1656
1662
|
return Promise.all([
|
|
1657
1663
|
Promise.all(o),
|
|
1658
|
-
Promise.all(r),
|
|
1659
1664
|
Promise.all(a),
|
|
1665
|
+
Promise.all(r),
|
|
1660
1666
|
Promise.all(c),
|
|
1661
1667
|
Promise.all(u)
|
|
1662
1668
|
]).then(function(h) {
|
|
@@ -1677,10 +1683,10 @@ class _s {
|
|
|
1677
1683
|
const t = this.json, s = this, n = t.nodes[e];
|
|
1678
1684
|
return n.mesh === void 0 ? null : s.getDependency("mesh", n.mesh).then(function(i) {
|
|
1679
1685
|
const o = s._getNodeRef(s.meshCache, n.mesh, i);
|
|
1680
|
-
return n.weights !== void 0 && o.traverse(function(
|
|
1681
|
-
if (
|
|
1682
|
-
for (let
|
|
1683
|
-
|
|
1686
|
+
return n.weights !== void 0 && o.traverse(function(a) {
|
|
1687
|
+
if (a.isMesh)
|
|
1688
|
+
for (let r = 0, c = n.weights.length; r < c; r++)
|
|
1689
|
+
a.morphTargetInfluences[r] = n.weights[r];
|
|
1684
1690
|
}), o;
|
|
1685
1691
|
});
|
|
1686
1692
|
}
|
|
@@ -1692,14 +1698,14 @@ class _s {
|
|
|
1692
1698
|
* @return {Promise<Object3D>}
|
|
1693
1699
|
*/
|
|
1694
1700
|
loadNode(e) {
|
|
1695
|
-
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [],
|
|
1696
|
-
for (let c = 0, u =
|
|
1697
|
-
o.push(s.getDependency("node",
|
|
1698
|
-
const
|
|
1701
|
+
const t = this.json, s = this, n = t.nodes[e], i = s._loadNodeShallow(e), o = [], a = n.children || [];
|
|
1702
|
+
for (let c = 0, u = a.length; c < u; c++)
|
|
1703
|
+
o.push(s.getDependency("node", a[c]));
|
|
1704
|
+
const r = n.skin === void 0 ? Promise.resolve(null) : s.getDependency("skin", n.skin);
|
|
1699
1705
|
return Promise.all([
|
|
1700
1706
|
i,
|
|
1701
1707
|
Promise.all(o),
|
|
1702
|
-
|
|
1708
|
+
r
|
|
1703
1709
|
]).then(function(c) {
|
|
1704
1710
|
const u = c[0], h = c[1], d = c[2];
|
|
1705
1711
|
d !== null && u.traverse(function(p) {
|
|
@@ -1716,18 +1722,18 @@ class _s {
|
|
|
1716
1722
|
const t = this.json, s = this.extensions, n = this;
|
|
1717
1723
|
if (this.nodeCache[e] !== void 0)
|
|
1718
1724
|
return this.nodeCache[e];
|
|
1719
|
-
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "",
|
|
1725
|
+
const i = t.nodes[e], o = i.name ? n.createUniqueName(i.name) : "", a = [], r = n._invokeOne(function(c) {
|
|
1720
1726
|
return c.createNodeMesh && c.createNodeMesh(e);
|
|
1721
1727
|
});
|
|
1722
|
-
return
|
|
1728
|
+
return r && a.push(r), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(c) {
|
|
1723
1729
|
return n._getNodeRef(n.cameraCache, i.camera, c);
|
|
1724
1730
|
})), n._invokeAll(function(c) {
|
|
1725
1731
|
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
1726
1732
|
}).forEach(function(c) {
|
|
1727
|
-
|
|
1728
|
-
}), this.nodeCache[e] = Promise.all(
|
|
1733
|
+
a.push(c);
|
|
1734
|
+
}), this.nodeCache[e] = Promise.all(a).then(function(c) {
|
|
1729
1735
|
let u;
|
|
1730
|
-
if (i.isBone === !0 ? u = new St() : c.length > 1 ? u = new ne() : c.length === 1 ? u = c[0] : u = new
|
|
1736
|
+
if (i.isBone === !0 ? u = new St() : c.length > 1 ? u = new ne() : c.length === 1 ? u = c[0] : u = new ke(), u !== c[0])
|
|
1731
1737
|
for (let h = 0, d = c.length; h < d; h++)
|
|
1732
1738
|
u.add(c[h]);
|
|
1733
1739
|
if (i.name && (u.userData.name = i.name, u.name = o), D(u, i), i.extensions && j(s, u, i), i.matrix !== void 0) {
|
|
@@ -1754,16 +1760,16 @@ class _s {
|
|
|
1754
1760
|
loadScene(e) {
|
|
1755
1761
|
const t = this.extensions, s = this.json.scenes[e], n = this, i = new ne();
|
|
1756
1762
|
s.name && (i.name = n.createUniqueName(s.name)), D(i, s), s.extensions && j(t, i, s);
|
|
1757
|
-
const o = s.nodes || [],
|
|
1758
|
-
for (let
|
|
1759
|
-
|
|
1760
|
-
return Promise.all(
|
|
1761
|
-
for (let u = 0, h =
|
|
1762
|
-
i.add(
|
|
1763
|
+
const o = s.nodes || [], a = [];
|
|
1764
|
+
for (let r = 0, c = o.length; r < c; r++)
|
|
1765
|
+
a.push(n.getDependency("node", o[r]));
|
|
1766
|
+
return Promise.all(a).then(function(r) {
|
|
1767
|
+
for (let u = 0, h = r.length; u < h; u++)
|
|
1768
|
+
i.add(r[u]);
|
|
1763
1769
|
const c = (u) => {
|
|
1764
1770
|
const h = /* @__PURE__ */ new Map();
|
|
1765
1771
|
for (const [d, p] of n.associations)
|
|
1766
|
-
(d instanceof se || d instanceof
|
|
1772
|
+
(d instanceof se || d instanceof ge) && h.set(d, p);
|
|
1767
1773
|
return u.traverse((d) => {
|
|
1768
1774
|
const p = n.associations.get(d);
|
|
1769
1775
|
p != null && h.set(d, p);
|
|
@@ -1773,39 +1779,39 @@ class _s {
|
|
|
1773
1779
|
});
|
|
1774
1780
|
}
|
|
1775
1781
|
_createAnimationTracks(e, t, s, n, i) {
|
|
1776
|
-
const o = [],
|
|
1782
|
+
const o = [], a = e.name ? e.name : e.uuid, r = [];
|
|
1777
1783
|
k[i.path] === k.weights ? e.traverse(function(d) {
|
|
1778
|
-
d.morphTargetInfluences &&
|
|
1779
|
-
}) :
|
|
1784
|
+
d.morphTargetInfluences && r.push(d.name ? d.name : d.uuid);
|
|
1785
|
+
}) : r.push(a);
|
|
1780
1786
|
let c;
|
|
1781
1787
|
switch (k[i.path]) {
|
|
1782
1788
|
case k.weights:
|
|
1783
|
-
c =
|
|
1789
|
+
c = ye;
|
|
1784
1790
|
break;
|
|
1785
1791
|
case k.rotation:
|
|
1786
|
-
c =
|
|
1792
|
+
c = xe;
|
|
1787
1793
|
break;
|
|
1788
1794
|
case k.translation:
|
|
1789
1795
|
case k.scale:
|
|
1790
|
-
c =
|
|
1796
|
+
c = Te;
|
|
1791
1797
|
break;
|
|
1792
1798
|
default:
|
|
1793
1799
|
switch (s.itemSize) {
|
|
1794
1800
|
case 1:
|
|
1795
|
-
c =
|
|
1801
|
+
c = ye;
|
|
1796
1802
|
break;
|
|
1797
1803
|
case 2:
|
|
1798
1804
|
case 3:
|
|
1799
1805
|
default:
|
|
1800
|
-
c =
|
|
1806
|
+
c = Te;
|
|
1801
1807
|
break;
|
|
1802
1808
|
}
|
|
1803
1809
|
break;
|
|
1804
1810
|
}
|
|
1805
|
-
const u = n.interpolation !== void 0 ? ls[n.interpolation] :
|
|
1806
|
-
for (let d = 0, p =
|
|
1811
|
+
const u = n.interpolation !== void 0 ? ls[n.interpolation] : Ue, h = this._getArrayFromAccessor(s);
|
|
1812
|
+
for (let d = 0, p = r.length; d < p; d++) {
|
|
1807
1813
|
const m = new c(
|
|
1808
|
-
|
|
1814
|
+
r[d] + "." + k[i.path],
|
|
1809
1815
|
t.array,
|
|
1810
1816
|
h,
|
|
1811
1817
|
u
|
|
@@ -1817,7 +1823,7 @@ class _s {
|
|
|
1817
1823
|
_getArrayFromAccessor(e) {
|
|
1818
1824
|
let t = e.array;
|
|
1819
1825
|
if (e.normalized) {
|
|
1820
|
-
const s =
|
|
1826
|
+
const s = fe(t.constructor), n = new Float32Array(t.length);
|
|
1821
1827
|
for (let i = 0, o = t.length; i < o; i++)
|
|
1822
1828
|
n[i] = t[i] * s;
|
|
1823
1829
|
t = n;
|
|
@@ -1826,7 +1832,7 @@ class _s {
|
|
|
1826
1832
|
}
|
|
1827
1833
|
_createCubicSplineTrackInterpolant(e) {
|
|
1828
1834
|
e.createInterpolant = function(s) {
|
|
1829
|
-
const n = this instanceof
|
|
1835
|
+
const n = this instanceof xe ? cs : Be;
|
|
1830
1836
|
return new n(this.times, this.values, this.getValueSize() / 3, s);
|
|
1831
1837
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1832
1838
|
}
|
|
@@ -1834,13 +1840,13 @@ class _s {
|
|
|
1834
1840
|
function gs(l, e, t) {
|
|
1835
1841
|
const s = e.attributes, n = new Nt();
|
|
1836
1842
|
if (s.POSITION !== void 0) {
|
|
1837
|
-
const
|
|
1838
|
-
if (
|
|
1843
|
+
const a = t.json.accessors[s.POSITION], r = a.min, c = a.max;
|
|
1844
|
+
if (r !== void 0 && c !== void 0) {
|
|
1839
1845
|
if (n.set(
|
|
1840
|
-
new M(
|
|
1846
|
+
new M(r[0], r[1], r[2]),
|
|
1841
1847
|
new M(c[0], c[1], c[2])
|
|
1842
|
-
),
|
|
1843
|
-
const u =
|
|
1848
|
+
), a.normalized) {
|
|
1849
|
+
const u = fe(K[a.componentType]);
|
|
1844
1850
|
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
1845
1851
|
}
|
|
1846
1852
|
} else {
|
|
@@ -1851,49 +1857,49 @@ function gs(l, e, t) {
|
|
|
1851
1857
|
return;
|
|
1852
1858
|
const i = e.targets;
|
|
1853
1859
|
if (i !== void 0) {
|
|
1854
|
-
const
|
|
1860
|
+
const a = new M(), r = new M();
|
|
1855
1861
|
for (let c = 0, u = i.length; c < u; c++) {
|
|
1856
1862
|
const h = i[c];
|
|
1857
1863
|
if (h.POSITION !== void 0) {
|
|
1858
1864
|
const d = t.json.accessors[h.POSITION], p = d.min, m = d.max;
|
|
1859
1865
|
if (p !== void 0 && m !== void 0) {
|
|
1860
|
-
if (
|
|
1861
|
-
const g =
|
|
1862
|
-
|
|
1866
|
+
if (r.setX(Math.max(Math.abs(p[0]), Math.abs(m[0]))), r.setY(Math.max(Math.abs(p[1]), Math.abs(m[1]))), r.setZ(Math.max(Math.abs(p[2]), Math.abs(m[2]))), d.normalized) {
|
|
1867
|
+
const g = fe(K[d.componentType]);
|
|
1868
|
+
r.multiplyScalar(g);
|
|
1863
1869
|
}
|
|
1864
|
-
|
|
1870
|
+
a.max(r);
|
|
1865
1871
|
} else
|
|
1866
1872
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1867
1873
|
}
|
|
1868
1874
|
}
|
|
1869
|
-
n.expandByVector(
|
|
1875
|
+
n.expandByVector(a);
|
|
1870
1876
|
}
|
|
1871
1877
|
l.boundingBox = n;
|
|
1872
1878
|
const o = new Ot();
|
|
1873
1879
|
n.getCenter(o.center), o.radius = n.min.distanceTo(n.max) / 2, l.boundingSphere = o;
|
|
1874
1880
|
}
|
|
1875
|
-
function
|
|
1881
|
+
function Ne(l, e, t) {
|
|
1876
1882
|
const s = e.attributes, n = [];
|
|
1877
|
-
function i(o,
|
|
1878
|
-
return t.getDependency("accessor", o).then(function(
|
|
1879
|
-
l.setAttribute(
|
|
1883
|
+
function i(o, a) {
|
|
1884
|
+
return t.getDependency("accessor", o).then(function(r) {
|
|
1885
|
+
l.setAttribute(a, r);
|
|
1880
1886
|
});
|
|
1881
1887
|
}
|
|
1882
1888
|
for (const o in s) {
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1889
|
+
const a = pe[o] || o.toLowerCase();
|
|
1890
|
+
a in l.attributes || n.push(i(s[o], a));
|
|
1885
1891
|
}
|
|
1886
1892
|
if (e.indices !== void 0 && !l.index) {
|
|
1887
|
-
const o = t.getDependency("accessor", e.indices).then(function(
|
|
1888
|
-
l.setIndex(
|
|
1893
|
+
const o = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1894
|
+
l.setIndex(a);
|
|
1889
1895
|
});
|
|
1890
1896
|
n.push(o);
|
|
1891
1897
|
}
|
|
1892
|
-
return
|
|
1898
|
+
return Ee.workingColorSpace !== C && "COLOR_0" in s && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ee.workingColorSpace}" not supported.`), D(l, e), gs(l, e, t), Promise.all(n).then(function() {
|
|
1893
1899
|
return e.targets !== void 0 ? us(l, e.targets, t) : l;
|
|
1894
1900
|
});
|
|
1895
1901
|
}
|
|
1896
|
-
const
|
|
1902
|
+
const Oe = { type: "change" }, _e = { type: "start" }, ze = { type: "end" }, W = new Ct(), De = new It(), Ts = Math.cos(70 * Ge.DEG2RAD), R = new M(), w = 2 * Math.PI, E = {
|
|
1897
1903
|
NONE: -1,
|
|
1898
1904
|
ROTATE: 0,
|
|
1899
1905
|
DOLLY: 1,
|
|
@@ -1911,7 +1917,7 @@ class ys extends Dt {
|
|
|
1911
1917
|
* @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
|
|
1912
1918
|
*/
|
|
1913
1919
|
constructor(e, t = null) {
|
|
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
|
|
1920
|
+
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 be(), this._sphericalDelta = new be(), 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();
|
|
1915
1921
|
}
|
|
1916
1922
|
connect(e) {
|
|
1917
1923
|
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";
|
|
@@ -1972,7 +1978,7 @@ class ys extends Dt {
|
|
|
1972
1978
|
* was called, or the initial state.
|
|
1973
1979
|
*/
|
|
1974
1980
|
reset() {
|
|
1975
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
1981
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(Oe), this.update(), this.state = E.NONE;
|
|
1976
1982
|
}
|
|
1977
1983
|
update(e = null) {
|
|
1978
1984
|
const t = this.object.position;
|
|
@@ -1989,25 +1995,25 @@ class ys extends Dt {
|
|
|
1989
1995
|
if (R.setFromSpherical(this._spherical), R.applyQuaternion(this._quatInverse), t.copy(this.target).add(R), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
1990
1996
|
let o = null;
|
|
1991
1997
|
if (this.object.isPerspectiveCamera) {
|
|
1992
|
-
const
|
|
1993
|
-
o = this._clampDistance(
|
|
1994
|
-
const
|
|
1995
|
-
this.object.position.addScaledVector(this._dollyDirection,
|
|
1998
|
+
const a = R.length();
|
|
1999
|
+
o = this._clampDistance(a * this._scale);
|
|
2000
|
+
const r = a - o;
|
|
2001
|
+
this.object.position.addScaledVector(this._dollyDirection, r), this.object.updateMatrixWorld(), i = !!r;
|
|
1996
2002
|
} else if (this.object.isOrthographicCamera) {
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1999
|
-
const
|
|
2000
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i =
|
|
2003
|
+
const a = new M(this._mouse.x, this._mouse.y, 0);
|
|
2004
|
+
a.unproject(this.object);
|
|
2005
|
+
const r = this.object.zoom;
|
|
2006
|
+
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), i = r !== this.object.zoom;
|
|
2001
2007
|
const c = new M(this._mouse.x, this._mouse.y, 0);
|
|
2002
|
-
c.unproject(this.object), this.object.position.sub(c).add(
|
|
2008
|
+
c.unproject(this.object), this.object.position.sub(c).add(a), this.object.updateMatrixWorld(), o = R.length();
|
|
2003
2009
|
} else
|
|
2004
2010
|
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
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) : (
|
|
2011
|
+
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) : (De.setFromNormalAndCoplanarPoint(this.object.up, this.target), W.intersectPlane(De, this.target))));
|
|
2006
2012
|
} else if (this.object.isOrthographicCamera) {
|
|
2007
2013
|
const o = this.object.zoom;
|
|
2008
2014
|
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);
|
|
2009
2015
|
}
|
|
2010
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > ae || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ae || this._lastTargetPosition.distanceToSquared(this.target) > ae ? (this.dispatchEvent(
|
|
2016
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > ae || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > ae || this._lastTargetPosition.distanceToSquared(this.target) > ae ? (this.dispatchEvent(Oe), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
2011
2017
|
}
|
|
2012
2018
|
_getAutoRotationAngle(e) {
|
|
2013
2019
|
return e !== null ? w / 60 * this.autoRotateSpeed * e : w / 60 / 60 * this.autoRotateSpeed;
|
|
@@ -2048,8 +2054,8 @@ class ys extends Dt {
|
|
|
2048
2054
|
if (!this.zoomToCursor)
|
|
2049
2055
|
return;
|
|
2050
2056
|
this._performCursorZoom = !0;
|
|
2051
|
-
const s = this.domElement.getBoundingClientRect(), n = e - s.left, i = t - s.top, o = s.width,
|
|
2052
|
-
this._mouse.x = n / o * 2 - 1, this._mouse.y = -(i /
|
|
2057
|
+
const s = this.domElement.getBoundingClientRect(), n = e - s.left, i = t - s.top, o = s.width, a = s.height;
|
|
2058
|
+
this._mouse.x = n / o * 2 - 1, this._mouse.y = -(i / a) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
2053
2059
|
}
|
|
2054
2060
|
_clampDistance(e) {
|
|
2055
2061
|
return Math.max(this.minDistance, Math.min(this.maxDistance, e));
|
|
@@ -2147,8 +2153,8 @@ class ys extends Dt {
|
|
|
2147
2153
|
_handleTouchMoveDolly(e) {
|
|
2148
2154
|
const t = this._getSecondPointerPosition(e), s = e.pageX - t.x, n = e.pageY - t.y, i = Math.sqrt(s * s + n * n);
|
|
2149
2155
|
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);
|
|
2150
|
-
const o = (e.pageX + t.x) * 0.5,
|
|
2151
|
-
this._updateZoomParameters(o,
|
|
2156
|
+
const o = (e.pageX + t.x) * 0.5, a = (e.pageY + t.y) * 0.5;
|
|
2157
|
+
this._updateZoomParameters(o, a);
|
|
2152
2158
|
}
|
|
2153
2159
|
_handleTouchMoveDollyPan(e) {
|
|
2154
2160
|
this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
|
|
@@ -2208,7 +2214,7 @@ function Es(l) {
|
|
|
2208
2214
|
function bs(l) {
|
|
2209
2215
|
switch (this._removePointer(l), this._pointers.length) {
|
|
2210
2216
|
case 0:
|
|
2211
|
-
this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
2217
|
+
this.domElement.releasePointerCapture(l.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(ze), this.state = E.NONE;
|
|
2212
2218
|
break;
|
|
2213
2219
|
case 1:
|
|
2214
2220
|
const e = this._pointers[0], t = this._pointerPositions[e];
|
|
@@ -2257,7 +2263,7 @@ function Rs(l) {
|
|
|
2257
2263
|
default:
|
|
2258
2264
|
this.state = E.NONE;
|
|
2259
2265
|
}
|
|
2260
|
-
this.state !== E.NONE && this.dispatchEvent(
|
|
2266
|
+
this.state !== E.NONE && this.dispatchEvent(_e);
|
|
2261
2267
|
}
|
|
2262
2268
|
function Ms(l) {
|
|
2263
2269
|
switch (this.state) {
|
|
@@ -2276,7 +2282,7 @@ function Ms(l) {
|
|
|
2276
2282
|
}
|
|
2277
2283
|
}
|
|
2278
2284
|
function ws(l) {
|
|
2279
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(
|
|
2285
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== E.NONE || (l.preventDefault(), this.dispatchEvent(_e), this._handleMouseWheel(this._customWheelEvent(l)), this.dispatchEvent(ze));
|
|
2280
2286
|
}
|
|
2281
2287
|
function Ss(l) {
|
|
2282
2288
|
this.enabled !== !1 && this._handleKeyDown(l);
|
|
@@ -2314,7 +2320,7 @@ function As(l) {
|
|
|
2314
2320
|
default:
|
|
2315
2321
|
this.state = E.NONE;
|
|
2316
2322
|
}
|
|
2317
|
-
this.state !== E.NONE && this.dispatchEvent(
|
|
2323
|
+
this.state !== E.NONE && this.dispatchEvent(_e);
|
|
2318
2324
|
}
|
|
2319
2325
|
function Ls(l) {
|
|
2320
2326
|
switch (this._trackPointer(l), this.state) {
|
|
@@ -2378,19 +2384,19 @@ const Ds = (l, e) => {
|
|
|
2378
2384
|
},
|
|
2379
2385
|
emits: ["initialized", "animate"],
|
|
2380
2386
|
setup(l, { emit: e }) {
|
|
2381
|
-
const t = e, s = l, n = "dom" +
|
|
2382
|
-
let o = null,
|
|
2387
|
+
const t = e, s = l, n = "dom" + Ve().uid, i = Xe(n);
|
|
2388
|
+
let o = null, a = null, r = null, c = null, u = null;
|
|
2383
2389
|
const h = () => {
|
|
2384
2390
|
t("animate", {
|
|
2385
|
-
GLTFLoader:
|
|
2391
|
+
GLTFLoader: de,
|
|
2386
2392
|
THREE: N,
|
|
2387
|
-
VRMExpressionPresetName:
|
|
2388
|
-
VRMHumanBoneName:
|
|
2389
|
-
camera:
|
|
2393
|
+
VRMExpressionPresetName: Me,
|
|
2394
|
+
VRMHumanBoneName: Re,
|
|
2395
|
+
camera: r,
|
|
2390
2396
|
controls: u,
|
|
2391
2397
|
renderer: c,
|
|
2392
|
-
scene:
|
|
2393
|
-
}), o != null && (cancelAnimationFrame(o), o = null), s.animation && (o = requestAnimationFrame(h)), c.render(
|
|
2398
|
+
scene: a
|
|
2399
|
+
}), o != null && (cancelAnimationFrame(o), o = null), s.animation && (o = requestAnimationFrame(h)), c.render(a, r);
|
|
2394
2400
|
}, d = () => {
|
|
2395
2401
|
o != null && (cancelAnimationFrame(o), o = null), o = requestAnimationFrame(h);
|
|
2396
2402
|
}, p = () => {
|
|
@@ -2404,48 +2410,48 @@ const Ds = (l, e) => {
|
|
|
2404
2410
|
antialias: !0,
|
|
2405
2411
|
alpha: !1
|
|
2406
2412
|
};
|
|
2407
|
-
if (N.ColorManagement.enabled = !1, c = new N.WebGLRenderer(x), c.setPixelRatio(window.devicePixelRatio), c.setSize(f, _), c.setClearColor(8372223, 1), c.outputColorSpace = N.SRGBColorSpace, g.appendChild(c.domElement),
|
|
2413
|
+
if (N.ColorManagement.enabled = !1, c = new N.WebGLRenderer(x), c.setPixelRatio(window.devicePixelRatio), c.setSize(f, _), c.setClearColor(8372223, 1), c.outputColorSpace = N.SRGBColorSpace, g.appendChild(c.domElement), a = new N.Scene(), r = new N.PerspectiveCamera(
|
|
2408
2414
|
45,
|
|
2409
2415
|
f / _,
|
|
2410
2416
|
0.1,
|
|
2411
2417
|
1e3
|
|
2412
|
-
),
|
|
2418
|
+
), r.position.set(0, 1.25, 1), s.useOrbitControls && (u = new ys(r, g), u.screenSpacePanning = !0, u.target.set(0, 1.25, 0), u.update()), s.useGridHelper) {
|
|
2413
2419
|
const T = new N.GridHelper(10, 10);
|
|
2414
|
-
|
|
2420
|
+
a.add(T), T.visible = !0;
|
|
2415
2421
|
}
|
|
2416
2422
|
if (s.useAxesHelper) {
|
|
2417
2423
|
const T = new N.AxesHelper(5);
|
|
2418
|
-
|
|
2424
|
+
a.add(T);
|
|
2419
2425
|
}
|
|
2420
2426
|
if (s.useDefaultLight) {
|
|
2421
2427
|
const T = new N.DirectionalLight(16777215);
|
|
2422
|
-
T.intensity = 3, T.position.set(1, 1, 1).normalize(),
|
|
2428
|
+
T.intensity = 3, T.position.set(1, 1, 1).normalize(), a.add(T);
|
|
2423
2429
|
const A = new N.AmbientLight(4210752);
|
|
2424
|
-
|
|
2430
|
+
a.add(A);
|
|
2425
2431
|
}
|
|
2426
2432
|
t("initialized", {
|
|
2427
|
-
GLTFLoader:
|
|
2433
|
+
GLTFLoader: de,
|
|
2428
2434
|
THREE: N,
|
|
2429
|
-
VRMExpressionPresetName:
|
|
2430
|
-
VRMHumanBoneName:
|
|
2431
|
-
camera:
|
|
2435
|
+
VRMExpressionPresetName: Me,
|
|
2436
|
+
VRMHumanBoneName: Re,
|
|
2437
|
+
camera: r,
|
|
2432
2438
|
controls: u,
|
|
2433
2439
|
renderer: c,
|
|
2434
|
-
scene:
|
|
2440
|
+
scene: a
|
|
2435
2441
|
});
|
|
2436
2442
|
};
|
|
2437
2443
|
return $(async () => {
|
|
2438
|
-
if (!
|
|
2439
|
-
const f =
|
|
2444
|
+
if (!we.isWebGL2Available()) {
|
|
2445
|
+
const f = we.getWebGLErrorMessage();
|
|
2440
2446
|
console.error(f);
|
|
2441
2447
|
return;
|
|
2442
2448
|
}
|
|
2443
2449
|
const g = () => {
|
|
2444
2450
|
const f = i.value, _ = f.clientWidth, x = f.clientHeight;
|
|
2445
|
-
c.setPixelRatio(window.devicePixelRatio), c.setSize(_, x),
|
|
2451
|
+
c.setPixelRatio(window.devicePixelRatio), c.setSize(_, x), r.aspect = _ / x, r.updateProjectionMatrix();
|
|
2446
2452
|
};
|
|
2447
2453
|
window.addEventListener("resize", g), m();
|
|
2448
|
-
}), (g, f) => (
|
|
2454
|
+
}), (g, f) => (me(), Ce("div", {
|
|
2449
2455
|
ref: n,
|
|
2450
2456
|
class: "box"
|
|
2451
2457
|
}));
|
|
@@ -2473,13 +2479,13 @@ const Ds = (l, e) => {
|
|
|
2473
2479
|
if (!o)
|
|
2474
2480
|
return;
|
|
2475
2481
|
t("loading", s.name, s.command);
|
|
2476
|
-
const
|
|
2482
|
+
const r = await new ue().fetchExpression(o);
|
|
2477
2483
|
let c = !1;
|
|
2478
|
-
|
|
2484
|
+
r && (c = !0), t("loaded", s.name, s.command, c, r);
|
|
2479
2485
|
}, i = (o) => {
|
|
2480
2486
|
t("loading", s.name, s.command);
|
|
2481
|
-
let
|
|
2482
|
-
o && (
|
|
2487
|
+
let a = !1;
|
|
2488
|
+
o && (a = !0), t("loaded", s.name, s.command, a, o);
|
|
2483
2489
|
};
|
|
2484
2490
|
return $(async () => {
|
|
2485
2491
|
s.data != null ? i(s.data) : n(s.url);
|
|
@@ -2487,7 +2493,7 @@ const Ds = (l, e) => {
|
|
|
2487
2493
|
s.data != null && i(s.data);
|
|
2488
2494
|
}), F(() => s.url, () => {
|
|
2489
2495
|
s.url && n(s.url);
|
|
2490
|
-
}), (o,
|
|
2496
|
+
}), (o, a) => null;
|
|
2491
2497
|
}
|
|
2492
2498
|
}, vs = {
|
|
2493
2499
|
__name: "VroidPose",
|
|
@@ -2512,13 +2518,14 @@ const Ds = (l, e) => {
|
|
|
2512
2518
|
if (!o)
|
|
2513
2519
|
return;
|
|
2514
2520
|
t("loading", s.name, s.command);
|
|
2515
|
-
const
|
|
2521
|
+
const r = await new ue().fetchPose(o);
|
|
2516
2522
|
let c = !1;
|
|
2517
|
-
|
|
2523
|
+
r && (c = !0), t("loaded", s.name, s.command, c, r);
|
|
2518
2524
|
}, i = (o) => {
|
|
2519
2525
|
t("loading", s.name, s.command);
|
|
2520
|
-
|
|
2521
|
-
|
|
2526
|
+
const r = new ue().normalizePose(o);
|
|
2527
|
+
let c = !1;
|
|
2528
|
+
r && (c = !0), t("loaded", s.name, s.command, c, r);
|
|
2522
2529
|
};
|
|
2523
2530
|
return $(async () => {
|
|
2524
2531
|
s.data != null ? i(s.data) : n(s.url);
|
|
@@ -2526,7 +2533,7 @@ const Ds = (l, e) => {
|
|
|
2526
2533
|
s.data != null && i(s.data);
|
|
2527
2534
|
}), F(() => s.url, () => {
|
|
2528
2535
|
s.url && n(s.url);
|
|
2529
|
-
}), (o,
|
|
2536
|
+
}), (o, a) => null;
|
|
2530
2537
|
}
|
|
2531
2538
|
}, ks = {
|
|
2532
2539
|
__name: "VroidVrm",
|
|
@@ -2547,23 +2554,23 @@ const Ds = (l, e) => {
|
|
|
2547
2554
|
},
|
|
2548
2555
|
emits: ["loading", "loaded"],
|
|
2549
2556
|
setup(l, { emit: e }) {
|
|
2550
|
-
const t = e, s = l, n = async (
|
|
2551
|
-
const
|
|
2552
|
-
return
|
|
2557
|
+
const t = e, s = l, n = async (a) => {
|
|
2558
|
+
const r = new de();
|
|
2559
|
+
return r.register((c) => new vt(c)), await r.loadAsync(a).then((c) => {
|
|
2553
2560
|
const u = c.userData.vrm;
|
|
2554
2561
|
return kt.rotateVRM0(u), u;
|
|
2555
2562
|
});
|
|
2556
|
-
}, i = async (
|
|
2557
|
-
if (!
|
|
2563
|
+
}, i = async (a) => {
|
|
2564
|
+
if (!a)
|
|
2558
2565
|
return;
|
|
2559
2566
|
t("loading", s.name, s.command);
|
|
2560
|
-
const
|
|
2567
|
+
const r = await n(a);
|
|
2561
2568
|
let c = !1;
|
|
2562
|
-
|
|
2563
|
-
}, o = (
|
|
2569
|
+
r && (c = !0), t("loaded", s.name, s.command, c, r);
|
|
2570
|
+
}, o = (a) => {
|
|
2564
2571
|
t("loading", s.name, s.command);
|
|
2565
|
-
let
|
|
2566
|
-
|
|
2572
|
+
let r = !1;
|
|
2573
|
+
a && (r = !0), t("loaded", s.name, s.command, r, a);
|
|
2567
2574
|
};
|
|
2568
2575
|
return $(async () => {
|
|
2569
2576
|
s.data != null ? o(s.data) : i(s.url);
|
|
@@ -2571,7 +2578,7 @@ const Ds = (l, e) => {
|
|
|
2571
2578
|
s.data != null && o(s.data);
|
|
2572
2579
|
}), F(() => s.url, () => {
|
|
2573
2580
|
s.url && i(s.url);
|
|
2574
|
-
}), (
|
|
2581
|
+
}), (a, r) => null;
|
|
2575
2582
|
}
|
|
2576
2583
|
}, js = {
|
|
2577
2584
|
__name: "VroidModel",
|
|
@@ -2612,20 +2619,20 @@ const Ds = (l, e) => {
|
|
|
2612
2619
|
},
|
|
2613
2620
|
emits: ["loading", "loaded"],
|
|
2614
2621
|
setup(l, { emit: e }) {
|
|
2615
|
-
const t = e, s = l, n = {}, i = {}, o = Z(null),
|
|
2622
|
+
const t = e, s = l, n = {}, i = {}, o = Z(null), a = Z(null), r = Z(null), c = (h, d) => {
|
|
2616
2623
|
const p = Object.keys(n).length;
|
|
2617
2624
|
n[h] = d;
|
|
2618
2625
|
const m = Object.keys(n).length;
|
|
2619
2626
|
p == 0 && m && t("loading", s.name);
|
|
2620
2627
|
}, u = (h, d, p, m) => {
|
|
2621
2628
|
const g = Object.keys(n).length;
|
|
2622
|
-
p && (d == "load_expression" && (o.value = m), d == "load_pose" && (
|
|
2629
|
+
p && (d == "load_expression" && (o.value = m), d == "load_pose" && (a.value = m), d == "load_vrm" && (r.value = m), i[h] = d), delete n[h];
|
|
2623
2630
|
const f = Object.keys(n).length;
|
|
2624
2631
|
if (g && f == 0) {
|
|
2625
2632
|
const _ = {};
|
|
2626
2633
|
for (const b in i) {
|
|
2627
2634
|
const T = i[b];
|
|
2628
|
-
T == "load_expression" && (_.expression = o.value), T == "load_pose" && (_.pose =
|
|
2635
|
+
T == "load_expression" && (_.expression = o.value), T == "load_pose" && (_.pose = a.value), T == "load_vrm" && (_.vrm = r.value);
|
|
2629
2636
|
}
|
|
2630
2637
|
t("loaded", s.name, _);
|
|
2631
2638
|
const x = Object.keys(i);
|
|
@@ -2633,7 +2640,7 @@ const Ds = (l, e) => {
|
|
|
2633
2640
|
delete i[b];
|
|
2634
2641
|
}
|
|
2635
2642
|
};
|
|
2636
|
-
return (h, d) => (
|
|
2643
|
+
return (h, d) => (me(), Ce(Ye, null, [
|
|
2637
2644
|
ee(Is, {
|
|
2638
2645
|
command: "load_expression",
|
|
2639
2646
|
name: s.expression_name,
|
|
@@ -2710,10 +2717,10 @@ const Ds = (l, e) => {
|
|
|
2710
2717
|
s.value = new jt();
|
|
2711
2718
|
const n = (o) => {
|
|
2712
2719
|
t("loading", o);
|
|
2713
|
-
}, i = (o,
|
|
2714
|
-
"vrm" in
|
|
2720
|
+
}, i = (o, a) => {
|
|
2721
|
+
"vrm" in a && s.value.setModel(a.vrm), "pose" in a && (s.value.resetPose(), s.value.setPose(a.pose), s.value.updatePose()), "expression" in a && (s.value.resetExpression(), s.value.importExpression(a.expression), s.value.updateExpression()), t("loaded", o, s.value);
|
|
2715
2722
|
};
|
|
2716
|
-
return (o,
|
|
2723
|
+
return (o, a) => (me(), We(js, {
|
|
2717
2724
|
name: l.model_name,
|
|
2718
2725
|
expression_name: l.expression_name,
|
|
2719
2726
|
expression_url: l.expression_url,
|
|
@@ -2730,7 +2737,7 @@ const Ds = (l, e) => {
|
|
|
2730
2737
|
}
|
|
2731
2738
|
};
|
|
2732
2739
|
export {
|
|
2733
|
-
|
|
2740
|
+
ue as ResourceLoader,
|
|
2734
2741
|
Us as ThreeFrame,
|
|
2735
2742
|
jt as VrmModel,
|
|
2736
2743
|
Ks as VroidControl,
|