@quick-threejs/reactive 0.1.31 → 0.1.33
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/app.module-BmmoQ8ZO.js +35 -0
- package/dist/{app.module-BbeIDure.mjs → app.module-WohiJuEI.mjs} +1847 -1737
- package/dist/common/interfaces/loader.interface.d.ts +3 -2
- package/dist/core/app/app.module.d.ts +8 -4
- package/dist/core/app/app.service.d.ts +1 -1
- package/dist/core/app/app.util.d.ts +2 -2
- package/dist/core/app/renderer/renderer.controller.d.ts +3 -3
- package/dist/core/app/timer/timer.controller.d.ts +2 -2
- package/dist/core/app/world/world.controller.d.ts +7 -0
- package/dist/core/app/world/world.module.d.ts +5 -1
- package/dist/core/register/loader/loader.module.d.ts +1 -0
- package/dist/core/register/loader/loader.service.d.ts +2 -0
- package/dist/core/register/register.module.d.ts +6 -5
- package/dist/core/register/register.service.d.ts +1 -0
- package/dist/main.js +3 -3
- package/dist/main.mjs +688 -678
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +31 -27
- package/package.json +1 -1
- package/dist/app.module-BaIoj4QA.js +0 -34
package/dist/main.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $e = Object.defineProperty;
|
|
2
2
|
var qe = (o, e, t) => e in o ? $e(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
3
|
var _ = (o, e, t) => qe(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { s as z, C as Ye, P as Qe, a as Me, f as Je, m as $, b as Ie, J as j, K as Ze, i as L,
|
|
5
|
-
import { k as
|
|
6
|
-
import { TrianglesDrawMode as
|
|
4
|
+
import { s as z, C as Ye, P as Qe, a as Me, f as Je, m as $, b as Ie, J as j, K as Ze, i as L, F as et, S as tt, c as se, W as _e, U as Oe, d as Ne, e as st, L as nt, R as rt, g as it, h as Pe, A as X, D as W, j as Re, Q as ot } from "./app.module-WohiJuEI.mjs";
|
|
5
|
+
import { k as en, o as tn, n as sn, l as nn } from "./app.module-WohiJuEI.mjs";
|
|
6
|
+
import { TrianglesDrawMode as at, TriangleFanDrawMode as ue, TriangleStripDrawMode as De, Loader as ke, FileLoader as q, SRGBColorSpace as N, LinearSRGBColorSpace as S, BufferGeometry as Fe, BufferAttribute as K, Color as P, ColorManagement as he, LoaderUtils as V, SpotLight as ct, PointLight as lt, DirectionalLight as ut, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as He, Matrix4 as Y, Vector3 as F, Quaternion as Ue, InstancedMesh as ht, InstancedBufferAttribute as dt, Object3D as Ge, TextureLoader as ft, ImageBitmapLoader as Be, InterleavedBuffer as pt, InterleavedBufferAttribute as mt, LinearFilter as de, LinearMipmapLinearFilter as je, RepeatWrapping as fe, NearestFilter as Ke, PointsMaterial as gt, Material as ne, LineBasicMaterial as At, MeshStandardMaterial as Ve, DoubleSide as Tt, PropertyBinding as _t, SkinnedMesh as Rt, Mesh as Et, LineSegments as wt, Line as xt, LineLoop as yt, Points as Lt, Group as re, PerspectiveCamera as bt, MathUtils as St, OrthographicCamera as vt, Skeleton as Ct, AnimationClip as Mt, Bone as It, InterpolateLinear as ze, NearestMipmapNearestFilter as Ot, LinearMipmapNearestFilter as Nt, NearestMipmapLinearFilter as Pt, ClampToEdgeWrapping as Dt, MirroredRepeatWrapping as kt, InterpolateDiscrete as Ft, FrontSide as Ht, Texture as Ee, VectorKeyframeTrack as we, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as ye, Box3 as Ut, Sphere as Gt, Interpolant as Bt, LoadingManager as jt, AudioLoader as Kt } from "three";
|
|
7
7
|
class Te {
|
|
8
8
|
constructor() {
|
|
9
9
|
/**
|
|
@@ -119,41 +119,41 @@ class Te {
|
|
|
119
119
|
_(this, "onReady");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
class
|
|
122
|
+
class Ys {
|
|
123
123
|
constructor() {
|
|
124
124
|
/** @description Handler triggered when the app is ready. */
|
|
125
125
|
_(this, "onReady");
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
function Le(o, e) {
|
|
129
|
-
if (e ===
|
|
129
|
+
if (e === at)
|
|
130
130
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
|
|
131
131
|
if (e === ue || e === De) {
|
|
132
132
|
let t = o.getIndex();
|
|
133
133
|
if (t === null) {
|
|
134
|
-
const
|
|
134
|
+
const r = [], a = o.getAttribute("position");
|
|
135
135
|
if (a !== void 0) {
|
|
136
136
|
for (let c = 0; c < a.count; c++)
|
|
137
|
-
|
|
138
|
-
o.setIndex(
|
|
137
|
+
r.push(c);
|
|
138
|
+
o.setIndex(r), t = o.getIndex();
|
|
139
139
|
} else
|
|
140
140
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const n = t.count - 2, s = [];
|
|
143
143
|
if (e === ue)
|
|
144
|
-
for (let
|
|
145
|
-
s.push(t.getX(0)), s.push(t.getX(
|
|
144
|
+
for (let r = 1; r <= n; r++)
|
|
145
|
+
s.push(t.getX(0)), s.push(t.getX(r)), s.push(t.getX(r + 1));
|
|
146
146
|
else
|
|
147
|
-
for (let
|
|
148
|
-
|
|
149
|
-
s.length / 3 !==
|
|
147
|
+
for (let r = 0; r < n; r++)
|
|
148
|
+
r % 2 === 0 ? (s.push(t.getX(r)), s.push(t.getX(r + 1)), s.push(t.getX(r + 2))) : (s.push(t.getX(r + 2)), s.push(t.getX(r + 1)), s.push(t.getX(r)));
|
|
149
|
+
s.length / 3 !== n && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
150
150
|
const i = o.clone();
|
|
151
151
|
return i.setIndex(s), i.clearGroups(), i;
|
|
152
152
|
} else
|
|
153
153
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
|
|
154
154
|
}
|
|
155
155
|
const ie = /* @__PURE__ */ new WeakMap();
|
|
156
|
-
class
|
|
156
|
+
class Vt extends ke {
|
|
157
157
|
constructor(e) {
|
|
158
158
|
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
159
159
|
position: "POSITION",
|
|
@@ -176,31 +176,31 @@ class Kt extends ke {
|
|
|
176
176
|
setWorkerLimit(e) {
|
|
177
177
|
return this.workerLimit = e, this;
|
|
178
178
|
}
|
|
179
|
-
load(e, t,
|
|
179
|
+
load(e, t, n, s) {
|
|
180
180
|
const i = new q(this.manager);
|
|
181
|
-
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (
|
|
182
|
-
this.parse(
|
|
183
|
-
},
|
|
181
|
+
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (r) => {
|
|
182
|
+
this.parse(r, t, s);
|
|
183
|
+
}, n, s);
|
|
184
184
|
}
|
|
185
|
-
parse(e, t,
|
|
185
|
+
parse(e, t, n = () => {
|
|
186
186
|
}) {
|
|
187
|
-
this.decodeDracoFile(e, t, null, null, N,
|
|
187
|
+
this.decodeDracoFile(e, t, null, null, N, n).catch(n);
|
|
188
188
|
}
|
|
189
|
-
decodeDracoFile(e, t,
|
|
189
|
+
decodeDracoFile(e, t, n, s, i = S, r = () => {
|
|
190
190
|
}) {
|
|
191
191
|
const a = {
|
|
192
|
-
attributeIDs:
|
|
192
|
+
attributeIDs: n || this.defaultAttributeIDs,
|
|
193
193
|
attributeTypes: s || this.defaultAttributeTypes,
|
|
194
|
-
useUniqueIDs: !!
|
|
194
|
+
useUniqueIDs: !!n,
|
|
195
195
|
vertexColorSpace: i
|
|
196
196
|
};
|
|
197
|
-
return this.decodeGeometry(e, a).then(t).catch(
|
|
197
|
+
return this.decodeGeometry(e, a).then(t).catch(r);
|
|
198
198
|
}
|
|
199
199
|
decodeGeometry(e, t) {
|
|
200
|
-
const
|
|
200
|
+
const n = JSON.stringify(t);
|
|
201
201
|
if (ie.has(e)) {
|
|
202
202
|
const c = ie.get(e);
|
|
203
|
-
if (c.key ===
|
|
203
|
+
if (c.key === n)
|
|
204
204
|
return c.promise;
|
|
205
205
|
if (e.byteLength === 0)
|
|
206
206
|
throw new Error(
|
|
@@ -208,35 +208,35 @@ class Kt extends ke {
|
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
let s;
|
|
211
|
-
const i = this.workerNextTaskID++,
|
|
212
|
-
s._callbacks[i] = { resolve: l, reject:
|
|
211
|
+
const i = this.workerNextTaskID++, r = e.byteLength, a = this._getWorker(i, r).then((c) => (s = c, new Promise((l, h) => {
|
|
212
|
+
s._callbacks[i] = { resolve: l, reject: h }, s.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
213
213
|
}))).then((c) => this._createGeometry(c.geometry));
|
|
214
214
|
return a.catch(() => !0).then(() => {
|
|
215
215
|
s && i && this._releaseTask(s, i);
|
|
216
216
|
}), ie.set(e, {
|
|
217
|
-
key:
|
|
217
|
+
key: n,
|
|
218
218
|
promise: a
|
|
219
219
|
}), a;
|
|
220
220
|
}
|
|
221
221
|
_createGeometry(e) {
|
|
222
222
|
const t = new Fe();
|
|
223
223
|
e.index && t.setIndex(new K(e.index.array, 1));
|
|
224
|
-
for (let
|
|
225
|
-
const s = e.attributes[
|
|
226
|
-
i === "color" && (this._assignVertexColorSpace(c, s.vertexColorSpace), c.normalized = !(
|
|
224
|
+
for (let n = 0; n < e.attributes.length; n++) {
|
|
225
|
+
const s = e.attributes[n], i = s.name, r = s.array, a = s.itemSize, c = new K(r, a);
|
|
226
|
+
i === "color" && (this._assignVertexColorSpace(c, s.vertexColorSpace), c.normalized = !(r instanceof Float32Array)), t.setAttribute(i, c);
|
|
227
227
|
}
|
|
228
228
|
return t;
|
|
229
229
|
}
|
|
230
230
|
_assignVertexColorSpace(e, t) {
|
|
231
231
|
if (t !== N) return;
|
|
232
|
-
const
|
|
232
|
+
const n = new P();
|
|
233
233
|
for (let s = 0, i = e.count; s < i; s++)
|
|
234
|
-
|
|
234
|
+
n.fromBufferAttribute(e, s), he.toWorkingColorSpace(n, N), e.setXYZ(s, n.r, n.g, n.b);
|
|
235
235
|
}
|
|
236
236
|
_loadLibrary(e, t) {
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
|
|
237
|
+
const n = new q(this.manager);
|
|
238
|
+
return n.setPath(this.decoderPath), n.setResponseType(t), n.setWithCredentials(this.withCredentials), new Promise((s, i) => {
|
|
239
|
+
n.load(e, s, void 0, i);
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
preload() {
|
|
@@ -245,10 +245,10 @@ class Kt extends ke {
|
|
|
245
245
|
_initDecoder() {
|
|
246
246
|
if (this.decoderPending) return this.decoderPending;
|
|
247
247
|
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
248
|
-
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((
|
|
249
|
-
const s =
|
|
250
|
-
e || (this.decoderConfig.wasmBinary =
|
|
251
|
-
const i =
|
|
248
|
+
return e ? t.push(this._loadLibrary("draco_decoder.js", "text")) : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(t).then((n) => {
|
|
249
|
+
const s = n[0];
|
|
250
|
+
e || (this.decoderConfig.wasmBinary = n[1]);
|
|
251
|
+
const i = zt.toString(), r = [
|
|
252
252
|
"/* draco decoder */",
|
|
253
253
|
s,
|
|
254
254
|
"",
|
|
@@ -256,7 +256,7 @@ class Kt extends ke {
|
|
|
256
256
|
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
257
257
|
].join(`
|
|
258
258
|
`);
|
|
259
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([
|
|
259
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([r]));
|
|
260
260
|
}), this.decoderPending;
|
|
261
261
|
}
|
|
262
262
|
_getWorker(e, t) {
|
|
@@ -264,24 +264,24 @@ class Kt extends ke {
|
|
|
264
264
|
if (this.workerPool.length < this.workerLimit) {
|
|
265
265
|
const s = new Worker(this.workerSourceURL);
|
|
266
266
|
s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(i) {
|
|
267
|
-
const
|
|
268
|
-
switch (
|
|
267
|
+
const r = i.data;
|
|
268
|
+
switch (r.type) {
|
|
269
269
|
case "decode":
|
|
270
|
-
s._callbacks[
|
|
270
|
+
s._callbacks[r.id].resolve(r);
|
|
271
271
|
break;
|
|
272
272
|
case "error":
|
|
273
|
-
s._callbacks[
|
|
273
|
+
s._callbacks[r.id].reject(r);
|
|
274
274
|
break;
|
|
275
275
|
default:
|
|
276
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' +
|
|
276
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + r.type + '"');
|
|
277
277
|
}
|
|
278
278
|
}, this.workerPool.push(s);
|
|
279
279
|
} else
|
|
280
280
|
this.workerPool.sort(function(s, i) {
|
|
281
281
|
return s._taskLoad > i._taskLoad ? -1 : 1;
|
|
282
282
|
});
|
|
283
|
-
const
|
|
284
|
-
return
|
|
283
|
+
const n = this.workerPool[this.workerPool.length - 1];
|
|
284
|
+
return n._taskCosts[e] = t, n._taskLoad += t, n;
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
_releaseTask(e, t) {
|
|
@@ -296,157 +296,157 @@ class Kt extends ke {
|
|
|
296
296
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function zt() {
|
|
300
300
|
let o, e;
|
|
301
|
-
onmessage = function(
|
|
302
|
-
const a =
|
|
301
|
+
onmessage = function(r) {
|
|
302
|
+
const a = r.data;
|
|
303
303
|
switch (a.type) {
|
|
304
304
|
case "init":
|
|
305
|
-
o = a.decoderConfig, e = new Promise(function(
|
|
305
|
+
o = a.decoderConfig, e = new Promise(function(h) {
|
|
306
306
|
o.onModuleLoaded = function(u) {
|
|
307
|
-
|
|
307
|
+
h({ draco: u });
|
|
308
308
|
}, DracoDecoderModule(o);
|
|
309
309
|
});
|
|
310
310
|
break;
|
|
311
311
|
case "decode":
|
|
312
312
|
const c = a.buffer, l = a.taskConfig;
|
|
313
|
-
e.then((
|
|
314
|
-
const u =
|
|
313
|
+
e.then((h) => {
|
|
314
|
+
const u = h.draco, d = new u.Decoder();
|
|
315
315
|
try {
|
|
316
|
-
const f = t(u,
|
|
316
|
+
const f = t(u, d, new Int8Array(c), l), p = f.attributes.map((A) => A.array.buffer);
|
|
317
317
|
f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
|
|
318
318
|
} catch (f) {
|
|
319
319
|
console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
|
|
320
320
|
} finally {
|
|
321
|
-
u.destroy(
|
|
321
|
+
u.destroy(d);
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
break;
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
function t(
|
|
328
|
-
const
|
|
329
|
-
let
|
|
327
|
+
function t(r, a, c, l) {
|
|
328
|
+
const h = l.attributeIDs, u = l.attributeTypes;
|
|
329
|
+
let d, f;
|
|
330
330
|
const p = a.GetEncodedGeometryType(c);
|
|
331
|
-
if (p ===
|
|
332
|
-
|
|
333
|
-
else if (p ===
|
|
334
|
-
|
|
331
|
+
if (p === r.TRIANGULAR_MESH)
|
|
332
|
+
d = new r.Mesh(), f = a.DecodeArrayToMesh(c, c.byteLength, d);
|
|
333
|
+
else if (p === r.POINT_CLOUD)
|
|
334
|
+
d = new r.PointCloud(), f = a.DecodeArrayToPointCloud(c, c.byteLength, d);
|
|
335
335
|
else
|
|
336
336
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
337
|
-
if (!f.ok() ||
|
|
337
|
+
if (!f.ok() || d.ptr === 0)
|
|
338
338
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
|
|
339
339
|
const A = { index: null, attributes: [] };
|
|
340
|
-
for (const m in
|
|
340
|
+
for (const m in h) {
|
|
341
341
|
const g = self[u[m]];
|
|
342
342
|
let R, w;
|
|
343
343
|
if (l.useUniqueIDs)
|
|
344
|
-
w =
|
|
344
|
+
w = h[m], R = a.GetAttributeByUniqueId(d, w);
|
|
345
345
|
else {
|
|
346
|
-
if (w = a.GetAttributeId(
|
|
347
|
-
R = a.GetAttribute(
|
|
346
|
+
if (w = a.GetAttributeId(d, r[h[m]]), w === -1) continue;
|
|
347
|
+
R = a.GetAttribute(d, w);
|
|
348
348
|
}
|
|
349
|
-
const E = s(
|
|
349
|
+
const E = s(r, a, d, m, g, R);
|
|
350
350
|
m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
|
|
351
351
|
}
|
|
352
|
-
return p ===
|
|
352
|
+
return p === r.TRIANGULAR_MESH && (A.index = n(r, a, d)), r.destroy(d), A;
|
|
353
353
|
}
|
|
354
|
-
function r
|
|
355
|
-
const
|
|
356
|
-
a.GetTrianglesUInt32Array(c, u,
|
|
357
|
-
const f = new Uint32Array(
|
|
358
|
-
return
|
|
354
|
+
function n(r, a, c) {
|
|
355
|
+
const h = c.num_faces() * 3, u = h * 4, d = r._malloc(u);
|
|
356
|
+
a.GetTrianglesUInt32Array(c, u, d);
|
|
357
|
+
const f = new Uint32Array(r.HEAPF32.buffer, d, h).slice();
|
|
358
|
+
return r._free(d), { array: f, itemSize: 1 };
|
|
359
359
|
}
|
|
360
|
-
function s(
|
|
361
|
-
const
|
|
360
|
+
function s(r, a, c, l, h, u) {
|
|
361
|
+
const d = u.num_components(), p = c.num_points() * d, A = p * h.BYTES_PER_ELEMENT, m = i(r, h), g = r._malloc(A);
|
|
362
362
|
a.GetAttributeDataArrayForAllPoints(c, u, m, A, g);
|
|
363
|
-
const R = new
|
|
364
|
-
return
|
|
363
|
+
const R = new h(r.HEAPF32.buffer, g, p).slice();
|
|
364
|
+
return r._free(g), {
|
|
365
365
|
name: l,
|
|
366
366
|
array: R,
|
|
367
|
-
itemSize:
|
|
367
|
+
itemSize: d
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function i(
|
|
370
|
+
function i(r, a) {
|
|
371
371
|
switch (a) {
|
|
372
372
|
case Float32Array:
|
|
373
|
-
return
|
|
373
|
+
return r.DT_FLOAT32;
|
|
374
374
|
case Int8Array:
|
|
375
|
-
return
|
|
375
|
+
return r.DT_INT8;
|
|
376
376
|
case Int16Array:
|
|
377
|
-
return
|
|
377
|
+
return r.DT_INT16;
|
|
378
378
|
case Int32Array:
|
|
379
|
-
return
|
|
379
|
+
return r.DT_INT32;
|
|
380
380
|
case Uint8Array:
|
|
381
|
-
return
|
|
381
|
+
return r.DT_UINT8;
|
|
382
382
|
case Uint16Array:
|
|
383
|
-
return
|
|
383
|
+
return r.DT_UINT16;
|
|
384
384
|
case Uint32Array:
|
|
385
|
-
return
|
|
385
|
+
return r.DT_UINT32;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
class
|
|
389
|
+
class Xt extends ke {
|
|
390
390
|
constructor(e) {
|
|
391
391
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
392
|
-
return new Yt(t);
|
|
393
|
-
}), this.register(function(t) {
|
|
394
392
|
return new Qt(t);
|
|
395
393
|
}), this.register(function(t) {
|
|
396
|
-
return new
|
|
394
|
+
return new Jt(t);
|
|
397
395
|
}), this.register(function(t) {
|
|
398
396
|
return new as(t);
|
|
399
397
|
}), this.register(function(t) {
|
|
400
398
|
return new cs(t);
|
|
401
399
|
}), this.register(function(t) {
|
|
402
|
-
return new
|
|
400
|
+
return new ls(t);
|
|
403
401
|
}), this.register(function(t) {
|
|
404
402
|
return new es(t);
|
|
405
403
|
}), this.register(function(t) {
|
|
406
404
|
return new ts(t);
|
|
407
405
|
}), this.register(function(t) {
|
|
408
406
|
return new ss(t);
|
|
409
|
-
}), this.register(function(t) {
|
|
410
|
-
return new qt(t);
|
|
411
407
|
}), this.register(function(t) {
|
|
412
408
|
return new ns(t);
|
|
413
409
|
}), this.register(function(t) {
|
|
414
|
-
return new
|
|
415
|
-
}), this.register(function(t) {
|
|
416
|
-
return new is(t);
|
|
410
|
+
return new Yt(t);
|
|
417
411
|
}), this.register(function(t) {
|
|
418
412
|
return new rs(t);
|
|
419
413
|
}), this.register(function(t) {
|
|
420
|
-
return new
|
|
414
|
+
return new Zt(t);
|
|
415
|
+
}), this.register(function(t) {
|
|
416
|
+
return new os(t);
|
|
421
417
|
}), this.register(function(t) {
|
|
422
|
-
return new
|
|
418
|
+
return new is(t);
|
|
419
|
+
}), this.register(function(t) {
|
|
420
|
+
return new $t(t);
|
|
423
421
|
}), this.register(function(t) {
|
|
424
422
|
return new us(t);
|
|
423
|
+
}), this.register(function(t) {
|
|
424
|
+
return new hs(t);
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
load(e, t,
|
|
427
|
+
load(e, t, n, s) {
|
|
428
428
|
const i = this;
|
|
429
|
-
let
|
|
429
|
+
let r;
|
|
430
430
|
if (this.resourcePath !== "")
|
|
431
|
-
|
|
431
|
+
r = this.resourcePath;
|
|
432
432
|
else if (this.path !== "") {
|
|
433
433
|
const l = V.extractUrlBase(e);
|
|
434
|
-
|
|
434
|
+
r = V.resolveURL(l, this.path);
|
|
435
435
|
} else
|
|
436
|
-
|
|
436
|
+
r = V.extractUrlBase(e);
|
|
437
437
|
this.manager.itemStart(e);
|
|
438
438
|
const a = function(l) {
|
|
439
439
|
s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
440
440
|
}, c = new q(this.manager);
|
|
441
441
|
c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
|
|
442
442
|
try {
|
|
443
|
-
i.parse(l,
|
|
444
|
-
t(
|
|
443
|
+
i.parse(l, r, function(h) {
|
|
444
|
+
t(h), i.manager.itemEnd(e);
|
|
445
445
|
}, a);
|
|
446
|
-
} catch (
|
|
447
|
-
a(
|
|
446
|
+
} catch (h) {
|
|
447
|
+
a(h);
|
|
448
448
|
}
|
|
449
|
-
},
|
|
449
|
+
}, n, a);
|
|
450
450
|
}
|
|
451
451
|
setDRACOLoader(e) {
|
|
452
452
|
return this.dracoLoader = e, this;
|
|
@@ -463,20 +463,20 @@ class zt extends ke {
|
|
|
463
463
|
unregister(e) {
|
|
464
464
|
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
465
465
|
}
|
|
466
|
-
parse(e, t,
|
|
466
|
+
parse(e, t, n, s) {
|
|
467
467
|
let i;
|
|
468
|
-
const
|
|
468
|
+
const r = {}, a = {}, c = new TextDecoder();
|
|
469
469
|
if (typeof e == "string")
|
|
470
470
|
i = JSON.parse(e);
|
|
471
471
|
else if (e instanceof ArrayBuffer)
|
|
472
472
|
if (c.decode(new Uint8Array(e, 0, 4)) === Xe) {
|
|
473
473
|
try {
|
|
474
|
-
|
|
474
|
+
r[T.KHR_BINARY_GLTF] = new ds(e);
|
|
475
475
|
} catch (u) {
|
|
476
476
|
s && s(u);
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
|
-
i = JSON.parse(
|
|
479
|
+
i = JSON.parse(r[T.KHR_BINARY_GLTF].content);
|
|
480
480
|
} else
|
|
481
481
|
i = JSON.parse(c.decode(e));
|
|
482
482
|
else
|
|
@@ -485,7 +485,7 @@ class zt extends ke {
|
|
|
485
485
|
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
|
-
const l = new
|
|
488
|
+
const l = new Ls(i, {
|
|
489
489
|
path: t || this.resourcePath || "",
|
|
490
490
|
crossOrigin: this.crossOrigin,
|
|
491
491
|
requestHeader: this.requestHeader,
|
|
@@ -494,40 +494,40 @@ class zt extends ke {
|
|
|
494
494
|
meshoptDecoder: this.meshoptDecoder
|
|
495
495
|
});
|
|
496
496
|
l.fileLoader.setRequestHeader(this.requestHeader);
|
|
497
|
-
for (let
|
|
498
|
-
const u = this.pluginCallbacks[
|
|
499
|
-
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u,
|
|
497
|
+
for (let h = 0; h < this.pluginCallbacks.length; h++) {
|
|
498
|
+
const u = this.pluginCallbacks[h](l);
|
|
499
|
+
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, r[u.name] = !0;
|
|
500
500
|
}
|
|
501
501
|
if (i.extensionsUsed)
|
|
502
|
-
for (let
|
|
503
|
-
const u = i.extensionsUsed[
|
|
502
|
+
for (let h = 0; h < i.extensionsUsed.length; ++h) {
|
|
503
|
+
const u = i.extensionsUsed[h], d = i.extensionsRequired || [];
|
|
504
504
|
switch (u) {
|
|
505
505
|
case T.KHR_MATERIALS_UNLIT:
|
|
506
|
-
|
|
506
|
+
r[u] = new qt();
|
|
507
507
|
break;
|
|
508
508
|
case T.KHR_DRACO_MESH_COMPRESSION:
|
|
509
|
-
|
|
509
|
+
r[u] = new fs(i, this.dracoLoader);
|
|
510
510
|
break;
|
|
511
511
|
case T.KHR_TEXTURE_TRANSFORM:
|
|
512
|
-
|
|
512
|
+
r[u] = new ps();
|
|
513
513
|
break;
|
|
514
514
|
case T.KHR_MESH_QUANTIZATION:
|
|
515
|
-
|
|
515
|
+
r[u] = new ms();
|
|
516
516
|
break;
|
|
517
517
|
default:
|
|
518
|
-
|
|
518
|
+
d.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
l.setExtensions(
|
|
521
|
+
l.setExtensions(r), l.setPlugins(a), l.parse(n, s);
|
|
522
522
|
}
|
|
523
523
|
parseAsync(e, t) {
|
|
524
|
-
const
|
|
524
|
+
const n = this;
|
|
525
525
|
return new Promise(function(s, i) {
|
|
526
|
-
|
|
526
|
+
n.parse(e, t, s, i);
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function Wt() {
|
|
531
531
|
let o = {};
|
|
532
532
|
return {
|
|
533
533
|
get: function(e) {
|
|
@@ -568,74 +568,74 @@ const T = {
|
|
|
568
568
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
569
569
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
570
570
|
};
|
|
571
|
-
class
|
|
571
|
+
class $t {
|
|
572
572
|
constructor(e) {
|
|
573
573
|
this.parser = e, this.name = T.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
574
574
|
}
|
|
575
575
|
_markDefs() {
|
|
576
576
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
577
|
-
for (let
|
|
578
|
-
const i = t[
|
|
577
|
+
for (let n = 0, s = t.length; n < s; n++) {
|
|
578
|
+
const i = t[n];
|
|
579
579
|
i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, i.extensions[this.name].light);
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
_loadLight(e) {
|
|
583
|
-
const t = this.parser,
|
|
584
|
-
let s = t.cache.get(
|
|
583
|
+
const t = this.parser, n = "light:" + e;
|
|
584
|
+
let s = t.cache.get(n);
|
|
585
585
|
if (s) return s;
|
|
586
586
|
const i = t.json, c = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
587
587
|
let l;
|
|
588
|
-
const
|
|
589
|
-
c.color !== void 0 &&
|
|
588
|
+
const h = new P(16777215);
|
|
589
|
+
c.color !== void 0 && h.setRGB(c.color[0], c.color[1], c.color[2], S);
|
|
590
590
|
const u = c.range !== void 0 ? c.range : 0;
|
|
591
591
|
switch (c.type) {
|
|
592
592
|
case "directional":
|
|
593
|
-
l = new
|
|
593
|
+
l = new ut(h), l.target.position.set(0, 0, -1), l.add(l.target);
|
|
594
594
|
break;
|
|
595
595
|
case "point":
|
|
596
|
-
l = new
|
|
596
|
+
l = new lt(h), l.distance = u;
|
|
597
597
|
break;
|
|
598
598
|
case "spot":
|
|
599
|
-
l = new
|
|
599
|
+
l = new ct(h), l.distance = u, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
|
|
600
600
|
break;
|
|
601
601
|
default:
|
|
602
602
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
|
|
603
603
|
}
|
|
604
|
-
return l.position.set(0, 0, 0), l.decay = 2, C(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(
|
|
604
|
+
return l.position.set(0, 0, 0), l.decay = 2, C(l, c), c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), s = Promise.resolve(l), t.cache.add(n, s), s;
|
|
605
605
|
}
|
|
606
606
|
getDependency(e, t) {
|
|
607
607
|
if (e === "light")
|
|
608
608
|
return this._loadLight(t);
|
|
609
609
|
}
|
|
610
610
|
createNodeAttachment(e) {
|
|
611
|
-
const t = this,
|
|
611
|
+
const t = this, n = this.parser, i = n.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
612
612
|
return a === void 0 ? null : this._loadLight(a).then(function(c) {
|
|
613
|
-
return
|
|
613
|
+
return n._getNodeRef(t.cache, a, c);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
class
|
|
617
|
+
class qt {
|
|
618
618
|
constructor() {
|
|
619
619
|
this.name = T.KHR_MATERIALS_UNLIT;
|
|
620
620
|
}
|
|
621
621
|
getMaterialType() {
|
|
622
622
|
return B;
|
|
623
623
|
}
|
|
624
|
-
extendParams(e, t,
|
|
624
|
+
extendParams(e, t, n) {
|
|
625
625
|
const s = [];
|
|
626
626
|
e.color = new P(1, 1, 1), e.opacity = 1;
|
|
627
627
|
const i = t.pbrMetallicRoughness;
|
|
628
628
|
if (i) {
|
|
629
629
|
if (Array.isArray(i.baseColorFactor)) {
|
|
630
|
-
const
|
|
631
|
-
e.color.setRGB(
|
|
630
|
+
const r = i.baseColorFactor;
|
|
631
|
+
e.color.setRGB(r[0], r[1], r[2], S), e.opacity = r[3];
|
|
632
632
|
}
|
|
633
|
-
i.baseColorTexture !== void 0 && s.push(
|
|
633
|
+
i.baseColorTexture !== void 0 && s.push(n.assignTexture(e, "map", i.baseColorTexture, N));
|
|
634
634
|
}
|
|
635
635
|
return Promise.all(s);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
class
|
|
638
|
+
class Yt {
|
|
639
639
|
constructor(e) {
|
|
640
640
|
this.parser = e, this.name = T.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
641
641
|
}
|
|
@@ -647,33 +647,33 @@ class qt {
|
|
|
647
647
|
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
|
-
class
|
|
650
|
+
class Qt {
|
|
651
651
|
constructor(e) {
|
|
652
652
|
this.parser = e, this.name = T.KHR_MATERIALS_CLEARCOAT;
|
|
653
653
|
}
|
|
654
654
|
getMaterialType(e) {
|
|
655
|
-
const
|
|
656
|
-
return !
|
|
655
|
+
const n = this.parser.json.materials[e];
|
|
656
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
657
657
|
}
|
|
658
658
|
extendMaterialParams(e, t) {
|
|
659
|
-
const
|
|
659
|
+
const n = this.parser, s = n.json.materials[e];
|
|
660
660
|
if (!s.extensions || !s.extensions[this.name])
|
|
661
661
|
return Promise.resolve();
|
|
662
|
-
const i = [],
|
|
663
|
-
if (
|
|
664
|
-
const a =
|
|
662
|
+
const i = [], r = s.extensions[this.name];
|
|
663
|
+
if (r.clearcoatFactor !== void 0 && (t.clearcoat = r.clearcoatFactor), r.clearcoatTexture !== void 0 && i.push(n.assignTexture(t, "clearcoatMap", r.clearcoatTexture)), r.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = r.clearcoatRoughnessFactor), r.clearcoatRoughnessTexture !== void 0 && i.push(n.assignTexture(t, "clearcoatRoughnessMap", r.clearcoatRoughnessTexture)), r.clearcoatNormalTexture !== void 0 && (i.push(n.assignTexture(t, "clearcoatNormalMap", r.clearcoatNormalTexture)), r.clearcoatNormalTexture.scale !== void 0)) {
|
|
664
|
+
const a = r.clearcoatNormalTexture.scale;
|
|
665
665
|
t.clearcoatNormalScale = new He(a, a);
|
|
666
666
|
}
|
|
667
667
|
return Promise.all(i);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
class
|
|
670
|
+
class Jt {
|
|
671
671
|
constructor(e) {
|
|
672
672
|
this.parser = e, this.name = T.KHR_MATERIALS_DISPERSION;
|
|
673
673
|
}
|
|
674
674
|
getMaterialType(e) {
|
|
675
|
-
const
|
|
676
|
-
return !
|
|
675
|
+
const n = this.parser.json.materials[e];
|
|
676
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
677
677
|
}
|
|
678
678
|
extendMaterialParams(e, t) {
|
|
679
679
|
const s = this.parser.json.materials[e];
|
|
@@ -683,85 +683,85 @@ class Qt {
|
|
|
683
683
|
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
class
|
|
686
|
+
class Zt {
|
|
687
687
|
constructor(e) {
|
|
688
688
|
this.parser = e, this.name = T.KHR_MATERIALS_IRIDESCENCE;
|
|
689
689
|
}
|
|
690
690
|
getMaterialType(e) {
|
|
691
|
-
const
|
|
692
|
-
return !
|
|
691
|
+
const n = this.parser.json.materials[e];
|
|
692
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
693
693
|
}
|
|
694
694
|
extendMaterialParams(e, t) {
|
|
695
|
-
const
|
|
695
|
+
const n = this.parser, s = n.json.materials[e];
|
|
696
696
|
if (!s.extensions || !s.extensions[this.name])
|
|
697
697
|
return Promise.resolve();
|
|
698
|
-
const i = [],
|
|
699
|
-
return
|
|
698
|
+
const i = [], r = s.extensions[this.name];
|
|
699
|
+
return r.iridescenceFactor !== void 0 && (t.iridescence = r.iridescenceFactor), r.iridescenceTexture !== void 0 && i.push(n.assignTexture(t, "iridescenceMap", r.iridescenceTexture)), r.iridescenceIor !== void 0 && (t.iridescenceIOR = r.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), r.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = r.iridescenceThicknessMinimum), r.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = r.iridescenceThicknessMaximum), r.iridescenceThicknessTexture !== void 0 && i.push(n.assignTexture(t, "iridescenceThicknessMap", r.iridescenceThicknessTexture)), Promise.all(i);
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
|
-
class
|
|
702
|
+
class es {
|
|
703
703
|
constructor(e) {
|
|
704
704
|
this.parser = e, this.name = T.KHR_MATERIALS_SHEEN;
|
|
705
705
|
}
|
|
706
706
|
getMaterialType(e) {
|
|
707
|
-
const
|
|
708
|
-
return !
|
|
707
|
+
const n = this.parser.json.materials[e];
|
|
708
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
709
709
|
}
|
|
710
710
|
extendMaterialParams(e, t) {
|
|
711
|
-
const
|
|
711
|
+
const n = this.parser, s = n.json.materials[e];
|
|
712
712
|
if (!s.extensions || !s.extensions[this.name])
|
|
713
713
|
return Promise.resolve();
|
|
714
714
|
const i = [];
|
|
715
715
|
t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
716
|
-
const
|
|
717
|
-
if (
|
|
718
|
-
const a =
|
|
716
|
+
const r = s.extensions[this.name];
|
|
717
|
+
if (r.sheenColorFactor !== void 0) {
|
|
718
|
+
const a = r.sheenColorFactor;
|
|
719
719
|
t.sheenColor.setRGB(a[0], a[1], a[2], S);
|
|
720
720
|
}
|
|
721
|
-
return
|
|
721
|
+
return r.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = r.sheenRoughnessFactor), r.sheenColorTexture !== void 0 && i.push(n.assignTexture(t, "sheenColorMap", r.sheenColorTexture, N)), r.sheenRoughnessTexture !== void 0 && i.push(n.assignTexture(t, "sheenRoughnessMap", r.sheenRoughnessTexture)), Promise.all(i);
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
class
|
|
724
|
+
class ts {
|
|
725
725
|
constructor(e) {
|
|
726
726
|
this.parser = e, this.name = T.KHR_MATERIALS_TRANSMISSION;
|
|
727
727
|
}
|
|
728
728
|
getMaterialType(e) {
|
|
729
|
-
const
|
|
730
|
-
return !
|
|
729
|
+
const n = this.parser.json.materials[e];
|
|
730
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
731
731
|
}
|
|
732
732
|
extendMaterialParams(e, t) {
|
|
733
|
-
const
|
|
733
|
+
const n = this.parser, s = n.json.materials[e];
|
|
734
734
|
if (!s.extensions || !s.extensions[this.name])
|
|
735
735
|
return Promise.resolve();
|
|
736
|
-
const i = [],
|
|
737
|
-
return
|
|
736
|
+
const i = [], r = s.extensions[this.name];
|
|
737
|
+
return r.transmissionFactor !== void 0 && (t.transmission = r.transmissionFactor), r.transmissionTexture !== void 0 && i.push(n.assignTexture(t, "transmissionMap", r.transmissionTexture)), Promise.all(i);
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
class
|
|
740
|
+
class ss {
|
|
741
741
|
constructor(e) {
|
|
742
742
|
this.parser = e, this.name = T.KHR_MATERIALS_VOLUME;
|
|
743
743
|
}
|
|
744
744
|
getMaterialType(e) {
|
|
745
|
-
const
|
|
746
|
-
return !
|
|
745
|
+
const n = this.parser.json.materials[e];
|
|
746
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
747
747
|
}
|
|
748
748
|
extendMaterialParams(e, t) {
|
|
749
|
-
const
|
|
749
|
+
const n = this.parser, s = n.json.materials[e];
|
|
750
750
|
if (!s.extensions || !s.extensions[this.name])
|
|
751
751
|
return Promise.resolve();
|
|
752
|
-
const i = [],
|
|
753
|
-
t.thickness =
|
|
754
|
-
const a =
|
|
752
|
+
const i = [], r = s.extensions[this.name];
|
|
753
|
+
t.thickness = r.thicknessFactor !== void 0 ? r.thicknessFactor : 0, r.thicknessTexture !== void 0 && i.push(n.assignTexture(t, "thicknessMap", r.thicknessTexture)), t.attenuationDistance = r.attenuationDistance || 1 / 0;
|
|
754
|
+
const a = r.attenuationColor || [1, 1, 1];
|
|
755
755
|
return t.attenuationColor = new P().setRGB(a[0], a[1], a[2], S), Promise.all(i);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
class
|
|
758
|
+
class ns {
|
|
759
759
|
constructor(e) {
|
|
760
760
|
this.parser = e, this.name = T.KHR_MATERIALS_IOR;
|
|
761
761
|
}
|
|
762
762
|
getMaterialType(e) {
|
|
763
|
-
const
|
|
764
|
-
return !
|
|
763
|
+
const n = this.parser.json.materials[e];
|
|
764
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
765
765
|
}
|
|
766
766
|
extendMaterialParams(e, t) {
|
|
767
767
|
const s = this.parser.json.materials[e];
|
|
@@ -771,92 +771,92 @@ class ss {
|
|
|
771
771
|
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
class
|
|
774
|
+
class rs {
|
|
775
775
|
constructor(e) {
|
|
776
776
|
this.parser = e, this.name = T.KHR_MATERIALS_SPECULAR;
|
|
777
777
|
}
|
|
778
778
|
getMaterialType(e) {
|
|
779
|
-
const
|
|
780
|
-
return !
|
|
779
|
+
const n = this.parser.json.materials[e];
|
|
780
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
781
781
|
}
|
|
782
782
|
extendMaterialParams(e, t) {
|
|
783
|
-
const
|
|
783
|
+
const n = this.parser, s = n.json.materials[e];
|
|
784
784
|
if (!s.extensions || !s.extensions[this.name])
|
|
785
785
|
return Promise.resolve();
|
|
786
|
-
const i = [],
|
|
787
|
-
t.specularIntensity =
|
|
788
|
-
const a =
|
|
789
|
-
return t.specularColor = new P().setRGB(a[0], a[1], a[2], S),
|
|
786
|
+
const i = [], r = s.extensions[this.name];
|
|
787
|
+
t.specularIntensity = r.specularFactor !== void 0 ? r.specularFactor : 1, r.specularTexture !== void 0 && i.push(n.assignTexture(t, "specularIntensityMap", r.specularTexture));
|
|
788
|
+
const a = r.specularColorFactor || [1, 1, 1];
|
|
789
|
+
return t.specularColor = new P().setRGB(a[0], a[1], a[2], S), r.specularColorTexture !== void 0 && i.push(n.assignTexture(t, "specularColorMap", r.specularColorTexture, N)), Promise.all(i);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
class
|
|
792
|
+
class is {
|
|
793
793
|
constructor(e) {
|
|
794
794
|
this.parser = e, this.name = T.EXT_MATERIALS_BUMP;
|
|
795
795
|
}
|
|
796
796
|
getMaterialType(e) {
|
|
797
|
-
const
|
|
798
|
-
return !
|
|
797
|
+
const n = this.parser.json.materials[e];
|
|
798
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
799
799
|
}
|
|
800
800
|
extendMaterialParams(e, t) {
|
|
801
|
-
const
|
|
801
|
+
const n = this.parser, s = n.json.materials[e];
|
|
802
802
|
if (!s.extensions || !s.extensions[this.name])
|
|
803
803
|
return Promise.resolve();
|
|
804
|
-
const i = [],
|
|
805
|
-
return t.bumpScale =
|
|
804
|
+
const i = [], r = s.extensions[this.name];
|
|
805
|
+
return t.bumpScale = r.bumpFactor !== void 0 ? r.bumpFactor : 1, r.bumpTexture !== void 0 && i.push(n.assignTexture(t, "bumpMap", r.bumpTexture)), Promise.all(i);
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
class
|
|
808
|
+
class os {
|
|
809
809
|
constructor(e) {
|
|
810
810
|
this.parser = e, this.name = T.KHR_MATERIALS_ANISOTROPY;
|
|
811
811
|
}
|
|
812
812
|
getMaterialType(e) {
|
|
813
|
-
const
|
|
814
|
-
return !
|
|
813
|
+
const n = this.parser.json.materials[e];
|
|
814
|
+
return !n.extensions || !n.extensions[this.name] ? null : v;
|
|
815
815
|
}
|
|
816
816
|
extendMaterialParams(e, t) {
|
|
817
|
-
const
|
|
817
|
+
const n = this.parser, s = n.json.materials[e];
|
|
818
818
|
if (!s.extensions || !s.extensions[this.name])
|
|
819
819
|
return Promise.resolve();
|
|
820
|
-
const i = [],
|
|
821
|
-
return
|
|
820
|
+
const i = [], r = s.extensions[this.name];
|
|
821
|
+
return r.anisotropyStrength !== void 0 && (t.anisotropy = r.anisotropyStrength), r.anisotropyRotation !== void 0 && (t.anisotropyRotation = r.anisotropyRotation), r.anisotropyTexture !== void 0 && i.push(n.assignTexture(t, "anisotropyMap", r.anisotropyTexture)), Promise.all(i);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
|
-
class
|
|
824
|
+
class as {
|
|
825
825
|
constructor(e) {
|
|
826
826
|
this.parser = e, this.name = T.KHR_TEXTURE_BASISU;
|
|
827
827
|
}
|
|
828
828
|
loadTexture(e) {
|
|
829
|
-
const t = this.parser,
|
|
829
|
+
const t = this.parser, n = t.json, s = n.textures[e];
|
|
830
830
|
if (!s.extensions || !s.extensions[this.name])
|
|
831
831
|
return null;
|
|
832
|
-
const i = s.extensions[this.name],
|
|
833
|
-
if (!
|
|
834
|
-
if (
|
|
832
|
+
const i = s.extensions[this.name], r = t.options.ktx2Loader;
|
|
833
|
+
if (!r) {
|
|
834
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0)
|
|
835
835
|
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
836
836
|
return null;
|
|
837
837
|
}
|
|
838
|
-
return t.loadTextureImage(e, i.source,
|
|
838
|
+
return t.loadTextureImage(e, i.source, r);
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
|
-
class
|
|
841
|
+
class cs {
|
|
842
842
|
constructor(e) {
|
|
843
843
|
this.parser = e, this.name = T.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
844
844
|
}
|
|
845
845
|
loadTexture(e) {
|
|
846
|
-
const t = this.name,
|
|
846
|
+
const t = this.name, n = this.parser, s = n.json, i = s.textures[e];
|
|
847
847
|
if (!i.extensions || !i.extensions[t])
|
|
848
848
|
return null;
|
|
849
|
-
const
|
|
850
|
-
let c =
|
|
849
|
+
const r = i.extensions[t], a = s.images[r.source];
|
|
850
|
+
let c = n.textureLoader;
|
|
851
851
|
if (a.uri) {
|
|
852
|
-
const l =
|
|
852
|
+
const l = n.options.manager.getHandler(a.uri);
|
|
853
853
|
l !== null && (c = l);
|
|
854
854
|
}
|
|
855
855
|
return this.detectSupport().then(function(l) {
|
|
856
|
-
if (l) return
|
|
856
|
+
if (l) return n.loadTextureImage(e, r.source, c);
|
|
857
857
|
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
858
858
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
859
|
-
return
|
|
859
|
+
return n.loadTexture(e);
|
|
860
860
|
});
|
|
861
861
|
}
|
|
862
862
|
detectSupport() {
|
|
@@ -868,25 +868,25 @@ class as {
|
|
|
868
868
|
})), this.isSupported;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
class
|
|
871
|
+
class ls {
|
|
872
872
|
constructor(e) {
|
|
873
873
|
this.parser = e, this.name = T.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
874
874
|
}
|
|
875
875
|
loadTexture(e) {
|
|
876
|
-
const t = this.name,
|
|
876
|
+
const t = this.name, n = this.parser, s = n.json, i = s.textures[e];
|
|
877
877
|
if (!i.extensions || !i.extensions[t])
|
|
878
878
|
return null;
|
|
879
|
-
const
|
|
880
|
-
let c =
|
|
879
|
+
const r = i.extensions[t], a = s.images[r.source];
|
|
880
|
+
let c = n.textureLoader;
|
|
881
881
|
if (a.uri) {
|
|
882
|
-
const l =
|
|
882
|
+
const l = n.options.manager.getHandler(a.uri);
|
|
883
883
|
l !== null && (c = l);
|
|
884
884
|
}
|
|
885
885
|
return this.detectSupport().then(function(l) {
|
|
886
|
-
if (l) return
|
|
886
|
+
if (l) return n.loadTextureImage(e, r.source, c);
|
|
887
887
|
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
888
888
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
889
|
-
return
|
|
889
|
+
return n.loadTexture(e);
|
|
890
890
|
});
|
|
891
891
|
}
|
|
892
892
|
detectSupport() {
|
|
@@ -898,52 +898,52 @@ class cs {
|
|
|
898
898
|
})), this.isSupported;
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
class
|
|
901
|
+
class us {
|
|
902
902
|
constructor(e) {
|
|
903
903
|
this.name = T.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
904
904
|
}
|
|
905
905
|
loadBufferView(e) {
|
|
906
|
-
const t = this.parser.json,
|
|
907
|
-
if (
|
|
908
|
-
const s =
|
|
909
|
-
if (!
|
|
906
|
+
const t = this.parser.json, n = t.bufferViews[e];
|
|
907
|
+
if (n.extensions && n.extensions[this.name]) {
|
|
908
|
+
const s = n.extensions[this.name], i = this.parser.getDependency("buffer", s.buffer), r = this.parser.options.meshoptDecoder;
|
|
909
|
+
if (!r || !r.supported) {
|
|
910
910
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
|
|
911
911
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
912
912
|
return null;
|
|
913
913
|
}
|
|
914
914
|
return i.then(function(a) {
|
|
915
|
-
const c = s.byteOffset || 0, l = s.byteLength || 0,
|
|
916
|
-
return
|
|
915
|
+
const c = s.byteOffset || 0, l = s.byteLength || 0, h = s.count, u = s.byteStride, d = new Uint8Array(a, c, l);
|
|
916
|
+
return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(h, u, d, s.mode, s.filter).then(function(f) {
|
|
917
917
|
return f.buffer;
|
|
918
|
-
}) :
|
|
919
|
-
const f = new ArrayBuffer(
|
|
920
|
-
return
|
|
918
|
+
}) : r.ready.then(function() {
|
|
919
|
+
const f = new ArrayBuffer(h * u);
|
|
920
|
+
return r.decodeGltfBuffer(new Uint8Array(f), h, u, d, s.mode, s.filter), f;
|
|
921
921
|
});
|
|
922
922
|
});
|
|
923
923
|
} else
|
|
924
924
|
return null;
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
|
-
class
|
|
927
|
+
class hs {
|
|
928
928
|
constructor(e) {
|
|
929
929
|
this.name = T.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
930
930
|
}
|
|
931
931
|
createNodeMesh(e) {
|
|
932
|
-
const t = this.parser.json,
|
|
933
|
-
if (!
|
|
932
|
+
const t = this.parser.json, n = t.nodes[e];
|
|
933
|
+
if (!n.extensions || !n.extensions[this.name] || n.mesh === void 0)
|
|
934
934
|
return null;
|
|
935
|
-
const s = t.meshes[
|
|
935
|
+
const s = t.meshes[n.mesh];
|
|
936
936
|
for (const l of s.primitives)
|
|
937
937
|
if (l.mode !== x.TRIANGLES && l.mode !== x.TRIANGLE_STRIP && l.mode !== x.TRIANGLE_FAN && l.mode !== void 0)
|
|
938
938
|
return null;
|
|
939
|
-
const
|
|
940
|
-
for (const l in
|
|
941
|
-
a.push(this.parser.getDependency("accessor",
|
|
939
|
+
const r = n.extensions[this.name].attributes, a = [], c = {};
|
|
940
|
+
for (const l in r)
|
|
941
|
+
a.push(this.parser.getDependency("accessor", r[l]).then((h) => (c[l] = h, c[l])));
|
|
942
942
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
|
|
943
|
-
const
|
|
943
|
+
const h = l.pop(), u = h.isGroup ? h.children : [h], d = l[0].count, f = [];
|
|
944
944
|
for (const p of u) {
|
|
945
|
-
const A = new Y(), m = new F(), g = new Ue(), R = new F(1, 1, 1), w = new
|
|
946
|
-
for (let E = 0; E <
|
|
945
|
+
const A = new Y(), m = new F(), g = new Ue(), R = new F(1, 1, 1), w = new ht(p.geometry, p.material, d);
|
|
946
|
+
for (let E = 0; E < d; E++)
|
|
947
947
|
c.TRANSLATION && m.fromBufferAttribute(c.TRANSLATION, E), c.ROTATION && g.fromBufferAttribute(c.ROTATION, E), c.SCALE && R.fromBufferAttribute(c.SCALE, E), w.setMatrixAt(E, A.compose(m, g, R));
|
|
948
948
|
for (const E in c)
|
|
949
949
|
if (E === "_COLOR_0") {
|
|
@@ -952,7 +952,7 @@ class us {
|
|
|
952
952
|
} else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, c[E]);
|
|
953
953
|
Ge.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
|
|
954
954
|
}
|
|
955
|
-
return
|
|
955
|
+
return h.isGroup ? (h.clear(), h.add(...f), h) : f[0];
|
|
956
956
|
}));
|
|
957
957
|
}
|
|
958
958
|
}
|
|
@@ -960,9 +960,9 @@ const Xe = "glTF", G = 12, be = { JSON: 1313821514, BIN: 5130562 };
|
|
|
960
960
|
class ds {
|
|
961
961
|
constructor(e) {
|
|
962
962
|
this.name = T.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
963
|
-
const t = new DataView(e, 0, G),
|
|
963
|
+
const t = new DataView(e, 0, G), n = new TextDecoder();
|
|
964
964
|
if (this.header = {
|
|
965
|
-
magic:
|
|
965
|
+
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
966
966
|
version: t.getUint32(4, !0),
|
|
967
967
|
length: t.getUint32(8, !0)
|
|
968
968
|
}, this.header.magic !== Xe)
|
|
@@ -970,57 +970,57 @@ class ds {
|
|
|
970
970
|
if (this.header.version < 2)
|
|
971
971
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
972
972
|
const s = this.header.length - G, i = new DataView(e, G);
|
|
973
|
-
let
|
|
974
|
-
for (;
|
|
975
|
-
const a = i.getUint32(
|
|
976
|
-
|
|
977
|
-
const c = i.getUint32(
|
|
978
|
-
if (
|
|
979
|
-
const l = new Uint8Array(e, G +
|
|
980
|
-
this.content =
|
|
973
|
+
let r = 0;
|
|
974
|
+
for (; r < s; ) {
|
|
975
|
+
const a = i.getUint32(r, !0);
|
|
976
|
+
r += 4;
|
|
977
|
+
const c = i.getUint32(r, !0);
|
|
978
|
+
if (r += 4, c === be.JSON) {
|
|
979
|
+
const l = new Uint8Array(e, G + r, a);
|
|
980
|
+
this.content = n.decode(l);
|
|
981
981
|
} else if (c === be.BIN) {
|
|
982
|
-
const l = G +
|
|
982
|
+
const l = G + r;
|
|
983
983
|
this.body = e.slice(l, l + a);
|
|
984
984
|
}
|
|
985
|
-
|
|
985
|
+
r += a;
|
|
986
986
|
}
|
|
987
987
|
if (this.content === null)
|
|
988
988
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
class
|
|
991
|
+
class fs {
|
|
992
992
|
constructor(e, t) {
|
|
993
993
|
if (!t)
|
|
994
994
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
995
995
|
this.name = T.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
996
996
|
}
|
|
997
997
|
decodePrimitive(e, t) {
|
|
998
|
-
const
|
|
999
|
-
for (const
|
|
1000
|
-
const u = pe[
|
|
1001
|
-
a[u] =
|
|
998
|
+
const n = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, r = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
|
|
999
|
+
for (const h in r) {
|
|
1000
|
+
const u = pe[h] || h.toLowerCase();
|
|
1001
|
+
a[u] = r[h];
|
|
1002
1002
|
}
|
|
1003
|
-
for (const
|
|
1004
|
-
const u = pe[
|
|
1005
|
-
if (
|
|
1006
|
-
const
|
|
1007
|
-
l[u] = f.name, c[u] =
|
|
1003
|
+
for (const h in e.attributes) {
|
|
1004
|
+
const u = pe[h] || h.toLowerCase();
|
|
1005
|
+
if (r[h] !== void 0) {
|
|
1006
|
+
const d = n.accessors[e.attributes[h]], f = H[d.componentType];
|
|
1007
|
+
l[u] = f.name, c[u] = d.normalized === !0;
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
return t.getDependency("bufferView", i).then(function(
|
|
1011
|
-
return new Promise(function(u,
|
|
1012
|
-
s.decodeDracoFile(
|
|
1010
|
+
return t.getDependency("bufferView", i).then(function(h) {
|
|
1011
|
+
return new Promise(function(u, d) {
|
|
1012
|
+
s.decodeDracoFile(h, function(f) {
|
|
1013
1013
|
for (const p in f.attributes) {
|
|
1014
1014
|
const A = f.attributes[p], m = c[p];
|
|
1015
1015
|
m !== void 0 && (A.normalized = m);
|
|
1016
1016
|
}
|
|
1017
1017
|
u(f);
|
|
1018
|
-
}, a, l, S,
|
|
1018
|
+
}, a, l, S, d);
|
|
1019
1019
|
});
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
class
|
|
1023
|
+
class ps {
|
|
1024
1024
|
constructor() {
|
|
1025
1025
|
this.name = T.KHR_TEXTURE_TRANSFORM;
|
|
1026
1026
|
}
|
|
@@ -1028,35 +1028,35 @@ class fs {
|
|
|
1028
1028
|
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;
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
|
-
class
|
|
1031
|
+
class ms {
|
|
1032
1032
|
constructor() {
|
|
1033
1033
|
this.name = T.KHR_MESH_QUANTIZATION;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
class We extends
|
|
1037
|
-
constructor(e, t,
|
|
1038
|
-
super(e, t,
|
|
1036
|
+
class We extends Bt {
|
|
1037
|
+
constructor(e, t, n, s) {
|
|
1038
|
+
super(e, t, n, s);
|
|
1039
1039
|
}
|
|
1040
1040
|
copySampleValue_(e) {
|
|
1041
|
-
const t = this.resultBuffer,
|
|
1042
|
-
for (let
|
|
1043
|
-
t[
|
|
1041
|
+
const t = this.resultBuffer, n = this.sampleValues, s = this.valueSize, i = e * s * 3 + s;
|
|
1042
|
+
for (let r = 0; r !== s; r++)
|
|
1043
|
+
t[r] = n[i + r];
|
|
1044
1044
|
return t;
|
|
1045
1045
|
}
|
|
1046
|
-
interpolate_(e, t,
|
|
1047
|
-
const i = this.resultBuffer,
|
|
1046
|
+
interpolate_(e, t, n, s) {
|
|
1047
|
+
const i = this.resultBuffer, r = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, h = s - t, u = (n - t) / h, d = u * u, f = d * u, p = e * l, A = p - l, m = -2 * f + 3 * d, g = f - d, R = 1 - m, w = g - d + u;
|
|
1048
1048
|
for (let E = 0; E !== a; E++) {
|
|
1049
|
-
const b =
|
|
1049
|
+
const b = r[A + E + a], M = r[A + E + c] * h, y = r[p + E + a], U = r[p + E] * h;
|
|
1050
1050
|
i[E] = R * b + w * M + m * y + g * U;
|
|
1051
1051
|
}
|
|
1052
1052
|
return i;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
const
|
|
1056
|
-
class
|
|
1057
|
-
interpolate_(e, t,
|
|
1058
|
-
const i = super.interpolate_(e, t,
|
|
1059
|
-
return
|
|
1055
|
+
const gs = new Ue();
|
|
1056
|
+
class As extends We {
|
|
1057
|
+
interpolate_(e, t, n, s) {
|
|
1058
|
+
const i = super.interpolate_(e, t, n, s);
|
|
1059
|
+
return gs.fromArray(i).normalize().toArray(i), i;
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
1062
|
const x = {
|
|
@@ -1088,14 +1088,14 @@ const x = {
|
|
|
1088
1088
|
5126: Float32Array
|
|
1089
1089
|
}, Se = {
|
|
1090
1090
|
9728: Ke,
|
|
1091
|
-
9729:
|
|
1092
|
-
9984:
|
|
1093
|
-
9985:
|
|
1094
|
-
9986:
|
|
1091
|
+
9729: de,
|
|
1092
|
+
9984: Ot,
|
|
1093
|
+
9985: Nt,
|
|
1094
|
+
9986: Pt,
|
|
1095
1095
|
9987: je
|
|
1096
1096
|
}, ve = {
|
|
1097
|
-
33071:
|
|
1098
|
-
33648:
|
|
1097
|
+
33071: Dt,
|
|
1098
|
+
33648: kt,
|
|
1099
1099
|
10497: fe
|
|
1100
1100
|
}, oe = {
|
|
1101
1101
|
SCALAR: 1,
|
|
@@ -1121,18 +1121,18 @@ const x = {
|
|
|
1121
1121
|
translation: "position",
|
|
1122
1122
|
rotation: "quaternion",
|
|
1123
1123
|
weights: "morphTargetInfluences"
|
|
1124
|
-
},
|
|
1124
|
+
}, Ts = {
|
|
1125
1125
|
CUBICSPLINE: void 0,
|
|
1126
1126
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1127
1127
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1128
1128
|
LINEAR: ze,
|
|
1129
|
-
STEP:
|
|
1129
|
+
STEP: Ft
|
|
1130
1130
|
}, ae = {
|
|
1131
1131
|
OPAQUE: "OPAQUE",
|
|
1132
1132
|
MASK: "MASK",
|
|
1133
1133
|
BLEND: "BLEND"
|
|
1134
1134
|
};
|
|
1135
|
-
function
|
|
1135
|
+
function _s(o) {
|
|
1136
1136
|
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new Ve({
|
|
1137
1137
|
color: 16777215,
|
|
1138
1138
|
emissive: 0,
|
|
@@ -1140,75 +1140,75 @@ function Ts(o) {
|
|
|
1140
1140
|
roughness: 1,
|
|
1141
1141
|
transparent: !1,
|
|
1142
1142
|
depthTest: !0,
|
|
1143
|
-
side:
|
|
1143
|
+
side: Ht
|
|
1144
1144
|
})), o.DefaultMaterial;
|
|
1145
1145
|
}
|
|
1146
1146
|
function D(o, e, t) {
|
|
1147
|
-
for (const
|
|
1148
|
-
o[
|
|
1147
|
+
for (const n in t.extensions)
|
|
1148
|
+
o[n] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[n] = t.extensions[n]);
|
|
1149
1149
|
}
|
|
1150
1150
|
function C(o, e) {
|
|
1151
1151
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(o.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1154
|
-
let
|
|
1155
|
-
for (let l = 0,
|
|
1153
|
+
function Rs(o, e, t) {
|
|
1154
|
+
let n = !1, s = !1, i = !1;
|
|
1155
|
+
for (let l = 0, h = e.length; l < h; l++) {
|
|
1156
1156
|
const u = e[l];
|
|
1157
|
-
if (u.POSITION !== void 0 && (
|
|
1157
|
+
if (u.POSITION !== void 0 && (n = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (i = !0), n && s && i) break;
|
|
1158
1158
|
}
|
|
1159
|
-
if (!
|
|
1160
|
-
const
|
|
1161
|
-
for (let l = 0,
|
|
1159
|
+
if (!n && !s && !i) return Promise.resolve(o);
|
|
1160
|
+
const r = [], a = [], c = [];
|
|
1161
|
+
for (let l = 0, h = e.length; l < h; l++) {
|
|
1162
1162
|
const u = e[l];
|
|
1163
|
-
if (
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1163
|
+
if (n) {
|
|
1164
|
+
const d = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : o.attributes.position;
|
|
1165
|
+
r.push(d);
|
|
1166
1166
|
}
|
|
1167
1167
|
if (s) {
|
|
1168
|
-
const
|
|
1169
|
-
a.push(
|
|
1168
|
+
const d = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : o.attributes.normal;
|
|
1169
|
+
a.push(d);
|
|
1170
1170
|
}
|
|
1171
1171
|
if (i) {
|
|
1172
|
-
const
|
|
1173
|
-
c.push(
|
|
1172
|
+
const d = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : o.attributes.color;
|
|
1173
|
+
c.push(d);
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
return Promise.all([
|
|
1177
|
-
Promise.all(
|
|
1177
|
+
Promise.all(r),
|
|
1178
1178
|
Promise.all(a),
|
|
1179
1179
|
Promise.all(c)
|
|
1180
1180
|
]).then(function(l) {
|
|
1181
|
-
const
|
|
1182
|
-
return
|
|
1181
|
+
const h = l[0], u = l[1], d = l[2];
|
|
1182
|
+
return n && (o.morphAttributes.position = h), s && (o.morphAttributes.normal = u), i && (o.morphAttributes.color = d), o.morphTargetsRelative = !0, o;
|
|
1183
1183
|
});
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1185
|
+
function Es(o, e) {
|
|
1186
1186
|
if (o.updateMorphTargets(), e.weights !== void 0)
|
|
1187
|
-
for (let t = 0,
|
|
1187
|
+
for (let t = 0, n = e.weights.length; t < n; t++)
|
|
1188
1188
|
o.morphTargetInfluences[t] = e.weights[t];
|
|
1189
1189
|
if (e.extras && Array.isArray(e.extras.targetNames)) {
|
|
1190
1190
|
const t = e.extras.targetNames;
|
|
1191
1191
|
if (o.morphTargetInfluences.length === t.length) {
|
|
1192
1192
|
o.morphTargetDictionary = {};
|
|
1193
|
-
for (let
|
|
1194
|
-
o.morphTargetDictionary[t[
|
|
1193
|
+
for (let n = 0, s = t.length; n < s; n++)
|
|
1194
|
+
o.morphTargetDictionary[t[n]] = n;
|
|
1195
1195
|
} else
|
|
1196
1196
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function ws(o) {
|
|
1200
1200
|
let e;
|
|
1201
1201
|
const t = o.extensions && o.extensions[T.KHR_DRACO_MESH_COMPRESSION];
|
|
1202
1202
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ce(t.attributes) : e = o.indices + ":" + ce(o.attributes) + ":" + o.mode, o.targets !== void 0)
|
|
1203
|
-
for (let
|
|
1204
|
-
e += ":" + ce(o.targets[
|
|
1203
|
+
for (let n = 0, s = o.targets.length; n < s; n++)
|
|
1204
|
+
e += ":" + ce(o.targets[n]);
|
|
1205
1205
|
return e;
|
|
1206
1206
|
}
|
|
1207
1207
|
function ce(o) {
|
|
1208
1208
|
let e = "";
|
|
1209
1209
|
const t = Object.keys(o).sort();
|
|
1210
|
-
for (let
|
|
1211
|
-
e += t[
|
|
1210
|
+
for (let n = 0, s = t.length; n < s; n++)
|
|
1211
|
+
e += t[n] + ":" + o[t[n]] + ";";
|
|
1212
1212
|
return e;
|
|
1213
1213
|
}
|
|
1214
1214
|
function me(o) {
|
|
@@ -1225,21 +1225,21 @@ function me(o) {
|
|
|
1225
1225
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function xs(o) {
|
|
1229
1229
|
return o.search(/\.jpe?g($|\?)/i) > 0 || o.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : o.search(/\.webp($|\?)/i) > 0 || o.search(/^data\:image\/webp/) === 0 ? "image/webp" : o.search(/\.ktx2($|\?)/i) > 0 || o.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1230
1230
|
}
|
|
1231
|
-
const
|
|
1232
|
-
class
|
|
1231
|
+
const ys = new Y();
|
|
1232
|
+
class Ls {
|
|
1233
1233
|
constructor(e = {}, t = {}) {
|
|
1234
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1235
|
-
let
|
|
1234
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Wt(), 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 = {};
|
|
1235
|
+
let n = !1, s = -1, i = !1, r = -1;
|
|
1236
1236
|
if (typeof navigator < "u") {
|
|
1237
1237
|
const a = navigator.userAgent;
|
|
1238
|
-
|
|
1238
|
+
n = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
1239
1239
|
const c = a.match(/Version\/(\d+)/);
|
|
1240
|
-
s =
|
|
1240
|
+
s = n && c ? parseInt(c[1], 10) : -1, i = a.indexOf("Firefox") > -1, r = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1241
1241
|
}
|
|
1242
|
-
typeof createImageBitmap > "u" ||
|
|
1242
|
+
typeof createImageBitmap > "u" || n && s < 17 || i && r < 98 ? this.textureLoader = new ft(this.options.manager) : this.textureLoader = new Be(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new q(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1243
1243
|
}
|
|
1244
1244
|
setExtensions(e) {
|
|
1245
1245
|
this.extensions = e;
|
|
@@ -1248,28 +1248,28 @@ class ys {
|
|
|
1248
1248
|
this.plugins = e;
|
|
1249
1249
|
}
|
|
1250
1250
|
parse(e, t) {
|
|
1251
|
-
const
|
|
1252
|
-
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(
|
|
1253
|
-
return
|
|
1254
|
-
}), Promise.all(this._invokeAll(function(
|
|
1255
|
-
return
|
|
1251
|
+
const n = this, s = this.json, i = this.extensions;
|
|
1252
|
+
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(r) {
|
|
1253
|
+
return r._markDefs && r._markDefs();
|
|
1254
|
+
}), Promise.all(this._invokeAll(function(r) {
|
|
1255
|
+
return r.beforeRoot && r.beforeRoot();
|
|
1256
1256
|
})).then(function() {
|
|
1257
1257
|
return Promise.all([
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1258
|
+
n.getDependencies("scene"),
|
|
1259
|
+
n.getDependencies("animation"),
|
|
1260
|
+
n.getDependencies("camera")
|
|
1261
1261
|
]);
|
|
1262
|
-
}).then(function(
|
|
1262
|
+
}).then(function(r) {
|
|
1263
1263
|
const a = {
|
|
1264
|
-
scene:
|
|
1265
|
-
scenes:
|
|
1266
|
-
animations:
|
|
1267
|
-
cameras:
|
|
1264
|
+
scene: r[0][s.scene || 0],
|
|
1265
|
+
scenes: r[0],
|
|
1266
|
+
animations: r[1],
|
|
1267
|
+
cameras: r[2],
|
|
1268
1268
|
asset: s.asset,
|
|
1269
|
-
parser:
|
|
1269
|
+
parser: n,
|
|
1270
1270
|
userData: {}
|
|
1271
1271
|
};
|
|
1272
|
-
return D(i, a, s), C(a, s), Promise.all(
|
|
1272
|
+
return D(i, a, s), C(a, s), Promise.all(n._invokeAll(function(c) {
|
|
1273
1273
|
return c.afterRoot && c.afterRoot(a);
|
|
1274
1274
|
})).then(function() {
|
|
1275
1275
|
for (const c of a.scenes)
|
|
@@ -1282,15 +1282,15 @@ class ys {
|
|
|
1282
1282
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
1283
1283
|
*/
|
|
1284
1284
|
_markDefs() {
|
|
1285
|
-
const e = this.json.nodes || [], t = this.json.skins || [],
|
|
1285
|
+
const e = this.json.nodes || [], t = this.json.skins || [], n = this.json.meshes || [];
|
|
1286
1286
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
1287
|
-
const
|
|
1288
|
-
for (let a = 0, c =
|
|
1289
|
-
e[
|
|
1287
|
+
const r = t[s].joints;
|
|
1288
|
+
for (let a = 0, c = r.length; a < c; a++)
|
|
1289
|
+
e[r[a]].isBone = !0;
|
|
1290
1290
|
}
|
|
1291
1291
|
for (let s = 0, i = e.length; s < i; s++) {
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1292
|
+
const r = e[s];
|
|
1293
|
+
r.mesh !== void 0 && (this._addNodeRef(this.meshCache, r.mesh), r.skin !== void 0 && (n[r.mesh].isSkinnedMesh = !0)), r.camera !== void 0 && this._addNodeRef(this.cameraCache, r.camera);
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
1296
|
/**
|
|
@@ -1316,21 +1316,21 @@ class ys {
|
|
|
1316
1316
|
* @param {Object} object
|
|
1317
1317
|
* @return {Object}
|
|
1318
1318
|
*/
|
|
1319
|
-
_getNodeRef(e, t,
|
|
1320
|
-
if (e.refs[t] <= 1) return
|
|
1321
|
-
const s =
|
|
1322
|
-
const c = this.associations.get(
|
|
1319
|
+
_getNodeRef(e, t, n) {
|
|
1320
|
+
if (e.refs[t] <= 1) return n;
|
|
1321
|
+
const s = n.clone(), i = (r, a) => {
|
|
1322
|
+
const c = this.associations.get(r);
|
|
1323
1323
|
c != null && this.associations.set(a, c);
|
|
1324
|
-
for (const [l,
|
|
1325
|
-
i(
|
|
1324
|
+
for (const [l, h] of r.children.entries())
|
|
1325
|
+
i(h, a.children[l]);
|
|
1326
1326
|
};
|
|
1327
|
-
return i(
|
|
1327
|
+
return i(n, s), s.name += "_instance_" + e.uses[t]++, s;
|
|
1328
1328
|
}
|
|
1329
1329
|
_invokeOne(e) {
|
|
1330
1330
|
const t = Object.values(this.plugins);
|
|
1331
1331
|
t.push(this);
|
|
1332
|
-
for (let
|
|
1333
|
-
const s = e(t[
|
|
1332
|
+
for (let n = 0; n < t.length; n++) {
|
|
1333
|
+
const s = e(t[n]);
|
|
1334
1334
|
if (s) return s;
|
|
1335
1335
|
}
|
|
1336
1336
|
return null;
|
|
@@ -1338,12 +1338,12 @@ class ys {
|
|
|
1338
1338
|
_invokeAll(e) {
|
|
1339
1339
|
const t = Object.values(this.plugins);
|
|
1340
1340
|
t.unshift(this);
|
|
1341
|
-
const
|
|
1341
|
+
const n = [];
|
|
1342
1342
|
for (let s = 0; s < t.length; s++) {
|
|
1343
1343
|
const i = e(t[s]);
|
|
1344
|
-
i &&
|
|
1344
|
+
i && n.push(i);
|
|
1345
1345
|
}
|
|
1346
|
-
return
|
|
1346
|
+
return n;
|
|
1347
1347
|
}
|
|
1348
1348
|
/**
|
|
1349
1349
|
* Requests the specified dependency asynchronously, with caching.
|
|
@@ -1352,8 +1352,8 @@ class ys {
|
|
|
1352
1352
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
1353
1353
|
*/
|
|
1354
1354
|
getDependency(e, t) {
|
|
1355
|
-
const
|
|
1356
|
-
let s = this.cache.get(
|
|
1355
|
+
const n = e + ":" + t;
|
|
1356
|
+
let s = this.cache.get(n);
|
|
1357
1357
|
if (!s) {
|
|
1358
1358
|
switch (e) {
|
|
1359
1359
|
case "scene":
|
|
@@ -1408,7 +1408,7 @@ class ys {
|
|
|
1408
1408
|
throw new Error("Unknown type: " + e);
|
|
1409
1409
|
break;
|
|
1410
1410
|
}
|
|
1411
|
-
this.cache.add(
|
|
1411
|
+
this.cache.add(n, s);
|
|
1412
1412
|
}
|
|
1413
1413
|
return s;
|
|
1414
1414
|
}
|
|
@@ -1420,9 +1420,9 @@ class ys {
|
|
|
1420
1420
|
getDependencies(e) {
|
|
1421
1421
|
let t = this.cache.get(e);
|
|
1422
1422
|
if (!t) {
|
|
1423
|
-
const
|
|
1424
|
-
t = Promise.all(s.map(function(i,
|
|
1425
|
-
return
|
|
1423
|
+
const n = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1424
|
+
t = Promise.all(s.map(function(i, r) {
|
|
1425
|
+
return n.getDependency(e, r);
|
|
1426
1426
|
})), this.cache.add(e, t);
|
|
1427
1427
|
}
|
|
1428
1428
|
return t;
|
|
@@ -1433,15 +1433,15 @@ class ys {
|
|
|
1433
1433
|
* @return {Promise<ArrayBuffer>}
|
|
1434
1434
|
*/
|
|
1435
1435
|
loadBuffer(e) {
|
|
1436
|
-
const t = this.json.buffers[e],
|
|
1436
|
+
const t = this.json.buffers[e], n = this.fileLoader;
|
|
1437
1437
|
if (t.type && t.type !== "arraybuffer")
|
|
1438
1438
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1439
1439
|
if (t.uri === void 0 && e === 0)
|
|
1440
1440
|
return Promise.resolve(this.extensions[T.KHR_BINARY_GLTF].body);
|
|
1441
1441
|
const s = this.options;
|
|
1442
|
-
return new Promise(function(i,
|
|
1443
|
-
|
|
1444
|
-
|
|
1442
|
+
return new Promise(function(i, r) {
|
|
1443
|
+
n.load(V.resolveURL(t.uri, s.path), i, void 0, function() {
|
|
1444
|
+
r(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1445
1445
|
});
|
|
1446
1446
|
});
|
|
1447
1447
|
}
|
|
@@ -1452,9 +1452,9 @@ class ys {
|
|
|
1452
1452
|
*/
|
|
1453
1453
|
loadBufferView(e) {
|
|
1454
1454
|
const t = this.json.bufferViews[e];
|
|
1455
|
-
return this.getDependency("buffer", t.buffer).then(function(
|
|
1455
|
+
return this.getDependency("buffer", t.buffer).then(function(n) {
|
|
1456
1456
|
const s = t.byteLength || 0, i = t.byteOffset || 0;
|
|
1457
|
-
return
|
|
1457
|
+
return n.slice(i, i + s);
|
|
1458
1458
|
});
|
|
1459
1459
|
}
|
|
1460
1460
|
/**
|
|
@@ -1463,23 +1463,23 @@ class ys {
|
|
|
1463
1463
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1464
1464
|
*/
|
|
1465
1465
|
loadAccessor(e) {
|
|
1466
|
-
const t = this,
|
|
1466
|
+
const t = this, n = this.json, s = this.json.accessors[e];
|
|
1467
1467
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
1468
|
-
const
|
|
1469
|
-
return Promise.resolve(new K(l,
|
|
1468
|
+
const r = oe[s.type], a = H[s.componentType], c = s.normalized === !0, l = new a(s.count * r);
|
|
1469
|
+
return Promise.resolve(new K(l, r, c));
|
|
1470
1470
|
}
|
|
1471
1471
|
const i = [];
|
|
1472
|
-
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(
|
|
1473
|
-
const a =
|
|
1472
|
+
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(r) {
|
|
1473
|
+
const a = r[0], c = oe[s.type], l = H[s.componentType], h = l.BYTES_PER_ELEMENT, u = h * c, d = s.byteOffset || 0, f = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
|
|
1474
1474
|
let A, m;
|
|
1475
1475
|
if (f && f !== u) {
|
|
1476
|
-
const g = Math.floor(
|
|
1476
|
+
const g = Math.floor(d / f), R = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
|
|
1477
1477
|
let w = t.cache.get(R);
|
|
1478
|
-
w || (A = new l(a, g * f, s.count * f /
|
|
1478
|
+
w || (A = new l(a, g * f, s.count * f / h), w = new pt(A, f / h), t.cache.add(R, w)), m = new mt(w, c, d % f / h, p);
|
|
1479
1479
|
} else
|
|
1480
|
-
a === null ? A = new l(s.count * c) : A = new l(a,
|
|
1480
|
+
a === null ? A = new l(s.count * c) : A = new l(a, d, s.count * c), m = new K(A, c, p);
|
|
1481
1481
|
if (s.sparse !== void 0) {
|
|
1482
|
-
const g = oe.SCALAR, R = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, b = new R(
|
|
1482
|
+
const g = oe.SCALAR, R = H[s.sparse.indices.componentType], w = s.sparse.indices.byteOffset || 0, E = s.sparse.values.byteOffset || 0, b = new R(r[1], w, s.sparse.count * g), M = new l(r[2], E, s.sparse.count * c);
|
|
1483
1483
|
a !== null && (m = new K(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
1484
1484
|
for (let y = 0, U = b.length; y < U; y++) {
|
|
1485
1485
|
const I = b[y];
|
|
@@ -1496,55 +1496,55 @@ class ys {
|
|
|
1496
1496
|
* @return {Promise<THREE.Texture|null>}
|
|
1497
1497
|
*/
|
|
1498
1498
|
loadTexture(e) {
|
|
1499
|
-
const t = this.json,
|
|
1499
|
+
const t = this.json, n = this.options, i = t.textures[e].source, r = t.images[i];
|
|
1500
1500
|
let a = this.textureLoader;
|
|
1501
|
-
if (
|
|
1502
|
-
const c =
|
|
1501
|
+
if (r.uri) {
|
|
1502
|
+
const c = n.manager.getHandler(r.uri);
|
|
1503
1503
|
c !== null && (a = c);
|
|
1504
1504
|
}
|
|
1505
1505
|
return this.loadTextureImage(e, i, a);
|
|
1506
1506
|
}
|
|
1507
|
-
loadTextureImage(e, t,
|
|
1508
|
-
const s = this, i = this.json,
|
|
1507
|
+
loadTextureImage(e, t, n) {
|
|
1508
|
+
const s = this, i = this.json, r = i.textures[e], a = i.images[t], c = (a.uri || a.bufferView) + ":" + r.sampler;
|
|
1509
1509
|
if (this.textureCache[c])
|
|
1510
1510
|
return this.textureCache[c];
|
|
1511
|
-
const l = this.loadImageSource(t,
|
|
1512
|
-
|
|
1513
|
-
const
|
|
1514
|
-
return
|
|
1511
|
+
const l = this.loadImageSource(t, n).then(function(h) {
|
|
1512
|
+
h.flipY = !1, h.name = r.name || a.name || "", h.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (h.name = a.uri);
|
|
1513
|
+
const d = (i.samplers || {})[r.sampler] || {};
|
|
1514
|
+
return h.magFilter = Se[d.magFilter] || de, h.minFilter = Se[d.minFilter] || je, h.wrapS = ve[d.wrapS] || fe, h.wrapT = ve[d.wrapT] || fe, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Ke && h.minFilter !== de, s.associations.set(h, { textures: e }), h;
|
|
1515
1515
|
}).catch(function() {
|
|
1516
1516
|
return null;
|
|
1517
1517
|
});
|
|
1518
1518
|
return this.textureCache[c] = l, l;
|
|
1519
1519
|
}
|
|
1520
1520
|
loadImageSource(e, t) {
|
|
1521
|
-
const
|
|
1521
|
+
const n = this, s = this.json, i = this.options;
|
|
1522
1522
|
if (this.sourceCache[e] !== void 0)
|
|
1523
1523
|
return this.sourceCache[e].then((u) => u.clone());
|
|
1524
|
-
const
|
|
1525
|
-
let c =
|
|
1526
|
-
if (
|
|
1527
|
-
c =
|
|
1524
|
+
const r = s.images[e], a = self.URL || self.webkitURL;
|
|
1525
|
+
let c = r.uri || "", l = !1;
|
|
1526
|
+
if (r.bufferView !== void 0)
|
|
1527
|
+
c = n.getDependency("bufferView", r.bufferView).then(function(u) {
|
|
1528
1528
|
l = !0;
|
|
1529
|
-
const
|
|
1530
|
-
return c = a.createObjectURL(
|
|
1529
|
+
const d = new Blob([u], { type: r.mimeType });
|
|
1530
|
+
return c = a.createObjectURL(d), c;
|
|
1531
1531
|
});
|
|
1532
|
-
else if (
|
|
1532
|
+
else if (r.uri === void 0)
|
|
1533
1533
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1534
|
-
const
|
|
1535
|
-
return new Promise(function(
|
|
1536
|
-
let p =
|
|
1534
|
+
const h = Promise.resolve(c).then(function(u) {
|
|
1535
|
+
return new Promise(function(d, f) {
|
|
1536
|
+
let p = d;
|
|
1537
1537
|
t.isImageBitmapLoader === !0 && (p = function(A) {
|
|
1538
1538
|
const m = new Ee(A);
|
|
1539
|
-
m.needsUpdate = !0,
|
|
1539
|
+
m.needsUpdate = !0, d(m);
|
|
1540
1540
|
}), t.load(V.resolveURL(u, i.path), p, void 0, f);
|
|
1541
1541
|
});
|
|
1542
1542
|
}).then(function(u) {
|
|
1543
|
-
return l === !0 && a.revokeObjectURL(c), C(u,
|
|
1543
|
+
return l === !0 && a.revokeObjectURL(c), C(u, r), u.userData.mimeType = r.mimeType || xs(r.uri), u;
|
|
1544
1544
|
}).catch(function(u) {
|
|
1545
1545
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
|
|
1546
1546
|
});
|
|
1547
|
-
return this.sourceCache[e] =
|
|
1547
|
+
return this.sourceCache[e] = h, h;
|
|
1548
1548
|
}
|
|
1549
1549
|
/**
|
|
1550
1550
|
* Asynchronously assigns a texture to the given material parameters.
|
|
@@ -1555,18 +1555,18 @@ class ys {
|
|
|
1555
1555
|
* @param {string} colorSpace
|
|
1556
1556
|
* @return {Promise<Texture>}
|
|
1557
1557
|
*/
|
|
1558
|
-
assignTexture(e, t,
|
|
1558
|
+
assignTexture(e, t, n, s) {
|
|
1559
1559
|
const i = this;
|
|
1560
|
-
return this.getDependency("texture",
|
|
1561
|
-
if (!
|
|
1562
|
-
if (
|
|
1563
|
-
const a =
|
|
1560
|
+
return this.getDependency("texture", n.index).then(function(r) {
|
|
1561
|
+
if (!r) return null;
|
|
1562
|
+
if (n.texCoord !== void 0 && n.texCoord > 0 && (r = r.clone(), r.channel = n.texCoord), i.extensions[T.KHR_TEXTURE_TRANSFORM]) {
|
|
1563
|
+
const a = n.extensions !== void 0 ? n.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1564
1564
|
if (a) {
|
|
1565
|
-
const c = i.associations.get(
|
|
1566
|
-
|
|
1565
|
+
const c = i.associations.get(r);
|
|
1566
|
+
r = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(r, a), i.associations.set(r, c);
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
1569
|
-
return s !== void 0 && (
|
|
1569
|
+
return s !== void 0 && (r.colorSpace = s), e[t] = r, r;
|
|
1570
1570
|
});
|
|
1571
1571
|
}
|
|
1572
1572
|
/**
|
|
@@ -1579,24 +1579,24 @@ class ys {
|
|
|
1579
1579
|
*/
|
|
1580
1580
|
assignFinalMaterial(e) {
|
|
1581
1581
|
const t = e.geometry;
|
|
1582
|
-
let
|
|
1583
|
-
const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0,
|
|
1582
|
+
let n = e.material;
|
|
1583
|
+
const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, r = t.attributes.normal === void 0;
|
|
1584
1584
|
if (e.isPoints) {
|
|
1585
|
-
const a = "PointsMaterial:" +
|
|
1585
|
+
const a = "PointsMaterial:" + n.uuid;
|
|
1586
1586
|
let c = this.cache.get(a);
|
|
1587
|
-
c || (c = new
|
|
1587
|
+
c || (c = new gt(), ne.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, c.sizeAttenuation = !1, this.cache.add(a, c)), n = c;
|
|
1588
1588
|
} else if (e.isLine) {
|
|
1589
|
-
const a = "LineBasicMaterial:" +
|
|
1589
|
+
const a = "LineBasicMaterial:" + n.uuid;
|
|
1590
1590
|
let c = this.cache.get(a);
|
|
1591
|
-
c || (c = new
|
|
1591
|
+
c || (c = new At(), ne.prototype.copy.call(c, n), c.color.copy(n.color), c.map = n.map, this.cache.add(a, c)), n = c;
|
|
1592
1592
|
}
|
|
1593
|
-
if (s || i ||
|
|
1594
|
-
let a = "ClonedMaterial:" +
|
|
1595
|
-
s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"),
|
|
1593
|
+
if (s || i || r) {
|
|
1594
|
+
let a = "ClonedMaterial:" + n.uuid + ":";
|
|
1595
|
+
s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), r && (a += "flat-shading:");
|
|
1596
1596
|
let c = this.cache.get(a);
|
|
1597
|
-
c || (c =
|
|
1597
|
+
c || (c = n.clone(), i && (c.vertexColors = !0), r && (c.flatShading = !0), s && (c.normalScale && (c.normalScale.y *= -1), c.clearcoatNormalScale && (c.clearcoatNormalScale.y *= -1)), this.cache.add(a, c), this.associations.set(c, this.associations.get(n))), n = c;
|
|
1598
1598
|
}
|
|
1599
|
-
e.material =
|
|
1599
|
+
e.material = n;
|
|
1600
1600
|
}
|
|
1601
1601
|
getMaterialType() {
|
|
1602
1602
|
return Ve;
|
|
@@ -1607,36 +1607,36 @@ class ys {
|
|
|
1607
1607
|
* @return {Promise<Material>}
|
|
1608
1608
|
*/
|
|
1609
1609
|
loadMaterial(e) {
|
|
1610
|
-
const t = this,
|
|
1611
|
-
let
|
|
1610
|
+
const t = this, n = this.json, s = this.extensions, i = n.materials[e];
|
|
1611
|
+
let r;
|
|
1612
1612
|
const a = {}, c = i.extensions || {}, l = [];
|
|
1613
1613
|
if (c[T.KHR_MATERIALS_UNLIT]) {
|
|
1614
1614
|
const u = s[T.KHR_MATERIALS_UNLIT];
|
|
1615
|
-
|
|
1615
|
+
r = u.getMaterialType(), l.push(u.extendParams(a, i, t));
|
|
1616
1616
|
} else {
|
|
1617
1617
|
const u = i.pbrMetallicRoughness || {};
|
|
1618
1618
|
if (a.color = new P(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
1619
|
-
const
|
|
1620
|
-
a.color.setRGB(
|
|
1619
|
+
const d = u.baseColorFactor;
|
|
1620
|
+
a.color.setRGB(d[0], d[1], d[2], S), a.opacity = d[3];
|
|
1621
1621
|
}
|
|
1622
|
-
u.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", u.baseColorTexture, N)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))),
|
|
1623
|
-
return
|
|
1624
|
-
}), l.push(Promise.all(this._invokeAll(function(
|
|
1625
|
-
return
|
|
1622
|
+
u.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", u.baseColorTexture, N)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), r = this._invokeOne(function(d) {
|
|
1623
|
+
return d.getMaterialType && d.getMaterialType(e);
|
|
1624
|
+
}), l.push(Promise.all(this._invokeAll(function(d) {
|
|
1625
|
+
return d.extendMaterialParams && d.extendMaterialParams(e, a);
|
|
1626
1626
|
})));
|
|
1627
1627
|
}
|
|
1628
|
-
i.doubleSided === !0 && (a.side =
|
|
1629
|
-
const
|
|
1630
|
-
if (
|
|
1628
|
+
i.doubleSided === !0 && (a.side = Tt);
|
|
1629
|
+
const h = i.alphaMode || ae.OPAQUE;
|
|
1630
|
+
if (h === ae.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, h === ae.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && r !== B && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new He(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1631
1631
|
const u = i.normalTexture.scale;
|
|
1632
1632
|
a.normalScale.set(u, u);
|
|
1633
1633
|
}
|
|
1634
|
-
if (i.occlusionTexture !== void 0 &&
|
|
1634
|
+
if (i.occlusionTexture !== void 0 && r !== B && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && r !== B) {
|
|
1635
1635
|
const u = i.emissiveFactor;
|
|
1636
1636
|
a.emissive = new P().setRGB(u[0], u[1], u[2], S);
|
|
1637
1637
|
}
|
|
1638
|
-
return i.emissiveTexture !== void 0 &&
|
|
1639
|
-
const u = new
|
|
1638
|
+
return i.emissiveTexture !== void 0 && r !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, N)), Promise.all(l).then(function() {
|
|
1639
|
+
const u = new r(a);
|
|
1640
1640
|
return i.name && (u.name = i.name), C(u, i), t.associations.set(u, { materials: e }), i.extensions && D(s, u, i), u;
|
|
1641
1641
|
});
|
|
1642
1642
|
}
|
|
@@ -1647,7 +1647,7 @@ class ys {
|
|
|
1647
1647
|
* @return {String}
|
|
1648
1648
|
*/
|
|
1649
1649
|
createUniqueName(e) {
|
|
1650
|
-
const t =
|
|
1650
|
+
const t = _t.sanitizeNodeName(e || "");
|
|
1651
1651
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1652
1652
|
}
|
|
1653
1653
|
/**
|
|
@@ -1659,23 +1659,23 @@ class ys {
|
|
|
1659
1659
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1660
1660
|
*/
|
|
1661
1661
|
loadGeometries(e) {
|
|
1662
|
-
const t = this,
|
|
1662
|
+
const t = this, n = this.extensions, s = this.primitiveCache;
|
|
1663
1663
|
function i(a) {
|
|
1664
|
-
return
|
|
1664
|
+
return n[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
|
|
1665
1665
|
return Ce(c, a, t);
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
|
-
const
|
|
1668
|
+
const r = [];
|
|
1669
1669
|
for (let a = 0, c = e.length; a < c; a++) {
|
|
1670
|
-
const l = e[a],
|
|
1670
|
+
const l = e[a], h = ws(l), u = s[h];
|
|
1671
1671
|
if (u)
|
|
1672
|
-
|
|
1672
|
+
r.push(u.promise);
|
|
1673
1673
|
else {
|
|
1674
|
-
let
|
|
1675
|
-
l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ?
|
|
1674
|
+
let d;
|
|
1675
|
+
l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? d = i(l) : d = Ce(new Fe(), l, t), s[h] = { primitive: l, promise: d }, r.push(d);
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
|
-
return Promise.all(
|
|
1678
|
+
return Promise.all(r);
|
|
1679
1679
|
}
|
|
1680
1680
|
/**
|
|
1681
1681
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
@@ -1683,30 +1683,30 @@ class ys {
|
|
|
1683
1683
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1684
1684
|
*/
|
|
1685
1685
|
loadMesh(e) {
|
|
1686
|
-
const t = this,
|
|
1687
|
-
for (let c = 0, l =
|
|
1688
|
-
const
|
|
1689
|
-
a.push(
|
|
1686
|
+
const t = this, n = this.json, s = this.extensions, i = n.meshes[e], r = i.primitives, a = [];
|
|
1687
|
+
for (let c = 0, l = r.length; c < l; c++) {
|
|
1688
|
+
const h = r[c].material === void 0 ? _s(this.cache) : this.getDependency("material", r[c].material);
|
|
1689
|
+
a.push(h);
|
|
1690
1690
|
}
|
|
1691
|
-
return a.push(t.loadGeometries(
|
|
1692
|
-
const l = c.slice(0, c.length - 1),
|
|
1693
|
-
for (let f = 0, p =
|
|
1694
|
-
const A =
|
|
1691
|
+
return a.push(t.loadGeometries(r)), Promise.all(a).then(function(c) {
|
|
1692
|
+
const l = c.slice(0, c.length - 1), h = c[c.length - 1], u = [];
|
|
1693
|
+
for (let f = 0, p = h.length; f < p; f++) {
|
|
1694
|
+
const A = h[f], m = r[f];
|
|
1695
1695
|
let g;
|
|
1696
1696
|
const R = l[f];
|
|
1697
1697
|
if (m.mode === x.TRIANGLES || m.mode === x.TRIANGLE_STRIP || m.mode === x.TRIANGLE_FAN || m.mode === void 0)
|
|
1698
|
-
g = i.isSkinnedMesh === !0 ? new
|
|
1698
|
+
g = i.isSkinnedMesh === !0 ? new Rt(A, R) : new Et(A, R), g.isSkinnedMesh === !0 && g.normalizeSkinWeights(), m.mode === x.TRIANGLE_STRIP ? g.geometry = Le(g.geometry, De) : m.mode === x.TRIANGLE_FAN && (g.geometry = Le(g.geometry, ue));
|
|
1699
1699
|
else if (m.mode === x.LINES)
|
|
1700
|
-
g = new Et(A, R);
|
|
1701
|
-
else if (m.mode === x.LINE_STRIP)
|
|
1702
1700
|
g = new wt(A, R);
|
|
1703
|
-
else if (m.mode === x.
|
|
1701
|
+
else if (m.mode === x.LINE_STRIP)
|
|
1704
1702
|
g = new xt(A, R);
|
|
1705
|
-
else if (m.mode === x.
|
|
1703
|
+
else if (m.mode === x.LINE_LOOP)
|
|
1706
1704
|
g = new yt(A, R);
|
|
1705
|
+
else if (m.mode === x.POINTS)
|
|
1706
|
+
g = new Lt(A, R);
|
|
1707
1707
|
else
|
|
1708
1708
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
1709
|
-
Object.keys(g.geometry.morphAttributes).length > 0 &&
|
|
1709
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && Es(g, i), g.name = t.createUniqueName(i.name || "mesh_" + e), C(g, i), m.extensions && D(s, g, m), t.assignFinalMaterial(g), u.push(g);
|
|
1710
1710
|
}
|
|
1711
1711
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1712
1712
|
t.associations.set(u[f], {
|
|
@@ -1715,11 +1715,11 @@ class ys {
|
|
|
1715
1715
|
});
|
|
1716
1716
|
if (u.length === 1)
|
|
1717
1717
|
return i.extensions && D(s, u[0], i), u[0];
|
|
1718
|
-
const
|
|
1719
|
-
i.extensions && D(s,
|
|
1718
|
+
const d = new re();
|
|
1719
|
+
i.extensions && D(s, d, i), t.associations.set(d, { meshes: e });
|
|
1720
1720
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1721
|
-
|
|
1722
|
-
return
|
|
1721
|
+
d.add(u[f]);
|
|
1722
|
+
return d;
|
|
1723
1723
|
});
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
@@ -1729,12 +1729,12 @@ class ys {
|
|
|
1729
1729
|
*/
|
|
1730
1730
|
loadCamera(e) {
|
|
1731
1731
|
let t;
|
|
1732
|
-
const
|
|
1732
|
+
const n = this.json.cameras[e], s = n[n.type];
|
|
1733
1733
|
if (!s) {
|
|
1734
1734
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
1737
|
-
return
|
|
1737
|
+
return n.type === "perspective" ? t = new bt(St.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : n.type === "orthographic" && (t = new vt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), n.name && (t.name = this.createUniqueName(n.name)), C(t, n), Promise.resolve(t);
|
|
1738
1738
|
}
|
|
1739
1739
|
/**
|
|
1740
1740
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1742,21 +1742,21 @@ class ys {
|
|
|
1742
1742
|
* @return {Promise<Skeleton>}
|
|
1743
1743
|
*/
|
|
1744
1744
|
loadSkin(e) {
|
|
1745
|
-
const t = this.json.skins[e],
|
|
1745
|
+
const t = this.json.skins[e], n = [];
|
|
1746
1746
|
for (let s = 0, i = t.joints.length; s < i; s++)
|
|
1747
|
-
|
|
1748
|
-
return t.inverseBindMatrices !== void 0 ?
|
|
1749
|
-
const i = s.pop(),
|
|
1750
|
-
for (let l = 0,
|
|
1751
|
-
const u =
|
|
1747
|
+
n.push(this._loadNodeShallow(t.joints[s]));
|
|
1748
|
+
return t.inverseBindMatrices !== void 0 ? n.push(this.getDependency("accessor", t.inverseBindMatrices)) : n.push(null), Promise.all(n).then(function(s) {
|
|
1749
|
+
const i = s.pop(), r = s, a = [], c = [];
|
|
1750
|
+
for (let l = 0, h = r.length; l < h; l++) {
|
|
1751
|
+
const u = r[l];
|
|
1752
1752
|
if (u) {
|
|
1753
1753
|
a.push(u);
|
|
1754
|
-
const
|
|
1755
|
-
i !== null &&
|
|
1754
|
+
const d = new Y();
|
|
1755
|
+
i !== null && d.fromArray(i.array, l * 16), c.push(d);
|
|
1756
1756
|
} else
|
|
1757
1757
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
|
|
1758
1758
|
}
|
|
1759
|
-
return new
|
|
1759
|
+
return new Ct(a, c);
|
|
1760
1760
|
});
|
|
1761
1761
|
}
|
|
1762
1762
|
/**
|
|
@@ -1765,40 +1765,40 @@ class ys {
|
|
|
1765
1765
|
* @return {Promise<AnimationClip>}
|
|
1766
1766
|
*/
|
|
1767
1767
|
loadAnimation(e) {
|
|
1768
|
-
const t = this.json,
|
|
1769
|
-
for (let u = 0,
|
|
1768
|
+
const t = this.json, n = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, r = [], a = [], c = [], l = [], h = [];
|
|
1769
|
+
for (let u = 0, d = s.channels.length; u < d; u++) {
|
|
1770
1770
|
const f = s.channels[u], p = s.samplers[f.sampler], A = f.target, m = A.node, g = s.parameters !== void 0 ? s.parameters[p.input] : p.input, R = s.parameters !== void 0 ? s.parameters[p.output] : p.output;
|
|
1771
|
-
A.node !== void 0 && (
|
|
1771
|
+
A.node !== void 0 && (r.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), c.push(this.getDependency("accessor", R)), l.push(p), h.push(A));
|
|
1772
1772
|
}
|
|
1773
1773
|
return Promise.all([
|
|
1774
|
-
Promise.all(
|
|
1774
|
+
Promise.all(r),
|
|
1775
1775
|
Promise.all(a),
|
|
1776
1776
|
Promise.all(c),
|
|
1777
1777
|
Promise.all(l),
|
|
1778
|
-
Promise.all(
|
|
1778
|
+
Promise.all(h)
|
|
1779
1779
|
]).then(function(u) {
|
|
1780
|
-
const
|
|
1781
|
-
for (let R = 0, w =
|
|
1782
|
-
const E =
|
|
1780
|
+
const d = u[0], f = u[1], p = u[2], A = u[3], m = u[4], g = [];
|
|
1781
|
+
for (let R = 0, w = d.length; R < w; R++) {
|
|
1782
|
+
const E = d[R], b = f[R], M = p[R], y = A[R], U = m[R];
|
|
1783
1783
|
if (E === void 0) continue;
|
|
1784
1784
|
E.updateMatrix && E.updateMatrix();
|
|
1785
|
-
const I =
|
|
1785
|
+
const I = n._createAnimationTracks(E, b, M, y, U);
|
|
1786
1786
|
if (I)
|
|
1787
1787
|
for (let te = 0; te < I.length; te++)
|
|
1788
1788
|
g.push(I[te]);
|
|
1789
1789
|
}
|
|
1790
|
-
return new
|
|
1790
|
+
return new Mt(i, void 0, g);
|
|
1791
1791
|
});
|
|
1792
1792
|
}
|
|
1793
1793
|
createNodeMesh(e) {
|
|
1794
|
-
const t = this.json,
|
|
1795
|
-
return s.mesh === void 0 ? null :
|
|
1796
|
-
const
|
|
1797
|
-
return s.weights !== void 0 &&
|
|
1794
|
+
const t = this.json, n = this, s = t.nodes[e];
|
|
1795
|
+
return s.mesh === void 0 ? null : n.getDependency("mesh", s.mesh).then(function(i) {
|
|
1796
|
+
const r = n._getNodeRef(n.meshCache, s.mesh, i);
|
|
1797
|
+
return s.weights !== void 0 && r.traverse(function(a) {
|
|
1798
1798
|
if (a.isMesh)
|
|
1799
1799
|
for (let c = 0, l = s.weights.length; c < l; c++)
|
|
1800
1800
|
a.morphTargetInfluences[c] = s.weights[c];
|
|
1801
|
-
}),
|
|
1801
|
+
}), r;
|
|
1802
1802
|
});
|
|
1803
1803
|
}
|
|
1804
1804
|
/**
|
|
@@ -1807,31 +1807,31 @@ class ys {
|
|
|
1807
1807
|
* @return {Promise<Object3D>}
|
|
1808
1808
|
*/
|
|
1809
1809
|
loadNode(e) {
|
|
1810
|
-
const t = this.json,
|
|
1811
|
-
for (let l = 0,
|
|
1812
|
-
|
|
1813
|
-
const c = s.skin === void 0 ? Promise.resolve(null) :
|
|
1810
|
+
const t = this.json, n = this, s = t.nodes[e], i = n._loadNodeShallow(e), r = [], a = s.children || [];
|
|
1811
|
+
for (let l = 0, h = a.length; l < h; l++)
|
|
1812
|
+
r.push(n.getDependency("node", a[l]));
|
|
1813
|
+
const c = s.skin === void 0 ? Promise.resolve(null) : n.getDependency("skin", s.skin);
|
|
1814
1814
|
return Promise.all([
|
|
1815
1815
|
i,
|
|
1816
|
-
Promise.all(
|
|
1816
|
+
Promise.all(r),
|
|
1817
1817
|
c
|
|
1818
1818
|
]).then(function(l) {
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
f.isSkinnedMesh && f.bind(
|
|
1819
|
+
const h = l[0], u = l[1], d = l[2];
|
|
1820
|
+
d !== null && h.traverse(function(f) {
|
|
1821
|
+
f.isSkinnedMesh && f.bind(d, ys);
|
|
1822
1822
|
});
|
|
1823
1823
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1824
|
-
|
|
1825
|
-
return
|
|
1824
|
+
h.add(u[f]);
|
|
1825
|
+
return h;
|
|
1826
1826
|
});
|
|
1827
1827
|
}
|
|
1828
1828
|
// ._loadNodeShallow() parses a single node.
|
|
1829
1829
|
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1830
1830
|
_loadNodeShallow(e) {
|
|
1831
|
-
const t = this.json,
|
|
1831
|
+
const t = this.json, n = this.extensions, s = this;
|
|
1832
1832
|
if (this.nodeCache[e] !== void 0)
|
|
1833
1833
|
return this.nodeCache[e];
|
|
1834
|
-
const i = t.nodes[e],
|
|
1834
|
+
const i = t.nodes[e], r = i.name ? s.createUniqueName(i.name) : "", a = [], c = s._invokeOne(function(l) {
|
|
1835
1835
|
return l.createNodeMesh && l.createNodeMesh(e);
|
|
1836
1836
|
});
|
|
1837
1837
|
return c && a.push(c), i.camera !== void 0 && a.push(s.getDependency("camera", i.camera).then(function(l) {
|
|
@@ -1841,16 +1841,16 @@ class ys {
|
|
|
1841
1841
|
}).forEach(function(l) {
|
|
1842
1842
|
a.push(l);
|
|
1843
1843
|
}), this.nodeCache[e] = Promise.all(a).then(function(l) {
|
|
1844
|
-
let
|
|
1845
|
-
if (i.isBone === !0 ?
|
|
1846
|
-
for (let u = 0,
|
|
1847
|
-
|
|
1848
|
-
if (i.name && (
|
|
1844
|
+
let h;
|
|
1845
|
+
if (i.isBone === !0 ? h = new It() : l.length > 1 ? h = new re() : l.length === 1 ? h = l[0] : h = new Ge(), h !== l[0])
|
|
1846
|
+
for (let u = 0, d = l.length; u < d; u++)
|
|
1847
|
+
h.add(l[u]);
|
|
1848
|
+
if (i.name && (h.userData.name = i.name, h.name = r), C(h, i), i.extensions && D(n, h, i), i.matrix !== void 0) {
|
|
1849
1849
|
const u = new Y();
|
|
1850
|
-
u.fromArray(i.matrix),
|
|
1850
|
+
u.fromArray(i.matrix), h.applyMatrix4(u);
|
|
1851
1851
|
} else
|
|
1852
|
-
i.translation !== void 0 &&
|
|
1853
|
-
return s.associations.has(
|
|
1852
|
+
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);
|
|
1853
|
+
return s.associations.has(h) || s.associations.set(h, {}), s.associations.get(h).nodes = e, h;
|
|
1854
1854
|
}), this.nodeCache[e];
|
|
1855
1855
|
}
|
|
1856
1856
|
/**
|
|
@@ -1859,30 +1859,30 @@ class ys {
|
|
|
1859
1859
|
* @return {Promise<Group>}
|
|
1860
1860
|
*/
|
|
1861
1861
|
loadScene(e) {
|
|
1862
|
-
const t = this.extensions,
|
|
1863
|
-
|
|
1864
|
-
const
|
|
1865
|
-
for (let c = 0, l =
|
|
1866
|
-
a.push(s.getDependency("node",
|
|
1862
|
+
const t = this.extensions, n = this.json.scenes[e], s = this, i = new re();
|
|
1863
|
+
n.name && (i.name = s.createUniqueName(n.name)), C(i, n), n.extensions && D(t, i, n);
|
|
1864
|
+
const r = n.nodes || [], a = [];
|
|
1865
|
+
for (let c = 0, l = r.length; c < l; c++)
|
|
1866
|
+
a.push(s.getDependency("node", r[c]));
|
|
1867
1867
|
return Promise.all(a).then(function(c) {
|
|
1868
|
-
for (let
|
|
1869
|
-
i.add(c[
|
|
1870
|
-
const l = (
|
|
1868
|
+
for (let h = 0, u = c.length; h < u; h++)
|
|
1869
|
+
i.add(c[h]);
|
|
1870
|
+
const l = (h) => {
|
|
1871
1871
|
const u = /* @__PURE__ */ new Map();
|
|
1872
|
-
for (const [
|
|
1873
|
-
(
|
|
1874
|
-
return
|
|
1875
|
-
const f = s.associations.get(
|
|
1876
|
-
f != null && u.set(
|
|
1872
|
+
for (const [d, f] of s.associations)
|
|
1873
|
+
(d instanceof ne || d instanceof Ee) && u.set(d, f);
|
|
1874
|
+
return h.traverse((d) => {
|
|
1875
|
+
const f = s.associations.get(d);
|
|
1876
|
+
f != null && u.set(d, f);
|
|
1877
1877
|
}), u;
|
|
1878
1878
|
};
|
|
1879
1879
|
return s.associations = l(i), i;
|
|
1880
1880
|
});
|
|
1881
1881
|
}
|
|
1882
|
-
_createAnimationTracks(e, t,
|
|
1883
|
-
const
|
|
1884
|
-
O[i.path] === O.weights ? e.traverse(function(
|
|
1885
|
-
|
|
1882
|
+
_createAnimationTracks(e, t, n, s, i) {
|
|
1883
|
+
const r = [], a = e.name ? e.name : e.uuid, c = [];
|
|
1884
|
+
O[i.path] === O.weights ? e.traverse(function(d) {
|
|
1885
|
+
d.morphTargetInfluences && c.push(d.name ? d.name : d.uuid);
|
|
1886
1886
|
}) : c.push(a);
|
|
1887
1887
|
let l;
|
|
1888
1888
|
switch (O[i.path]) {
|
|
@@ -1897,7 +1897,7 @@ class ys {
|
|
|
1897
1897
|
l = we;
|
|
1898
1898
|
break;
|
|
1899
1899
|
default:
|
|
1900
|
-
switch (
|
|
1900
|
+
switch (n.itemSize) {
|
|
1901
1901
|
case 1:
|
|
1902
1902
|
l = xe;
|
|
1903
1903
|
break;
|
|
@@ -1909,46 +1909,46 @@ class ys {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
break;
|
|
1911
1911
|
}
|
|
1912
|
-
const
|
|
1913
|
-
for (let
|
|
1912
|
+
const h = s.interpolation !== void 0 ? Ts[s.interpolation] : ze, u = this._getArrayFromAccessor(n);
|
|
1913
|
+
for (let d = 0, f = c.length; d < f; d++) {
|
|
1914
1914
|
const p = new l(
|
|
1915
|
-
c[
|
|
1915
|
+
c[d] + "." + O[i.path],
|
|
1916
1916
|
t.array,
|
|
1917
1917
|
u,
|
|
1918
|
-
|
|
1918
|
+
h
|
|
1919
1919
|
);
|
|
1920
|
-
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p),
|
|
1920
|
+
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), r.push(p);
|
|
1921
1921
|
}
|
|
1922
|
-
return
|
|
1922
|
+
return r;
|
|
1923
1923
|
}
|
|
1924
1924
|
_getArrayFromAccessor(e) {
|
|
1925
1925
|
let t = e.array;
|
|
1926
1926
|
if (e.normalized) {
|
|
1927
|
-
const
|
|
1928
|
-
for (let i = 0,
|
|
1929
|
-
s[i] = t[i] *
|
|
1927
|
+
const n = me(t.constructor), s = new Float32Array(t.length);
|
|
1928
|
+
for (let i = 0, r = t.length; i < r; i++)
|
|
1929
|
+
s[i] = t[i] * n;
|
|
1930
1930
|
t = s;
|
|
1931
1931
|
}
|
|
1932
1932
|
return t;
|
|
1933
1933
|
}
|
|
1934
1934
|
_createCubicSplineTrackInterpolant(e) {
|
|
1935
|
-
e.createInterpolant = function(
|
|
1936
|
-
const s = this instanceof ye ?
|
|
1937
|
-
return new s(this.times, this.values, this.getValueSize() / 3,
|
|
1935
|
+
e.createInterpolant = function(n) {
|
|
1936
|
+
const s = this instanceof ye ? As : We;
|
|
1937
|
+
return new s(this.times, this.values, this.getValueSize() / 3, n);
|
|
1938
1938
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1944
|
-
const a = t.json.accessors[
|
|
1941
|
+
function bs(o, e, t) {
|
|
1942
|
+
const n = e.attributes, s = new Ut();
|
|
1943
|
+
if (n.POSITION !== void 0) {
|
|
1944
|
+
const a = t.json.accessors[n.POSITION], c = a.min, l = a.max;
|
|
1945
1945
|
if (c !== void 0 && l !== void 0) {
|
|
1946
1946
|
if (s.set(
|
|
1947
1947
|
new F(c[0], c[1], c[2]),
|
|
1948
1948
|
new F(l[0], l[1], l[2])
|
|
1949
1949
|
), a.normalized) {
|
|
1950
|
-
const
|
|
1951
|
-
s.min.multiplyScalar(
|
|
1950
|
+
const h = me(H[a.componentType]);
|
|
1951
|
+
s.min.multiplyScalar(h), s.max.multiplyScalar(h);
|
|
1952
1952
|
}
|
|
1953
1953
|
} else {
|
|
1954
1954
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1959,13 +1959,13 @@ function Ls(o, e, t) {
|
|
|
1959
1959
|
const i = e.targets;
|
|
1960
1960
|
if (i !== void 0) {
|
|
1961
1961
|
const a = new F(), c = new F();
|
|
1962
|
-
for (let l = 0,
|
|
1962
|
+
for (let l = 0, h = i.length; l < h; l++) {
|
|
1963
1963
|
const u = i[l];
|
|
1964
1964
|
if (u.POSITION !== void 0) {
|
|
1965
|
-
const
|
|
1965
|
+
const d = t.json.accessors[u.POSITION], f = d.min, p = d.max;
|
|
1966
1966
|
if (f !== void 0 && p !== void 0) {
|
|
1967
|
-
if (c.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))),
|
|
1968
|
-
const A = me(H[
|
|
1967
|
+
if (c.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), d.normalized) {
|
|
1968
|
+
const A = me(H[d.componentType]);
|
|
1969
1969
|
c.multiplyScalar(A);
|
|
1970
1970
|
}
|
|
1971
1971
|
a.max(c);
|
|
@@ -1976,39 +1976,40 @@ function Ls(o, e, t) {
|
|
|
1976
1976
|
s.expandByVector(a);
|
|
1977
1977
|
}
|
|
1978
1978
|
o.boundingBox = s;
|
|
1979
|
-
const
|
|
1980
|
-
s.getCenter(
|
|
1979
|
+
const r = new Gt();
|
|
1980
|
+
s.getCenter(r.center), r.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = r;
|
|
1981
1981
|
}
|
|
1982
1982
|
function Ce(o, e, t) {
|
|
1983
|
-
const
|
|
1984
|
-
function i(
|
|
1985
|
-
return t.getDependency("accessor",
|
|
1983
|
+
const n = e.attributes, s = [];
|
|
1984
|
+
function i(r, a) {
|
|
1985
|
+
return t.getDependency("accessor", r).then(function(c) {
|
|
1986
1986
|
o.setAttribute(a, c);
|
|
1987
1987
|
});
|
|
1988
1988
|
}
|
|
1989
|
-
for (const
|
|
1990
|
-
const a = pe[
|
|
1991
|
-
a in o.attributes || s.push(i(r
|
|
1989
|
+
for (const r in n) {
|
|
1990
|
+
const a = pe[r] || r.toLowerCase();
|
|
1991
|
+
a in o.attributes || s.push(i(n[r], a));
|
|
1992
1992
|
}
|
|
1993
1993
|
if (e.indices !== void 0 && !o.index) {
|
|
1994
|
-
const
|
|
1994
|
+
const r = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1995
1995
|
o.setIndex(a);
|
|
1996
1996
|
});
|
|
1997
|
-
s.push(
|
|
1997
|
+
s.push(r);
|
|
1998
1998
|
}
|
|
1999
|
-
return
|
|
2000
|
-
return e.targets !== void 0 ?
|
|
1999
|
+
return he.workingColorSpace !== S && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${he.workingColorSpace}" not supported.`), C(o, e), bs(o, e, t), Promise.all(s).then(function() {
|
|
2000
|
+
return e.targets !== void 0 ? Rs(o, e.targets, t) : o;
|
|
2001
2001
|
});
|
|
2002
2002
|
}
|
|
2003
|
-
var
|
|
2004
|
-
for (var s =
|
|
2005
|
-
(
|
|
2006
|
-
return
|
|
2003
|
+
var Ss = Object.defineProperty, vs = Object.getOwnPropertyDescriptor, Cs = (o, e, t, n) => {
|
|
2004
|
+
for (var s = n > 1 ? void 0 : n ? vs(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2005
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2006
|
+
return n && s && Ss(e, t, s), s;
|
|
2007
2007
|
};
|
|
2008
2008
|
let Q = class {
|
|
2009
2009
|
constructor() {
|
|
2010
2010
|
_(this, "workerPool", Ye(void 0, !0));
|
|
2011
2011
|
_(this, "canvas");
|
|
2012
|
+
_(this, "offscreenCanvas");
|
|
2012
2013
|
_(this, "worker");
|
|
2013
2014
|
_(this, "thread");
|
|
2014
2015
|
}
|
|
@@ -2016,14 +2017,14 @@ let Q = class {
|
|
|
2016
2017
|
this.worker = o.worker, this.thread = o.thread;
|
|
2017
2018
|
}
|
|
2018
2019
|
};
|
|
2019
|
-
Q =
|
|
2020
|
+
Q = Cs([
|
|
2020
2021
|
z()
|
|
2021
2022
|
], Q);
|
|
2022
|
-
var
|
|
2023
|
-
for (var s =
|
|
2024
|
-
(
|
|
2025
|
-
return
|
|
2026
|
-
},
|
|
2023
|
+
var Ms = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, Os = (o, e, t, n) => {
|
|
2024
|
+
for (var s = n > 1 ? void 0 : n ? Is(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2025
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2026
|
+
return n && s && Ms(e, t, s), s;
|
|
2027
|
+
}, Ns = (o, e) => (t, n) => e(t, n, o);
|
|
2027
2028
|
let ge = class extends Qe {
|
|
2028
2029
|
constructor(e) {
|
|
2029
2030
|
super();
|
|
@@ -2033,17 +2034,17 @@ let ge = class extends Qe {
|
|
|
2033
2034
|
init(e) {
|
|
2034
2035
|
this.canvas = e;
|
|
2035
2036
|
for (const t of Me) {
|
|
2036
|
-
const
|
|
2037
|
+
const n = t.startsWith("mouse") || t.startsWith("pointer") || t.startsWith("touch") ? this.mouseEventHandler : t.startsWith("key") ? this.keyEventHandler : t === "resize" ? this.uiEventHandler : t === "wheel" ? this.wheelEventHandler : this.preventDefaultHandler;
|
|
2037
2038
|
this[`${t}$`] = Je(
|
|
2038
2039
|
t === "resize" ? window : e,
|
|
2039
2040
|
t
|
|
2040
2041
|
).pipe(
|
|
2041
2042
|
// @ts-ignore
|
|
2042
|
-
$(
|
|
2043
|
+
$(n.bind(this)),
|
|
2043
2044
|
Ie((s) => !(t === "keydown" && !s))
|
|
2044
2045
|
), this[`${t}$`].subscribe((s) => {
|
|
2045
|
-
var i,
|
|
2046
|
-
(
|
|
2046
|
+
var i, r;
|
|
2047
|
+
(r = (i = this._service.thread) == null ? void 0 : i[t]) == null || r.call(i, s);
|
|
2047
2048
|
});
|
|
2048
2049
|
}
|
|
2049
2050
|
}
|
|
@@ -2086,7 +2087,7 @@ let ge = class extends Qe {
|
|
|
2086
2087
|
};
|
|
2087
2088
|
}
|
|
2088
2089
|
touchEventHandler(e) {
|
|
2089
|
-
const t = [],
|
|
2090
|
+
const t = [], n = { type: e.type, touches: t };
|
|
2090
2091
|
for (let s = 0; s < e.touches.length; ++s) {
|
|
2091
2092
|
const i = e.touches[s];
|
|
2092
2093
|
t.push({
|
|
@@ -2094,7 +2095,7 @@ let ge = class extends Qe {
|
|
|
2094
2095
|
pageY: (i == null ? void 0 : i.pageY) ?? 0
|
|
2095
2096
|
});
|
|
2096
2097
|
}
|
|
2097
|
-
return { ...this.getScreenSizes(), ...
|
|
2098
|
+
return { ...this.getScreenSizes(), ...n };
|
|
2098
2099
|
}
|
|
2099
2100
|
wheelEventHandler(e) {
|
|
2100
2101
|
return e.preventDefault(), {
|
|
@@ -2110,18 +2111,18 @@ let ge = class extends Qe {
|
|
|
2110
2111
|
};
|
|
2111
2112
|
}
|
|
2112
2113
|
};
|
|
2113
|
-
ge =
|
|
2114
|
+
ge = Os([
|
|
2114
2115
|
z(),
|
|
2115
|
-
|
|
2116
|
+
Ns(0, L(Q))
|
|
2116
2117
|
], ge);
|
|
2117
|
-
var
|
|
2118
|
-
for (var s =
|
|
2119
|
-
(
|
|
2120
|
-
return
|
|
2118
|
+
var Ps = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, ks = (o, e, t, n) => {
|
|
2119
|
+
for (var s = n > 1 ? void 0 : n ? Ds(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2120
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2121
|
+
return n && s && Ps(e, t, s), s;
|
|
2121
2122
|
};
|
|
2122
2123
|
let J = class {
|
|
2123
2124
|
constructor() {
|
|
2124
|
-
_(this, "loadingManager", new
|
|
2125
|
+
_(this, "loadingManager", new jt());
|
|
2125
2126
|
_(this, "loaders", {});
|
|
2126
2127
|
_(this, "sources", []);
|
|
2127
2128
|
_(this, "loadedResources", {});
|
|
@@ -2134,15 +2135,15 @@ let J = class {
|
|
|
2134
2135
|
load: (o, e) => {
|
|
2135
2136
|
const t = document.createElement("video");
|
|
2136
2137
|
t.muted = !0, t.loop = !0, t.crossOrigin = "anonymous", t.controls = !1, t.playsInline = !0, t.src = o, t.autoplay = !0;
|
|
2137
|
-
const
|
|
2138
|
-
e(t), t.removeEventListener("canplaythrough",
|
|
2138
|
+
const n = async () => {
|
|
2139
|
+
e(t), t.removeEventListener("canplaythrough", n);
|
|
2139
2140
|
};
|
|
2140
|
-
t.addEventListener("canplaythrough",
|
|
2141
|
+
t.addEventListener("canplaythrough", n);
|
|
2141
2142
|
}
|
|
2142
2143
|
};
|
|
2143
2144
|
}
|
|
2144
2145
|
_initLoaders() {
|
|
2145
|
-
this.loaders.dracoLoader = new
|
|
2146
|
+
this.loaders.dracoLoader = new Vt(this.loadingManager), this.loaders.audioLoader = new Kt(this.loadingManager), this.loaders.fontLoader = new et(this.loadingManager), this.loaders.gltfLoader = new Xt(this.loadingManager), this.loaders.imageLoader = new Be(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
|
|
2146
2147
|
}
|
|
2147
2148
|
_initSources(o) {
|
|
2148
2149
|
this.sources = o, this.toLoadCount = this.sources.length, this.loadedCount = 0;
|
|
@@ -2160,44 +2161,49 @@ let J = class {
|
|
|
2160
2161
|
source: o,
|
|
2161
2162
|
resource: e,
|
|
2162
2163
|
toLoadCount: t,
|
|
2163
|
-
loadedCount:
|
|
2164
|
+
loadedCount: n
|
|
2164
2165
|
}) {
|
|
2165
|
-
e && (this.loadedResources[o.name] = e, this.loadedCount =
|
|
2166
|
+
e && (this.loadedResources[o.name] = e, this.loadedCount = n, this.toLoadCount = t);
|
|
2166
2167
|
}
|
|
2167
2168
|
load(o) {
|
|
2168
|
-
var t,
|
|
2169
|
+
var t, n, s, i, r;
|
|
2169
2170
|
const e = this.sources[0];
|
|
2170
2171
|
if (e) {
|
|
2171
2172
|
o == null || o(e);
|
|
2172
|
-
for (const
|
|
2173
|
-
if (this.loadedResources[
|
|
2173
|
+
for (const a of this.sources) {
|
|
2174
|
+
if (this.loadedResources[a.name] || typeof a.path != "string")
|
|
2174
2175
|
return;
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
(
|
|
2178
|
-
)),
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2176
|
+
a.type === "gltf" && ((t = this.loaders.gltfLoader) == null || t.load(
|
|
2177
|
+
a.path,
|
|
2178
|
+
(c) => o == null ? void 0 : o(a, c)
|
|
2179
|
+
)), a.type === "audio" && ((n = this.loaders.audioLoader) == null || n.load(
|
|
2180
|
+
a.path,
|
|
2181
|
+
(c) => o == null ? void 0 : o(a, c)
|
|
2182
|
+
)), a.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(
|
|
2183
|
+
a.path,
|
|
2184
|
+
(c) => o == null ? void 0 : o(a, c)
|
|
2185
|
+
)), a.type === "video" && ((i = this.loaders.videoLoader) == null || i.load(
|
|
2186
|
+
a.path,
|
|
2187
|
+
(c) => o == null ? void 0 : o(a, c)
|
|
2188
|
+
)), a.type === "font" && ((r = this.loaders.fontLoader) == null || r.load(
|
|
2189
|
+
a.path,
|
|
2190
|
+
(c) => o == null ? void 0 : o(a, c)
|
|
2185
2191
|
));
|
|
2186
2192
|
}
|
|
2187
2193
|
}
|
|
2188
2194
|
}
|
|
2189
2195
|
};
|
|
2190
|
-
J =
|
|
2196
|
+
J = ks([
|
|
2191
2197
|
z()
|
|
2192
2198
|
], J);
|
|
2193
|
-
var
|
|
2194
|
-
for (var s =
|
|
2195
|
-
(
|
|
2196
|
-
return
|
|
2197
|
-
},
|
|
2199
|
+
var Fs = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, Us = (o, e, t, n) => {
|
|
2200
|
+
for (var s = n > 1 ? void 0 : n ? Hs(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2201
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2202
|
+
return n && s && Fs(e, t, s), s;
|
|
2203
|
+
}, Gs = (o, e) => (t, n) => e(t, n, o);
|
|
2198
2204
|
let Z = class {
|
|
2199
2205
|
constructor(o) {
|
|
2200
|
-
_(this, "load$$", new
|
|
2206
|
+
_(this, "load$$", new tt());
|
|
2201
2207
|
_(this, "load$", this.load$$.pipe(
|
|
2202
2208
|
$((o) => ({
|
|
2203
2209
|
...o,
|
|
@@ -2208,10 +2214,10 @@ let Z = class {
|
|
|
2208
2214
|
));
|
|
2209
2215
|
_(this, "serializedLoad$", this.load$.pipe(
|
|
2210
2216
|
$((o) => {
|
|
2211
|
-
var t,
|
|
2217
|
+
var t, n, s;
|
|
2212
2218
|
let e = o.resource;
|
|
2213
2219
|
if ((t = o == null ? void 0 : o.resource) != null && t.parser) {
|
|
2214
|
-
const i = o.resource,
|
|
2220
|
+
const i = o.resource, r = i.scenes.map(
|
|
2215
2221
|
(a) => _e(a)
|
|
2216
2222
|
);
|
|
2217
2223
|
e = {
|
|
@@ -2223,12 +2229,12 @@ let Z = class {
|
|
|
2223
2229
|
(a) => _e(a)
|
|
2224
2230
|
),
|
|
2225
2231
|
parser: { json: i.parser.json },
|
|
2226
|
-
scene:
|
|
2227
|
-
scenes:
|
|
2232
|
+
scene: r == null ? void 0 : r[0],
|
|
2233
|
+
scenes: r,
|
|
2228
2234
|
userData: i.userData
|
|
2229
2235
|
};
|
|
2230
2236
|
}
|
|
2231
|
-
return ((
|
|
2237
|
+
return ((n = o == null ? void 0 : o.source) == null ? void 0 : n.type) === "audio" && o.resource instanceof AudioBuffer && (e = {
|
|
2232
2238
|
arrayBuffer: o.resource.getChannelData(0),
|
|
2233
2239
|
length: o.resource.length,
|
|
2234
2240
|
sampleRate: o.resource.sampleRate,
|
|
@@ -2293,15 +2299,15 @@ let Z = class {
|
|
|
2293
2299
|
this._service = o;
|
|
2294
2300
|
}
|
|
2295
2301
|
};
|
|
2296
|
-
Z =
|
|
2302
|
+
Z = Us([
|
|
2297
2303
|
z(),
|
|
2298
|
-
|
|
2304
|
+
Gs(0, L(J))
|
|
2299
2305
|
], Z);
|
|
2300
|
-
var
|
|
2301
|
-
for (var s =
|
|
2302
|
-
(
|
|
2303
|
-
return
|
|
2304
|
-
}, le = (o, e) => (t,
|
|
2306
|
+
var Bs = Object.defineProperty, js = Object.getOwnPropertyDescriptor, Ks = (o, e, t, n) => {
|
|
2307
|
+
for (var s = n > 1 ? void 0 : n ? js(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2308
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2309
|
+
return n && s && Bs(e, t, s), s;
|
|
2310
|
+
}, le = (o, e) => (t, n) => e(t, n, o);
|
|
2305
2311
|
let ee = class {
|
|
2306
2312
|
constructor(o, e, t) {
|
|
2307
2313
|
_(this, "_subscriptions", []);
|
|
@@ -2351,23 +2357,23 @@ let ee = class {
|
|
|
2351
2357
|
this._controller.load$$.complete();
|
|
2352
2358
|
}
|
|
2353
2359
|
};
|
|
2354
|
-
ee =
|
|
2360
|
+
ee = Ks([
|
|
2355
2361
|
z(),
|
|
2356
2362
|
le(0, L(Z)),
|
|
2357
2363
|
le(1, L(J)),
|
|
2358
2364
|
le(2, L(Te))
|
|
2359
2365
|
], ee);
|
|
2360
2366
|
Ne.resolve(ee);
|
|
2361
|
-
var
|
|
2362
|
-
for (var s =
|
|
2363
|
-
(
|
|
2364
|
-
return
|
|
2365
|
-
}, k = (o, e) => (t,
|
|
2366
|
-
let Ae = class extends
|
|
2367
|
-
constructor(e, t,
|
|
2367
|
+
var Vs = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, Xs = (o, e, t, n) => {
|
|
2368
|
+
for (var s = n > 1 ? void 0 : n ? zs(e, t) : e, i = o.length - 1, r; i >= 0; i--)
|
|
2369
|
+
(r = o[i]) && (s = (n ? r(e, t, s) : r(s)) || s);
|
|
2370
|
+
return n && s && Vs(e, t, s), s;
|
|
2371
|
+
}, k = (o, e) => (t, n) => e(t, n, o);
|
|
2372
|
+
let Ae = class extends rt {
|
|
2373
|
+
constructor(e, t, n, s, i, r) {
|
|
2368
2374
|
super();
|
|
2369
2375
|
_(this, "initialized", !1);
|
|
2370
|
-
this._service = e, this._controller = t, this._loaderController =
|
|
2376
|
+
this._service = e, this._controller = t, this._loaderController = n, this.props = s, this.loader = i, this.container = r, this.props.initOnConstruct && this.init();
|
|
2371
2377
|
}
|
|
2372
2378
|
async _initCanvas() {
|
|
2373
2379
|
try {
|
|
@@ -2394,15 +2400,16 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2394
2400
|
if (!this._service.canvas)
|
|
2395
2401
|
throw new Error("Canvas element is not initialized.");
|
|
2396
2402
|
this._controller.init(this._service.canvas), !(!this._service.thread || !this._service.worker) && this.props.fullScreen && ((t = (e = this._service.thread) == null ? void 0 : e.resize) == null || t.call(e, {
|
|
2397
|
-
...this._controller.uiEventHandler({
|
|
2403
|
+
...this._controller.uiEventHandler({
|
|
2404
|
+
type: "resize"
|
|
2405
|
+
})
|
|
2398
2406
|
}));
|
|
2399
2407
|
}
|
|
2400
2408
|
async _initWorkerThread() {
|
|
2401
2409
|
if (!this._service.canvas)
|
|
2402
2410
|
throw new Error("Canvas element is not initialized.");
|
|
2403
|
-
|
|
2404
|
-
e
|
|
2405
|
-
const [t, r] = await this._service.workerPool.run({
|
|
2411
|
+
this._service.offscreenCanvas = this._service.canvas.transferControlToOffscreen(), this._service.offscreenCanvas.width = this._service.canvas.clientWidth, this._service.offscreenCanvas.height = this._service.canvas.clientHeight;
|
|
2412
|
+
const [e, t] = await this._service.workerPool.run({
|
|
2406
2413
|
payload: {
|
|
2407
2414
|
path: this.props.location,
|
|
2408
2415
|
subject: {
|
|
@@ -2412,14 +2419,14 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2412
2419
|
"onReady",
|
|
2413
2420
|
"loaderDataSources"
|
|
2414
2421
|
]),
|
|
2415
|
-
canvas:
|
|
2422
|
+
canvas: this._service.offscreenCanvas
|
|
2416
2423
|
},
|
|
2417
|
-
transferSubject: [
|
|
2424
|
+
transferSubject: [this._service.offscreenCanvas]
|
|
2418
2425
|
}
|
|
2419
2426
|
});
|
|
2420
|
-
if (!
|
|
2427
|
+
if (!e || t)
|
|
2421
2428
|
throw new Error("Unable to retrieve the worker-thread info.");
|
|
2422
|
-
this._service.worker =
|
|
2429
|
+
this._service.worker = e.worker, this._service.thread = e.thread;
|
|
2423
2430
|
}
|
|
2424
2431
|
async _initObservableProxyEvents() {
|
|
2425
2432
|
Me.forEach(
|
|
@@ -2431,43 +2438,46 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2431
2438
|
}
|
|
2432
2439
|
async _initLoader() {
|
|
2433
2440
|
this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe((e) => {
|
|
2434
|
-
var t,
|
|
2441
|
+
var t, n;
|
|
2435
2442
|
if (e.resource instanceof ArrayBuffer)
|
|
2436
2443
|
return (t = this._service.worker) == null ? void 0 : t.postMessage(e.resource, [
|
|
2437
2444
|
e.resource
|
|
2438
2445
|
]);
|
|
2439
|
-
(
|
|
2440
|
-
token:
|
|
2446
|
+
(n = this._service.worker) == null || n.postMessage({
|
|
2447
|
+
token: it,
|
|
2441
2448
|
payload: e
|
|
2442
2449
|
});
|
|
2443
2450
|
});
|
|
2444
2451
|
}
|
|
2445
|
-
isInitialized() {
|
|
2446
|
-
return this.initialized;
|
|
2447
|
-
}
|
|
2448
2452
|
async init() {
|
|
2449
2453
|
var e, t;
|
|
2450
2454
|
this.initialized || (await this._initCanvas(), await this._initWorkerThread(), await this._initService(), await this._initController(), await this._initObservableProxyEvents(), await this._initLoader(), (t = (e = this.props).onReady) == null || t.call(e, { module: this, container: this.container }));
|
|
2451
2455
|
}
|
|
2452
|
-
|
|
2456
|
+
getCanvas() {
|
|
2453
2457
|
return this._service.canvas;
|
|
2454
2458
|
}
|
|
2455
|
-
|
|
2459
|
+
getOffscreenCanvas() {
|
|
2460
|
+
return this._service.offscreenCanvas;
|
|
2461
|
+
}
|
|
2462
|
+
getThread() {
|
|
2456
2463
|
return this._service.thread;
|
|
2457
2464
|
}
|
|
2458
|
-
|
|
2465
|
+
getWorker() {
|
|
2459
2466
|
return this._service.worker;
|
|
2460
2467
|
}
|
|
2461
|
-
|
|
2468
|
+
getWorkerPool() {
|
|
2462
2469
|
return this._service.workerPool;
|
|
2463
2470
|
}
|
|
2471
|
+
isInitialized() {
|
|
2472
|
+
return this.initialized;
|
|
2473
|
+
}
|
|
2464
2474
|
async dispose() {
|
|
2465
|
-
var e;
|
|
2466
|
-
await this._service.workerPool.terminateAll(), ((e = this._service.
|
|
2475
|
+
var e, t, n;
|
|
2476
|
+
await this._service.workerPool.terminateAll(), (t = (e = this._service.offscreenCanvas) == null ? void 0 : e.getContext("2d")) == null || t.closePath(), ((n = this._service.canvas) == null ? void 0 : n.dataset.reactive) === "true" && (document.body.removeChild(this._service.canvas), this._service.canvas.remove(), this._service.canvas = void 0), this.initialized = !1;
|
|
2467
2477
|
}
|
|
2468
2478
|
};
|
|
2469
|
-
Ae =
|
|
2470
|
-
|
|
2479
|
+
Ae = Xs([
|
|
2480
|
+
st(nt.ContainerScoped),
|
|
2471
2481
|
k(0, L(Q)),
|
|
2472
2482
|
k(1, L(ge)),
|
|
2473
2483
|
k(2, L(Z)),
|
|
@@ -2475,13 +2485,13 @@ Ae = zs([
|
|
|
2475
2485
|
k(4, L(ee)),
|
|
2476
2486
|
k(5, L(Pe))
|
|
2477
2487
|
], Ae);
|
|
2478
|
-
const
|
|
2488
|
+
const Qs = (o) => {
|
|
2479
2489
|
if (typeof (o == null ? void 0 : o.location) != "string" && !((o == null ? void 0 : o.location) instanceof URL))
|
|
2480
2490
|
throw new Error(
|
|
2481
2491
|
"Invalid register props detected. location path is required"
|
|
2482
2492
|
);
|
|
2483
2493
|
const e = Ne.createChildContainer();
|
|
2484
|
-
o.initOnConstruct = X(o.initOnConstruct) || !W(o.initOnConstruct) ? !0 : o.initOnConstruct, o.defaultCamera = o != null && o.defaultCamera && o.defaultCamera in Re ? o.defaultCamera : Re.PERSPECTIVE, o.withMiniCamera = X(o.withMiniCamera) || !W(o.withMiniCamera) ? !1 : o.withMiniCamera, o.startTimer = X(o.startTimer) || !W(o.startTimer) ? !0 : o.startTimer, o.fullScreen = X(o.fullScreen) || !W(o.fullScreen) ? !0 : o.fullScreen, o.onReady =
|
|
2494
|
+
o.initOnConstruct = X(o.initOnConstruct) || !W(o.initOnConstruct) ? !0 : o.initOnConstruct, o.defaultCamera = o != null && o.defaultCamera && o.defaultCamera in Re ? o.defaultCamera : Re.PERSPECTIVE, o.withMiniCamera = X(o.withMiniCamera) || !W(o.withMiniCamera) ? !1 : o.withMiniCamera, o.startTimer = X(o.startTimer) || !W(o.startTimer) ? !0 : o.startTimer, o.fullScreen = X(o.fullScreen) || !W(o.fullScreen) ? !0 : o.fullScreen, o.onReady = ot(o.onReady) ? o.onReady : void 0, e.register(Pe, { useValue: e }), e.register(Te, { useValue: o });
|
|
2485
2495
|
const t = e.resolve(Ae);
|
|
2486
2496
|
return t.initialized = !0, {
|
|
2487
2497
|
container: e,
|
|
@@ -2489,19 +2499,19 @@ const Ys = (o) => {
|
|
|
2489
2499
|
};
|
|
2490
2500
|
};
|
|
2491
2501
|
export {
|
|
2492
|
-
|
|
2493
|
-
|
|
2502
|
+
en as AppModule,
|
|
2503
|
+
tn as AppProxyEventHandlersBlueprint,
|
|
2494
2504
|
Pe as CONTAINER_TOKEN,
|
|
2495
2505
|
Re as DefaultCameraType,
|
|
2496
2506
|
Ze as KEYBOARD_EVENT_CODES,
|
|
2497
|
-
|
|
2498
|
-
|
|
2507
|
+
it as LOADER_SERIALIZED_LOAD_TOKEN,
|
|
2508
|
+
Ys as LaunchAppProps,
|
|
2499
2509
|
Me as PROXY_EVENT_LISTENERS,
|
|
2500
2510
|
Qe as ProxyEventHandlersBlueprint,
|
|
2501
|
-
|
|
2502
|
-
|
|
2511
|
+
sn as ProxyEventObservablesBlueprint,
|
|
2512
|
+
nn as ProxyEventSubjectsBlueprint,
|
|
2503
2513
|
Ae as RegisterModule,
|
|
2504
2514
|
Te as RegisterPropsBlueprint,
|
|
2505
|
-
|
|
2506
|
-
|
|
2515
|
+
rt as RegisterProxyEventHandlersBlueprint,
|
|
2516
|
+
Qs as register
|
|
2507
2517
|
};
|