@quick-threejs/reactive 0.1.30 → 0.1.31
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-DRE0SP1g.js → app.module-BaIoj4QA.js} +7 -7
- package/dist/{app.module-BHCAJZLN.mjs → app.module-BbeIDure.mjs} +631 -621
- package/dist/common/interfaces/loader.interface.d.ts +4 -2
- package/dist/core/app/loader/loader.controller.d.ts +6 -1
- package/dist/core/app/loader/loader.module.d.ts +3 -1
- package/dist/core/register/loader/loader.controller.d.ts +1 -1
- package/dist/core/register/loader/loader.module.d.ts +1 -1
- package/dist/main.js +3 -3
- package/dist/main.mjs +775 -744
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +1 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _ = (o, e, t) =>
|
|
4
|
-
import { s as
|
|
5
|
-
import { k as Zs, o as en, n as tn, l as sn } from "./app.module-
|
|
6
|
-
import { TrianglesDrawMode as ot, TriangleFanDrawMode as
|
|
7
|
-
class
|
|
1
|
+
var $e = Object.defineProperty;
|
|
2
|
+
var qe = (o, e, t) => e in o ? $e(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
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, S as et, c as se, W as _e, U as Oe, d as Ne, e as tt, L as st, R as nt, g as rt, h as Pe, A as X, D as W, j as Re, Q as it } from "./app.module-BbeIDure.mjs";
|
|
5
|
+
import { k as Zs, o as en, n as tn, l as sn } from "./app.module-BbeIDure.mjs";
|
|
6
|
+
import { TrianglesDrawMode as ot, 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 de, LoaderUtils as V, SpotLight as at, PointLight as ct, DirectionalLight as lt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as He, Matrix4 as Y, Vector3 as F, Quaternion as Ue, InstancedMesh as ut, InstancedBufferAttribute as dt, Object3D as Ge, TextureLoader as ht, ImageBitmapLoader as Be, InterleavedBuffer as ft, InterleavedBufferAttribute as pt, LinearFilter as he, LinearMipmapLinearFilter as je, RepeatWrapping as fe, NearestFilter as Ke, PointsMaterial as mt, Material as ne, LineBasicMaterial as gt, MeshStandardMaterial as Ve, DoubleSide as At, PropertyBinding as Tt, SkinnedMesh as _t, Mesh as Rt, LineSegments as Et, Line as wt, LineLoop as xt, Points as yt, Group as re, PerspectiveCamera as Lt, MathUtils as bt, OrthographicCamera as St, Skeleton as vt, AnimationClip as Ct, Bone as Mt, InterpolateLinear as ze, NearestMipmapNearestFilter as It, LinearMipmapNearestFilter as Ot, NearestMipmapLinearFilter as Nt, ClampToEdgeWrapping as Pt, MirroredRepeatWrapping as Dt, InterpolateDiscrete as kt, FrontSide as Ft, Texture as Ee, VectorKeyframeTrack as we, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as ye, Box3 as Ht, Sphere as Ut, Interpolant as Gt, LoadingManager as Bt, AudioLoader as jt } from "three";
|
|
7
|
+
class Te {
|
|
8
8
|
constructor() {
|
|
9
9
|
/**
|
|
10
10
|
* @description The app worker logic location.
|
|
@@ -125,35 +125,35 @@ class qs {
|
|
|
125
125
|
_(this, "onReady");
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Le(o, e) {
|
|
129
129
|
if (e === ot)
|
|
130
130
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
|
|
131
|
-
if (e ===
|
|
131
|
+
if (e === ue || e === De) {
|
|
132
132
|
let t = o.getIndex();
|
|
133
133
|
if (t === null) {
|
|
134
|
-
const n = [],
|
|
135
|
-
if (
|
|
136
|
-
for (let
|
|
137
|
-
n.push(
|
|
134
|
+
const n = [], a = o.getAttribute("position");
|
|
135
|
+
if (a !== void 0) {
|
|
136
|
+
for (let c = 0; c < a.count; c++)
|
|
137
|
+
n.push(c);
|
|
138
138
|
o.setIndex(n), 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
|
|
143
|
-
if (e ===
|
|
144
|
-
for (let n = 1; n <=
|
|
142
|
+
const r = t.count - 2, s = [];
|
|
143
|
+
if (e === ue)
|
|
144
|
+
for (let n = 1; n <= r; n++)
|
|
145
145
|
s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
|
|
146
146
|
else
|
|
147
|
-
for (let n = 0; n <
|
|
147
|
+
for (let n = 0; n < r; n++)
|
|
148
148
|
n % 2 === 0 ? (s.push(t.getX(n)), s.push(t.getX(n + 1)), s.push(t.getX(n + 2))) : (s.push(t.getX(n + 2)), s.push(t.getX(n + 1)), s.push(t.getX(n)));
|
|
149
|
-
s.length / 3 !==
|
|
150
|
-
const
|
|
151
|
-
return
|
|
149
|
+
s.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
150
|
+
const i = o.clone();
|
|
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
|
-
const
|
|
156
|
-
class Kt extends
|
|
155
|
+
const ie = /* @__PURE__ */ new WeakMap();
|
|
156
|
+
class Kt 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,67 +176,67 @@ class Kt extends Pe {
|
|
|
176
176
|
setWorkerLimit(e) {
|
|
177
177
|
return this.workerLimit = e, this;
|
|
178
178
|
}
|
|
179
|
-
load(e, t,
|
|
180
|
-
const
|
|
181
|
-
|
|
179
|
+
load(e, t, r, s) {
|
|
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, (n) => {
|
|
182
182
|
this.parse(n, t, s);
|
|
183
|
-
},
|
|
183
|
+
}, r, s);
|
|
184
184
|
}
|
|
185
|
-
parse(e, t,
|
|
185
|
+
parse(e, t, r = () => {
|
|
186
186
|
}) {
|
|
187
|
-
this.decodeDracoFile(e, t, null, null, N,
|
|
187
|
+
this.decodeDracoFile(e, t, null, null, N, r).catch(r);
|
|
188
188
|
}
|
|
189
|
-
decodeDracoFile(e, t,
|
|
189
|
+
decodeDracoFile(e, t, r, s, i = S, n = () => {
|
|
190
190
|
}) {
|
|
191
|
-
const
|
|
192
|
-
attributeIDs:
|
|
191
|
+
const a = {
|
|
192
|
+
attributeIDs: r || this.defaultAttributeIDs,
|
|
193
193
|
attributeTypes: s || this.defaultAttributeTypes,
|
|
194
|
-
useUniqueIDs: !!
|
|
195
|
-
vertexColorSpace:
|
|
194
|
+
useUniqueIDs: !!r,
|
|
195
|
+
vertexColorSpace: i
|
|
196
196
|
};
|
|
197
|
-
return this.decodeGeometry(e,
|
|
197
|
+
return this.decodeGeometry(e, a).then(t).catch(n);
|
|
198
198
|
}
|
|
199
199
|
decodeGeometry(e, t) {
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
return
|
|
200
|
+
const r = JSON.stringify(t);
|
|
201
|
+
if (ie.has(e)) {
|
|
202
|
+
const c = ie.get(e);
|
|
203
|
+
if (c.key === r)
|
|
204
|
+
return c.promise;
|
|
205
205
|
if (e.byteLength === 0)
|
|
206
206
|
throw new Error(
|
|
207
207
|
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
let s;
|
|
211
|
-
const
|
|
212
|
-
s._callbacks[
|
|
213
|
-
}))).then((
|
|
214
|
-
return
|
|
215
|
-
s &&
|
|
216
|
-
}),
|
|
217
|
-
key:
|
|
218
|
-
promise:
|
|
219
|
-
}),
|
|
211
|
+
const i = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(i, n).then((c) => (s = c, new Promise((l, d) => {
|
|
212
|
+
s._callbacks[i] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
213
|
+
}))).then((c) => this._createGeometry(c.geometry));
|
|
214
|
+
return a.catch(() => !0).then(() => {
|
|
215
|
+
s && i && this._releaseTask(s, i);
|
|
216
|
+
}), ie.set(e, {
|
|
217
|
+
key: r,
|
|
218
|
+
promise: a
|
|
219
|
+
}), a;
|
|
220
220
|
}
|
|
221
221
|
_createGeometry(e) {
|
|
222
|
-
const t = new
|
|
223
|
-
e.index && t.setIndex(new
|
|
224
|
-
for (let
|
|
225
|
-
const s = e.attributes[
|
|
226
|
-
|
|
222
|
+
const t = new Fe();
|
|
223
|
+
e.index && t.setIndex(new K(e.index.array, 1));
|
|
224
|
+
for (let r = 0; r < e.attributes.length; r++) {
|
|
225
|
+
const s = e.attributes[r], i = s.name, n = s.array, a = s.itemSize, c = new K(n, a);
|
|
226
|
+
i === "color" && (this._assignVertexColorSpace(c, s.vertexColorSpace), c.normalized = !(n 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
|
|
233
|
-
for (let s = 0,
|
|
234
|
-
|
|
232
|
+
const r = new P();
|
|
233
|
+
for (let s = 0, i = e.count; s < i; s++)
|
|
234
|
+
r.fromBufferAttribute(e, s), de.toWorkingColorSpace(r, N), e.setXYZ(s, r.r, r.g, r.b);
|
|
235
235
|
}
|
|
236
236
|
_loadLibrary(e, t) {
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
|
|
237
|
+
const r = new q(this.manager);
|
|
238
|
+
return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((s, i) => {
|
|
239
|
+
r.load(e, s, void 0, i);
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
preload() {
|
|
@@ -245,15 +245,15 @@ class Kt extends Pe {
|
|
|
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
|
|
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((r) => {
|
|
249
|
+
const s = r[0];
|
|
250
|
+
e || (this.decoderConfig.wasmBinary = r[1]);
|
|
251
|
+
const i = Vt.toString(), n = [
|
|
252
252
|
"/* draco decoder */",
|
|
253
253
|
s,
|
|
254
254
|
"",
|
|
255
255
|
"/* worker */",
|
|
256
|
-
|
|
256
|
+
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
257
257
|
].join(`
|
|
258
258
|
`);
|
|
259
259
|
this.workerSourceURL = URL.createObjectURL(new Blob([n]));
|
|
@@ -263,8 +263,8 @@ class Kt extends Pe {
|
|
|
263
263
|
return this._initDecoder().then(() => {
|
|
264
264
|
if (this.workerPool.length < this.workerLimit) {
|
|
265
265
|
const s = new Worker(this.workerSourceURL);
|
|
266
|
-
s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(
|
|
267
|
-
const n =
|
|
266
|
+
s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(i) {
|
|
267
|
+
const n = i.data;
|
|
268
268
|
switch (n.type) {
|
|
269
269
|
case "decode":
|
|
270
270
|
s._callbacks[n.id].resolve(n);
|
|
@@ -277,11 +277,11 @@ class Kt extends Pe {
|
|
|
277
277
|
}
|
|
278
278
|
}, this.workerPool.push(s);
|
|
279
279
|
} else
|
|
280
|
-
this.workerPool.sort(function(s,
|
|
281
|
-
return s._taskLoad >
|
|
280
|
+
this.workerPool.sort(function(s, i) {
|
|
281
|
+
return s._taskLoad > i._taskLoad ? -1 : 1;
|
|
282
282
|
});
|
|
283
|
-
const
|
|
284
|
-
return
|
|
283
|
+
const r = this.workerPool[this.workerPool.length - 1];
|
|
284
|
+
return r._taskCosts[e] = t, r._taskLoad += t, r;
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
_releaseTask(e, t) {
|
|
@@ -299,24 +299,24 @@ class Kt extends Pe {
|
|
|
299
299
|
function Vt() {
|
|
300
300
|
let o, e;
|
|
301
301
|
onmessage = function(n) {
|
|
302
|
-
const
|
|
303
|
-
switch (
|
|
302
|
+
const a = n.data;
|
|
303
|
+
switch (a.type) {
|
|
304
304
|
case "init":
|
|
305
|
-
o =
|
|
305
|
+
o = a.decoderConfig, e = new Promise(function(d) {
|
|
306
306
|
o.onModuleLoaded = function(u) {
|
|
307
307
|
d({ draco: u });
|
|
308
308
|
}, DracoDecoderModule(o);
|
|
309
309
|
});
|
|
310
310
|
break;
|
|
311
311
|
case "decode":
|
|
312
|
-
const
|
|
312
|
+
const c = a.buffer, l = a.taskConfig;
|
|
313
313
|
e.then((d) => {
|
|
314
314
|
const u = d.draco, h = new u.Decoder();
|
|
315
315
|
try {
|
|
316
|
-
const f = t(u, h, new Int8Array(
|
|
317
|
-
f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id:
|
|
316
|
+
const f = t(u, h, new Int8Array(c), l), p = f.attributes.map((A) => A.array.buffer);
|
|
317
|
+
f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
|
|
318
318
|
} catch (f) {
|
|
319
|
-
console.error(f), self.postMessage({ type: "error", id:
|
|
319
|
+
console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
|
|
320
320
|
} finally {
|
|
321
321
|
u.destroy(h);
|
|
322
322
|
}
|
|
@@ -324,14 +324,14 @@ function Vt() {
|
|
|
324
324
|
break;
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
function t(n,
|
|
327
|
+
function t(n, a, c, l) {
|
|
328
328
|
const d = l.attributeIDs, u = l.attributeTypes;
|
|
329
329
|
let h, f;
|
|
330
|
-
const p =
|
|
330
|
+
const p = a.GetEncodedGeometryType(c);
|
|
331
331
|
if (p === n.TRIANGULAR_MESH)
|
|
332
|
-
h = new n.Mesh(), f =
|
|
332
|
+
h = new n.Mesh(), f = a.DecodeArrayToMesh(c, c.byteLength, h);
|
|
333
333
|
else if (p === n.POINT_CLOUD)
|
|
334
|
-
h = new n.PointCloud(), f =
|
|
334
|
+
h = new n.PointCloud(), f = a.DecodeArrayToPointCloud(c, c.byteLength, h);
|
|
335
335
|
else
|
|
336
336
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
337
337
|
if (!f.ok() || h.ptr === 0)
|
|
@@ -341,25 +341,25 @@ function Vt() {
|
|
|
341
341
|
const g = self[u[m]];
|
|
342
342
|
let R, w;
|
|
343
343
|
if (l.useUniqueIDs)
|
|
344
|
-
w = d[m], R =
|
|
344
|
+
w = d[m], R = a.GetAttributeByUniqueId(h, w);
|
|
345
345
|
else {
|
|
346
|
-
if (w =
|
|
347
|
-
R =
|
|
346
|
+
if (w = a.GetAttributeId(h, n[d[m]]), w === -1) continue;
|
|
347
|
+
R = a.GetAttribute(h, w);
|
|
348
348
|
}
|
|
349
|
-
const E = s(n,
|
|
349
|
+
const E = s(n, a, h, m, g, R);
|
|
350
350
|
m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
|
|
351
351
|
}
|
|
352
|
-
return p === n.TRIANGULAR_MESH && (A.index =
|
|
352
|
+
return p === n.TRIANGULAR_MESH && (A.index = r(n, a, h)), n.destroy(h), A;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
const d =
|
|
356
|
-
|
|
354
|
+
function r(n, a, c) {
|
|
355
|
+
const d = c.num_faces() * 3, u = d * 4, h = n._malloc(u);
|
|
356
|
+
a.GetTrianglesUInt32Array(c, u, h);
|
|
357
357
|
const f = new Uint32Array(n.HEAPF32.buffer, h, d).slice();
|
|
358
358
|
return n._free(h), { array: f, itemSize: 1 };
|
|
359
359
|
}
|
|
360
|
-
function s(n,
|
|
361
|
-
const h = u.num_components(), p =
|
|
362
|
-
|
|
360
|
+
function s(n, a, c, l, d, u) {
|
|
361
|
+
const h = u.num_components(), p = c.num_points() * h, A = p * d.BYTES_PER_ELEMENT, m = i(n, d), g = n._malloc(A);
|
|
362
|
+
a.GetAttributeDataArrayForAllPoints(c, u, m, A, g);
|
|
363
363
|
const R = new d(n.HEAPF32.buffer, g, p).slice();
|
|
364
364
|
return n._free(g), {
|
|
365
365
|
name: l,
|
|
@@ -367,8 +367,8 @@ function Vt() {
|
|
|
367
367
|
itemSize: h
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
switch (
|
|
370
|
+
function i(n, a) {
|
|
371
|
+
switch (a) {
|
|
372
372
|
case Float32Array:
|
|
373
373
|
return n.DT_FLOAT32;
|
|
374
374
|
case Int8Array:
|
|
@@ -386,7 +386,7 @@ function Vt() {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
class zt extends
|
|
389
|
+
class zt 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
392
|
return new Yt(t);
|
|
@@ -424,29 +424,29 @@ class zt extends Pe {
|
|
|
424
424
|
return new us(t);
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
load(e, t,
|
|
428
|
-
const
|
|
427
|
+
load(e, t, r, s) {
|
|
428
|
+
const i = this;
|
|
429
429
|
let n;
|
|
430
430
|
if (this.resourcePath !== "")
|
|
431
431
|
n = this.resourcePath;
|
|
432
432
|
else if (this.path !== "") {
|
|
433
|
-
const l =
|
|
434
|
-
n =
|
|
433
|
+
const l = V.extractUrlBase(e);
|
|
434
|
+
n = V.resolveURL(l, this.path);
|
|
435
435
|
} else
|
|
436
|
-
n =
|
|
436
|
+
n = V.extractUrlBase(e);
|
|
437
437
|
this.manager.itemStart(e);
|
|
438
|
-
const
|
|
439
|
-
s ? s(l) : console.error(l),
|
|
440
|
-
},
|
|
441
|
-
|
|
438
|
+
const a = function(l) {
|
|
439
|
+
s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
440
|
+
}, c = new q(this.manager);
|
|
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
|
-
|
|
444
|
-
t(d),
|
|
445
|
-
},
|
|
443
|
+
i.parse(l, n, function(d) {
|
|
444
|
+
t(d), i.manager.itemEnd(e);
|
|
445
|
+
}, a);
|
|
446
446
|
} catch (d) {
|
|
447
|
-
|
|
447
|
+
a(d);
|
|
448
448
|
}
|
|
449
|
-
},
|
|
449
|
+
}, r, a);
|
|
450
450
|
}
|
|
451
451
|
setDRACOLoader(e) {
|
|
452
452
|
return this.dracoLoader = e, this;
|
|
@@ -463,29 +463,29 @@ class zt extends Pe {
|
|
|
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,
|
|
467
|
-
let
|
|
468
|
-
const n = {},
|
|
466
|
+
parse(e, t, r, s) {
|
|
467
|
+
let i;
|
|
468
|
+
const n = {}, a = {}, c = new TextDecoder();
|
|
469
469
|
if (typeof e == "string")
|
|
470
|
-
|
|
470
|
+
i = JSON.parse(e);
|
|
471
471
|
else if (e instanceof ArrayBuffer)
|
|
472
|
-
if (
|
|
472
|
+
if (c.decode(new Uint8Array(e, 0, 4)) === Xe) {
|
|
473
473
|
try {
|
|
474
474
|
n[T.KHR_BINARY_GLTF] = new ds(e);
|
|
475
475
|
} catch (u) {
|
|
476
476
|
s && s(u);
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
|
-
|
|
479
|
+
i = JSON.parse(n[T.KHR_BINARY_GLTF].content);
|
|
480
480
|
} else
|
|
481
|
-
|
|
481
|
+
i = JSON.parse(c.decode(e));
|
|
482
482
|
else
|
|
483
|
-
|
|
484
|
-
if (
|
|
483
|
+
i = e;
|
|
484
|
+
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
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 ys(
|
|
488
|
+
const l = new ys(i, {
|
|
489
489
|
path: t || this.resourcePath || "",
|
|
490
490
|
crossOrigin: this.crossOrigin,
|
|
491
491
|
requestHeader: this.requestHeader,
|
|
@@ -496,17 +496,17 @@ class zt extends Pe {
|
|
|
496
496
|
l.fileLoader.setRequestHeader(this.requestHeader);
|
|
497
497
|
for (let d = 0; d < this.pluginCallbacks.length; d++) {
|
|
498
498
|
const u = this.pluginCallbacks[d](l);
|
|
499
|
-
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),
|
|
499
|
+
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, n[u.name] = !0;
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
502
|
-
for (let d = 0; d <
|
|
503
|
-
const u =
|
|
501
|
+
if (i.extensionsUsed)
|
|
502
|
+
for (let d = 0; d < i.extensionsUsed.length; ++d) {
|
|
503
|
+
const u = i.extensionsUsed[d], h = i.extensionsRequired || [];
|
|
504
504
|
switch (u) {
|
|
505
505
|
case T.KHR_MATERIALS_UNLIT:
|
|
506
506
|
n[u] = new $t();
|
|
507
507
|
break;
|
|
508
508
|
case T.KHR_DRACO_MESH_COMPRESSION:
|
|
509
|
-
n[u] = new hs(
|
|
509
|
+
n[u] = new hs(i, this.dracoLoader);
|
|
510
510
|
break;
|
|
511
511
|
case T.KHR_TEXTURE_TRANSFORM:
|
|
512
512
|
n[u] = new fs();
|
|
@@ -515,15 +515,15 @@ class zt extends Pe {
|
|
|
515
515
|
n[u] = new ps();
|
|
516
516
|
break;
|
|
517
517
|
default:
|
|
518
|
-
h.indexOf(u) >= 0 &&
|
|
518
|
+
h.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
l.setExtensions(n), l.setPlugins(
|
|
521
|
+
l.setExtensions(n), l.setPlugins(a), l.parse(r, s);
|
|
522
522
|
}
|
|
523
523
|
parseAsync(e, t) {
|
|
524
|
-
const
|
|
525
|
-
return new Promise(function(s,
|
|
526
|
-
|
|
524
|
+
const r = this;
|
|
525
|
+
return new Promise(function(s, i) {
|
|
526
|
+
r.parse(e, t, s, i);
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
}
|
|
@@ -574,21 +574,21 @@ class Wt {
|
|
|
574
574
|
}
|
|
575
575
|
_markDefs() {
|
|
576
576
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
577
|
-
for (let
|
|
578
|
-
const
|
|
579
|
-
|
|
577
|
+
for (let r = 0, s = t.length; r < s; r++) {
|
|
578
|
+
const i = t[r];
|
|
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, r = "light:" + e;
|
|
584
|
+
let s = t.cache.get(r);
|
|
585
585
|
if (s) return s;
|
|
586
|
-
const
|
|
586
|
+
const i = t.json, c = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
587
587
|
let l;
|
|
588
588
|
const d = new P(16777215);
|
|
589
|
-
|
|
590
|
-
const u =
|
|
591
|
-
switch (
|
|
589
|
+
c.color !== void 0 && d.setRGB(c.color[0], c.color[1], c.color[2], S);
|
|
590
|
+
const u = c.range !== void 0 ? c.range : 0;
|
|
591
|
+
switch (c.type) {
|
|
592
592
|
case "directional":
|
|
593
593
|
l = new lt(d), l.target.position.set(0, 0, -1), l.add(l.target);
|
|
594
594
|
break;
|
|
@@ -596,21 +596,21 @@ class Wt {
|
|
|
596
596
|
l = new ct(d), l.distance = u;
|
|
597
597
|
break;
|
|
598
598
|
case "spot":
|
|
599
|
-
l = new at(d), l.distance = u,
|
|
599
|
+
l = new at(d), 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
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " +
|
|
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,
|
|
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(r, 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,
|
|
612
|
-
return
|
|
613
|
-
return
|
|
611
|
+
const t = this, r = this.parser, i = r.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
612
|
+
return a === void 0 ? null : this._loadLight(a).then(function(c) {
|
|
613
|
+
return r._getNodeRef(t.cache, a, c);
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
616
|
}
|
|
@@ -621,16 +621,16 @@ class $t {
|
|
|
621
621
|
getMaterialType() {
|
|
622
622
|
return B;
|
|
623
623
|
}
|
|
624
|
-
extendParams(e, t,
|
|
624
|
+
extendParams(e, t, r) {
|
|
625
625
|
const s = [];
|
|
626
626
|
e.color = new P(1, 1, 1), e.opacity = 1;
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
629
|
-
if (Array.isArray(
|
|
630
|
-
const n =
|
|
627
|
+
const i = t.pbrMetallicRoughness;
|
|
628
|
+
if (i) {
|
|
629
|
+
if (Array.isArray(i.baseColorFactor)) {
|
|
630
|
+
const n = i.baseColorFactor;
|
|
631
631
|
e.color.setRGB(n[0], n[1], n[2], S), e.opacity = n[3];
|
|
632
632
|
}
|
|
633
|
-
|
|
633
|
+
i.baseColorTexture !== void 0 && s.push(r.assignTexture(e, "map", i.baseColorTexture, N));
|
|
634
634
|
}
|
|
635
635
|
return Promise.all(s);
|
|
636
636
|
}
|
|
@@ -643,8 +643,8 @@ class qt {
|
|
|
643
643
|
const s = this.parser.json.materials[e];
|
|
644
644
|
if (!s.extensions || !s.extensions[this.name])
|
|
645
645
|
return Promise.resolve();
|
|
646
|
-
const
|
|
647
|
-
return
|
|
646
|
+
const i = s.extensions[this.name].emissiveStrength;
|
|
647
|
+
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
class Yt {
|
|
@@ -652,19 +652,19 @@ class Yt {
|
|
|
652
652
|
this.parser = e, this.name = T.KHR_MATERIALS_CLEARCOAT;
|
|
653
653
|
}
|
|
654
654
|
getMaterialType(e) {
|
|
655
|
-
const
|
|
656
|
-
return !
|
|
655
|
+
const r = this.parser.json.materials[e];
|
|
656
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
657
657
|
}
|
|
658
658
|
extendMaterialParams(e, t) {
|
|
659
|
-
const
|
|
659
|
+
const r = this.parser, s = r.json.materials[e];
|
|
660
660
|
if (!s.extensions || !s.extensions[this.name])
|
|
661
661
|
return Promise.resolve();
|
|
662
|
-
const
|
|
663
|
-
if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 &&
|
|
664
|
-
const
|
|
665
|
-
t.clearcoatNormalScale = new
|
|
662
|
+
const i = [], n = s.extensions[this.name];
|
|
663
|
+
if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (i.push(r.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
|
|
664
|
+
const a = n.clearcoatNormalTexture.scale;
|
|
665
|
+
t.clearcoatNormalScale = new He(a, a);
|
|
666
666
|
}
|
|
667
|
-
return Promise.all(
|
|
667
|
+
return Promise.all(i);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
class Qt {
|
|
@@ -672,15 +672,15 @@ class Qt {
|
|
|
672
672
|
this.parser = e, this.name = T.KHR_MATERIALS_DISPERSION;
|
|
673
673
|
}
|
|
674
674
|
getMaterialType(e) {
|
|
675
|
-
const
|
|
676
|
-
return !
|
|
675
|
+
const r = this.parser.json.materials[e];
|
|
676
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
677
677
|
}
|
|
678
678
|
extendMaterialParams(e, t) {
|
|
679
679
|
const s = this.parser.json.materials[e];
|
|
680
680
|
if (!s.extensions || !s.extensions[this.name])
|
|
681
681
|
return Promise.resolve();
|
|
682
|
-
const
|
|
683
|
-
return t.dispersion =
|
|
682
|
+
const i = s.extensions[this.name];
|
|
683
|
+
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
class Jt {
|
|
@@ -688,15 +688,15 @@ class Jt {
|
|
|
688
688
|
this.parser = e, this.name = T.KHR_MATERIALS_IRIDESCENCE;
|
|
689
689
|
}
|
|
690
690
|
getMaterialType(e) {
|
|
691
|
-
const
|
|
692
|
-
return !
|
|
691
|
+
const r = this.parser.json.materials[e];
|
|
692
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
693
693
|
}
|
|
694
694
|
extendMaterialParams(e, t) {
|
|
695
|
-
const
|
|
695
|
+
const r = this.parser, s = r.json.materials[e];
|
|
696
696
|
if (!s.extensions || !s.extensions[this.name])
|
|
697
697
|
return Promise.resolve();
|
|
698
|
-
const
|
|
699
|
-
return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 &&
|
|
698
|
+
const i = [], n = s.extensions[this.name];
|
|
699
|
+
return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceMap", n.iridescenceTexture)), n.iridescenceIor !== void 0 && (t.iridescenceIOR = n.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), n.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = n.iridescenceThicknessMinimum), n.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = n.iridescenceThicknessMaximum), n.iridescenceThicknessTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(i);
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
class Zt {
|
|
@@ -704,21 +704,21 @@ class Zt {
|
|
|
704
704
|
this.parser = e, this.name = T.KHR_MATERIALS_SHEEN;
|
|
705
705
|
}
|
|
706
706
|
getMaterialType(e) {
|
|
707
|
-
const
|
|
708
|
-
return !
|
|
707
|
+
const r = this.parser.json.materials[e];
|
|
708
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
709
709
|
}
|
|
710
710
|
extendMaterialParams(e, t) {
|
|
711
|
-
const
|
|
711
|
+
const r = this.parser, s = r.json.materials[e];
|
|
712
712
|
if (!s.extensions || !s.extensions[this.name])
|
|
713
713
|
return Promise.resolve();
|
|
714
|
-
const
|
|
714
|
+
const i = [];
|
|
715
715
|
t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
716
716
|
const n = s.extensions[this.name];
|
|
717
717
|
if (n.sheenColorFactor !== void 0) {
|
|
718
|
-
const
|
|
719
|
-
t.sheenColor.setRGB(
|
|
718
|
+
const a = n.sheenColorFactor;
|
|
719
|
+
t.sheenColor.setRGB(a[0], a[1], a[2], S);
|
|
720
720
|
}
|
|
721
|
-
return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 &&
|
|
721
|
+
return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && i.push(r.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(i);
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
class es {
|
|
@@ -726,15 +726,15 @@ class es {
|
|
|
726
726
|
this.parser = e, this.name = T.KHR_MATERIALS_TRANSMISSION;
|
|
727
727
|
}
|
|
728
728
|
getMaterialType(e) {
|
|
729
|
-
const
|
|
730
|
-
return !
|
|
729
|
+
const r = this.parser.json.materials[e];
|
|
730
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
731
731
|
}
|
|
732
732
|
extendMaterialParams(e, t) {
|
|
733
|
-
const
|
|
733
|
+
const r = this.parser, s = r.json.materials[e];
|
|
734
734
|
if (!s.extensions || !s.extensions[this.name])
|
|
735
735
|
return Promise.resolve();
|
|
736
|
-
const
|
|
737
|
-
return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 &&
|
|
736
|
+
const i = [], n = s.extensions[this.name];
|
|
737
|
+
return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && i.push(r.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(i);
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
class ts {
|
|
@@ -742,17 +742,17 @@ class ts {
|
|
|
742
742
|
this.parser = e, this.name = T.KHR_MATERIALS_VOLUME;
|
|
743
743
|
}
|
|
744
744
|
getMaterialType(e) {
|
|
745
|
-
const
|
|
746
|
-
return !
|
|
745
|
+
const r = this.parser.json.materials[e];
|
|
746
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
747
747
|
}
|
|
748
748
|
extendMaterialParams(e, t) {
|
|
749
|
-
const
|
|
749
|
+
const r = this.parser, s = r.json.materials[e];
|
|
750
750
|
if (!s.extensions || !s.extensions[this.name])
|
|
751
751
|
return Promise.resolve();
|
|
752
|
-
const
|
|
753
|
-
t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 &&
|
|
754
|
-
const
|
|
755
|
-
return t.attenuationColor = new P().setRGB(
|
|
752
|
+
const i = [], n = s.extensions[this.name];
|
|
753
|
+
t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && i.push(r.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
|
|
754
|
+
const a = n.attenuationColor || [1, 1, 1];
|
|
755
|
+
return t.attenuationColor = new P().setRGB(a[0], a[1], a[2], S), Promise.all(i);
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
class ss {
|
|
@@ -760,15 +760,15 @@ class ss {
|
|
|
760
760
|
this.parser = e, this.name = T.KHR_MATERIALS_IOR;
|
|
761
761
|
}
|
|
762
762
|
getMaterialType(e) {
|
|
763
|
-
const
|
|
764
|
-
return !
|
|
763
|
+
const r = this.parser.json.materials[e];
|
|
764
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
765
765
|
}
|
|
766
766
|
extendMaterialParams(e, t) {
|
|
767
767
|
const s = this.parser.json.materials[e];
|
|
768
768
|
if (!s.extensions || !s.extensions[this.name])
|
|
769
769
|
return Promise.resolve();
|
|
770
|
-
const
|
|
771
|
-
return t.ior =
|
|
770
|
+
const i = s.extensions[this.name];
|
|
771
|
+
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
class ns {
|
|
@@ -776,17 +776,17 @@ class ns {
|
|
|
776
776
|
this.parser = e, this.name = T.KHR_MATERIALS_SPECULAR;
|
|
777
777
|
}
|
|
778
778
|
getMaterialType(e) {
|
|
779
|
-
const
|
|
780
|
-
return !
|
|
779
|
+
const r = this.parser.json.materials[e];
|
|
780
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
781
781
|
}
|
|
782
782
|
extendMaterialParams(e, t) {
|
|
783
|
-
const
|
|
783
|
+
const r = this.parser, s = r.json.materials[e];
|
|
784
784
|
if (!s.extensions || !s.extensions[this.name])
|
|
785
785
|
return Promise.resolve();
|
|
786
|
-
const
|
|
787
|
-
t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 &&
|
|
788
|
-
const
|
|
789
|
-
return t.specularColor = new P().setRGB(
|
|
786
|
+
const i = [], n = s.extensions[this.name];
|
|
787
|
+
t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && i.push(r.assignTexture(t, "specularIntensityMap", n.specularTexture));
|
|
788
|
+
const a = n.specularColorFactor || [1, 1, 1];
|
|
789
|
+
return t.specularColor = new P().setRGB(a[0], a[1], a[2], S), n.specularColorTexture !== void 0 && i.push(r.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(i);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
class rs {
|
|
@@ -794,15 +794,15 @@ class rs {
|
|
|
794
794
|
this.parser = e, this.name = T.EXT_MATERIALS_BUMP;
|
|
795
795
|
}
|
|
796
796
|
getMaterialType(e) {
|
|
797
|
-
const
|
|
798
|
-
return !
|
|
797
|
+
const r = this.parser.json.materials[e];
|
|
798
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
799
799
|
}
|
|
800
800
|
extendMaterialParams(e, t) {
|
|
801
|
-
const
|
|
801
|
+
const r = this.parser, s = r.json.materials[e];
|
|
802
802
|
if (!s.extensions || !s.extensions[this.name])
|
|
803
803
|
return Promise.resolve();
|
|
804
|
-
const
|
|
805
|
-
return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 &&
|
|
804
|
+
const i = [], n = s.extensions[this.name];
|
|
805
|
+
return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && i.push(r.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(i);
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
808
|
class is {
|
|
@@ -810,15 +810,15 @@ class is {
|
|
|
810
810
|
this.parser = e, this.name = T.KHR_MATERIALS_ANISOTROPY;
|
|
811
811
|
}
|
|
812
812
|
getMaterialType(e) {
|
|
813
|
-
const
|
|
814
|
-
return !
|
|
813
|
+
const r = this.parser.json.materials[e];
|
|
814
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
815
815
|
}
|
|
816
816
|
extendMaterialParams(e, t) {
|
|
817
|
-
const
|
|
817
|
+
const r = this.parser, s = r.json.materials[e];
|
|
818
818
|
if (!s.extensions || !s.extensions[this.name])
|
|
819
819
|
return Promise.resolve();
|
|
820
|
-
const
|
|
821
|
-
return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 &&
|
|
820
|
+
const i = [], n = s.extensions[this.name];
|
|
821
|
+
return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && i.push(r.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(i);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
class os {
|
|
@@ -826,16 +826,16 @@ class os {
|
|
|
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, r = t.json, s = r.textures[e];
|
|
830
830
|
if (!s.extensions || !s.extensions[this.name])
|
|
831
831
|
return null;
|
|
832
|
-
const
|
|
832
|
+
const i = s.extensions[this.name], n = t.options.ktx2Loader;
|
|
833
833
|
if (!n) {
|
|
834
|
-
if (
|
|
834
|
+
if (r.extensionsRequired && r.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,
|
|
838
|
+
return t.loadTextureImage(e, i.source, n);
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
class as {
|
|
@@ -843,20 +843,20 @@ class as {
|
|
|
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,
|
|
847
|
-
if (!
|
|
846
|
+
const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
|
|
847
|
+
if (!i.extensions || !i.extensions[t])
|
|
848
848
|
return null;
|
|
849
|
-
const n =
|
|
850
|
-
let
|
|
851
|
-
if (
|
|
852
|
-
const l =
|
|
853
|
-
l !== null && (
|
|
849
|
+
const n = i.extensions[t], a = s.images[n.source];
|
|
850
|
+
let c = r.textureLoader;
|
|
851
|
+
if (a.uri) {
|
|
852
|
+
const l = r.options.manager.getHandler(a.uri);
|
|
853
|
+
l !== null && (c = l);
|
|
854
854
|
}
|
|
855
855
|
return this.detectSupport().then(function(l) {
|
|
856
|
-
if (l) return
|
|
856
|
+
if (l) return r.loadTextureImage(e, n.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 r.loadTexture(e);
|
|
860
860
|
});
|
|
861
861
|
}
|
|
862
862
|
detectSupport() {
|
|
@@ -873,20 +873,20 @@ class cs {
|
|
|
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,
|
|
877
|
-
if (!
|
|
876
|
+
const t = this.name, r = this.parser, s = r.json, i = s.textures[e];
|
|
877
|
+
if (!i.extensions || !i.extensions[t])
|
|
878
878
|
return null;
|
|
879
|
-
const n =
|
|
880
|
-
let
|
|
881
|
-
if (
|
|
882
|
-
const l =
|
|
883
|
-
l !== null && (
|
|
879
|
+
const n = i.extensions[t], a = s.images[n.source];
|
|
880
|
+
let c = r.textureLoader;
|
|
881
|
+
if (a.uri) {
|
|
882
|
+
const l = r.options.manager.getHandler(a.uri);
|
|
883
|
+
l !== null && (c = l);
|
|
884
884
|
}
|
|
885
885
|
return this.detectSupport().then(function(l) {
|
|
886
|
-
if (l) return
|
|
886
|
+
if (l) return r.loadTextureImage(e, n.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 r.loadTexture(e);
|
|
890
890
|
});
|
|
891
891
|
}
|
|
892
892
|
detectSupport() {
|
|
@@ -903,16 +903,16 @@ class ls {
|
|
|
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 =
|
|
906
|
+
const t = this.parser.json, r = t.bufferViews[e];
|
|
907
|
+
if (r.extensions && r.extensions[this.name]) {
|
|
908
|
+
const s = r.extensions[this.name], i = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
|
|
909
909
|
if (!n || !n.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
|
-
return
|
|
915
|
-
const
|
|
914
|
+
return i.then(function(a) {
|
|
915
|
+
const c = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(a, c, l);
|
|
916
916
|
return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(d, u, h, s.mode, s.filter).then(function(f) {
|
|
917
917
|
return f.buffer;
|
|
918
918
|
}) : n.ready.then(function() {
|
|
@@ -929,60 +929,60 @@ class us {
|
|
|
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, r = t.nodes[e];
|
|
933
|
+
if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
|
|
934
934
|
return null;
|
|
935
|
-
const s = t.meshes[
|
|
935
|
+
const s = t.meshes[r.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 n =
|
|
939
|
+
const n = r.extensions[this.name].attributes, a = [], c = {};
|
|
940
940
|
for (const l in n)
|
|
941
|
-
|
|
942
|
-
return
|
|
941
|
+
a.push(this.parser.getDependency("accessor", n[l]).then((d) => (c[l] = d, c[l])));
|
|
942
|
+
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
|
|
943
943
|
const d = l.pop(), u = d.isGroup ? d.children : [d], h = l[0].count, f = [];
|
|
944
944
|
for (const p of u) {
|
|
945
|
-
const A = new
|
|
945
|
+
const A = new Y(), m = new F(), g = new Ue(), R = new F(1, 1, 1), w = new ut(p.geometry, p.material, h);
|
|
946
946
|
for (let E = 0; E < h; E++)
|
|
947
|
-
|
|
948
|
-
for (const E in
|
|
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
|
+
for (const E in c)
|
|
949
949
|
if (E === "_COLOR_0") {
|
|
950
|
-
const b =
|
|
950
|
+
const b = c[E];
|
|
951
951
|
w.instanceColor = new dt(b.array, b.itemSize, b.normalized);
|
|
952
|
-
} else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E,
|
|
953
|
-
|
|
952
|
+
} else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E, c[E]);
|
|
953
|
+
Ge.prototype.copy.call(w, p), this.parser.assignFinalMaterial(w), f.push(w);
|
|
954
954
|
}
|
|
955
955
|
return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
|
|
956
956
|
}));
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
const
|
|
959
|
+
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), r = new TextDecoder();
|
|
964
964
|
if (this.header = {
|
|
965
|
-
magic:
|
|
965
|
+
magic: r.decode(new Uint8Array(e.slice(0, 4))),
|
|
966
966
|
version: t.getUint32(4, !0),
|
|
967
967
|
length: t.getUint32(8, !0)
|
|
968
|
-
}, this.header.magic !==
|
|
968
|
+
}, this.header.magic !== Xe)
|
|
969
969
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
970
970
|
if (this.header.version < 2)
|
|
971
971
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
972
|
-
const s = this.header.length - G,
|
|
972
|
+
const s = this.header.length - G, i = new DataView(e, G);
|
|
973
973
|
let n = 0;
|
|
974
974
|
for (; n < s; ) {
|
|
975
|
-
const
|
|
975
|
+
const a = i.getUint32(n, !0);
|
|
976
976
|
n += 4;
|
|
977
|
-
const
|
|
978
|
-
if (n += 4,
|
|
979
|
-
const l = new Uint8Array(e, G + n,
|
|
980
|
-
this.content =
|
|
981
|
-
} else if (
|
|
977
|
+
const c = i.getUint32(n, !0);
|
|
978
|
+
if (n += 4, c === be.JSON) {
|
|
979
|
+
const l = new Uint8Array(e, G + n, a);
|
|
980
|
+
this.content = r.decode(l);
|
|
981
|
+
} else if (c === be.BIN) {
|
|
982
982
|
const l = G + n;
|
|
983
|
-
this.body = e.slice(l, l +
|
|
983
|
+
this.body = e.slice(l, l + a);
|
|
984
984
|
}
|
|
985
|
-
n +=
|
|
985
|
+
n += a;
|
|
986
986
|
}
|
|
987
987
|
if (this.content === null)
|
|
988
988
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
@@ -995,27 +995,27 @@ class hs {
|
|
|
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
|
|
998
|
+
const r = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
|
|
999
999
|
for (const d in n) {
|
|
1000
|
-
const u =
|
|
1001
|
-
|
|
1000
|
+
const u = pe[d] || d.toLowerCase();
|
|
1001
|
+
a[u] = n[d];
|
|
1002
1002
|
}
|
|
1003
1003
|
for (const d in e.attributes) {
|
|
1004
|
-
const u =
|
|
1004
|
+
const u = pe[d] || d.toLowerCase();
|
|
1005
1005
|
if (n[d] !== void 0) {
|
|
1006
|
-
const h =
|
|
1007
|
-
l[u] = f.name,
|
|
1006
|
+
const h = r.accessors[e.attributes[d]], f = H[h.componentType];
|
|
1007
|
+
l[u] = f.name, c[u] = h.normalized === !0;
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
return t.getDependency("bufferView",
|
|
1010
|
+
return t.getDependency("bufferView", i).then(function(d) {
|
|
1011
1011
|
return new Promise(function(u, h) {
|
|
1012
1012
|
s.decodeDracoFile(d, function(f) {
|
|
1013
1013
|
for (const p in f.attributes) {
|
|
1014
|
-
const A = f.attributes[p], m =
|
|
1014
|
+
const A = f.attributes[p], m = c[p];
|
|
1015
1015
|
m !== void 0 && (A.normalized = m);
|
|
1016
1016
|
}
|
|
1017
1017
|
u(f);
|
|
1018
|
-
},
|
|
1018
|
+
}, a, l, S, h);
|
|
1019
1019
|
});
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
@@ -1033,30 +1033,30 @@ class ps {
|
|
|
1033
1033
|
this.name = T.KHR_MESH_QUANTIZATION;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
class
|
|
1037
|
-
constructor(e, t,
|
|
1038
|
-
super(e, t,
|
|
1036
|
+
class We extends Gt {
|
|
1037
|
+
constructor(e, t, r, s) {
|
|
1038
|
+
super(e, t, r, s);
|
|
1039
1039
|
}
|
|
1040
1040
|
copySampleValue_(e) {
|
|
1041
|
-
const t = this.resultBuffer,
|
|
1041
|
+
const t = this.resultBuffer, r = this.sampleValues, s = this.valueSize, i = e * s * 3 + s;
|
|
1042
1042
|
for (let n = 0; n !== s; n++)
|
|
1043
|
-
t[n] = i
|
|
1043
|
+
t[n] = r[i + n];
|
|
1044
1044
|
return t;
|
|
1045
1045
|
}
|
|
1046
|
-
interpolate_(e, t,
|
|
1047
|
-
const
|
|
1048
|
-
for (let E = 0; E !==
|
|
1049
|
-
const b = n[A + E +
|
|
1050
|
-
|
|
1046
|
+
interpolate_(e, t, r, s) {
|
|
1047
|
+
const i = this.resultBuffer, n = this.sampleValues, a = this.valueSize, c = a * 2, l = a * 3, d = s - t, u = (r - t) / d, h = u * u, f = h * u, p = e * l, A = p - l, m = -2 * f + 3 * h, g = f - h, R = 1 - m, w = g - h + u;
|
|
1048
|
+
for (let E = 0; E !== a; E++) {
|
|
1049
|
+
const b = n[A + E + a], M = n[A + E + c] * d, y = n[p + E + a], U = n[p + E] * d;
|
|
1050
|
+
i[E] = R * b + w * M + m * y + g * U;
|
|
1051
1051
|
}
|
|
1052
|
-
return
|
|
1052
|
+
return i;
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
const ms = new
|
|
1056
|
-
class gs extends
|
|
1057
|
-
interpolate_(e, t,
|
|
1058
|
-
const
|
|
1059
|
-
return ms.fromArray(
|
|
1055
|
+
const ms = new Ue();
|
|
1056
|
+
class gs extends We {
|
|
1057
|
+
interpolate_(e, t, r, s) {
|
|
1058
|
+
const i = super.interpolate_(e, t, r, s);
|
|
1059
|
+
return ms.fromArray(i).normalize().toArray(i), i;
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
1062
1062
|
const x = {
|
|
@@ -1086,18 +1086,18 @@ const x = {
|
|
|
1086
1086
|
5123: Uint16Array,
|
|
1087
1087
|
5125: Uint32Array,
|
|
1088
1088
|
5126: Float32Array
|
|
1089
|
-
},
|
|
1090
|
-
9728:
|
|
1091
|
-
9729:
|
|
1089
|
+
}, Se = {
|
|
1090
|
+
9728: Ke,
|
|
1091
|
+
9729: he,
|
|
1092
1092
|
9984: It,
|
|
1093
1093
|
9985: Ot,
|
|
1094
1094
|
9986: Nt,
|
|
1095
|
-
9987:
|
|
1096
|
-
},
|
|
1095
|
+
9987: je
|
|
1096
|
+
}, ve = {
|
|
1097
1097
|
33071: Pt,
|
|
1098
1098
|
33648: Dt,
|
|
1099
|
-
10497:
|
|
1100
|
-
},
|
|
1099
|
+
10497: fe
|
|
1100
|
+
}, oe = {
|
|
1101
1101
|
SCALAR: 1,
|
|
1102
1102
|
VEC2: 2,
|
|
1103
1103
|
VEC3: 3,
|
|
@@ -1105,7 +1105,7 @@ const x = {
|
|
|
1105
1105
|
MAT2: 4,
|
|
1106
1106
|
MAT3: 9,
|
|
1107
1107
|
MAT4: 16
|
|
1108
|
-
},
|
|
1108
|
+
}, pe = {
|
|
1109
1109
|
POSITION: "position",
|
|
1110
1110
|
NORMAL: "normal",
|
|
1111
1111
|
TANGENT: "tangent",
|
|
@@ -1125,15 +1125,15 @@ const x = {
|
|
|
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
|
-
LINEAR:
|
|
1128
|
+
LINEAR: ze,
|
|
1129
1129
|
STEP: kt
|
|
1130
|
-
},
|
|
1130
|
+
}, ae = {
|
|
1131
1131
|
OPAQUE: "OPAQUE",
|
|
1132
1132
|
MASK: "MASK",
|
|
1133
1133
|
BLEND: "BLEND"
|
|
1134
1134
|
};
|
|
1135
1135
|
function Ts(o) {
|
|
1136
|
-
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new
|
|
1136
|
+
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new Ve({
|
|
1137
1137
|
color: 16777215,
|
|
1138
1138
|
emissive: 0,
|
|
1139
1139
|
metalness: 1,
|
|
@@ -1144,54 +1144,54 @@ function Ts(o) {
|
|
|
1144
1144
|
})), o.DefaultMaterial;
|
|
1145
1145
|
}
|
|
1146
1146
|
function D(o, e, t) {
|
|
1147
|
-
for (const
|
|
1148
|
-
o[
|
|
1147
|
+
for (const r in t.extensions)
|
|
1148
|
+
o[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
|
|
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
1153
|
function _s(o, e, t) {
|
|
1154
|
-
let
|
|
1154
|
+
let r = !1, s = !1, i = !1;
|
|
1155
1155
|
for (let l = 0, d = e.length; l < d; l++) {
|
|
1156
1156
|
const u = e[l];
|
|
1157
|
-
if (u.POSITION !== void 0 && (
|
|
1157
|
+
if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (s = !0), u.COLOR_0 !== void 0 && (i = !0), r && s && i) break;
|
|
1158
1158
|
}
|
|
1159
|
-
if (!
|
|
1160
|
-
const n = [],
|
|
1159
|
+
if (!r && !s && !i) return Promise.resolve(o);
|
|
1160
|
+
const n = [], a = [], c = [];
|
|
1161
1161
|
for (let l = 0, d = e.length; l < d; l++) {
|
|
1162
1162
|
const u = e[l];
|
|
1163
|
-
if (
|
|
1163
|
+
if (r) {
|
|
1164
1164
|
const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : o.attributes.position;
|
|
1165
1165
|
n.push(h);
|
|
1166
1166
|
}
|
|
1167
1167
|
if (s) {
|
|
1168
1168
|
const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : o.attributes.normal;
|
|
1169
|
-
|
|
1169
|
+
a.push(h);
|
|
1170
1170
|
}
|
|
1171
|
-
if (
|
|
1171
|
+
if (i) {
|
|
1172
1172
|
const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : o.attributes.color;
|
|
1173
|
-
|
|
1173
|
+
c.push(h);
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
return Promise.all([
|
|
1177
1177
|
Promise.all(n),
|
|
1178
|
-
Promise.all(
|
|
1179
|
-
Promise.all(
|
|
1178
|
+
Promise.all(a),
|
|
1179
|
+
Promise.all(c)
|
|
1180
1180
|
]).then(function(l) {
|
|
1181
1181
|
const d = l[0], u = l[1], h = l[2];
|
|
1182
|
-
return
|
|
1182
|
+
return r && (o.morphAttributes.position = d), s && (o.morphAttributes.normal = u), i && (o.morphAttributes.color = h), o.morphTargetsRelative = !0, o;
|
|
1183
1183
|
});
|
|
1184
1184
|
}
|
|
1185
1185
|
function Rs(o, e) {
|
|
1186
1186
|
if (o.updateMorphTargets(), e.weights !== void 0)
|
|
1187
|
-
for (let t = 0,
|
|
1187
|
+
for (let t = 0, r = e.weights.length; t < r; 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 r = 0, s = t.length; r < s; r++)
|
|
1194
|
+
o.morphTargetDictionary[t[r]] = r;
|
|
1195
1195
|
} else
|
|
1196
1196
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1197
1197
|
}
|
|
@@ -1199,19 +1199,19 @@ function Rs(o, e) {
|
|
|
1199
1199
|
function Es(o) {
|
|
1200
1200
|
let e;
|
|
1201
1201
|
const t = o.extensions && o.extensions[T.KHR_DRACO_MESH_COMPRESSION];
|
|
1202
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
1203
|
-
for (let
|
|
1204
|
-
e += ":" +
|
|
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 r = 0, s = o.targets.length; r < s; r++)
|
|
1204
|
+
e += ":" + ce(o.targets[r]);
|
|
1205
1205
|
return e;
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
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 r = 0, s = t.length; r < s; r++)
|
|
1211
|
+
e += t[r] + ":" + o[t[r]] + ";";
|
|
1212
1212
|
return e;
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1214
|
+
function me(o) {
|
|
1215
1215
|
switch (o) {
|
|
1216
1216
|
case Int8Array:
|
|
1217
1217
|
return 1 / 127;
|
|
@@ -1228,18 +1228,18 @@ function pe(o) {
|
|
|
1228
1228
|
function ws(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 xs = new
|
|
1231
|
+
const xs = new Y();
|
|
1232
1232
|
class ys {
|
|
1233
1233
|
constructor(e = {}, t = {}) {
|
|
1234
1234
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Xt(), 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
|
|
1235
|
+
let r = !1, s = -1, i = !1, n = -1;
|
|
1236
1236
|
if (typeof navigator < "u") {
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
const
|
|
1240
|
-
s =
|
|
1237
|
+
const a = navigator.userAgent;
|
|
1238
|
+
r = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
1239
|
+
const c = a.match(/Version\/(\d+)/);
|
|
1240
|
+
s = r && c ? parseInt(c[1], 10) : -1, i = a.indexOf("Firefox") > -1, n = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1241
1241
|
}
|
|
1242
|
-
typeof createImageBitmap > "u" ||
|
|
1242
|
+
typeof createImageBitmap > "u" || r && s < 17 || i && n < 98 ? this.textureLoader = new ht(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,33 +1248,33 @@ class ys {
|
|
|
1248
1248
|
this.plugins = e;
|
|
1249
1249
|
}
|
|
1250
1250
|
parse(e, t) {
|
|
1251
|
-
const
|
|
1251
|
+
const r = this, s = this.json, i = this.extensions;
|
|
1252
1252
|
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
|
|
1253
1253
|
return n._markDefs && n._markDefs();
|
|
1254
1254
|
}), Promise.all(this._invokeAll(function(n) {
|
|
1255
1255
|
return n.beforeRoot && n.beforeRoot();
|
|
1256
1256
|
})).then(function() {
|
|
1257
1257
|
return Promise.all([
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1258
|
+
r.getDependencies("scene"),
|
|
1259
|
+
r.getDependencies("animation"),
|
|
1260
|
+
r.getDependencies("camera")
|
|
1261
1261
|
]);
|
|
1262
1262
|
}).then(function(n) {
|
|
1263
|
-
const
|
|
1263
|
+
const a = {
|
|
1264
1264
|
scene: n[0][s.scene || 0],
|
|
1265
1265
|
scenes: n[0],
|
|
1266
1266
|
animations: n[1],
|
|
1267
1267
|
cameras: n[2],
|
|
1268
1268
|
asset: s.asset,
|
|
1269
|
-
parser:
|
|
1269
|
+
parser: r,
|
|
1270
1270
|
userData: {}
|
|
1271
1271
|
};
|
|
1272
|
-
return D(
|
|
1273
|
-
return
|
|
1272
|
+
return D(i, a, s), C(a, s), Promise.all(r._invokeAll(function(c) {
|
|
1273
|
+
return c.afterRoot && c.afterRoot(a);
|
|
1274
1274
|
})).then(function() {
|
|
1275
|
-
for (const
|
|
1276
|
-
|
|
1277
|
-
e(
|
|
1275
|
+
for (const c of a.scenes)
|
|
1276
|
+
c.updateMatrixWorld();
|
|
1277
|
+
e(a);
|
|
1278
1278
|
});
|
|
1279
1279
|
}).catch(t);
|
|
1280
1280
|
}
|
|
@@ -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 || [],
|
|
1286
|
-
for (let s = 0,
|
|
1285
|
+
const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
|
|
1286
|
+
for (let s = 0, i = t.length; s < i; s++) {
|
|
1287
1287
|
const n = t[s].joints;
|
|
1288
|
-
for (let
|
|
1289
|
-
e[n[
|
|
1288
|
+
for (let a = 0, c = n.length; a < c; a++)
|
|
1289
|
+
e[n[a]].isBone = !0;
|
|
1290
1290
|
}
|
|
1291
|
-
for (let s = 0,
|
|
1291
|
+
for (let s = 0, i = e.length; s < i; s++) {
|
|
1292
1292
|
const n = e[s];
|
|
1293
|
-
n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (
|
|
1293
|
+
n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (r[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.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
|
|
1323
|
-
|
|
1319
|
+
_getNodeRef(e, t, r) {
|
|
1320
|
+
if (e.refs[t] <= 1) return r;
|
|
1321
|
+
const s = r.clone(), i = (n, a) => {
|
|
1322
|
+
const c = this.associations.get(n);
|
|
1323
|
+
c != null && this.associations.set(a, c);
|
|
1324
1324
|
for (const [l, d] of n.children.entries())
|
|
1325
|
-
|
|
1325
|
+
i(d, a.children[l]);
|
|
1326
1326
|
};
|
|
1327
|
-
return r
|
|
1327
|
+
return i(r, 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 r = 0; r < t.length; r++) {
|
|
1333
|
+
const s = e(t[r]);
|
|
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 r = [];
|
|
1342
1342
|
for (let s = 0; s < t.length; s++) {
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1343
|
+
const i = e(t[s]);
|
|
1344
|
+
i && r.push(i);
|
|
1345
1345
|
}
|
|
1346
|
-
return
|
|
1346
|
+
return r;
|
|
1347
1347
|
}
|
|
1348
1348
|
/**
|
|
1349
1349
|
* Requests the specified dependency asynchronously, with caching.
|
|
@@ -1352,63 +1352,63 @@ 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 r = e + ":" + t;
|
|
1356
|
+
let s = this.cache.get(r);
|
|
1357
1357
|
if (!s) {
|
|
1358
1358
|
switch (e) {
|
|
1359
1359
|
case "scene":
|
|
1360
1360
|
s = this.loadScene(t);
|
|
1361
1361
|
break;
|
|
1362
1362
|
case "node":
|
|
1363
|
-
s = this._invokeOne(function(
|
|
1364
|
-
return
|
|
1363
|
+
s = this._invokeOne(function(i) {
|
|
1364
|
+
return i.loadNode && i.loadNode(t);
|
|
1365
1365
|
});
|
|
1366
1366
|
break;
|
|
1367
1367
|
case "mesh":
|
|
1368
|
-
s = this._invokeOne(function(
|
|
1369
|
-
return
|
|
1368
|
+
s = this._invokeOne(function(i) {
|
|
1369
|
+
return i.loadMesh && i.loadMesh(t);
|
|
1370
1370
|
});
|
|
1371
1371
|
break;
|
|
1372
1372
|
case "accessor":
|
|
1373
1373
|
s = this.loadAccessor(t);
|
|
1374
1374
|
break;
|
|
1375
1375
|
case "bufferView":
|
|
1376
|
-
s = this._invokeOne(function(
|
|
1377
|
-
return
|
|
1376
|
+
s = this._invokeOne(function(i) {
|
|
1377
|
+
return i.loadBufferView && i.loadBufferView(t);
|
|
1378
1378
|
});
|
|
1379
1379
|
break;
|
|
1380
1380
|
case "buffer":
|
|
1381
1381
|
s = this.loadBuffer(t);
|
|
1382
1382
|
break;
|
|
1383
1383
|
case "material":
|
|
1384
|
-
s = this._invokeOne(function(
|
|
1385
|
-
return
|
|
1384
|
+
s = this._invokeOne(function(i) {
|
|
1385
|
+
return i.loadMaterial && i.loadMaterial(t);
|
|
1386
1386
|
});
|
|
1387
1387
|
break;
|
|
1388
1388
|
case "texture":
|
|
1389
|
-
s = this._invokeOne(function(
|
|
1390
|
-
return
|
|
1389
|
+
s = this._invokeOne(function(i) {
|
|
1390
|
+
return i.loadTexture && i.loadTexture(t);
|
|
1391
1391
|
});
|
|
1392
1392
|
break;
|
|
1393
1393
|
case "skin":
|
|
1394
1394
|
s = this.loadSkin(t);
|
|
1395
1395
|
break;
|
|
1396
1396
|
case "animation":
|
|
1397
|
-
s = this._invokeOne(function(
|
|
1398
|
-
return
|
|
1397
|
+
s = this._invokeOne(function(i) {
|
|
1398
|
+
return i.loadAnimation && i.loadAnimation(t);
|
|
1399
1399
|
});
|
|
1400
1400
|
break;
|
|
1401
1401
|
case "camera":
|
|
1402
1402
|
s = this.loadCamera(t);
|
|
1403
1403
|
break;
|
|
1404
1404
|
default:
|
|
1405
|
-
if (s = this._invokeOne(function(
|
|
1406
|
-
return
|
|
1405
|
+
if (s = this._invokeOne(function(i) {
|
|
1406
|
+
return i != this && i.getDependency && i.getDependency(e, t);
|
|
1407
1407
|
}), !s)
|
|
1408
1408
|
throw new Error("Unknown type: " + e);
|
|
1409
1409
|
break;
|
|
1410
1410
|
}
|
|
1411
|
-
this.cache.add(
|
|
1411
|
+
this.cache.add(r, 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(
|
|
1425
|
-
return
|
|
1423
|
+
const r = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1424
|
+
t = Promise.all(s.map(function(i, n) {
|
|
1425
|
+
return r.getDependency(e, n);
|
|
1426
1426
|
})), this.cache.add(e, t);
|
|
1427
1427
|
}
|
|
1428
1428
|
return t;
|
|
@@ -1433,14 +1433,14 @@ 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], r = 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(
|
|
1443
|
-
|
|
1442
|
+
return new Promise(function(i, n) {
|
|
1443
|
+
r.load(V.resolveURL(t.uri, s.path), i, void 0, function() {
|
|
1444
1444
|
n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1445
1445
|
});
|
|
1446
1446
|
});
|
|
@@ -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(
|
|
1456
|
-
const s = t.byteLength || 0,
|
|
1457
|
-
return
|
|
1455
|
+
return this.getDependency("buffer", t.buffer).then(function(r) {
|
|
1456
|
+
const s = t.byteLength || 0, i = t.byteOffset || 0;
|
|
1457
|
+
return r.slice(i, i + s);
|
|
1458
1458
|
});
|
|
1459
1459
|
}
|
|
1460
1460
|
/**
|
|
@@ -1463,27 +1463,27 @@ class ys {
|
|
|
1463
1463
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1464
1464
|
*/
|
|
1465
1465
|
loadAccessor(e) {
|
|
1466
|
-
const t = this,
|
|
1466
|
+
const t = this, r = this.json, s = this.json.accessors[e];
|
|
1467
1467
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
1468
|
-
const n =
|
|
1469
|
-
return Promise.resolve(new
|
|
1468
|
+
const n = oe[s.type], a = H[s.componentType], c = s.normalized === !0, l = new a(s.count * n);
|
|
1469
|
+
return Promise.resolve(new K(l, n, c));
|
|
1470
1470
|
}
|
|
1471
|
-
const
|
|
1472
|
-
return s.bufferView !== void 0 ?
|
|
1473
|
-
const
|
|
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(n) {
|
|
1473
|
+
const a = n[0], c = oe[s.type], l = H[s.componentType], d = l.BYTES_PER_ELEMENT, u = d * c, h = s.byteOffset || 0, f = s.bufferView !== void 0 ? r.bufferViews[s.bufferView].byteStride : void 0, p = s.normalized === !0;
|
|
1474
1474
|
let A, m;
|
|
1475
1475
|
if (f && f !== u) {
|
|
1476
1476
|
const g = Math.floor(h / f), R = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
|
|
1477
1477
|
let w = t.cache.get(R);
|
|
1478
|
-
w || (A = new l(
|
|
1478
|
+
w || (A = new l(a, g * f, s.count * f / d), w = new ft(A, f / d), t.cache.add(R, w)), m = new pt(w, c, h % f / d, p);
|
|
1479
1479
|
} else
|
|
1480
|
-
|
|
1480
|
+
a === null ? A = new l(s.count * c) : A = new l(a, h, s.count * c), m = new K(A, c, p);
|
|
1481
1481
|
if (s.sparse !== void 0) {
|
|
1482
|
-
const g =
|
|
1483
|
-
|
|
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(n[1], w, s.sparse.count * g), M = new l(n[2], E, s.sparse.count * c);
|
|
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];
|
|
1486
|
-
if (m.setX(I, M[y *
|
|
1486
|
+
if (m.setX(I, M[y * c]), c >= 2 && m.setY(I, M[y * c + 1]), c >= 3 && m.setZ(I, M[y * c + 2]), c >= 4 && m.setW(I, M[y * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1487
1487
|
}
|
|
1488
1488
|
m.normalized = p;
|
|
1489
1489
|
}
|
|
@@ -1496,53 +1496,53 @@ class ys {
|
|
|
1496
1496
|
* @return {Promise<THREE.Texture|null>}
|
|
1497
1497
|
*/
|
|
1498
1498
|
loadTexture(e) {
|
|
1499
|
-
const t = this.json,
|
|
1500
|
-
let
|
|
1499
|
+
const t = this.json, r = this.options, i = t.textures[e].source, n = t.images[i];
|
|
1500
|
+
let a = this.textureLoader;
|
|
1501
1501
|
if (n.uri) {
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1502
|
+
const c = r.manager.getHandler(n.uri);
|
|
1503
|
+
c !== null && (a = c);
|
|
1504
1504
|
}
|
|
1505
|
-
return this.loadTextureImage(e,
|
|
1506
|
-
}
|
|
1507
|
-
loadTextureImage(e, t,
|
|
1508
|
-
const s = this,
|
|
1509
|
-
if (this.textureCache[
|
|
1510
|
-
return this.textureCache[
|
|
1511
|
-
const l = this.loadImageSource(t,
|
|
1512
|
-
d.flipY = !1, d.name = n.name ||
|
|
1513
|
-
const h = (
|
|
1514
|
-
return d.magFilter =
|
|
1505
|
+
return this.loadTextureImage(e, i, a);
|
|
1506
|
+
}
|
|
1507
|
+
loadTextureImage(e, t, r) {
|
|
1508
|
+
const s = this, i = this.json, n = i.textures[e], a = i.images[t], c = (a.uri || a.bufferView) + ":" + n.sampler;
|
|
1509
|
+
if (this.textureCache[c])
|
|
1510
|
+
return this.textureCache[c];
|
|
1511
|
+
const l = this.loadImageSource(t, r).then(function(d) {
|
|
1512
|
+
d.flipY = !1, d.name = n.name || a.name || "", d.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (d.name = a.uri);
|
|
1513
|
+
const h = (i.samplers || {})[n.sampler] || {};
|
|
1514
|
+
return d.magFilter = Se[h.magFilter] || he, d.minFilter = Se[h.minFilter] || je, d.wrapS = ve[h.wrapS] || fe, d.wrapT = ve[h.wrapT] || fe, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Ke && d.minFilter !== he, s.associations.set(d, { textures: e }), d;
|
|
1515
1515
|
}).catch(function() {
|
|
1516
1516
|
return null;
|
|
1517
1517
|
});
|
|
1518
|
-
return this.textureCache[
|
|
1518
|
+
return this.textureCache[c] = l, l;
|
|
1519
1519
|
}
|
|
1520
1520
|
loadImageSource(e, t) {
|
|
1521
|
-
const
|
|
1521
|
+
const r = 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 n = s.images[e],
|
|
1525
|
-
let
|
|
1524
|
+
const n = s.images[e], a = self.URL || self.webkitURL;
|
|
1525
|
+
let c = n.uri || "", l = !1;
|
|
1526
1526
|
if (n.bufferView !== void 0)
|
|
1527
|
-
|
|
1527
|
+
c = r.getDependency("bufferView", n.bufferView).then(function(u) {
|
|
1528
1528
|
l = !0;
|
|
1529
1529
|
const h = new Blob([u], { type: n.mimeType });
|
|
1530
|
-
return
|
|
1530
|
+
return c = a.createObjectURL(h), c;
|
|
1531
1531
|
});
|
|
1532
1532
|
else if (n.uri === void 0)
|
|
1533
1533
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1534
|
-
const d = Promise.resolve(
|
|
1534
|
+
const d = Promise.resolve(c).then(function(u) {
|
|
1535
1535
|
return new Promise(function(h, f) {
|
|
1536
1536
|
let p = h;
|
|
1537
1537
|
t.isImageBitmapLoader === !0 && (p = function(A) {
|
|
1538
|
-
const m = new
|
|
1538
|
+
const m = new Ee(A);
|
|
1539
1539
|
m.needsUpdate = !0, h(m);
|
|
1540
|
-
}), t.load(
|
|
1540
|
+
}), t.load(V.resolveURL(u, i.path), p, void 0, f);
|
|
1541
1541
|
});
|
|
1542
1542
|
}).then(function(u) {
|
|
1543
|
-
return l === !0 &&
|
|
1543
|
+
return l === !0 && a.revokeObjectURL(c), C(u, n), u.userData.mimeType = n.mimeType || ws(n.uri), u;
|
|
1544
1544
|
}).catch(function(u) {
|
|
1545
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture",
|
|
1545
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
|
|
1546
1546
|
});
|
|
1547
1547
|
return this.sourceCache[e] = d, d;
|
|
1548
1548
|
}
|
|
@@ -1555,15 +1555,15 @@ class ys {
|
|
|
1555
1555
|
* @param {string} colorSpace
|
|
1556
1556
|
* @return {Promise<Texture>}
|
|
1557
1557
|
*/
|
|
1558
|
-
assignTexture(e, t,
|
|
1559
|
-
const
|
|
1560
|
-
return this.getDependency("texture",
|
|
1558
|
+
assignTexture(e, t, r, s) {
|
|
1559
|
+
const i = this;
|
|
1560
|
+
return this.getDependency("texture", r.index).then(function(n) {
|
|
1561
1561
|
if (!n) return null;
|
|
1562
|
-
if (
|
|
1563
|
-
const
|
|
1564
|
-
if (
|
|
1565
|
-
const
|
|
1566
|
-
n =
|
|
1562
|
+
if (r.texCoord !== void 0 && r.texCoord > 0 && (n = n.clone(), n.channel = r.texCoord), i.extensions[T.KHR_TEXTURE_TRANSFORM]) {
|
|
1563
|
+
const a = r.extensions !== void 0 ? r.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1564
|
+
if (a) {
|
|
1565
|
+
const c = i.associations.get(n);
|
|
1566
|
+
n = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), i.associations.set(n, c);
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
1569
1569
|
return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
|
|
@@ -1579,27 +1579,27 @@ class ys {
|
|
|
1579
1579
|
*/
|
|
1580
1580
|
assignFinalMaterial(e) {
|
|
1581
1581
|
const t = e.geometry;
|
|
1582
|
-
let
|
|
1583
|
-
const s = t.attributes.tangent === void 0,
|
|
1582
|
+
let r = e.material;
|
|
1583
|
+
const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
|
|
1584
1584
|
if (e.isPoints) {
|
|
1585
|
-
const
|
|
1586
|
-
let
|
|
1587
|
-
|
|
1585
|
+
const a = "PointsMaterial:" + r.uuid;
|
|
1586
|
+
let c = this.cache.get(a);
|
|
1587
|
+
c || (c = new mt(), ne.prototype.copy.call(c, r), c.color.copy(r.color), c.map = r.map, c.sizeAttenuation = !1, this.cache.add(a, c)), r = c;
|
|
1588
1588
|
} else if (e.isLine) {
|
|
1589
|
-
const
|
|
1590
|
-
let
|
|
1591
|
-
|
|
1589
|
+
const a = "LineBasicMaterial:" + r.uuid;
|
|
1590
|
+
let c = this.cache.get(a);
|
|
1591
|
+
c || (c = new gt(), ne.prototype.copy.call(c, r), c.color.copy(r.color), c.map = r.map, this.cache.add(a, c)), r = c;
|
|
1592
1592
|
}
|
|
1593
|
-
if (s ||
|
|
1594
|
-
let
|
|
1595
|
-
s && (
|
|
1596
|
-
let
|
|
1597
|
-
|
|
1593
|
+
if (s || i || n) {
|
|
1594
|
+
let a = "ClonedMaterial:" + r.uuid + ":";
|
|
1595
|
+
s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), n && (a += "flat-shading:");
|
|
1596
|
+
let c = this.cache.get(a);
|
|
1597
|
+
c || (c = r.clone(), i && (c.vertexColors = !0), n && (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(r))), r = c;
|
|
1598
1598
|
}
|
|
1599
|
-
e.material =
|
|
1599
|
+
e.material = r;
|
|
1600
1600
|
}
|
|
1601
1601
|
getMaterialType() {
|
|
1602
|
-
return
|
|
1602
|
+
return Ve;
|
|
1603
1603
|
}
|
|
1604
1604
|
/**
|
|
1605
1605
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1607,37 +1607,37 @@ class ys {
|
|
|
1607
1607
|
* @return {Promise<Material>}
|
|
1608
1608
|
*/
|
|
1609
1609
|
loadMaterial(e) {
|
|
1610
|
-
const t = this,
|
|
1610
|
+
const t = this, r = this.json, s = this.extensions, i = r.materials[e];
|
|
1611
1611
|
let n;
|
|
1612
|
-
const
|
|
1613
|
-
if (
|
|
1612
|
+
const a = {}, c = i.extensions || {}, l = [];
|
|
1613
|
+
if (c[T.KHR_MATERIALS_UNLIT]) {
|
|
1614
1614
|
const u = s[T.KHR_MATERIALS_UNLIT];
|
|
1615
|
-
n = u.getMaterialType(), l.push(u.extendParams(
|
|
1615
|
+
n = u.getMaterialType(), l.push(u.extendParams(a, i, t));
|
|
1616
1616
|
} else {
|
|
1617
|
-
const u =
|
|
1618
|
-
if (
|
|
1617
|
+
const u = i.pbrMetallicRoughness || {};
|
|
1618
|
+
if (a.color = new P(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
1619
1619
|
const h = u.baseColorFactor;
|
|
1620
|
-
|
|
1620
|
+
a.color.setRGB(h[0], h[1], h[2], S), a.opacity = h[3];
|
|
1621
1621
|
}
|
|
1622
|
-
u.baseColorTexture !== void 0 && l.push(t.assignTexture(
|
|
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))), n = this._invokeOne(function(h) {
|
|
1623
1623
|
return h.getMaterialType && h.getMaterialType(e);
|
|
1624
1624
|
}), l.push(Promise.all(this._invokeAll(function(h) {
|
|
1625
|
-
return h.extendMaterialParams && h.extendMaterialParams(e,
|
|
1625
|
+
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
1626
1626
|
})));
|
|
1627
1627
|
}
|
|
1628
|
-
|
|
1629
|
-
const d =
|
|
1630
|
-
if (d ===
|
|
1631
|
-
const u =
|
|
1632
|
-
|
|
1628
|
+
i.doubleSided === !0 && (a.side = At);
|
|
1629
|
+
const d = i.alphaMode || ae.OPAQUE;
|
|
1630
|
+
if (d === ae.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === ae.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new He(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1631
|
+
const u = i.normalTexture.scale;
|
|
1632
|
+
a.normalScale.set(u, u);
|
|
1633
1633
|
}
|
|
1634
|
-
if (
|
|
1635
|
-
const u =
|
|
1636
|
-
|
|
1634
|
+
if (i.occlusionTexture !== void 0 && n !== B && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && n !== B) {
|
|
1635
|
+
const u = i.emissiveFactor;
|
|
1636
|
+
a.emissive = new P().setRGB(u[0], u[1], u[2], S);
|
|
1637
1637
|
}
|
|
1638
|
-
return
|
|
1639
|
-
const u = new n(
|
|
1640
|
-
return
|
|
1638
|
+
return i.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, N)), Promise.all(l).then(function() {
|
|
1639
|
+
const u = new n(a);
|
|
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
|
}
|
|
1643
1643
|
/**
|
|
@@ -1659,20 +1659,20 @@ class ys {
|
|
|
1659
1659
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1660
1660
|
*/
|
|
1661
1661
|
loadGeometries(e) {
|
|
1662
|
-
const t = this,
|
|
1663
|
-
function
|
|
1664
|
-
return
|
|
1665
|
-
return
|
|
1662
|
+
const t = this, r = this.extensions, s = this.primitiveCache;
|
|
1663
|
+
function i(a) {
|
|
1664
|
+
return r[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
|
|
1665
|
+
return Ce(c, a, t);
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
const n = [];
|
|
1669
|
-
for (let
|
|
1670
|
-
const l = e[
|
|
1669
|
+
for (let a = 0, c = e.length; a < c; a++) {
|
|
1670
|
+
const l = e[a], d = Es(l), u = s[d];
|
|
1671
1671
|
if (u)
|
|
1672
1672
|
n.push(u.promise);
|
|
1673
1673
|
else {
|
|
1674
1674
|
let h;
|
|
1675
|
-
l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h =
|
|
1675
|
+
l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = i(l) : h = Ce(new Fe(), l, t), s[d] = { primitive: l, promise: h }, n.push(h);
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
return Promise.all(n);
|
|
@@ -1683,19 +1683,19 @@ class ys {
|
|
|
1683
1683
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1684
1684
|
*/
|
|
1685
1685
|
loadMesh(e) {
|
|
1686
|
-
const t = this,
|
|
1687
|
-
for (let
|
|
1688
|
-
const d = n[
|
|
1689
|
-
|
|
1686
|
+
const t = this, r = this.json, s = this.extensions, i = r.meshes[e], n = i.primitives, a = [];
|
|
1687
|
+
for (let c = 0, l = n.length; c < l; c++) {
|
|
1688
|
+
const d = n[c].material === void 0 ? Ts(this.cache) : this.getDependency("material", n[c].material);
|
|
1689
|
+
a.push(d);
|
|
1690
1690
|
}
|
|
1691
|
-
return
|
|
1692
|
-
const l =
|
|
1691
|
+
return a.push(t.loadGeometries(n)), Promise.all(a).then(function(c) {
|
|
1692
|
+
const l = c.slice(0, c.length - 1), d = c[c.length - 1], u = [];
|
|
1693
1693
|
for (let f = 0, p = d.length; f < p; f++) {
|
|
1694
1694
|
const A = d[f], m = n[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 =
|
|
1698
|
+
g = i.isSkinnedMesh === !0 ? new _t(A, R) : new Rt(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
1700
|
g = new Et(A, R);
|
|
1701
1701
|
else if (m.mode === x.LINE_STRIP)
|
|
@@ -1706,7 +1706,7 @@ class ys {
|
|
|
1706
1706
|
g = new yt(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 && Rs(g,
|
|
1709
|
+
Object.keys(g.geometry.morphAttributes).length > 0 && Rs(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], {
|
|
@@ -1714,9 +1714,9 @@ class ys {
|
|
|
1714
1714
|
primitives: f
|
|
1715
1715
|
});
|
|
1716
1716
|
if (u.length === 1)
|
|
1717
|
-
return
|
|
1718
|
-
const h = new
|
|
1719
|
-
|
|
1717
|
+
return i.extensions && D(s, u[0], i), u[0];
|
|
1718
|
+
const h = new re();
|
|
1719
|
+
i.extensions && D(s, h, i), t.associations.set(h, { meshes: e });
|
|
1720
1720
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1721
1721
|
h.add(u[f]);
|
|
1722
1722
|
return h;
|
|
@@ -1729,12 +1729,12 @@ class ys {
|
|
|
1729
1729
|
*/
|
|
1730
1730
|
loadCamera(e) {
|
|
1731
1731
|
let t;
|
|
1732
|
-
const
|
|
1732
|
+
const r = this.json.cameras[e], s = r[r.type];
|
|
1733
1733
|
if (!s) {
|
|
1734
1734
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
1737
|
-
return
|
|
1737
|
+
return r.type === "perspective" ? t = new Lt(bt.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : r.type === "orthographic" && (t = new St(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), r.name && (t.name = this.createUniqueName(r.name)), C(t, r), 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],
|
|
1746
|
-
for (let s = 0,
|
|
1747
|
-
|
|
1748
|
-
return t.inverseBindMatrices !== void 0 ?
|
|
1749
|
-
const
|
|
1745
|
+
const t = this.json.skins[e], r = [];
|
|
1746
|
+
for (let s = 0, i = t.joints.length; s < i; s++)
|
|
1747
|
+
r.push(this._loadNodeShallow(t.joints[s]));
|
|
1748
|
+
return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(s) {
|
|
1749
|
+
const i = s.pop(), n = s, a = [], c = [];
|
|
1750
1750
|
for (let l = 0, d = n.length; l < d; l++) {
|
|
1751
1751
|
const u = n[l];
|
|
1752
1752
|
if (u) {
|
|
1753
|
-
|
|
1754
|
-
const h = new
|
|
1755
|
-
|
|
1753
|
+
a.push(u);
|
|
1754
|
+
const h = new Y();
|
|
1755
|
+
i !== null && h.fromArray(i.array, l * 16), c.push(h);
|
|
1756
1756
|
} else
|
|
1757
1757
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
|
|
1758
1758
|
}
|
|
1759
|
-
return new vt(
|
|
1759
|
+
return new vt(a, c);
|
|
1760
1760
|
});
|
|
1761
1761
|
}
|
|
1762
1762
|
/**
|
|
@@ -1765,15 +1765,15 @@ class ys {
|
|
|
1765
1765
|
* @return {Promise<AnimationClip>}
|
|
1766
1766
|
*/
|
|
1767
1767
|
loadAnimation(e) {
|
|
1768
|
-
const t = this.json,
|
|
1768
|
+
const t = this.json, r = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, n = [], a = [], c = [], l = [], d = [];
|
|
1769
1769
|
for (let u = 0, h = s.channels.length; u < h; 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 && (n.push(this.getDependency("node", m)),
|
|
1771
|
+
A.node !== void 0 && (n.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)), c.push(this.getDependency("accessor", R)), l.push(p), d.push(A));
|
|
1772
1772
|
}
|
|
1773
1773
|
return Promise.all([
|
|
1774
1774
|
Promise.all(n),
|
|
1775
|
-
Promise.all(c),
|
|
1776
1775
|
Promise.all(a),
|
|
1776
|
+
Promise.all(c),
|
|
1777
1777
|
Promise.all(l),
|
|
1778
1778
|
Promise.all(d)
|
|
1779
1779
|
]).then(function(u) {
|
|
@@ -1782,22 +1782,22 @@ class ys {
|
|
|
1782
1782
|
const E = h[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 = r._createAnimationTracks(E, b, M, y, U);
|
|
1786
1786
|
if (I)
|
|
1787
|
-
for (let
|
|
1788
|
-
g.push(I[
|
|
1787
|
+
for (let te = 0; te < I.length; te++)
|
|
1788
|
+
g.push(I[te]);
|
|
1789
1789
|
}
|
|
1790
|
-
return new Ct(
|
|
1790
|
+
return new Ct(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 n =
|
|
1797
|
-
return s.weights !== void 0 && n.traverse(function(
|
|
1798
|
-
if (
|
|
1799
|
-
for (let
|
|
1800
|
-
|
|
1794
|
+
const t = this.json, r = this, s = t.nodes[e];
|
|
1795
|
+
return s.mesh === void 0 ? null : r.getDependency("mesh", s.mesh).then(function(i) {
|
|
1796
|
+
const n = r._getNodeRef(r.meshCache, s.mesh, i);
|
|
1797
|
+
return s.weights !== void 0 && n.traverse(function(a) {
|
|
1798
|
+
if (a.isMesh)
|
|
1799
|
+
for (let c = 0, l = s.weights.length; c < l; c++)
|
|
1800
|
+
a.morphTargetInfluences[c] = s.weights[c];
|
|
1801
1801
|
}), n;
|
|
1802
1802
|
});
|
|
1803
1803
|
}
|
|
@@ -1807,14 +1807,14 @@ class ys {
|
|
|
1807
1807
|
* @return {Promise<Object3D>}
|
|
1808
1808
|
*/
|
|
1809
1809
|
loadNode(e) {
|
|
1810
|
-
const t = this.json,
|
|
1811
|
-
for (let l = 0, d =
|
|
1812
|
-
n.push(
|
|
1813
|
-
const
|
|
1810
|
+
const t = this.json, r = this, s = t.nodes[e], i = r._loadNodeShallow(e), n = [], a = s.children || [];
|
|
1811
|
+
for (let l = 0, d = a.length; l < d; l++)
|
|
1812
|
+
n.push(r.getDependency("node", a[l]));
|
|
1813
|
+
const c = s.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", s.skin);
|
|
1814
1814
|
return Promise.all([
|
|
1815
|
-
|
|
1815
|
+
i,
|
|
1816
1816
|
Promise.all(n),
|
|
1817
|
-
|
|
1817
|
+
c
|
|
1818
1818
|
]).then(function(l) {
|
|
1819
1819
|
const d = l[0], u = l[1], h = l[2];
|
|
1820
1820
|
h !== null && d.traverse(function(f) {
|
|
@@ -1828,28 +1828,28 @@ class ys {
|
|
|
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, r = this.extensions, s = this;
|
|
1832
1832
|
if (this.nodeCache[e] !== void 0)
|
|
1833
1833
|
return this.nodeCache[e];
|
|
1834
|
-
const
|
|
1834
|
+
const i = t.nodes[e], n = i.name ? s.createUniqueName(i.name) : "", a = [], c = s._invokeOne(function(l) {
|
|
1835
1835
|
return l.createNodeMesh && l.createNodeMesh(e);
|
|
1836
1836
|
});
|
|
1837
|
-
return
|
|
1838
|
-
return s._getNodeRef(s.cameraCache,
|
|
1837
|
+
return c && a.push(c), i.camera !== void 0 && a.push(s.getDependency("camera", i.camera).then(function(l) {
|
|
1838
|
+
return s._getNodeRef(s.cameraCache, i.camera, l);
|
|
1839
1839
|
})), s._invokeAll(function(l) {
|
|
1840
1840
|
return l.createNodeAttachment && l.createNodeAttachment(e);
|
|
1841
1841
|
}).forEach(function(l) {
|
|
1842
|
-
|
|
1843
|
-
}), this.nodeCache[e] = Promise.all(
|
|
1842
|
+
a.push(l);
|
|
1843
|
+
}), this.nodeCache[e] = Promise.all(a).then(function(l) {
|
|
1844
1844
|
let d;
|
|
1845
|
-
if (
|
|
1845
|
+
if (i.isBone === !0 ? d = new Mt() : l.length > 1 ? d = new re() : l.length === 1 ? d = l[0] : d = new Ge(), d !== l[0])
|
|
1846
1846
|
for (let u = 0, h = l.length; u < h; u++)
|
|
1847
1847
|
d.add(l[u]);
|
|
1848
|
-
if (
|
|
1849
|
-
const u = new
|
|
1850
|
-
u.fromArray(
|
|
1848
|
+
if (i.name && (d.userData.name = i.name, d.name = n), C(d, i), i.extensions && D(r, d, i), i.matrix !== void 0) {
|
|
1849
|
+
const u = new Y();
|
|
1850
|
+
u.fromArray(i.matrix), d.applyMatrix4(u);
|
|
1851
1851
|
} else
|
|
1852
|
-
|
|
1852
|
+
i.translation !== void 0 && d.position.fromArray(i.translation), i.rotation !== void 0 && d.quaternion.fromArray(i.rotation), i.scale !== void 0 && d.scale.fromArray(i.scale);
|
|
1853
1853
|
return s.associations.has(d) || s.associations.set(d, {}), s.associations.get(d).nodes = e, d;
|
|
1854
1854
|
}), this.nodeCache[e];
|
|
1855
1855
|
}
|
|
@@ -1859,60 +1859,60 @@ class ys {
|
|
|
1859
1859
|
* @return {Promise<Group>}
|
|
1860
1860
|
*/
|
|
1861
1861
|
loadScene(e) {
|
|
1862
|
-
const t = this.extensions,
|
|
1863
|
-
|
|
1864
|
-
const n =
|
|
1865
|
-
for (let
|
|
1866
|
-
|
|
1867
|
-
return Promise.all(
|
|
1868
|
-
for (let d = 0, u =
|
|
1869
|
-
|
|
1862
|
+
const t = this.extensions, r = this.json.scenes[e], s = this, i = new re();
|
|
1863
|
+
r.name && (i.name = s.createUniqueName(r.name)), C(i, r), r.extensions && D(t, i, r);
|
|
1864
|
+
const n = r.nodes || [], a = [];
|
|
1865
|
+
for (let c = 0, l = n.length; c < l; c++)
|
|
1866
|
+
a.push(s.getDependency("node", n[c]));
|
|
1867
|
+
return Promise.all(a).then(function(c) {
|
|
1868
|
+
for (let d = 0, u = c.length; d < u; d++)
|
|
1869
|
+
i.add(c[d]);
|
|
1870
1870
|
const l = (d) => {
|
|
1871
1871
|
const u = /* @__PURE__ */ new Map();
|
|
1872
1872
|
for (const [h, f] of s.associations)
|
|
1873
|
-
(h instanceof
|
|
1873
|
+
(h instanceof ne || h instanceof Ee) && u.set(h, f);
|
|
1874
1874
|
return d.traverse((h) => {
|
|
1875
1875
|
const f = s.associations.get(h);
|
|
1876
1876
|
f != null && u.set(h, f);
|
|
1877
1877
|
}), u;
|
|
1878
1878
|
};
|
|
1879
|
-
return s.associations = l(
|
|
1879
|
+
return s.associations = l(i), i;
|
|
1880
1880
|
});
|
|
1881
1881
|
}
|
|
1882
|
-
_createAnimationTracks(e, t,
|
|
1883
|
-
const n = [],
|
|
1884
|
-
O[
|
|
1885
|
-
h.morphTargetInfluences &&
|
|
1886
|
-
}) :
|
|
1882
|
+
_createAnimationTracks(e, t, r, s, i) {
|
|
1883
|
+
const n = [], a = e.name ? e.name : e.uuid, c = [];
|
|
1884
|
+
O[i.path] === O.weights ? e.traverse(function(h) {
|
|
1885
|
+
h.morphTargetInfluences && c.push(h.name ? h.name : h.uuid);
|
|
1886
|
+
}) : c.push(a);
|
|
1887
1887
|
let l;
|
|
1888
|
-
switch (O[
|
|
1888
|
+
switch (O[i.path]) {
|
|
1889
1889
|
case O.weights:
|
|
1890
|
-
l =
|
|
1890
|
+
l = xe;
|
|
1891
1891
|
break;
|
|
1892
1892
|
case O.rotation:
|
|
1893
|
-
l =
|
|
1893
|
+
l = ye;
|
|
1894
1894
|
break;
|
|
1895
1895
|
case O.position:
|
|
1896
1896
|
case O.scale:
|
|
1897
|
-
l =
|
|
1897
|
+
l = we;
|
|
1898
1898
|
break;
|
|
1899
1899
|
default:
|
|
1900
|
-
switch (
|
|
1900
|
+
switch (r.itemSize) {
|
|
1901
1901
|
case 1:
|
|
1902
|
-
l =
|
|
1902
|
+
l = xe;
|
|
1903
1903
|
break;
|
|
1904
1904
|
case 2:
|
|
1905
1905
|
case 3:
|
|
1906
1906
|
default:
|
|
1907
|
-
l =
|
|
1907
|
+
l = we;
|
|
1908
1908
|
break;
|
|
1909
1909
|
}
|
|
1910
1910
|
break;
|
|
1911
1911
|
}
|
|
1912
|
-
const d = s.interpolation !== void 0 ? As[s.interpolation] :
|
|
1913
|
-
for (let h = 0, f =
|
|
1912
|
+
const d = s.interpolation !== void 0 ? As[s.interpolation] : ze, u = this._getArrayFromAccessor(r);
|
|
1913
|
+
for (let h = 0, f = c.length; h < f; h++) {
|
|
1914
1914
|
const p = new l(
|
|
1915
|
-
|
|
1915
|
+
c[h] + "." + O[i.path],
|
|
1916
1916
|
t.array,
|
|
1917
1917
|
u,
|
|
1918
1918
|
d
|
|
@@ -1924,30 +1924,30 @@ class ys {
|
|
|
1924
1924
|
_getArrayFromAccessor(e) {
|
|
1925
1925
|
let t = e.array;
|
|
1926
1926
|
if (e.normalized) {
|
|
1927
|
-
const
|
|
1928
|
-
for (let
|
|
1929
|
-
s[
|
|
1927
|
+
const r = me(t.constructor), s = new Float32Array(t.length);
|
|
1928
|
+
for (let i = 0, n = t.length; i < n; i++)
|
|
1929
|
+
s[i] = t[i] * r;
|
|
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
|
|
1937
|
-
return new s(this.times, this.values, this.getValueSize() / 3,
|
|
1935
|
+
e.createInterpolant = function(r) {
|
|
1936
|
+
const s = this instanceof ye ? gs : We;
|
|
1937
|
+
return new s(this.times, this.values, this.getValueSize() / 3, r);
|
|
1938
1938
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
1941
|
function Ls(o, e, t) {
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1944
|
-
const
|
|
1945
|
-
if (
|
|
1942
|
+
const r = e.attributes, s = new Ht();
|
|
1943
|
+
if (r.POSITION !== void 0) {
|
|
1944
|
+
const a = t.json.accessors[r.POSITION], c = a.min, l = a.max;
|
|
1945
|
+
if (c !== void 0 && l !== void 0) {
|
|
1946
1946
|
if (s.set(
|
|
1947
|
-
new F(
|
|
1947
|
+
new F(c[0], c[1], c[2]),
|
|
1948
1948
|
new F(l[0], l[1], l[2])
|
|
1949
|
-
),
|
|
1950
|
-
const d =
|
|
1949
|
+
), a.normalized) {
|
|
1950
|
+
const d = me(H[a.componentType]);
|
|
1951
1951
|
s.min.multiplyScalar(d), s.max.multiplyScalar(d);
|
|
1952
1952
|
}
|
|
1953
1953
|
} else {
|
|
@@ -1956,58 +1956,58 @@ function Ls(o, e, t) {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
} else
|
|
1958
1958
|
return;
|
|
1959
|
-
const
|
|
1960
|
-
if (
|
|
1961
|
-
const
|
|
1962
|
-
for (let l = 0, d =
|
|
1963
|
-
const u =
|
|
1959
|
+
const i = e.targets;
|
|
1960
|
+
if (i !== void 0) {
|
|
1961
|
+
const a = new F(), c = new F();
|
|
1962
|
+
for (let l = 0, d = i.length; l < d; l++) {
|
|
1963
|
+
const u = i[l];
|
|
1964
1964
|
if (u.POSITION !== void 0) {
|
|
1965
1965
|
const h = t.json.accessors[u.POSITION], f = h.min, p = h.max;
|
|
1966
1966
|
if (f !== void 0 && p !== void 0) {
|
|
1967
|
-
if (
|
|
1968
|
-
const A =
|
|
1969
|
-
|
|
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]))), h.normalized) {
|
|
1968
|
+
const A = me(H[h.componentType]);
|
|
1969
|
+
c.multiplyScalar(A);
|
|
1970
1970
|
}
|
|
1971
|
-
|
|
1971
|
+
a.max(c);
|
|
1972
1972
|
} else
|
|
1973
1973
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
|
-
s.expandByVector(
|
|
1976
|
+
s.expandByVector(a);
|
|
1977
1977
|
}
|
|
1978
1978
|
o.boundingBox = s;
|
|
1979
1979
|
const n = new Ut();
|
|
1980
1980
|
s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = n;
|
|
1981
1981
|
}
|
|
1982
|
-
function
|
|
1983
|
-
const
|
|
1984
|
-
function
|
|
1985
|
-
return t.getDependency("accessor", n).then(function(
|
|
1986
|
-
o.setAttribute(
|
|
1982
|
+
function Ce(o, e, t) {
|
|
1983
|
+
const r = e.attributes, s = [];
|
|
1984
|
+
function i(n, a) {
|
|
1985
|
+
return t.getDependency("accessor", n).then(function(c) {
|
|
1986
|
+
o.setAttribute(a, c);
|
|
1987
1987
|
});
|
|
1988
1988
|
}
|
|
1989
|
-
for (const n in
|
|
1990
|
-
const
|
|
1991
|
-
|
|
1989
|
+
for (const n in r) {
|
|
1990
|
+
const a = pe[n] || n.toLowerCase();
|
|
1991
|
+
a in o.attributes || s.push(i(r[n], a));
|
|
1992
1992
|
}
|
|
1993
1993
|
if (e.indices !== void 0 && !o.index) {
|
|
1994
|
-
const n = t.getDependency("accessor", e.indices).then(function(
|
|
1995
|
-
o.setIndex(
|
|
1994
|
+
const n = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1995
|
+
o.setIndex(a);
|
|
1996
1996
|
});
|
|
1997
1997
|
s.push(n);
|
|
1998
1998
|
}
|
|
1999
|
-
return
|
|
1999
|
+
return de.workingColorSpace !== S && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${de.workingColorSpace}" not supported.`), C(o, e), Ls(o, e, t), Promise.all(s).then(function() {
|
|
2000
2000
|
return e.targets !== void 0 ? _s(o, e.targets, t) : o;
|
|
2001
2001
|
});
|
|
2002
2002
|
}
|
|
2003
|
-
var bs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, vs = (o, e, t,
|
|
2004
|
-
for (var s =
|
|
2005
|
-
(n = o[
|
|
2006
|
-
return
|
|
2003
|
+
var bs = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, vs = (o, e, t, r) => {
|
|
2004
|
+
for (var s = r > 1 ? void 0 : r ? Ss(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2005
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2006
|
+
return r && s && bs(e, t, s), s;
|
|
2007
2007
|
};
|
|
2008
|
-
let
|
|
2008
|
+
let Q = class {
|
|
2009
2009
|
constructor() {
|
|
2010
|
-
_(this, "workerPool",
|
|
2010
|
+
_(this, "workerPool", Ye(void 0, !0));
|
|
2011
2011
|
_(this, "canvas");
|
|
2012
2012
|
_(this, "worker");
|
|
2013
2013
|
_(this, "thread");
|
|
@@ -2016,15 +2016,15 @@ let q = class {
|
|
|
2016
2016
|
this.worker = o.worker, this.thread = o.thread;
|
|
2017
2017
|
}
|
|
2018
2018
|
};
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
],
|
|
2022
|
-
var Cs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Is = (o, e, t,
|
|
2023
|
-
for (var s =
|
|
2024
|
-
(n = o[
|
|
2025
|
-
return
|
|
2026
|
-
}, Os = (o, e) => (t,
|
|
2027
|
-
let
|
|
2019
|
+
Q = vs([
|
|
2020
|
+
z()
|
|
2021
|
+
], Q);
|
|
2022
|
+
var Cs = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, Is = (o, e, t, r) => {
|
|
2023
|
+
for (var s = r > 1 ? void 0 : r ? Ms(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2024
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2025
|
+
return r && s && Cs(e, t, s), s;
|
|
2026
|
+
}, Os = (o, e) => (t, r) => e(t, r, o);
|
|
2027
|
+
let ge = class extends Qe {
|
|
2028
2028
|
constructor(e) {
|
|
2029
2029
|
super();
|
|
2030
2030
|
_(this, "canvas");
|
|
@@ -2032,18 +2032,18 @@ let me = class extends qe {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
init(e) {
|
|
2034
2034
|
this.canvas = e;
|
|
2035
|
-
for (const t of
|
|
2036
|
-
const
|
|
2037
|
-
this[`${t}$`] =
|
|
2035
|
+
for (const t of Me) {
|
|
2036
|
+
const r = 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
|
+
this[`${t}$`] = Je(
|
|
2038
2038
|
t === "resize" ? window : e,
|
|
2039
2039
|
t
|
|
2040
2040
|
).pipe(
|
|
2041
2041
|
// @ts-ignore
|
|
2042
|
-
|
|
2043
|
-
|
|
2042
|
+
$(r.bind(this)),
|
|
2043
|
+
Ie((s) => !(t === "keydown" && !s))
|
|
2044
2044
|
), this[`${t}$`].subscribe((s) => {
|
|
2045
|
-
var
|
|
2046
|
-
(n = (
|
|
2045
|
+
var i, n;
|
|
2046
|
+
(n = (i = this._service.thread) == null ? void 0 : i[t]) == null || n.call(i, s);
|
|
2047
2047
|
});
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
@@ -2072,7 +2072,7 @@ let me = class extends qe {
|
|
|
2072
2072
|
mouseEventHandler(e) {
|
|
2073
2073
|
return {
|
|
2074
2074
|
...this.getScreenSizes(),
|
|
2075
|
-
...
|
|
2075
|
+
...j(e, [
|
|
2076
2076
|
"ctrlKey",
|
|
2077
2077
|
"metaKey",
|
|
2078
2078
|
"shiftKey",
|
|
@@ -2086,40 +2086,40 @@ let me = class extends qe {
|
|
|
2086
2086
|
};
|
|
2087
2087
|
}
|
|
2088
2088
|
touchEventHandler(e) {
|
|
2089
|
-
const t = [],
|
|
2089
|
+
const t = [], r = { type: e.type, touches: t };
|
|
2090
2090
|
for (let s = 0; s < e.touches.length; ++s) {
|
|
2091
|
-
const
|
|
2091
|
+
const i = e.touches[s];
|
|
2092
2092
|
t.push({
|
|
2093
|
-
pageX: (
|
|
2094
|
-
pageY: (
|
|
2093
|
+
pageX: (i == null ? void 0 : i.pageX) ?? 0,
|
|
2094
|
+
pageY: (i == null ? void 0 : i.pageY) ?? 0
|
|
2095
2095
|
});
|
|
2096
2096
|
}
|
|
2097
|
-
return { ...this.getScreenSizes(), ...
|
|
2097
|
+
return { ...this.getScreenSizes(), ...r };
|
|
2098
2098
|
}
|
|
2099
2099
|
wheelEventHandler(e) {
|
|
2100
2100
|
return e.preventDefault(), {
|
|
2101
2101
|
...this.getScreenSizes(),
|
|
2102
|
-
...
|
|
2102
|
+
...j(e, ["deltaX", "deltaY"])
|
|
2103
2103
|
};
|
|
2104
2104
|
}
|
|
2105
2105
|
keyEventHandler(e) {
|
|
2106
|
-
if (
|
|
2106
|
+
if (Ze.includes(e.code))
|
|
2107
2107
|
return e.preventDefault(), {
|
|
2108
2108
|
...this.getScreenSizes(),
|
|
2109
|
-
...
|
|
2109
|
+
...j(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
|
|
2110
2110
|
};
|
|
2111
2111
|
}
|
|
2112
2112
|
};
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
Os(0, L(
|
|
2116
|
-
],
|
|
2117
|
-
var Ns = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ds = (o, e, t,
|
|
2118
|
-
for (var s =
|
|
2119
|
-
(n = o[
|
|
2120
|
-
return
|
|
2113
|
+
ge = Is([
|
|
2114
|
+
z(),
|
|
2115
|
+
Os(0, L(Q))
|
|
2116
|
+
], ge);
|
|
2117
|
+
var Ns = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, Ds = (o, e, t, r) => {
|
|
2118
|
+
for (var s = r > 1 ? void 0 : r ? Ps(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2119
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2120
|
+
return r && s && Ns(e, t, s), s;
|
|
2121
2121
|
};
|
|
2122
|
-
let
|
|
2122
|
+
let J = class {
|
|
2123
2123
|
constructor() {
|
|
2124
2124
|
_(this, "loadingManager", new Bt());
|
|
2125
2125
|
_(this, "loaders", {});
|
|
@@ -2134,39 +2134,15 @@ let Y = class {
|
|
|
2134
2134
|
load: (o, e) => {
|
|
2135
2135
|
const t = document.createElement("video");
|
|
2136
2136
|
t.muted = !0, t.loop = !0, t.crossOrigin = "anonymous", t.controls = !1, t.playsInline = !0, t.src = o, t.autoplay = !0;
|
|
2137
|
-
async
|
|
2138
|
-
|
|
2139
|
-
r.videoWidth,
|
|
2140
|
-
r.videoHeight
|
|
2141
|
-
), c = n.getContext("2d"), a = 30, l = [];
|
|
2142
|
-
return console.log("Extracting frames from video"), new Promise((d) => {
|
|
2143
|
-
for (r.currentTime = 0; r.currentTime < r.duration; ) {
|
|
2144
|
-
c == null || c.drawImage(
|
|
2145
|
-
r,
|
|
2146
|
-
0,
|
|
2147
|
-
0,
|
|
2148
|
-
n.width,
|
|
2149
|
-
n.height
|
|
2150
|
-
);
|
|
2151
|
-
const u = n.transferToImageBitmap();
|
|
2152
|
-
l.push(u), r.currentTime < r.duration && (r.currentTime += 1 / a);
|
|
2153
|
-
}
|
|
2154
|
-
d(l), r.onerror = (u) => {
|
|
2155
|
-
console.error("Error while extracting frames:", u);
|
|
2156
|
-
}, r.currentTime = 0;
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
const s = async () => {
|
|
2160
|
-
if (!t) return;
|
|
2161
|
-
const r = await i(t);
|
|
2162
|
-
console.log("Video loaded", r), e(r), t.removeEventListener("loadeddata", s);
|
|
2137
|
+
const r = async () => {
|
|
2138
|
+
e(t), t.removeEventListener("canplaythrough", r);
|
|
2163
2139
|
};
|
|
2164
|
-
t.addEventListener("
|
|
2140
|
+
t.addEventListener("canplaythrough", r);
|
|
2165
2141
|
}
|
|
2166
2142
|
};
|
|
2167
2143
|
}
|
|
2168
2144
|
_initLoaders() {
|
|
2169
|
-
this.loaders.dracoLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new jt(this.loadingManager), this.loaders.gltfLoader = new zt(this.loadingManager), this.loaders.imageLoader = new
|
|
2145
|
+
this.loaders.dracoLoader = new Kt(this.loadingManager), this.loaders.audioLoader = new jt(this.loadingManager), this.loaders.gltfLoader = new zt(this.loadingManager), this.loaders.imageLoader = new Be(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
|
|
2170
2146
|
}
|
|
2171
2147
|
_initSources(o) {
|
|
2172
2148
|
this.sources = o, this.toLoadCount = this.sources.length, this.loadedCount = 0;
|
|
@@ -2184,12 +2160,12 @@ let Y = class {
|
|
|
2184
2160
|
source: o,
|
|
2185
2161
|
resource: e,
|
|
2186
2162
|
toLoadCount: t,
|
|
2187
|
-
loadedCount:
|
|
2163
|
+
loadedCount: r
|
|
2188
2164
|
}) {
|
|
2189
|
-
e && (this.loadedResources[o.name] = e, this.loadedCount =
|
|
2165
|
+
e && (this.loadedResources[o.name] = e, this.loadedCount = r, this.toLoadCount = t);
|
|
2190
2166
|
}
|
|
2191
2167
|
load(o) {
|
|
2192
|
-
var t,
|
|
2168
|
+
var t, r, s, i;
|
|
2193
2169
|
const e = this.sources[0];
|
|
2194
2170
|
if (e) {
|
|
2195
2171
|
o == null || o(e);
|
|
@@ -2198,82 +2174,135 @@ let Y = class {
|
|
|
2198
2174
|
return;
|
|
2199
2175
|
n.type === "gltf" && ((t = this.loaders.gltfLoader) == null || t.load(
|
|
2200
2176
|
n.path,
|
|
2201
|
-
(
|
|
2202
|
-
)), n.type === "audio" && ((
|
|
2203
|
-
o == null || o(n,
|
|
2204
|
-
})), n.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(n.path, (
|
|
2205
|
-
o == null || o(n,
|
|
2206
|
-
})), n.type === "video" && ((
|
|
2177
|
+
(a) => o == null ? void 0 : o(n, a)
|
|
2178
|
+
)), n.type === "audio" && ((r = this.loaders.audioLoader) == null || r.load(n.path, (a) => {
|
|
2179
|
+
o == null || o(n, a);
|
|
2180
|
+
})), n.type === "image" && ((s = this.loaders.imageLoader) == null || s.load(n.path, (a) => {
|
|
2181
|
+
o == null || o(n, a);
|
|
2182
|
+
})), n.type === "video" && ((i = this.loaders.videoLoader) == null || i.load(
|
|
2207
2183
|
n.path,
|
|
2208
|
-
(
|
|
2184
|
+
(a) => o == null ? void 0 : o(n, a)
|
|
2209
2185
|
));
|
|
2210
2186
|
}
|
|
2211
2187
|
}
|
|
2212
2188
|
}
|
|
2213
2189
|
};
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
],
|
|
2217
|
-
var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (o, e, t,
|
|
2218
|
-
for (var s =
|
|
2219
|
-
(n = o[
|
|
2220
|
-
return
|
|
2221
|
-
}, Us = (o, e) => (t,
|
|
2222
|
-
let
|
|
2190
|
+
J = Ds([
|
|
2191
|
+
z()
|
|
2192
|
+
], J);
|
|
2193
|
+
var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (o, e, t, r) => {
|
|
2194
|
+
for (var s = r > 1 ? void 0 : r ? Fs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2195
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2196
|
+
return r && s && ks(e, t, s), s;
|
|
2197
|
+
}, Us = (o, e) => (t, r) => e(t, r, o);
|
|
2198
|
+
let Z = class {
|
|
2223
2199
|
constructor(o) {
|
|
2224
|
-
_(this, "load$$", new
|
|
2200
|
+
_(this, "load$$", new et());
|
|
2225
2201
|
_(this, "load$", this.load$$.pipe(
|
|
2226
|
-
|
|
2202
|
+
$((o) => ({
|
|
2227
2203
|
...o,
|
|
2228
2204
|
loadedCount: o.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
|
|
2229
2205
|
toLoadCount: this._service.toLoadCount
|
|
2230
2206
|
})),
|
|
2231
|
-
|
|
2207
|
+
se()
|
|
2232
2208
|
));
|
|
2233
2209
|
_(this, "serializedLoad$", this.load$.pipe(
|
|
2234
|
-
|
|
2235
|
-
var t,
|
|
2210
|
+
$((o) => {
|
|
2211
|
+
var t, r, s;
|
|
2236
2212
|
let e = o.resource;
|
|
2237
2213
|
if ((t = o == null ? void 0 : o.resource) != null && t.parser) {
|
|
2238
|
-
const
|
|
2239
|
-
(
|
|
2214
|
+
const i = o.resource, n = i.scenes.map(
|
|
2215
|
+
(a) => _e(a)
|
|
2240
2216
|
);
|
|
2241
2217
|
e = {
|
|
2242
2218
|
animations: (o == null ? void 0 : o.resource).animations.map(
|
|
2243
2219
|
// @ts-ignore <<toJSON methods doesn't require a parameter>>
|
|
2244
|
-
(
|
|
2220
|
+
(a) => a.toJSON()
|
|
2245
2221
|
),
|
|
2246
|
-
cameras:
|
|
2247
|
-
(
|
|
2222
|
+
cameras: i.cameras.map(
|
|
2223
|
+
(a) => _e(a)
|
|
2248
2224
|
),
|
|
2249
|
-
parser: { json:
|
|
2250
|
-
scene:
|
|
2251
|
-
scenes:
|
|
2252
|
-
userData:
|
|
2225
|
+
parser: { json: i.parser.json },
|
|
2226
|
+
scene: n == null ? void 0 : n[0],
|
|
2227
|
+
scenes: n,
|
|
2228
|
+
userData: i.userData
|
|
2253
2229
|
};
|
|
2254
2230
|
}
|
|
2255
|
-
return ((
|
|
2231
|
+
return ((r = o == null ? void 0 : o.source) == null ? void 0 : r.type) === "audio" && o.resource instanceof AudioBuffer && (e = {
|
|
2232
|
+
arrayBuffer: o.resource.getChannelData(0),
|
|
2233
|
+
length: o.resource.length,
|
|
2234
|
+
sampleRate: o.resource.sampleRate,
|
|
2235
|
+
duration: o.resource.duration
|
|
2236
|
+
}), ((s = o == null ? void 0 : o.source) == null ? void 0 : s.type) === "video" && o.resource instanceof HTMLVideoElement && (e = {
|
|
2237
|
+
...j(o.resource, [
|
|
2238
|
+
"autoplay",
|
|
2239
|
+
"baseURI",
|
|
2240
|
+
"controls",
|
|
2241
|
+
"crossOrigin",
|
|
2242
|
+
"currentTime",
|
|
2243
|
+
"defaultMuted",
|
|
2244
|
+
"disablePictureInPicture",
|
|
2245
|
+
"draggable",
|
|
2246
|
+
"duration",
|
|
2247
|
+
"ended",
|
|
2248
|
+
"height",
|
|
2249
|
+
"hidden",
|
|
2250
|
+
"loop",
|
|
2251
|
+
"muted",
|
|
2252
|
+
"nodeName",
|
|
2253
|
+
"nodeType",
|
|
2254
|
+
"paused",
|
|
2255
|
+
"playbackRate",
|
|
2256
|
+
"playsInline",
|
|
2257
|
+
"poster",
|
|
2258
|
+
"preload",
|
|
2259
|
+
"readyState",
|
|
2260
|
+
"seeking",
|
|
2261
|
+
"spellcheck",
|
|
2262
|
+
"src",
|
|
2263
|
+
"tabIndex",
|
|
2264
|
+
"translate",
|
|
2265
|
+
"videoHeight",
|
|
2266
|
+
"videoWidth",
|
|
2267
|
+
"volume",
|
|
2268
|
+
"width"
|
|
2269
|
+
]),
|
|
2270
|
+
buffered: o.resource.buffered.length,
|
|
2271
|
+
error: o.resource.error ? Oe(o.resource.error, []) : {},
|
|
2272
|
+
played: o.resource.played.length,
|
|
2273
|
+
seekable: o.resource.seekable.length,
|
|
2274
|
+
textTracks: o.resource.textTracks.length
|
|
2275
|
+
}), {
|
|
2256
2276
|
...o,
|
|
2257
2277
|
resource: e
|
|
2258
2278
|
};
|
|
2259
|
-
})
|
|
2279
|
+
}),
|
|
2280
|
+
se()
|
|
2260
2281
|
));
|
|
2261
2282
|
_(this, "loadCompleted$", this.load$.pipe(
|
|
2262
|
-
|
|
2283
|
+
Ie((o) => o.toLoadCount === o.loadedCount),
|
|
2284
|
+
$(
|
|
2285
|
+
() => j(this._service, [
|
|
2286
|
+
"loadedCount",
|
|
2287
|
+
"loadedResources",
|
|
2288
|
+
"toLoadCount"
|
|
2289
|
+
])
|
|
2290
|
+
),
|
|
2291
|
+
se()
|
|
2263
2292
|
));
|
|
2264
2293
|
this._service = o;
|
|
2265
2294
|
}
|
|
2266
2295
|
};
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
Us(0, L(
|
|
2270
|
-
],
|
|
2271
|
-
var Gs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, js = (o, e, t,
|
|
2272
|
-
for (var s =
|
|
2273
|
-
(n = o[
|
|
2274
|
-
return
|
|
2275
|
-
},
|
|
2276
|
-
let
|
|
2296
|
+
Z = Hs([
|
|
2297
|
+
z(),
|
|
2298
|
+
Us(0, L(J))
|
|
2299
|
+
], Z);
|
|
2300
|
+
var Gs = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, js = (o, e, t, r) => {
|
|
2301
|
+
for (var s = r > 1 ? void 0 : r ? Bs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2302
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2303
|
+
return r && s && Gs(e, t, s), s;
|
|
2304
|
+
}, le = (o, e) => (t, r) => e(t, r, o);
|
|
2305
|
+
let ee = class {
|
|
2277
2306
|
constructor(o, e, t) {
|
|
2278
2307
|
_(this, "_subscriptions", []);
|
|
2279
2308
|
this._controller = o, this._service = e, this._props = t, this._subscriptions.push(
|
|
@@ -2322,23 +2351,23 @@ let J = class {
|
|
|
2322
2351
|
this._controller.load$$.complete();
|
|
2323
2352
|
}
|
|
2324
2353
|
};
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
],
|
|
2331
|
-
|
|
2332
|
-
var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (o, e, t,
|
|
2333
|
-
for (var s =
|
|
2334
|
-
(n = o[
|
|
2335
|
-
return
|
|
2336
|
-
}, k = (o, e) => (t,
|
|
2337
|
-
let
|
|
2338
|
-
constructor(e, t,
|
|
2354
|
+
ee = js([
|
|
2355
|
+
z(),
|
|
2356
|
+
le(0, L(Z)),
|
|
2357
|
+
le(1, L(J)),
|
|
2358
|
+
le(2, L(Te))
|
|
2359
|
+
], ee);
|
|
2360
|
+
Ne.resolve(ee);
|
|
2361
|
+
var Ks = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, zs = (o, e, t, r) => {
|
|
2362
|
+
for (var s = r > 1 ? void 0 : r ? Vs(e, t) : e, i = o.length - 1, n; i >= 0; i--)
|
|
2363
|
+
(n = o[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2364
|
+
return r && s && Ks(e, t, s), s;
|
|
2365
|
+
}, k = (o, e) => (t, r) => e(t, r, o);
|
|
2366
|
+
let Ae = class extends nt {
|
|
2367
|
+
constructor(e, t, r, s, i, n) {
|
|
2339
2368
|
super();
|
|
2340
2369
|
_(this, "initialized", !1);
|
|
2341
|
-
this._service = e, this._controller = t, this._loaderController =
|
|
2370
|
+
this._service = e, this._controller = t, this._loaderController = r, this.props = s, this.loader = i, this.container = n, this.props.initOnConstruct && this.init();
|
|
2342
2371
|
}
|
|
2343
2372
|
async _initCanvas() {
|
|
2344
2373
|
try {
|
|
@@ -2364,7 +2393,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2364
2393
|
var e, t;
|
|
2365
2394
|
if (!this._service.canvas)
|
|
2366
2395
|
throw new Error("Canvas element is not initialized.");
|
|
2367
|
-
this._controller.init(this._service.canvas), !(!this._service.thread || !this._service.worker) && ((t = (e = this._service.thread) == null ? void 0 : e.resize) == null || t.call(e, {
|
|
2396
|
+
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, {
|
|
2368
2397
|
...this._controller.uiEventHandler({ type: "resize" })
|
|
2369
2398
|
}));
|
|
2370
2399
|
}
|
|
@@ -2373,11 +2402,11 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2373
2402
|
throw new Error("Canvas element is not initialized.");
|
|
2374
2403
|
const e = this._service.canvas.transferControlToOffscreen();
|
|
2375
2404
|
e.width = this._service.canvas.clientWidth, e.height = this._service.canvas.clientHeight;
|
|
2376
|
-
const [t,
|
|
2405
|
+
const [t, r] = await this._service.workerPool.run({
|
|
2377
2406
|
payload: {
|
|
2378
2407
|
path: this.props.location,
|
|
2379
2408
|
subject: {
|
|
2380
|
-
...
|
|
2409
|
+
...Oe(this.props, [
|
|
2381
2410
|
"canvas",
|
|
2382
2411
|
"location",
|
|
2383
2412
|
"onReady",
|
|
@@ -2388,12 +2417,12 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2388
2417
|
transferSubject: [e]
|
|
2389
2418
|
}
|
|
2390
2419
|
});
|
|
2391
|
-
if (!t ||
|
|
2420
|
+
if (!t || r)
|
|
2392
2421
|
throw new Error("Unable to retrieve the worker-thread info.");
|
|
2393
2422
|
this._service.worker = t.worker, this._service.thread = t.thread;
|
|
2394
2423
|
}
|
|
2395
2424
|
async _initObservableProxyEvents() {
|
|
2396
|
-
|
|
2425
|
+
Me.forEach(
|
|
2397
2426
|
(e) => this[`${e}$`] = () => {
|
|
2398
2427
|
var t;
|
|
2399
2428
|
return (t = this._controller) == null ? void 0 : t[`${e}$`];
|
|
@@ -2401,15 +2430,17 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2401
2430
|
);
|
|
2402
2431
|
}
|
|
2403
2432
|
async _initLoader() {
|
|
2404
|
-
this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe(
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
return (t = this._service.worker) == null ? void 0 : t.postMessage(
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2433
|
+
this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe((e) => {
|
|
2434
|
+
var t, r;
|
|
2435
|
+
if (e.resource instanceof ArrayBuffer)
|
|
2436
|
+
return (t = this._service.worker) == null ? void 0 : t.postMessage(e.resource, [
|
|
2437
|
+
e.resource
|
|
2438
|
+
]);
|
|
2439
|
+
(r = this._service.worker) == null || r.postMessage({
|
|
2440
|
+
token: rt,
|
|
2441
|
+
payload: e
|
|
2442
|
+
});
|
|
2443
|
+
});
|
|
2413
2444
|
}
|
|
2414
2445
|
isInitialized() {
|
|
2415
2446
|
return this.initialized;
|
|
@@ -2435,23 +2466,23 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2435
2466
|
await this._service.workerPool.terminateAll(), ((e = this._service.canvas) == null ? void 0 : e.dataset.reactive) === "true" && (this._service.canvas.remove(), this._service.canvas = void 0), this.initialized = !1;
|
|
2436
2467
|
}
|
|
2437
2468
|
};
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
k(0, L(
|
|
2441
|
-
k(1, L(
|
|
2442
|
-
k(2, L(
|
|
2443
|
-
k(3, L(
|
|
2444
|
-
k(4, L(
|
|
2445
|
-
k(5, L(
|
|
2446
|
-
],
|
|
2469
|
+
Ae = zs([
|
|
2470
|
+
tt(st.ContainerScoped),
|
|
2471
|
+
k(0, L(Q)),
|
|
2472
|
+
k(1, L(ge)),
|
|
2473
|
+
k(2, L(Z)),
|
|
2474
|
+
k(3, L(Te)),
|
|
2475
|
+
k(4, L(ee)),
|
|
2476
|
+
k(5, L(Pe))
|
|
2477
|
+
], Ae);
|
|
2447
2478
|
const Ys = (o) => {
|
|
2448
2479
|
if (typeof (o == null ? void 0 : o.location) != "string" && !((o == null ? void 0 : o.location) instanceof URL))
|
|
2449
2480
|
throw new Error(
|
|
2450
2481
|
"Invalid register props detected. location path is required"
|
|
2451
2482
|
);
|
|
2452
|
-
const e =
|
|
2453
|
-
o.initOnConstruct =
|
|
2454
|
-
const t = e.resolve(
|
|
2483
|
+
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 = it(o.onReady) ? o.onReady : void 0, e.register(Pe, { useValue: e }), e.register(Te, { useValue: o });
|
|
2485
|
+
const t = e.resolve(Ae);
|
|
2455
2486
|
return t.initialized = !0, {
|
|
2456
2487
|
container: e,
|
|
2457
2488
|
module: t
|
|
@@ -2460,17 +2491,17 @@ const Ys = (o) => {
|
|
|
2460
2491
|
export {
|
|
2461
2492
|
Zs as AppModule,
|
|
2462
2493
|
en as AppProxyEventHandlersBlueprint,
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2494
|
+
Pe as CONTAINER_TOKEN,
|
|
2495
|
+
Re as DefaultCameraType,
|
|
2496
|
+
Ze as KEYBOARD_EVENT_CODES,
|
|
2466
2497
|
rt as LOADER_SERIALIZED_LOAD_TOKEN,
|
|
2467
2498
|
qs as LaunchAppProps,
|
|
2468
|
-
|
|
2469
|
-
|
|
2499
|
+
Me as PROXY_EVENT_LISTENERS,
|
|
2500
|
+
Qe as ProxyEventHandlersBlueprint,
|
|
2470
2501
|
tn as ProxyEventObservablesBlueprint,
|
|
2471
2502
|
sn as ProxyEventSubjectsBlueprint,
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2503
|
+
Ae as RegisterModule,
|
|
2504
|
+
Te as RegisterPropsBlueprint,
|
|
2505
|
+
nt as RegisterProxyEventHandlersBlueprint,
|
|
2475
2506
|
Ys as register
|
|
2476
2507
|
};
|