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