@quick-threejs/reactive 0.1.29 → 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-Bhlwvbrt.js → app.module-BaIoj4QA.js} +7 -7
- package/dist/{app.module-Dy3P3_8R.mjs → app.module-BbeIDure.mjs} +999 -987
- package/dist/common/interfaces/loader.interface.d.ts +5 -4
- package/dist/core/app/debug/debug.module.d.ts +2 -2
- package/dist/core/app/debug/debug.service.d.ts +1 -1
- 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 +5 -6
- package/dist/core/register/loader/loader.service.d.ts +4 -4
- package/dist/main.js +3 -3
- package/dist/main.mjs +883 -831
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +1 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $e = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var _ = (
|
|
4
|
-
import { s as
|
|
5
|
-
import { k as
|
|
6
|
-
import { TrianglesDrawMode as
|
|
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
7
|
class Te {
|
|
8
8
|
constructor() {
|
|
9
9
|
/**
|
|
@@ -119,189 +119,309 @@ class Te {
|
|
|
119
119
|
_(this, "onReady");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
class
|
|
122
|
+
class qs {
|
|
123
123
|
constructor() {
|
|
124
124
|
/** @description Handler triggered when the app is ready. */
|
|
125
125
|
_(this, "onReady");
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
128
|
+
function Le(o, e) {
|
|
129
|
+
if (e === ot)
|
|
130
|
+
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), o;
|
|
131
|
+
if (e === ue || e === De) {
|
|
132
|
+
let t = o.getIndex();
|
|
133
|
+
if (t === null) {
|
|
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
|
+
o.setIndex(n), t = o.getIndex();
|
|
139
|
+
} else
|
|
140
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), o;
|
|
141
|
+
}
|
|
142
|
+
const r = t.count - 2, s = [];
|
|
143
|
+
if (e === ue)
|
|
144
|
+
for (let n = 1; n <= r; n++)
|
|
145
|
+
s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
|
|
146
|
+
else
|
|
147
|
+
for (let n = 0; n < r; n++)
|
|
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 !== 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
|
+
} else
|
|
153
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), o;
|
|
154
|
+
}
|
|
155
|
+
const ie = /* @__PURE__ */ new WeakMap();
|
|
156
|
+
class Kt extends ke {
|
|
157
|
+
constructor(e) {
|
|
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
|
+
position: "POSITION",
|
|
160
|
+
normal: "NORMAL",
|
|
161
|
+
color: "COLOR",
|
|
162
|
+
uv: "TEX_COORD"
|
|
163
|
+
}, this.defaultAttributeTypes = {
|
|
164
|
+
position: "Float32Array",
|
|
165
|
+
normal: "Float32Array",
|
|
166
|
+
color: "Float32Array",
|
|
167
|
+
uv: "Float32Array"
|
|
168
|
+
};
|
|
139
169
|
}
|
|
140
|
-
|
|
141
|
-
this.
|
|
170
|
+
setDecoderPath(e) {
|
|
171
|
+
return this.decoderPath = e, this;
|
|
142
172
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
V()
|
|
146
|
-
], q);
|
|
147
|
-
var qt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Qt = (c, e, t, r) => {
|
|
148
|
-
for (var s = r > 1 ? void 0 : r ? Yt(e, t) : e, i = c.length - 1, n; i >= 0; i--)
|
|
149
|
-
(n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
150
|
-
return r && s && qt(e, t, s), s;
|
|
151
|
-
}, Jt = (c, e) => (t, r) => e(t, r, c);
|
|
152
|
-
let pe = class extends Ye {
|
|
153
|
-
constructor(e) {
|
|
154
|
-
super();
|
|
155
|
-
_(this, "canvas");
|
|
156
|
-
this._service = e;
|
|
173
|
+
setDecoderConfig(e) {
|
|
174
|
+
return this.decoderConfig = e, this;
|
|
157
175
|
}
|
|
158
|
-
|
|
159
|
-
this.
|
|
160
|
-
for (const t of Ce) {
|
|
161
|
-
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;
|
|
162
|
-
this[`${t}$`] = Qe(
|
|
163
|
-
t === "resize" ? window : e,
|
|
164
|
-
t
|
|
165
|
-
).pipe(
|
|
166
|
-
// @ts-ignore
|
|
167
|
-
le(r.bind(this)),
|
|
168
|
-
Me((s) => !(t === "keydown" && !s))
|
|
169
|
-
), this[`${t}$`].subscribe((s) => {
|
|
170
|
-
var i, n;
|
|
171
|
-
(n = (i = this._service.thread) == null ? void 0 : i[t]) == null || n.call(i, s);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
176
|
+
setWorkerLimit(e) {
|
|
177
|
+
return this.workerLimit = e, this;
|
|
174
178
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
+
this.parse(n, t, s);
|
|
183
|
+
}, r, s);
|
|
179
184
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
height: this.canvas.height,
|
|
184
|
-
windowWidth: (window == null ? void 0 : window.innerWidth) ?? 0,
|
|
185
|
-
windowHeight: (window == null ? void 0 : window.innerHeight) ?? 0
|
|
186
|
-
};
|
|
185
|
+
parse(e, t, r = () => {
|
|
186
|
+
}) {
|
|
187
|
+
this.decodeDracoFile(e, t, null, null, N, r).catch(r);
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
decodeDracoFile(e, t, r, s, i = S, n = () => {
|
|
190
|
+
}) {
|
|
191
|
+
const a = {
|
|
192
|
+
attributeIDs: r || this.defaultAttributeIDs,
|
|
193
|
+
attributeTypes: s || this.defaultAttributeTypes,
|
|
194
|
+
useUniqueIDs: !!r,
|
|
195
|
+
vertexColorSpace: i
|
|
195
196
|
};
|
|
197
|
+
return this.decodeGeometry(e, a).then(t).catch(n);
|
|
196
198
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
])
|
|
211
|
-
};
|
|
199
|
+
decodeGeometry(e, t) {
|
|
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
|
+
if (e.byteLength === 0)
|
|
206
|
+
throw new Error(
|
|
207
|
+
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
let s;
|
|
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;
|
|
212
220
|
}
|
|
213
|
-
|
|
214
|
-
const t =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
pageY: (i == null ? void 0 : i.pageY) ?? 0
|
|
220
|
-
});
|
|
221
|
+
_createGeometry(e) {
|
|
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);
|
|
221
227
|
}
|
|
222
|
-
return
|
|
228
|
+
return t;
|
|
223
229
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
230
|
+
_assignVertexColorSpace(e, t) {
|
|
231
|
+
if (t !== N) return;
|
|
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);
|
|
229
235
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
};
|
|
236
|
+
_loadLibrary(e, t) {
|
|
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
|
+
});
|
|
236
241
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
242
|
+
preload() {
|
|
243
|
+
return this._initDecoder(), this;
|
|
244
|
+
}
|
|
245
|
+
_initDecoder() {
|
|
246
|
+
if (this.decoderPending) return this.decoderPending;
|
|
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((r) => {
|
|
249
|
+
const s = r[0];
|
|
250
|
+
e || (this.decoderConfig.wasmBinary = r[1]);
|
|
251
|
+
const i = Vt.toString(), n = [
|
|
252
|
+
"/* draco decoder */",
|
|
253
|
+
s,
|
|
254
|
+
"",
|
|
255
|
+
"/* worker */",
|
|
256
|
+
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
257
|
+
].join(`
|
|
258
|
+
`);
|
|
259
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([n]));
|
|
260
|
+
}), this.decoderPending;
|
|
261
|
+
}
|
|
262
|
+
_getWorker(e, t) {
|
|
263
|
+
return this._initDecoder().then(() => {
|
|
264
|
+
if (this.workerPool.length < this.workerLimit) {
|
|
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(i) {
|
|
267
|
+
const n = i.data;
|
|
268
|
+
switch (n.type) {
|
|
269
|
+
case "decode":
|
|
270
|
+
s._callbacks[n.id].resolve(n);
|
|
271
|
+
break;
|
|
272
|
+
case "error":
|
|
273
|
+
s._callbacks[n.id].reject(n);
|
|
274
|
+
break;
|
|
275
|
+
default:
|
|
276
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
|
|
277
|
+
}
|
|
278
|
+
}, this.workerPool.push(s);
|
|
253
279
|
} else
|
|
254
|
-
|
|
280
|
+
this.workerPool.sort(function(s, i) {
|
|
281
|
+
return s._taskLoad > i._taskLoad ? -1 : 1;
|
|
282
|
+
});
|
|
283
|
+
const r = this.workerPool[this.workerPool.length - 1];
|
|
284
|
+
return r._taskCosts[e] = t, r._taskLoad += t, r;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
_releaseTask(e, t) {
|
|
288
|
+
e._taskLoad -= e._taskCosts[t], delete e._callbacks[t], delete e._taskCosts[t];
|
|
289
|
+
}
|
|
290
|
+
debug() {
|
|
291
|
+
console.log("Task load: ", this.workerPool.map((e) => e._taskLoad));
|
|
292
|
+
}
|
|
293
|
+
dispose() {
|
|
294
|
+
for (let e = 0; e < this.workerPool.length; ++e)
|
|
295
|
+
this.workerPool[e].terminate();
|
|
296
|
+
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function Vt() {
|
|
300
|
+
let o, e;
|
|
301
|
+
onmessage = function(n) {
|
|
302
|
+
const a = n.data;
|
|
303
|
+
switch (a.type) {
|
|
304
|
+
case "init":
|
|
305
|
+
o = a.decoderConfig, e = new Promise(function(d) {
|
|
306
|
+
o.onModuleLoaded = function(u) {
|
|
307
|
+
d({ draco: u });
|
|
308
|
+
}, DracoDecoderModule(o);
|
|
309
|
+
});
|
|
310
|
+
break;
|
|
311
|
+
case "decode":
|
|
312
|
+
const c = a.buffer, l = a.taskConfig;
|
|
313
|
+
e.then((d) => {
|
|
314
|
+
const u = d.draco, h = new u.Decoder();
|
|
315
|
+
try {
|
|
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
|
+
} catch (f) {
|
|
319
|
+
console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
|
|
320
|
+
} finally {
|
|
321
|
+
u.destroy(h);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
break;
|
|
255
325
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
326
|
+
};
|
|
327
|
+
function t(n, a, c, l) {
|
|
328
|
+
const d = l.attributeIDs, u = l.attributeTypes;
|
|
329
|
+
let h, f;
|
|
330
|
+
const p = a.GetEncodedGeometryType(c);
|
|
331
|
+
if (p === n.TRIANGULAR_MESH)
|
|
332
|
+
h = new n.Mesh(), f = a.DecodeArrayToMesh(c, c.byteLength, h);
|
|
333
|
+
else if (p === n.POINT_CLOUD)
|
|
334
|
+
h = new n.PointCloud(), f = a.DecodeArrayToPointCloud(c, c.byteLength, h);
|
|
260
335
|
else
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
336
|
+
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
337
|
+
if (!f.ok() || h.ptr === 0)
|
|
338
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
|
|
339
|
+
const A = { index: null, attributes: [] };
|
|
340
|
+
for (const m in d) {
|
|
341
|
+
const g = self[u[m]];
|
|
342
|
+
let R, w;
|
|
343
|
+
if (l.useUniqueIDs)
|
|
344
|
+
w = d[m], R = a.GetAttributeByUniqueId(h, w);
|
|
345
|
+
else {
|
|
346
|
+
if (w = a.GetAttributeId(h, n[d[m]]), w === -1) continue;
|
|
347
|
+
R = a.GetAttribute(h, w);
|
|
348
|
+
}
|
|
349
|
+
const E = s(n, a, h, m, g, R);
|
|
350
|
+
m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
|
|
351
|
+
}
|
|
352
|
+
return p === n.TRIANGULAR_MESH && (A.index = r(n, a, h)), n.destroy(h), A;
|
|
353
|
+
}
|
|
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
|
+
const f = new Uint32Array(n.HEAPF32.buffer, h, d).slice();
|
|
358
|
+
return n._free(h), { array: f, itemSize: 1 };
|
|
359
|
+
}
|
|
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
|
+
const R = new d(n.HEAPF32.buffer, g, p).slice();
|
|
364
|
+
return n._free(g), {
|
|
365
|
+
name: l,
|
|
366
|
+
array: R,
|
|
367
|
+
itemSize: h
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function i(n, a) {
|
|
371
|
+
switch (a) {
|
|
372
|
+
case Float32Array:
|
|
373
|
+
return n.DT_FLOAT32;
|
|
374
|
+
case Int8Array:
|
|
375
|
+
return n.DT_INT8;
|
|
376
|
+
case Int16Array:
|
|
377
|
+
return n.DT_INT16;
|
|
378
|
+
case Int32Array:
|
|
379
|
+
return n.DT_INT32;
|
|
380
|
+
case Uint8Array:
|
|
381
|
+
return n.DT_UINT8;
|
|
382
|
+
case Uint16Array:
|
|
383
|
+
return n.DT_UINT16;
|
|
384
|
+
case Uint32Array:
|
|
385
|
+
return n.DT_UINT32;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
268
388
|
}
|
|
269
|
-
class
|
|
389
|
+
class zt extends ke {
|
|
270
390
|
constructor(e) {
|
|
271
391
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
272
|
-
return new
|
|
392
|
+
return new Yt(t);
|
|
273
393
|
}), this.register(function(t) {
|
|
274
|
-
return new
|
|
394
|
+
return new Qt(t);
|
|
275
395
|
}), this.register(function(t) {
|
|
276
|
-
return new
|
|
277
|
-
}), this.register(function(t) {
|
|
278
|
-
return new ms(t);
|
|
279
|
-
}), this.register(function(t) {
|
|
280
|
-
return new gs(t);
|
|
396
|
+
return new os(t);
|
|
281
397
|
}), this.register(function(t) {
|
|
282
398
|
return new as(t);
|
|
283
399
|
}), this.register(function(t) {
|
|
284
400
|
return new cs(t);
|
|
285
401
|
}), this.register(function(t) {
|
|
286
|
-
return new
|
|
402
|
+
return new Zt(t);
|
|
287
403
|
}), this.register(function(t) {
|
|
288
|
-
return new
|
|
404
|
+
return new es(t);
|
|
289
405
|
}), this.register(function(t) {
|
|
290
|
-
return new
|
|
406
|
+
return new ts(t);
|
|
291
407
|
}), this.register(function(t) {
|
|
292
|
-
return new
|
|
408
|
+
return new ss(t);
|
|
293
409
|
}), this.register(function(t) {
|
|
294
|
-
return new
|
|
410
|
+
return new qt(t);
|
|
295
411
|
}), this.register(function(t) {
|
|
296
|
-
return new
|
|
412
|
+
return new ns(t);
|
|
297
413
|
}), this.register(function(t) {
|
|
298
|
-
return new
|
|
414
|
+
return new Jt(t);
|
|
299
415
|
}), this.register(function(t) {
|
|
300
|
-
return new
|
|
416
|
+
return new is(t);
|
|
417
|
+
}), this.register(function(t) {
|
|
418
|
+
return new rs(t);
|
|
301
419
|
}), this.register(function(t) {
|
|
302
|
-
return new
|
|
420
|
+
return new Wt(t);
|
|
303
421
|
}), this.register(function(t) {
|
|
304
|
-
return new
|
|
422
|
+
return new ls(t);
|
|
423
|
+
}), this.register(function(t) {
|
|
424
|
+
return new us(t);
|
|
305
425
|
});
|
|
306
426
|
}
|
|
307
427
|
load(e, t, r, s) {
|
|
@@ -310,15 +430,15 @@ class Zt extends De {
|
|
|
310
430
|
if (this.resourcePath !== "")
|
|
311
431
|
n = this.resourcePath;
|
|
312
432
|
else if (this.path !== "") {
|
|
313
|
-
const l =
|
|
314
|
-
n =
|
|
433
|
+
const l = V.extractUrlBase(e);
|
|
434
|
+
n = V.resolveURL(l, this.path);
|
|
315
435
|
} else
|
|
316
|
-
n =
|
|
436
|
+
n = V.extractUrlBase(e);
|
|
317
437
|
this.manager.itemStart(e);
|
|
318
438
|
const a = function(l) {
|
|
319
439
|
s ? s(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
320
|
-
},
|
|
321
|
-
|
|
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) {
|
|
322
442
|
try {
|
|
323
443
|
i.parse(l, n, function(d) {
|
|
324
444
|
t(d), i.manager.itemEnd(e);
|
|
@@ -345,27 +465,27 @@ class Zt extends De {
|
|
|
345
465
|
}
|
|
346
466
|
parse(e, t, r, s) {
|
|
347
467
|
let i;
|
|
348
|
-
const n = {}, a = {},
|
|
468
|
+
const n = {}, a = {}, c = new TextDecoder();
|
|
349
469
|
if (typeof e == "string")
|
|
350
470
|
i = JSON.parse(e);
|
|
351
471
|
else if (e instanceof ArrayBuffer)
|
|
352
|
-
if (
|
|
472
|
+
if (c.decode(new Uint8Array(e, 0, 4)) === Xe) {
|
|
353
473
|
try {
|
|
354
|
-
n[T.KHR_BINARY_GLTF] = new
|
|
474
|
+
n[T.KHR_BINARY_GLTF] = new ds(e);
|
|
355
475
|
} catch (u) {
|
|
356
476
|
s && s(u);
|
|
357
477
|
return;
|
|
358
478
|
}
|
|
359
479
|
i = JSON.parse(n[T.KHR_BINARY_GLTF].content);
|
|
360
480
|
} else
|
|
361
|
-
i = JSON.parse(
|
|
481
|
+
i = JSON.parse(c.decode(e));
|
|
362
482
|
else
|
|
363
483
|
i = e;
|
|
364
484
|
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
365
485
|
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
366
486
|
return;
|
|
367
487
|
}
|
|
368
|
-
const l = new
|
|
488
|
+
const l = new ys(i, {
|
|
369
489
|
path: t || this.resourcePath || "",
|
|
370
490
|
crossOrigin: this.crossOrigin,
|
|
371
491
|
requestHeader: this.requestHeader,
|
|
@@ -383,16 +503,16 @@ class Zt extends De {
|
|
|
383
503
|
const u = i.extensionsUsed[d], h = i.extensionsRequired || [];
|
|
384
504
|
switch (u) {
|
|
385
505
|
case T.KHR_MATERIALS_UNLIT:
|
|
386
|
-
n[u] = new
|
|
506
|
+
n[u] = new $t();
|
|
387
507
|
break;
|
|
388
508
|
case T.KHR_DRACO_MESH_COMPRESSION:
|
|
389
|
-
n[u] = new
|
|
509
|
+
n[u] = new hs(i, this.dracoLoader);
|
|
390
510
|
break;
|
|
391
511
|
case T.KHR_TEXTURE_TRANSFORM:
|
|
392
|
-
n[u] = new
|
|
512
|
+
n[u] = new fs();
|
|
393
513
|
break;
|
|
394
514
|
case T.KHR_MESH_QUANTIZATION:
|
|
395
|
-
n[u] = new
|
|
515
|
+
n[u] = new ps();
|
|
396
516
|
break;
|
|
397
517
|
default:
|
|
398
518
|
h.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
|
|
@@ -407,20 +527,20 @@ class Zt extends De {
|
|
|
407
527
|
});
|
|
408
528
|
}
|
|
409
529
|
}
|
|
410
|
-
function
|
|
411
|
-
let
|
|
530
|
+
function Xt() {
|
|
531
|
+
let o = {};
|
|
412
532
|
return {
|
|
413
533
|
get: function(e) {
|
|
414
|
-
return
|
|
534
|
+
return o[e];
|
|
415
535
|
},
|
|
416
536
|
add: function(e, t) {
|
|
417
|
-
|
|
537
|
+
o[e] = t;
|
|
418
538
|
},
|
|
419
539
|
remove: function(e) {
|
|
420
|
-
delete
|
|
540
|
+
delete o[e];
|
|
421
541
|
},
|
|
422
542
|
removeAll: function() {
|
|
423
|
-
|
|
543
|
+
o = {};
|
|
424
544
|
}
|
|
425
545
|
};
|
|
426
546
|
}
|
|
@@ -448,7 +568,7 @@ const T = {
|
|
|
448
568
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
449
569
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
450
570
|
};
|
|
451
|
-
class
|
|
571
|
+
class Wt {
|
|
452
572
|
constructor(e) {
|
|
453
573
|
this.parser = e, this.name = T.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
454
574
|
}
|
|
@@ -463,25 +583,25 @@ class ts {
|
|
|
463
583
|
const t = this.parser, r = "light:" + e;
|
|
464
584
|
let s = t.cache.get(r);
|
|
465
585
|
if (s) return s;
|
|
466
|
-
const i = t.json,
|
|
586
|
+
const i = t.json, c = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
467
587
|
let l;
|
|
468
|
-
const d = new
|
|
469
|
-
|
|
470
|
-
const u =
|
|
471
|
-
switch (
|
|
588
|
+
const d = new P(16777215);
|
|
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) {
|
|
472
592
|
case "directional":
|
|
473
|
-
l = new
|
|
593
|
+
l = new lt(d), l.target.position.set(0, 0, -1), l.add(l.target);
|
|
474
594
|
break;
|
|
475
595
|
case "point":
|
|
476
|
-
l = new
|
|
596
|
+
l = new ct(d), l.distance = u;
|
|
477
597
|
break;
|
|
478
598
|
case "spot":
|
|
479
|
-
l = new
|
|
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);
|
|
480
600
|
break;
|
|
481
601
|
default:
|
|
482
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " +
|
|
602
|
+
throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
|
|
483
603
|
}
|
|
484
|
-
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;
|
|
485
605
|
}
|
|
486
606
|
getDependency(e, t) {
|
|
487
607
|
if (e === "light")
|
|
@@ -489,12 +609,12 @@ class ts {
|
|
|
489
609
|
}
|
|
490
610
|
createNodeAttachment(e) {
|
|
491
611
|
const t = this, r = this.parser, i = r.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
492
|
-
return a === void 0 ? null : this._loadLight(a).then(function(
|
|
493
|
-
return r._getNodeRef(t.cache, a,
|
|
612
|
+
return a === void 0 ? null : this._loadLight(a).then(function(c) {
|
|
613
|
+
return r._getNodeRef(t.cache, a, c);
|
|
494
614
|
});
|
|
495
615
|
}
|
|
496
616
|
}
|
|
497
|
-
class
|
|
617
|
+
class $t {
|
|
498
618
|
constructor() {
|
|
499
619
|
this.name = T.KHR_MATERIALS_UNLIT;
|
|
500
620
|
}
|
|
@@ -503,7 +623,7 @@ class ss {
|
|
|
503
623
|
}
|
|
504
624
|
extendParams(e, t, r) {
|
|
505
625
|
const s = [];
|
|
506
|
-
e.color = new
|
|
626
|
+
e.color = new P(1, 1, 1), e.opacity = 1;
|
|
507
627
|
const i = t.pbrMetallicRoughness;
|
|
508
628
|
if (i) {
|
|
509
629
|
if (Array.isArray(i.baseColorFactor)) {
|
|
@@ -515,7 +635,7 @@ class ss {
|
|
|
515
635
|
return Promise.all(s);
|
|
516
636
|
}
|
|
517
637
|
}
|
|
518
|
-
class
|
|
638
|
+
class qt {
|
|
519
639
|
constructor(e) {
|
|
520
640
|
this.parser = e, this.name = T.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
521
641
|
}
|
|
@@ -527,7 +647,7 @@ class ns {
|
|
|
527
647
|
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
528
648
|
}
|
|
529
649
|
}
|
|
530
|
-
class
|
|
650
|
+
class Yt {
|
|
531
651
|
constructor(e) {
|
|
532
652
|
this.parser = e, this.name = T.KHR_MATERIALS_CLEARCOAT;
|
|
533
653
|
}
|
|
@@ -542,12 +662,12 @@ class rs {
|
|
|
542
662
|
const i = [], n = s.extensions[this.name];
|
|
543
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)) {
|
|
544
664
|
const a = n.clearcoatNormalTexture.scale;
|
|
545
|
-
t.clearcoatNormalScale = new
|
|
665
|
+
t.clearcoatNormalScale = new He(a, a);
|
|
546
666
|
}
|
|
547
667
|
return Promise.all(i);
|
|
548
668
|
}
|
|
549
669
|
}
|
|
550
|
-
class
|
|
670
|
+
class Qt {
|
|
551
671
|
constructor(e) {
|
|
552
672
|
this.parser = e, this.name = T.KHR_MATERIALS_DISPERSION;
|
|
553
673
|
}
|
|
@@ -563,7 +683,7 @@ class is {
|
|
|
563
683
|
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
564
684
|
}
|
|
565
685
|
}
|
|
566
|
-
class
|
|
686
|
+
class Jt {
|
|
567
687
|
constructor(e) {
|
|
568
688
|
this.parser = e, this.name = T.KHR_MATERIALS_IRIDESCENCE;
|
|
569
689
|
}
|
|
@@ -579,7 +699,7 @@ class os {
|
|
|
579
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);
|
|
580
700
|
}
|
|
581
701
|
}
|
|
582
|
-
class
|
|
702
|
+
class Zt {
|
|
583
703
|
constructor(e) {
|
|
584
704
|
this.parser = e, this.name = T.KHR_MATERIALS_SHEEN;
|
|
585
705
|
}
|
|
@@ -592,7 +712,7 @@ class as {
|
|
|
592
712
|
if (!s.extensions || !s.extensions[this.name])
|
|
593
713
|
return Promise.resolve();
|
|
594
714
|
const i = [];
|
|
595
|
-
t.sheenColor = new
|
|
715
|
+
t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
596
716
|
const n = s.extensions[this.name];
|
|
597
717
|
if (n.sheenColorFactor !== void 0) {
|
|
598
718
|
const a = n.sheenColorFactor;
|
|
@@ -601,7 +721,7 @@ class as {
|
|
|
601
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);
|
|
602
722
|
}
|
|
603
723
|
}
|
|
604
|
-
class
|
|
724
|
+
class es {
|
|
605
725
|
constructor(e) {
|
|
606
726
|
this.parser = e, this.name = T.KHR_MATERIALS_TRANSMISSION;
|
|
607
727
|
}
|
|
@@ -617,7 +737,7 @@ class cs {
|
|
|
617
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);
|
|
618
738
|
}
|
|
619
739
|
}
|
|
620
|
-
class
|
|
740
|
+
class ts {
|
|
621
741
|
constructor(e) {
|
|
622
742
|
this.parser = e, this.name = T.KHR_MATERIALS_VOLUME;
|
|
623
743
|
}
|
|
@@ -632,10 +752,10 @@ class ls {
|
|
|
632
752
|
const i = [], n = s.extensions[this.name];
|
|
633
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;
|
|
634
754
|
const a = n.attenuationColor || [1, 1, 1];
|
|
635
|
-
return t.attenuationColor = new
|
|
755
|
+
return t.attenuationColor = new P().setRGB(a[0], a[1], a[2], S), Promise.all(i);
|
|
636
756
|
}
|
|
637
757
|
}
|
|
638
|
-
class
|
|
758
|
+
class ss {
|
|
639
759
|
constructor(e) {
|
|
640
760
|
this.parser = e, this.name = T.KHR_MATERIALS_IOR;
|
|
641
761
|
}
|
|
@@ -651,7 +771,7 @@ class us {
|
|
|
651
771
|
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
652
772
|
}
|
|
653
773
|
}
|
|
654
|
-
class
|
|
774
|
+
class ns {
|
|
655
775
|
constructor(e) {
|
|
656
776
|
this.parser = e, this.name = T.KHR_MATERIALS_SPECULAR;
|
|
657
777
|
}
|
|
@@ -666,10 +786,10 @@ class ds {
|
|
|
666
786
|
const i = [], n = s.extensions[this.name];
|
|
667
787
|
t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && i.push(r.assignTexture(t, "specularIntensityMap", n.specularTexture));
|
|
668
788
|
const a = n.specularColorFactor || [1, 1, 1];
|
|
669
|
-
return t.specularColor = new
|
|
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);
|
|
670
790
|
}
|
|
671
791
|
}
|
|
672
|
-
class
|
|
792
|
+
class rs {
|
|
673
793
|
constructor(e) {
|
|
674
794
|
this.parser = e, this.name = T.EXT_MATERIALS_BUMP;
|
|
675
795
|
}
|
|
@@ -685,7 +805,7 @@ class hs {
|
|
|
685
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);
|
|
686
806
|
}
|
|
687
807
|
}
|
|
688
|
-
class
|
|
808
|
+
class is {
|
|
689
809
|
constructor(e) {
|
|
690
810
|
this.parser = e, this.name = T.KHR_MATERIALS_ANISOTROPY;
|
|
691
811
|
}
|
|
@@ -701,7 +821,7 @@ class fs {
|
|
|
701
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);
|
|
702
822
|
}
|
|
703
823
|
}
|
|
704
|
-
class
|
|
824
|
+
class os {
|
|
705
825
|
constructor(e) {
|
|
706
826
|
this.parser = e, this.name = T.KHR_TEXTURE_BASISU;
|
|
707
827
|
}
|
|
@@ -718,7 +838,7 @@ class ps {
|
|
|
718
838
|
return t.loadTextureImage(e, i.source, n);
|
|
719
839
|
}
|
|
720
840
|
}
|
|
721
|
-
class
|
|
841
|
+
class as {
|
|
722
842
|
constructor(e) {
|
|
723
843
|
this.parser = e, this.name = T.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
724
844
|
}
|
|
@@ -727,13 +847,13 @@ class ms {
|
|
|
727
847
|
if (!i.extensions || !i.extensions[t])
|
|
728
848
|
return null;
|
|
729
849
|
const n = i.extensions[t], a = s.images[n.source];
|
|
730
|
-
let
|
|
850
|
+
let c = r.textureLoader;
|
|
731
851
|
if (a.uri) {
|
|
732
852
|
const l = r.options.manager.getHandler(a.uri);
|
|
733
|
-
l !== null && (
|
|
853
|
+
l !== null && (c = l);
|
|
734
854
|
}
|
|
735
855
|
return this.detectSupport().then(function(l) {
|
|
736
|
-
if (l) return r.loadTextureImage(e, n.source,
|
|
856
|
+
if (l) return r.loadTextureImage(e, n.source, c);
|
|
737
857
|
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
738
858
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
739
859
|
return r.loadTexture(e);
|
|
@@ -748,7 +868,7 @@ class ms {
|
|
|
748
868
|
})), this.isSupported;
|
|
749
869
|
}
|
|
750
870
|
}
|
|
751
|
-
class
|
|
871
|
+
class cs {
|
|
752
872
|
constructor(e) {
|
|
753
873
|
this.parser = e, this.name = T.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
754
874
|
}
|
|
@@ -757,13 +877,13 @@ class gs {
|
|
|
757
877
|
if (!i.extensions || !i.extensions[t])
|
|
758
878
|
return null;
|
|
759
879
|
const n = i.extensions[t], a = s.images[n.source];
|
|
760
|
-
let
|
|
880
|
+
let c = r.textureLoader;
|
|
761
881
|
if (a.uri) {
|
|
762
882
|
const l = r.options.manager.getHandler(a.uri);
|
|
763
|
-
l !== null && (
|
|
883
|
+
l !== null && (c = l);
|
|
764
884
|
}
|
|
765
885
|
return this.detectSupport().then(function(l) {
|
|
766
|
-
if (l) return r.loadTextureImage(e, n.source,
|
|
886
|
+
if (l) return r.loadTextureImage(e, n.source, c);
|
|
767
887
|
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
768
888
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
769
889
|
return r.loadTexture(e);
|
|
@@ -778,7 +898,7 @@ class gs {
|
|
|
778
898
|
})), this.isSupported;
|
|
779
899
|
}
|
|
780
900
|
}
|
|
781
|
-
class
|
|
901
|
+
class ls {
|
|
782
902
|
constructor(e) {
|
|
783
903
|
this.name = T.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
784
904
|
}
|
|
@@ -792,7 +912,7 @@ class As {
|
|
|
792
912
|
return null;
|
|
793
913
|
}
|
|
794
914
|
return i.then(function(a) {
|
|
795
|
-
const
|
|
915
|
+
const c = s.byteOffset || 0, l = s.byteLength || 0, d = s.count, u = s.byteStride, h = new Uint8Array(a, c, l);
|
|
796
916
|
return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(d, u, h, s.mode, s.filter).then(function(f) {
|
|
797
917
|
return f.buffer;
|
|
798
918
|
}) : n.ready.then(function() {
|
|
@@ -804,7 +924,7 @@ class As {
|
|
|
804
924
|
return null;
|
|
805
925
|
}
|
|
806
926
|
}
|
|
807
|
-
class
|
|
927
|
+
class us {
|
|
808
928
|
constructor(e) {
|
|
809
929
|
this.name = T.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
810
930
|
}
|
|
@@ -814,30 +934,30 @@ class Ts {
|
|
|
814
934
|
return null;
|
|
815
935
|
const s = t.meshes[r.mesh];
|
|
816
936
|
for (const l of s.primitives)
|
|
817
|
-
if (l.mode !==
|
|
937
|
+
if (l.mode !== x.TRIANGLES && l.mode !== x.TRIANGLE_STRIP && l.mode !== x.TRIANGLE_FAN && l.mode !== void 0)
|
|
818
938
|
return null;
|
|
819
|
-
const n = r.extensions[this.name].attributes, a = [],
|
|
939
|
+
const n = r.extensions[this.name].attributes, a = [], c = {};
|
|
820
940
|
for (const l in n)
|
|
821
|
-
a.push(this.parser.getDependency("accessor", n[l]).then((d) => (
|
|
941
|
+
a.push(this.parser.getDependency("accessor", n[l]).then((d) => (c[l] = d, c[l])));
|
|
822
942
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
|
|
823
943
|
const d = l.pop(), u = d.isGroup ? d.children : [d], h = l[0].count, f = [];
|
|
824
944
|
for (const p of u) {
|
|
825
|
-
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);
|
|
826
946
|
for (let E = 0; E < h; E++)
|
|
827
|
-
|
|
828
|
-
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)
|
|
829
949
|
if (E === "_COLOR_0") {
|
|
830
|
-
const b =
|
|
831
|
-
w.instanceColor = new
|
|
832
|
-
} else E !== "TRANSLATION" && E !== "ROTATION" && E !== "SCALE" && p.geometry.setAttribute(E,
|
|
833
|
-
|
|
950
|
+
const b = c[E];
|
|
951
|
+
w.instanceColor = new dt(b.array, b.itemSize, b.normalized);
|
|
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);
|
|
834
954
|
}
|
|
835
955
|
return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
|
|
836
956
|
}));
|
|
837
957
|
}
|
|
838
958
|
}
|
|
839
|
-
const
|
|
840
|
-
class
|
|
959
|
+
const Xe = "glTF", G = 12, be = { JSON: 1313821514, BIN: 5130562 };
|
|
960
|
+
class ds {
|
|
841
961
|
constructor(e) {
|
|
842
962
|
this.name = T.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
843
963
|
const t = new DataView(e, 0, G), r = new TextDecoder();
|
|
@@ -845,7 +965,7 @@ class _s {
|
|
|
845
965
|
magic: r.decode(new Uint8Array(e.slice(0, 4))),
|
|
846
966
|
version: t.getUint32(4, !0),
|
|
847
967
|
length: t.getUint32(8, !0)
|
|
848
|
-
}, this.header.magic !==
|
|
968
|
+
}, this.header.magic !== Xe)
|
|
849
969
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
850
970
|
if (this.header.version < 2)
|
|
851
971
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
@@ -854,11 +974,11 @@ class _s {
|
|
|
854
974
|
for (; n < s; ) {
|
|
855
975
|
const a = i.getUint32(n, !0);
|
|
856
976
|
n += 4;
|
|
857
|
-
const
|
|
858
|
-
if (n += 4,
|
|
977
|
+
const c = i.getUint32(n, !0);
|
|
978
|
+
if (n += 4, c === be.JSON) {
|
|
859
979
|
const l = new Uint8Array(e, G + n, a);
|
|
860
980
|
this.content = r.decode(l);
|
|
861
|
-
} else if (
|
|
981
|
+
} else if (c === be.BIN) {
|
|
862
982
|
const l = G + n;
|
|
863
983
|
this.body = e.slice(l, l + a);
|
|
864
984
|
}
|
|
@@ -868,30 +988,30 @@ class _s {
|
|
|
868
988
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
869
989
|
}
|
|
870
990
|
}
|
|
871
|
-
class
|
|
991
|
+
class hs {
|
|
872
992
|
constructor(e, t) {
|
|
873
993
|
if (!t)
|
|
874
994
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
875
995
|
this.name = T.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
876
996
|
}
|
|
877
997
|
decodePrimitive(e, t) {
|
|
878
|
-
const r = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {},
|
|
998
|
+
const r = this.json, s = this.dracoLoader, i = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
|
|
879
999
|
for (const d in n) {
|
|
880
|
-
const u =
|
|
1000
|
+
const u = pe[d] || d.toLowerCase();
|
|
881
1001
|
a[u] = n[d];
|
|
882
1002
|
}
|
|
883
1003
|
for (const d in e.attributes) {
|
|
884
|
-
const u =
|
|
1004
|
+
const u = pe[d] || d.toLowerCase();
|
|
885
1005
|
if (n[d] !== void 0) {
|
|
886
1006
|
const h = r.accessors[e.attributes[d]], f = H[h.componentType];
|
|
887
|
-
l[u] = f.name,
|
|
1007
|
+
l[u] = f.name, c[u] = h.normalized === !0;
|
|
888
1008
|
}
|
|
889
1009
|
}
|
|
890
1010
|
return t.getDependency("bufferView", i).then(function(d) {
|
|
891
1011
|
return new Promise(function(u, h) {
|
|
892
1012
|
s.decodeDracoFile(d, function(f) {
|
|
893
1013
|
for (const p in f.attributes) {
|
|
894
|
-
const A = f.attributes[p], m =
|
|
1014
|
+
const A = f.attributes[p], m = c[p];
|
|
895
1015
|
m !== void 0 && (A.normalized = m);
|
|
896
1016
|
}
|
|
897
1017
|
u(f);
|
|
@@ -900,7 +1020,7 @@ class Rs {
|
|
|
900
1020
|
});
|
|
901
1021
|
}
|
|
902
1022
|
}
|
|
903
|
-
class
|
|
1023
|
+
class fs {
|
|
904
1024
|
constructor() {
|
|
905
1025
|
this.name = T.KHR_TEXTURE_TRANSFORM;
|
|
906
1026
|
}
|
|
@@ -908,12 +1028,12 @@ class Es {
|
|
|
908
1028
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
909
1029
|
}
|
|
910
1030
|
}
|
|
911
|
-
class
|
|
1031
|
+
class ps {
|
|
912
1032
|
constructor() {
|
|
913
1033
|
this.name = T.KHR_MESH_QUANTIZATION;
|
|
914
1034
|
}
|
|
915
1035
|
}
|
|
916
|
-
class
|
|
1036
|
+
class We extends Gt {
|
|
917
1037
|
constructor(e, t, r, s) {
|
|
918
1038
|
super(e, t, r, s);
|
|
919
1039
|
}
|
|
@@ -924,22 +1044,22 @@ class Xe extends Bt {
|
|
|
924
1044
|
return t;
|
|
925
1045
|
}
|
|
926
1046
|
interpolate_(e, t, r, s) {
|
|
927
|
-
const i = this.resultBuffer, n = this.sampleValues, a = this.valueSize,
|
|
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;
|
|
928
1048
|
for (let E = 0; E !== a; E++) {
|
|
929
|
-
const b = n[A + E + a], M = n[A + E +
|
|
930
|
-
i[E] = R * b + w * M + m *
|
|
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;
|
|
931
1051
|
}
|
|
932
1052
|
return i;
|
|
933
1053
|
}
|
|
934
1054
|
}
|
|
935
|
-
const
|
|
936
|
-
class
|
|
1055
|
+
const ms = new Ue();
|
|
1056
|
+
class gs extends We {
|
|
937
1057
|
interpolate_(e, t, r, s) {
|
|
938
1058
|
const i = super.interpolate_(e, t, r, s);
|
|
939
|
-
return
|
|
1059
|
+
return ms.fromArray(i).normalize().toArray(i), i;
|
|
940
1060
|
}
|
|
941
1061
|
}
|
|
942
|
-
const
|
|
1062
|
+
const x = {
|
|
943
1063
|
FLOAT: 5126,
|
|
944
1064
|
//FLOAT_MAT2: 35674,
|
|
945
1065
|
FLOAT_MAT3: 35675,
|
|
@@ -966,18 +1086,18 @@ const L = {
|
|
|
966
1086
|
5123: Uint16Array,
|
|
967
1087
|
5125: Uint32Array,
|
|
968
1088
|
5126: Float32Array
|
|
969
|
-
}, be = {
|
|
970
|
-
9728: Ge,
|
|
971
|
-
9729: de,
|
|
972
|
-
9984: Ot,
|
|
973
|
-
9985: Nt,
|
|
974
|
-
9986: Dt,
|
|
975
|
-
9987: Ue
|
|
976
1089
|
}, Se = {
|
|
1090
|
+
9728: Ke,
|
|
1091
|
+
9729: he,
|
|
1092
|
+
9984: It,
|
|
1093
|
+
9985: Ot,
|
|
1094
|
+
9986: Nt,
|
|
1095
|
+
9987: je
|
|
1096
|
+
}, ve = {
|
|
977
1097
|
33071: Pt,
|
|
978
|
-
33648:
|
|
979
|
-
10497:
|
|
980
|
-
},
|
|
1098
|
+
33648: Dt,
|
|
1099
|
+
10497: fe
|
|
1100
|
+
}, oe = {
|
|
981
1101
|
SCALAR: 1,
|
|
982
1102
|
VEC2: 2,
|
|
983
1103
|
VEC3: 3,
|
|
@@ -985,7 +1105,7 @@ const L = {
|
|
|
985
1105
|
MAT2: 4,
|
|
986
1106
|
MAT3: 9,
|
|
987
1107
|
MAT4: 16
|
|
988
|
-
},
|
|
1108
|
+
}, pe = {
|
|
989
1109
|
POSITION: "position",
|
|
990
1110
|
NORMAL: "normal",
|
|
991
1111
|
TANGENT: "tangent",
|
|
@@ -1001,98 +1121,98 @@ const L = {
|
|
|
1001
1121
|
translation: "position",
|
|
1002
1122
|
rotation: "quaternion",
|
|
1003
1123
|
weights: "morphTargetInfluences"
|
|
1004
|
-
},
|
|
1124
|
+
}, As = {
|
|
1005
1125
|
CUBICSPLINE: void 0,
|
|
1006
1126
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1007
1127
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1008
|
-
LINEAR:
|
|
1009
|
-
STEP:
|
|
1010
|
-
},
|
|
1128
|
+
LINEAR: ze,
|
|
1129
|
+
STEP: kt
|
|
1130
|
+
}, ae = {
|
|
1011
1131
|
OPAQUE: "OPAQUE",
|
|
1012
1132
|
MASK: "MASK",
|
|
1013
1133
|
BLEND: "BLEND"
|
|
1014
1134
|
};
|
|
1015
|
-
function
|
|
1016
|
-
return
|
|
1135
|
+
function Ts(o) {
|
|
1136
|
+
return o.DefaultMaterial === void 0 && (o.DefaultMaterial = new Ve({
|
|
1017
1137
|
color: 16777215,
|
|
1018
1138
|
emissive: 0,
|
|
1019
1139
|
metalness: 1,
|
|
1020
1140
|
roughness: 1,
|
|
1021
1141
|
transparent: !1,
|
|
1022
1142
|
depthTest: !0,
|
|
1023
|
-
side:
|
|
1024
|
-
})),
|
|
1143
|
+
side: Ft
|
|
1144
|
+
})), o.DefaultMaterial;
|
|
1025
1145
|
}
|
|
1026
|
-
function
|
|
1146
|
+
function D(o, e, t) {
|
|
1027
1147
|
for (const r in t.extensions)
|
|
1028
|
-
|
|
1148
|
+
o[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
|
|
1029
1149
|
}
|
|
1030
|
-
function C(
|
|
1031
|
-
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(
|
|
1150
|
+
function C(o, e) {
|
|
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));
|
|
1032
1152
|
}
|
|
1033
|
-
function
|
|
1153
|
+
function _s(o, e, t) {
|
|
1034
1154
|
let r = !1, s = !1, i = !1;
|
|
1035
1155
|
for (let l = 0, d = e.length; l < d; l++) {
|
|
1036
1156
|
const u = e[l];
|
|
1037
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;
|
|
1038
1158
|
}
|
|
1039
|
-
if (!r && !s && !i) return Promise.resolve(
|
|
1040
|
-
const n = [], a = [],
|
|
1159
|
+
if (!r && !s && !i) return Promise.resolve(o);
|
|
1160
|
+
const n = [], a = [], c = [];
|
|
1041
1161
|
for (let l = 0, d = e.length; l < d; l++) {
|
|
1042
1162
|
const u = e[l];
|
|
1043
1163
|
if (r) {
|
|
1044
|
-
const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) :
|
|
1164
|
+
const h = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : o.attributes.position;
|
|
1045
1165
|
n.push(h);
|
|
1046
1166
|
}
|
|
1047
1167
|
if (s) {
|
|
1048
|
-
const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) :
|
|
1168
|
+
const h = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : o.attributes.normal;
|
|
1049
1169
|
a.push(h);
|
|
1050
1170
|
}
|
|
1051
1171
|
if (i) {
|
|
1052
|
-
const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) :
|
|
1053
|
-
|
|
1172
|
+
const h = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : o.attributes.color;
|
|
1173
|
+
c.push(h);
|
|
1054
1174
|
}
|
|
1055
1175
|
}
|
|
1056
1176
|
return Promise.all([
|
|
1057
1177
|
Promise.all(n),
|
|
1058
1178
|
Promise.all(a),
|
|
1059
|
-
Promise.all(
|
|
1179
|
+
Promise.all(c)
|
|
1060
1180
|
]).then(function(l) {
|
|
1061
1181
|
const d = l[0], u = l[1], h = l[2];
|
|
1062
|
-
return r && (
|
|
1182
|
+
return r && (o.morphAttributes.position = d), s && (o.morphAttributes.normal = u), i && (o.morphAttributes.color = h), o.morphTargetsRelative = !0, o;
|
|
1063
1183
|
});
|
|
1064
1184
|
}
|
|
1065
|
-
function
|
|
1066
|
-
if (
|
|
1185
|
+
function Rs(o, e) {
|
|
1186
|
+
if (o.updateMorphTargets(), e.weights !== void 0)
|
|
1067
1187
|
for (let t = 0, r = e.weights.length; t < r; t++)
|
|
1068
|
-
|
|
1188
|
+
o.morphTargetInfluences[t] = e.weights[t];
|
|
1069
1189
|
if (e.extras && Array.isArray(e.extras.targetNames)) {
|
|
1070
1190
|
const t = e.extras.targetNames;
|
|
1071
|
-
if (
|
|
1072
|
-
|
|
1191
|
+
if (o.morphTargetInfluences.length === t.length) {
|
|
1192
|
+
o.morphTargetDictionary = {};
|
|
1073
1193
|
for (let r = 0, s = t.length; r < s; r++)
|
|
1074
|
-
|
|
1194
|
+
o.morphTargetDictionary[t[r]] = r;
|
|
1075
1195
|
} else
|
|
1076
1196
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1077
1197
|
}
|
|
1078
1198
|
}
|
|
1079
|
-
function
|
|
1199
|
+
function Es(o) {
|
|
1080
1200
|
let e;
|
|
1081
|
-
const t =
|
|
1082
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
1083
|
-
for (let r = 0, s =
|
|
1084
|
-
e += ":" +
|
|
1201
|
+
const t = o.extensions && o.extensions[T.KHR_DRACO_MESH_COMPRESSION];
|
|
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]);
|
|
1085
1205
|
return e;
|
|
1086
1206
|
}
|
|
1087
|
-
function
|
|
1207
|
+
function ce(o) {
|
|
1088
1208
|
let e = "";
|
|
1089
|
-
const t = Object.keys(
|
|
1209
|
+
const t = Object.keys(o).sort();
|
|
1090
1210
|
for (let r = 0, s = t.length; r < s; r++)
|
|
1091
|
-
e += t[r] + ":" +
|
|
1211
|
+
e += t[r] + ":" + o[t[r]] + ";";
|
|
1092
1212
|
return e;
|
|
1093
1213
|
}
|
|
1094
|
-
function
|
|
1095
|
-
switch (
|
|
1214
|
+
function me(o) {
|
|
1215
|
+
switch (o) {
|
|
1096
1216
|
case Int8Array:
|
|
1097
1217
|
return 1 / 127;
|
|
1098
1218
|
case Uint8Array:
|
|
@@ -1105,21 +1225,21 @@ function ge(c) {
|
|
|
1105
1225
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1106
1226
|
}
|
|
1107
1227
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1228
|
+
function ws(o) {
|
|
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";
|
|
1110
1230
|
}
|
|
1111
|
-
const
|
|
1112
|
-
class
|
|
1231
|
+
const xs = new Y();
|
|
1232
|
+
class ys {
|
|
1113
1233
|
constructor(e = {}, t = {}) {
|
|
1114
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
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 = {};
|
|
1115
1235
|
let r = !1, s = -1, i = !1, n = -1;
|
|
1116
1236
|
if (typeof navigator < "u") {
|
|
1117
1237
|
const a = navigator.userAgent;
|
|
1118
1238
|
r = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
1119
|
-
const
|
|
1120
|
-
s = r &&
|
|
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;
|
|
1121
1241
|
}
|
|
1122
|
-
typeof createImageBitmap > "u" || r && s < 17 || i && n < 98 ? this.textureLoader = new
|
|
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);
|
|
1123
1243
|
}
|
|
1124
1244
|
setExtensions(e) {
|
|
1125
1245
|
this.extensions = e;
|
|
@@ -1149,11 +1269,11 @@ class Os {
|
|
|
1149
1269
|
parser: r,
|
|
1150
1270
|
userData: {}
|
|
1151
1271
|
};
|
|
1152
|
-
return
|
|
1153
|
-
return
|
|
1272
|
+
return D(i, a, s), C(a, s), Promise.all(r._invokeAll(function(c) {
|
|
1273
|
+
return c.afterRoot && c.afterRoot(a);
|
|
1154
1274
|
})).then(function() {
|
|
1155
|
-
for (const
|
|
1156
|
-
|
|
1275
|
+
for (const c of a.scenes)
|
|
1276
|
+
c.updateMatrixWorld();
|
|
1157
1277
|
e(a);
|
|
1158
1278
|
});
|
|
1159
1279
|
}).catch(t);
|
|
@@ -1165,7 +1285,7 @@ class Os {
|
|
|
1165
1285
|
const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
|
|
1166
1286
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
1167
1287
|
const n = t[s].joints;
|
|
1168
|
-
for (let a = 0,
|
|
1288
|
+
for (let a = 0, c = n.length; a < c; a++)
|
|
1169
1289
|
e[n[a]].isBone = !0;
|
|
1170
1290
|
}
|
|
1171
1291
|
for (let s = 0, i = e.length; s < i; s++) {
|
|
@@ -1199,8 +1319,8 @@ class Os {
|
|
|
1199
1319
|
_getNodeRef(e, t, r) {
|
|
1200
1320
|
if (e.refs[t] <= 1) return r;
|
|
1201
1321
|
const s = r.clone(), i = (n, a) => {
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1322
|
+
const c = this.associations.get(n);
|
|
1323
|
+
c != null && this.associations.set(a, c);
|
|
1204
1324
|
for (const [l, d] of n.children.entries())
|
|
1205
1325
|
i(d, a.children[l]);
|
|
1206
1326
|
};
|
|
@@ -1320,7 +1440,7 @@ class Os {
|
|
|
1320
1440
|
return Promise.resolve(this.extensions[T.KHR_BINARY_GLTF].body);
|
|
1321
1441
|
const s = this.options;
|
|
1322
1442
|
return new Promise(function(i, n) {
|
|
1323
|
-
r.load(
|
|
1443
|
+
r.load(V.resolveURL(t.uri, s.path), i, void 0, function() {
|
|
1324
1444
|
n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1325
1445
|
});
|
|
1326
1446
|
});
|
|
@@ -1345,25 +1465,25 @@ class Os {
|
|
|
1345
1465
|
loadAccessor(e) {
|
|
1346
1466
|
const t = this, r = this.json, s = this.json.accessors[e];
|
|
1347
1467
|
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
1348
|
-
const n =
|
|
1349
|
-
return Promise.resolve(new K(l, n,
|
|
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));
|
|
1350
1470
|
}
|
|
1351
1471
|
const i = [];
|
|
1352
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) {
|
|
1353
|
-
const a = n[0],
|
|
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;
|
|
1354
1474
|
let A, m;
|
|
1355
1475
|
if (f && f !== u) {
|
|
1356
1476
|
const g = Math.floor(h / f), R = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + g + ":" + s.count;
|
|
1357
1477
|
let w = t.cache.get(R);
|
|
1358
|
-
w || (A = new l(a, g * f, s.count * f / d), w = new
|
|
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);
|
|
1359
1479
|
} else
|
|
1360
|
-
a === null ? A = new l(s.count *
|
|
1480
|
+
a === null ? A = new l(s.count * c) : A = new l(a, h, s.count * c), m = new K(A, c, p);
|
|
1361
1481
|
if (s.sparse !== void 0) {
|
|
1362
|
-
const g =
|
|
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);
|
|
1363
1483
|
a !== null && (m = new K(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
1364
|
-
for (let
|
|
1365
|
-
const I = b[
|
|
1366
|
-
if (m.setX(I, M[
|
|
1484
|
+
for (let y = 0, U = b.length; y < U; y++) {
|
|
1485
|
+
const I = b[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.");
|
|
1367
1487
|
}
|
|
1368
1488
|
m.normalized = p;
|
|
1369
1489
|
}
|
|
@@ -1379,50 +1499,50 @@ class Os {
|
|
|
1379
1499
|
const t = this.json, r = this.options, i = t.textures[e].source, n = t.images[i];
|
|
1380
1500
|
let a = this.textureLoader;
|
|
1381
1501
|
if (n.uri) {
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1502
|
+
const c = r.manager.getHandler(n.uri);
|
|
1503
|
+
c !== null && (a = c);
|
|
1384
1504
|
}
|
|
1385
1505
|
return this.loadTextureImage(e, i, a);
|
|
1386
1506
|
}
|
|
1387
1507
|
loadTextureImage(e, t, r) {
|
|
1388
|
-
const s = this, i = this.json, n = i.textures[e], a = i.images[t],
|
|
1389
|
-
if (this.textureCache[
|
|
1390
|
-
return this.textureCache[
|
|
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];
|
|
1391
1511
|
const l = this.loadImageSource(t, r).then(function(d) {
|
|
1392
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);
|
|
1393
1513
|
const h = (i.samplers || {})[n.sampler] || {};
|
|
1394
|
-
return d.magFilter =
|
|
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;
|
|
1395
1515
|
}).catch(function() {
|
|
1396
1516
|
return null;
|
|
1397
1517
|
});
|
|
1398
|
-
return this.textureCache[
|
|
1518
|
+
return this.textureCache[c] = l, l;
|
|
1399
1519
|
}
|
|
1400
1520
|
loadImageSource(e, t) {
|
|
1401
1521
|
const r = this, s = this.json, i = this.options;
|
|
1402
1522
|
if (this.sourceCache[e] !== void 0)
|
|
1403
1523
|
return this.sourceCache[e].then((u) => u.clone());
|
|
1404
1524
|
const n = s.images[e], a = self.URL || self.webkitURL;
|
|
1405
|
-
let
|
|
1525
|
+
let c = n.uri || "", l = !1;
|
|
1406
1526
|
if (n.bufferView !== void 0)
|
|
1407
|
-
|
|
1527
|
+
c = r.getDependency("bufferView", n.bufferView).then(function(u) {
|
|
1408
1528
|
l = !0;
|
|
1409
1529
|
const h = new Blob([u], { type: n.mimeType });
|
|
1410
|
-
return
|
|
1530
|
+
return c = a.createObjectURL(h), c;
|
|
1411
1531
|
});
|
|
1412
1532
|
else if (n.uri === void 0)
|
|
1413
1533
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1414
|
-
const d = Promise.resolve(
|
|
1534
|
+
const d = Promise.resolve(c).then(function(u) {
|
|
1415
1535
|
return new Promise(function(h, f) {
|
|
1416
1536
|
let p = h;
|
|
1417
1537
|
t.isImageBitmapLoader === !0 && (p = function(A) {
|
|
1418
|
-
const m = new
|
|
1538
|
+
const m = new Ee(A);
|
|
1419
1539
|
m.needsUpdate = !0, h(m);
|
|
1420
|
-
}), t.load(
|
|
1540
|
+
}), t.load(V.resolveURL(u, i.path), p, void 0, f);
|
|
1421
1541
|
});
|
|
1422
1542
|
}).then(function(u) {
|
|
1423
|
-
return l === !0 && a.revokeObjectURL(
|
|
1543
|
+
return l === !0 && a.revokeObjectURL(c), C(u, n), u.userData.mimeType = n.mimeType || ws(n.uri), u;
|
|
1424
1544
|
}).catch(function(u) {
|
|
1425
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture",
|
|
1545
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", c), u;
|
|
1426
1546
|
});
|
|
1427
1547
|
return this.sourceCache[e] = d, d;
|
|
1428
1548
|
}
|
|
@@ -1442,8 +1562,8 @@ class Os {
|
|
|
1442
1562
|
if (r.texCoord !== void 0 && r.texCoord > 0 && (n = n.clone(), n.channel = r.texCoord), i.extensions[T.KHR_TEXTURE_TRANSFORM]) {
|
|
1443
1563
|
const a = r.extensions !== void 0 ? r.extensions[T.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1444
1564
|
if (a) {
|
|
1445
|
-
const
|
|
1446
|
-
n = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), i.associations.set(n,
|
|
1565
|
+
const c = i.associations.get(n);
|
|
1566
|
+
n = i.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), i.associations.set(n, c);
|
|
1447
1567
|
}
|
|
1448
1568
|
}
|
|
1449
1569
|
return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
|
|
@@ -1463,23 +1583,23 @@ class Os {
|
|
|
1463
1583
|
const s = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
|
|
1464
1584
|
if (e.isPoints) {
|
|
1465
1585
|
const a = "PointsMaterial:" + r.uuid;
|
|
1466
|
-
let
|
|
1467
|
-
|
|
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;
|
|
1468
1588
|
} else if (e.isLine) {
|
|
1469
1589
|
const a = "LineBasicMaterial:" + r.uuid;
|
|
1470
|
-
let
|
|
1471
|
-
|
|
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;
|
|
1472
1592
|
}
|
|
1473
1593
|
if (s || i || n) {
|
|
1474
1594
|
let a = "ClonedMaterial:" + r.uuid + ":";
|
|
1475
1595
|
s && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), n && (a += "flat-shading:");
|
|
1476
|
-
let
|
|
1477
|
-
|
|
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;
|
|
1478
1598
|
}
|
|
1479
1599
|
e.material = r;
|
|
1480
1600
|
}
|
|
1481
1601
|
getMaterialType() {
|
|
1482
|
-
return
|
|
1602
|
+
return Ve;
|
|
1483
1603
|
}
|
|
1484
1604
|
/**
|
|
1485
1605
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1489,13 +1609,13 @@ class Os {
|
|
|
1489
1609
|
loadMaterial(e) {
|
|
1490
1610
|
const t = this, r = this.json, s = this.extensions, i = r.materials[e];
|
|
1491
1611
|
let n;
|
|
1492
|
-
const a = {},
|
|
1493
|
-
if (
|
|
1612
|
+
const a = {}, c = i.extensions || {}, l = [];
|
|
1613
|
+
if (c[T.KHR_MATERIALS_UNLIT]) {
|
|
1494
1614
|
const u = s[T.KHR_MATERIALS_UNLIT];
|
|
1495
1615
|
n = u.getMaterialType(), l.push(u.extendParams(a, i, t));
|
|
1496
1616
|
} else {
|
|
1497
1617
|
const u = i.pbrMetallicRoughness || {};
|
|
1498
|
-
if (a.color = new
|
|
1618
|
+
if (a.color = new P(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
1499
1619
|
const h = u.baseColorFactor;
|
|
1500
1620
|
a.color.setRGB(h[0], h[1], h[2], S), a.opacity = h[3];
|
|
1501
1621
|
}
|
|
@@ -1505,19 +1625,19 @@ class Os {
|
|
|
1505
1625
|
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
1506
1626
|
})));
|
|
1507
1627
|
}
|
|
1508
|
-
i.doubleSided === !0 && (a.side =
|
|
1509
|
-
const d = i.alphaMode ||
|
|
1510
|
-
if (d ===
|
|
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)) {
|
|
1511
1631
|
const u = i.normalTexture.scale;
|
|
1512
1632
|
a.normalScale.set(u, u);
|
|
1513
1633
|
}
|
|
1514
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) {
|
|
1515
1635
|
const u = i.emissiveFactor;
|
|
1516
|
-
a.emissive = new
|
|
1636
|
+
a.emissive = new P().setRGB(u[0], u[1], u[2], S);
|
|
1517
1637
|
}
|
|
1518
1638
|
return i.emissiveTexture !== void 0 && n !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, N)), Promise.all(l).then(function() {
|
|
1519
1639
|
const u = new n(a);
|
|
1520
|
-
return i.name && (u.name = i.name), C(u, i), t.associations.set(u, { materials: e }), i.extensions &&
|
|
1640
|
+
return i.name && (u.name = i.name), C(u, i), t.associations.set(u, { materials: e }), i.extensions && D(s, u, i), u;
|
|
1521
1641
|
});
|
|
1522
1642
|
}
|
|
1523
1643
|
/**
|
|
@@ -1527,7 +1647,7 @@ class Os {
|
|
|
1527
1647
|
* @return {String}
|
|
1528
1648
|
*/
|
|
1529
1649
|
createUniqueName(e) {
|
|
1530
|
-
const t =
|
|
1650
|
+
const t = Tt.sanitizeNodeName(e || "");
|
|
1531
1651
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1532
1652
|
}
|
|
1533
1653
|
/**
|
|
@@ -1541,18 +1661,18 @@ class Os {
|
|
|
1541
1661
|
loadGeometries(e) {
|
|
1542
1662
|
const t = this, r = this.extensions, s = this.primitiveCache;
|
|
1543
1663
|
function i(a) {
|
|
1544
|
-
return r[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(
|
|
1545
|
-
return
|
|
1664
|
+
return r[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
|
|
1665
|
+
return Ce(c, a, t);
|
|
1546
1666
|
});
|
|
1547
1667
|
}
|
|
1548
1668
|
const n = [];
|
|
1549
|
-
for (let a = 0,
|
|
1550
|
-
const l = e[a], d =
|
|
1669
|
+
for (let a = 0, c = e.length; a < c; a++) {
|
|
1670
|
+
const l = e[a], d = Es(l), u = s[d];
|
|
1551
1671
|
if (u)
|
|
1552
1672
|
n.push(u.promise);
|
|
1553
1673
|
else {
|
|
1554
1674
|
let h;
|
|
1555
|
-
l.extensions && l.extensions[T.KHR_DRACO_MESH_COMPRESSION] ? h = i(l) : 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);
|
|
1556
1676
|
}
|
|
1557
1677
|
}
|
|
1558
1678
|
return Promise.all(n);
|
|
@@ -1564,29 +1684,29 @@ class Os {
|
|
|
1564
1684
|
*/
|
|
1565
1685
|
loadMesh(e) {
|
|
1566
1686
|
const t = this, r = this.json, s = this.extensions, i = r.meshes[e], n = i.primitives, a = [];
|
|
1567
|
-
for (let
|
|
1568
|
-
const d = n[
|
|
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);
|
|
1569
1689
|
a.push(d);
|
|
1570
1690
|
}
|
|
1571
|
-
return a.push(t.loadGeometries(n)), Promise.all(a).then(function(
|
|
1572
|
-
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 = [];
|
|
1573
1693
|
for (let f = 0, p = d.length; f < p; f++) {
|
|
1574
1694
|
const A = d[f], m = n[f];
|
|
1575
1695
|
let g;
|
|
1576
1696
|
const R = l[f];
|
|
1577
|
-
if (m.mode ===
|
|
1578
|
-
g = i.isSkinnedMesh === !0 ? new
|
|
1579
|
-
else if (m.mode ===
|
|
1697
|
+
if (m.mode === x.TRIANGLES || m.mode === x.TRIANGLE_STRIP || m.mode === x.TRIANGLE_FAN || m.mode === void 0)
|
|
1698
|
+
g = i.isSkinnedMesh === !0 ? new _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
|
+
else if (m.mode === x.LINES)
|
|
1700
|
+
g = new Et(A, R);
|
|
1701
|
+
else if (m.mode === x.LINE_STRIP)
|
|
1580
1702
|
g = new wt(A, R);
|
|
1581
|
-
else if (m.mode ===
|
|
1582
|
-
g = new Lt(A, R);
|
|
1583
|
-
else if (m.mode === L.LINE_LOOP)
|
|
1703
|
+
else if (m.mode === x.LINE_LOOP)
|
|
1584
1704
|
g = new xt(A, R);
|
|
1585
|
-
else if (m.mode ===
|
|
1705
|
+
else if (m.mode === x.POINTS)
|
|
1586
1706
|
g = new yt(A, R);
|
|
1587
1707
|
else
|
|
1588
1708
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
1589
|
-
Object.keys(g.geometry.morphAttributes).length > 0 &&
|
|
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);
|
|
1590
1710
|
}
|
|
1591
1711
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1592
1712
|
t.associations.set(u[f], {
|
|
@@ -1594,9 +1714,9 @@ class Os {
|
|
|
1594
1714
|
primitives: f
|
|
1595
1715
|
});
|
|
1596
1716
|
if (u.length === 1)
|
|
1597
|
-
return i.extensions &&
|
|
1598
|
-
const h = new
|
|
1599
|
-
i.extensions &&
|
|
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 });
|
|
1600
1720
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1601
1721
|
h.add(u[f]);
|
|
1602
1722
|
return h;
|
|
@@ -1614,7 +1734,7 @@ class Os {
|
|
|
1614
1734
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1615
1735
|
return;
|
|
1616
1736
|
}
|
|
1617
|
-
return r.type === "perspective" ? t = new bt
|
|
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);
|
|
1618
1738
|
}
|
|
1619
1739
|
/**
|
|
1620
1740
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1626,17 +1746,17 @@ class Os {
|
|
|
1626
1746
|
for (let s = 0, i = t.joints.length; s < i; s++)
|
|
1627
1747
|
r.push(this._loadNodeShallow(t.joints[s]));
|
|
1628
1748
|
return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(s) {
|
|
1629
|
-
const i = s.pop(), n = s, a = [],
|
|
1749
|
+
const i = s.pop(), n = s, a = [], c = [];
|
|
1630
1750
|
for (let l = 0, d = n.length; l < d; l++) {
|
|
1631
1751
|
const u = n[l];
|
|
1632
1752
|
if (u) {
|
|
1633
1753
|
a.push(u);
|
|
1634
|
-
const h = new
|
|
1635
|
-
i !== null && h.fromArray(i.array, l * 16),
|
|
1754
|
+
const h = new Y();
|
|
1755
|
+
i !== null && h.fromArray(i.array, l * 16), c.push(h);
|
|
1636
1756
|
} else
|
|
1637
1757
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
|
|
1638
1758
|
}
|
|
1639
|
-
return new
|
|
1759
|
+
return new vt(a, c);
|
|
1640
1760
|
});
|
|
1641
1761
|
}
|
|
1642
1762
|
/**
|
|
@@ -1645,29 +1765,29 @@ class Os {
|
|
|
1645
1765
|
* @return {Promise<AnimationClip>}
|
|
1646
1766
|
*/
|
|
1647
1767
|
loadAnimation(e) {
|
|
1648
|
-
const t = this.json, r = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, n = [], a = [],
|
|
1768
|
+
const t = this.json, r = this, s = t.animations[e], i = s.name ? s.name : "animation_" + e, n = [], a = [], c = [], l = [], d = [];
|
|
1649
1769
|
for (let u = 0, h = s.channels.length; u < h; u++) {
|
|
1650
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;
|
|
1651
|
-
A.node !== void 0 && (n.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", g)),
|
|
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));
|
|
1652
1772
|
}
|
|
1653
1773
|
return Promise.all([
|
|
1654
1774
|
Promise.all(n),
|
|
1655
1775
|
Promise.all(a),
|
|
1656
|
-
Promise.all(
|
|
1776
|
+
Promise.all(c),
|
|
1657
1777
|
Promise.all(l),
|
|
1658
1778
|
Promise.all(d)
|
|
1659
1779
|
]).then(function(u) {
|
|
1660
1780
|
const h = u[0], f = u[1], p = u[2], A = u[3], m = u[4], g = [];
|
|
1661
1781
|
for (let R = 0, w = h.length; R < w; R++) {
|
|
1662
|
-
const E = h[R], b = f[R], M = p[R],
|
|
1782
|
+
const E = h[R], b = f[R], M = p[R], y = A[R], U = m[R];
|
|
1663
1783
|
if (E === void 0) continue;
|
|
1664
1784
|
E.updateMatrix && E.updateMatrix();
|
|
1665
|
-
const I = r._createAnimationTracks(E, b, M,
|
|
1785
|
+
const I = r._createAnimationTracks(E, b, M, y, U);
|
|
1666
1786
|
if (I)
|
|
1667
|
-
for (let
|
|
1668
|
-
g.push(I[
|
|
1787
|
+
for (let te = 0; te < I.length; te++)
|
|
1788
|
+
g.push(I[te]);
|
|
1669
1789
|
}
|
|
1670
|
-
return new
|
|
1790
|
+
return new Ct(i, void 0, g);
|
|
1671
1791
|
});
|
|
1672
1792
|
}
|
|
1673
1793
|
createNodeMesh(e) {
|
|
@@ -1676,8 +1796,8 @@ class Os {
|
|
|
1676
1796
|
const n = r._getNodeRef(r.meshCache, s.mesh, i);
|
|
1677
1797
|
return s.weights !== void 0 && n.traverse(function(a) {
|
|
1678
1798
|
if (a.isMesh)
|
|
1679
|
-
for (let
|
|
1680
|
-
a.morphTargetInfluences[
|
|
1799
|
+
for (let c = 0, l = s.weights.length; c < l; c++)
|
|
1800
|
+
a.morphTargetInfluences[c] = s.weights[c];
|
|
1681
1801
|
}), n;
|
|
1682
1802
|
});
|
|
1683
1803
|
}
|
|
@@ -1690,15 +1810,15 @@ class Os {
|
|
|
1690
1810
|
const t = this.json, r = this, s = t.nodes[e], i = r._loadNodeShallow(e), n = [], a = s.children || [];
|
|
1691
1811
|
for (let l = 0, d = a.length; l < d; l++)
|
|
1692
1812
|
n.push(r.getDependency("node", a[l]));
|
|
1693
|
-
const
|
|
1813
|
+
const c = s.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", s.skin);
|
|
1694
1814
|
return Promise.all([
|
|
1695
1815
|
i,
|
|
1696
1816
|
Promise.all(n),
|
|
1697
|
-
|
|
1817
|
+
c
|
|
1698
1818
|
]).then(function(l) {
|
|
1699
1819
|
const d = l[0], u = l[1], h = l[2];
|
|
1700
1820
|
h !== null && d.traverse(function(f) {
|
|
1701
|
-
f.isSkinnedMesh && f.bind(h,
|
|
1821
|
+
f.isSkinnedMesh && f.bind(h, xs);
|
|
1702
1822
|
});
|
|
1703
1823
|
for (let f = 0, p = u.length; f < p; f++)
|
|
1704
1824
|
d.add(u[f]);
|
|
@@ -1711,10 +1831,10 @@ class Os {
|
|
|
1711
1831
|
const t = this.json, r = this.extensions, s = this;
|
|
1712
1832
|
if (this.nodeCache[e] !== void 0)
|
|
1713
1833
|
return this.nodeCache[e];
|
|
1714
|
-
const i = t.nodes[e], n = i.name ? s.createUniqueName(i.name) : "", a = [],
|
|
1834
|
+
const i = t.nodes[e], n = i.name ? s.createUniqueName(i.name) : "", a = [], c = s._invokeOne(function(l) {
|
|
1715
1835
|
return l.createNodeMesh && l.createNodeMesh(e);
|
|
1716
1836
|
});
|
|
1717
|
-
return
|
|
1837
|
+
return c && a.push(c), i.camera !== void 0 && a.push(s.getDependency("camera", i.camera).then(function(l) {
|
|
1718
1838
|
return s._getNodeRef(s.cameraCache, i.camera, l);
|
|
1719
1839
|
})), s._invokeAll(function(l) {
|
|
1720
1840
|
return l.createNodeAttachment && l.createNodeAttachment(e);
|
|
@@ -1722,11 +1842,11 @@ class Os {
|
|
|
1722
1842
|
a.push(l);
|
|
1723
1843
|
}), this.nodeCache[e] = Promise.all(a).then(function(l) {
|
|
1724
1844
|
let d;
|
|
1725
|
-
if (i.isBone === !0 ? d = new
|
|
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])
|
|
1726
1846
|
for (let u = 0, h = l.length; u < h; u++)
|
|
1727
1847
|
d.add(l[u]);
|
|
1728
|
-
if (i.name && (d.userData.name = i.name, d.name = n), C(d, i), i.extensions &&
|
|
1729
|
-
const u = new
|
|
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();
|
|
1730
1850
|
u.fromArray(i.matrix), d.applyMatrix4(u);
|
|
1731
1851
|
} else
|
|
1732
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);
|
|
@@ -1739,18 +1859,18 @@ class Os {
|
|
|
1739
1859
|
* @return {Promise<Group>}
|
|
1740
1860
|
*/
|
|
1741
1861
|
loadScene(e) {
|
|
1742
|
-
const t = this.extensions, r = this.json.scenes[e], s = this, i = new
|
|
1743
|
-
r.name && (i.name = s.createUniqueName(r.name)), C(i, r), r.extensions &&
|
|
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);
|
|
1744
1864
|
const n = r.nodes || [], a = [];
|
|
1745
|
-
for (let
|
|
1746
|
-
a.push(s.getDependency("node", n[
|
|
1747
|
-
return Promise.all(a).then(function(
|
|
1748
|
-
for (let d = 0, u =
|
|
1749
|
-
i.add(
|
|
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]);
|
|
1750
1870
|
const l = (d) => {
|
|
1751
1871
|
const u = /* @__PURE__ */ new Map();
|
|
1752
1872
|
for (const [h, f] of s.associations)
|
|
1753
|
-
(h instanceof
|
|
1873
|
+
(h instanceof ne || h instanceof Ee) && u.set(h, f);
|
|
1754
1874
|
return d.traverse((h) => {
|
|
1755
1875
|
const f = s.associations.get(h);
|
|
1756
1876
|
f != null && u.set(h, f);
|
|
@@ -1760,39 +1880,39 @@ class Os {
|
|
|
1760
1880
|
});
|
|
1761
1881
|
}
|
|
1762
1882
|
_createAnimationTracks(e, t, r, s, i) {
|
|
1763
|
-
const n = [], a = e.name ? e.name : e.uuid,
|
|
1883
|
+
const n = [], a = e.name ? e.name : e.uuid, c = [];
|
|
1764
1884
|
O[i.path] === O.weights ? e.traverse(function(h) {
|
|
1765
|
-
h.morphTargetInfluences &&
|
|
1766
|
-
}) :
|
|
1885
|
+
h.morphTargetInfluences && c.push(h.name ? h.name : h.uuid);
|
|
1886
|
+
}) : c.push(a);
|
|
1767
1887
|
let l;
|
|
1768
1888
|
switch (O[i.path]) {
|
|
1769
1889
|
case O.weights:
|
|
1770
|
-
l =
|
|
1890
|
+
l = xe;
|
|
1771
1891
|
break;
|
|
1772
1892
|
case O.rotation:
|
|
1773
|
-
l =
|
|
1893
|
+
l = ye;
|
|
1774
1894
|
break;
|
|
1775
1895
|
case O.position:
|
|
1776
1896
|
case O.scale:
|
|
1777
|
-
l =
|
|
1897
|
+
l = we;
|
|
1778
1898
|
break;
|
|
1779
1899
|
default:
|
|
1780
1900
|
switch (r.itemSize) {
|
|
1781
1901
|
case 1:
|
|
1782
|
-
l =
|
|
1902
|
+
l = xe;
|
|
1783
1903
|
break;
|
|
1784
1904
|
case 2:
|
|
1785
1905
|
case 3:
|
|
1786
1906
|
default:
|
|
1787
|
-
l =
|
|
1907
|
+
l = we;
|
|
1788
1908
|
break;
|
|
1789
1909
|
}
|
|
1790
1910
|
break;
|
|
1791
1911
|
}
|
|
1792
|
-
const d = s.interpolation !== void 0 ?
|
|
1793
|
-
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++) {
|
|
1794
1914
|
const p = new l(
|
|
1795
|
-
|
|
1915
|
+
c[h] + "." + O[i.path],
|
|
1796
1916
|
t.array,
|
|
1797
1917
|
u,
|
|
1798
1918
|
d
|
|
@@ -1804,7 +1924,7 @@ class Os {
|
|
|
1804
1924
|
_getArrayFromAccessor(e) {
|
|
1805
1925
|
let t = e.array;
|
|
1806
1926
|
if (e.normalized) {
|
|
1807
|
-
const r =
|
|
1927
|
+
const r = me(t.constructor), s = new Float32Array(t.length);
|
|
1808
1928
|
for (let i = 0, n = t.length; i < n; i++)
|
|
1809
1929
|
s[i] = t[i] * r;
|
|
1810
1930
|
t = s;
|
|
@@ -1813,315 +1933,195 @@ class Os {
|
|
|
1813
1933
|
}
|
|
1814
1934
|
_createCubicSplineTrackInterpolant(e) {
|
|
1815
1935
|
e.createInterpolant = function(r) {
|
|
1816
|
-
const s = this instanceof
|
|
1936
|
+
const s = this instanceof ye ? gs : We;
|
|
1817
1937
|
return new s(this.times, this.values, this.getValueSize() / 3, r);
|
|
1818
1938
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1819
1939
|
}
|
|
1820
1940
|
}
|
|
1821
|
-
function
|
|
1822
|
-
const r = e.attributes, s = new
|
|
1941
|
+
function Ls(o, e, t) {
|
|
1942
|
+
const r = e.attributes, s = new Ht();
|
|
1823
1943
|
if (r.POSITION !== void 0) {
|
|
1824
|
-
const a = t.json.accessors[r.POSITION],
|
|
1825
|
-
if (
|
|
1944
|
+
const a = t.json.accessors[r.POSITION], c = a.min, l = a.max;
|
|
1945
|
+
if (c !== void 0 && l !== void 0) {
|
|
1826
1946
|
if (s.set(
|
|
1827
|
-
new F(
|
|
1947
|
+
new F(c[0], c[1], c[2]),
|
|
1828
1948
|
new F(l[0], l[1], l[2])
|
|
1829
1949
|
), a.normalized) {
|
|
1830
|
-
const d =
|
|
1950
|
+
const d = me(H[a.componentType]);
|
|
1831
1951
|
s.min.multiplyScalar(d), s.max.multiplyScalar(d);
|
|
1832
|
-
}
|
|
1833
|
-
} else {
|
|
1834
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1835
|
-
return;
|
|
1836
|
-
}
|
|
1837
|
-
} else
|
|
1838
|
-
return;
|
|
1839
|
-
const i = e.targets;
|
|
1840
|
-
if (i !== void 0) {
|
|
1841
|
-
const a = new F(), o = new F();
|
|
1842
|
-
for (let l = 0, d = i.length; l < d; l++) {
|
|
1843
|
-
const u = i[l];
|
|
1844
|
-
if (u.POSITION !== void 0) {
|
|
1845
|
-
const h = t.json.accessors[u.POSITION], f = h.min, p = h.max;
|
|
1846
|
-
if (f !== void 0 && p !== void 0) {
|
|
1847
|
-
if (o.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), o.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), o.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
|
|
1848
|
-
const A = ge(H[h.componentType]);
|
|
1849
|
-
o.multiplyScalar(A);
|
|
1850
|
-
}
|
|
1851
|
-
a.max(o);
|
|
1852
|
-
} else
|
|
1853
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
s.expandByVector(a);
|
|
1857
|
-
}
|
|
1858
|
-
c.boundingBox = s;
|
|
1859
|
-
const n = new Gt();
|
|
1860
|
-
s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, c.boundingSphere = n;
|
|
1861
|
-
}
|
|
1862
|
-
function ve(c, e, t) {
|
|
1863
|
-
const r = e.attributes, s = [];
|
|
1864
|
-
function i(n, a) {
|
|
1865
|
-
return t.getDependency("accessor", n).then(function(o) {
|
|
1866
|
-
c.setAttribute(a, o);
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
for (const n in r) {
|
|
1870
|
-
const a = me[n] || n.toLowerCase();
|
|
1871
|
-
a in c.attributes || s.push(i(r[n], a));
|
|
1872
|
-
}
|
|
1873
|
-
if (e.indices !== void 0 && !c.index) {
|
|
1874
|
-
const n = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1875
|
-
c.setIndex(a);
|
|
1876
|
-
});
|
|
1877
|
-
s.push(n);
|
|
1878
|
-
}
|
|
1879
|
-
return fe.workingColorSpace !== S && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${fe.workingColorSpace}" not supported.`), C(c, e), Ns(c, e, t), Promise.all(s).then(function() {
|
|
1880
|
-
return e.targets !== void 0 ? Ss(c, e.targets, t) : c;
|
|
1881
|
-
});
|
|
1882
|
-
}
|
|
1883
|
-
const ae = /* @__PURE__ */ new WeakMap();
|
|
1884
|
-
class Ds extends De {
|
|
1885
|
-
constructor(e) {
|
|
1886
|
-
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
1887
|
-
position: "POSITION",
|
|
1888
|
-
normal: "NORMAL",
|
|
1889
|
-
color: "COLOR",
|
|
1890
|
-
uv: "TEX_COORD"
|
|
1891
|
-
}, this.defaultAttributeTypes = {
|
|
1892
|
-
position: "Float32Array",
|
|
1893
|
-
normal: "Float32Array",
|
|
1894
|
-
color: "Float32Array",
|
|
1895
|
-
uv: "Float32Array"
|
|
1896
|
-
};
|
|
1897
|
-
}
|
|
1898
|
-
setDecoderPath(e) {
|
|
1899
|
-
return this.decoderPath = e, this;
|
|
1900
|
-
}
|
|
1901
|
-
setDecoderConfig(e) {
|
|
1902
|
-
return this.decoderConfig = e, this;
|
|
1903
|
-
}
|
|
1904
|
-
setWorkerLimit(e) {
|
|
1905
|
-
return this.workerLimit = e, this;
|
|
1906
|
-
}
|
|
1907
|
-
load(e, t, r, s) {
|
|
1908
|
-
const i = new $(this.manager);
|
|
1909
|
-
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (n) => {
|
|
1910
|
-
this.parse(n, t, s);
|
|
1911
|
-
}, r, s);
|
|
1912
|
-
}
|
|
1913
|
-
parse(e, t, r = () => {
|
|
1914
|
-
}) {
|
|
1915
|
-
this.decodeDracoFile(e, t, null, null, N, r).catch(r);
|
|
1916
|
-
}
|
|
1917
|
-
decodeDracoFile(e, t, r, s, i = S, n = () => {
|
|
1918
|
-
}) {
|
|
1919
|
-
const a = {
|
|
1920
|
-
attributeIDs: r || this.defaultAttributeIDs,
|
|
1921
|
-
attributeTypes: s || this.defaultAttributeTypes,
|
|
1922
|
-
useUniqueIDs: !!r,
|
|
1923
|
-
vertexColorSpace: i
|
|
1924
|
-
};
|
|
1925
|
-
return this.decodeGeometry(e, a).then(t).catch(n);
|
|
1926
|
-
}
|
|
1927
|
-
decodeGeometry(e, t) {
|
|
1928
|
-
const r = JSON.stringify(t);
|
|
1929
|
-
if (ae.has(e)) {
|
|
1930
|
-
const o = ae.get(e);
|
|
1931
|
-
if (o.key === r)
|
|
1932
|
-
return o.promise;
|
|
1933
|
-
if (e.byteLength === 0)
|
|
1934
|
-
throw new Error(
|
|
1935
|
-
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
1936
|
-
);
|
|
1937
|
-
}
|
|
1938
|
-
let s;
|
|
1939
|
-
const i = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(i, n).then((o) => (s = o, new Promise((l, d) => {
|
|
1940
|
-
s._callbacks[i] = { resolve: l, reject: d }, s.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
1941
|
-
}))).then((o) => this._createGeometry(o.geometry));
|
|
1942
|
-
return a.catch(() => !0).then(() => {
|
|
1943
|
-
s && i && this._releaseTask(s, i);
|
|
1944
|
-
}), ae.set(e, {
|
|
1945
|
-
key: r,
|
|
1946
|
-
promise: a
|
|
1947
|
-
}), a;
|
|
1948
|
-
}
|
|
1949
|
-
_createGeometry(e) {
|
|
1950
|
-
const t = new je();
|
|
1951
|
-
e.index && t.setIndex(new K(e.index.array, 1));
|
|
1952
|
-
for (let r = 0; r < e.attributes.length; r++) {
|
|
1953
|
-
const s = e.attributes[r], i = s.name, n = s.array, a = s.itemSize, o = new K(n, a);
|
|
1954
|
-
i === "color" && (this._assignVertexColorSpace(o, s.vertexColorSpace), o.normalized = !(n instanceof Float32Array)), t.setAttribute(i, o);
|
|
1952
|
+
}
|
|
1953
|
+
} else {
|
|
1954
|
+
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1955
|
+
return;
|
|
1955
1956
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
const
|
|
1961
|
-
for (let
|
|
1962
|
-
|
|
1957
|
+
} else
|
|
1958
|
+
return;
|
|
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
|
+
if (u.POSITION !== void 0) {
|
|
1965
|
+
const h = t.json.accessors[u.POSITION], f = h.min, p = h.max;
|
|
1966
|
+
if (f !== void 0 && p !== void 0) {
|
|
1967
|
+
if (c.setX(Math.max(Math.abs(f[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(p[2]))), h.normalized) {
|
|
1968
|
+
const A = me(H[h.componentType]);
|
|
1969
|
+
c.multiplyScalar(A);
|
|
1970
|
+
}
|
|
1971
|
+
a.max(c);
|
|
1972
|
+
} else
|
|
1973
|
+
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
s.expandByVector(a);
|
|
1963
1977
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1978
|
+
o.boundingBox = s;
|
|
1979
|
+
const n = new Ut();
|
|
1980
|
+
s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, o.boundingSphere = n;
|
|
1981
|
+
}
|
|
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);
|
|
1968
1987
|
});
|
|
1969
1988
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
_initDecoder() {
|
|
1974
|
-
if (this.decoderPending) return this.decoderPending;
|
|
1975
|
-
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
1976
|
-
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) => {
|
|
1977
|
-
const s = r[0];
|
|
1978
|
-
e || (this.decoderConfig.wasmBinary = r[1]);
|
|
1979
|
-
const i = Ps.toString(), n = [
|
|
1980
|
-
"/* draco decoder */",
|
|
1981
|
-
s,
|
|
1982
|
-
"",
|
|
1983
|
-
"/* worker */",
|
|
1984
|
-
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
1985
|
-
].join(`
|
|
1986
|
-
`);
|
|
1987
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([n]));
|
|
1988
|
-
}), this.decoderPending;
|
|
1989
|
+
for (const n in r) {
|
|
1990
|
+
const a = pe[n] || n.toLowerCase();
|
|
1991
|
+
a in o.attributes || s.push(i(r[n], a));
|
|
1989
1992
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
const s = new Worker(this.workerSourceURL);
|
|
1994
|
-
s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(i) {
|
|
1995
|
-
const n = i.data;
|
|
1996
|
-
switch (n.type) {
|
|
1997
|
-
case "decode":
|
|
1998
|
-
s._callbacks[n.id].resolve(n);
|
|
1999
|
-
break;
|
|
2000
|
-
case "error":
|
|
2001
|
-
s._callbacks[n.id].reject(n);
|
|
2002
|
-
break;
|
|
2003
|
-
default:
|
|
2004
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
|
|
2005
|
-
}
|
|
2006
|
-
}, this.workerPool.push(s);
|
|
2007
|
-
} else
|
|
2008
|
-
this.workerPool.sort(function(s, i) {
|
|
2009
|
-
return s._taskLoad > i._taskLoad ? -1 : 1;
|
|
2010
|
-
});
|
|
2011
|
-
const r = this.workerPool[this.workerPool.length - 1];
|
|
2012
|
-
return r._taskCosts[e] = t, r._taskLoad += t, r;
|
|
1993
|
+
if (e.indices !== void 0 && !o.index) {
|
|
1994
|
+
const n = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1995
|
+
o.setIndex(a);
|
|
2013
1996
|
});
|
|
1997
|
+
s.push(n);
|
|
2014
1998
|
}
|
|
2015
|
-
|
|
2016
|
-
e.
|
|
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
|
+
return e.targets !== void 0 ? _s(o, e.targets, t) : o;
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
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
|
+
};
|
|
2008
|
+
let Q = class {
|
|
2009
|
+
constructor() {
|
|
2010
|
+
_(this, "workerPool", Ye(void 0, !0));
|
|
2011
|
+
_(this, "canvas");
|
|
2012
|
+
_(this, "worker");
|
|
2013
|
+
_(this, "thread");
|
|
2017
2014
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2015
|
+
init(o) {
|
|
2016
|
+
this.worker = o.worker, this.thread = o.thread;
|
|
2020
2017
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2018
|
+
};
|
|
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
|
+
constructor(e) {
|
|
2029
|
+
super();
|
|
2030
|
+
_(this, "canvas");
|
|
2031
|
+
this._service = e;
|
|
2025
2032
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
e.then((d) => {
|
|
2042
|
-
const u = d.draco, h = new u.Decoder();
|
|
2043
|
-
try {
|
|
2044
|
-
const f = t(u, h, new Int8Array(o), l), p = f.attributes.map((A) => A.array.buffer);
|
|
2045
|
-
f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
|
|
2046
|
-
} catch (f) {
|
|
2047
|
-
console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
|
|
2048
|
-
} finally {
|
|
2049
|
-
u.destroy(h);
|
|
2050
|
-
}
|
|
2051
|
-
});
|
|
2052
|
-
break;
|
|
2053
|
-
}
|
|
2054
|
-
};
|
|
2055
|
-
function t(n, a, o, l) {
|
|
2056
|
-
const d = l.attributeIDs, u = l.attributeTypes;
|
|
2057
|
-
let h, f;
|
|
2058
|
-
const p = a.GetEncodedGeometryType(o);
|
|
2059
|
-
if (p === n.TRIANGULAR_MESH)
|
|
2060
|
-
h = new n.Mesh(), f = a.DecodeArrayToMesh(o, o.byteLength, h);
|
|
2061
|
-
else if (p === n.POINT_CLOUD)
|
|
2062
|
-
h = new n.PointCloud(), f = a.DecodeArrayToPointCloud(o, o.byteLength, h);
|
|
2063
|
-
else
|
|
2064
|
-
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2065
|
-
if (!f.ok() || h.ptr === 0)
|
|
2066
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
|
|
2067
|
-
const A = { index: null, attributes: [] };
|
|
2068
|
-
for (const m in d) {
|
|
2069
|
-
const g = self[u[m]];
|
|
2070
|
-
let R, w;
|
|
2071
|
-
if (l.useUniqueIDs)
|
|
2072
|
-
w = d[m], R = a.GetAttributeByUniqueId(h, w);
|
|
2073
|
-
else {
|
|
2074
|
-
if (w = a.GetAttributeId(h, n[d[m]]), w === -1) continue;
|
|
2075
|
-
R = a.GetAttribute(h, w);
|
|
2076
|
-
}
|
|
2077
|
-
const E = s(n, a, h, m, g, R);
|
|
2078
|
-
m === "color" && (E.vertexColorSpace = l.vertexColorSpace), A.attributes.push(E);
|
|
2033
|
+
init(e) {
|
|
2034
|
+
this.canvas = e;
|
|
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
|
+
t === "resize" ? window : e,
|
|
2039
|
+
t
|
|
2040
|
+
).pipe(
|
|
2041
|
+
// @ts-ignore
|
|
2042
|
+
$(r.bind(this)),
|
|
2043
|
+
Ie((s) => !(t === "keydown" && !s))
|
|
2044
|
+
), this[`${t}$`].subscribe((s) => {
|
|
2045
|
+
var i, n;
|
|
2046
|
+
(n = (i = this._service.thread) == null ? void 0 : i[t]) == null || n.call(i, s);
|
|
2047
|
+
});
|
|
2079
2048
|
}
|
|
2080
|
-
return p === n.TRIANGULAR_MESH && (A.index = r(n, a, h)), n.destroy(h), A;
|
|
2081
2049
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
return n._free(h), { array: f, itemSize: 1 };
|
|
2050
|
+
preventDefaultHandler(e) {
|
|
2051
|
+
return e.preventDefault(), {
|
|
2052
|
+
type: e.type
|
|
2053
|
+
};
|
|
2087
2054
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
array: R,
|
|
2095
|
-
itemSize: h
|
|
2055
|
+
getScreenSizes() {
|
|
2056
|
+
return {
|
|
2057
|
+
width: this.canvas.width,
|
|
2058
|
+
height: this.canvas.height,
|
|
2059
|
+
windowWidth: (window == null ? void 0 : window.innerWidth) ?? 0,
|
|
2060
|
+
windowHeight: (window == null ? void 0 : window.innerHeight) ?? 0
|
|
2096
2061
|
};
|
|
2097
2062
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2063
|
+
uiEventHandler(e) {
|
|
2064
|
+
const t = this.canvas.getBoundingClientRect();
|
|
2065
|
+
return {
|
|
2066
|
+
...this.getScreenSizes(),
|
|
2067
|
+
type: e.type,
|
|
2068
|
+
top: t.top,
|
|
2069
|
+
left: t.left
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
mouseEventHandler(e) {
|
|
2073
|
+
return {
|
|
2074
|
+
...this.getScreenSizes(),
|
|
2075
|
+
...j(e, [
|
|
2076
|
+
"ctrlKey",
|
|
2077
|
+
"metaKey",
|
|
2078
|
+
"shiftKey",
|
|
2079
|
+
"button",
|
|
2080
|
+
"pointerType",
|
|
2081
|
+
"clientX",
|
|
2082
|
+
"clientY",
|
|
2083
|
+
"pageX",
|
|
2084
|
+
"pageY"
|
|
2085
|
+
])
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
touchEventHandler(e) {
|
|
2089
|
+
const t = [], r = { type: e.type, touches: t };
|
|
2090
|
+
for (let s = 0; s < e.touches.length; ++s) {
|
|
2091
|
+
const i = e.touches[s];
|
|
2092
|
+
t.push({
|
|
2093
|
+
pageX: (i == null ? void 0 : i.pageX) ?? 0,
|
|
2094
|
+
pageY: (i == null ? void 0 : i.pageY) ?? 0
|
|
2095
|
+
});
|
|
2114
2096
|
}
|
|
2097
|
+
return { ...this.getScreenSizes(), ...r };
|
|
2098
|
+
}
|
|
2099
|
+
wheelEventHandler(e) {
|
|
2100
|
+
return e.preventDefault(), {
|
|
2101
|
+
...this.getScreenSizes(),
|
|
2102
|
+
...j(e, ["deltaX", "deltaY"])
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
keyEventHandler(e) {
|
|
2106
|
+
if (Ze.includes(e.code))
|
|
2107
|
+
return e.preventDefault(), {
|
|
2108
|
+
...this.getScreenSizes(),
|
|
2109
|
+
...j(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
|
|
2110
|
+
};
|
|
2115
2111
|
}
|
|
2116
|
-
}
|
|
2117
|
-
var ks = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, Hs = (c, e, t, r) => {
|
|
2118
|
-
for (var s = r > 1 ? void 0 : r ? Fs(e, t) : e, i = c.length - 1, n; i >= 0; i--)
|
|
2119
|
-
(n = c[i]) && (s = (r ? n(e, t, s) : n(s)) || s);
|
|
2120
|
-
return r && s && ks(e, t, s), s;
|
|
2121
2112
|
};
|
|
2122
|
-
|
|
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
|
+
};
|
|
2122
|
+
let J = class {
|
|
2123
2123
|
constructor() {
|
|
2124
|
-
_(this, "loadingManager", new
|
|
2124
|
+
_(this, "loadingManager", new Bt());
|
|
2125
2125
|
_(this, "loaders", {});
|
|
2126
2126
|
_(this, "sources", []);
|
|
2127
2127
|
_(this, "loadedResources", {});
|
|
@@ -2131,147 +2131,197 @@ let Y = class {
|
|
|
2131
2131
|
/** @description The video loader. based on {@link HTMLVideoElement}. */
|
|
2132
2132
|
get videoLoader() {
|
|
2133
2133
|
return {
|
|
2134
|
-
load: (
|
|
2134
|
+
load: (o, e) => {
|
|
2135
2135
|
const t = document.createElement("video");
|
|
2136
|
-
t.muted = !0, t.loop = !0, t.controls = !1, t.playsInline = !0, t.src =
|
|
2137
|
-
const r = () => {
|
|
2138
|
-
|
|
2139
|
-
t.play();
|
|
2140
|
-
const s = new Ve(t), i = s.dispose.bind(s);
|
|
2141
|
-
s.dispose = () => {
|
|
2142
|
-
var n;
|
|
2143
|
-
(n = s.image) == null || n.remove(), i();
|
|
2144
|
-
}, e(s), t.removeEventListener("canplaythrough", r);
|
|
2136
|
+
t.muted = !0, t.loop = !0, t.crossOrigin = "anonymous", t.controls = !1, t.playsInline = !0, t.src = o, t.autoplay = !0;
|
|
2137
|
+
const r = async () => {
|
|
2138
|
+
e(t), t.removeEventListener("canplaythrough", r);
|
|
2145
2139
|
};
|
|
2146
2140
|
t.addEventListener("canplaythrough", r);
|
|
2147
2141
|
}
|
|
2148
2142
|
};
|
|
2149
2143
|
}
|
|
2150
2144
|
_initLoaders() {
|
|
2151
|
-
this.loaders.
|
|
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;
|
|
2152
2146
|
}
|
|
2153
|
-
_initSources(
|
|
2154
|
-
this.sources =
|
|
2147
|
+
_initSources(o) {
|
|
2148
|
+
this.sources = o, this.toLoadCount = this.sources.length, this.loadedCount = 0;
|
|
2155
2149
|
}
|
|
2156
|
-
init(
|
|
2157
|
-
this._initLoaders(), this._initSources(
|
|
2150
|
+
init(o = []) {
|
|
2151
|
+
this._initLoaders(), this._initSources(o);
|
|
2158
2152
|
}
|
|
2159
|
-
setDracoDecoder(
|
|
2153
|
+
setDracoDecoder(o) {
|
|
2160
2154
|
var e;
|
|
2161
2155
|
this.loaders.dracoLoader && (this.loaders.dracoLoader.setDecoderPath(
|
|
2162
|
-
|
|
2156
|
+
o ?? "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"
|
|
2163
2157
|
), (e = this.loaders.gltfLoader) == null || e.setDRACOLoader(this.loaders.dracoLoader));
|
|
2164
2158
|
}
|
|
2165
2159
|
handleLoad({
|
|
2166
|
-
source:
|
|
2160
|
+
source: o,
|
|
2167
2161
|
resource: e,
|
|
2168
2162
|
toLoadCount: t,
|
|
2169
2163
|
loadedCount: r
|
|
2170
2164
|
}) {
|
|
2171
|
-
e && (this.loadedResources[
|
|
2165
|
+
e && (this.loadedResources[o.name] = e, this.loadedCount = r, this.toLoadCount = t);
|
|
2166
|
+
}
|
|
2167
|
+
load(o) {
|
|
2168
|
+
var t, r, s, i;
|
|
2169
|
+
const e = this.sources[0];
|
|
2170
|
+
if (e) {
|
|
2171
|
+
o == null || o(e);
|
|
2172
|
+
for (const n of this.sources) {
|
|
2173
|
+
if (this.loadedResources[n.name] || typeof n.path != "string")
|
|
2174
|
+
return;
|
|
2175
|
+
n.type === "gltf" && ((t = this.loaders.gltfLoader) == null || t.load(
|
|
2176
|
+
n.path,
|
|
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(
|
|
2183
|
+
n.path,
|
|
2184
|
+
(a) => o == null ? void 0 : o(n, a)
|
|
2185
|
+
));
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2172
2188
|
}
|
|
2173
2189
|
};
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
],
|
|
2177
|
-
var
|
|
2178
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2179
|
-
(n =
|
|
2180
|
-
return r && s &&
|
|
2181
|
-
},
|
|
2182
|
-
let
|
|
2183
|
-
constructor(
|
|
2184
|
-
_(this, "load$$", new
|
|
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 {
|
|
2199
|
+
constructor(o) {
|
|
2200
|
+
_(this, "load$$", new et());
|
|
2185
2201
|
_(this, "load$", this.load$$.pipe(
|
|
2186
|
-
|
|
2187
|
-
...
|
|
2188
|
-
loadedCount:
|
|
2202
|
+
$((o) => ({
|
|
2203
|
+
...o,
|
|
2204
|
+
loadedCount: o.resource ? this._service.loadedCount + 1 : this._service.loadedCount,
|
|
2189
2205
|
toLoadCount: this._service.toLoadCount
|
|
2190
2206
|
})),
|
|
2191
|
-
|
|
2207
|
+
se()
|
|
2192
2208
|
));
|
|
2193
2209
|
_(this, "serializedLoad$", this.load$.pipe(
|
|
2194
|
-
|
|
2195
|
-
var t;
|
|
2196
|
-
let e =
|
|
2197
|
-
if ((t =
|
|
2198
|
-
const
|
|
2210
|
+
$((o) => {
|
|
2211
|
+
var t, r, s;
|
|
2212
|
+
let e = o.resource;
|
|
2213
|
+
if ((t = o == null ? void 0 : o.resource) != null && t.parser) {
|
|
2214
|
+
const i = o.resource, n = i.scenes.map(
|
|
2215
|
+
(a) => _e(a)
|
|
2216
|
+
);
|
|
2199
2217
|
e = {
|
|
2200
|
-
animations: (
|
|
2218
|
+
animations: (o == null ? void 0 : o.resource).animations.map(
|
|
2201
2219
|
// @ts-ignore <<toJSON methods doesn't require a parameter>>
|
|
2202
|
-
(
|
|
2220
|
+
(a) => a.toJSON()
|
|
2203
2221
|
),
|
|
2204
|
-
cameras:
|
|
2205
|
-
(
|
|
2222
|
+
cameras: i.cameras.map(
|
|
2223
|
+
(a) => _e(a)
|
|
2206
2224
|
),
|
|
2207
|
-
parser: { json:
|
|
2208
|
-
scene:
|
|
2209
|
-
scenes:
|
|
2210
|
-
userData:
|
|
2225
|
+
parser: { json: i.parser.json },
|
|
2226
|
+
scene: n == null ? void 0 : n[0],
|
|
2227
|
+
scenes: n,
|
|
2228
|
+
userData: i.userData
|
|
2211
2229
|
};
|
|
2212
2230
|
}
|
|
2213
|
-
return (
|
|
2214
|
-
|
|
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
|
+
}), {
|
|
2276
|
+
...o,
|
|
2215
2277
|
resource: e
|
|
2216
2278
|
};
|
|
2217
|
-
})
|
|
2279
|
+
}),
|
|
2280
|
+
se()
|
|
2218
2281
|
));
|
|
2219
2282
|
_(this, "loadCompleted$", this.load$.pipe(
|
|
2220
|
-
|
|
2283
|
+
Ie((o) => o.toLoadCount === o.loadedCount),
|
|
2284
|
+
$(
|
|
2285
|
+
() => j(this._service, [
|
|
2286
|
+
"loadedCount",
|
|
2287
|
+
"loadedResources",
|
|
2288
|
+
"toLoadCount"
|
|
2289
|
+
])
|
|
2290
|
+
),
|
|
2291
|
+
se()
|
|
2221
2292
|
));
|
|
2222
|
-
this._service =
|
|
2293
|
+
this._service = o;
|
|
2223
2294
|
}
|
|
2224
2295
|
};
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
],
|
|
2229
|
-
var
|
|
2230
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2231
|
-
(n =
|
|
2232
|
-
return r && s &&
|
|
2233
|
-
},
|
|
2234
|
-
let
|
|
2235
|
-
constructor(
|
|
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 {
|
|
2306
|
+
constructor(o, e, t) {
|
|
2236
2307
|
_(this, "_subscriptions", []);
|
|
2237
|
-
this._controller =
|
|
2308
|
+
this._controller = o, this._service = e, this._props = t, this._subscriptions.push(
|
|
2238
2309
|
this._controller.load$.subscribe(
|
|
2239
2310
|
this._service.handleLoad.bind(this._service)
|
|
2240
2311
|
)
|
|
2241
2312
|
);
|
|
2242
2313
|
}
|
|
2243
|
-
|
|
2314
|
+
_listenToLoad(o, e) {
|
|
2244
2315
|
this._controller.load$$.next({
|
|
2245
|
-
source:
|
|
2316
|
+
source: o,
|
|
2246
2317
|
resource: e
|
|
2247
2318
|
});
|
|
2248
2319
|
}
|
|
2249
|
-
init(
|
|
2250
|
-
this._service.init(
|
|
2320
|
+
init(o = []) {
|
|
2321
|
+
this._service.init(o), this._service.setDracoDecoder(), [void 0, !0].includes(this._props.loadResourcesOnInit) && this.load();
|
|
2251
2322
|
}
|
|
2252
2323
|
load() {
|
|
2253
|
-
|
|
2254
|
-
const c = this._service.sources[0];
|
|
2255
|
-
if (c) {
|
|
2256
|
-
this._performLoad(c);
|
|
2257
|
-
for (const n of this._service.sources) {
|
|
2258
|
-
if (this._service.loadedResources[n.name]) return;
|
|
2259
|
-
n.type === "gltfModel" && typeof n.path == "string" && ((e = this._service.loaders.gltfLoader) == null || e.load(
|
|
2260
|
-
n.path,
|
|
2261
|
-
(a) => this._performLoad(n, a)
|
|
2262
|
-
)), n.type === "texture" && typeof n.path == "string" && ((t = this._service.loaders.textureLoader) == null || t.load(n.path, (a) => {
|
|
2263
|
-
this._performLoad(n, new zt(a));
|
|
2264
|
-
})), n.type === "cubeTexture" && typeof n.path == "object" && ((r = this._service.loaders.cubeTextureLoader) == null || r.load(
|
|
2265
|
-
n.path,
|
|
2266
|
-
(a) => this._performLoad(n, a)
|
|
2267
|
-
)), n.type === "video" && typeof n.path == "string" && ((s = this._service.loaders.videoLoader) == null || s.load(
|
|
2268
|
-
n.path,
|
|
2269
|
-
(a) => this._performLoad(n, a)
|
|
2270
|
-
)), n.type === "audio" && typeof n.path == "string" && ((i = this._service.loaders.audioLoader) == null || i.load(n.path, (a) => {
|
|
2271
|
-
this._performLoad(n, a);
|
|
2272
|
-
}));
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2324
|
+
this._service.load(this._listenToLoad.bind(this));
|
|
2275
2325
|
}
|
|
2276
2326
|
getLoadedResources() {
|
|
2277
2327
|
return this._service.loadedResources;
|
|
@@ -2294,25 +2344,25 @@ let J = class {
|
|
|
2294
2344
|
getLoadCompleted$() {
|
|
2295
2345
|
return this._controller.loadCompleted$;
|
|
2296
2346
|
}
|
|
2297
|
-
setDracoDecoder(
|
|
2298
|
-
this._service.setDracoDecoder(
|
|
2347
|
+
setDracoDecoder(o) {
|
|
2348
|
+
this._service.setDracoDecoder(o);
|
|
2299
2349
|
}
|
|
2300
2350
|
dispose() {
|
|
2301
2351
|
this._controller.load$$.complete();
|
|
2302
2352
|
}
|
|
2303
2353
|
};
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
],
|
|
2310
|
-
|
|
2311
|
-
var
|
|
2312
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2313
|
-
(n =
|
|
2314
|
-
return r && s &&
|
|
2315
|
-
}, k = (
|
|
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);
|
|
2316
2366
|
let Ae = class extends nt {
|
|
2317
2367
|
constructor(e, t, r, s, i, n) {
|
|
2318
2368
|
super();
|
|
@@ -2343,7 +2393,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2343
2393
|
var e, t;
|
|
2344
2394
|
if (!this._service.canvas)
|
|
2345
2395
|
throw new Error("Canvas element is not initialized.");
|
|
2346
|
-
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, {
|
|
2347
2397
|
...this._controller.uiEventHandler({ type: "resize" })
|
|
2348
2398
|
}));
|
|
2349
2399
|
}
|
|
@@ -2356,7 +2406,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2356
2406
|
payload: {
|
|
2357
2407
|
path: this.props.location,
|
|
2358
2408
|
subject: {
|
|
2359
|
-
...
|
|
2409
|
+
...Oe(this.props, [
|
|
2360
2410
|
"canvas",
|
|
2361
2411
|
"location",
|
|
2362
2412
|
"onReady",
|
|
@@ -2372,7 +2422,7 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2372
2422
|
this._service.worker = t.worker, this._service.thread = t.thread;
|
|
2373
2423
|
}
|
|
2374
2424
|
async _initObservableProxyEvents() {
|
|
2375
|
-
|
|
2425
|
+
Me.forEach(
|
|
2376
2426
|
(e) => this[`${e}$`] = () => {
|
|
2377
2427
|
var t;
|
|
2378
2428
|
return (t = this._controller) == null ? void 0 : t[`${e}$`];
|
|
@@ -2380,15 +2430,17 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2380
2430
|
);
|
|
2381
2431
|
}
|
|
2382
2432
|
async _initLoader() {
|
|
2383
|
-
this.loader.init(this.props.loaderDataSources), this._loaderController.serializedLoad$.subscribe(
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
return (t = this._service.worker) == null ? void 0 : t.postMessage(
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
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
|
+
});
|
|
2392
2444
|
}
|
|
2393
2445
|
isInitialized() {
|
|
2394
2446
|
return this.initialized;
|
|
@@ -2414,22 +2466,22 @@ ${e instanceof Error ? e.message : "Something went wrong"}`
|
|
|
2414
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;
|
|
2415
2467
|
}
|
|
2416
2468
|
};
|
|
2417
|
-
Ae =
|
|
2469
|
+
Ae = zs([
|
|
2418
2470
|
tt(st.ContainerScoped),
|
|
2419
|
-
k(0,
|
|
2420
|
-
k(1,
|
|
2421
|
-
k(2,
|
|
2422
|
-
k(3,
|
|
2423
|
-
k(4,
|
|
2424
|
-
k(5,
|
|
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))
|
|
2425
2477
|
], Ae);
|
|
2426
|
-
const
|
|
2427
|
-
if (typeof (
|
|
2478
|
+
const Ys = (o) => {
|
|
2479
|
+
if (typeof (o == null ? void 0 : o.location) != "string" && !((o == null ? void 0 : o.location) instanceof URL))
|
|
2428
2480
|
throw new Error(
|
|
2429
2481
|
"Invalid register props detected. location path is required"
|
|
2430
2482
|
);
|
|
2431
|
-
const e =
|
|
2432
|
-
|
|
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 });
|
|
2433
2485
|
const t = e.resolve(Ae);
|
|
2434
2486
|
return t.initialized = !0, {
|
|
2435
2487
|
container: e,
|
|
@@ -2437,19 +2489,19 @@ const Zs = (c) => {
|
|
|
2437
2489
|
};
|
|
2438
2490
|
};
|
|
2439
2491
|
export {
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2492
|
+
Zs as AppModule,
|
|
2493
|
+
en as AppProxyEventHandlersBlueprint,
|
|
2494
|
+
Pe as CONTAINER_TOKEN,
|
|
2495
|
+
Re as DefaultCameraType,
|
|
2496
|
+
Ze as KEYBOARD_EVENT_CODES,
|
|
2497
|
+
rt as LOADER_SERIALIZED_LOAD_TOKEN,
|
|
2498
|
+
qs as LaunchAppProps,
|
|
2499
|
+
Me as PROXY_EVENT_LISTENERS,
|
|
2500
|
+
Qe as ProxyEventHandlersBlueprint,
|
|
2501
|
+
tn as ProxyEventObservablesBlueprint,
|
|
2502
|
+
sn as ProxyEventSubjectsBlueprint,
|
|
2451
2503
|
Ae as RegisterModule,
|
|
2452
2504
|
Te as RegisterPropsBlueprint,
|
|
2453
2505
|
nt as RegisterProxyEventHandlersBlueprint,
|
|
2454
|
-
|
|
2506
|
+
Ys as register
|
|
2455
2507
|
};
|