@quick-threejs/reactive 0.1.24 → 0.1.25
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-BeaCiPyy.mjs +5868 -0
- package/dist/app.module-jsu6itlh.js +34 -0
- package/dist/common/enums/index.d.ts +0 -1
- package/dist/common/index.d.ts +1 -1
- package/dist/common/interfaces/event.interface.d.ts +0 -4
- package/dist/common/interfaces/index.d.ts +1 -0
- package/dist/common/interfaces/module.interface.d.ts +10 -2
- package/dist/common/models/launch-app-props.model.d.ts +4 -6
- package/dist/common/models/proxy-event-handler.model.d.ts +1 -1
- package/dist/common/models/proxy-event-observables.model.d.ts +1 -1
- package/dist/common/models/proxy-event-subjects.models.d.ts +1 -1
- package/dist/common/models/register-props.model.d.ts +9 -2
- package/dist/common/tokens/index.d.ts +1 -0
- package/dist/common/tokens/ioc.token.d.ts +1 -0
- package/dist/core/app/app.controller.d.ts +3 -7
- package/dist/core/app/app.module-worker.d.ts +4 -3
- package/dist/core/app/app.module.d.ts +19 -15
- package/dist/core/app/{app.component.d.ts → app.service.d.ts} +5 -3
- package/dist/core/app/camera/camera.controller.d.ts +4 -8
- package/dist/core/app/camera/camera.module.d.ts +6 -7
- package/dist/core/app/camera/{camera.component.d.ts → camera.service.d.ts} +4 -4
- package/dist/core/app/debug/debug.controller.d.ts +3 -4
- package/dist/core/app/debug/debug.module.d.ts +10 -8
- package/dist/core/app/debug/{debug.component.d.ts → debug.service.d.ts} +10 -10
- package/dist/core/app/renderer/renderer.controller.d.ts +6 -8
- package/dist/core/app/renderer/renderer.module.d.ts +6 -8
- package/dist/core/app/renderer/renderer.service.d.ts +19 -0
- package/dist/core/app/sizes/sizes.controller.d.ts +5 -7
- package/dist/core/app/sizes/sizes.module.d.ts +4 -5
- package/dist/core/app/sizes/{sizes.component.d.ts → sizes.service.d.ts} +1 -1
- package/dist/core/app/timer/timer.controller.d.ts +18 -12
- package/dist/core/app/timer/timer.module.d.ts +22 -12
- package/dist/core/app/timer/timer.service.d.ts +10 -0
- package/dist/core/app/world/world.controller.d.ts +0 -3
- package/dist/core/app/world/world.module.d.ts +3 -6
- package/dist/core/app/world/{world.component.d.ts → world.service.d.ts} +1 -1
- package/dist/core/loader/loader.controller.d.ts +0 -2
- package/dist/core/loader/loader.module.d.ts +0 -1
- package/dist/core/register/register.controller.d.ts +3 -7
- package/dist/core/register/register.module.d.ts +14 -17
- package/dist/core/register/register.service.d.ts +9 -0
- package/dist/core/register/register.util.d.ts +8 -5
- package/dist/main.js +3 -12
- package/dist/main.mjs +1318 -1667
- package/dist/worker.js +1 -3
- package/dist/worker.mjs +32 -315
- package/package.json +6 -4
- package/dist/app.module-Da11YIUG.js +0 -29
- package/dist/app.module-Dg_0i25D.mjs +0 -2640
- package/dist/common/enums/lifecycle.enum.d.ts +0 -10
- package/dist/common/types/index.d.ts +0 -1
- package/dist/core/app/renderer/renderer.component.d.ts +0 -19
- package/dist/core/app/timer/timer.component.d.ts +0 -8
- package/dist/core/register/register.component.d.ts +0 -13
- /package/dist/common/{types/object.type.d.ts → interfaces/object.interface.d.ts} +0 -0
package/dist/main.mjs
CHANGED
|
@@ -1,21 +1,207 @@
|
|
|
1
1
|
var et = Object.defineProperty;
|
|
2
|
-
var tt = (
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Loader as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
var tt = (c, e, t) => e in c ? et(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
|
|
3
|
+
var T = (c, e, t) => tt(c, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { m as Te, _ as nt, a as Ne, c as ye, i as _e, b as N, o as st, d as rt, O as it, s as Y, L as Q, S as ot, f as Pe, e as De, g as k, h as ke, z as at, P as ct, j as Fe, U as Z, K as lt, $ as ut, C as He, k as V, J as z, D as we, l as dt } from "./app.module-BeaCiPyy.mjs";
|
|
5
|
+
import { A as ys, n as ws, p as Es, q as Rs } from "./app.module-BeaCiPyy.mjs";
|
|
6
|
+
import { Loader as Ue, FileLoader as X, SRGBColorSpace as O, LinearSRGBColorSpace as b, BufferGeometry as Ge, BufferAttribute as j, Color as P, ColorManagement as oe, TrianglesDrawMode as ht, TriangleFanDrawMode as ae, TriangleStripDrawMode as Be, LoaderUtils as K, SpotLight as ft, PointLight as pt, DirectionalLight as mt, MeshBasicMaterial as B, MeshPhysicalMaterial as v, Vector2 as je, Matrix4 as W, Vector3 as F, Quaternion as Ke, InstancedMesh as gt, InstancedBufferAttribute as At, Object3D as Ve, TextureLoader as Tt, ImageBitmapLoader as ze, InterleavedBuffer as _t, InterleavedBufferAttribute as yt, LinearFilter as ce, LinearMipmapLinearFilter as $e, RepeatWrapping as le, NearestFilter as Xe, PointsMaterial as wt, Material as ee, LineBasicMaterial as Et, MeshStandardMaterial as We, DoubleSide as Rt, PropertyBinding as xt, SkinnedMesh as Lt, Mesh as bt, LineSegments as vt, Line as St, LineLoop as Mt, Points as Ct, Group as te, PerspectiveCamera as It, MathUtils as Ot, OrthographicCamera as Nt, Skeleton as Pt, AnimationClip as Dt, Bone as kt, InterpolateLinear as qe, NearestMipmapNearestFilter as Ft, LinearMipmapNearestFilter as Ht, NearestMipmapLinearFilter as Ut, ClampToEdgeWrapping as Gt, MirroredRepeatWrapping as Bt, InterpolateDiscrete as jt, FrontSide as Kt, Texture as Ee, VectorKeyframeTrack as Re, NumberKeyframeTrack as xe, QuaternionKeyframeTrack as Le, Box3 as Vt, Sphere as zt, Interpolant as $t, LoadingManager as Xt, CubeTextureLoader as Wt, AudioLoader as qt, VideoTexture as Yt, CanvasTexture as Qt } from "three";
|
|
7
|
+
class ms {
|
|
8
|
+
constructor() {
|
|
9
|
+
/** @description Handler triggered when the app is ready. */
|
|
10
|
+
T(this, "onReady");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class Ye {
|
|
14
|
+
constructor() {
|
|
15
|
+
/**
|
|
16
|
+
* @description The app worker logic location.
|
|
17
|
+
*
|
|
18
|
+
* @required
|
|
19
|
+
*/
|
|
20
|
+
T(this, "location");
|
|
21
|
+
/**
|
|
22
|
+
* @description Initialize the app on construct.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
T(this, "initOnConstruct");
|
|
27
|
+
/**
|
|
28
|
+
* @description App `canvas` element reference.
|
|
29
|
+
*
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
T(this, "canvas");
|
|
33
|
+
/**
|
|
34
|
+
* @description Set the `canvas` view in fullscreen and auto-resize it.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
T(this, "fullScreen");
|
|
39
|
+
/**
|
|
40
|
+
* Default used camera.
|
|
41
|
+
*
|
|
42
|
+
* @see {@link DefaultCameraType}
|
|
43
|
+
*
|
|
44
|
+
* @default DefaultCameraType.PERSPECTIVE
|
|
45
|
+
*/
|
|
46
|
+
T(this, "defaultCamera");
|
|
47
|
+
/**
|
|
48
|
+
* @description Start timer update on launch.
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
T(this, "startTimer");
|
|
53
|
+
/**
|
|
54
|
+
* Enable the debug mode
|
|
55
|
+
*
|
|
56
|
+
* @default undefined
|
|
57
|
+
*/
|
|
58
|
+
T(this, "enableDebug");
|
|
59
|
+
/**
|
|
60
|
+
* Define the {@link THREE.AxesHelper} sizes.
|
|
61
|
+
*
|
|
62
|
+
* @remark __Deactivated if the value is `0` or `undefined`__
|
|
63
|
+
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
64
|
+
*
|
|
65
|
+
* @default undefined
|
|
66
|
+
*/
|
|
67
|
+
T(this, "axesSizes");
|
|
68
|
+
/**
|
|
69
|
+
* Define the {@link THREE.GridHelper} sizes.
|
|
70
|
+
*
|
|
71
|
+
* @remark __Deactivated if the value is `0` or `undefined`__
|
|
72
|
+
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
73
|
+
*
|
|
74
|
+
* @default undefined
|
|
75
|
+
*/
|
|
76
|
+
T(this, "gridSizes");
|
|
77
|
+
/**
|
|
78
|
+
* Display a mini perfective camera at the top right corner of the screen.
|
|
79
|
+
*
|
|
80
|
+
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
T(this, "withMiniCamera");
|
|
85
|
+
/**
|
|
86
|
+
* @description Handler called when the app is ready.
|
|
87
|
+
*
|
|
88
|
+
* @default undefined
|
|
89
|
+
*/
|
|
90
|
+
T(this, "onReady");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class Jt {
|
|
94
|
+
constructor() {
|
|
95
|
+
T(this, "contextmenu$");
|
|
96
|
+
T(this, "resize$");
|
|
97
|
+
T(this, "mousedown$");
|
|
98
|
+
T(this, "mousemove$");
|
|
99
|
+
T(this, "mouseup$");
|
|
100
|
+
T(this, "pointerdown$");
|
|
101
|
+
T(this, "pointermove$");
|
|
102
|
+
T(this, "pointercancel$");
|
|
103
|
+
T(this, "pointerup$");
|
|
104
|
+
T(this, "touchstart$");
|
|
105
|
+
T(this, "touchmove$");
|
|
106
|
+
T(this, "touchend$");
|
|
107
|
+
T(this, "wheel$");
|
|
108
|
+
T(this, "keydown$");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var Zt = Array.isArray;
|
|
112
|
+
function en(c, e) {
|
|
113
|
+
return Zt(e) ? c.apply(void 0, nt([], Ne(e))) : c(e);
|
|
114
|
+
}
|
|
115
|
+
function tn(c) {
|
|
116
|
+
return Te(function(e) {
|
|
117
|
+
return en(c, e);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function nn(c, e, t, r, n, i, s, a) {
|
|
121
|
+
var o = [], l = 0, u = 0, d = !1, h = function() {
|
|
122
|
+
d && !o.length && !l && e.complete();
|
|
123
|
+
}, f = function(g) {
|
|
124
|
+
return l < r ? p(g) : o.push(g);
|
|
125
|
+
}, p = function(g) {
|
|
126
|
+
l++;
|
|
127
|
+
var m = !1;
|
|
128
|
+
_e(t(g, u++)).subscribe(ye(e, function(A) {
|
|
129
|
+
e.next(A);
|
|
130
|
+
}, function() {
|
|
131
|
+
m = !0;
|
|
132
|
+
}, void 0, function() {
|
|
133
|
+
if (m)
|
|
134
|
+
try {
|
|
135
|
+
l--;
|
|
136
|
+
for (var A = function() {
|
|
137
|
+
var y = o.shift();
|
|
138
|
+
s || p(y);
|
|
139
|
+
}; o.length && l < r; )
|
|
140
|
+
A();
|
|
141
|
+
h();
|
|
142
|
+
} catch (y) {
|
|
143
|
+
e.error(y);
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
return c.subscribe(ye(e, f, function() {
|
|
148
|
+
d = !0, h();
|
|
149
|
+
})), function() {
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function Qe(c, e, t) {
|
|
153
|
+
return t === void 0 && (t = 1 / 0), N(e) ? Qe(function(r, n) {
|
|
154
|
+
return Te(function(i, s) {
|
|
155
|
+
return e(r, i, n, s);
|
|
156
|
+
})(_e(c(r, n)));
|
|
157
|
+
}, t) : (typeof e == "number" && (t = e), st(function(r, n) {
|
|
158
|
+
return nn(r, n, c, t);
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
var sn = ["addListener", "removeListener"], rn = ["addEventListener", "removeEventListener"], on = ["on", "off"];
|
|
162
|
+
function ue(c, e, t, r) {
|
|
163
|
+
if (N(t) && (r = t, t = void 0), r)
|
|
164
|
+
return ue(c, e, t).pipe(tn(r));
|
|
165
|
+
var n = Ne(ln(c) ? rn.map(function(a) {
|
|
166
|
+
return function(o) {
|
|
167
|
+
return c[a](e, o, t);
|
|
168
|
+
};
|
|
169
|
+
}) : an(c) ? sn.map(be(c, e)) : cn(c) ? on.map(be(c, e)) : [], 2), i = n[0], s = n[1];
|
|
170
|
+
if (!i && rt(c))
|
|
171
|
+
return Qe(function(a) {
|
|
172
|
+
return ue(a, e, t);
|
|
173
|
+
})(_e(c));
|
|
174
|
+
if (!i)
|
|
175
|
+
throw new TypeError("Invalid event target");
|
|
176
|
+
return new it(function(a) {
|
|
177
|
+
var o = function() {
|
|
178
|
+
for (var l = [], u = 0; u < arguments.length; u++)
|
|
179
|
+
l[u] = arguments[u];
|
|
180
|
+
return a.next(1 < l.length ? l : l[0]);
|
|
181
|
+
};
|
|
182
|
+
return i(o), function() {
|
|
183
|
+
return s(o);
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function be(c, e) {
|
|
11
188
|
return function(t) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
189
|
+
return function(r) {
|
|
190
|
+
return c[t](e, r);
|
|
191
|
+
};
|
|
15
192
|
};
|
|
16
193
|
}
|
|
17
|
-
|
|
18
|
-
|
|
194
|
+
function an(c) {
|
|
195
|
+
return N(c.addListener) && N(c.removeListener);
|
|
196
|
+
}
|
|
197
|
+
function cn(c) {
|
|
198
|
+
return N(c.on) && N(c.off);
|
|
199
|
+
}
|
|
200
|
+
function ln(c) {
|
|
201
|
+
return N(c.addEventListener) && N(c.removeEventListener);
|
|
202
|
+
}
|
|
203
|
+
const ne = /* @__PURE__ */ new WeakMap();
|
|
204
|
+
class un extends Ue {
|
|
19
205
|
constructor(e) {
|
|
20
206
|
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
21
207
|
position: "POSITION",
|
|
@@ -38,67 +224,67 @@ class Jt extends He {
|
|
|
38
224
|
setWorkerLimit(e) {
|
|
39
225
|
return this.workerLimit = e, this;
|
|
40
226
|
}
|
|
41
|
-
load(e, t,
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
this.parse(
|
|
45
|
-
},
|
|
227
|
+
load(e, t, r, n) {
|
|
228
|
+
const i = new X(this.manager);
|
|
229
|
+
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, (s) => {
|
|
230
|
+
this.parse(s, t, n);
|
|
231
|
+
}, r, n);
|
|
46
232
|
}
|
|
47
|
-
parse(e, t,
|
|
233
|
+
parse(e, t, r = () => {
|
|
48
234
|
}) {
|
|
49
|
-
this.decodeDracoFile(e, t, null, null,
|
|
235
|
+
this.decodeDracoFile(e, t, null, null, O, r).catch(r);
|
|
50
236
|
}
|
|
51
|
-
decodeDracoFile(e, t,
|
|
237
|
+
decodeDracoFile(e, t, r, n, i = b, s = () => {
|
|
52
238
|
}) {
|
|
53
|
-
const
|
|
54
|
-
attributeIDs:
|
|
239
|
+
const a = {
|
|
240
|
+
attributeIDs: r || this.defaultAttributeIDs,
|
|
55
241
|
attributeTypes: n || this.defaultAttributeTypes,
|
|
56
|
-
useUniqueIDs: !!
|
|
57
|
-
vertexColorSpace:
|
|
242
|
+
useUniqueIDs: !!r,
|
|
243
|
+
vertexColorSpace: i
|
|
58
244
|
};
|
|
59
|
-
return this.decodeGeometry(e,
|
|
245
|
+
return this.decodeGeometry(e, a).then(t).catch(s);
|
|
60
246
|
}
|
|
61
247
|
decodeGeometry(e, t) {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
248
|
+
const r = JSON.stringify(t);
|
|
249
|
+
if (ne.has(e)) {
|
|
250
|
+
const o = ne.get(e);
|
|
251
|
+
if (o.key === r)
|
|
252
|
+
return o.promise;
|
|
67
253
|
if (e.byteLength === 0)
|
|
68
254
|
throw new Error(
|
|
69
255
|
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
70
256
|
);
|
|
71
257
|
}
|
|
72
258
|
let n;
|
|
73
|
-
const
|
|
74
|
-
n._callbacks[
|
|
75
|
-
}))).then((
|
|
76
|
-
return
|
|
77
|
-
n &&
|
|
78
|
-
}),
|
|
79
|
-
key:
|
|
80
|
-
promise:
|
|
81
|
-
}),
|
|
259
|
+
const i = this.workerNextTaskID++, s = e.byteLength, a = this._getWorker(i, s).then((o) => (n = o, new Promise((l, u) => {
|
|
260
|
+
n._callbacks[i] = { resolve: l, reject: u }, n.postMessage({ type: "decode", id: i, taskConfig: t, buffer: e }, [e]);
|
|
261
|
+
}))).then((o) => this._createGeometry(o.geometry));
|
|
262
|
+
return a.catch(() => !0).then(() => {
|
|
263
|
+
n && i && this._releaseTask(n, i);
|
|
264
|
+
}), ne.set(e, {
|
|
265
|
+
key: r,
|
|
266
|
+
promise: a
|
|
267
|
+
}), a;
|
|
82
268
|
}
|
|
83
269
|
_createGeometry(e) {
|
|
84
|
-
const t = new
|
|
270
|
+
const t = new Ge();
|
|
85
271
|
e.index && t.setIndex(new j(e.index.array, 1));
|
|
86
|
-
for (let
|
|
87
|
-
const n = e.attributes[
|
|
88
|
-
|
|
272
|
+
for (let r = 0; r < e.attributes.length; r++) {
|
|
273
|
+
const n = e.attributes[r], i = n.name, s = n.array, a = n.itemSize, o = new j(s, a);
|
|
274
|
+
i === "color" && (this._assignVertexColorSpace(o, n.vertexColorSpace), o.normalized = !(s instanceof Float32Array)), t.setAttribute(i, o);
|
|
89
275
|
}
|
|
90
276
|
return t;
|
|
91
277
|
}
|
|
92
278
|
_assignVertexColorSpace(e, t) {
|
|
93
|
-
if (t !==
|
|
94
|
-
const
|
|
95
|
-
for (let n = 0,
|
|
96
|
-
|
|
279
|
+
if (t !== O) return;
|
|
280
|
+
const r = new P();
|
|
281
|
+
for (let n = 0, i = e.count; n < i; n++)
|
|
282
|
+
r.fromBufferAttribute(e, n), oe.toWorkingColorSpace(r, O), e.setXYZ(n, r.r, r.g, r.b);
|
|
97
283
|
}
|
|
98
284
|
_loadLibrary(e, t) {
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
|
|
285
|
+
const r = new X(this.manager);
|
|
286
|
+
return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((n, i) => {
|
|
287
|
+
r.load(e, n, void 0, i);
|
|
102
288
|
});
|
|
103
289
|
}
|
|
104
290
|
preload() {
|
|
@@ -107,43 +293,43 @@ class Jt extends He {
|
|
|
107
293
|
_initDecoder() {
|
|
108
294
|
if (this.decoderPending) return this.decoderPending;
|
|
109
295
|
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
110
|
-
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((
|
|
111
|
-
const n =
|
|
112
|
-
e || (this.decoderConfig.wasmBinary =
|
|
113
|
-
const
|
|
296
|
+
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) => {
|
|
297
|
+
const n = r[0];
|
|
298
|
+
e || (this.decoderConfig.wasmBinary = r[1]);
|
|
299
|
+
const i = dn.toString(), s = [
|
|
114
300
|
"/* draco decoder */",
|
|
115
301
|
n,
|
|
116
302
|
"",
|
|
117
303
|
"/* worker */",
|
|
118
|
-
|
|
304
|
+
i.substring(i.indexOf("{") + 1, i.lastIndexOf("}"))
|
|
119
305
|
].join(`
|
|
120
306
|
`);
|
|
121
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([
|
|
307
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([s]));
|
|
122
308
|
}), this.decoderPending;
|
|
123
309
|
}
|
|
124
310
|
_getWorker(e, t) {
|
|
125
311
|
return this._initDecoder().then(() => {
|
|
126
312
|
if (this.workerPool.length < this.workerLimit) {
|
|
127
313
|
const n = new Worker(this.workerSourceURL);
|
|
128
|
-
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(
|
|
129
|
-
const
|
|
130
|
-
switch (
|
|
314
|
+
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(i) {
|
|
315
|
+
const s = i.data;
|
|
316
|
+
switch (s.type) {
|
|
131
317
|
case "decode":
|
|
132
|
-
n._callbacks[
|
|
318
|
+
n._callbacks[s.id].resolve(s);
|
|
133
319
|
break;
|
|
134
320
|
case "error":
|
|
135
|
-
n._callbacks[
|
|
321
|
+
n._callbacks[s.id].reject(s);
|
|
136
322
|
break;
|
|
137
323
|
default:
|
|
138
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' +
|
|
324
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + s.type + '"');
|
|
139
325
|
}
|
|
140
326
|
}, this.workerPool.push(n);
|
|
141
327
|
} else
|
|
142
|
-
this.workerPool.sort(function(n,
|
|
143
|
-
return n._taskLoad >
|
|
328
|
+
this.workerPool.sort(function(n, i) {
|
|
329
|
+
return n._taskLoad > i._taskLoad ? -1 : 1;
|
|
144
330
|
});
|
|
145
|
-
const
|
|
146
|
-
return
|
|
331
|
+
const r = this.workerPool[this.workerPool.length - 1];
|
|
332
|
+
return r._taskCosts[e] = t, r._taskLoad += t, r;
|
|
147
333
|
});
|
|
148
334
|
}
|
|
149
335
|
_releaseTask(e, t) {
|
|
@@ -158,203 +344,201 @@ class Jt extends He {
|
|
|
158
344
|
return this.workerPool.length = 0, this.workerSourceURL !== "" && URL.revokeObjectURL(this.workerSourceURL), this;
|
|
159
345
|
}
|
|
160
346
|
}
|
|
161
|
-
function
|
|
162
|
-
let
|
|
163
|
-
onmessage = function(
|
|
164
|
-
const
|
|
165
|
-
switch (
|
|
347
|
+
function dn() {
|
|
348
|
+
let c, e;
|
|
349
|
+
onmessage = function(s) {
|
|
350
|
+
const a = s.data;
|
|
351
|
+
switch (a.type) {
|
|
166
352
|
case "init":
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}, DracoDecoderModule(
|
|
353
|
+
c = a.decoderConfig, e = new Promise(function(u) {
|
|
354
|
+
c.onModuleLoaded = function(d) {
|
|
355
|
+
u({ draco: d });
|
|
356
|
+
}, DracoDecoderModule(c);
|
|
171
357
|
});
|
|
172
358
|
break;
|
|
173
359
|
case "decode":
|
|
174
|
-
const
|
|
175
|
-
e.then((
|
|
176
|
-
const d =
|
|
360
|
+
const o = a.buffer, l = a.taskConfig;
|
|
361
|
+
e.then((u) => {
|
|
362
|
+
const d = u.draco, h = new d.Decoder();
|
|
177
363
|
try {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
} catch (
|
|
181
|
-
console.error(
|
|
364
|
+
const f = t(d, h, new Int8Array(o), l), p = f.attributes.map((g) => g.array.buffer);
|
|
365
|
+
f.index && p.push(f.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: f }, p);
|
|
366
|
+
} catch (f) {
|
|
367
|
+
console.error(f), self.postMessage({ type: "error", id: a.id, error: f.message });
|
|
182
368
|
} finally {
|
|
183
|
-
d.destroy(
|
|
369
|
+
d.destroy(h);
|
|
184
370
|
}
|
|
185
371
|
});
|
|
186
372
|
break;
|
|
187
373
|
}
|
|
188
374
|
};
|
|
189
|
-
function t(
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
else if (
|
|
196
|
-
|
|
375
|
+
function t(s, a, o, l) {
|
|
376
|
+
const u = l.attributeIDs, d = l.attributeTypes;
|
|
377
|
+
let h, f;
|
|
378
|
+
const p = a.GetEncodedGeometryType(o);
|
|
379
|
+
if (p === s.TRIANGULAR_MESH)
|
|
380
|
+
h = new s.Mesh(), f = a.DecodeArrayToMesh(o, o.byteLength, h);
|
|
381
|
+
else if (p === s.POINT_CLOUD)
|
|
382
|
+
h = new s.PointCloud(), f = a.DecodeArrayToPointCloud(o, o.byteLength, h);
|
|
197
383
|
else
|
|
198
384
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
199
|
-
if (!
|
|
200
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " +
|
|
201
|
-
const
|
|
202
|
-
for (const m in
|
|
385
|
+
if (!f.ok() || h.ptr === 0)
|
|
386
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + f.error_msg());
|
|
387
|
+
const g = { index: null, attributes: [] };
|
|
388
|
+
for (const m in u) {
|
|
203
389
|
const A = self[d[m]];
|
|
204
|
-
let y,
|
|
205
|
-
if (
|
|
206
|
-
|
|
390
|
+
let y, E;
|
|
391
|
+
if (l.useUniqueIDs)
|
|
392
|
+
E = u[m], y = a.GetAttributeByUniqueId(h, E);
|
|
207
393
|
else {
|
|
208
|
-
if (
|
|
209
|
-
y =
|
|
394
|
+
if (E = a.GetAttributeId(h, s[u[m]]), E === -1) continue;
|
|
395
|
+
y = a.GetAttribute(h, E);
|
|
210
396
|
}
|
|
211
|
-
const
|
|
212
|
-
m === "color" && (
|
|
397
|
+
const w = n(s, a, h, m, A, y);
|
|
398
|
+
m === "color" && (w.vertexColorSpace = l.vertexColorSpace), g.attributes.push(w);
|
|
213
399
|
}
|
|
214
|
-
return
|
|
215
|
-
}
|
|
216
|
-
function s
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
return
|
|
221
|
-
}
|
|
222
|
-
function n(
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const y = new
|
|
226
|
-
return
|
|
227
|
-
name:
|
|
400
|
+
return p === s.TRIANGULAR_MESH && (g.index = r(s, a, h)), s.destroy(h), g;
|
|
401
|
+
}
|
|
402
|
+
function r(s, a, o) {
|
|
403
|
+
const u = o.num_faces() * 3, d = u * 4, h = s._malloc(d);
|
|
404
|
+
a.GetTrianglesUInt32Array(o, d, h);
|
|
405
|
+
const f = new Uint32Array(s.HEAPF32.buffer, h, u).slice();
|
|
406
|
+
return s._free(h), { array: f, itemSize: 1 };
|
|
407
|
+
}
|
|
408
|
+
function n(s, a, o, l, u, d) {
|
|
409
|
+
const h = d.num_components(), p = o.num_points() * h, g = p * u.BYTES_PER_ELEMENT, m = i(s, u), A = s._malloc(g);
|
|
410
|
+
a.GetAttributeDataArrayForAllPoints(o, d, m, g, A);
|
|
411
|
+
const y = new u(s.HEAPF32.buffer, A, p).slice();
|
|
412
|
+
return s._free(A), {
|
|
413
|
+
name: l,
|
|
228
414
|
array: y,
|
|
229
|
-
itemSize:
|
|
415
|
+
itemSize: h
|
|
230
416
|
};
|
|
231
417
|
}
|
|
232
|
-
function
|
|
233
|
-
switch (
|
|
418
|
+
function i(s, a) {
|
|
419
|
+
switch (a) {
|
|
234
420
|
case Float32Array:
|
|
235
|
-
return
|
|
421
|
+
return s.DT_FLOAT32;
|
|
236
422
|
case Int8Array:
|
|
237
|
-
return
|
|
423
|
+
return s.DT_INT8;
|
|
238
424
|
case Int16Array:
|
|
239
|
-
return
|
|
425
|
+
return s.DT_INT16;
|
|
240
426
|
case Int32Array:
|
|
241
|
-
return
|
|
427
|
+
return s.DT_INT32;
|
|
242
428
|
case Uint8Array:
|
|
243
|
-
return
|
|
429
|
+
return s.DT_UINT8;
|
|
244
430
|
case Uint16Array:
|
|
245
|
-
return
|
|
431
|
+
return s.DT_UINT16;
|
|
246
432
|
case Uint32Array:
|
|
247
|
-
return
|
|
433
|
+
return s.DT_UINT32;
|
|
248
434
|
}
|
|
249
435
|
}
|
|
250
436
|
}
|
|
251
|
-
var
|
|
252
|
-
for (var n =
|
|
253
|
-
(
|
|
254
|
-
return
|
|
437
|
+
var hn = Object.defineProperty, fn = Object.getOwnPropertyDescriptor, pn = (c, e, t, r) => {
|
|
438
|
+
for (var n = r > 1 ? void 0 : r ? fn(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
439
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
440
|
+
return r && n && hn(e, t, n), n;
|
|
255
441
|
};
|
|
256
442
|
let de = class {
|
|
257
443
|
constructor() {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
g(this, "progressCompleted$", this.progress$.pipe(
|
|
263
|
-
qe((o) => o.toLoad === o.loaded)
|
|
444
|
+
T(this, "progress$$", new ot());
|
|
445
|
+
T(this, "progress$", this.progress$$.pipe());
|
|
446
|
+
T(this, "progressCompleted$", this.progress$.pipe(
|
|
447
|
+
Pe((c) => c.toLoad === c.loaded)
|
|
264
448
|
));
|
|
265
449
|
}
|
|
266
450
|
};
|
|
267
|
-
de =
|
|
268
|
-
|
|
451
|
+
de = pn([
|
|
452
|
+
Y(Q.ResolutionScoped)
|
|
269
453
|
], de);
|
|
270
|
-
function
|
|
271
|
-
if (e ===
|
|
272
|
-
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),
|
|
273
|
-
if (e ===
|
|
274
|
-
let t =
|
|
454
|
+
function ve(c, e) {
|
|
455
|
+
if (e === ht)
|
|
456
|
+
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), c;
|
|
457
|
+
if (e === ae || e === Be) {
|
|
458
|
+
let t = c.getIndex();
|
|
275
459
|
if (t === null) {
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
for (let
|
|
279
|
-
|
|
280
|
-
|
|
460
|
+
const s = [], a = c.getAttribute("position");
|
|
461
|
+
if (a !== void 0) {
|
|
462
|
+
for (let o = 0; o < a.count; o++)
|
|
463
|
+
s.push(o);
|
|
464
|
+
c.setIndex(s), t = c.getIndex();
|
|
281
465
|
} else
|
|
282
|
-
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),
|
|
466
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), c;
|
|
283
467
|
}
|
|
284
|
-
const
|
|
285
|
-
if (e ===
|
|
286
|
-
for (let
|
|
287
|
-
n.push(t.getX(0)), n.push(t.getX(
|
|
468
|
+
const r = t.count - 2, n = [];
|
|
469
|
+
if (e === ae)
|
|
470
|
+
for (let s = 1; s <= r; s++)
|
|
471
|
+
n.push(t.getX(0)), n.push(t.getX(s)), n.push(t.getX(s + 1));
|
|
288
472
|
else
|
|
289
|
-
for (let
|
|
290
|
-
|
|
291
|
-
n.length / 3 !==
|
|
292
|
-
const
|
|
293
|
-
return
|
|
473
|
+
for (let s = 0; s < r; s++)
|
|
474
|
+
s % 2 === 0 ? (n.push(t.getX(s)), n.push(t.getX(s + 1)), n.push(t.getX(s + 2))) : (n.push(t.getX(s + 2)), n.push(t.getX(s + 1)), n.push(t.getX(s)));
|
|
475
|
+
n.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
476
|
+
const i = c.clone();
|
|
477
|
+
return i.setIndex(n), i.clearGroups(), i;
|
|
294
478
|
} else
|
|
295
|
-
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e),
|
|
479
|
+
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), c;
|
|
296
480
|
}
|
|
297
|
-
class
|
|
481
|
+
class mn extends Ue {
|
|
298
482
|
constructor(e) {
|
|
299
483
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
300
|
-
return new
|
|
484
|
+
return new yn(t);
|
|
301
485
|
}), this.register(function(t) {
|
|
302
|
-
return new
|
|
486
|
+
return new wn(t);
|
|
303
487
|
}), this.register(function(t) {
|
|
304
|
-
return new
|
|
488
|
+
return new Cn(t);
|
|
305
489
|
}), this.register(function(t) {
|
|
306
|
-
return new
|
|
490
|
+
return new In(t);
|
|
307
491
|
}), this.register(function(t) {
|
|
308
|
-
return new
|
|
492
|
+
return new On(t);
|
|
309
493
|
}), this.register(function(t) {
|
|
310
|
-
return new
|
|
494
|
+
return new Rn(t);
|
|
311
495
|
}), this.register(function(t) {
|
|
312
|
-
return new
|
|
496
|
+
return new xn(t);
|
|
313
497
|
}), this.register(function(t) {
|
|
314
|
-
return new
|
|
498
|
+
return new Ln(t);
|
|
315
499
|
}), this.register(function(t) {
|
|
316
|
-
return new
|
|
500
|
+
return new bn(t);
|
|
317
501
|
}), this.register(function(t) {
|
|
318
|
-
return new
|
|
502
|
+
return new _n(t);
|
|
319
503
|
}), this.register(function(t) {
|
|
320
|
-
return new
|
|
504
|
+
return new vn(t);
|
|
321
505
|
}), this.register(function(t) {
|
|
322
|
-
return new
|
|
506
|
+
return new En(t);
|
|
323
507
|
}), this.register(function(t) {
|
|
324
|
-
return new
|
|
508
|
+
return new Mn(t);
|
|
325
509
|
}), this.register(function(t) {
|
|
326
|
-
return new
|
|
510
|
+
return new Sn(t);
|
|
327
511
|
}), this.register(function(t) {
|
|
328
|
-
return new
|
|
512
|
+
return new An(t);
|
|
329
513
|
}), this.register(function(t) {
|
|
330
|
-
return new
|
|
514
|
+
return new Nn(t);
|
|
331
515
|
}), this.register(function(t) {
|
|
332
|
-
return new
|
|
516
|
+
return new Pn(t);
|
|
333
517
|
});
|
|
334
518
|
}
|
|
335
|
-
load(e, t,
|
|
336
|
-
const
|
|
337
|
-
let
|
|
519
|
+
load(e, t, r, n) {
|
|
520
|
+
const i = this;
|
|
521
|
+
let s;
|
|
338
522
|
if (this.resourcePath !== "")
|
|
339
|
-
|
|
523
|
+
s = this.resourcePath;
|
|
340
524
|
else if (this.path !== "") {
|
|
341
|
-
const
|
|
342
|
-
|
|
525
|
+
const l = K.extractUrlBase(e);
|
|
526
|
+
s = K.resolveURL(l, this.path);
|
|
343
527
|
} else
|
|
344
|
-
|
|
528
|
+
s = K.extractUrlBase(e);
|
|
345
529
|
this.manager.itemStart(e);
|
|
346
|
-
const
|
|
347
|
-
n ? n(
|
|
348
|
-
},
|
|
349
|
-
|
|
530
|
+
const a = function(l) {
|
|
531
|
+
n ? n(l) : console.error(l), i.manager.itemError(e), i.manager.itemEnd(e);
|
|
532
|
+
}, o = new X(this.manager);
|
|
533
|
+
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(l) {
|
|
350
534
|
try {
|
|
351
|
-
|
|
352
|
-
t(
|
|
353
|
-
},
|
|
354
|
-
} catch (
|
|
355
|
-
|
|
535
|
+
i.parse(l, s, function(u) {
|
|
536
|
+
t(u), i.manager.itemEnd(e);
|
|
537
|
+
}, a);
|
|
538
|
+
} catch (u) {
|
|
539
|
+
a(u);
|
|
356
540
|
}
|
|
357
|
-
},
|
|
541
|
+
}, r, a);
|
|
358
542
|
}
|
|
359
543
|
setDRACOLoader(e) {
|
|
360
544
|
return this.dracoLoader = e, this;
|
|
@@ -371,29 +555,29 @@ class nn extends He {
|
|
|
371
555
|
unregister(e) {
|
|
372
556
|
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
373
557
|
}
|
|
374
|
-
parse(e, t,
|
|
375
|
-
let
|
|
376
|
-
const
|
|
558
|
+
parse(e, t, r, n) {
|
|
559
|
+
let i;
|
|
560
|
+
const s = {}, a = {}, o = new TextDecoder();
|
|
377
561
|
if (typeof e == "string")
|
|
378
|
-
|
|
562
|
+
i = JSON.parse(e);
|
|
379
563
|
else if (e instanceof ArrayBuffer)
|
|
380
|
-
if (
|
|
564
|
+
if (o.decode(new Uint8Array(e, 0, 4)) === Je) {
|
|
381
565
|
try {
|
|
382
|
-
|
|
566
|
+
s[_.KHR_BINARY_GLTF] = new Dn(e);
|
|
383
567
|
} catch (d) {
|
|
384
568
|
n && n(d);
|
|
385
569
|
return;
|
|
386
570
|
}
|
|
387
|
-
|
|
571
|
+
i = JSON.parse(s[_.KHR_BINARY_GLTF].content);
|
|
388
572
|
} else
|
|
389
|
-
|
|
573
|
+
i = JSON.parse(o.decode(e));
|
|
390
574
|
else
|
|
391
|
-
|
|
392
|
-
if (
|
|
575
|
+
i = e;
|
|
576
|
+
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
393
577
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
394
578
|
return;
|
|
395
579
|
}
|
|
396
|
-
const
|
|
580
|
+
const l = new Wn(i, {
|
|
397
581
|
path: t || this.resourcePath || "",
|
|
398
582
|
crossOrigin: this.crossOrigin,
|
|
399
583
|
requestHeader: this.requestHeader,
|
|
@@ -401,58 +585,58 @@ class nn extends He {
|
|
|
401
585
|
ktx2Loader: this.ktx2Loader,
|
|
402
586
|
meshoptDecoder: this.meshoptDecoder
|
|
403
587
|
});
|
|
404
|
-
|
|
405
|
-
for (let
|
|
406
|
-
const d = this.pluginCallbacks[
|
|
407
|
-
d.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),
|
|
588
|
+
l.fileLoader.setRequestHeader(this.requestHeader);
|
|
589
|
+
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
590
|
+
const d = this.pluginCallbacks[u](l);
|
|
591
|
+
d.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[d.name] = d, s[d.name] = !0;
|
|
408
592
|
}
|
|
409
|
-
if (
|
|
410
|
-
for (let
|
|
411
|
-
const d =
|
|
593
|
+
if (i.extensionsUsed)
|
|
594
|
+
for (let u = 0; u < i.extensionsUsed.length; ++u) {
|
|
595
|
+
const d = i.extensionsUsed[u], h = i.extensionsRequired || [];
|
|
412
596
|
switch (d) {
|
|
413
|
-
case
|
|
414
|
-
|
|
597
|
+
case _.KHR_MATERIALS_UNLIT:
|
|
598
|
+
s[d] = new Tn();
|
|
415
599
|
break;
|
|
416
|
-
case
|
|
417
|
-
|
|
600
|
+
case _.KHR_DRACO_MESH_COMPRESSION:
|
|
601
|
+
s[d] = new kn(i, this.dracoLoader);
|
|
418
602
|
break;
|
|
419
|
-
case
|
|
420
|
-
|
|
603
|
+
case _.KHR_TEXTURE_TRANSFORM:
|
|
604
|
+
s[d] = new Fn();
|
|
421
605
|
break;
|
|
422
|
-
case
|
|
423
|
-
|
|
606
|
+
case _.KHR_MESH_QUANTIZATION:
|
|
607
|
+
s[d] = new Hn();
|
|
424
608
|
break;
|
|
425
609
|
default:
|
|
426
|
-
|
|
610
|
+
h.indexOf(d) >= 0 && a[d] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + d + '".');
|
|
427
611
|
}
|
|
428
612
|
}
|
|
429
|
-
|
|
613
|
+
l.setExtensions(s), l.setPlugins(a), l.parse(r, n);
|
|
430
614
|
}
|
|
431
615
|
parseAsync(e, t) {
|
|
432
|
-
const
|
|
433
|
-
return new Promise(function(n,
|
|
434
|
-
|
|
616
|
+
const r = this;
|
|
617
|
+
return new Promise(function(n, i) {
|
|
618
|
+
r.parse(e, t, n, i);
|
|
435
619
|
});
|
|
436
620
|
}
|
|
437
621
|
}
|
|
438
|
-
function
|
|
439
|
-
let
|
|
622
|
+
function gn() {
|
|
623
|
+
let c = {};
|
|
440
624
|
return {
|
|
441
625
|
get: function(e) {
|
|
442
|
-
return
|
|
626
|
+
return c[e];
|
|
443
627
|
},
|
|
444
628
|
add: function(e, t) {
|
|
445
|
-
|
|
629
|
+
c[e] = t;
|
|
446
630
|
},
|
|
447
631
|
remove: function(e) {
|
|
448
|
-
delete
|
|
632
|
+
delete c[e];
|
|
449
633
|
},
|
|
450
634
|
removeAll: function() {
|
|
451
|
-
|
|
635
|
+
c = {};
|
|
452
636
|
}
|
|
453
637
|
};
|
|
454
638
|
}
|
|
455
|
-
const
|
|
639
|
+
const _ = {
|
|
456
640
|
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
457
641
|
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
458
642
|
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
@@ -476,295 +660,295 @@ const w = {
|
|
|
476
660
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
477
661
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
478
662
|
};
|
|
479
|
-
class
|
|
663
|
+
class An {
|
|
480
664
|
constructor(e) {
|
|
481
|
-
this.parser = e, this.name =
|
|
665
|
+
this.parser = e, this.name = _.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
482
666
|
}
|
|
483
667
|
_markDefs() {
|
|
484
668
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
485
|
-
for (let
|
|
486
|
-
const
|
|
487
|
-
|
|
669
|
+
for (let r = 0, n = t.length; r < n; r++) {
|
|
670
|
+
const i = t[r];
|
|
671
|
+
i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, i.extensions[this.name].light);
|
|
488
672
|
}
|
|
489
673
|
}
|
|
490
674
|
_loadLight(e) {
|
|
491
|
-
const t = this.parser,
|
|
492
|
-
let n = t.cache.get(
|
|
675
|
+
const t = this.parser, r = "light:" + e;
|
|
676
|
+
let n = t.cache.get(r);
|
|
493
677
|
if (n) return n;
|
|
494
|
-
const
|
|
495
|
-
let
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
const d =
|
|
499
|
-
switch (
|
|
678
|
+
const i = t.json, o = ((i.extensions && i.extensions[this.name] || {}).lights || [])[e];
|
|
679
|
+
let l;
|
|
680
|
+
const u = new P(16777215);
|
|
681
|
+
o.color !== void 0 && u.setRGB(o.color[0], o.color[1], o.color[2], b);
|
|
682
|
+
const d = o.range !== void 0 ? o.range : 0;
|
|
683
|
+
switch (o.type) {
|
|
500
684
|
case "directional":
|
|
501
|
-
|
|
685
|
+
l = new mt(u), l.target.position.set(0, 0, -1), l.add(l.target);
|
|
502
686
|
break;
|
|
503
687
|
case "point":
|
|
504
|
-
|
|
688
|
+
l = new pt(u), l.distance = d;
|
|
505
689
|
break;
|
|
506
690
|
case "spot":
|
|
507
|
-
|
|
691
|
+
l = new ft(u), l.distance = d, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, l.angle = o.spot.outerConeAngle, l.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
|
|
508
692
|
break;
|
|
509
693
|
default:
|
|
510
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " +
|
|
694
|
+
throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
|
|
511
695
|
}
|
|
512
|
-
return
|
|
696
|
+
return l.position.set(0, 0, 0), l.decay = 2, S(l, o), o.intensity !== void 0 && (l.intensity = o.intensity), l.name = t.createUniqueName(o.name || "light_" + e), n = Promise.resolve(l), t.cache.add(r, n), n;
|
|
513
697
|
}
|
|
514
698
|
getDependency(e, t) {
|
|
515
699
|
if (e === "light")
|
|
516
700
|
return this._loadLight(t);
|
|
517
701
|
}
|
|
518
702
|
createNodeAttachment(e) {
|
|
519
|
-
const t = this,
|
|
520
|
-
return
|
|
521
|
-
return
|
|
703
|
+
const t = this, r = this.parser, i = r.json.nodes[e], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
704
|
+
return a === void 0 ? null : this._loadLight(a).then(function(o) {
|
|
705
|
+
return r._getNodeRef(t.cache, a, o);
|
|
522
706
|
});
|
|
523
707
|
}
|
|
524
708
|
}
|
|
525
|
-
class
|
|
709
|
+
class Tn {
|
|
526
710
|
constructor() {
|
|
527
|
-
this.name =
|
|
711
|
+
this.name = _.KHR_MATERIALS_UNLIT;
|
|
528
712
|
}
|
|
529
713
|
getMaterialType() {
|
|
530
|
-
return
|
|
714
|
+
return B;
|
|
531
715
|
}
|
|
532
|
-
extendParams(e, t,
|
|
716
|
+
extendParams(e, t, r) {
|
|
533
717
|
const n = [];
|
|
534
|
-
e.color = new
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
if (Array.isArray(
|
|
538
|
-
const
|
|
539
|
-
e.color.setRGB(
|
|
718
|
+
e.color = new P(1, 1, 1), e.opacity = 1;
|
|
719
|
+
const i = t.pbrMetallicRoughness;
|
|
720
|
+
if (i) {
|
|
721
|
+
if (Array.isArray(i.baseColorFactor)) {
|
|
722
|
+
const s = i.baseColorFactor;
|
|
723
|
+
e.color.setRGB(s[0], s[1], s[2], b), e.opacity = s[3];
|
|
540
724
|
}
|
|
541
|
-
|
|
725
|
+
i.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", i.baseColorTexture, O));
|
|
542
726
|
}
|
|
543
727
|
return Promise.all(n);
|
|
544
728
|
}
|
|
545
729
|
}
|
|
546
|
-
class
|
|
730
|
+
class _n {
|
|
547
731
|
constructor(e) {
|
|
548
|
-
this.parser = e, this.name =
|
|
732
|
+
this.parser = e, this.name = _.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
549
733
|
}
|
|
550
734
|
extendMaterialParams(e, t) {
|
|
551
735
|
const n = this.parser.json.materials[e];
|
|
552
736
|
if (!n.extensions || !n.extensions[this.name])
|
|
553
737
|
return Promise.resolve();
|
|
554
|
-
const
|
|
555
|
-
return
|
|
738
|
+
const i = n.extensions[this.name].emissiveStrength;
|
|
739
|
+
return i !== void 0 && (t.emissiveIntensity = i), Promise.resolve();
|
|
556
740
|
}
|
|
557
741
|
}
|
|
558
|
-
class
|
|
742
|
+
class yn {
|
|
559
743
|
constructor(e) {
|
|
560
|
-
this.parser = e, this.name =
|
|
744
|
+
this.parser = e, this.name = _.KHR_MATERIALS_CLEARCOAT;
|
|
561
745
|
}
|
|
562
746
|
getMaterialType(e) {
|
|
563
|
-
const
|
|
564
|
-
return !
|
|
747
|
+
const r = this.parser.json.materials[e];
|
|
748
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
565
749
|
}
|
|
566
750
|
extendMaterialParams(e, t) {
|
|
567
|
-
const
|
|
751
|
+
const r = this.parser, n = r.json.materials[e];
|
|
568
752
|
if (!n.extensions || !n.extensions[this.name])
|
|
569
753
|
return Promise.resolve();
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
const
|
|
573
|
-
t.clearcoatNormalScale = new je(
|
|
754
|
+
const i = [], s = n.extensions[this.name];
|
|
755
|
+
if (s.clearcoatFactor !== void 0 && (t.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (i.push(r.assignTexture(t, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
|
|
756
|
+
const a = s.clearcoatNormalTexture.scale;
|
|
757
|
+
t.clearcoatNormalScale = new je(a, a);
|
|
574
758
|
}
|
|
575
|
-
return Promise.all(
|
|
759
|
+
return Promise.all(i);
|
|
576
760
|
}
|
|
577
761
|
}
|
|
578
|
-
class
|
|
762
|
+
class wn {
|
|
579
763
|
constructor(e) {
|
|
580
|
-
this.parser = e, this.name =
|
|
764
|
+
this.parser = e, this.name = _.KHR_MATERIALS_DISPERSION;
|
|
581
765
|
}
|
|
582
766
|
getMaterialType(e) {
|
|
583
|
-
const
|
|
584
|
-
return !
|
|
767
|
+
const r = this.parser.json.materials[e];
|
|
768
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
585
769
|
}
|
|
586
770
|
extendMaterialParams(e, t) {
|
|
587
771
|
const n = this.parser.json.materials[e];
|
|
588
772
|
if (!n.extensions || !n.extensions[this.name])
|
|
589
773
|
return Promise.resolve();
|
|
590
|
-
const
|
|
591
|
-
return t.dispersion =
|
|
774
|
+
const i = n.extensions[this.name];
|
|
775
|
+
return t.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
592
776
|
}
|
|
593
777
|
}
|
|
594
|
-
class
|
|
778
|
+
class En {
|
|
595
779
|
constructor(e) {
|
|
596
|
-
this.parser = e, this.name =
|
|
780
|
+
this.parser = e, this.name = _.KHR_MATERIALS_IRIDESCENCE;
|
|
597
781
|
}
|
|
598
782
|
getMaterialType(e) {
|
|
599
|
-
const
|
|
600
|
-
return !
|
|
783
|
+
const r = this.parser.json.materials[e];
|
|
784
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
601
785
|
}
|
|
602
786
|
extendMaterialParams(e, t) {
|
|
603
|
-
const
|
|
787
|
+
const r = this.parser, n = r.json.materials[e];
|
|
604
788
|
if (!n.extensions || !n.extensions[this.name])
|
|
605
789
|
return Promise.resolve();
|
|
606
|
-
const
|
|
607
|
-
return
|
|
790
|
+
const i = [], s = n.extensions[this.name];
|
|
791
|
+
return s.iridescenceFactor !== void 0 && (t.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (t.iridescenceIOR = s.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && i.push(r.assignTexture(t, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(i);
|
|
608
792
|
}
|
|
609
793
|
}
|
|
610
|
-
class
|
|
794
|
+
class Rn {
|
|
611
795
|
constructor(e) {
|
|
612
|
-
this.parser = e, this.name =
|
|
796
|
+
this.parser = e, this.name = _.KHR_MATERIALS_SHEEN;
|
|
613
797
|
}
|
|
614
798
|
getMaterialType(e) {
|
|
615
|
-
const
|
|
616
|
-
return !
|
|
799
|
+
const r = this.parser.json.materials[e];
|
|
800
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
617
801
|
}
|
|
618
802
|
extendMaterialParams(e, t) {
|
|
619
|
-
const
|
|
803
|
+
const r = this.parser, n = r.json.materials[e];
|
|
620
804
|
if (!n.extensions || !n.extensions[this.name])
|
|
621
805
|
return Promise.resolve();
|
|
622
|
-
const
|
|
623
|
-
t.sheenColor = new
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
t.sheenColor.setRGB(
|
|
806
|
+
const i = [];
|
|
807
|
+
t.sheenColor = new P(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
808
|
+
const s = n.extensions[this.name];
|
|
809
|
+
if (s.sheenColorFactor !== void 0) {
|
|
810
|
+
const a = s.sheenColorFactor;
|
|
811
|
+
t.sheenColor.setRGB(a[0], a[1], a[2], b);
|
|
628
812
|
}
|
|
629
|
-
return
|
|
813
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && i.push(r.assignTexture(t, "sheenColorMap", s.sheenColorTexture, O)), s.sheenRoughnessTexture !== void 0 && i.push(r.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(i);
|
|
630
814
|
}
|
|
631
815
|
}
|
|
632
|
-
class
|
|
816
|
+
class xn {
|
|
633
817
|
constructor(e) {
|
|
634
|
-
this.parser = e, this.name =
|
|
818
|
+
this.parser = e, this.name = _.KHR_MATERIALS_TRANSMISSION;
|
|
635
819
|
}
|
|
636
820
|
getMaterialType(e) {
|
|
637
|
-
const
|
|
638
|
-
return !
|
|
821
|
+
const r = this.parser.json.materials[e];
|
|
822
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
639
823
|
}
|
|
640
824
|
extendMaterialParams(e, t) {
|
|
641
|
-
const
|
|
825
|
+
const r = this.parser, n = r.json.materials[e];
|
|
642
826
|
if (!n.extensions || !n.extensions[this.name])
|
|
643
827
|
return Promise.resolve();
|
|
644
|
-
const
|
|
645
|
-
return
|
|
828
|
+
const i = [], s = n.extensions[this.name];
|
|
829
|
+
return s.transmissionFactor !== void 0 && (t.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && i.push(r.assignTexture(t, "transmissionMap", s.transmissionTexture)), Promise.all(i);
|
|
646
830
|
}
|
|
647
831
|
}
|
|
648
|
-
class
|
|
832
|
+
class Ln {
|
|
649
833
|
constructor(e) {
|
|
650
|
-
this.parser = e, this.name =
|
|
834
|
+
this.parser = e, this.name = _.KHR_MATERIALS_VOLUME;
|
|
651
835
|
}
|
|
652
836
|
getMaterialType(e) {
|
|
653
|
-
const
|
|
654
|
-
return !
|
|
837
|
+
const r = this.parser.json.materials[e];
|
|
838
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
655
839
|
}
|
|
656
840
|
extendMaterialParams(e, t) {
|
|
657
|
-
const
|
|
841
|
+
const r = this.parser, n = r.json.materials[e];
|
|
658
842
|
if (!n.extensions || !n.extensions[this.name])
|
|
659
843
|
return Promise.resolve();
|
|
660
|
-
const
|
|
661
|
-
t.thickness =
|
|
662
|
-
const
|
|
663
|
-
return t.attenuationColor = new
|
|
844
|
+
const i = [], s = n.extensions[this.name];
|
|
845
|
+
t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && i.push(r.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
|
|
846
|
+
const a = s.attenuationColor || [1, 1, 1];
|
|
847
|
+
return t.attenuationColor = new P().setRGB(a[0], a[1], a[2], b), Promise.all(i);
|
|
664
848
|
}
|
|
665
849
|
}
|
|
666
|
-
class
|
|
850
|
+
class bn {
|
|
667
851
|
constructor(e) {
|
|
668
|
-
this.parser = e, this.name =
|
|
852
|
+
this.parser = e, this.name = _.KHR_MATERIALS_IOR;
|
|
669
853
|
}
|
|
670
854
|
getMaterialType(e) {
|
|
671
|
-
const
|
|
672
|
-
return !
|
|
855
|
+
const r = this.parser.json.materials[e];
|
|
856
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
673
857
|
}
|
|
674
858
|
extendMaterialParams(e, t) {
|
|
675
859
|
const n = this.parser.json.materials[e];
|
|
676
860
|
if (!n.extensions || !n.extensions[this.name])
|
|
677
861
|
return Promise.resolve();
|
|
678
|
-
const
|
|
679
|
-
return t.ior =
|
|
862
|
+
const i = n.extensions[this.name];
|
|
863
|
+
return t.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
680
864
|
}
|
|
681
865
|
}
|
|
682
|
-
class
|
|
866
|
+
class vn {
|
|
683
867
|
constructor(e) {
|
|
684
|
-
this.parser = e, this.name =
|
|
868
|
+
this.parser = e, this.name = _.KHR_MATERIALS_SPECULAR;
|
|
685
869
|
}
|
|
686
870
|
getMaterialType(e) {
|
|
687
|
-
const
|
|
688
|
-
return !
|
|
871
|
+
const r = this.parser.json.materials[e];
|
|
872
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
689
873
|
}
|
|
690
874
|
extendMaterialParams(e, t) {
|
|
691
|
-
const
|
|
875
|
+
const r = this.parser, n = r.json.materials[e];
|
|
692
876
|
if (!n.extensions || !n.extensions[this.name])
|
|
693
877
|
return Promise.resolve();
|
|
694
|
-
const
|
|
695
|
-
t.specularIntensity =
|
|
696
|
-
const
|
|
697
|
-
return t.specularColor = new
|
|
878
|
+
const i = [], s = n.extensions[this.name];
|
|
879
|
+
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && i.push(r.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
880
|
+
const a = s.specularColorFactor || [1, 1, 1];
|
|
881
|
+
return t.specularColor = new P().setRGB(a[0], a[1], a[2], b), s.specularColorTexture !== void 0 && i.push(r.assignTexture(t, "specularColorMap", s.specularColorTexture, O)), Promise.all(i);
|
|
698
882
|
}
|
|
699
883
|
}
|
|
700
|
-
class
|
|
884
|
+
class Sn {
|
|
701
885
|
constructor(e) {
|
|
702
|
-
this.parser = e, this.name =
|
|
886
|
+
this.parser = e, this.name = _.EXT_MATERIALS_BUMP;
|
|
703
887
|
}
|
|
704
888
|
getMaterialType(e) {
|
|
705
|
-
const
|
|
706
|
-
return !
|
|
889
|
+
const r = this.parser.json.materials[e];
|
|
890
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
707
891
|
}
|
|
708
892
|
extendMaterialParams(e, t) {
|
|
709
|
-
const
|
|
893
|
+
const r = this.parser, n = r.json.materials[e];
|
|
710
894
|
if (!n.extensions || !n.extensions[this.name])
|
|
711
895
|
return Promise.resolve();
|
|
712
|
-
const
|
|
713
|
-
return t.bumpScale =
|
|
896
|
+
const i = [], s = n.extensions[this.name];
|
|
897
|
+
return t.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && i.push(r.assignTexture(t, "bumpMap", s.bumpTexture)), Promise.all(i);
|
|
714
898
|
}
|
|
715
899
|
}
|
|
716
|
-
class
|
|
900
|
+
class Mn {
|
|
717
901
|
constructor(e) {
|
|
718
|
-
this.parser = e, this.name =
|
|
902
|
+
this.parser = e, this.name = _.KHR_MATERIALS_ANISOTROPY;
|
|
719
903
|
}
|
|
720
904
|
getMaterialType(e) {
|
|
721
|
-
const
|
|
722
|
-
return !
|
|
905
|
+
const r = this.parser.json.materials[e];
|
|
906
|
+
return !r.extensions || !r.extensions[this.name] ? null : v;
|
|
723
907
|
}
|
|
724
908
|
extendMaterialParams(e, t) {
|
|
725
|
-
const
|
|
909
|
+
const r = this.parser, n = r.json.materials[e];
|
|
726
910
|
if (!n.extensions || !n.extensions[this.name])
|
|
727
911
|
return Promise.resolve();
|
|
728
|
-
const
|
|
729
|
-
return
|
|
912
|
+
const i = [], s = n.extensions[this.name];
|
|
913
|
+
return s.anisotropyStrength !== void 0 && (t.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (t.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && i.push(r.assignTexture(t, "anisotropyMap", s.anisotropyTexture)), Promise.all(i);
|
|
730
914
|
}
|
|
731
915
|
}
|
|
732
|
-
class
|
|
916
|
+
class Cn {
|
|
733
917
|
constructor(e) {
|
|
734
|
-
this.parser = e, this.name =
|
|
918
|
+
this.parser = e, this.name = _.KHR_TEXTURE_BASISU;
|
|
735
919
|
}
|
|
736
920
|
loadTexture(e) {
|
|
737
|
-
const t = this.parser,
|
|
921
|
+
const t = this.parser, r = t.json, n = r.textures[e];
|
|
738
922
|
if (!n.extensions || !n.extensions[this.name])
|
|
739
923
|
return null;
|
|
740
|
-
const
|
|
741
|
-
if (!
|
|
742
|
-
if (
|
|
924
|
+
const i = n.extensions[this.name], s = t.options.ktx2Loader;
|
|
925
|
+
if (!s) {
|
|
926
|
+
if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
|
|
743
927
|
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
744
928
|
return null;
|
|
745
929
|
}
|
|
746
|
-
return t.loadTextureImage(e,
|
|
930
|
+
return t.loadTextureImage(e, i.source, s);
|
|
747
931
|
}
|
|
748
932
|
}
|
|
749
|
-
class
|
|
933
|
+
class In {
|
|
750
934
|
constructor(e) {
|
|
751
|
-
this.parser = e, this.name =
|
|
935
|
+
this.parser = e, this.name = _.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
752
936
|
}
|
|
753
937
|
loadTexture(e) {
|
|
754
|
-
const t = this.name,
|
|
755
|
-
if (!
|
|
938
|
+
const t = this.name, r = this.parser, n = r.json, i = n.textures[e];
|
|
939
|
+
if (!i.extensions || !i.extensions[t])
|
|
756
940
|
return null;
|
|
757
|
-
const
|
|
758
|
-
let
|
|
759
|
-
if (
|
|
760
|
-
const
|
|
761
|
-
|
|
941
|
+
const s = i.extensions[t], a = n.images[s.source];
|
|
942
|
+
let o = r.textureLoader;
|
|
943
|
+
if (a.uri) {
|
|
944
|
+
const l = r.options.manager.getHandler(a.uri);
|
|
945
|
+
l !== null && (o = l);
|
|
762
946
|
}
|
|
763
|
-
return this.detectSupport().then(function(
|
|
764
|
-
if (
|
|
947
|
+
return this.detectSupport().then(function(l) {
|
|
948
|
+
if (l) return r.loadTextureImage(e, s.source, o);
|
|
765
949
|
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
766
950
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
767
|
-
return
|
|
951
|
+
return r.loadTexture(e);
|
|
768
952
|
});
|
|
769
953
|
}
|
|
770
954
|
detectSupport() {
|
|
@@ -776,25 +960,25 @@ class wn {
|
|
|
776
960
|
})), this.isSupported;
|
|
777
961
|
}
|
|
778
962
|
}
|
|
779
|
-
class
|
|
963
|
+
class On {
|
|
780
964
|
constructor(e) {
|
|
781
|
-
this.parser = e, this.name =
|
|
965
|
+
this.parser = e, this.name = _.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
782
966
|
}
|
|
783
967
|
loadTexture(e) {
|
|
784
|
-
const t = this.name,
|
|
785
|
-
if (!
|
|
968
|
+
const t = this.name, r = this.parser, n = r.json, i = n.textures[e];
|
|
969
|
+
if (!i.extensions || !i.extensions[t])
|
|
786
970
|
return null;
|
|
787
|
-
const
|
|
788
|
-
let
|
|
789
|
-
if (
|
|
790
|
-
const
|
|
791
|
-
|
|
971
|
+
const s = i.extensions[t], a = n.images[s.source];
|
|
972
|
+
let o = r.textureLoader;
|
|
973
|
+
if (a.uri) {
|
|
974
|
+
const l = r.options.manager.getHandler(a.uri);
|
|
975
|
+
l !== null && (o = l);
|
|
792
976
|
}
|
|
793
|
-
return this.detectSupport().then(function(
|
|
794
|
-
if (
|
|
977
|
+
return this.detectSupport().then(function(l) {
|
|
978
|
+
if (l) return r.loadTextureImage(e, s.source, o);
|
|
795
979
|
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
796
980
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
797
|
-
return
|
|
981
|
+
return r.loadTexture(e);
|
|
798
982
|
});
|
|
799
983
|
}
|
|
800
984
|
detectSupport() {
|
|
@@ -806,168 +990,168 @@ class yn {
|
|
|
806
990
|
})), this.isSupported;
|
|
807
991
|
}
|
|
808
992
|
}
|
|
809
|
-
class
|
|
993
|
+
class Nn {
|
|
810
994
|
constructor(e) {
|
|
811
|
-
this.name =
|
|
995
|
+
this.name = _.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
812
996
|
}
|
|
813
997
|
loadBufferView(e) {
|
|
814
|
-
const t = this.parser.json,
|
|
815
|
-
if (
|
|
816
|
-
const n =
|
|
817
|
-
if (!
|
|
998
|
+
const t = this.parser.json, r = t.bufferViews[e];
|
|
999
|
+
if (r.extensions && r.extensions[this.name]) {
|
|
1000
|
+
const n = r.extensions[this.name], i = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
|
|
1001
|
+
if (!s || !s.supported) {
|
|
818
1002
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
|
|
819
1003
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
820
1004
|
return null;
|
|
821
1005
|
}
|
|
822
|
-
return
|
|
823
|
-
const
|
|
824
|
-
return
|
|
825
|
-
return
|
|
826
|
-
}) :
|
|
827
|
-
const
|
|
828
|
-
return
|
|
1006
|
+
return i.then(function(a) {
|
|
1007
|
+
const o = n.byteOffset || 0, l = n.byteLength || 0, u = n.count, d = n.byteStride, h = new Uint8Array(a, o, l);
|
|
1008
|
+
return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(u, d, h, n.mode, n.filter).then(function(f) {
|
|
1009
|
+
return f.buffer;
|
|
1010
|
+
}) : s.ready.then(function() {
|
|
1011
|
+
const f = new ArrayBuffer(u * d);
|
|
1012
|
+
return s.decodeGltfBuffer(new Uint8Array(f), u, d, h, n.mode, n.filter), f;
|
|
829
1013
|
});
|
|
830
1014
|
});
|
|
831
1015
|
} else
|
|
832
1016
|
return null;
|
|
833
1017
|
}
|
|
834
1018
|
}
|
|
835
|
-
class
|
|
1019
|
+
class Pn {
|
|
836
1020
|
constructor(e) {
|
|
837
|
-
this.name =
|
|
1021
|
+
this.name = _.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
838
1022
|
}
|
|
839
1023
|
createNodeMesh(e) {
|
|
840
|
-
const t = this.parser.json,
|
|
841
|
-
if (!
|
|
1024
|
+
const t = this.parser.json, r = t.nodes[e];
|
|
1025
|
+
if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
|
|
842
1026
|
return null;
|
|
843
|
-
const n = t.meshes[
|
|
844
|
-
for (const
|
|
845
|
-
if (
|
|
1027
|
+
const n = t.meshes[r.mesh];
|
|
1028
|
+
for (const l of n.primitives)
|
|
1029
|
+
if (l.mode !== R.TRIANGLES && l.mode !== R.TRIANGLE_STRIP && l.mode !== R.TRIANGLE_FAN && l.mode !== void 0)
|
|
846
1030
|
return null;
|
|
847
|
-
const
|
|
848
|
-
for (const
|
|
849
|
-
|
|
850
|
-
return
|
|
851
|
-
const
|
|
852
|
-
for (const
|
|
853
|
-
const
|
|
854
|
-
for (let
|
|
855
|
-
|
|
856
|
-
for (const
|
|
857
|
-
if (
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
} else
|
|
861
|
-
Ve.prototype.copy.call(
|
|
1031
|
+
const s = r.extensions[this.name].attributes, a = [], o = {};
|
|
1032
|
+
for (const l in s)
|
|
1033
|
+
a.push(this.parser.getDependency("accessor", s[l]).then((u) => (o[l] = u, o[l])));
|
|
1034
|
+
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((l) => {
|
|
1035
|
+
const u = l.pop(), d = u.isGroup ? u.children : [u], h = l[0].count, f = [];
|
|
1036
|
+
for (const p of d) {
|
|
1037
|
+
const g = new W(), m = new F(), A = new Ke(), y = new F(1, 1, 1), E = new gt(p.geometry, p.material, h);
|
|
1038
|
+
for (let w = 0; w < h; w++)
|
|
1039
|
+
o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, w), o.ROTATION && A.fromBufferAttribute(o.ROTATION, w), o.SCALE && y.fromBufferAttribute(o.SCALE, w), E.setMatrixAt(w, g.compose(m, A, y));
|
|
1040
|
+
for (const w in o)
|
|
1041
|
+
if (w === "_COLOR_0") {
|
|
1042
|
+
const L = o[w];
|
|
1043
|
+
E.instanceColor = new At(L.array, L.itemSize, L.normalized);
|
|
1044
|
+
} else w !== "TRANSLATION" && w !== "ROTATION" && w !== "SCALE" && p.geometry.setAttribute(w, o[w]);
|
|
1045
|
+
Ve.prototype.copy.call(E, p), this.parser.assignFinalMaterial(E), f.push(E);
|
|
862
1046
|
}
|
|
863
|
-
return
|
|
1047
|
+
return u.isGroup ? (u.clear(), u.add(...f), u) : f[0];
|
|
864
1048
|
}));
|
|
865
1049
|
}
|
|
866
1050
|
}
|
|
867
|
-
const Je = "glTF",
|
|
868
|
-
class
|
|
1051
|
+
const Je = "glTF", G = 12, Se = { JSON: 1313821514, BIN: 5130562 };
|
|
1052
|
+
class Dn {
|
|
869
1053
|
constructor(e) {
|
|
870
|
-
this.name =
|
|
871
|
-
const t = new DataView(e, 0,
|
|
1054
|
+
this.name = _.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
1055
|
+
const t = new DataView(e, 0, G), r = new TextDecoder();
|
|
872
1056
|
if (this.header = {
|
|
873
|
-
magic:
|
|
1057
|
+
magic: r.decode(new Uint8Array(e.slice(0, 4))),
|
|
874
1058
|
version: t.getUint32(4, !0),
|
|
875
1059
|
length: t.getUint32(8, !0)
|
|
876
1060
|
}, this.header.magic !== Je)
|
|
877
1061
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
878
1062
|
if (this.header.version < 2)
|
|
879
1063
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
880
|
-
const n = this.header.length -
|
|
881
|
-
let
|
|
882
|
-
for (;
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
if (
|
|
887
|
-
const
|
|
888
|
-
this.content =
|
|
889
|
-
} else if (
|
|
890
|
-
const
|
|
891
|
-
this.body = e.slice(
|
|
1064
|
+
const n = this.header.length - G, i = new DataView(e, G);
|
|
1065
|
+
let s = 0;
|
|
1066
|
+
for (; s < n; ) {
|
|
1067
|
+
const a = i.getUint32(s, !0);
|
|
1068
|
+
s += 4;
|
|
1069
|
+
const o = i.getUint32(s, !0);
|
|
1070
|
+
if (s += 4, o === Se.JSON) {
|
|
1071
|
+
const l = new Uint8Array(e, G + s, a);
|
|
1072
|
+
this.content = r.decode(l);
|
|
1073
|
+
} else if (o === Se.BIN) {
|
|
1074
|
+
const l = G + s;
|
|
1075
|
+
this.body = e.slice(l, l + a);
|
|
892
1076
|
}
|
|
893
|
-
|
|
1077
|
+
s += a;
|
|
894
1078
|
}
|
|
895
1079
|
if (this.content === null)
|
|
896
1080
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
897
1081
|
}
|
|
898
1082
|
}
|
|
899
|
-
class
|
|
1083
|
+
class kn {
|
|
900
1084
|
constructor(e, t) {
|
|
901
1085
|
if (!t)
|
|
902
1086
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
903
|
-
this.name =
|
|
1087
|
+
this.name = _.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
904
1088
|
}
|
|
905
1089
|
decodePrimitive(e, t) {
|
|
906
|
-
const
|
|
907
|
-
for (const
|
|
908
|
-
const d =
|
|
909
|
-
|
|
1090
|
+
const r = this.json, n = this.dracoLoader, i = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes, a = {}, o = {}, l = {};
|
|
1091
|
+
for (const u in s) {
|
|
1092
|
+
const d = he[u] || u.toLowerCase();
|
|
1093
|
+
a[d] = s[u];
|
|
910
1094
|
}
|
|
911
|
-
for (const
|
|
912
|
-
const d =
|
|
913
|
-
if (
|
|
914
|
-
const
|
|
915
|
-
|
|
1095
|
+
for (const u in e.attributes) {
|
|
1096
|
+
const d = he[u] || u.toLowerCase();
|
|
1097
|
+
if (s[u] !== void 0) {
|
|
1098
|
+
const h = r.accessors[e.attributes[u]], f = H[h.componentType];
|
|
1099
|
+
l[d] = f.name, o[d] = h.normalized === !0;
|
|
916
1100
|
}
|
|
917
1101
|
}
|
|
918
|
-
return t.getDependency("bufferView",
|
|
919
|
-
return new Promise(function(d,
|
|
920
|
-
n.decodeDracoFile(
|
|
921
|
-
for (const
|
|
922
|
-
const
|
|
923
|
-
m !== void 0 && (
|
|
1102
|
+
return t.getDependency("bufferView", i).then(function(u) {
|
|
1103
|
+
return new Promise(function(d, h) {
|
|
1104
|
+
n.decodeDracoFile(u, function(f) {
|
|
1105
|
+
for (const p in f.attributes) {
|
|
1106
|
+
const g = f.attributes[p], m = o[p];
|
|
1107
|
+
m !== void 0 && (g.normalized = m);
|
|
924
1108
|
}
|
|
925
|
-
d(
|
|
926
|
-
},
|
|
1109
|
+
d(f);
|
|
1110
|
+
}, a, l, b, h);
|
|
927
1111
|
});
|
|
928
1112
|
});
|
|
929
1113
|
}
|
|
930
1114
|
}
|
|
931
|
-
class
|
|
1115
|
+
class Fn {
|
|
932
1116
|
constructor() {
|
|
933
|
-
this.name =
|
|
1117
|
+
this.name = _.KHR_TEXTURE_TRANSFORM;
|
|
934
1118
|
}
|
|
935
1119
|
extendTexture(e, t) {
|
|
936
1120
|
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;
|
|
937
1121
|
}
|
|
938
1122
|
}
|
|
939
|
-
class
|
|
1123
|
+
class Hn {
|
|
940
1124
|
constructor() {
|
|
941
|
-
this.name =
|
|
1125
|
+
this.name = _.KHR_MESH_QUANTIZATION;
|
|
942
1126
|
}
|
|
943
1127
|
}
|
|
944
|
-
class
|
|
945
|
-
constructor(e, t,
|
|
946
|
-
super(e, t,
|
|
1128
|
+
class Ze extends $t {
|
|
1129
|
+
constructor(e, t, r, n) {
|
|
1130
|
+
super(e, t, r, n);
|
|
947
1131
|
}
|
|
948
1132
|
copySampleValue_(e) {
|
|
949
|
-
const t = this.resultBuffer,
|
|
950
|
-
for (let
|
|
951
|
-
t[
|
|
1133
|
+
const t = this.resultBuffer, r = this.sampleValues, n = this.valueSize, i = e * n * 3 + n;
|
|
1134
|
+
for (let s = 0; s !== n; s++)
|
|
1135
|
+
t[s] = r[i + s];
|
|
952
1136
|
return t;
|
|
953
1137
|
}
|
|
954
|
-
interpolate_(e, t,
|
|
955
|
-
const
|
|
956
|
-
for (let
|
|
957
|
-
const
|
|
958
|
-
|
|
1138
|
+
interpolate_(e, t, r, n) {
|
|
1139
|
+
const i = this.resultBuffer, s = this.sampleValues, a = this.valueSize, o = a * 2, l = a * 3, u = n - t, d = (r - t) / u, h = d * d, f = h * d, p = e * l, g = p - l, m = -2 * f + 3 * h, A = f - h, y = 1 - m, E = A - h + d;
|
|
1140
|
+
for (let w = 0; w !== a; w++) {
|
|
1141
|
+
const L = s[g + w + a], M = s[g + w + o] * u, x = s[p + w + a], U = s[p + w] * u;
|
|
1142
|
+
i[w] = y * L + E * M + m * x + A * U;
|
|
959
1143
|
}
|
|
960
|
-
return
|
|
1144
|
+
return i;
|
|
961
1145
|
}
|
|
962
1146
|
}
|
|
963
|
-
const
|
|
964
|
-
class
|
|
965
|
-
interpolate_(e, t,
|
|
966
|
-
const
|
|
967
|
-
return
|
|
1147
|
+
const Un = new Ke();
|
|
1148
|
+
class Gn extends Ze {
|
|
1149
|
+
interpolate_(e, t, r, n) {
|
|
1150
|
+
const i = super.interpolate_(e, t, r, n);
|
|
1151
|
+
return Un.fromArray(i).normalize().toArray(i), i;
|
|
968
1152
|
}
|
|
969
1153
|
}
|
|
970
|
-
const
|
|
1154
|
+
const R = {
|
|
971
1155
|
FLOAT: 5126,
|
|
972
1156
|
//FLOAT_MAT2: 35674,
|
|
973
1157
|
FLOAT_MAT3: 35675,
|
|
@@ -987,25 +1171,25 @@ const x = {
|
|
|
987
1171
|
TRIANGLE_FAN: 6,
|
|
988
1172
|
UNSIGNED_BYTE: 5121,
|
|
989
1173
|
UNSIGNED_SHORT: 5123
|
|
990
|
-
},
|
|
1174
|
+
}, H = {
|
|
991
1175
|
5120: Int8Array,
|
|
992
1176
|
5121: Uint8Array,
|
|
993
1177
|
5122: Int16Array,
|
|
994
1178
|
5123: Uint16Array,
|
|
995
1179
|
5125: Uint32Array,
|
|
996
1180
|
5126: Float32Array
|
|
997
|
-
},
|
|
998
|
-
9728:
|
|
999
|
-
9729:
|
|
1000
|
-
9984:
|
|
1001
|
-
9985:
|
|
1002
|
-
9986:
|
|
1003
|
-
9987:
|
|
1004
|
-
},
|
|
1005
|
-
33071:
|
|
1006
|
-
33648:
|
|
1007
|
-
10497:
|
|
1008
|
-
},
|
|
1181
|
+
}, Me = {
|
|
1182
|
+
9728: Xe,
|
|
1183
|
+
9729: ce,
|
|
1184
|
+
9984: Ft,
|
|
1185
|
+
9985: Ht,
|
|
1186
|
+
9986: Ut,
|
|
1187
|
+
9987: $e
|
|
1188
|
+
}, Ce = {
|
|
1189
|
+
33071: Gt,
|
|
1190
|
+
33648: Bt,
|
|
1191
|
+
10497: le
|
|
1192
|
+
}, se = {
|
|
1009
1193
|
SCALAR: 1,
|
|
1010
1194
|
VEC2: 2,
|
|
1011
1195
|
VEC3: 3,
|
|
@@ -1013,7 +1197,7 @@ const x = {
|
|
|
1013
1197
|
MAT2: 4,
|
|
1014
1198
|
MAT3: 9,
|
|
1015
1199
|
MAT4: 16
|
|
1016
|
-
},
|
|
1200
|
+
}, he = {
|
|
1017
1201
|
POSITION: "position",
|
|
1018
1202
|
NORMAL: "normal",
|
|
1019
1203
|
TANGENT: "tangent",
|
|
@@ -1024,103 +1208,103 @@ const x = {
|
|
|
1024
1208
|
COLOR_0: "color",
|
|
1025
1209
|
WEIGHTS_0: "skinWeight",
|
|
1026
1210
|
JOINTS_0: "skinIndex"
|
|
1027
|
-
},
|
|
1211
|
+
}, I = {
|
|
1028
1212
|
scale: "scale",
|
|
1029
1213
|
translation: "position",
|
|
1030
1214
|
rotation: "quaternion",
|
|
1031
1215
|
weights: "morphTargetInfluences"
|
|
1032
|
-
},
|
|
1216
|
+
}, Bn = {
|
|
1033
1217
|
CUBICSPLINE: void 0,
|
|
1034
1218
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
1035
1219
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
1036
|
-
LINEAR:
|
|
1037
|
-
STEP:
|
|
1038
|
-
},
|
|
1220
|
+
LINEAR: qe,
|
|
1221
|
+
STEP: jt
|
|
1222
|
+
}, re = {
|
|
1039
1223
|
OPAQUE: "OPAQUE",
|
|
1040
1224
|
MASK: "MASK",
|
|
1041
1225
|
BLEND: "BLEND"
|
|
1042
1226
|
};
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1227
|
+
function jn(c) {
|
|
1228
|
+
return c.DefaultMaterial === void 0 && (c.DefaultMaterial = new We({
|
|
1045
1229
|
color: 16777215,
|
|
1046
1230
|
emissive: 0,
|
|
1047
1231
|
metalness: 1,
|
|
1048
1232
|
roughness: 1,
|
|
1049
1233
|
transparent: !1,
|
|
1050
1234
|
depthTest: !0,
|
|
1051
|
-
side:
|
|
1052
|
-
})),
|
|
1235
|
+
side: Kt
|
|
1236
|
+
})), c.DefaultMaterial;
|
|
1053
1237
|
}
|
|
1054
|
-
function
|
|
1055
|
-
for (const
|
|
1056
|
-
|
|
1238
|
+
function D(c, e, t) {
|
|
1239
|
+
for (const r in t.extensions)
|
|
1240
|
+
c[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
|
|
1057
1241
|
}
|
|
1058
|
-
function
|
|
1059
|
-
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(
|
|
1242
|
+
function S(c, e) {
|
|
1243
|
+
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(c.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
1060
1244
|
}
|
|
1061
|
-
function
|
|
1062
|
-
let
|
|
1063
|
-
for (let
|
|
1064
|
-
const d = e[
|
|
1065
|
-
if (d.POSITION !== void 0 && (
|
|
1066
|
-
}
|
|
1067
|
-
if (!
|
|
1068
|
-
const
|
|
1069
|
-
for (let
|
|
1070
|
-
const d = e[
|
|
1071
|
-
if (
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1245
|
+
function Kn(c, e, t) {
|
|
1246
|
+
let r = !1, n = !1, i = !1;
|
|
1247
|
+
for (let l = 0, u = e.length; l < u; l++) {
|
|
1248
|
+
const d = e[l];
|
|
1249
|
+
if (d.POSITION !== void 0 && (r = !0), d.NORMAL !== void 0 && (n = !0), d.COLOR_0 !== void 0 && (i = !0), r && n && i) break;
|
|
1250
|
+
}
|
|
1251
|
+
if (!r && !n && !i) return Promise.resolve(c);
|
|
1252
|
+
const s = [], a = [], o = [];
|
|
1253
|
+
for (let l = 0, u = e.length; l < u; l++) {
|
|
1254
|
+
const d = e[l];
|
|
1255
|
+
if (r) {
|
|
1256
|
+
const h = d.POSITION !== void 0 ? t.getDependency("accessor", d.POSITION) : c.attributes.position;
|
|
1257
|
+
s.push(h);
|
|
1074
1258
|
}
|
|
1075
1259
|
if (n) {
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1260
|
+
const h = d.NORMAL !== void 0 ? t.getDependency("accessor", d.NORMAL) : c.attributes.normal;
|
|
1261
|
+
a.push(h);
|
|
1078
1262
|
}
|
|
1079
|
-
if (
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1263
|
+
if (i) {
|
|
1264
|
+
const h = d.COLOR_0 !== void 0 ? t.getDependency("accessor", d.COLOR_0) : c.attributes.color;
|
|
1265
|
+
o.push(h);
|
|
1082
1266
|
}
|
|
1083
1267
|
}
|
|
1084
1268
|
return Promise.all([
|
|
1085
|
-
Promise.all(
|
|
1086
|
-
Promise.all(
|
|
1087
|
-
Promise.all(
|
|
1088
|
-
]).then(function(
|
|
1089
|
-
const
|
|
1090
|
-
return
|
|
1269
|
+
Promise.all(s),
|
|
1270
|
+
Promise.all(a),
|
|
1271
|
+
Promise.all(o)
|
|
1272
|
+
]).then(function(l) {
|
|
1273
|
+
const u = l[0], d = l[1], h = l[2];
|
|
1274
|
+
return r && (c.morphAttributes.position = u), n && (c.morphAttributes.normal = d), i && (c.morphAttributes.color = h), c.morphTargetsRelative = !0, c;
|
|
1091
1275
|
});
|
|
1092
1276
|
}
|
|
1093
|
-
function
|
|
1094
|
-
if (
|
|
1095
|
-
for (let t = 0,
|
|
1096
|
-
|
|
1277
|
+
function Vn(c, e) {
|
|
1278
|
+
if (c.updateMorphTargets(), e.weights !== void 0)
|
|
1279
|
+
for (let t = 0, r = e.weights.length; t < r; t++)
|
|
1280
|
+
c.morphTargetInfluences[t] = e.weights[t];
|
|
1097
1281
|
if (e.extras && Array.isArray(e.extras.targetNames)) {
|
|
1098
1282
|
const t = e.extras.targetNames;
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1101
|
-
for (let
|
|
1102
|
-
|
|
1283
|
+
if (c.morphTargetInfluences.length === t.length) {
|
|
1284
|
+
c.morphTargetDictionary = {};
|
|
1285
|
+
for (let r = 0, n = t.length; r < n; r++)
|
|
1286
|
+
c.morphTargetDictionary[t[r]] = r;
|
|
1103
1287
|
} else
|
|
1104
1288
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
1105
1289
|
}
|
|
1106
1290
|
}
|
|
1107
|
-
function
|
|
1291
|
+
function zn(c) {
|
|
1108
1292
|
let e;
|
|
1109
|
-
const t =
|
|
1110
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ie(t.attributes) : e =
|
|
1111
|
-
for (let
|
|
1112
|
-
e += ":" + ie(
|
|
1293
|
+
const t = c.extensions && c.extensions[_.KHR_DRACO_MESH_COMPRESSION];
|
|
1294
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ie(t.attributes) : e = c.indices + ":" + ie(c.attributes) + ":" + c.mode, c.targets !== void 0)
|
|
1295
|
+
for (let r = 0, n = c.targets.length; r < n; r++)
|
|
1296
|
+
e += ":" + ie(c.targets[r]);
|
|
1113
1297
|
return e;
|
|
1114
1298
|
}
|
|
1115
|
-
function ie(
|
|
1299
|
+
function ie(c) {
|
|
1116
1300
|
let e = "";
|
|
1117
|
-
const t = Object.keys(
|
|
1118
|
-
for (let
|
|
1119
|
-
e += t[
|
|
1301
|
+
const t = Object.keys(c).sort();
|
|
1302
|
+
for (let r = 0, n = t.length; r < n; r++)
|
|
1303
|
+
e += t[r] + ":" + c[t[r]] + ";";
|
|
1120
1304
|
return e;
|
|
1121
1305
|
}
|
|
1122
|
-
function
|
|
1123
|
-
switch (
|
|
1306
|
+
function fe(c) {
|
|
1307
|
+
switch (c) {
|
|
1124
1308
|
case Int8Array:
|
|
1125
1309
|
return 1 / 127;
|
|
1126
1310
|
case Uint8Array:
|
|
@@ -1133,21 +1317,21 @@ function pe(o) {
|
|
|
1133
1317
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
1134
1318
|
}
|
|
1135
1319
|
}
|
|
1136
|
-
function
|
|
1137
|
-
return
|
|
1320
|
+
function $n(c) {
|
|
1321
|
+
return c.search(/\.jpe?g($|\?)/i) > 0 || c.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : c.search(/\.webp($|\?)/i) > 0 || c.search(/^data\:image\/webp/) === 0 ? "image/webp" : c.search(/\.ktx2($|\?)/i) > 0 || c.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
1138
1322
|
}
|
|
1139
|
-
const
|
|
1140
|
-
class
|
|
1323
|
+
const Xn = new W();
|
|
1324
|
+
class Wn {
|
|
1141
1325
|
constructor(e = {}, t = {}) {
|
|
1142
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
1143
|
-
let
|
|
1326
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new gn(), 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 = {};
|
|
1327
|
+
let r = !1, n = -1, i = !1, s = -1;
|
|
1144
1328
|
if (typeof navigator < "u") {
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
const
|
|
1148
|
-
n =
|
|
1329
|
+
const a = navigator.userAgent;
|
|
1330
|
+
r = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
1331
|
+
const o = a.match(/Version\/(\d+)/);
|
|
1332
|
+
n = r && o ? parseInt(o[1], 10) : -1, i = a.indexOf("Firefox") > -1, s = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
1149
1333
|
}
|
|
1150
|
-
typeof createImageBitmap > "u" ||
|
|
1334
|
+
typeof createImageBitmap > "u" || r && n < 17 || i && s < 98 ? this.textureLoader = new Tt(this.options.manager) : this.textureLoader = new ze(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new X(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
1151
1335
|
}
|
|
1152
1336
|
setExtensions(e) {
|
|
1153
1337
|
this.extensions = e;
|
|
@@ -1156,33 +1340,33 @@ class Nn {
|
|
|
1156
1340
|
this.plugins = e;
|
|
1157
1341
|
}
|
|
1158
1342
|
parse(e, t) {
|
|
1159
|
-
const
|
|
1160
|
-
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(
|
|
1161
|
-
return
|
|
1162
|
-
}), Promise.all(this._invokeAll(function(
|
|
1163
|
-
return
|
|
1343
|
+
const r = this, n = this.json, i = this.extensions;
|
|
1344
|
+
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
|
|
1345
|
+
return s._markDefs && s._markDefs();
|
|
1346
|
+
}), Promise.all(this._invokeAll(function(s) {
|
|
1347
|
+
return s.beforeRoot && s.beforeRoot();
|
|
1164
1348
|
})).then(function() {
|
|
1165
1349
|
return Promise.all([
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1350
|
+
r.getDependencies("scene"),
|
|
1351
|
+
r.getDependencies("animation"),
|
|
1352
|
+
r.getDependencies("camera")
|
|
1169
1353
|
]);
|
|
1170
|
-
}).then(function(
|
|
1171
|
-
const
|
|
1172
|
-
scene:
|
|
1173
|
-
scenes:
|
|
1174
|
-
animations:
|
|
1175
|
-
cameras:
|
|
1354
|
+
}).then(function(s) {
|
|
1355
|
+
const a = {
|
|
1356
|
+
scene: s[0][n.scene || 0],
|
|
1357
|
+
scenes: s[0],
|
|
1358
|
+
animations: s[1],
|
|
1359
|
+
cameras: s[2],
|
|
1176
1360
|
asset: n.asset,
|
|
1177
|
-
parser:
|
|
1361
|
+
parser: r,
|
|
1178
1362
|
userData: {}
|
|
1179
1363
|
};
|
|
1180
|
-
return
|
|
1181
|
-
return
|
|
1364
|
+
return D(i, a, n), S(a, n), Promise.all(r._invokeAll(function(o) {
|
|
1365
|
+
return o.afterRoot && o.afterRoot(a);
|
|
1182
1366
|
})).then(function() {
|
|
1183
|
-
for (const
|
|
1184
|
-
|
|
1185
|
-
e(
|
|
1367
|
+
for (const o of a.scenes)
|
|
1368
|
+
o.updateMatrixWorld();
|
|
1369
|
+
e(a);
|
|
1186
1370
|
});
|
|
1187
1371
|
}).catch(t);
|
|
1188
1372
|
}
|
|
@@ -1190,15 +1374,15 @@ class Nn {
|
|
|
1190
1374
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
1191
1375
|
*/
|
|
1192
1376
|
_markDefs() {
|
|
1193
|
-
const e = this.json.nodes || [], t = this.json.skins || [],
|
|
1194
|
-
for (let n = 0,
|
|
1195
|
-
const
|
|
1196
|
-
for (let
|
|
1197
|
-
e[
|
|
1377
|
+
const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
|
|
1378
|
+
for (let n = 0, i = t.length; n < i; n++) {
|
|
1379
|
+
const s = t[n].joints;
|
|
1380
|
+
for (let a = 0, o = s.length; a < o; a++)
|
|
1381
|
+
e[s[a]].isBone = !0;
|
|
1198
1382
|
}
|
|
1199
|
-
for (let n = 0,
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1383
|
+
for (let n = 0, i = e.length; n < i; n++) {
|
|
1384
|
+
const s = e[n];
|
|
1385
|
+
s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (r[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
|
|
1202
1386
|
}
|
|
1203
1387
|
}
|
|
1204
1388
|
/**
|
|
@@ -1214,21 +1398,21 @@ class Nn {
|
|
|
1214
1398
|
t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
|
|
1215
1399
|
}
|
|
1216
1400
|
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
1217
|
-
_getNodeRef(e, t,
|
|
1218
|
-
if (e.refs[t] <= 1) return
|
|
1219
|
-
const n =
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
for (const [
|
|
1223
|
-
|
|
1401
|
+
_getNodeRef(e, t, r) {
|
|
1402
|
+
if (e.refs[t] <= 1) return r;
|
|
1403
|
+
const n = r.clone(), i = (s, a) => {
|
|
1404
|
+
const o = this.associations.get(s);
|
|
1405
|
+
o != null && this.associations.set(a, o);
|
|
1406
|
+
for (const [l, u] of s.children.entries())
|
|
1407
|
+
i(u, a.children[l]);
|
|
1224
1408
|
};
|
|
1225
|
-
return r
|
|
1409
|
+
return i(r, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
1226
1410
|
}
|
|
1227
1411
|
_invokeOne(e) {
|
|
1228
1412
|
const t = Object.values(this.plugins);
|
|
1229
1413
|
t.push(this);
|
|
1230
|
-
for (let
|
|
1231
|
-
const n = e(t[
|
|
1414
|
+
for (let r = 0; r < t.length; r++) {
|
|
1415
|
+
const n = e(t[r]);
|
|
1232
1416
|
if (n) return n;
|
|
1233
1417
|
}
|
|
1234
1418
|
return null;
|
|
@@ -1236,12 +1420,12 @@ class Nn {
|
|
|
1236
1420
|
_invokeAll(e) {
|
|
1237
1421
|
const t = Object.values(this.plugins);
|
|
1238
1422
|
t.unshift(this);
|
|
1239
|
-
const
|
|
1423
|
+
const r = [];
|
|
1240
1424
|
for (let n = 0; n < t.length; n++) {
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1425
|
+
const i = e(t[n]);
|
|
1426
|
+
i && r.push(i);
|
|
1243
1427
|
}
|
|
1244
|
-
return
|
|
1428
|
+
return r;
|
|
1245
1429
|
}
|
|
1246
1430
|
/**
|
|
1247
1431
|
* Requests the specified dependency asynchronously, with caching.
|
|
@@ -1250,63 +1434,63 @@ class Nn {
|
|
|
1250
1434
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
1251
1435
|
*/
|
|
1252
1436
|
getDependency(e, t) {
|
|
1253
|
-
const
|
|
1254
|
-
let n = this.cache.get(
|
|
1437
|
+
const r = e + ":" + t;
|
|
1438
|
+
let n = this.cache.get(r);
|
|
1255
1439
|
if (!n) {
|
|
1256
1440
|
switch (e) {
|
|
1257
1441
|
case "scene":
|
|
1258
1442
|
n = this.loadScene(t);
|
|
1259
1443
|
break;
|
|
1260
1444
|
case "node":
|
|
1261
|
-
n = this._invokeOne(function(
|
|
1262
|
-
return
|
|
1445
|
+
n = this._invokeOne(function(i) {
|
|
1446
|
+
return i.loadNode && i.loadNode(t);
|
|
1263
1447
|
});
|
|
1264
1448
|
break;
|
|
1265
1449
|
case "mesh":
|
|
1266
|
-
n = this._invokeOne(function(
|
|
1267
|
-
return
|
|
1450
|
+
n = this._invokeOne(function(i) {
|
|
1451
|
+
return i.loadMesh && i.loadMesh(t);
|
|
1268
1452
|
});
|
|
1269
1453
|
break;
|
|
1270
1454
|
case "accessor":
|
|
1271
1455
|
n = this.loadAccessor(t);
|
|
1272
1456
|
break;
|
|
1273
1457
|
case "bufferView":
|
|
1274
|
-
n = this._invokeOne(function(
|
|
1275
|
-
return
|
|
1458
|
+
n = this._invokeOne(function(i) {
|
|
1459
|
+
return i.loadBufferView && i.loadBufferView(t);
|
|
1276
1460
|
});
|
|
1277
1461
|
break;
|
|
1278
1462
|
case "buffer":
|
|
1279
1463
|
n = this.loadBuffer(t);
|
|
1280
1464
|
break;
|
|
1281
1465
|
case "material":
|
|
1282
|
-
n = this._invokeOne(function(
|
|
1283
|
-
return
|
|
1466
|
+
n = this._invokeOne(function(i) {
|
|
1467
|
+
return i.loadMaterial && i.loadMaterial(t);
|
|
1284
1468
|
});
|
|
1285
1469
|
break;
|
|
1286
1470
|
case "texture":
|
|
1287
|
-
n = this._invokeOne(function(
|
|
1288
|
-
return
|
|
1471
|
+
n = this._invokeOne(function(i) {
|
|
1472
|
+
return i.loadTexture && i.loadTexture(t);
|
|
1289
1473
|
});
|
|
1290
1474
|
break;
|
|
1291
1475
|
case "skin":
|
|
1292
1476
|
n = this.loadSkin(t);
|
|
1293
1477
|
break;
|
|
1294
1478
|
case "animation":
|
|
1295
|
-
n = this._invokeOne(function(
|
|
1296
|
-
return
|
|
1479
|
+
n = this._invokeOne(function(i) {
|
|
1480
|
+
return i.loadAnimation && i.loadAnimation(t);
|
|
1297
1481
|
});
|
|
1298
1482
|
break;
|
|
1299
1483
|
case "camera":
|
|
1300
1484
|
n = this.loadCamera(t);
|
|
1301
1485
|
break;
|
|
1302
1486
|
default:
|
|
1303
|
-
if (n = this._invokeOne(function(
|
|
1304
|
-
return
|
|
1487
|
+
if (n = this._invokeOne(function(i) {
|
|
1488
|
+
return i != this && i.getDependency && i.getDependency(e, t);
|
|
1305
1489
|
}), !n)
|
|
1306
1490
|
throw new Error("Unknown type: " + e);
|
|
1307
1491
|
break;
|
|
1308
1492
|
}
|
|
1309
|
-
this.cache.add(
|
|
1493
|
+
this.cache.add(r, n);
|
|
1310
1494
|
}
|
|
1311
1495
|
return n;
|
|
1312
1496
|
}
|
|
@@ -1318,9 +1502,9 @@ class Nn {
|
|
|
1318
1502
|
getDependencies(e) {
|
|
1319
1503
|
let t = this.cache.get(e);
|
|
1320
1504
|
if (!t) {
|
|
1321
|
-
const
|
|
1322
|
-
t = Promise.all(n.map(function(
|
|
1323
|
-
return
|
|
1505
|
+
const r = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1506
|
+
t = Promise.all(n.map(function(i, s) {
|
|
1507
|
+
return r.getDependency(e, s);
|
|
1324
1508
|
})), this.cache.add(e, t);
|
|
1325
1509
|
}
|
|
1326
1510
|
return t;
|
|
@@ -1331,15 +1515,15 @@ class Nn {
|
|
|
1331
1515
|
* @return {Promise<ArrayBuffer>}
|
|
1332
1516
|
*/
|
|
1333
1517
|
loadBuffer(e) {
|
|
1334
|
-
const t = this.json.buffers[e],
|
|
1518
|
+
const t = this.json.buffers[e], r = this.fileLoader;
|
|
1335
1519
|
if (t.type && t.type !== "arraybuffer")
|
|
1336
1520
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1337
1521
|
if (t.uri === void 0 && e === 0)
|
|
1338
|
-
return Promise.resolve(this.extensions[
|
|
1522
|
+
return Promise.resolve(this.extensions[_.KHR_BINARY_GLTF].body);
|
|
1339
1523
|
const n = this.options;
|
|
1340
|
-
return new Promise(function(
|
|
1341
|
-
|
|
1342
|
-
|
|
1524
|
+
return new Promise(function(i, s) {
|
|
1525
|
+
r.load(K.resolveURL(t.uri, n.path), i, void 0, function() {
|
|
1526
|
+
s(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1343
1527
|
});
|
|
1344
1528
|
});
|
|
1345
1529
|
}
|
|
@@ -1350,9 +1534,9 @@ class Nn {
|
|
|
1350
1534
|
*/
|
|
1351
1535
|
loadBufferView(e) {
|
|
1352
1536
|
const t = this.json.bufferViews[e];
|
|
1353
|
-
return this.getDependency("buffer", t.buffer).then(function(
|
|
1354
|
-
const n = t.byteLength || 0,
|
|
1355
|
-
return
|
|
1537
|
+
return this.getDependency("buffer", t.buffer).then(function(r) {
|
|
1538
|
+
const n = t.byteLength || 0, i = t.byteOffset || 0;
|
|
1539
|
+
return r.slice(i, i + n);
|
|
1356
1540
|
});
|
|
1357
1541
|
}
|
|
1358
1542
|
/**
|
|
@@ -1361,29 +1545,29 @@ class Nn {
|
|
|
1361
1545
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1362
1546
|
*/
|
|
1363
1547
|
loadAccessor(e) {
|
|
1364
|
-
const t = this,
|
|
1548
|
+
const t = this, r = this.json, n = this.json.accessors[e];
|
|
1365
1549
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1366
|
-
const
|
|
1367
|
-
return Promise.resolve(new j(
|
|
1550
|
+
const s = se[n.type], a = H[n.componentType], o = n.normalized === !0, l = new a(n.count * s);
|
|
1551
|
+
return Promise.resolve(new j(l, s, o));
|
|
1368
1552
|
}
|
|
1369
|
-
const
|
|
1370
|
-
return n.bufferView !== void 0 ?
|
|
1371
|
-
const
|
|
1372
|
-
let
|
|
1373
|
-
if (
|
|
1374
|
-
const A = Math.floor(
|
|
1375
|
-
let
|
|
1376
|
-
|
|
1553
|
+
const i = [];
|
|
1554
|
+
return n.bufferView !== void 0 ? i.push(this.getDependency("bufferView", n.bufferView)) : i.push(null), n.sparse !== void 0 && (i.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(i).then(function(s) {
|
|
1555
|
+
const a = s[0], o = se[n.type], l = H[n.componentType], u = l.BYTES_PER_ELEMENT, d = u * o, h = n.byteOffset || 0, f = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, p = n.normalized === !0;
|
|
1556
|
+
let g, m;
|
|
1557
|
+
if (f && f !== d) {
|
|
1558
|
+
const A = Math.floor(h / f), y = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + A + ":" + n.count;
|
|
1559
|
+
let E = t.cache.get(y);
|
|
1560
|
+
E || (g = new l(a, A * f, n.count * f / u), E = new _t(g, f / u), t.cache.add(y, E)), m = new yt(E, o, h % f / u, p);
|
|
1377
1561
|
} else
|
|
1378
|
-
|
|
1562
|
+
a === null ? g = new l(n.count * o) : g = new l(a, h, n.count * o), m = new j(g, o, p);
|
|
1379
1563
|
if (n.sparse !== void 0) {
|
|
1380
|
-
const A =
|
|
1381
|
-
|
|
1382
|
-
for (let
|
|
1383
|
-
const
|
|
1384
|
-
if (m.setX(
|
|
1564
|
+
const A = se.SCALAR, y = H[n.sparse.indices.componentType], E = n.sparse.indices.byteOffset || 0, w = n.sparse.values.byteOffset || 0, L = new y(s[1], E, n.sparse.count * A), M = new l(s[2], w, n.sparse.count * o);
|
|
1565
|
+
a !== null && (m = new j(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
1566
|
+
for (let x = 0, U = L.length; x < U; x++) {
|
|
1567
|
+
const C = L[x];
|
|
1568
|
+
if (m.setX(C, M[x * o]), o >= 2 && m.setY(C, M[x * o + 1]), o >= 3 && m.setZ(C, M[x * o + 2]), o >= 4 && m.setW(C, M[x * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1385
1569
|
}
|
|
1386
|
-
m.normalized =
|
|
1570
|
+
m.normalized = p;
|
|
1387
1571
|
}
|
|
1388
1572
|
return m;
|
|
1389
1573
|
});
|
|
@@ -1394,55 +1578,55 @@ class Nn {
|
|
|
1394
1578
|
* @return {Promise<THREE.Texture|null>}
|
|
1395
1579
|
*/
|
|
1396
1580
|
loadTexture(e) {
|
|
1397
|
-
const t = this.json,
|
|
1398
|
-
let
|
|
1399
|
-
if (
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1581
|
+
const t = this.json, r = this.options, i = t.textures[e].source, s = t.images[i];
|
|
1582
|
+
let a = this.textureLoader;
|
|
1583
|
+
if (s.uri) {
|
|
1584
|
+
const o = r.manager.getHandler(s.uri);
|
|
1585
|
+
o !== null && (a = o);
|
|
1402
1586
|
}
|
|
1403
|
-
return this.loadTextureImage(e,
|
|
1404
|
-
}
|
|
1405
|
-
loadTextureImage(e, t,
|
|
1406
|
-
const n = this,
|
|
1407
|
-
if (this.textureCache[
|
|
1408
|
-
return this.textureCache[
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
return
|
|
1587
|
+
return this.loadTextureImage(e, i, a);
|
|
1588
|
+
}
|
|
1589
|
+
loadTextureImage(e, t, r) {
|
|
1590
|
+
const n = this, i = this.json, s = i.textures[e], a = i.images[t], o = (a.uri || a.bufferView) + ":" + s.sampler;
|
|
1591
|
+
if (this.textureCache[o])
|
|
1592
|
+
return this.textureCache[o];
|
|
1593
|
+
const l = this.loadImageSource(t, r).then(function(u) {
|
|
1594
|
+
u.flipY = !1, u.name = s.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
1595
|
+
const h = (i.samplers || {})[s.sampler] || {};
|
|
1596
|
+
return u.magFilter = Me[h.magFilter] || ce, u.minFilter = Me[h.minFilter] || $e, u.wrapS = Ce[h.wrapS] || le, u.wrapT = Ce[h.wrapT] || le, u.generateMipmaps = !u.isCompressedTexture && u.minFilter !== Xe && u.minFilter !== ce, n.associations.set(u, { textures: e }), u;
|
|
1413
1597
|
}).catch(function() {
|
|
1414
1598
|
return null;
|
|
1415
1599
|
});
|
|
1416
|
-
return this.textureCache[
|
|
1600
|
+
return this.textureCache[o] = l, l;
|
|
1417
1601
|
}
|
|
1418
1602
|
loadImageSource(e, t) {
|
|
1419
|
-
const
|
|
1603
|
+
const r = this, n = this.json, i = this.options;
|
|
1420
1604
|
if (this.sourceCache[e] !== void 0)
|
|
1421
1605
|
return this.sourceCache[e].then((d) => d.clone());
|
|
1422
|
-
const
|
|
1423
|
-
let
|
|
1424
|
-
if (
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
return
|
|
1606
|
+
const s = n.images[e], a = self.URL || self.webkitURL;
|
|
1607
|
+
let o = s.uri || "", l = !1;
|
|
1608
|
+
if (s.bufferView !== void 0)
|
|
1609
|
+
o = r.getDependency("bufferView", s.bufferView).then(function(d) {
|
|
1610
|
+
l = !0;
|
|
1611
|
+
const h = new Blob([d], { type: s.mimeType });
|
|
1612
|
+
return o = a.createObjectURL(h), o;
|
|
1429
1613
|
});
|
|
1430
|
-
else if (
|
|
1614
|
+
else if (s.uri === void 0)
|
|
1431
1615
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1432
|
-
const
|
|
1433
|
-
return new Promise(function(
|
|
1434
|
-
let
|
|
1435
|
-
t.isImageBitmapLoader === !0 && (
|
|
1436
|
-
const m = new
|
|
1437
|
-
m.needsUpdate = !0,
|
|
1438
|
-
}), t.load(
|
|
1616
|
+
const u = Promise.resolve(o).then(function(d) {
|
|
1617
|
+
return new Promise(function(h, f) {
|
|
1618
|
+
let p = h;
|
|
1619
|
+
t.isImageBitmapLoader === !0 && (p = function(g) {
|
|
1620
|
+
const m = new Ee(g);
|
|
1621
|
+
m.needsUpdate = !0, h(m);
|
|
1622
|
+
}), t.load(K.resolveURL(d, i.path), p, void 0, f);
|
|
1439
1623
|
});
|
|
1440
1624
|
}).then(function(d) {
|
|
1441
|
-
return
|
|
1625
|
+
return l === !0 && a.revokeObjectURL(o), S(d, s), d.userData.mimeType = s.mimeType || $n(s.uri), d;
|
|
1442
1626
|
}).catch(function(d) {
|
|
1443
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture",
|
|
1627
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", o), d;
|
|
1444
1628
|
});
|
|
1445
|
-
return this.sourceCache[e] =
|
|
1629
|
+
return this.sourceCache[e] = u, u;
|
|
1446
1630
|
}
|
|
1447
1631
|
/**
|
|
1448
1632
|
* Asynchronously assigns a texture to the given material parameters.
|
|
@@ -1451,18 +1635,18 @@ class Nn {
|
|
|
1451
1635
|
* @param {Object} mapDef
|
|
1452
1636
|
* @return {Promise<Texture>}
|
|
1453
1637
|
*/
|
|
1454
|
-
assignTexture(e, t,
|
|
1455
|
-
const
|
|
1456
|
-
return this.getDependency("texture",
|
|
1457
|
-
if (!
|
|
1458
|
-
if (
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1638
|
+
assignTexture(e, t, r, n) {
|
|
1639
|
+
const i = this;
|
|
1640
|
+
return this.getDependency("texture", r.index).then(function(s) {
|
|
1641
|
+
if (!s) return null;
|
|
1642
|
+
if (r.texCoord !== void 0 && r.texCoord > 0 && (s = s.clone(), s.channel = r.texCoord), i.extensions[_.KHR_TEXTURE_TRANSFORM]) {
|
|
1643
|
+
const a = r.extensions !== void 0 ? r.extensions[_.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1644
|
+
if (a) {
|
|
1645
|
+
const o = i.associations.get(s);
|
|
1646
|
+
s = i.extensions[_.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), i.associations.set(s, o);
|
|
1463
1647
|
}
|
|
1464
1648
|
}
|
|
1465
|
-
return n !== void 0 && (
|
|
1649
|
+
return n !== void 0 && (s.colorSpace = n), e[t] = s, s;
|
|
1466
1650
|
});
|
|
1467
1651
|
}
|
|
1468
1652
|
/**
|
|
@@ -1475,24 +1659,24 @@ class Nn {
|
|
|
1475
1659
|
*/
|
|
1476
1660
|
assignFinalMaterial(e) {
|
|
1477
1661
|
const t = e.geometry;
|
|
1478
|
-
let
|
|
1479
|
-
const n = t.attributes.tangent === void 0,
|
|
1662
|
+
let r = e.material;
|
|
1663
|
+
const n = t.attributes.tangent === void 0, i = t.attributes.color !== void 0, s = t.attributes.normal === void 0;
|
|
1480
1664
|
if (e.isPoints) {
|
|
1481
|
-
const
|
|
1482
|
-
let
|
|
1483
|
-
|
|
1665
|
+
const a = "PointsMaterial:" + r.uuid;
|
|
1666
|
+
let o = this.cache.get(a);
|
|
1667
|
+
o || (o = new wt(), ee.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, o.sizeAttenuation = !1, this.cache.add(a, o)), r = o;
|
|
1484
1668
|
} else if (e.isLine) {
|
|
1485
|
-
const
|
|
1486
|
-
let
|
|
1487
|
-
|
|
1669
|
+
const a = "LineBasicMaterial:" + r.uuid;
|
|
1670
|
+
let o = this.cache.get(a);
|
|
1671
|
+
o || (o = new Et(), ee.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, this.cache.add(a, o)), r = o;
|
|
1488
1672
|
}
|
|
1489
|
-
if (n ||
|
|
1490
|
-
let
|
|
1491
|
-
n && (
|
|
1492
|
-
let
|
|
1493
|
-
|
|
1673
|
+
if (n || i || s) {
|
|
1674
|
+
let a = "ClonedMaterial:" + r.uuid + ":";
|
|
1675
|
+
n && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), s && (a += "flat-shading:");
|
|
1676
|
+
let o = this.cache.get(a);
|
|
1677
|
+
o || (o = r.clone(), i && (o.vertexColors = !0), s && (o.flatShading = !0), n && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(r))), r = o;
|
|
1494
1678
|
}
|
|
1495
|
-
e.material =
|
|
1679
|
+
e.material = r;
|
|
1496
1680
|
}
|
|
1497
1681
|
getMaterialType() {
|
|
1498
1682
|
return We;
|
|
@@ -1503,42 +1687,42 @@ class Nn {
|
|
|
1503
1687
|
* @return {Promise<Material>}
|
|
1504
1688
|
*/
|
|
1505
1689
|
loadMaterial(e) {
|
|
1506
|
-
const t = this,
|
|
1507
|
-
let
|
|
1508
|
-
const
|
|
1509
|
-
if (
|
|
1510
|
-
const d = n[
|
|
1511
|
-
|
|
1690
|
+
const t = this, r = this.json, n = this.extensions, i = r.materials[e];
|
|
1691
|
+
let s;
|
|
1692
|
+
const a = {}, o = i.extensions || {}, l = [];
|
|
1693
|
+
if (o[_.KHR_MATERIALS_UNLIT]) {
|
|
1694
|
+
const d = n[_.KHR_MATERIALS_UNLIT];
|
|
1695
|
+
s = d.getMaterialType(), l.push(d.extendParams(a, i, t));
|
|
1512
1696
|
} else {
|
|
1513
|
-
const d =
|
|
1514
|
-
if (
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1697
|
+
const d = i.pbrMetallicRoughness || {};
|
|
1698
|
+
if (a.color = new P(1, 1, 1), a.opacity = 1, Array.isArray(d.baseColorFactor)) {
|
|
1699
|
+
const h = d.baseColorFactor;
|
|
1700
|
+
a.color.setRGB(h[0], h[1], h[2], b), a.opacity = h[3];
|
|
1517
1701
|
}
|
|
1518
|
-
d.baseColorTexture !== void 0 &&
|
|
1519
|
-
return
|
|
1520
|
-
}),
|
|
1521
|
-
return
|
|
1702
|
+
d.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", d.baseColorTexture, O)), a.metalness = d.metallicFactor !== void 0 ? d.metallicFactor : 1, a.roughness = d.roughnessFactor !== void 0 ? d.roughnessFactor : 1, d.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", d.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", d.metallicRoughnessTexture))), s = this._invokeOne(function(h) {
|
|
1703
|
+
return h.getMaterialType && h.getMaterialType(e);
|
|
1704
|
+
}), l.push(Promise.all(this._invokeAll(function(h) {
|
|
1705
|
+
return h.extendMaterialParams && h.extendMaterialParams(e, a);
|
|
1522
1706
|
})));
|
|
1523
1707
|
}
|
|
1524
|
-
|
|
1525
|
-
const
|
|
1526
|
-
if (
|
|
1527
|
-
const d =
|
|
1528
|
-
|
|
1708
|
+
i.doubleSided === !0 && (a.side = Rt);
|
|
1709
|
+
const u = i.alphaMode || re.OPAQUE;
|
|
1710
|
+
if (u === re.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === re.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && s !== B && (l.push(t.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new je(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1711
|
+
const d = i.normalTexture.scale;
|
|
1712
|
+
a.normalScale.set(d, d);
|
|
1529
1713
|
}
|
|
1530
|
-
if (
|
|
1531
|
-
const d =
|
|
1532
|
-
|
|
1714
|
+
if (i.occlusionTexture !== void 0 && s !== B && (l.push(t.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && s !== B) {
|
|
1715
|
+
const d = i.emissiveFactor;
|
|
1716
|
+
a.emissive = new P().setRGB(d[0], d[1], d[2], b);
|
|
1533
1717
|
}
|
|
1534
|
-
return
|
|
1535
|
-
const d = new
|
|
1536
|
-
return
|
|
1718
|
+
return i.emissiveTexture !== void 0 && s !== B && l.push(t.assignTexture(a, "emissiveMap", i.emissiveTexture, O)), Promise.all(l).then(function() {
|
|
1719
|
+
const d = new s(a);
|
|
1720
|
+
return i.name && (d.name = i.name), S(d, i), t.associations.set(d, { materials: e }), i.extensions && D(n, d, i), d;
|
|
1537
1721
|
});
|
|
1538
1722
|
}
|
|
1539
1723
|
/** When Object3D instances are targeted by animation, they need unique names. */
|
|
1540
1724
|
createUniqueName(e) {
|
|
1541
|
-
const t =
|
|
1725
|
+
const t = xt.sanitizeNodeName(e || "");
|
|
1542
1726
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1543
1727
|
}
|
|
1544
1728
|
/**
|
|
@@ -1550,23 +1734,23 @@ class Nn {
|
|
|
1550
1734
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1551
1735
|
*/
|
|
1552
1736
|
loadGeometries(e) {
|
|
1553
|
-
const t = this,
|
|
1554
|
-
function
|
|
1555
|
-
return
|
|
1556
|
-
return
|
|
1737
|
+
const t = this, r = this.extensions, n = this.primitiveCache;
|
|
1738
|
+
function i(a) {
|
|
1739
|
+
return r[_.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(o) {
|
|
1740
|
+
return Ie(o, a, t);
|
|
1557
1741
|
});
|
|
1558
1742
|
}
|
|
1559
|
-
const
|
|
1560
|
-
for (let
|
|
1561
|
-
const
|
|
1743
|
+
const s = [];
|
|
1744
|
+
for (let a = 0, o = e.length; a < o; a++) {
|
|
1745
|
+
const l = e[a], u = zn(l), d = n[u];
|
|
1562
1746
|
if (d)
|
|
1563
|
-
|
|
1747
|
+
s.push(d.promise);
|
|
1564
1748
|
else {
|
|
1565
|
-
let
|
|
1566
|
-
|
|
1749
|
+
let h;
|
|
1750
|
+
l.extensions && l.extensions[_.KHR_DRACO_MESH_COMPRESSION] ? h = i(l) : h = Ie(new Ge(), l, t), n[u] = { primitive: l, promise: h }, s.push(h);
|
|
1567
1751
|
}
|
|
1568
1752
|
}
|
|
1569
|
-
return Promise.all(
|
|
1753
|
+
return Promise.all(s);
|
|
1570
1754
|
}
|
|
1571
1755
|
/**
|
|
1572
1756
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
@@ -1574,43 +1758,43 @@ class Nn {
|
|
|
1574
1758
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1575
1759
|
*/
|
|
1576
1760
|
loadMesh(e) {
|
|
1577
|
-
const t = this,
|
|
1578
|
-
for (let
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1761
|
+
const t = this, r = this.json, n = this.extensions, i = r.meshes[e], s = i.primitives, a = [];
|
|
1762
|
+
for (let o = 0, l = s.length; o < l; o++) {
|
|
1763
|
+
const u = s[o].material === void 0 ? jn(this.cache) : this.getDependency("material", s[o].material);
|
|
1764
|
+
a.push(u);
|
|
1581
1765
|
}
|
|
1582
|
-
return
|
|
1583
|
-
const
|
|
1584
|
-
for (let
|
|
1585
|
-
const
|
|
1766
|
+
return a.push(t.loadGeometries(s)), Promise.all(a).then(function(o) {
|
|
1767
|
+
const l = o.slice(0, o.length - 1), u = o[o.length - 1], d = [];
|
|
1768
|
+
for (let f = 0, p = u.length; f < p; f++) {
|
|
1769
|
+
const g = u[f], m = s[f];
|
|
1586
1770
|
let A;
|
|
1587
|
-
const y =
|
|
1588
|
-
if (m.mode ===
|
|
1589
|
-
A =
|
|
1590
|
-
else if (m.mode ===
|
|
1591
|
-
A = new
|
|
1592
|
-
else if (m.mode ===
|
|
1593
|
-
A = new
|
|
1594
|
-
else if (m.mode ===
|
|
1595
|
-
A = new
|
|
1596
|
-
else if (m.mode ===
|
|
1597
|
-
A = new
|
|
1771
|
+
const y = l[f];
|
|
1772
|
+
if (m.mode === R.TRIANGLES || m.mode === R.TRIANGLE_STRIP || m.mode === R.TRIANGLE_FAN || m.mode === void 0)
|
|
1773
|
+
A = i.isSkinnedMesh === !0 ? new Lt(g, y) : new bt(g, y), A.isSkinnedMesh === !0 && A.normalizeSkinWeights(), m.mode === R.TRIANGLE_STRIP ? A.geometry = ve(A.geometry, Be) : m.mode === R.TRIANGLE_FAN && (A.geometry = ve(A.geometry, ae));
|
|
1774
|
+
else if (m.mode === R.LINES)
|
|
1775
|
+
A = new vt(g, y);
|
|
1776
|
+
else if (m.mode === R.LINE_STRIP)
|
|
1777
|
+
A = new St(g, y);
|
|
1778
|
+
else if (m.mode === R.LINE_LOOP)
|
|
1779
|
+
A = new Mt(g, y);
|
|
1780
|
+
else if (m.mode === R.POINTS)
|
|
1781
|
+
A = new Ct(g, y);
|
|
1598
1782
|
else
|
|
1599
1783
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
1600
|
-
Object.keys(A.geometry.morphAttributes).length > 0 &&
|
|
1784
|
+
Object.keys(A.geometry.morphAttributes).length > 0 && Vn(A, i), A.name = t.createUniqueName(i.name || "mesh_" + e), S(A, i), m.extensions && D(n, A, m), t.assignFinalMaterial(A), d.push(A);
|
|
1601
1785
|
}
|
|
1602
|
-
for (let
|
|
1603
|
-
t.associations.set(d[
|
|
1786
|
+
for (let f = 0, p = d.length; f < p; f++)
|
|
1787
|
+
t.associations.set(d[f], {
|
|
1604
1788
|
meshes: e,
|
|
1605
|
-
primitives:
|
|
1789
|
+
primitives: f
|
|
1606
1790
|
});
|
|
1607
1791
|
if (d.length === 1)
|
|
1608
|
-
return
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1611
|
-
for (let
|
|
1612
|
-
|
|
1613
|
-
return
|
|
1792
|
+
return i.extensions && D(n, d[0], i), d[0];
|
|
1793
|
+
const h = new te();
|
|
1794
|
+
i.extensions && D(n, h, i), t.associations.set(h, { meshes: e });
|
|
1795
|
+
for (let f = 0, p = d.length; f < p; f++)
|
|
1796
|
+
h.add(d[f]);
|
|
1797
|
+
return h;
|
|
1614
1798
|
});
|
|
1615
1799
|
}
|
|
1616
1800
|
/**
|
|
@@ -1620,12 +1804,12 @@ class Nn {
|
|
|
1620
1804
|
*/
|
|
1621
1805
|
loadCamera(e) {
|
|
1622
1806
|
let t;
|
|
1623
|
-
const
|
|
1807
|
+
const r = this.json.cameras[e], n = r[r.type];
|
|
1624
1808
|
if (!n) {
|
|
1625
1809
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1626
1810
|
return;
|
|
1627
1811
|
}
|
|
1628
|
-
return
|
|
1812
|
+
return r.type === "perspective" ? t = new It(Ot.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (t = new Nt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (t.name = this.createUniqueName(r.name)), S(t, r), Promise.resolve(t);
|
|
1629
1813
|
}
|
|
1630
1814
|
/**
|
|
1631
1815
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1633,21 +1817,21 @@ class Nn {
|
|
|
1633
1817
|
* @return {Promise<Skeleton>}
|
|
1634
1818
|
*/
|
|
1635
1819
|
loadSkin(e) {
|
|
1636
|
-
const t = this.json.skins[e],
|
|
1637
|
-
for (let n = 0,
|
|
1638
|
-
|
|
1639
|
-
return t.inverseBindMatrices !== void 0 ?
|
|
1640
|
-
const
|
|
1641
|
-
for (let
|
|
1642
|
-
const d =
|
|
1820
|
+
const t = this.json.skins[e], r = [];
|
|
1821
|
+
for (let n = 0, i = t.joints.length; n < i; n++)
|
|
1822
|
+
r.push(this._loadNodeShallow(t.joints[n]));
|
|
1823
|
+
return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(n) {
|
|
1824
|
+
const i = n.pop(), s = n, a = [], o = [];
|
|
1825
|
+
for (let l = 0, u = s.length; l < u; l++) {
|
|
1826
|
+
const d = s[l];
|
|
1643
1827
|
if (d) {
|
|
1644
|
-
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1828
|
+
a.push(d);
|
|
1829
|
+
const h = new W();
|
|
1830
|
+
i !== null && h.fromArray(i.array, l * 16), o.push(h);
|
|
1647
1831
|
} else
|
|
1648
|
-
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[
|
|
1832
|
+
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[l]);
|
|
1649
1833
|
}
|
|
1650
|
-
return new
|
|
1834
|
+
return new Pt(a, o);
|
|
1651
1835
|
});
|
|
1652
1836
|
}
|
|
1653
1837
|
/**
|
|
@@ -1656,40 +1840,40 @@ class Nn {
|
|
|
1656
1840
|
* @return {Promise<AnimationClip>}
|
|
1657
1841
|
*/
|
|
1658
1842
|
loadAnimation(e) {
|
|
1659
|
-
const t = this.json,
|
|
1660
|
-
for (let d = 0,
|
|
1661
|
-
const
|
|
1662
|
-
|
|
1843
|
+
const t = this.json, r = this, n = t.animations[e], i = n.name ? n.name : "animation_" + e, s = [], a = [], o = [], l = [], u = [];
|
|
1844
|
+
for (let d = 0, h = n.channels.length; d < h; d++) {
|
|
1845
|
+
const f = n.channels[d], p = n.samplers[f.sampler], g = f.target, m = g.node, A = n.parameters !== void 0 ? n.parameters[p.input] : p.input, y = n.parameters !== void 0 ? n.parameters[p.output] : p.output;
|
|
1846
|
+
g.node !== void 0 && (s.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", A)), o.push(this.getDependency("accessor", y)), l.push(p), u.push(g));
|
|
1663
1847
|
}
|
|
1664
1848
|
return Promise.all([
|
|
1665
|
-
Promise.all(
|
|
1666
|
-
Promise.all(l),
|
|
1849
|
+
Promise.all(s),
|
|
1667
1850
|
Promise.all(a),
|
|
1668
|
-
Promise.all(
|
|
1669
|
-
Promise.all(
|
|
1851
|
+
Promise.all(o),
|
|
1852
|
+
Promise.all(l),
|
|
1853
|
+
Promise.all(u)
|
|
1670
1854
|
]).then(function(d) {
|
|
1671
|
-
const
|
|
1672
|
-
for (let y = 0,
|
|
1673
|
-
const
|
|
1674
|
-
if (
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
for (let
|
|
1679
|
-
A.push(
|
|
1855
|
+
const h = d[0], f = d[1], p = d[2], g = d[3], m = d[4], A = [];
|
|
1856
|
+
for (let y = 0, E = h.length; y < E; y++) {
|
|
1857
|
+
const w = h[y], L = f[y], M = p[y], x = g[y], U = m[y];
|
|
1858
|
+
if (w === void 0) continue;
|
|
1859
|
+
w.updateMatrix && w.updateMatrix();
|
|
1860
|
+
const C = r._createAnimationTracks(w, L, M, x, U);
|
|
1861
|
+
if (C)
|
|
1862
|
+
for (let J = 0; J < C.length; J++)
|
|
1863
|
+
A.push(C[J]);
|
|
1680
1864
|
}
|
|
1681
|
-
return new
|
|
1865
|
+
return new Dt(i, void 0, A);
|
|
1682
1866
|
});
|
|
1683
1867
|
}
|
|
1684
1868
|
createNodeMesh(e) {
|
|
1685
|
-
const t = this.json,
|
|
1686
|
-
return n.mesh === void 0 ? null :
|
|
1687
|
-
const
|
|
1688
|
-
return n.weights !== void 0 &&
|
|
1689
|
-
if (
|
|
1690
|
-
for (let
|
|
1691
|
-
|
|
1692
|
-
}),
|
|
1869
|
+
const t = this.json, r = this, n = t.nodes[e];
|
|
1870
|
+
return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(i) {
|
|
1871
|
+
const s = r._getNodeRef(r.meshCache, n.mesh, i);
|
|
1872
|
+
return n.weights !== void 0 && s.traverse(function(a) {
|
|
1873
|
+
if (a.isMesh)
|
|
1874
|
+
for (let o = 0, l = n.weights.length; o < l; o++)
|
|
1875
|
+
a.morphTargetInfluences[o] = n.weights[o];
|
|
1876
|
+
}), s;
|
|
1693
1877
|
});
|
|
1694
1878
|
}
|
|
1695
1879
|
/**
|
|
@@ -1698,50 +1882,50 @@ class Nn {
|
|
|
1698
1882
|
* @return {Promise<Object3D>}
|
|
1699
1883
|
*/
|
|
1700
1884
|
loadNode(e) {
|
|
1701
|
-
const t = this.json,
|
|
1702
|
-
for (let
|
|
1703
|
-
|
|
1704
|
-
const
|
|
1885
|
+
const t = this.json, r = this, n = t.nodes[e], i = r._loadNodeShallow(e), s = [], a = n.children || [];
|
|
1886
|
+
for (let l = 0, u = a.length; l < u; l++)
|
|
1887
|
+
s.push(r.getDependency("node", a[l]));
|
|
1888
|
+
const o = n.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", n.skin);
|
|
1705
1889
|
return Promise.all([
|
|
1706
|
-
|
|
1707
|
-
Promise.all(
|
|
1708
|
-
|
|
1709
|
-
]).then(function(
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
|
|
1890
|
+
i,
|
|
1891
|
+
Promise.all(s),
|
|
1892
|
+
o
|
|
1893
|
+
]).then(function(l) {
|
|
1894
|
+
const u = l[0], d = l[1], h = l[2];
|
|
1895
|
+
h !== null && u.traverse(function(f) {
|
|
1896
|
+
f.isSkinnedMesh && f.bind(h, Xn);
|
|
1713
1897
|
});
|
|
1714
|
-
for (let
|
|
1715
|
-
|
|
1716
|
-
return
|
|
1898
|
+
for (let f = 0, p = d.length; f < p; f++)
|
|
1899
|
+
u.add(d[f]);
|
|
1900
|
+
return u;
|
|
1717
1901
|
});
|
|
1718
1902
|
}
|
|
1719
1903
|
// ._loadNodeShallow() parses a single node.
|
|
1720
1904
|
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1721
1905
|
_loadNodeShallow(e) {
|
|
1722
|
-
const t = this.json,
|
|
1906
|
+
const t = this.json, r = this.extensions, n = this;
|
|
1723
1907
|
if (this.nodeCache[e] !== void 0)
|
|
1724
1908
|
return this.nodeCache[e];
|
|
1725
|
-
const
|
|
1726
|
-
return
|
|
1909
|
+
const i = t.nodes[e], s = i.name ? n.createUniqueName(i.name) : "", a = [], o = n._invokeOne(function(l) {
|
|
1910
|
+
return l.createNodeMesh && l.createNodeMesh(e);
|
|
1727
1911
|
});
|
|
1728
|
-
return
|
|
1729
|
-
return n._getNodeRef(n.cameraCache,
|
|
1730
|
-
})), n._invokeAll(function(
|
|
1731
|
-
return
|
|
1732
|
-
}).forEach(function(
|
|
1733
|
-
|
|
1734
|
-
}), this.nodeCache[e] = Promise.all(
|
|
1735
|
-
let
|
|
1736
|
-
if (
|
|
1737
|
-
for (let d = 0,
|
|
1738
|
-
|
|
1739
|
-
if (
|
|
1740
|
-
const d = new
|
|
1741
|
-
d.fromArray(
|
|
1912
|
+
return o && a.push(o), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(l) {
|
|
1913
|
+
return n._getNodeRef(n.cameraCache, i.camera, l);
|
|
1914
|
+
})), n._invokeAll(function(l) {
|
|
1915
|
+
return l.createNodeAttachment && l.createNodeAttachment(e);
|
|
1916
|
+
}).forEach(function(l) {
|
|
1917
|
+
a.push(l);
|
|
1918
|
+
}), this.nodeCache[e] = Promise.all(a).then(function(l) {
|
|
1919
|
+
let u;
|
|
1920
|
+
if (i.isBone === !0 ? u = new kt() : l.length > 1 ? u = new te() : l.length === 1 ? u = l[0] : u = new Ve(), u !== l[0])
|
|
1921
|
+
for (let d = 0, h = l.length; d < h; d++)
|
|
1922
|
+
u.add(l[d]);
|
|
1923
|
+
if (i.name && (u.userData.name = i.name, u.name = s), S(u, i), i.extensions && D(r, u, i), i.matrix !== void 0) {
|
|
1924
|
+
const d = new W();
|
|
1925
|
+
d.fromArray(i.matrix), u.applyMatrix4(d);
|
|
1742
1926
|
} else
|
|
1743
|
-
|
|
1744
|
-
return n.associations.has(
|
|
1927
|
+
i.translation !== void 0 && u.position.fromArray(i.translation), i.rotation !== void 0 && u.quaternion.fromArray(i.rotation), i.scale !== void 0 && u.scale.fromArray(i.scale);
|
|
1928
|
+
return n.associations.has(u) || n.associations.set(u, {}), n.associations.get(u).nodes = e, u;
|
|
1745
1929
|
}), this.nodeCache[e];
|
|
1746
1930
|
}
|
|
1747
1931
|
/**
|
|
@@ -1750,96 +1934,96 @@ class Nn {
|
|
|
1750
1934
|
* @return {Promise<Group>}
|
|
1751
1935
|
*/
|
|
1752
1936
|
loadScene(e) {
|
|
1753
|
-
const t = this.extensions,
|
|
1754
|
-
|
|
1755
|
-
const
|
|
1756
|
-
for (let
|
|
1757
|
-
|
|
1758
|
-
return Promise.all(
|
|
1759
|
-
for (let
|
|
1760
|
-
|
|
1761
|
-
const
|
|
1937
|
+
const t = this.extensions, r = this.json.scenes[e], n = this, i = new te();
|
|
1938
|
+
r.name && (i.name = n.createUniqueName(r.name)), S(i, r), r.extensions && D(t, i, r);
|
|
1939
|
+
const s = r.nodes || [], a = [];
|
|
1940
|
+
for (let o = 0, l = s.length; o < l; o++)
|
|
1941
|
+
a.push(n.getDependency("node", s[o]));
|
|
1942
|
+
return Promise.all(a).then(function(o) {
|
|
1943
|
+
for (let u = 0, d = o.length; u < d; u++)
|
|
1944
|
+
i.add(o[u]);
|
|
1945
|
+
const l = (u) => {
|
|
1762
1946
|
const d = /* @__PURE__ */ new Map();
|
|
1763
|
-
for (const [
|
|
1764
|
-
(
|
|
1765
|
-
return
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1947
|
+
for (const [h, f] of n.associations)
|
|
1948
|
+
(h instanceof ee || h instanceof Ee) && d.set(h, f);
|
|
1949
|
+
return u.traverse((h) => {
|
|
1950
|
+
const f = n.associations.get(h);
|
|
1951
|
+
f != null && d.set(h, f);
|
|
1768
1952
|
}), d;
|
|
1769
1953
|
};
|
|
1770
|
-
return n.associations =
|
|
1954
|
+
return n.associations = l(i), i;
|
|
1771
1955
|
});
|
|
1772
1956
|
}
|
|
1773
|
-
_createAnimationTracks(e, t,
|
|
1774
|
-
const
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
}) :
|
|
1778
|
-
let
|
|
1779
|
-
switch (
|
|
1780
|
-
case
|
|
1781
|
-
|
|
1957
|
+
_createAnimationTracks(e, t, r, n, i) {
|
|
1958
|
+
const s = [], a = e.name ? e.name : e.uuid, o = [];
|
|
1959
|
+
I[i.path] === I.weights ? e.traverse(function(h) {
|
|
1960
|
+
h.morphTargetInfluences && o.push(h.name ? h.name : h.uuid);
|
|
1961
|
+
}) : o.push(a);
|
|
1962
|
+
let l;
|
|
1963
|
+
switch (I[i.path]) {
|
|
1964
|
+
case I.weights:
|
|
1965
|
+
l = xe;
|
|
1782
1966
|
break;
|
|
1783
|
-
case
|
|
1784
|
-
|
|
1967
|
+
case I.rotation:
|
|
1968
|
+
l = Le;
|
|
1785
1969
|
break;
|
|
1786
|
-
case
|
|
1787
|
-
case
|
|
1788
|
-
|
|
1970
|
+
case I.position:
|
|
1971
|
+
case I.scale:
|
|
1972
|
+
l = Re;
|
|
1789
1973
|
break;
|
|
1790
1974
|
default:
|
|
1791
|
-
switch (
|
|
1975
|
+
switch (r.itemSize) {
|
|
1792
1976
|
case 1:
|
|
1793
|
-
|
|
1977
|
+
l = xe;
|
|
1794
1978
|
break;
|
|
1795
1979
|
case 2:
|
|
1796
1980
|
case 3:
|
|
1797
1981
|
default:
|
|
1798
|
-
|
|
1982
|
+
l = Re;
|
|
1799
1983
|
break;
|
|
1800
1984
|
}
|
|
1801
1985
|
break;
|
|
1802
1986
|
}
|
|
1803
|
-
const
|
|
1804
|
-
for (let
|
|
1805
|
-
const
|
|
1806
|
-
|
|
1987
|
+
const u = n.interpolation !== void 0 ? Bn[n.interpolation] : qe, d = this._getArrayFromAccessor(r);
|
|
1988
|
+
for (let h = 0, f = o.length; h < f; h++) {
|
|
1989
|
+
const p = new l(
|
|
1990
|
+
o[h] + "." + I[i.path],
|
|
1807
1991
|
t.array,
|
|
1808
1992
|
d,
|
|
1809
|
-
|
|
1993
|
+
u
|
|
1810
1994
|
);
|
|
1811
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(
|
|
1995
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(p), s.push(p);
|
|
1812
1996
|
}
|
|
1813
|
-
return
|
|
1997
|
+
return s;
|
|
1814
1998
|
}
|
|
1815
1999
|
_getArrayFromAccessor(e) {
|
|
1816
2000
|
let t = e.array;
|
|
1817
2001
|
if (e.normalized) {
|
|
1818
|
-
const
|
|
1819
|
-
for (let
|
|
1820
|
-
n[
|
|
2002
|
+
const r = fe(t.constructor), n = new Float32Array(t.length);
|
|
2003
|
+
for (let i = 0, s = t.length; i < s; i++)
|
|
2004
|
+
n[i] = t[i] * r;
|
|
1821
2005
|
t = n;
|
|
1822
2006
|
}
|
|
1823
2007
|
return t;
|
|
1824
2008
|
}
|
|
1825
2009
|
_createCubicSplineTrackInterpolant(e) {
|
|
1826
|
-
e.createInterpolant = function(
|
|
1827
|
-
const n = this instanceof
|
|
1828
|
-
return new n(this.times, this.values, this.getValueSize() / 3,
|
|
2010
|
+
e.createInterpolant = function(r) {
|
|
2011
|
+
const n = this instanceof Le ? Gn : Ze;
|
|
2012
|
+
return new n(this.times, this.values, this.getValueSize() / 3, r);
|
|
1829
2013
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1830
2014
|
}
|
|
1831
2015
|
}
|
|
1832
|
-
function
|
|
1833
|
-
const
|
|
1834
|
-
if (
|
|
1835
|
-
const
|
|
1836
|
-
if (
|
|
2016
|
+
function qn(c, e, t) {
|
|
2017
|
+
const r = e.attributes, n = new Vt();
|
|
2018
|
+
if (r.POSITION !== void 0) {
|
|
2019
|
+
const a = t.json.accessors[r.POSITION], o = a.min, l = a.max;
|
|
2020
|
+
if (o !== void 0 && l !== void 0) {
|
|
1837
2021
|
if (n.set(
|
|
1838
|
-
new
|
|
1839
|
-
new
|
|
1840
|
-
),
|
|
1841
|
-
const
|
|
1842
|
-
n.min.multiplyScalar(
|
|
2022
|
+
new F(o[0], o[1], o[2]),
|
|
2023
|
+
new F(l[0], l[1], l[2])
|
|
2024
|
+
), a.normalized) {
|
|
2025
|
+
const u = fe(H[a.componentType]);
|
|
2026
|
+
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
1843
2027
|
}
|
|
1844
2028
|
} else {
|
|
1845
2029
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1847,147 +2031,147 @@ function $n(o, e, t) {
|
|
|
1847
2031
|
}
|
|
1848
2032
|
} else
|
|
1849
2033
|
return;
|
|
1850
|
-
const
|
|
1851
|
-
if (
|
|
1852
|
-
const
|
|
1853
|
-
for (let
|
|
1854
|
-
const d =
|
|
2034
|
+
const i = e.targets;
|
|
2035
|
+
if (i !== void 0) {
|
|
2036
|
+
const a = new F(), o = new F();
|
|
2037
|
+
for (let l = 0, u = i.length; l < u; l++) {
|
|
2038
|
+
const d = i[l];
|
|
1855
2039
|
if (d.POSITION !== void 0) {
|
|
1856
|
-
const
|
|
1857
|
-
if (
|
|
1858
|
-
if (
|
|
1859
|
-
const
|
|
1860
|
-
|
|
2040
|
+
const h = t.json.accessors[d.POSITION], f = h.min, p = h.max;
|
|
2041
|
+
if (f !== void 0 && p !== void 0) {
|
|
2042
|
+
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) {
|
|
2043
|
+
const g = fe(H[h.componentType]);
|
|
2044
|
+
o.multiplyScalar(g);
|
|
1861
2045
|
}
|
|
1862
|
-
|
|
2046
|
+
a.max(o);
|
|
1863
2047
|
} else
|
|
1864
2048
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1865
2049
|
}
|
|
1866
2050
|
}
|
|
1867
|
-
n.expandByVector(
|
|
2051
|
+
n.expandByVector(a);
|
|
1868
2052
|
}
|
|
1869
|
-
|
|
1870
|
-
const
|
|
1871
|
-
n.getCenter(
|
|
2053
|
+
c.boundingBox = n;
|
|
2054
|
+
const s = new zt();
|
|
2055
|
+
n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, c.boundingSphere = s;
|
|
1872
2056
|
}
|
|
1873
|
-
function
|
|
1874
|
-
const
|
|
1875
|
-
function
|
|
1876
|
-
return t.getDependency("accessor",
|
|
1877
|
-
|
|
2057
|
+
function Ie(c, e, t) {
|
|
2058
|
+
const r = e.attributes, n = [];
|
|
2059
|
+
function i(s, a) {
|
|
2060
|
+
return t.getDependency("accessor", s).then(function(o) {
|
|
2061
|
+
c.setAttribute(a, o);
|
|
1878
2062
|
});
|
|
1879
2063
|
}
|
|
1880
|
-
for (const
|
|
1881
|
-
const
|
|
1882
|
-
|
|
2064
|
+
for (const s in r) {
|
|
2065
|
+
const a = he[s] || s.toLowerCase();
|
|
2066
|
+
a in c.attributes || n.push(i(r[s], a));
|
|
1883
2067
|
}
|
|
1884
|
-
if (e.indices !== void 0 && !
|
|
1885
|
-
const
|
|
1886
|
-
|
|
2068
|
+
if (e.indices !== void 0 && !c.index) {
|
|
2069
|
+
const s = t.getDependency("accessor", e.indices).then(function(a) {
|
|
2070
|
+
c.setIndex(a);
|
|
1887
2071
|
});
|
|
1888
|
-
n.push(
|
|
2072
|
+
n.push(s);
|
|
1889
2073
|
}
|
|
1890
|
-
return
|
|
1891
|
-
return e.targets !== void 0 ?
|
|
2074
|
+
return oe.workingColorSpace !== b && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${oe.workingColorSpace}" not supported.`), S(c, e), qn(c, e, t), Promise.all(n).then(function() {
|
|
2075
|
+
return e.targets !== void 0 ? Kn(c, e.targets, t) : c;
|
|
1892
2076
|
});
|
|
1893
2077
|
}
|
|
1894
|
-
var
|
|
1895
|
-
for (var n =
|
|
1896
|
-
(
|
|
1897
|
-
return
|
|
2078
|
+
var Yn = Object.defineProperty, Qn = Object.getOwnPropertyDescriptor, Jn = (c, e, t, r) => {
|
|
2079
|
+
for (var n = r > 1 ? void 0 : r ? Qn(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
2080
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
2081
|
+
return r && n && Yn(e, t, n), n;
|
|
1898
2082
|
};
|
|
1899
|
-
let
|
|
2083
|
+
let pe = class {
|
|
1900
2084
|
constructor() {
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
2085
|
+
T(this, "loadingManager", new Xt());
|
|
2086
|
+
T(this, "loaders", {});
|
|
2087
|
+
T(this, "resources", []);
|
|
2088
|
+
T(this, "items", {});
|
|
2089
|
+
T(this, "toLoad", 0);
|
|
2090
|
+
T(this, "loaded", 0);
|
|
1907
2091
|
}
|
|
1908
2092
|
get videoLoader() {
|
|
1909
2093
|
return {
|
|
1910
|
-
load: (
|
|
2094
|
+
load: (c, e) => {
|
|
1911
2095
|
let t = document.createElement("video");
|
|
1912
|
-
t.muted = !0, t.loop = !0, t.controls = !1, t.playsInline = !0, t.src =
|
|
1913
|
-
const
|
|
2096
|
+
t.muted = !0, t.loop = !0, t.controls = !1, t.playsInline = !0, t.src = c, t.autoplay = !0;
|
|
2097
|
+
const r = () => {
|
|
1914
2098
|
if (!t) return;
|
|
1915
2099
|
t.play();
|
|
1916
|
-
const n = new
|
|
2100
|
+
const n = new Yt(t), i = n.dispose.bind(n);
|
|
1917
2101
|
n.dispose = () => {
|
|
1918
|
-
n.userData.element = void 0, t == null || t.remove(), t = void 0,
|
|
1919
|
-
}, e(n), n.userData.element = t, t.removeEventListener("canplaythrough",
|
|
2102
|
+
n.userData.element = void 0, t == null || t.remove(), t = void 0, i();
|
|
2103
|
+
}, e(n), n.userData.element = t, t.removeEventListener("canplaythrough", r);
|
|
1920
2104
|
};
|
|
1921
|
-
t.addEventListener("canplaythrough",
|
|
2105
|
+
t.addEventListener("canplaythrough", r);
|
|
1922
2106
|
}
|
|
1923
2107
|
};
|
|
1924
2108
|
}
|
|
1925
2109
|
_setLoaders() {
|
|
1926
|
-
this.loaders.gltfLoader = new
|
|
2110
|
+
this.loaders.gltfLoader = new mn(this.loadingManager), this.loaders.textureLoader = new ze(this.loadingManager), this.loaders.cubeTextureLoader = new Wt(this.loadingManager), this.loaders.audioLoader = new qt(this.loadingManager), this.loaders.videoLoader = this.videoLoader;
|
|
1927
2111
|
}
|
|
1928
|
-
setResources(
|
|
1929
|
-
this.resources =
|
|
2112
|
+
setResources(c) {
|
|
2113
|
+
this.resources = c, this.toLoad = this.resources.length, this.loaded = 0;
|
|
1930
2114
|
}
|
|
1931
|
-
init(
|
|
1932
|
-
this.resources =
|
|
2115
|
+
init(c = []) {
|
|
2116
|
+
this.resources = c, this._setLoaders();
|
|
1933
2117
|
}
|
|
1934
2118
|
};
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
],
|
|
1938
|
-
var
|
|
1939
|
-
for (var n =
|
|
1940
|
-
(
|
|
1941
|
-
return
|
|
1942
|
-
},
|
|
2119
|
+
pe = Jn([
|
|
2120
|
+
Y(Q.ResolutionScoped)
|
|
2121
|
+
], pe);
|
|
2122
|
+
var Zn = Object.defineProperty, es = Object.getOwnPropertyDescriptor, ts = (c, e, t, r) => {
|
|
2123
|
+
for (var n = r > 1 ? void 0 : r ? es(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
2124
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
2125
|
+
return r && n && Zn(e, t, n), n;
|
|
2126
|
+
}, Oe = (c, e) => (t, r) => e(t, r, c);
|
|
1943
2127
|
let me = class {
|
|
1944
|
-
constructor(
|
|
1945
|
-
this.controller =
|
|
2128
|
+
constructor(c, e) {
|
|
2129
|
+
this.controller = c, this.component = e, typeof self < "u" && (self.onmessage = (t) => {
|
|
1946
2130
|
var n;
|
|
1947
|
-
const
|
|
1948
|
-
|
|
2131
|
+
const r = (n = t == null ? void 0 : t.data) == null ? void 0 : n.resources;
|
|
2132
|
+
r && this.init(r);
|
|
1949
2133
|
});
|
|
1950
2134
|
}
|
|
1951
|
-
_handleLoadedResource(
|
|
1952
|
-
this.component.items[
|
|
2135
|
+
_handleLoadedResource(c, e) {
|
|
2136
|
+
this.component.items[c.name] = e, this.component.loaded++, this.controller.progress$$.next({
|
|
1953
2137
|
file: e,
|
|
1954
|
-
resource:
|
|
2138
|
+
resource: c,
|
|
1955
2139
|
loaded: this.component.loaded,
|
|
1956
2140
|
toLoad: this.component.toLoad
|
|
1957
2141
|
});
|
|
1958
2142
|
}
|
|
1959
|
-
setDracoLoader(
|
|
1960
|
-
this.component.loaders.dracoLoader = new
|
|
2143
|
+
setDracoLoader(c, e = !0) {
|
|
2144
|
+
this.component.loaders.dracoLoader = new un(
|
|
1961
2145
|
this.component.loadingManager
|
|
1962
|
-
), this.component.loaders.dracoLoader.setDecoderPath(
|
|
2146
|
+
), this.component.loaders.dracoLoader.setDecoderPath(c), e && this.component.loaders.gltfLoader && this.component.loaders.gltfLoader.setDRACOLoader(
|
|
1963
2147
|
this.component.loaders.dracoLoader
|
|
1964
2148
|
);
|
|
1965
2149
|
}
|
|
1966
2150
|
load() {
|
|
1967
|
-
var e, t,
|
|
1968
|
-
const
|
|
1969
|
-
if (
|
|
2151
|
+
var e, t, r, n, i;
|
|
2152
|
+
const c = this.component.resources[0];
|
|
2153
|
+
if (c) {
|
|
1970
2154
|
this.controller.progress$$.next({
|
|
1971
|
-
resource:
|
|
2155
|
+
resource: c,
|
|
1972
2156
|
loaded: this.component.loaded,
|
|
1973
2157
|
toLoad: this.component.toLoad
|
|
1974
2158
|
});
|
|
1975
|
-
for (const
|
|
1976
|
-
this.component.items[
|
|
1977
|
-
|
|
1978
|
-
(
|
|
1979
|
-
)),
|
|
1980
|
-
this._handleLoadedResource(
|
|
1981
|
-
})),
|
|
1982
|
-
|
|
1983
|
-
(
|
|
1984
|
-
)),
|
|
1985
|
-
|
|
1986
|
-
(
|
|
1987
|
-
)),
|
|
1988
|
-
|
|
1989
|
-
(
|
|
1990
|
-
this._handleLoadedResource(
|
|
2159
|
+
for (const s of this.component.resources)
|
|
2160
|
+
this.component.items[s.name] || (s.type === "gltfModel" && typeof s.path == "string" && ((e = this.component.loaders.gltfLoader) == null || e.load(
|
|
2161
|
+
s.path,
|
|
2162
|
+
(a) => this._handleLoadedResource(s, a)
|
|
2163
|
+
)), s.type === "texture" && typeof s.path == "string" && ((t = this.component.loaders.textureLoader) == null || t.load(s.path, (a) => {
|
|
2164
|
+
this._handleLoadedResource(s, new Qt(a));
|
|
2165
|
+
})), s.type === "cubeTexture" && typeof s.path == "object" && ((r = this.component.loaders.cubeTextureLoader) == null || r.load(
|
|
2166
|
+
s.path,
|
|
2167
|
+
(a) => this._handleLoadedResource(s, a)
|
|
2168
|
+
)), s.type === "video" && typeof s.path == "string" && ((n = this.component.loaders.videoLoader) == null || n.load(
|
|
2169
|
+
s.path,
|
|
2170
|
+
(a) => this._handleLoadedResource(s, a)
|
|
2171
|
+
)), s.type === "audio" && typeof s.path == "string" && ((i = this.component.loaders.audioLoader) == null || i.load(
|
|
2172
|
+
s.path,
|
|
2173
|
+
(a) => {
|
|
2174
|
+
this._handleLoadedResource(s, a);
|
|
1991
2175
|
}
|
|
1992
2176
|
)));
|
|
1993
2177
|
}
|
|
@@ -2007,14 +2191,11 @@ let me = class {
|
|
|
2007
2191
|
toLoad() {
|
|
2008
2192
|
return this.component.toLoad;
|
|
2009
2193
|
}
|
|
2010
|
-
init(
|
|
2011
|
-
this.component.init(
|
|
2194
|
+
init(c = []) {
|
|
2195
|
+
this.component.init(c);
|
|
2012
2196
|
}
|
|
2013
2197
|
dispose() {
|
|
2014
|
-
this.controller.
|
|
2015
|
-
}
|
|
2016
|
-
lifecycle$() {
|
|
2017
|
-
return this.controller.lifecycle$;
|
|
2198
|
+
this.controller.progress$$.complete();
|
|
2018
2199
|
}
|
|
2019
2200
|
progress$() {
|
|
2020
2201
|
return this.controller.progress$;
|
|
@@ -2023,491 +2204,56 @@ let me = class {
|
|
|
2023
2204
|
return this.controller.progressCompleted$;
|
|
2024
2205
|
}
|
|
2025
2206
|
};
|
|
2026
|
-
me =
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2207
|
+
me = ts([
|
|
2208
|
+
Y(Q.ResolutionScoped),
|
|
2209
|
+
Oe(0, k(de)),
|
|
2210
|
+
Oe(1, k(pe))
|
|
2030
2211
|
], me);
|
|
2031
|
-
const gs =
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
* @author George Michael Brower
|
|
2037
|
-
* @license MIT
|
|
2038
|
-
*/
|
|
2039
|
-
class L {
|
|
2040
|
-
constructor(e, t, s, n, r = "div") {
|
|
2041
|
-
this.parent = e, this.object = t, this.property = s, this._disabled = !1, this._hidden = !1, this.initialValue = this.getValue(), this.domElement = document.createElement("div"), this.domElement.classList.add("controller"), this.domElement.classList.add(n), this.$name = document.createElement("div"), this.$name.classList.add("name"), L.nextNameID = L.nextNameID || 0, this.$name.id = "lil-gui-name-" + ++L.nextNameID, this.$widget = document.createElement(r), this.$widget.classList.add("widget"), this.$disable = this.$widget, this.domElement.appendChild(this.$name), this.domElement.appendChild(this.$widget), this.parent.children.push(this), this.parent.controllers.push(this), this.parent.$children.appendChild(this.domElement), this._listenCallback = this._listenCallback.bind(this), this.name(s);
|
|
2042
|
-
}
|
|
2043
|
-
name(e) {
|
|
2044
|
-
return this._name = e, this.$name.innerHTML = e, this;
|
|
2045
|
-
}
|
|
2046
|
-
onChange(e) {
|
|
2047
|
-
return this._onChange = e, this;
|
|
2048
|
-
}
|
|
2049
|
-
_callOnChange() {
|
|
2050
|
-
this.parent._callOnChange(this), this._onChange !== void 0 && this._onChange.call(this, this.getValue()), this._changed = !0;
|
|
2051
|
-
}
|
|
2052
|
-
onFinishChange(e) {
|
|
2053
|
-
return this._onFinishChange = e, this;
|
|
2054
|
-
}
|
|
2055
|
-
_callOnFinishChange() {
|
|
2056
|
-
this._changed && (this.parent._callOnFinishChange(this), this._onFinishChange !== void 0 && this._onFinishChange.call(this, this.getValue())), this._changed = !1;
|
|
2057
|
-
}
|
|
2058
|
-
reset() {
|
|
2059
|
-
return this.setValue(this.initialValue), this._callOnFinishChange(), this;
|
|
2060
|
-
}
|
|
2061
|
-
enable(e = !0) {
|
|
2062
|
-
return this.disable(!e);
|
|
2063
|
-
}
|
|
2064
|
-
disable(e = !0) {
|
|
2065
|
-
return e === this._disabled || (this._disabled = e, this.domElement.classList.toggle("disabled", e), this.$disable.toggleAttribute("disabled", e)), this;
|
|
2066
|
-
}
|
|
2067
|
-
show(e = !0) {
|
|
2068
|
-
return this._hidden = !e, this.domElement.style.display = this._hidden ? "none" : "", this;
|
|
2069
|
-
}
|
|
2070
|
-
hide() {
|
|
2071
|
-
return this.show(!1);
|
|
2072
|
-
}
|
|
2073
|
-
options(e) {
|
|
2074
|
-
const t = this.parent.add(this.object, this.property, e);
|
|
2075
|
-
return t.name(this._name), this.destroy(), t;
|
|
2076
|
-
}
|
|
2077
|
-
min(e) {
|
|
2078
|
-
return this;
|
|
2079
|
-
}
|
|
2080
|
-
max(e) {
|
|
2081
|
-
return this;
|
|
2082
|
-
}
|
|
2083
|
-
step(e) {
|
|
2084
|
-
return this;
|
|
2085
|
-
}
|
|
2086
|
-
decimals(e) {
|
|
2087
|
-
return this;
|
|
2088
|
-
}
|
|
2089
|
-
listen(e = !0) {
|
|
2090
|
-
return this._listening = e, this._listenCallbackID !== void 0 && (cancelAnimationFrame(this._listenCallbackID), this._listenCallbackID = void 0), this._listening && this._listenCallback(), this;
|
|
2091
|
-
}
|
|
2092
|
-
_listenCallback() {
|
|
2093
|
-
this._listenCallbackID = requestAnimationFrame(this._listenCallback);
|
|
2094
|
-
const e = this.save();
|
|
2095
|
-
e !== this._listenPrevValue && this.updateDisplay(), this._listenPrevValue = e;
|
|
2096
|
-
}
|
|
2097
|
-
getValue() {
|
|
2098
|
-
return this.object[this.property];
|
|
2099
|
-
}
|
|
2100
|
-
setValue(e) {
|
|
2101
|
-
return this.object[this.property] = e, this._callOnChange(), this.updateDisplay(), this;
|
|
2102
|
-
}
|
|
2103
|
-
updateDisplay() {
|
|
2104
|
-
return this;
|
|
2105
|
-
}
|
|
2106
|
-
load(e) {
|
|
2107
|
-
return this.setValue(e), this._callOnFinishChange(), this;
|
|
2108
|
-
}
|
|
2109
|
-
save() {
|
|
2110
|
-
return this.getValue();
|
|
2111
|
-
}
|
|
2112
|
-
destroy() {
|
|
2113
|
-
this.listen(!1), this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.controllers.splice(this.parent.controllers.indexOf(this), 1), this.parent.$children.removeChild(this.domElement);
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
class Vn extends L {
|
|
2117
|
-
constructor(e, t, s) {
|
|
2118
|
-
super(e, t, s, "boolean", "label"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "checkbox"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$widget.appendChild(this.$input), this.$input.addEventListener("change", () => {
|
|
2119
|
-
this.setValue(this.$input.checked), this._callOnFinishChange();
|
|
2120
|
-
}), this.$disable = this.$input, this.updateDisplay();
|
|
2121
|
-
}
|
|
2122
|
-
updateDisplay() {
|
|
2123
|
-
return this.$input.checked = this.getValue(), this;
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
function ge(o) {
|
|
2127
|
-
let e, t;
|
|
2128
|
-
return (e = o.match(/(#|0x)?([a-f0-9]{6})/i)) ? t = e[2] : (e = o.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/)) ? t = parseInt(e[1]).toString(16).padStart(2, 0) + parseInt(e[2]).toString(16).padStart(2, 0) + parseInt(e[3]).toString(16).padStart(2, 0) : (e = o.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i)) && (t = e[1] + e[1] + e[2] + e[2] + e[3] + e[3]), !!t && "#" + t;
|
|
2129
|
-
}
|
|
2130
|
-
const Kn = { isPrimitive: !0, match: (o) => typeof o == "string", fromHexString: ge, toHexString: ge }, V = { isPrimitive: !0, match: (o) => typeof o == "number", fromHexString: (o) => parseInt(o.substring(1), 16), toHexString: (o) => "#" + o.toString(16).padStart(6, 0) }, zn = { isPrimitive: !1, match: Array.isArray, fromHexString(o, e, t = 1) {
|
|
2131
|
-
const s = V.fromHexString(o);
|
|
2132
|
-
e[0] = (s >> 16 & 255) / 255 * t, e[1] = (s >> 8 & 255) / 255 * t, e[2] = (255 & s) / 255 * t;
|
|
2133
|
-
}, toHexString: ([o, e, t], s = 1) => V.toHexString(o * (s = 255 / s) << 16 ^ e * s << 8 ^ t * s << 0) }, Xn = { isPrimitive: !1, match: (o) => Object(o) === o, fromHexString(o, e, t = 1) {
|
|
2134
|
-
const s = V.fromHexString(o);
|
|
2135
|
-
e.r = (s >> 16 & 255) / 255 * t, e.g = (s >> 8 & 255) / 255 * t, e.b = (255 & s) / 255 * t;
|
|
2136
|
-
}, toHexString: ({ r: o, g: e, b: t }, s = 1) => V.toHexString(o * (s = 255 / s) << 16 ^ e * s << 8 ^ t * s << 0) }, Wn = [Kn, V, zn, Xn];
|
|
2137
|
-
class Yn extends L {
|
|
2138
|
-
constructor(e, t, s, n) {
|
|
2139
|
-
var r;
|
|
2140
|
-
super(e, t, s, "color"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "color"), this.$input.setAttribute("tabindex", -1), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$text = document.createElement("input"), this.$text.setAttribute("type", "text"), this.$text.setAttribute("spellcheck", "false"), this.$text.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("display"), this.$display.appendChild(this.$input), this.$widget.appendChild(this.$display), this.$widget.appendChild(this.$text), this._format = (r = this.initialValue, Wn.find((i) => i.match(r))), this._rgbScale = n, this._initialValueHexString = this.save(), this._textFocused = !1, this.$input.addEventListener("input", () => {
|
|
2141
|
-
this._setValueFromHexString(this.$input.value);
|
|
2142
|
-
}), this.$input.addEventListener("blur", () => {
|
|
2143
|
-
this._callOnFinishChange();
|
|
2144
|
-
}), this.$text.addEventListener("input", () => {
|
|
2145
|
-
const i = ge(this.$text.value);
|
|
2146
|
-
i && this._setValueFromHexString(i);
|
|
2147
|
-
}), this.$text.addEventListener("focus", () => {
|
|
2148
|
-
this._textFocused = !0, this.$text.select();
|
|
2149
|
-
}), this.$text.addEventListener("blur", () => {
|
|
2150
|
-
this._textFocused = !1, this.updateDisplay(), this._callOnFinishChange();
|
|
2151
|
-
}), this.$disable = this.$text, this.updateDisplay();
|
|
2152
|
-
}
|
|
2153
|
-
reset() {
|
|
2154
|
-
return this._setValueFromHexString(this._initialValueHexString), this;
|
|
2155
|
-
}
|
|
2156
|
-
_setValueFromHexString(e) {
|
|
2157
|
-
if (this._format.isPrimitive) {
|
|
2158
|
-
const t = this._format.fromHexString(e);
|
|
2159
|
-
this.setValue(t);
|
|
2160
|
-
} else this._format.fromHexString(e, this.getValue(), this._rgbScale), this._callOnChange(), this.updateDisplay();
|
|
2161
|
-
}
|
|
2162
|
-
save() {
|
|
2163
|
-
return this._format.toHexString(this.getValue(), this._rgbScale);
|
|
2164
|
-
}
|
|
2165
|
-
load(e) {
|
|
2166
|
-
return this._setValueFromHexString(e), this._callOnFinishChange(), this;
|
|
2167
|
-
}
|
|
2168
|
-
updateDisplay() {
|
|
2169
|
-
return this.$input.value = this._format.toHexString(this.getValue(), this._rgbScale), this._textFocused || (this.$text.value = this.$input.value.substring(1)), this.$display.style.backgroundColor = this.$input.value, this;
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
class re extends L {
|
|
2173
|
-
constructor(e, t, s) {
|
|
2174
|
-
super(e, t, s, "function"), this.$button = document.createElement("button"), this.$button.appendChild(this.$name), this.$widget.appendChild(this.$button), this.$button.addEventListener("click", (n) => {
|
|
2175
|
-
n.preventDefault(), this.getValue().call(this.object);
|
|
2176
|
-
}), this.$button.addEventListener("touchstart", () => {
|
|
2177
|
-
}, { passive: !0 }), this.$disable = this.$button;
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
class qn extends L {
|
|
2181
|
-
constructor(e, t, s, n, r, i) {
|
|
2182
|
-
super(e, t, s, "number"), this._initInput(), this.min(n), this.max(r);
|
|
2183
|
-
const l = i !== void 0;
|
|
2184
|
-
this.step(l ? i : this._getImplicitStep(), l), this.updateDisplay();
|
|
2185
|
-
}
|
|
2186
|
-
decimals(e) {
|
|
2187
|
-
return this._decimals = e, this.updateDisplay(), this;
|
|
2188
|
-
}
|
|
2189
|
-
min(e) {
|
|
2190
|
-
return this._min = e, this._onUpdateMinMax(), this;
|
|
2191
|
-
}
|
|
2192
|
-
max(e) {
|
|
2193
|
-
return this._max = e, this._onUpdateMinMax(), this;
|
|
2194
|
-
}
|
|
2195
|
-
step(e, t = !0) {
|
|
2196
|
-
return this._step = e, this._stepExplicit = t, this;
|
|
2197
|
-
}
|
|
2198
|
-
updateDisplay() {
|
|
2199
|
-
const e = this.getValue();
|
|
2200
|
-
if (this._hasSlider) {
|
|
2201
|
-
let t = (e - this._min) / (this._max - this._min);
|
|
2202
|
-
t = Math.max(0, Math.min(t, 1)), this.$fill.style.width = 100 * t + "%";
|
|
2203
|
-
}
|
|
2204
|
-
return this._inputFocused || (this.$input.value = this._decimals === void 0 ? e : e.toFixed(this._decimals)), this;
|
|
2205
|
-
}
|
|
2206
|
-
_initInput() {
|
|
2207
|
-
this.$input = document.createElement("input"), this.$input.setAttribute("type", "number"), this.$input.setAttribute("step", "any"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$widget.appendChild(this.$input), this.$disable = this.$input;
|
|
2208
|
-
const e = (h) => {
|
|
2209
|
-
const d = parseFloat(this.$input.value);
|
|
2210
|
-
isNaN(d) || (this._snapClampSetValue(d + h), this.$input.value = this.getValue());
|
|
2211
|
-
};
|
|
2212
|
-
let t, s, n, r, i, l = !1;
|
|
2213
|
-
const a = (h) => {
|
|
2214
|
-
if (l) {
|
|
2215
|
-
const d = h.clientX - t, u = h.clientY - s;
|
|
2216
|
-
Math.abs(u) > 5 ? (h.preventDefault(), this.$input.blur(), l = !1, this._setDraggingStyle(!0, "vertical")) : Math.abs(d) > 5 && c();
|
|
2217
|
-
}
|
|
2218
|
-
if (!l) {
|
|
2219
|
-
const d = h.clientY - n;
|
|
2220
|
-
i -= d * this._step * this._arrowKeyMultiplier(h), r + i > this._max ? i = this._max - r : r + i < this._min && (i = this._min - r), this._snapClampSetValue(r + i);
|
|
2221
|
-
}
|
|
2222
|
-
n = h.clientY;
|
|
2223
|
-
}, c = () => {
|
|
2224
|
-
this._setDraggingStyle(!1, "vertical"), this._callOnFinishChange(), window.removeEventListener("mousemove", a), window.removeEventListener("mouseup", c);
|
|
2225
|
-
};
|
|
2226
|
-
this.$input.addEventListener("input", () => {
|
|
2227
|
-
let h = parseFloat(this.$input.value);
|
|
2228
|
-
isNaN(h) || (this._stepExplicit && (h = this._snap(h)), this.setValue(this._clamp(h)));
|
|
2229
|
-
}), this.$input.addEventListener("keydown", (h) => {
|
|
2230
|
-
h.code === "Enter" && this.$input.blur(), h.code === "ArrowUp" && (h.preventDefault(), e(this._step * this._arrowKeyMultiplier(h))), h.code === "ArrowDown" && (h.preventDefault(), e(this._step * this._arrowKeyMultiplier(h) * -1));
|
|
2231
|
-
}), this.$input.addEventListener("wheel", (h) => {
|
|
2232
|
-
this._inputFocused && (h.preventDefault(), e(this._step * this._normalizeMouseWheel(h)));
|
|
2233
|
-
}, { passive: !1 }), this.$input.addEventListener("mousedown", (h) => {
|
|
2234
|
-
t = h.clientX, s = n = h.clientY, l = !0, r = this.getValue(), i = 0, window.addEventListener("mousemove", a), window.addEventListener("mouseup", c);
|
|
2235
|
-
}), this.$input.addEventListener("focus", () => {
|
|
2236
|
-
this._inputFocused = !0;
|
|
2237
|
-
}), this.$input.addEventListener("blur", () => {
|
|
2238
|
-
this._inputFocused = !1, this.updateDisplay(), this._callOnFinishChange();
|
|
2239
|
-
});
|
|
2240
|
-
}
|
|
2241
|
-
_initSlider() {
|
|
2242
|
-
this._hasSlider = !0, this.$slider = document.createElement("div"), this.$slider.classList.add("slider"), this.$fill = document.createElement("div"), this.$fill.classList.add("fill"), this.$slider.appendChild(this.$fill), this.$widget.insertBefore(this.$slider, this.$input), this.domElement.classList.add("hasSlider");
|
|
2243
|
-
const e = (u) => {
|
|
2244
|
-
const p = this.$slider.getBoundingClientRect();
|
|
2245
|
-
let f = (b = u, m = p.left, A = p.right, y = this._min, T = this._max, (b - m) / (A - m) * (T - y) + y);
|
|
2246
|
-
var b, m, A, y, T;
|
|
2247
|
-
this._snapClampSetValue(f);
|
|
2248
|
-
}, t = (u) => {
|
|
2249
|
-
e(u.clientX);
|
|
2250
|
-
}, s = () => {
|
|
2251
|
-
this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", s);
|
|
2252
|
-
};
|
|
2253
|
-
let n, r, i = !1;
|
|
2254
|
-
const l = (u) => {
|
|
2255
|
-
u.preventDefault(), this._setDraggingStyle(!0), e(u.touches[0].clientX), i = !1;
|
|
2256
|
-
}, a = (u) => {
|
|
2257
|
-
if (i) {
|
|
2258
|
-
const p = u.touches[0].clientX - n, f = u.touches[0].clientY - r;
|
|
2259
|
-
Math.abs(p) > Math.abs(f) ? l(u) : (window.removeEventListener("touchmove", a), window.removeEventListener("touchend", c));
|
|
2260
|
-
} else u.preventDefault(), e(u.touches[0].clientX);
|
|
2261
|
-
}, c = () => {
|
|
2262
|
-
this._callOnFinishChange(), this._setDraggingStyle(!1), window.removeEventListener("touchmove", a), window.removeEventListener("touchend", c);
|
|
2263
|
-
}, h = this._callOnFinishChange.bind(this);
|
|
2264
|
-
let d;
|
|
2265
|
-
this.$slider.addEventListener("mousedown", (u) => {
|
|
2266
|
-
this._setDraggingStyle(!0), e(u.clientX), window.addEventListener("mousemove", t), window.addEventListener("mouseup", s);
|
|
2267
|
-
}), this.$slider.addEventListener("touchstart", (u) => {
|
|
2268
|
-
u.touches.length > 1 || (this._hasScrollBar ? (n = u.touches[0].clientX, r = u.touches[0].clientY, i = !0) : l(u), window.addEventListener("touchmove", a, { passive: !1 }), window.addEventListener("touchend", c));
|
|
2269
|
-
}, { passive: !1 }), this.$slider.addEventListener("wheel", (u) => {
|
|
2270
|
-
if (Math.abs(u.deltaX) < Math.abs(u.deltaY) && this._hasScrollBar) return;
|
|
2271
|
-
u.preventDefault();
|
|
2272
|
-
const p = this._normalizeMouseWheel(u) * this._step;
|
|
2273
|
-
this._snapClampSetValue(this.getValue() + p), this.$input.value = this.getValue(), clearTimeout(d), d = setTimeout(h, 400);
|
|
2274
|
-
}, { passive: !1 });
|
|
2275
|
-
}
|
|
2276
|
-
_setDraggingStyle(e, t = "horizontal") {
|
|
2277
|
-
this.$slider && this.$slider.classList.toggle("active", e), document.body.classList.toggle("lil-gui-dragging", e), document.body.classList.toggle("lil-gui-" + t, e);
|
|
2278
|
-
}
|
|
2279
|
-
_getImplicitStep() {
|
|
2280
|
-
return this._hasMin && this._hasMax ? (this._max - this._min) / 1e3 : 0.1;
|
|
2281
|
-
}
|
|
2282
|
-
_onUpdateMinMax() {
|
|
2283
|
-
!this._hasSlider && this._hasMin && this._hasMax && (this._stepExplicit || this.step(this._getImplicitStep(), !1), this._initSlider(), this.updateDisplay());
|
|
2284
|
-
}
|
|
2285
|
-
_normalizeMouseWheel(e) {
|
|
2286
|
-
let { deltaX: t, deltaY: s } = e;
|
|
2287
|
-
return Math.floor(e.deltaY) !== e.deltaY && e.wheelDelta && (t = 0, s = -e.wheelDelta / 120, s *= this._stepExplicit ? 1 : 10), t + -s;
|
|
2288
|
-
}
|
|
2289
|
-
_arrowKeyMultiplier(e) {
|
|
2290
|
-
let t = this._stepExplicit ? 1 : 10;
|
|
2291
|
-
return e.shiftKey ? t *= 10 : e.altKey && (t /= 10), t;
|
|
2292
|
-
}
|
|
2293
|
-
_snap(e) {
|
|
2294
|
-
const t = Math.round(e / this._step) * this._step;
|
|
2295
|
-
return parseFloat(t.toPrecision(15));
|
|
2296
|
-
}
|
|
2297
|
-
_clamp(e) {
|
|
2298
|
-
return e < this._min && (e = this._min), e > this._max && (e = this._max), e;
|
|
2299
|
-
}
|
|
2300
|
-
_snapClampSetValue(e) {
|
|
2301
|
-
this.setValue(this._clamp(this._snap(e)));
|
|
2302
|
-
}
|
|
2303
|
-
get _hasScrollBar() {
|
|
2304
|
-
const e = this.parent.root.$children;
|
|
2305
|
-
return e.scrollHeight > e.clientHeight;
|
|
2306
|
-
}
|
|
2307
|
-
get _hasMin() {
|
|
2308
|
-
return this._min !== void 0;
|
|
2309
|
-
}
|
|
2310
|
-
get _hasMax() {
|
|
2311
|
-
return this._max !== void 0;
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
class Jn extends L {
|
|
2315
|
-
constructor(e, t, s, n) {
|
|
2316
|
-
super(e, t, s, "option"), this.$select = document.createElement("select"), this.$select.setAttribute("aria-labelledby", this.$name.id), this.$display = document.createElement("div"), this.$display.classList.add("display"), this._values = Array.isArray(n) ? n : Object.values(n), this._names = Array.isArray(n) ? n : Object.keys(n), this._names.forEach((r) => {
|
|
2317
|
-
const i = document.createElement("option");
|
|
2318
|
-
i.innerHTML = r, this.$select.appendChild(i);
|
|
2319
|
-
}), this.$select.addEventListener("change", () => {
|
|
2320
|
-
this.setValue(this._values[this.$select.selectedIndex]), this._callOnFinishChange();
|
|
2321
|
-
}), this.$select.addEventListener("focus", () => {
|
|
2322
|
-
this.$display.classList.add("focus");
|
|
2323
|
-
}), this.$select.addEventListener("blur", () => {
|
|
2324
|
-
this.$display.classList.remove("focus");
|
|
2325
|
-
}), this.$widget.appendChild(this.$select), this.$widget.appendChild(this.$display), this.$disable = this.$select, this.updateDisplay();
|
|
2326
|
-
}
|
|
2327
|
-
updateDisplay() {
|
|
2328
|
-
const e = this.getValue(), t = this._values.indexOf(e);
|
|
2329
|
-
return this.$select.selectedIndex = t, this.$display.innerHTML = t === -1 ? e : this._names[t], this;
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
class Qn extends L {
|
|
2333
|
-
constructor(e, t, s) {
|
|
2334
|
-
super(e, t, s, "string"), this.$input = document.createElement("input"), this.$input.setAttribute("type", "text"), this.$input.setAttribute("aria-labelledby", this.$name.id), this.$input.addEventListener("input", () => {
|
|
2335
|
-
this.setValue(this.$input.value);
|
|
2336
|
-
}), this.$input.addEventListener("keydown", (n) => {
|
|
2337
|
-
n.code === "Enter" && this.$input.blur();
|
|
2338
|
-
}), this.$input.addEventListener("blur", () => {
|
|
2339
|
-
this._callOnFinishChange();
|
|
2340
|
-
}), this.$widget.appendChild(this.$input), this.$disable = this.$input, this.updateDisplay();
|
|
2341
|
-
}
|
|
2342
|
-
updateDisplay() {
|
|
2343
|
-
return this.$input.value = this.getValue(), this;
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
let $e = !1;
|
|
2347
|
-
class Te {
|
|
2348
|
-
constructor({ parent: e, autoPlace: t = e === void 0, container: s, width: n, title: r = "Controls", injectStyles: i = !0, touchStyles: l = !0 } = {}) {
|
|
2349
|
-
if (this.parent = e, this.root = e ? e.root : this, this.children = [], this.controllers = [], this.folders = [], this._closed = !1, this._hidden = !1, this.domElement = document.createElement("div"), this.domElement.classList.add("lil-gui"), this.$title = document.createElement("div"), this.$title.classList.add("title"), this.$title.setAttribute("role", "button"), this.$title.setAttribute("aria-expanded", !0), this.$title.setAttribute("tabindex", 0), this.$title.addEventListener("click", () => this.openAnimated(this._closed)), this.$title.addEventListener("keydown", (a) => {
|
|
2350
|
-
a.code !== "Enter" && a.code !== "Space" || (a.preventDefault(), this.$title.click());
|
|
2351
|
-
}), this.$title.addEventListener("touchstart", () => {
|
|
2352
|
-
}, { passive: !0 }), this.$children = document.createElement("div"), this.$children.classList.add("children"), this.domElement.appendChild(this.$title), this.domElement.appendChild(this.$children), this.title(r), l && this.domElement.classList.add("allow-touch-styles"), this.parent) return this.parent.children.push(this), this.parent.folders.push(this), void this.parent.$children.appendChild(this.domElement);
|
|
2353
|
-
this.domElement.classList.add("root"), !$e && i && (function(a) {
|
|
2354
|
-
const c = document.createElement("style");
|
|
2355
|
-
c.innerHTML = a;
|
|
2356
|
-
const h = document.querySelector("head link[rel=stylesheet], head style");
|
|
2357
|
-
h ? document.head.insertBefore(c, h) : document.head.appendChild(c);
|
|
2358
|
-
}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'), $e = !0), s ? s.appendChild(this.domElement) : t && (this.domElement.classList.add("autoPlace"), document.body.appendChild(this.domElement)), n && this.domElement.style.setProperty("--width", n + "px"), this.domElement.addEventListener("keydown", (a) => a.stopPropagation()), this.domElement.addEventListener("keyup", (a) => a.stopPropagation());
|
|
2359
|
-
}
|
|
2360
|
-
add(e, t, s, n, r) {
|
|
2361
|
-
if (Object(s) === s) return new Jn(this, e, t, s);
|
|
2362
|
-
const i = e[t];
|
|
2363
|
-
switch (typeof i) {
|
|
2364
|
-
case "number":
|
|
2365
|
-
return new qn(this, e, t, s, n, r);
|
|
2366
|
-
case "boolean":
|
|
2367
|
-
return new Vn(this, e, t);
|
|
2368
|
-
case "string":
|
|
2369
|
-
return new Qn(this, e, t);
|
|
2370
|
-
case "function":
|
|
2371
|
-
return new re(this, e, t);
|
|
2372
|
-
}
|
|
2373
|
-
console.error(`gui.add failed
|
|
2374
|
-
property:`, t, `
|
|
2375
|
-
object:`, e, `
|
|
2376
|
-
value:`, i);
|
|
2377
|
-
}
|
|
2378
|
-
addColor(e, t, s = 1) {
|
|
2379
|
-
return new Yn(this, e, t, s);
|
|
2380
|
-
}
|
|
2381
|
-
addFolder(e) {
|
|
2382
|
-
return new Te({ parent: this, title: e });
|
|
2383
|
-
}
|
|
2384
|
-
load(e, t = !0) {
|
|
2385
|
-
return e.controllers && this.controllers.forEach((s) => {
|
|
2386
|
-
s instanceof re || s._name in e.controllers && s.load(e.controllers[s._name]);
|
|
2387
|
-
}), t && e.folders && this.folders.forEach((s) => {
|
|
2388
|
-
s._title in e.folders && s.load(e.folders[s._title]);
|
|
2389
|
-
}), this;
|
|
2390
|
-
}
|
|
2391
|
-
save(e = !0) {
|
|
2392
|
-
const t = { controllers: {}, folders: {} };
|
|
2393
|
-
return this.controllers.forEach((s) => {
|
|
2394
|
-
if (!(s instanceof re)) {
|
|
2395
|
-
if (s._name in t.controllers) throw new Error(`Cannot save GUI with duplicate property "${s._name}"`);
|
|
2396
|
-
t.controllers[s._name] = s.save();
|
|
2397
|
-
}
|
|
2398
|
-
}), e && this.folders.forEach((s) => {
|
|
2399
|
-
if (s._title in t.folders) throw new Error(`Cannot save GUI with duplicate folder "${s._title}"`);
|
|
2400
|
-
t.folders[s._title] = s.save();
|
|
2401
|
-
}), t;
|
|
2402
|
-
}
|
|
2403
|
-
open(e = !0) {
|
|
2404
|
-
return this._closed = !e, this.$title.setAttribute("aria-expanded", !this._closed), this.domElement.classList.toggle("closed", this._closed), this;
|
|
2405
|
-
}
|
|
2406
|
-
close() {
|
|
2407
|
-
return this.open(!1);
|
|
2408
|
-
}
|
|
2409
|
-
show(e = !0) {
|
|
2410
|
-
return this._hidden = !e, this.domElement.style.display = this._hidden ? "none" : "", this;
|
|
2411
|
-
}
|
|
2412
|
-
hide() {
|
|
2413
|
-
return this.show(!1);
|
|
2414
|
-
}
|
|
2415
|
-
openAnimated(e = !0) {
|
|
2416
|
-
return this._closed = !e, this.$title.setAttribute("aria-expanded", !this._closed), requestAnimationFrame(() => {
|
|
2417
|
-
const t = this.$children.clientHeight;
|
|
2418
|
-
this.$children.style.height = t + "px", this.domElement.classList.add("transition");
|
|
2419
|
-
const s = (r) => {
|
|
2420
|
-
r.target === this.$children && (this.$children.style.height = "", this.domElement.classList.remove("transition"), this.$children.removeEventListener("transitionend", s));
|
|
2421
|
-
};
|
|
2422
|
-
this.$children.addEventListener("transitionend", s);
|
|
2423
|
-
const n = e ? this.$children.scrollHeight : 0;
|
|
2424
|
-
this.domElement.classList.toggle("closed", !e), requestAnimationFrame(() => {
|
|
2425
|
-
this.$children.style.height = n + "px";
|
|
2426
|
-
});
|
|
2427
|
-
}), this;
|
|
2428
|
-
}
|
|
2429
|
-
title(e) {
|
|
2430
|
-
return this._title = e, this.$title.innerHTML = e, this;
|
|
2431
|
-
}
|
|
2432
|
-
reset(e = !0) {
|
|
2433
|
-
return (e ? this.controllersRecursive() : this.controllers).forEach((t) => t.reset()), this;
|
|
2434
|
-
}
|
|
2435
|
-
onChange(e) {
|
|
2436
|
-
return this._onChange = e, this;
|
|
2437
|
-
}
|
|
2438
|
-
_callOnChange(e) {
|
|
2439
|
-
this.parent && this.parent._callOnChange(e), this._onChange !== void 0 && this._onChange.call(this, { object: e.object, property: e.property, value: e.getValue(), controller: e });
|
|
2440
|
-
}
|
|
2441
|
-
onFinishChange(e) {
|
|
2442
|
-
return this._onFinishChange = e, this;
|
|
2443
|
-
}
|
|
2444
|
-
_callOnFinishChange(e) {
|
|
2445
|
-
this.parent && this.parent._callOnFinishChange(e), this._onFinishChange !== void 0 && this._onFinishChange.call(this, { object: e.object, property: e.property, value: e.getValue(), controller: e });
|
|
2446
|
-
}
|
|
2447
|
-
destroy() {
|
|
2448
|
-
this.parent && (this.parent.children.splice(this.parent.children.indexOf(this), 1), this.parent.folders.splice(this.parent.folders.indexOf(this), 1)), this.domElement.parentElement && this.domElement.parentElement.removeChild(this.domElement), Array.from(this.children).forEach((e) => e.destroy());
|
|
2449
|
-
}
|
|
2450
|
-
controllersRecursive() {
|
|
2451
|
-
let e = Array.from(this.controllers);
|
|
2452
|
-
return this.folders.forEach((t) => {
|
|
2453
|
-
e = e.concat(t.controllersRecursive());
|
|
2454
|
-
}), e;
|
|
2455
|
-
}
|
|
2456
|
-
foldersRecursive() {
|
|
2457
|
-
let e = Array.from(this.folders);
|
|
2458
|
-
return this.folders.forEach((t) => {
|
|
2459
|
-
e = e.concat(t.foldersRecursive());
|
|
2460
|
-
}), e;
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
var Zn = Object.defineProperty, es = Object.getOwnPropertyDescriptor, ts = (o, e, t, s) => {
|
|
2464
|
-
for (var n = s > 1 ? void 0 : s ? es(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
2465
|
-
(i = o[r]) && (n = (s ? i(e, t, n) : i(n)) || n);
|
|
2466
|
-
return s && n && Zn(e, t, n), n;
|
|
2212
|
+
const gs = De.resolve(me);
|
|
2213
|
+
var ns = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, rs = (c, e, t, r) => {
|
|
2214
|
+
for (var n = r > 1 ? void 0 : r ? ss(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
2215
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
2216
|
+
return r && n && ns(e, t, n), n;
|
|
2467
2217
|
};
|
|
2468
|
-
let
|
|
2218
|
+
let q = class {
|
|
2469
2219
|
constructor() {
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
g(this, "gui");
|
|
2475
|
-
g(this, "stats");
|
|
2220
|
+
T(this, "workerPool", at(void 0, !0));
|
|
2221
|
+
T(this, "canvas");
|
|
2222
|
+
T(this, "worker");
|
|
2223
|
+
T(this, "thread");
|
|
2476
2224
|
}
|
|
2477
|
-
init(
|
|
2478
|
-
this.worker =
|
|
2225
|
+
init(c) {
|
|
2226
|
+
this.worker = c.worker, this.thread = c.thread;
|
|
2479
2227
|
}
|
|
2480
2228
|
};
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
],
|
|
2484
|
-
var
|
|
2485
|
-
for (var n =
|
|
2486
|
-
(
|
|
2487
|
-
return
|
|
2488
|
-
},
|
|
2489
|
-
let
|
|
2229
|
+
q = rs([
|
|
2230
|
+
ke()
|
|
2231
|
+
], q);
|
|
2232
|
+
var is = Object.defineProperty, os = Object.getOwnPropertyDescriptor, as = (c, e, t, r) => {
|
|
2233
|
+
for (var n = r > 1 ? void 0 : r ? os(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
2234
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
2235
|
+
return r && n && is(e, t, n), n;
|
|
2236
|
+
}, cs = (c, e) => (t, r) => e(t, r, c);
|
|
2237
|
+
let ge = class extends ct {
|
|
2490
2238
|
constructor(e) {
|
|
2491
2239
|
super();
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
g(this, "lifecycle$", this.lifecycle$$.pipe());
|
|
2495
|
-
this.component = e;
|
|
2240
|
+
T(this, "canvas");
|
|
2241
|
+
this._service = e;
|
|
2496
2242
|
}
|
|
2497
2243
|
init(e) {
|
|
2498
2244
|
this.canvas = e;
|
|
2499
2245
|
for (const t of Fe) {
|
|
2500
|
-
const
|
|
2501
|
-
this[`${t}$`] =
|
|
2246
|
+
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;
|
|
2247
|
+
this[`${t}$`] = ue(
|
|
2502
2248
|
t === "resize" ? window : e,
|
|
2503
2249
|
t
|
|
2504
2250
|
).pipe(
|
|
2505
2251
|
// @ts-ignore
|
|
2506
|
-
|
|
2507
|
-
|
|
2252
|
+
Te(r.bind(this)),
|
|
2253
|
+
Pe((n) => !(t === "keydown" && !n))
|
|
2508
2254
|
), this[`${t}$`].subscribe((n) => {
|
|
2509
|
-
var
|
|
2510
|
-
(
|
|
2255
|
+
var i, s;
|
|
2256
|
+
(s = (i = this._service.thread) == null ? void 0 : i[t]) == null || s.call(i, n);
|
|
2511
2257
|
});
|
|
2512
2258
|
}
|
|
2513
2259
|
}
|
|
@@ -2536,7 +2282,7 @@ let Ae = class extends st {
|
|
|
2536
2282
|
mouseEventHandler(e) {
|
|
2537
2283
|
return {
|
|
2538
2284
|
...this.getScreenSizes(),
|
|
2539
|
-
...
|
|
2285
|
+
...Z(e, [
|
|
2540
2286
|
"ctrlKey",
|
|
2541
2287
|
"metaKey",
|
|
2542
2288
|
"shiftKey",
|
|
@@ -2550,285 +2296,190 @@ let Ae = class extends st {
|
|
|
2550
2296
|
};
|
|
2551
2297
|
}
|
|
2552
2298
|
touchEventHandler(e) {
|
|
2553
|
-
const t = [],
|
|
2299
|
+
const t = [], r = { type: e.type, touches: t };
|
|
2554
2300
|
for (let n = 0; n < e.touches.length; ++n) {
|
|
2555
|
-
const
|
|
2301
|
+
const i = e.touches[n];
|
|
2556
2302
|
t.push({
|
|
2557
|
-
pageX: (
|
|
2558
|
-
pageY: (
|
|
2303
|
+
pageX: (i == null ? void 0 : i.pageX) ?? 0,
|
|
2304
|
+
pageY: (i == null ? void 0 : i.pageY) ?? 0
|
|
2559
2305
|
});
|
|
2560
2306
|
}
|
|
2561
|
-
return { ...this.getScreenSizes(), ...
|
|
2307
|
+
return { ...this.getScreenSizes(), ...r };
|
|
2562
2308
|
}
|
|
2563
2309
|
wheelEventHandler(e) {
|
|
2564
2310
|
return e.preventDefault(), {
|
|
2565
2311
|
...this.getScreenSizes(),
|
|
2566
|
-
...
|
|
2312
|
+
...Z(e, ["deltaX", "deltaY"])
|
|
2567
2313
|
};
|
|
2568
2314
|
}
|
|
2569
2315
|
keyEventHandler(e) {
|
|
2570
|
-
if (
|
|
2316
|
+
if (lt.includes(e.code))
|
|
2571
2317
|
return e.preventDefault(), {
|
|
2572
2318
|
...this.getScreenSizes(),
|
|
2573
|
-
...
|
|
2319
|
+
...Z(e, ["ctrlKey", "metaKey", "shiftKey", "keyCode"])
|
|
2574
2320
|
};
|
|
2575
2321
|
}
|
|
2576
2322
|
};
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
],
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
*
|
|
2592
|
-
* @default undefined
|
|
2593
|
-
*/
|
|
2594
|
-
g(this, "canvas");
|
|
2595
|
-
/**
|
|
2596
|
-
* @description Set the `canvas` view in fullscreen and auto-resize it.
|
|
2597
|
-
*
|
|
2598
|
-
* @default true
|
|
2599
|
-
*/
|
|
2600
|
-
g(this, "fullScreen");
|
|
2601
|
-
/**
|
|
2602
|
-
* Default used camera.
|
|
2603
|
-
*
|
|
2604
|
-
* @see {@link DefaultCameraType}
|
|
2605
|
-
*
|
|
2606
|
-
* @default DefaultCameraType.PERSPECTIVE
|
|
2607
|
-
*/
|
|
2608
|
-
g(this, "defaultCamera");
|
|
2609
|
-
/**
|
|
2610
|
-
* @description Start timer update on launch.
|
|
2611
|
-
*
|
|
2612
|
-
* @default true
|
|
2613
|
-
*/
|
|
2614
|
-
g(this, "startTimer");
|
|
2615
|
-
/**
|
|
2616
|
-
* Enable the debug mode
|
|
2617
|
-
*
|
|
2618
|
-
* @default undefined
|
|
2619
|
-
*/
|
|
2620
|
-
g(this, "enableDebug");
|
|
2621
|
-
/**
|
|
2622
|
-
* Define the {@link THREE.AxesHelper} sizes.
|
|
2623
|
-
*
|
|
2624
|
-
* @remark __Deactivated if the value is `0` or `undefined`__
|
|
2625
|
-
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
2626
|
-
*
|
|
2627
|
-
* @default undefined
|
|
2628
|
-
*/
|
|
2629
|
-
g(this, "axesSizes");
|
|
2630
|
-
/**
|
|
2631
|
-
* Define the {@link THREE.GridHelper} sizes.
|
|
2632
|
-
*
|
|
2633
|
-
* @remark __Deactivated if the value is `0` or `undefined`__
|
|
2634
|
-
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
2635
|
-
*
|
|
2636
|
-
* @default undefined
|
|
2637
|
-
*/
|
|
2638
|
-
g(this, "gridSizes");
|
|
2639
|
-
/**
|
|
2640
|
-
* Display a mini perfective camera at the top right corner of the screen.
|
|
2641
|
-
*
|
|
2642
|
-
* @remark __This property depends on {@link RegisterPropsModel.enableDebug}__
|
|
2643
|
-
*
|
|
2644
|
-
* @default false
|
|
2645
|
-
*/
|
|
2646
|
-
g(this, "withMiniCamera");
|
|
2647
|
-
/**
|
|
2648
|
-
* @description Handler called when the app is ready.
|
|
2649
|
-
*
|
|
2650
|
-
* @default undefined
|
|
2651
|
-
*/
|
|
2652
|
-
g(this, "onReady");
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
class os {
|
|
2656
|
-
constructor() {
|
|
2657
|
-
g(this, "contextmenu$");
|
|
2658
|
-
g(this, "resize$");
|
|
2659
|
-
g(this, "mousedown$");
|
|
2660
|
-
g(this, "mousemove$");
|
|
2661
|
-
g(this, "mouseup$");
|
|
2662
|
-
g(this, "pointerdown$");
|
|
2663
|
-
g(this, "pointermove$");
|
|
2664
|
-
g(this, "pointercancel$");
|
|
2665
|
-
g(this, "pointerup$");
|
|
2666
|
-
g(this, "touchstart$");
|
|
2667
|
-
g(this, "touchmove$");
|
|
2668
|
-
g(this, "touchend$");
|
|
2669
|
-
g(this, "wheel$");
|
|
2670
|
-
g(this, "keydown$");
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
var as = Object.defineProperty, ls = Object.getOwnPropertyDescriptor, cs = (o, e, t, s) => {
|
|
2674
|
-
for (var n = s > 1 ? void 0 : s ? ls(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
2675
|
-
(i = o[r]) && (n = (s ? i(e, t, n) : i(n)) || n);
|
|
2676
|
-
return s && n && as(e, t, n), n;
|
|
2677
|
-
}, oe = (o, e) => (t, s) => e(t, s, o);
|
|
2678
|
-
let be = class extends os {
|
|
2679
|
-
constructor(o, e, t) {
|
|
2680
|
-
super(), this.component = o, this.controller = e, this.registerProps = t, this.init();
|
|
2323
|
+
ge = as([
|
|
2324
|
+
ke(),
|
|
2325
|
+
cs(0, k(q))
|
|
2326
|
+
], ge);
|
|
2327
|
+
var ls = Object.defineProperty, us = Object.getOwnPropertyDescriptor, ds = (c, e, t, r) => {
|
|
2328
|
+
for (var n = r > 1 ? void 0 : r ? us(e, t) : e, i = c.length - 1, s; i >= 0; i--)
|
|
2329
|
+
(s = c[i]) && (n = (r ? s(e, t, n) : s(n)) || n);
|
|
2330
|
+
return r && n && ls(e, t, n), n;
|
|
2331
|
+
}, $ = (c, e) => (t, r) => e(t, r, c);
|
|
2332
|
+
let Ae = class extends Jt {
|
|
2333
|
+
constructor(e, t, r, n) {
|
|
2334
|
+
super();
|
|
2335
|
+
T(this, "initialized", !1);
|
|
2336
|
+
this._container = e, this._service = t, this._controller = r, this.registerProps = n, this.registerProps.initOnConstruct && this.init();
|
|
2681
2337
|
}
|
|
2682
2338
|
async _initCanvas() {
|
|
2683
2339
|
try {
|
|
2684
|
-
if (this.
|
|
2685
|
-
const
|
|
2340
|
+
if (this.registerProps.canvas instanceof HTMLCanvasElement && (this._service.canvas = this.registerProps.canvas), typeof this.registerProps.canvas == "string") {
|
|
2341
|
+
const e = document.querySelector(
|
|
2686
2342
|
this.registerProps.canvas
|
|
2687
2343
|
);
|
|
2688
|
-
|
|
2344
|
+
e instanceof HTMLCanvasElement && (this._service.canvas = e);
|
|
2689
2345
|
}
|
|
2690
|
-
this.
|
|
2691
|
-
} catch (
|
|
2346
|
+
this._service.canvas || (this._service.canvas = document.createElement("canvas"), this._service.canvas.dataset.reactive = "true", document.body.appendChild(this._service.canvas));
|
|
2347
|
+
} catch (e) {
|
|
2692
2348
|
console.error(
|
|
2693
2349
|
`🛑 Unable to initialize the canvas:
|
|
2694
|
-
${
|
|
2350
|
+
${e instanceof Error ? e.message : "Something went wrong"}`
|
|
2695
2351
|
);
|
|
2696
2352
|
}
|
|
2697
2353
|
}
|
|
2698
2354
|
async _initComponent() {
|
|
2699
|
-
this.
|
|
2700
|
-
worker: this.
|
|
2701
|
-
thread: this.
|
|
2355
|
+
this._service.init({
|
|
2356
|
+
worker: this._service.worker,
|
|
2357
|
+
thread: this._service.thread
|
|
2702
2358
|
});
|
|
2703
2359
|
}
|
|
2704
2360
|
async _initController() {
|
|
2705
|
-
var
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
s === xe.STEP_STARTED && ((n = this.component.stats) == null || n.begin()), s === xe.STEP_ENDED && ((r = this.component.stats) == null || r.end());
|
|
2361
|
+
var e, t;
|
|
2362
|
+
if (!this._service.canvas)
|
|
2363
|
+
throw new Error("Canvas element is not initialized.");
|
|
2364
|
+
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, {
|
|
2365
|
+
...this._controller.uiEventHandler({ type: "resize" })
|
|
2711
2366
|
}));
|
|
2712
2367
|
}
|
|
2713
2368
|
async _initWorkerThread() {
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
const e =
|
|
2369
|
+
if (!this._service.canvas)
|
|
2370
|
+
throw new Error("Canvas element is not initialized.");
|
|
2371
|
+
const e = this._service.canvas.transferControlToOffscreen();
|
|
2372
|
+
e.width = this._service.canvas.clientWidth, e.height = this._service.canvas.clientHeight;
|
|
2373
|
+
const [t, r] = await this._service.workerPool.run({
|
|
2717
2374
|
payload: {
|
|
2718
2375
|
path: this.registerProps.location,
|
|
2719
2376
|
subject: {
|
|
2720
|
-
...
|
|
2377
|
+
...ut(this.registerProps, [
|
|
2721
2378
|
"canvas",
|
|
2722
2379
|
"location",
|
|
2723
2380
|
"onReady"
|
|
2724
2381
|
]),
|
|
2725
|
-
canvas:
|
|
2382
|
+
canvas: e
|
|
2726
2383
|
},
|
|
2727
|
-
transferSubject: [
|
|
2384
|
+
transferSubject: [e]
|
|
2728
2385
|
}
|
|
2729
2386
|
});
|
|
2730
|
-
if (!
|
|
2731
|
-
throw new Error("Unable to retrieve
|
|
2732
|
-
this.
|
|
2387
|
+
if (!t || r)
|
|
2388
|
+
throw new Error("Unable to retrieve the worker-thread info.");
|
|
2389
|
+
this._service.worker = t.worker, this._service.thread = t.thread;
|
|
2733
2390
|
}
|
|
2734
|
-
async
|
|
2391
|
+
async _initObservableProxyEvents() {
|
|
2735
2392
|
Fe.forEach(
|
|
2736
|
-
(
|
|
2737
|
-
var
|
|
2738
|
-
return (
|
|
2393
|
+
(e) => this[`${e}$`] = () => {
|
|
2394
|
+
var t;
|
|
2395
|
+
return (t = this._controller) == null ? void 0 : t[`${e}$`];
|
|
2739
2396
|
}
|
|
2740
2397
|
);
|
|
2741
2398
|
}
|
|
2742
2399
|
async init() {
|
|
2743
|
-
var
|
|
2744
|
-
await this._initCanvas(), await this._initWorkerThread(), await this._initComponent(), await this._initController(), await this.
|
|
2400
|
+
var e, t;
|
|
2401
|
+
await this._initCanvas(), await this._initWorkerThread(), await this._initComponent(), await this._initController(), await this._initObservableProxyEvents(), (t = (e = this.registerProps).onReady) == null || t.call(e, { module: this, container: this._container });
|
|
2745
2402
|
}
|
|
2746
|
-
async loadResources(
|
|
2747
|
-
var
|
|
2748
|
-
const
|
|
2403
|
+
async loadResources(e) {
|
|
2404
|
+
var n, i, s, a, o, l, u, d, h;
|
|
2405
|
+
const [t, r] = await this._service.workerPool.run({
|
|
2749
2406
|
payload: {
|
|
2750
2407
|
path: "../loader/loader.module-worker.ts",
|
|
2751
2408
|
subject: {
|
|
2752
|
-
resources:
|
|
2409
|
+
resources: e.resources
|
|
2753
2410
|
}
|
|
2754
2411
|
}
|
|
2755
2412
|
});
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2413
|
+
if (!t || r)
|
|
2414
|
+
throw new Error("Unable to retrieve worker thread info.");
|
|
2415
|
+
return (n = t.thread) == null || n.progress$().subscribe((f) => {
|
|
2416
|
+
var p;
|
|
2417
|
+
(p = e.onProgress) == null || p.call(e, f);
|
|
2418
|
+
}), (i = t.thread) == null || i.progressCompleted$().subscribe((f) => {
|
|
2419
|
+
var p, g;
|
|
2420
|
+
(p = e.onProgressComplete) == null || p.call(e, f), (e.disposeOnComplete || e.disposeOnComplete === void 0) && ((g = t.thread) == null || g.dispose());
|
|
2421
|
+
}), (e.immediateLoad || e.immediateLoad === void 0) && await ((s = t.thread) == null ? void 0 : s.load()), {
|
|
2422
|
+
...t,
|
|
2423
|
+
load: await ((a = t.thread) == null ? void 0 : a.load),
|
|
2424
|
+
items: await ((o = t.thread) == null ? void 0 : o.items()),
|
|
2425
|
+
loaders: await ((l = t.thread) == null ? void 0 : l.items()),
|
|
2426
|
+
toLoad: await ((u = t.thread) == null ? void 0 : u.toLoad()),
|
|
2427
|
+
loaded: await ((d = t.thread) == null ? void 0 : d.loaded()),
|
|
2428
|
+
resources: await ((h = t.thread) == null ? void 0 : h.resources())
|
|
2770
2429
|
};
|
|
2771
2430
|
}
|
|
2772
2431
|
workerPool() {
|
|
2773
|
-
return this.
|
|
2432
|
+
return this._service.workerPool;
|
|
2774
2433
|
}
|
|
2775
2434
|
canvas() {
|
|
2776
|
-
return this.
|
|
2435
|
+
return this._service.canvas;
|
|
2777
2436
|
}
|
|
2778
2437
|
worker() {
|
|
2779
|
-
return this.
|
|
2438
|
+
return this._service.worker;
|
|
2780
2439
|
}
|
|
2781
2440
|
thread() {
|
|
2782
|
-
return this.
|
|
2441
|
+
return this._service.thread;
|
|
2783
2442
|
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
dispose() {
|
|
2788
|
-
this.component.workerPool.terminateAll(), this.controller.lifecycle$$.next(Ee.DISPOSED);
|
|
2789
|
-
}
|
|
2790
|
-
lifecycle$() {
|
|
2791
|
-
return this.controller.lifecycle$;
|
|
2443
|
+
async dispose() {
|
|
2444
|
+
var e;
|
|
2445
|
+
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);
|
|
2792
2446
|
}
|
|
2793
2447
|
};
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2448
|
+
Ae = ds([
|
|
2449
|
+
Y(Q.ContainerScoped),
|
|
2450
|
+
$(0, k(He)),
|
|
2451
|
+
$(1, k(q)),
|
|
2452
|
+
$(2, k(ge)),
|
|
2453
|
+
$(3, k(Ye))
|
|
2454
|
+
], Ae);
|
|
2455
|
+
const As = (c) => {
|
|
2456
|
+
if (typeof (c == null ? void 0 : c.location) != "string" && !((c == null ? void 0 : c.location) instanceof URL))
|
|
2802
2457
|
throw new Error(
|
|
2803
2458
|
"Invalid register props detected. location path is required"
|
|
2804
2459
|
);
|
|
2805
|
-
|
|
2460
|
+
const e = De.createChildContainer();
|
|
2461
|
+
c.initOnConstruct = V(c.initOnConstruct) || !z(c.initOnConstruct) ? !0 : c.initOnConstruct, c.defaultCamera = c != null && c.defaultCamera && c.defaultCamera in we ? c.defaultCamera : we.PERSPECTIVE, c.withMiniCamera = V(c.withMiniCamera) || !z(c.withMiniCamera) ? !1 : c.withMiniCamera, c.startTimer = V(c.startTimer) || !z(c.startTimer) ? !0 : c.startTimer, c.fullScreen = V(c.fullScreen) || !z(c.fullScreen) ? !0 : c.fullScreen, c.onReady = dt(c.onReady) ? c.onReady : void 0, e.register(He, { useValue: e }), e.register(Ye, { useValue: c });
|
|
2462
|
+
const t = e.resolve(Ae);
|
|
2463
|
+
return t.initialized = !0, {
|
|
2464
|
+
container: e,
|
|
2465
|
+
module: t
|
|
2466
|
+
};
|
|
2806
2467
|
};
|
|
2807
|
-
class bs {
|
|
2808
|
-
constructor() {
|
|
2809
|
-
/**
|
|
2810
|
-
* @description Handler triggered when the app is ready.
|
|
2811
|
-
*/
|
|
2812
|
-
g(this, "onReady");
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
2468
|
export {
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2469
|
+
ys as AppModule,
|
|
2470
|
+
ws as AppProxyEventHandlersModel,
|
|
2471
|
+
He as CONTAINER_TOKEN,
|
|
2472
|
+
we as DefaultCameraType,
|
|
2473
|
+
lt as KEYBOARD_EVENT_CODES,
|
|
2474
|
+
ms as LaunchAppProps,
|
|
2822
2475
|
me as LoaderModule,
|
|
2823
2476
|
Fe as PROXY_EVENT_LISTENERS,
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
os as RegisterProxyEventHandlersModel,
|
|
2831
|
-
vs as appModule,
|
|
2477
|
+
ct as ProxyEventHandlersModel,
|
|
2478
|
+
Es as ProxyEventObservablesModel,
|
|
2479
|
+
Rs as ProxyEventSubjectsModel,
|
|
2480
|
+
Ae as RegisterModule,
|
|
2481
|
+
Ye as RegisterPropsModel,
|
|
2482
|
+
Jt as RegisterProxyEventHandlersModel,
|
|
2832
2483
|
gs as loaderModule,
|
|
2833
2484
|
As as register
|
|
2834
2485
|
};
|