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