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