@shopware-ag/dive 2.0.1-beta.8 → 2.0.1
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/README.md +7 -9
- package/build/chunks/AssetCache-BvUcYEFC.mjs +79 -0
- package/build/chunks/AssetCache-CSbNftve.cjs +1 -0
- package/build/chunks/{AssetExporter-TzKB2FHh.cjs → AssetExporter-DsbC2rqv.cjs} +1 -1
- package/build/chunks/{AssetExporter-QnOue3VT.mjs → AssetExporter-brT7ogoM.mjs} +1 -1
- package/build/chunks/{AssetLoader-C8Teswp4.mjs → AssetLoader-B07cARjB.mjs} +510 -507
- package/build/chunks/AssetLoader-CJNVpiKM.cjs +4 -0
- package/build/chunks/FileTypes-DQE3hqoS.cjs +30 -0
- package/build/chunks/{FileTypes-CXnW0NAe.mjs → FileTypes-rkWpMg2n.mjs} +155 -205
- package/build/chunks/OrbitController-BQ6SV1O_.mjs +1159 -0
- package/build/chunks/OrbitController-CpFQ3A1H.cjs +1 -0
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
- package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +34 -0
- package/build/chunks/{SelectTool-DFpr9XHT.mjs → SelectTool-7pU-VXgr.mjs} +4 -4
- package/build/chunks/SelectTool-BSlKpYbt.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
- package/build/chunks/isFileTypeSupported-BSpswPHU.mjs +12 -0
- package/build/chunks/isFileTypeSupported-CrEqYiv9.cjs +1 -0
- package/build/chunks/network-error-BONfHWQq.mjs +14 -0
- package/build/chunks/network-error-CdDXil5g.cjs +1 -0
- package/build/chunks/package-CX-oVoMh.mjs +39 -0
- package/build/chunks/package-CubHy4zo.cjs +1 -0
- package/build/chunks/{parse-error-BFRJyIxM.mjs → parse-error-DfOPyLWM.mjs} +3 -3
- package/build/chunks/parse-error-Dy_EE4rL.cjs +1 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +295 -222
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +59 -54
- package/build/plugins/assetcache/index.cjs +1 -0
- package/build/plugins/assetcache/index.d.ts +2 -0
- package/build/plugins/assetcache/index.mjs +5 -0
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/mediacreator/index.cjs +1 -1
- package/build/plugins/mediacreator/index.mjs +13 -13
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -0
- package/build/plugins/orientationdisplay/index.d.ts +2 -0
- package/build/plugins/orientationdisplay/index.mjs +5 -0
- package/build/plugins/state/index.cjs +6 -6
- package/build/plugins/state/index.mjs +728 -728
- package/build/plugins/systeminfo/index.mjs +1 -1
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +12 -12
- package/build/src/components/boundingbox/BoundingBox.d.ts +136 -0
- package/build/src/components/light/AmbientLight.d.ts +3 -1
- package/build/src/components/light/SceneLight.d.ts +3 -1
- package/build/src/core/Dive.d.ts +1 -1
- package/build/src/error/file-content/file-content-error.d.ts +4 -0
- package/build/src/error/index.d.ts +4 -0
- package/build/src/error/network/network-error.d.ts +1 -1
- package/build/src/error/parse/parse-error.d.ts +2 -1
- package/build/src/events/dispatcher/EventDispatcher.d.ts +6 -0
- package/build/src/events/index.d.ts +1 -1
- package/build/src/helpers/deepClone/deepClone.d.ts +34 -0
- package/build/src/helpers/index.d.ts +5 -4
- package/build/src/index.d.ts +1 -3
- package/build/src/plugins/ar/src/error/ar-errors.d.ts +7 -1
- package/build/src/plugins/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +2 -2
- package/build/src/plugins/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +2 -2
- package/build/src/plugins/assetcache/index.d.ts +1 -0
- package/build/src/plugins/assetcache/src/cache/AssetCache.d.ts +12 -0
- package/build/src/plugins/assetcache/src/chunk/Chunk.d.ts +16 -0
- package/build/src/plugins/assetcache/src/index.d.ts +2 -0
- package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +7 -1
- package/build/src/plugins/mediacreator/index.d.ts +1 -0
- package/build/src/plugins/mediacreator/src/MediaCreator.d.ts +2 -2
- package/build/src/plugins/mediacreator/types/MediaGenerationById.d.ts +5 -0
- package/build/src/plugins/mediacreator/types/MediaGenerationByPosition.d.ts +7 -0
- package/build/src/plugins/mediacreator/types/MediaGenerationResolution.d.ts +4 -0
- package/build/src/plugins/mediacreator/types/index.d.ts +3 -0
- package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +17 -2
- package/build/src/plugins/orientationdisplay/index.d.ts +2 -0
- package/build/src/plugins/{axiscamera/src/AxisCamera.d.ts → orientationdisplay/src/OrientationDisplay.d.ts} +5 -5
- package/build/src/plugins/orientationdisplay/src/axes/Axes.d.ts +6 -0
- package/build/src/plugins/state/src/actions/action.d.ts +4 -4
- package/build/src/plugins/state/src/actions/media/generatemedia.d.ts +2 -18
- package/build/src/plugins/state/src/actions/toolbox/setgizmovisible.d.ts +2 -2
- package/build/src/plugins/state/types/index.d.ts +2 -0
- package/build/src/plugins/systeminfo/src/SystemInfo.d.ts +1 -1
- package/build/src/plugins/toolbox/index.d.ts +1 -0
- package/build/src/plugins/toolbox/src/Toolbox.d.ts +2 -2
- package/build/src/plugins/toolbox/src/transform/TransformTool.d.ts +1 -1
- package/build/src/plugins/toolbox/types/ToolType.d.ts +1 -0
- package/build/src/plugins/toolbox/types/index.d.ts +1 -0
- package/package.json +12 -9
- package/build/chunks/AssetLoader-BfPa_oNd.cjs +0 -4
- package/build/chunks/FileTypes-B2JRjVgw.cjs +0 -30
- package/build/chunks/OrbitController-D-WNei2f.mjs +0 -940
- package/build/chunks/OrbitController-rMX8EHvJ.cjs +0 -1
- package/build/chunks/PerspectiveCamera-CONx93im.cjs +0 -1
- package/build/chunks/PerspectiveCamera-DUiWJJIj.mjs +0 -38
- package/build/chunks/SelectTool-DVqL2ebn.cjs +0 -1
- package/build/chunks/network-error-CHvryg-4.mjs +0 -18
- package/build/chunks/network-error-D_pq8VU6.cjs +0 -1
- package/build/chunks/package-BBfJ2Cc5.cjs +0 -1
- package/build/chunks/package-CHFUaMpF.mjs +0 -39
- package/build/chunks/parse-error-Bd09D_1L.cjs +0 -1
- package/build/plugins/axiscamera/index.cjs +0 -1
- package/build/plugins/axiscamera/index.d.ts +0 -2
- package/build/plugins/axiscamera/index.mjs +0 -4
- package/build/src/events/EventExecutor.d.ts +0 -5
- package/build/src/plugins/axiscamera/index.d.ts +0 -1
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
var ve = Object.defineProperty;
|
|
2
2
|
var Be = (d, e, t) => e in d ? ve(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
3
3
|
var v = (d, e, t) => Be(d, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as q, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as
|
|
5
|
-
import { u as
|
|
6
|
-
import { S as _t } from "./FileTypes-
|
|
7
|
-
import {
|
|
8
|
-
import { F as
|
|
9
|
-
|
|
4
|
+
import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as q, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as xt, NoColorSpace as H } from "three";
|
|
5
|
+
import { u as Rt, a as Ae } from "./fflate.module-xyO_T3Zm.mjs";
|
|
6
|
+
import { S as _t } from "./FileTypes-rkWpMg2n.mjs";
|
|
7
|
+
import { g as wt, i as Et } from "./isFileTypeSupported-BSpswPHU.mjs";
|
|
8
|
+
import { F as Te, P as ye } from "./parse-error-DfOPyLWM.mjs";
|
|
9
|
+
import { A as xe } from "./AssetCache-BvUcYEFC.mjs";
|
|
10
|
+
function Re(d, e) {
|
|
10
11
|
if (e === je)
|
|
11
12
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
|
12
13
|
if (e === re || e === be) {
|
|
13
14
|
let t = d.getIndex();
|
|
14
15
|
if (t === null) {
|
|
15
|
-
const
|
|
16
|
+
const n = [], a = d.getAttribute("position");
|
|
16
17
|
if (a !== void 0) {
|
|
17
18
|
for (let i = 0; i < a.count; i++)
|
|
18
|
-
|
|
19
|
-
d.setIndex(
|
|
19
|
+
n.push(i);
|
|
20
|
+
d.setIndex(n), t = d.getIndex();
|
|
20
21
|
} else
|
|
21
22
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
|
|
22
23
|
}
|
|
23
|
-
const o = t.count - 2,
|
|
24
|
+
const o = t.count - 2, s = [];
|
|
24
25
|
if (e === re)
|
|
25
|
-
for (let
|
|
26
|
-
|
|
26
|
+
for (let n = 1; n <= o; n++)
|
|
27
|
+
s.push(t.getX(0)), s.push(t.getX(n)), s.push(t.getX(n + 1));
|
|
27
28
|
else
|
|
28
|
-
for (let
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
for (let n = 0; n < o; n++)
|
|
30
|
+
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)));
|
|
31
|
+
s.length / 3 !== o && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
31
32
|
const r = d.clone();
|
|
32
|
-
return r.setIndex(
|
|
33
|
+
return r.setIndex(s), r.clearGroups(), r;
|
|
33
34
|
} else
|
|
34
35
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), d;
|
|
35
36
|
}
|
|
@@ -69,23 +70,23 @@ class St extends ae {
|
|
|
69
70
|
return new Kt(t);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
load(e, t, o,
|
|
73
|
+
load(e, t, o, s) {
|
|
73
74
|
const r = this;
|
|
74
|
-
let
|
|
75
|
+
let n;
|
|
75
76
|
if (this.resourcePath !== "")
|
|
76
|
-
|
|
77
|
+
n = this.resourcePath;
|
|
77
78
|
else if (this.path !== "") {
|
|
78
79
|
const c = X.extractUrlBase(e);
|
|
79
|
-
|
|
80
|
+
n = X.resolveURL(c, this.path);
|
|
80
81
|
} else
|
|
81
|
-
|
|
82
|
+
n = X.extractUrlBase(e);
|
|
82
83
|
this.manager.itemStart(e);
|
|
83
84
|
const a = function(c) {
|
|
84
|
-
|
|
85
|
+
s ? s(c) : console.error(c), r.manager.itemError(e), r.manager.itemEnd(e);
|
|
85
86
|
}, i = new K(this.manager);
|
|
86
87
|
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, function(c) {
|
|
87
88
|
try {
|
|
88
|
-
r.parse(c,
|
|
89
|
+
r.parse(c, n, function(u) {
|
|
89
90
|
t(u), r.manager.itemEnd(e);
|
|
90
91
|
}, a);
|
|
91
92
|
} catch (u) {
|
|
@@ -113,26 +114,26 @@ class St extends ae {
|
|
|
113
114
|
unregister(e) {
|
|
114
115
|
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
115
116
|
}
|
|
116
|
-
parse(e, t, o,
|
|
117
|
+
parse(e, t, o, s) {
|
|
117
118
|
let r;
|
|
118
|
-
const
|
|
119
|
+
const n = {}, a = {}, i = new TextDecoder();
|
|
119
120
|
if (typeof e == "string")
|
|
120
121
|
r = JSON.parse(e);
|
|
121
122
|
else if (e instanceof ArrayBuffer)
|
|
122
123
|
if (i.decode(new Uint8Array(e, 0, 4)) === Fe) {
|
|
123
124
|
try {
|
|
124
|
-
|
|
125
|
+
n[b.KHR_BINARY_GLTF] = new Vt(e);
|
|
125
126
|
} catch (l) {
|
|
126
|
-
|
|
127
|
+
s && s(l);
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
|
-
r = JSON.parse(
|
|
130
|
+
r = JSON.parse(n[b.KHR_BINARY_GLTF].content);
|
|
130
131
|
} else
|
|
131
132
|
r = JSON.parse(i.decode(e));
|
|
132
133
|
else
|
|
133
134
|
r = e;
|
|
134
135
|
if (r.asset === void 0 || r.asset.version[0] < 2) {
|
|
135
|
-
|
|
136
|
+
s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
139
|
const c = new sn(r, {
|
|
@@ -146,34 +147,34 @@ class St extends ae {
|
|
|
146
147
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
147
148
|
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
148
149
|
const l = this.pluginCallbacks[u](c);
|
|
149
|
-
l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l,
|
|
150
|
+
l.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[l.name] = l, n[l.name] = !0;
|
|
150
151
|
}
|
|
151
152
|
if (r.extensionsUsed)
|
|
152
153
|
for (let u = 0; u < r.extensionsUsed.length; ++u) {
|
|
153
154
|
const l = r.extensionsUsed[u], f = r.extensionsRequired || [];
|
|
154
155
|
switch (l) {
|
|
155
156
|
case b.KHR_MATERIALS_UNLIT:
|
|
156
|
-
|
|
157
|
+
n[l] = new Mt();
|
|
157
158
|
break;
|
|
158
159
|
case b.KHR_DRACO_MESH_COMPRESSION:
|
|
159
|
-
|
|
160
|
+
n[l] = new Wt(r, this.dracoLoader);
|
|
160
161
|
break;
|
|
161
162
|
case b.KHR_TEXTURE_TRANSFORM:
|
|
162
|
-
|
|
163
|
+
n[l] = new Xt();
|
|
163
164
|
break;
|
|
164
165
|
case b.KHR_MESH_QUANTIZATION:
|
|
165
|
-
|
|
166
|
+
n[l] = new zt();
|
|
166
167
|
break;
|
|
167
168
|
default:
|
|
168
169
|
f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
|
-
c.setExtensions(
|
|
172
|
+
c.setExtensions(n), c.setPlugins(a), c.parse(o, s);
|
|
172
173
|
}
|
|
173
174
|
parseAsync(e, t) {
|
|
174
175
|
const o = this;
|
|
175
|
-
return new Promise(function(
|
|
176
|
-
o.parse(e, t,
|
|
176
|
+
return new Promise(function(s, r) {
|
|
177
|
+
o.parse(e, t, s, r);
|
|
177
178
|
});
|
|
178
179
|
}
|
|
179
180
|
}
|
|
@@ -223,15 +224,15 @@ class Lt {
|
|
|
223
224
|
}
|
|
224
225
|
_markDefs() {
|
|
225
226
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
226
|
-
for (let o = 0,
|
|
227
|
+
for (let o = 0, s = t.length; o < s; o++) {
|
|
227
228
|
const r = t[o];
|
|
228
229
|
r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, r.extensions[this.name].light);
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
_loadLight(e) {
|
|
232
233
|
const t = this.parser, o = "light:" + e;
|
|
233
|
-
let
|
|
234
|
-
if (
|
|
234
|
+
let s = t.cache.get(o);
|
|
235
|
+
if (s) return s;
|
|
235
236
|
const r = t.json, i = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
|
|
236
237
|
let c;
|
|
237
238
|
const u = new U(16777215);
|
|
@@ -250,7 +251,7 @@ class Lt {
|
|
|
250
251
|
default:
|
|
251
252
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + i.type);
|
|
252
253
|
}
|
|
253
|
-
return c.position.set(0, 0, 0), c.decay = 2, F(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e),
|
|
254
|
+
return c.position.set(0, 0, 0), c.decay = 2, F(c, i), i.intensity !== void 0 && (c.intensity = i.intensity), c.name = t.createUniqueName(i.name || "light_" + e), s = Promise.resolve(c), t.cache.add(o, s), s;
|
|
254
255
|
}
|
|
255
256
|
getDependency(e, t) {
|
|
256
257
|
if (e === "light")
|
|
@@ -271,17 +272,17 @@ class Mt {
|
|
|
271
272
|
return W;
|
|
272
273
|
}
|
|
273
274
|
extendParams(e, t, o) {
|
|
274
|
-
const
|
|
275
|
+
const s = [];
|
|
275
276
|
e.color = new U(1, 1, 1), e.opacity = 1;
|
|
276
277
|
const r = t.pbrMetallicRoughness;
|
|
277
278
|
if (r) {
|
|
278
279
|
if (Array.isArray(r.baseColorFactor)) {
|
|
279
|
-
const
|
|
280
|
-
e.color.setRGB(
|
|
280
|
+
const n = r.baseColorFactor;
|
|
281
|
+
e.color.setRGB(n[0], n[1], n[2], D), e.opacity = n[3];
|
|
281
282
|
}
|
|
282
|
-
r.baseColorTexture !== void 0 &&
|
|
283
|
+
r.baseColorTexture !== void 0 && s.push(o.assignTexture(e, "map", r.baseColorTexture, N));
|
|
283
284
|
}
|
|
284
|
-
return Promise.all(
|
|
285
|
+
return Promise.all(s);
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
class It {
|
|
@@ -289,10 +290,10 @@ class It {
|
|
|
289
290
|
this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
290
291
|
}
|
|
291
292
|
extendMaterialParams(e, t) {
|
|
292
|
-
const
|
|
293
|
-
if (!
|
|
293
|
+
const s = this.parser.json.materials[e];
|
|
294
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
294
295
|
return Promise.resolve();
|
|
295
|
-
const r =
|
|
296
|
+
const r = s.extensions[this.name].emissiveStrength;
|
|
296
297
|
return r !== void 0 && (t.emissiveIntensity = r), Promise.resolve();
|
|
297
298
|
}
|
|
298
299
|
}
|
|
@@ -305,12 +306,12 @@ class Ct {
|
|
|
305
306
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
306
307
|
}
|
|
307
308
|
extendMaterialParams(e, t) {
|
|
308
|
-
const o = this.parser,
|
|
309
|
-
if (!
|
|
309
|
+
const o = this.parser, s = o.json.materials[e];
|
|
310
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
310
311
|
return Promise.resolve();
|
|
311
|
-
const r = [],
|
|
312
|
-
if (
|
|
313
|
-
const a =
|
|
312
|
+
const r = [], n = s.extensions[this.name];
|
|
313
|
+
if (n.clearcoatFactor !== void 0 && (t.clearcoat = n.clearcoatFactor), n.clearcoatTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatMap", n.clearcoatTexture)), n.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = n.clearcoatRoughnessFactor), n.clearcoatRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "clearcoatRoughnessMap", n.clearcoatRoughnessTexture)), n.clearcoatNormalTexture !== void 0 && (r.push(o.assignTexture(t, "clearcoatNormalMap", n.clearcoatNormalTexture)), n.clearcoatNormalTexture.scale !== void 0)) {
|
|
314
|
+
const a = n.clearcoatNormalTexture.scale;
|
|
314
315
|
t.clearcoatNormalScale = new q(a, a);
|
|
315
316
|
}
|
|
316
317
|
return Promise.all(r);
|
|
@@ -325,11 +326,11 @@ class Nt {
|
|
|
325
326
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
326
327
|
}
|
|
327
328
|
extendMaterialParams(e, t) {
|
|
328
|
-
const o = this.parser,
|
|
329
|
-
if (!
|
|
329
|
+
const o = this.parser, s = o.json.materials[e];
|
|
330
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
330
331
|
return Promise.resolve();
|
|
331
|
-
const r = [],
|
|
332
|
-
return
|
|
332
|
+
const r = [], n = s.extensions[this.name];
|
|
333
|
+
return n.iridescenceFactor !== void 0 && (t.iridescence = n.iridescenceFactor), n.iridescenceTexture !== void 0 && r.push(o.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 && r.push(o.assignTexture(t, "iridescenceThicknessMap", n.iridescenceThicknessTexture)), Promise.all(r);
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
class Dt {
|
|
@@ -341,17 +342,17 @@ class Dt {
|
|
|
341
342
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
342
343
|
}
|
|
343
344
|
extendMaterialParams(e, t) {
|
|
344
|
-
const o = this.parser,
|
|
345
|
-
if (!
|
|
345
|
+
const o = this.parser, s = o.json.materials[e];
|
|
346
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
346
347
|
return Promise.resolve();
|
|
347
348
|
const r = [];
|
|
348
349
|
t.sheenColor = new U(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
351
|
-
const a =
|
|
350
|
+
const n = s.extensions[this.name];
|
|
351
|
+
if (n.sheenColorFactor !== void 0) {
|
|
352
|
+
const a = n.sheenColorFactor;
|
|
352
353
|
t.sheenColor.setRGB(a[0], a[1], a[2], D);
|
|
353
354
|
}
|
|
354
|
-
return
|
|
355
|
+
return n.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = n.sheenRoughnessFactor), n.sheenColorTexture !== void 0 && r.push(o.assignTexture(t, "sheenColorMap", n.sheenColorTexture, N)), n.sheenRoughnessTexture !== void 0 && r.push(o.assignTexture(t, "sheenRoughnessMap", n.sheenRoughnessTexture)), Promise.all(r);
|
|
355
356
|
}
|
|
356
357
|
}
|
|
357
358
|
class Ot {
|
|
@@ -363,11 +364,11 @@ class Ot {
|
|
|
363
364
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
364
365
|
}
|
|
365
366
|
extendMaterialParams(e, t) {
|
|
366
|
-
const o = this.parser,
|
|
367
|
-
if (!
|
|
367
|
+
const o = this.parser, s = o.json.materials[e];
|
|
368
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
368
369
|
return Promise.resolve();
|
|
369
|
-
const r = [],
|
|
370
|
-
return
|
|
370
|
+
const r = [], n = s.extensions[this.name];
|
|
371
|
+
return n.transmissionFactor !== void 0 && (t.transmission = n.transmissionFactor), n.transmissionTexture !== void 0 && r.push(o.assignTexture(t, "transmissionMap", n.transmissionTexture)), Promise.all(r);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
374
|
class Pt {
|
|
@@ -379,12 +380,12 @@ class Pt {
|
|
|
379
380
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
380
381
|
}
|
|
381
382
|
extendMaterialParams(e, t) {
|
|
382
|
-
const o = this.parser,
|
|
383
|
-
if (!
|
|
383
|
+
const o = this.parser, s = o.json.materials[e];
|
|
384
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
384
385
|
return Promise.resolve();
|
|
385
|
-
const r = [],
|
|
386
|
-
t.thickness =
|
|
387
|
-
const a =
|
|
386
|
+
const r = [], n = s.extensions[this.name];
|
|
387
|
+
t.thickness = n.thicknessFactor !== void 0 ? n.thicknessFactor : 0, n.thicknessTexture !== void 0 && r.push(o.assignTexture(t, "thicknessMap", n.thicknessTexture)), t.attenuationDistance = n.attenuationDistance || 1 / 0;
|
|
388
|
+
const a = n.attenuationColor || [1, 1, 1];
|
|
388
389
|
return t.attenuationColor = new U().setRGB(a[0], a[1], a[2], D), Promise.all(r);
|
|
389
390
|
}
|
|
390
391
|
}
|
|
@@ -397,10 +398,10 @@ class kt {
|
|
|
397
398
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
398
399
|
}
|
|
399
400
|
extendMaterialParams(e, t) {
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
401
|
+
const s = this.parser.json.materials[e];
|
|
402
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
402
403
|
return Promise.resolve();
|
|
403
|
-
const r =
|
|
404
|
+
const r = s.extensions[this.name];
|
|
404
405
|
return t.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
|
|
405
406
|
}
|
|
406
407
|
}
|
|
@@ -413,13 +414,13 @@ class Ft {
|
|
|
413
414
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
414
415
|
}
|
|
415
416
|
extendMaterialParams(e, t) {
|
|
416
|
-
const o = this.parser,
|
|
417
|
-
if (!
|
|
417
|
+
const o = this.parser, s = o.json.materials[e];
|
|
418
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
418
419
|
return Promise.resolve();
|
|
419
|
-
const r = [],
|
|
420
|
-
t.specularIntensity =
|
|
421
|
-
const a =
|
|
422
|
-
return t.specularColor = new U().setRGB(a[0], a[1], a[2], D),
|
|
420
|
+
const r = [], n = s.extensions[this.name];
|
|
421
|
+
t.specularIntensity = n.specularFactor !== void 0 ? n.specularFactor : 1, n.specularTexture !== void 0 && r.push(o.assignTexture(t, "specularIntensityMap", n.specularTexture));
|
|
422
|
+
const a = n.specularColorFactor || [1, 1, 1];
|
|
423
|
+
return t.specularColor = new U().setRGB(a[0], a[1], a[2], D), n.specularColorTexture !== void 0 && r.push(o.assignTexture(t, "specularColorMap", n.specularColorTexture, N)), Promise.all(r);
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
class Ut {
|
|
@@ -431,11 +432,11 @@ class Ut {
|
|
|
431
432
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
432
433
|
}
|
|
433
434
|
extendMaterialParams(e, t) {
|
|
434
|
-
const o = this.parser,
|
|
435
|
-
if (!
|
|
435
|
+
const o = this.parser, s = o.json.materials[e];
|
|
436
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
436
437
|
return Promise.resolve();
|
|
437
|
-
const r = [],
|
|
438
|
-
return t.bumpScale =
|
|
438
|
+
const r = [], n = s.extensions[this.name];
|
|
439
|
+
return t.bumpScale = n.bumpFactor !== void 0 ? n.bumpFactor : 1, n.bumpTexture !== void 0 && r.push(o.assignTexture(t, "bumpMap", n.bumpTexture)), Promise.all(r);
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
442
|
class Ht {
|
|
@@ -447,11 +448,11 @@ class Ht {
|
|
|
447
448
|
return !o.extensions || !o.extensions[this.name] ? null : O;
|
|
448
449
|
}
|
|
449
450
|
extendMaterialParams(e, t) {
|
|
450
|
-
const o = this.parser,
|
|
451
|
-
if (!
|
|
451
|
+
const o = this.parser, s = o.json.materials[e];
|
|
452
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
452
453
|
return Promise.resolve();
|
|
453
|
-
const r = [],
|
|
454
|
-
return
|
|
454
|
+
const r = [], n = s.extensions[this.name];
|
|
455
|
+
return n.anisotropyStrength !== void 0 && (t.anisotropy = n.anisotropyStrength), n.anisotropyRotation !== void 0 && (t.anisotropyRotation = n.anisotropyRotation), n.anisotropyTexture !== void 0 && r.push(o.assignTexture(t, "anisotropyMap", n.anisotropyTexture)), Promise.all(r);
|
|
455
456
|
}
|
|
456
457
|
}
|
|
457
458
|
class Gt {
|
|
@@ -459,16 +460,16 @@ class Gt {
|
|
|
459
460
|
this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
|
|
460
461
|
}
|
|
461
462
|
loadTexture(e) {
|
|
462
|
-
const t = this.parser, o = t.json,
|
|
463
|
-
if (!
|
|
463
|
+
const t = this.parser, o = t.json, s = o.textures[e];
|
|
464
|
+
if (!s.extensions || !s.extensions[this.name])
|
|
464
465
|
return null;
|
|
465
|
-
const r =
|
|
466
|
-
if (!
|
|
466
|
+
const r = s.extensions[this.name], n = t.options.ktx2Loader;
|
|
467
|
+
if (!n) {
|
|
467
468
|
if (o.extensionsRequired && o.extensionsRequired.indexOf(this.name) >= 0)
|
|
468
469
|
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
469
470
|
return null;
|
|
470
471
|
}
|
|
471
|
-
return t.loadTextureImage(e, r.source,
|
|
472
|
+
return t.loadTextureImage(e, r.source, n);
|
|
472
473
|
}
|
|
473
474
|
}
|
|
474
475
|
class vt {
|
|
@@ -476,18 +477,18 @@ class vt {
|
|
|
476
477
|
this.parser = e, this.name = b.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
477
478
|
}
|
|
478
479
|
loadTexture(e) {
|
|
479
|
-
const t = this.name, o = this.parser,
|
|
480
|
+
const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
|
|
480
481
|
if (!r.extensions || !r.extensions[t])
|
|
481
482
|
return null;
|
|
482
|
-
const
|
|
483
|
+
const n = r.extensions[t], a = s.images[n.source];
|
|
483
484
|
let i = o.textureLoader;
|
|
484
485
|
if (a.uri) {
|
|
485
486
|
const c = o.options.manager.getHandler(a.uri);
|
|
486
487
|
c !== null && (i = c);
|
|
487
488
|
}
|
|
488
489
|
return this.detectSupport().then(function(c) {
|
|
489
|
-
if (c) return o.loadTextureImage(e,
|
|
490
|
-
if (
|
|
490
|
+
if (c) return o.loadTextureImage(e, n.source, i);
|
|
491
|
+
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
491
492
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
492
493
|
return o.loadTexture(e);
|
|
493
494
|
});
|
|
@@ -506,18 +507,18 @@ class Bt {
|
|
|
506
507
|
this.parser = e, this.name = b.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
507
508
|
}
|
|
508
509
|
loadTexture(e) {
|
|
509
|
-
const t = this.name, o = this.parser,
|
|
510
|
+
const t = this.name, o = this.parser, s = o.json, r = s.textures[e];
|
|
510
511
|
if (!r.extensions || !r.extensions[t])
|
|
511
512
|
return null;
|
|
512
|
-
const
|
|
513
|
+
const n = r.extensions[t], a = s.images[n.source];
|
|
513
514
|
let i = o.textureLoader;
|
|
514
515
|
if (a.uri) {
|
|
515
516
|
const c = o.options.manager.getHandler(a.uri);
|
|
516
517
|
c !== null && (i = c);
|
|
517
518
|
}
|
|
518
519
|
return this.detectSupport().then(function(c) {
|
|
519
|
-
if (c) return o.loadTextureImage(e,
|
|
520
|
-
if (
|
|
520
|
+
if (c) return o.loadTextureImage(e, n.source, i);
|
|
521
|
+
if (s.extensionsRequired && s.extensionsRequired.indexOf(t) >= 0)
|
|
521
522
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
522
523
|
return o.loadTexture(e);
|
|
523
524
|
});
|
|
@@ -538,19 +539,19 @@ class jt {
|
|
|
538
539
|
loadBufferView(e) {
|
|
539
540
|
const t = this.parser.json, o = t.bufferViews[e];
|
|
540
541
|
if (o.extensions && o.extensions[this.name]) {
|
|
541
|
-
const
|
|
542
|
-
if (!
|
|
542
|
+
const s = o.extensions[this.name], r = this.parser.getDependency("buffer", s.buffer), n = this.parser.options.meshoptDecoder;
|
|
543
|
+
if (!n || !n.supported) {
|
|
543
544
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
|
|
544
545
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
545
546
|
return null;
|
|
546
547
|
}
|
|
547
548
|
return r.then(function(a) {
|
|
548
|
-
const i =
|
|
549
|
-
return
|
|
549
|
+
const i = s.byteOffset || 0, c = s.byteLength || 0, u = s.count, l = s.byteStride, f = new Uint8Array(a, i, c);
|
|
550
|
+
return n.decodeGltfBufferAsync ? n.decodeGltfBufferAsync(u, l, f, s.mode, s.filter).then(function(m) {
|
|
550
551
|
return m.buffer;
|
|
551
|
-
}) :
|
|
552
|
+
}) : n.ready.then(function() {
|
|
552
553
|
const m = new ArrayBuffer(u * l);
|
|
553
|
-
return
|
|
554
|
+
return n.decodeGltfBuffer(new Uint8Array(m), u, l, f, s.mode, s.filter), m;
|
|
554
555
|
});
|
|
555
556
|
});
|
|
556
557
|
} else
|
|
@@ -565,19 +566,19 @@ class Kt {
|
|
|
565
566
|
const t = this.parser.json, o = t.nodes[e];
|
|
566
567
|
if (!o.extensions || !o.extensions[this.name] || o.mesh === void 0)
|
|
567
568
|
return null;
|
|
568
|
-
const
|
|
569
|
-
for (const c of
|
|
569
|
+
const s = t.meshes[o.mesh];
|
|
570
|
+
for (const c of s.primitives)
|
|
570
571
|
if (c.mode !== C.TRIANGLES && c.mode !== C.TRIANGLE_STRIP && c.mode !== C.TRIANGLE_FAN && c.mode !== void 0)
|
|
571
572
|
return null;
|
|
572
|
-
const
|
|
573
|
-
for (const c in
|
|
574
|
-
a.push(this.parser.getDependency("accessor",
|
|
573
|
+
const n = o.extensions[this.name].attributes, a = [], i = {};
|
|
574
|
+
for (const c in n)
|
|
575
|
+
a.push(this.parser.getDependency("accessor", n[c]).then((u) => (i[c] = u, i[c])));
|
|
575
576
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
576
577
|
const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, m = [];
|
|
577
578
|
for (const T of l) {
|
|
578
|
-
const
|
|
579
|
+
const R = new Y(), y = new B(), x = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
|
|
579
580
|
for (let _ = 0; _ < f; _++)
|
|
580
|
-
i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION &&
|
|
581
|
+
i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION && x.fromBufferAttribute(i.ROTATION, _), i.SCALE && E.fromBufferAttribute(i.SCALE, _), S.setMatrixAt(_, R.compose(y, x, E));
|
|
581
582
|
for (const _ in i)
|
|
582
583
|
if (_ === "_COLOR_0") {
|
|
583
584
|
const M = i[_];
|
|
@@ -602,20 +603,20 @@ class Vt {
|
|
|
602
603
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
603
604
|
if (this.header.version < 2)
|
|
604
605
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
605
|
-
const
|
|
606
|
-
let
|
|
607
|
-
for (;
|
|
608
|
-
const a = r.getUint32(
|
|
609
|
-
|
|
610
|
-
const i = r.getUint32(
|
|
611
|
-
if (
|
|
612
|
-
const c = new Uint8Array(e, V +
|
|
606
|
+
const s = this.header.length - V, r = new DataView(e, V);
|
|
607
|
+
let n = 0;
|
|
608
|
+
for (; n < s; ) {
|
|
609
|
+
const a = r.getUint32(n, !0);
|
|
610
|
+
n += 4;
|
|
611
|
+
const i = r.getUint32(n, !0);
|
|
612
|
+
if (n += 4, i === _e.JSON) {
|
|
613
|
+
const c = new Uint8Array(e, V + n, a);
|
|
613
614
|
this.content = o.decode(c);
|
|
614
615
|
} else if (i === _e.BIN) {
|
|
615
|
-
const c = V +
|
|
616
|
+
const c = V + n;
|
|
616
617
|
this.body = e.slice(c, c + a);
|
|
617
618
|
}
|
|
618
|
-
|
|
619
|
+
n += a;
|
|
619
620
|
}
|
|
620
621
|
if (this.content === null)
|
|
621
622
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
@@ -628,24 +629,24 @@ class Wt {
|
|
|
628
629
|
this.name = b.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
629
630
|
}
|
|
630
631
|
decodePrimitive(e, t) {
|
|
631
|
-
const o = this.json,
|
|
632
|
-
for (const u in
|
|
632
|
+
const o = this.json, s = this.dracoLoader, r = e.extensions[this.name].bufferView, n = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
|
|
633
|
+
for (const u in n) {
|
|
633
634
|
const l = oe[u] || u.toLowerCase();
|
|
634
|
-
a[l] =
|
|
635
|
+
a[l] = n[u];
|
|
635
636
|
}
|
|
636
637
|
for (const u in e.attributes) {
|
|
637
638
|
const l = oe[u] || u.toLowerCase();
|
|
638
|
-
if (
|
|
639
|
+
if (n[u] !== void 0) {
|
|
639
640
|
const f = o.accessors[e.attributes[u]], m = j[f.componentType];
|
|
640
641
|
c[l] = m.name, i[l] = f.normalized === !0;
|
|
641
642
|
}
|
|
642
643
|
}
|
|
643
644
|
return t.getDependency("bufferView", r).then(function(u) {
|
|
644
645
|
return new Promise(function(l, f) {
|
|
645
|
-
|
|
646
|
+
s.decodeDracoFile(u, function(m) {
|
|
646
647
|
for (const T in m.attributes) {
|
|
647
|
-
const
|
|
648
|
-
y !== void 0 && (
|
|
648
|
+
const R = m.attributes[T], y = i[T];
|
|
649
|
+
y !== void 0 && (R.normalized = y);
|
|
649
650
|
}
|
|
650
651
|
l(m);
|
|
651
652
|
}, a, c, D, f);
|
|
@@ -667,28 +668,28 @@ class zt {
|
|
|
667
668
|
}
|
|
668
669
|
}
|
|
669
670
|
class Ue extends Tt {
|
|
670
|
-
constructor(e, t, o,
|
|
671
|
-
super(e, t, o,
|
|
671
|
+
constructor(e, t, o, s) {
|
|
672
|
+
super(e, t, o, s);
|
|
672
673
|
}
|
|
673
674
|
copySampleValue_(e) {
|
|
674
|
-
const t = this.resultBuffer, o = this.sampleValues,
|
|
675
|
-
for (let
|
|
676
|
-
t[
|
|
675
|
+
const t = this.resultBuffer, o = this.sampleValues, s = this.valueSize, r = e * s * 3 + s;
|
|
676
|
+
for (let n = 0; n !== s; n++)
|
|
677
|
+
t[n] = o[r + n];
|
|
677
678
|
return t;
|
|
678
679
|
}
|
|
679
|
-
interpolate_(e, t, o,
|
|
680
|
-
const r = this.resultBuffer,
|
|
680
|
+
interpolate_(e, t, o, s) {
|
|
681
|
+
const r = this.resultBuffer, n = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = s - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c, R = T - c, y = -2 * m + 3 * f, x = m - f, E = 1 - y, S = x - f + l;
|
|
681
682
|
for (let _ = 0; _ !== a; _++) {
|
|
682
|
-
const M =
|
|
683
|
-
r[_] = E * M + S * I + y * L +
|
|
683
|
+
const M = n[R + _ + a], I = n[R + _ + i] * u, L = n[T + _ + a], h = n[T + _] * u;
|
|
684
|
+
r[_] = E * M + S * I + y * L + x * h;
|
|
684
685
|
}
|
|
685
686
|
return r;
|
|
686
687
|
}
|
|
687
688
|
}
|
|
688
689
|
const qt = new Le();
|
|
689
690
|
class Yt extends Ue {
|
|
690
|
-
interpolate_(e, t, o,
|
|
691
|
-
const r = super.interpolate_(e, t, o,
|
|
691
|
+
interpolate_(e, t, o, s) {
|
|
692
|
+
const r = super.interpolate_(e, t, o, s);
|
|
692
693
|
return qt.fromArray(r).normalize().toArray(r), r;
|
|
693
694
|
}
|
|
694
695
|
}
|
|
@@ -772,20 +773,20 @@ function F(d, e) {
|
|
|
772
773
|
e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(d.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
|
|
773
774
|
}
|
|
774
775
|
function Zt(d, e, t) {
|
|
775
|
-
let o = !1,
|
|
776
|
+
let o = !1, s = !1, r = !1;
|
|
776
777
|
for (let c = 0, u = e.length; c < u; c++) {
|
|
777
778
|
const l = e[c];
|
|
778
|
-
if (l.POSITION !== void 0 && (o = !0), l.NORMAL !== void 0 && (
|
|
779
|
+
if (l.POSITION !== void 0 && (o = !0), l.NORMAL !== void 0 && (s = !0), l.COLOR_0 !== void 0 && (r = !0), o && s && r) break;
|
|
779
780
|
}
|
|
780
|
-
if (!o && !
|
|
781
|
-
const
|
|
781
|
+
if (!o && !s && !r) return Promise.resolve(d);
|
|
782
|
+
const n = [], a = [], i = [];
|
|
782
783
|
for (let c = 0, u = e.length; c < u; c++) {
|
|
783
784
|
const l = e[c];
|
|
784
785
|
if (o) {
|
|
785
786
|
const f = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : d.attributes.position;
|
|
786
|
-
|
|
787
|
+
n.push(f);
|
|
787
788
|
}
|
|
788
|
-
if (
|
|
789
|
+
if (s) {
|
|
789
790
|
const f = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : d.attributes.normal;
|
|
790
791
|
a.push(f);
|
|
791
792
|
}
|
|
@@ -795,12 +796,12 @@ function Zt(d, e, t) {
|
|
|
795
796
|
}
|
|
796
797
|
}
|
|
797
798
|
return Promise.all([
|
|
798
|
-
Promise.all(
|
|
799
|
+
Promise.all(n),
|
|
799
800
|
Promise.all(a),
|
|
800
801
|
Promise.all(i)
|
|
801
802
|
]).then(function(c) {
|
|
802
803
|
const u = c[0], l = c[1], f = c[2];
|
|
803
|
-
return o && (d.morphAttributes.position = u),
|
|
804
|
+
return o && (d.morphAttributes.position = u), s && (d.morphAttributes.normal = l), r && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
|
|
804
805
|
});
|
|
805
806
|
}
|
|
806
807
|
function $t(d, e) {
|
|
@@ -811,7 +812,7 @@ function $t(d, e) {
|
|
|
811
812
|
const t = e.extras.targetNames;
|
|
812
813
|
if (d.morphTargetInfluences.length === t.length) {
|
|
813
814
|
d.morphTargetDictionary = {};
|
|
814
|
-
for (let o = 0,
|
|
815
|
+
for (let o = 0, s = t.length; o < s; o++)
|
|
815
816
|
d.morphTargetDictionary[t[o]] = o;
|
|
816
817
|
} else
|
|
817
818
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
@@ -821,14 +822,14 @@ function en(d) {
|
|
|
821
822
|
let e;
|
|
822
823
|
const t = d.extensions && d.extensions[b.KHR_DRACO_MESH_COMPRESSION];
|
|
823
824
|
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + te(t.attributes) : e = d.indices + ":" + te(d.attributes) + ":" + d.mode, d.targets !== void 0)
|
|
824
|
-
for (let o = 0,
|
|
825
|
+
for (let o = 0, s = d.targets.length; o < s; o++)
|
|
825
826
|
e += ":" + te(d.targets[o]);
|
|
826
827
|
return e;
|
|
827
828
|
}
|
|
828
829
|
function te(d) {
|
|
829
830
|
let e = "";
|
|
830
831
|
const t = Object.keys(d).sort();
|
|
831
|
-
for (let o = 0,
|
|
832
|
+
for (let o = 0, s = t.length; o < s; o++)
|
|
832
833
|
e += t[o] + ":" + d[t[o]] + ";";
|
|
833
834
|
return e;
|
|
834
835
|
}
|
|
@@ -853,8 +854,8 @@ const nn = new Y();
|
|
|
853
854
|
class sn {
|
|
854
855
|
constructor(e = {}, t = {}) {
|
|
855
856
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new bt(), 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 = {};
|
|
856
|
-
let o = !1,
|
|
857
|
-
typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0,
|
|
857
|
+
let o = !1, s = !1, r = -1;
|
|
858
|
+
typeof navigator < "u" && (o = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, s = navigator.userAgent.indexOf("Firefox") > -1, r = s ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || o || s && r < 98 ? this.textureLoader = new Me(this.options.manager) : this.textureLoader = new qe(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new K(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
858
859
|
}
|
|
859
860
|
setExtensions(e) {
|
|
860
861
|
this.extensions = e;
|
|
@@ -863,28 +864,28 @@ class sn {
|
|
|
863
864
|
this.plugins = e;
|
|
864
865
|
}
|
|
865
866
|
parse(e, t) {
|
|
866
|
-
const o = this,
|
|
867
|
-
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(
|
|
868
|
-
return
|
|
869
|
-
}), Promise.all(this._invokeAll(function(
|
|
870
|
-
return
|
|
867
|
+
const o = this, s = this.json, r = this.extensions;
|
|
868
|
+
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(n) {
|
|
869
|
+
return n._markDefs && n._markDefs();
|
|
870
|
+
}), Promise.all(this._invokeAll(function(n) {
|
|
871
|
+
return n.beforeRoot && n.beforeRoot();
|
|
871
872
|
})).then(function() {
|
|
872
873
|
return Promise.all([
|
|
873
874
|
o.getDependencies("scene"),
|
|
874
875
|
o.getDependencies("animation"),
|
|
875
876
|
o.getDependencies("camera")
|
|
876
877
|
]);
|
|
877
|
-
}).then(function(
|
|
878
|
+
}).then(function(n) {
|
|
878
879
|
const a = {
|
|
879
|
-
scene:
|
|
880
|
-
scenes:
|
|
881
|
-
animations:
|
|
882
|
-
cameras:
|
|
883
|
-
asset:
|
|
880
|
+
scene: n[0][s.scene || 0],
|
|
881
|
+
scenes: n[0],
|
|
882
|
+
animations: n[1],
|
|
883
|
+
cameras: n[2],
|
|
884
|
+
asset: s.asset,
|
|
884
885
|
parser: o,
|
|
885
886
|
userData: {}
|
|
886
887
|
};
|
|
887
|
-
return G(r, a,
|
|
888
|
+
return G(r, a, s), F(a, s), Promise.all(o._invokeAll(function(i) {
|
|
888
889
|
return i.afterRoot && i.afterRoot(a);
|
|
889
890
|
})).then(function() {
|
|
890
891
|
for (const i of a.scenes)
|
|
@@ -898,14 +899,14 @@ class sn {
|
|
|
898
899
|
*/
|
|
899
900
|
_markDefs() {
|
|
900
901
|
const e = this.json.nodes || [], t = this.json.skins || [], o = this.json.meshes || [];
|
|
901
|
-
for (let
|
|
902
|
-
const
|
|
903
|
-
for (let a = 0, i =
|
|
904
|
-
e[
|
|
902
|
+
for (let s = 0, r = t.length; s < r; s++) {
|
|
903
|
+
const n = t[s].joints;
|
|
904
|
+
for (let a = 0, i = n.length; a < i; a++)
|
|
905
|
+
e[n[a]].isBone = !0;
|
|
905
906
|
}
|
|
906
|
-
for (let
|
|
907
|
-
const
|
|
908
|
-
|
|
907
|
+
for (let s = 0, r = e.length; s < r; s++) {
|
|
908
|
+
const n = e[s];
|
|
909
|
+
n.mesh !== void 0 && (this._addNodeRef(this.meshCache, n.mesh), n.skin !== void 0 && (o[n.mesh].isSkinnedMesh = !0)), n.camera !== void 0 && this._addNodeRef(this.cameraCache, n.camera);
|
|
909
910
|
}
|
|
910
911
|
}
|
|
911
912
|
/**
|
|
@@ -923,20 +924,20 @@ class sn {
|
|
|
923
924
|
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
924
925
|
_getNodeRef(e, t, o) {
|
|
925
926
|
if (e.refs[t] <= 1) return o;
|
|
926
|
-
const
|
|
927
|
-
const i = this.associations.get(
|
|
927
|
+
const s = o.clone(), r = (n, a) => {
|
|
928
|
+
const i = this.associations.get(n);
|
|
928
929
|
i != null && this.associations.set(a, i);
|
|
929
|
-
for (const [c, u] of
|
|
930
|
+
for (const [c, u] of n.children.entries())
|
|
930
931
|
r(u, a.children[c]);
|
|
931
932
|
};
|
|
932
|
-
return r(o,
|
|
933
|
+
return r(o, s), s.name += "_instance_" + e.uses[t]++, s;
|
|
933
934
|
}
|
|
934
935
|
_invokeOne(e) {
|
|
935
936
|
const t = Object.values(this.plugins);
|
|
936
937
|
t.push(this);
|
|
937
938
|
for (let o = 0; o < t.length; o++) {
|
|
938
|
-
const
|
|
939
|
-
if (
|
|
939
|
+
const s = e(t[o]);
|
|
940
|
+
if (s) return s;
|
|
940
941
|
}
|
|
941
942
|
return null;
|
|
942
943
|
}
|
|
@@ -944,8 +945,8 @@ class sn {
|
|
|
944
945
|
const t = Object.values(this.plugins);
|
|
945
946
|
t.unshift(this);
|
|
946
947
|
const o = [];
|
|
947
|
-
for (let
|
|
948
|
-
const r = e(t[
|
|
948
|
+
for (let s = 0; s < t.length; s++) {
|
|
949
|
+
const r = e(t[s]);
|
|
949
950
|
r && o.push(r);
|
|
950
951
|
}
|
|
951
952
|
return o;
|
|
@@ -958,64 +959,64 @@ class sn {
|
|
|
958
959
|
*/
|
|
959
960
|
getDependency(e, t) {
|
|
960
961
|
const o = e + ":" + t;
|
|
961
|
-
let
|
|
962
|
-
if (!
|
|
962
|
+
let s = this.cache.get(o);
|
|
963
|
+
if (!s) {
|
|
963
964
|
switch (e) {
|
|
964
965
|
case "scene":
|
|
965
|
-
|
|
966
|
+
s = this.loadScene(t);
|
|
966
967
|
break;
|
|
967
968
|
case "node":
|
|
968
|
-
|
|
969
|
+
s = this._invokeOne(function(r) {
|
|
969
970
|
return r.loadNode && r.loadNode(t);
|
|
970
971
|
});
|
|
971
972
|
break;
|
|
972
973
|
case "mesh":
|
|
973
|
-
|
|
974
|
+
s = this._invokeOne(function(r) {
|
|
974
975
|
return r.loadMesh && r.loadMesh(t);
|
|
975
976
|
});
|
|
976
977
|
break;
|
|
977
978
|
case "accessor":
|
|
978
|
-
|
|
979
|
+
s = this.loadAccessor(t);
|
|
979
980
|
break;
|
|
980
981
|
case "bufferView":
|
|
981
|
-
|
|
982
|
+
s = this._invokeOne(function(r) {
|
|
982
983
|
return r.loadBufferView && r.loadBufferView(t);
|
|
983
984
|
});
|
|
984
985
|
break;
|
|
985
986
|
case "buffer":
|
|
986
|
-
|
|
987
|
+
s = this.loadBuffer(t);
|
|
987
988
|
break;
|
|
988
989
|
case "material":
|
|
989
|
-
|
|
990
|
+
s = this._invokeOne(function(r) {
|
|
990
991
|
return r.loadMaterial && r.loadMaterial(t);
|
|
991
992
|
});
|
|
992
993
|
break;
|
|
993
994
|
case "texture":
|
|
994
|
-
|
|
995
|
+
s = this._invokeOne(function(r) {
|
|
995
996
|
return r.loadTexture && r.loadTexture(t);
|
|
996
997
|
});
|
|
997
998
|
break;
|
|
998
999
|
case "skin":
|
|
999
|
-
|
|
1000
|
+
s = this.loadSkin(t);
|
|
1000
1001
|
break;
|
|
1001
1002
|
case "animation":
|
|
1002
|
-
|
|
1003
|
+
s = this._invokeOne(function(r) {
|
|
1003
1004
|
return r.loadAnimation && r.loadAnimation(t);
|
|
1004
1005
|
});
|
|
1005
1006
|
break;
|
|
1006
1007
|
case "camera":
|
|
1007
|
-
|
|
1008
|
+
s = this.loadCamera(t);
|
|
1008
1009
|
break;
|
|
1009
1010
|
default:
|
|
1010
|
-
if (
|
|
1011
|
+
if (s = this._invokeOne(function(r) {
|
|
1011
1012
|
return r != this && r.getDependency && r.getDependency(e, t);
|
|
1012
|
-
}), !
|
|
1013
|
+
}), !s)
|
|
1013
1014
|
throw new Error("Unknown type: " + e);
|
|
1014
1015
|
break;
|
|
1015
1016
|
}
|
|
1016
|
-
this.cache.add(o,
|
|
1017
|
+
this.cache.add(o, s);
|
|
1017
1018
|
}
|
|
1018
|
-
return
|
|
1019
|
+
return s;
|
|
1019
1020
|
}
|
|
1020
1021
|
/**
|
|
1021
1022
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
@@ -1025,9 +1026,9 @@ class sn {
|
|
|
1025
1026
|
getDependencies(e) {
|
|
1026
1027
|
let t = this.cache.get(e);
|
|
1027
1028
|
if (!t) {
|
|
1028
|
-
const o = this,
|
|
1029
|
-
t = Promise.all(
|
|
1030
|
-
return o.getDependency(e,
|
|
1029
|
+
const o = this, s = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1030
|
+
t = Promise.all(s.map(function(r, n) {
|
|
1031
|
+
return o.getDependency(e, n);
|
|
1031
1032
|
})), this.cache.add(e, t);
|
|
1032
1033
|
}
|
|
1033
1034
|
return t;
|
|
@@ -1043,10 +1044,10 @@ class sn {
|
|
|
1043
1044
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1044
1045
|
if (t.uri === void 0 && e === 0)
|
|
1045
1046
|
return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
|
|
1046
|
-
const
|
|
1047
|
-
return new Promise(function(r,
|
|
1048
|
-
o.load(X.resolveURL(t.uri,
|
|
1049
|
-
|
|
1047
|
+
const s = this.options;
|
|
1048
|
+
return new Promise(function(r, n) {
|
|
1049
|
+
o.load(X.resolveURL(t.uri, s.path), r, void 0, function() {
|
|
1050
|
+
n(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1050
1051
|
});
|
|
1051
1052
|
});
|
|
1052
1053
|
}
|
|
@@ -1058,8 +1059,8 @@ class sn {
|
|
|
1058
1059
|
loadBufferView(e) {
|
|
1059
1060
|
const t = this.json.bufferViews[e];
|
|
1060
1061
|
return this.getDependency("buffer", t.buffer).then(function(o) {
|
|
1061
|
-
const
|
|
1062
|
-
return o.slice(r, r +
|
|
1062
|
+
const s = t.byteLength || 0, r = t.byteOffset || 0;
|
|
1063
|
+
return o.slice(r, r + s);
|
|
1063
1064
|
});
|
|
1064
1065
|
}
|
|
1065
1066
|
/**
|
|
@@ -1068,23 +1069,23 @@ class sn {
|
|
|
1068
1069
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1069
1070
|
*/
|
|
1070
1071
|
loadAccessor(e) {
|
|
1071
|
-
const t = this, o = this.json,
|
|
1072
|
-
if (
|
|
1073
|
-
const
|
|
1074
|
-
return Promise.resolve(new P(c,
|
|
1072
|
+
const t = this, o = this.json, s = this.json.accessors[e];
|
|
1073
|
+
if (s.bufferView === void 0 && s.sparse === void 0) {
|
|
1074
|
+
const n = $[s.type], a = j[s.componentType], i = s.normalized === !0, c = new a(s.count * n);
|
|
1075
|
+
return Promise.resolve(new P(c, n, i));
|
|
1075
1076
|
}
|
|
1076
1077
|
const r = [];
|
|
1077
|
-
return
|
|
1078
|
-
const a =
|
|
1079
|
-
let
|
|
1078
|
+
return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(n) {
|
|
1079
|
+
const a = n[0], i = $[s.type], c = j[s.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = s.byteOffset || 0, m = s.bufferView !== void 0 ? o.bufferViews[s.bufferView].byteStride : void 0, T = s.normalized === !0;
|
|
1080
|
+
let R, y;
|
|
1080
1081
|
if (m && m !== l) {
|
|
1081
|
-
const
|
|
1082
|
+
const x = Math.floor(f / m), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + x + ":" + s.count;
|
|
1082
1083
|
let S = t.cache.get(E);
|
|
1083
|
-
S || (
|
|
1084
|
+
S || (R = new c(a, x * m, s.count * m / u), S = new Ye(R, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
|
|
1084
1085
|
} else
|
|
1085
|
-
a === null ?
|
|
1086
|
-
if (
|
|
1087
|
-
const
|
|
1086
|
+
a === null ? R = new c(s.count * i) : R = new c(a, f, s.count * i), y = new P(R, i, T);
|
|
1087
|
+
if (s.sparse !== void 0) {
|
|
1088
|
+
const x = $.SCALAR, E = j[s.sparse.indices.componentType], S = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, M = new E(n[1], S, s.sparse.count * x), I = new c(n[2], _, s.sparse.count * i);
|
|
1088
1089
|
a !== null && (y = new P(y.array.slice(), y.itemSize, y.normalized));
|
|
1089
1090
|
for (let L = 0, h = M.length; L < h; L++) {
|
|
1090
1091
|
const p = M[L];
|
|
@@ -1100,51 +1101,51 @@ class sn {
|
|
|
1100
1101
|
* @return {Promise<THREE.Texture|null>}
|
|
1101
1102
|
*/
|
|
1102
1103
|
loadTexture(e) {
|
|
1103
|
-
const t = this.json, o = this.options, r = t.textures[e].source,
|
|
1104
|
+
const t = this.json, o = this.options, r = t.textures[e].source, n = t.images[r];
|
|
1104
1105
|
let a = this.textureLoader;
|
|
1105
|
-
if (
|
|
1106
|
-
const i = o.manager.getHandler(
|
|
1106
|
+
if (n.uri) {
|
|
1107
|
+
const i = o.manager.getHandler(n.uri);
|
|
1107
1108
|
i !== null && (a = i);
|
|
1108
1109
|
}
|
|
1109
1110
|
return this.loadTextureImage(e, r, a);
|
|
1110
1111
|
}
|
|
1111
1112
|
loadTextureImage(e, t, o) {
|
|
1112
|
-
const
|
|
1113
|
+
const s = this, r = this.json, n = r.textures[e], a = r.images[t], i = (a.uri || a.bufferView) + ":" + n.sampler;
|
|
1113
1114
|
if (this.textureCache[i])
|
|
1114
1115
|
return this.textureCache[i];
|
|
1115
1116
|
const c = this.loadImageSource(t, o).then(function(u) {
|
|
1116
|
-
u.flipY = !1, u.name =
|
|
1117
|
-
const f = (r.samplers || {})[
|
|
1118
|
-
return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J,
|
|
1117
|
+
u.flipY = !1, u.name = n.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
1118
|
+
const f = (r.samplers || {})[n.sampler] || {};
|
|
1119
|
+
return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J, s.associations.set(u, { textures: e }), u;
|
|
1119
1120
|
}).catch(function() {
|
|
1120
1121
|
return null;
|
|
1121
1122
|
});
|
|
1122
1123
|
return this.textureCache[i] = c, c;
|
|
1123
1124
|
}
|
|
1124
1125
|
loadImageSource(e, t) {
|
|
1125
|
-
const o = this,
|
|
1126
|
+
const o = this, s = this.json, r = this.options;
|
|
1126
1127
|
if (this.sourceCache[e] !== void 0)
|
|
1127
1128
|
return this.sourceCache[e].then((l) => l.clone());
|
|
1128
|
-
const
|
|
1129
|
-
let i =
|
|
1130
|
-
if (
|
|
1131
|
-
i = o.getDependency("bufferView",
|
|
1129
|
+
const n = s.images[e], a = self.URL || self.webkitURL;
|
|
1130
|
+
let i = n.uri || "", c = !1;
|
|
1131
|
+
if (n.bufferView !== void 0)
|
|
1132
|
+
i = o.getDependency("bufferView", n.bufferView).then(function(l) {
|
|
1132
1133
|
c = !0;
|
|
1133
|
-
const f = new Blob([l], { type:
|
|
1134
|
+
const f = new Blob([l], { type: n.mimeType });
|
|
1134
1135
|
return i = a.createObjectURL(f), i;
|
|
1135
1136
|
});
|
|
1136
|
-
else if (
|
|
1137
|
+
else if (n.uri === void 0)
|
|
1137
1138
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1138
1139
|
const u = Promise.resolve(i).then(function(l) {
|
|
1139
1140
|
return new Promise(function(f, m) {
|
|
1140
1141
|
let T = f;
|
|
1141
|
-
t.isImageBitmapLoader === !0 && (T = function(
|
|
1142
|
-
const y = new de(
|
|
1142
|
+
t.isImageBitmapLoader === !0 && (T = function(R) {
|
|
1143
|
+
const y = new de(R);
|
|
1143
1144
|
y.needsUpdate = !0, f(y);
|
|
1144
1145
|
}), t.load(X.resolveURL(l, r.path), T, void 0, m);
|
|
1145
1146
|
});
|
|
1146
1147
|
}).then(function(l) {
|
|
1147
|
-
return c === !0 && a.revokeObjectURL(i), l.userData.mimeType =
|
|
1148
|
+
return c === !0 && a.revokeObjectURL(i), l.userData.mimeType = n.mimeType || tn(n.uri), l;
|
|
1148
1149
|
}).catch(function(l) {
|
|
1149
1150
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", i), l;
|
|
1150
1151
|
});
|
|
@@ -1157,18 +1158,18 @@ class sn {
|
|
|
1157
1158
|
* @param {Object} mapDef
|
|
1158
1159
|
* @return {Promise<Texture>}
|
|
1159
1160
|
*/
|
|
1160
|
-
assignTexture(e, t, o,
|
|
1161
|
+
assignTexture(e, t, o, s) {
|
|
1161
1162
|
const r = this;
|
|
1162
|
-
return this.getDependency("texture", o.index).then(function(
|
|
1163
|
-
if (!
|
|
1164
|
-
if (o.texCoord !== void 0 && o.texCoord > 0 && (
|
|
1163
|
+
return this.getDependency("texture", o.index).then(function(n) {
|
|
1164
|
+
if (!n) return null;
|
|
1165
|
+
if (o.texCoord !== void 0 && o.texCoord > 0 && (n = n.clone(), n.channel = o.texCoord), r.extensions[b.KHR_TEXTURE_TRANSFORM]) {
|
|
1165
1166
|
const a = o.extensions !== void 0 ? o.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1166
1167
|
if (a) {
|
|
1167
|
-
const i = r.associations.get(
|
|
1168
|
-
|
|
1168
|
+
const i = r.associations.get(n);
|
|
1169
|
+
n = r.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(n, a), r.associations.set(n, i);
|
|
1169
1170
|
}
|
|
1170
1171
|
}
|
|
1171
|
-
return
|
|
1172
|
+
return s !== void 0 && (n.colorSpace = s), e[t] = n, n;
|
|
1172
1173
|
});
|
|
1173
1174
|
}
|
|
1174
1175
|
/**
|
|
@@ -1182,7 +1183,7 @@ class sn {
|
|
|
1182
1183
|
assignFinalMaterial(e) {
|
|
1183
1184
|
const t = e.geometry;
|
|
1184
1185
|
let o = e.material;
|
|
1185
|
-
const
|
|
1186
|
+
const s = t.attributes.tangent === void 0, r = t.attributes.color !== void 0, n = t.attributes.normal === void 0;
|
|
1186
1187
|
if (e.isPoints) {
|
|
1187
1188
|
const a = "PointsMaterial:" + o.uuid;
|
|
1188
1189
|
let i = this.cache.get(a);
|
|
@@ -1192,11 +1193,11 @@ class sn {
|
|
|
1192
1193
|
let i = this.cache.get(a);
|
|
1193
1194
|
i || (i = new nt(), Z.prototype.copy.call(i, o), i.color.copy(o.color), i.map = o.map, this.cache.add(a, i)), o = i;
|
|
1194
1195
|
}
|
|
1195
|
-
if (
|
|
1196
|
+
if (s || r || n) {
|
|
1196
1197
|
let a = "ClonedMaterial:" + o.uuid + ":";
|
|
1197
|
-
|
|
1198
|
+
s && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), n && (a += "flat-shading:");
|
|
1198
1199
|
let i = this.cache.get(a);
|
|
1199
|
-
i || (i = o.clone(), r && (i.vertexColors = !0),
|
|
1200
|
+
i || (i = o.clone(), r && (i.vertexColors = !0), n && (i.flatShading = !0), s && (i.normalScale && (i.normalScale.y *= -1), i.clearcoatNormalScale && (i.clearcoatNormalScale.y *= -1)), this.cache.add(a, i), this.associations.set(i, this.associations.get(o))), o = i;
|
|
1200
1201
|
}
|
|
1201
1202
|
e.material = o;
|
|
1202
1203
|
}
|
|
@@ -1209,19 +1210,19 @@ class sn {
|
|
|
1209
1210
|
* @return {Promise<Material>}
|
|
1210
1211
|
*/
|
|
1211
1212
|
loadMaterial(e) {
|
|
1212
|
-
const t = this, o = this.json,
|
|
1213
|
-
let
|
|
1213
|
+
const t = this, o = this.json, s = this.extensions, r = o.materials[e];
|
|
1214
|
+
let n;
|
|
1214
1215
|
const a = {}, i = r.extensions || {}, c = [];
|
|
1215
1216
|
if (i[b.KHR_MATERIALS_UNLIT]) {
|
|
1216
|
-
const l =
|
|
1217
|
-
|
|
1217
|
+
const l = s[b.KHR_MATERIALS_UNLIT];
|
|
1218
|
+
n = l.getMaterialType(), c.push(l.extendParams(a, r, t));
|
|
1218
1219
|
} else {
|
|
1219
1220
|
const l = r.pbrMetallicRoughness || {};
|
|
1220
1221
|
if (a.color = new U(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
|
|
1221
1222
|
const f = l.baseColorFactor;
|
|
1222
1223
|
a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
|
|
1223
1224
|
}
|
|
1224
|
-
l.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", l.baseColorTexture, N)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))),
|
|
1225
|
+
l.baseColorTexture !== void 0 && c.push(t.assignTexture(a, "map", l.baseColorTexture, N)), a.metalness = l.metallicFactor !== void 0 ? l.metallicFactor : 1, a.roughness = l.roughnessFactor !== void 0 ? l.roughnessFactor : 1, l.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(a, "metalnessMap", l.metallicRoughnessTexture)), c.push(t.assignTexture(a, "roughnessMap", l.metallicRoughnessTexture))), n = this._invokeOne(function(f) {
|
|
1225
1226
|
return f.getMaterialType && f.getMaterialType(e);
|
|
1226
1227
|
}), c.push(Promise.all(this._invokeAll(function(f) {
|
|
1227
1228
|
return f.extendMaterialParams && f.extendMaterialParams(e, a);
|
|
@@ -1229,17 +1230,17 @@ class sn {
|
|
|
1229
1230
|
}
|
|
1230
1231
|
r.doubleSided === !0 && (a.side = st);
|
|
1231
1232
|
const u = r.alphaMode || ee.OPAQUE;
|
|
1232
|
-
if (u === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 &&
|
|
1233
|
+
if (u === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new q(1, 1), r.normalTexture.scale !== void 0)) {
|
|
1233
1234
|
const l = r.normalTexture.scale;
|
|
1234
1235
|
a.normalScale.set(l, l);
|
|
1235
1236
|
}
|
|
1236
|
-
if (r.occlusionTexture !== void 0 &&
|
|
1237
|
+
if (r.occlusionTexture !== void 0 && n !== W && (c.push(t.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && n !== W) {
|
|
1237
1238
|
const l = r.emissiveFactor;
|
|
1238
1239
|
a.emissive = new U().setRGB(l[0], l[1], l[2], D);
|
|
1239
1240
|
}
|
|
1240
|
-
return r.emissiveTexture !== void 0 &&
|
|
1241
|
-
const l = new
|
|
1242
|
-
return r.name && (l.name = r.name), F(l, r), t.associations.set(l, { materials: e }), r.extensions && G(
|
|
1241
|
+
return r.emissiveTexture !== void 0 && n !== W && c.push(t.assignTexture(a, "emissiveMap", r.emissiveTexture, N)), Promise.all(c).then(function() {
|
|
1242
|
+
const l = new n(a);
|
|
1243
|
+
return r.name && (l.name = r.name), F(l, r), t.associations.set(l, { materials: e }), r.extensions && G(s, l, r), l;
|
|
1243
1244
|
});
|
|
1244
1245
|
}
|
|
1245
1246
|
/** When Object3D instances are targeted by animation, they need unique names. */
|
|
@@ -1256,23 +1257,23 @@ class sn {
|
|
|
1256
1257
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1257
1258
|
*/
|
|
1258
1259
|
loadGeometries(e) {
|
|
1259
|
-
const t = this, o = this.extensions,
|
|
1260
|
+
const t = this, o = this.extensions, s = this.primitiveCache;
|
|
1260
1261
|
function r(a) {
|
|
1261
1262
|
return o[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
|
|
1262
1263
|
return Se(i, a, t);
|
|
1263
1264
|
});
|
|
1264
1265
|
}
|
|
1265
|
-
const
|
|
1266
|
+
const n = [];
|
|
1266
1267
|
for (let a = 0, i = e.length; a < i; a++) {
|
|
1267
|
-
const c = e[a], u = en(c), l =
|
|
1268
|
+
const c = e[a], u = en(c), l = s[u];
|
|
1268
1269
|
if (l)
|
|
1269
|
-
|
|
1270
|
+
n.push(l.promise);
|
|
1270
1271
|
else {
|
|
1271
1272
|
let f;
|
|
1272
|
-
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t),
|
|
1273
|
+
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t), s[u] = { primitive: c, promise: f }, n.push(f);
|
|
1273
1274
|
}
|
|
1274
1275
|
}
|
|
1275
|
-
return Promise.all(
|
|
1276
|
+
return Promise.all(n);
|
|
1276
1277
|
}
|
|
1277
1278
|
/**
|
|
1278
1279
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
@@ -1280,30 +1281,30 @@ class sn {
|
|
|
1280
1281
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1281
1282
|
*/
|
|
1282
1283
|
loadMesh(e) {
|
|
1283
|
-
const t = this, o = this.json,
|
|
1284
|
-
for (let i = 0, c =
|
|
1285
|
-
const u =
|
|
1284
|
+
const t = this, o = this.json, s = this.extensions, r = o.meshes[e], n = r.primitives, a = [];
|
|
1285
|
+
for (let i = 0, c = n.length; i < c; i++) {
|
|
1286
|
+
const u = n[i].material === void 0 ? Qt(this.cache) : this.getDependency("material", n[i].material);
|
|
1286
1287
|
a.push(u);
|
|
1287
1288
|
}
|
|
1288
|
-
return a.push(t.loadGeometries(
|
|
1289
|
+
return a.push(t.loadGeometries(n)), Promise.all(a).then(function(i) {
|
|
1289
1290
|
const c = i.slice(0, i.length - 1), u = i[i.length - 1], l = [];
|
|
1290
1291
|
for (let m = 0, T = u.length; m < T; m++) {
|
|
1291
|
-
const
|
|
1292
|
-
let
|
|
1292
|
+
const R = u[m], y = n[m];
|
|
1293
|
+
let x;
|
|
1293
1294
|
const E = c[m];
|
|
1294
1295
|
if (y.mode === C.TRIANGLES || y.mode === C.TRIANGLE_STRIP || y.mode === C.TRIANGLE_FAN || y.mode === void 0)
|
|
1295
|
-
|
|
1296
|
+
x = r.isSkinnedMesh === !0 ? new ot(R, E) : new Pe(R, E), x.isSkinnedMesh === !0 && x.normalizeSkinWeights(), y.mode === C.TRIANGLE_STRIP ? x.geometry = Re(x.geometry, be) : y.mode === C.TRIANGLE_FAN && (x.geometry = Re(x.geometry, re));
|
|
1296
1297
|
else if (y.mode === C.LINES)
|
|
1297
|
-
|
|
1298
|
+
x = new it(R, E);
|
|
1298
1299
|
else if (y.mode === C.LINE_STRIP)
|
|
1299
|
-
|
|
1300
|
+
x = new at(R, E);
|
|
1300
1301
|
else if (y.mode === C.LINE_LOOP)
|
|
1301
|
-
|
|
1302
|
+
x = new ct(R, E);
|
|
1302
1303
|
else if (y.mode === C.POINTS)
|
|
1303
|
-
|
|
1304
|
+
x = new ut(R, E);
|
|
1304
1305
|
else
|
|
1305
1306
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
1306
|
-
Object.keys(
|
|
1307
|
+
Object.keys(x.geometry.morphAttributes).length > 0 && $t(x, r), x.name = t.createUniqueName(r.name || "mesh_" + e), F(x, r), y.extensions && G(s, x, y), t.assignFinalMaterial(x), l.push(x);
|
|
1307
1308
|
}
|
|
1308
1309
|
for (let m = 0, T = l.length; m < T; m++)
|
|
1309
1310
|
t.associations.set(l[m], {
|
|
@@ -1311,9 +1312,9 @@ class sn {
|
|
|
1311
1312
|
primitives: m
|
|
1312
1313
|
});
|
|
1313
1314
|
if (l.length === 1)
|
|
1314
|
-
return r.extensions && G(
|
|
1315
|
+
return r.extensions && G(s, l[0], r), l[0];
|
|
1315
1316
|
const f = new z();
|
|
1316
|
-
r.extensions && G(
|
|
1317
|
+
r.extensions && G(s, f, r), t.associations.set(f, { meshes: e });
|
|
1317
1318
|
for (let m = 0, T = l.length; m < T; m++)
|
|
1318
1319
|
f.add(l[m]);
|
|
1319
1320
|
return f;
|
|
@@ -1326,12 +1327,12 @@ class sn {
|
|
|
1326
1327
|
*/
|
|
1327
1328
|
loadCamera(e) {
|
|
1328
1329
|
let t;
|
|
1329
|
-
const o = this.json.cameras[e],
|
|
1330
|
-
if (!
|
|
1330
|
+
const o = this.json.cameras[e], s = o[o.type];
|
|
1331
|
+
if (!s) {
|
|
1331
1332
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1332
1333
|
return;
|
|
1333
1334
|
}
|
|
1334
|
-
return o.type === "perspective" ? t = new lt(ft.radToDeg(
|
|
1335
|
+
return o.type === "perspective" ? t = new lt(ft.radToDeg(s.yfov), s.aspectRatio || 1, s.znear || 1, s.zfar || 2e6) : o.type === "orthographic" && (t = new dt(-s.xmag, s.xmag, s.ymag, -s.ymag, s.znear, s.zfar)), o.name && (t.name = this.createUniqueName(o.name)), F(t, o), Promise.resolve(t);
|
|
1335
1336
|
}
|
|
1336
1337
|
/**
|
|
1337
1338
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1340,12 +1341,12 @@ class sn {
|
|
|
1340
1341
|
*/
|
|
1341
1342
|
loadSkin(e) {
|
|
1342
1343
|
const t = this.json.skins[e], o = [];
|
|
1343
|
-
for (let
|
|
1344
|
-
o.push(this._loadNodeShallow(t.joints[
|
|
1345
|
-
return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(
|
|
1346
|
-
const r =
|
|
1347
|
-
for (let c = 0, u =
|
|
1348
|
-
const l =
|
|
1344
|
+
for (let s = 0, r = t.joints.length; s < r; s++)
|
|
1345
|
+
o.push(this._loadNodeShallow(t.joints[s]));
|
|
1346
|
+
return t.inverseBindMatrices !== void 0 ? o.push(this.getDependency("accessor", t.inverseBindMatrices)) : o.push(null), Promise.all(o).then(function(s) {
|
|
1347
|
+
const r = s.pop(), n = s, a = [], i = [];
|
|
1348
|
+
for (let c = 0, u = n.length; c < u; c++) {
|
|
1349
|
+
const l = n[c];
|
|
1349
1350
|
if (l) {
|
|
1350
1351
|
a.push(l);
|
|
1351
1352
|
const f = new Y();
|
|
@@ -1362,40 +1363,40 @@ class sn {
|
|
|
1362
1363
|
* @return {Promise<AnimationClip>}
|
|
1363
1364
|
*/
|
|
1364
1365
|
loadAnimation(e) {
|
|
1365
|
-
const t = this.json, o = this,
|
|
1366
|
-
for (let l = 0, f =
|
|
1367
|
-
const m =
|
|
1368
|
-
|
|
1366
|
+
const t = this.json, o = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, n = [], a = [], i = [], c = [], u = [];
|
|
1367
|
+
for (let l = 0, f = s.channels.length; l < f; l++) {
|
|
1368
|
+
const m = s.channels[l], T = s.samplers[m.sampler], R = m.target, y = R.node, x = s.parameters !== void 0 ? s.parameters[T.input] : T.input, E = s.parameters !== void 0 ? s.parameters[T.output] : T.output;
|
|
1369
|
+
R.node !== void 0 && (n.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", x)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(R));
|
|
1369
1370
|
}
|
|
1370
1371
|
return Promise.all([
|
|
1371
|
-
Promise.all(
|
|
1372
|
+
Promise.all(n),
|
|
1372
1373
|
Promise.all(a),
|
|
1373
1374
|
Promise.all(i),
|
|
1374
1375
|
Promise.all(c),
|
|
1375
1376
|
Promise.all(u)
|
|
1376
1377
|
]).then(function(l) {
|
|
1377
|
-
const f = l[0], m = l[1], T = l[2],
|
|
1378
|
+
const f = l[0], m = l[1], T = l[2], R = l[3], y = l[4], x = [];
|
|
1378
1379
|
for (let E = 0, S = f.length; E < S; E++) {
|
|
1379
|
-
const _ = f[E], M = m[E], I = T[E], L =
|
|
1380
|
+
const _ = f[E], M = m[E], I = T[E], L = R[E], h = y[E];
|
|
1380
1381
|
if (_ === void 0) continue;
|
|
1381
1382
|
_.updateMatrix && _.updateMatrix();
|
|
1382
1383
|
const p = o._createAnimationTracks(_, M, I, L, h);
|
|
1383
1384
|
if (p)
|
|
1384
1385
|
for (let g = 0; g < p.length; g++)
|
|
1385
|
-
|
|
1386
|
+
x.push(p[g]);
|
|
1386
1387
|
}
|
|
1387
|
-
return new pt(r, void 0,
|
|
1388
|
+
return new pt(r, void 0, x);
|
|
1388
1389
|
});
|
|
1389
1390
|
}
|
|
1390
1391
|
createNodeMesh(e) {
|
|
1391
|
-
const t = this.json, o = this,
|
|
1392
|
-
return
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1392
|
+
const t = this.json, o = this, s = t.nodes[e];
|
|
1393
|
+
return s.mesh === void 0 ? null : o.getDependency("mesh", s.mesh).then(function(r) {
|
|
1394
|
+
const n = o._getNodeRef(o.meshCache, s.mesh, r);
|
|
1395
|
+
return s.weights !== void 0 && n.traverse(function(a) {
|
|
1395
1396
|
if (a.isMesh)
|
|
1396
|
-
for (let i = 0, c =
|
|
1397
|
-
a.morphTargetInfluences[i] =
|
|
1398
|
-
}),
|
|
1397
|
+
for (let i = 0, c = s.weights.length; i < c; i++)
|
|
1398
|
+
a.morphTargetInfluences[i] = s.weights[i];
|
|
1399
|
+
}), n;
|
|
1399
1400
|
});
|
|
1400
1401
|
}
|
|
1401
1402
|
/**
|
|
@@ -1404,13 +1405,13 @@ class sn {
|
|
|
1404
1405
|
* @return {Promise<Object3D>}
|
|
1405
1406
|
*/
|
|
1406
1407
|
loadNode(e) {
|
|
1407
|
-
const t = this.json, o = this,
|
|
1408
|
+
const t = this.json, o = this, s = t.nodes[e], r = o._loadNodeShallow(e), n = [], a = s.children || [];
|
|
1408
1409
|
for (let c = 0, u = a.length; c < u; c++)
|
|
1409
|
-
|
|
1410
|
-
const i =
|
|
1410
|
+
n.push(o.getDependency("node", a[c]));
|
|
1411
|
+
const i = s.skin === void 0 ? Promise.resolve(null) : o.getDependency("skin", s.skin);
|
|
1411
1412
|
return Promise.all([
|
|
1412
1413
|
r,
|
|
1413
|
-
Promise.all(
|
|
1414
|
+
Promise.all(n),
|
|
1414
1415
|
i
|
|
1415
1416
|
]).then(function(c) {
|
|
1416
1417
|
const u = c[0], l = c[1], f = c[2];
|
|
@@ -1425,15 +1426,15 @@ class sn {
|
|
|
1425
1426
|
// ._loadNodeShallow() parses a single node.
|
|
1426
1427
|
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1427
1428
|
_loadNodeShallow(e) {
|
|
1428
|
-
const t = this.json, o = this.extensions,
|
|
1429
|
+
const t = this.json, o = this.extensions, s = this;
|
|
1429
1430
|
if (this.nodeCache[e] !== void 0)
|
|
1430
1431
|
return this.nodeCache[e];
|
|
1431
|
-
const r = t.nodes[e],
|
|
1432
|
+
const r = t.nodes[e], n = r.name ? s.createUniqueName(r.name) : "", a = [], i = s._invokeOne(function(c) {
|
|
1432
1433
|
return c.createNodeMesh && c.createNodeMesh(e);
|
|
1433
1434
|
});
|
|
1434
|
-
return i && a.push(i), r.camera !== void 0 && a.push(
|
|
1435
|
-
return
|
|
1436
|
-
})),
|
|
1435
|
+
return i && a.push(i), r.camera !== void 0 && a.push(s.getDependency("camera", r.camera).then(function(c) {
|
|
1436
|
+
return s._getNodeRef(s.cameraCache, r.camera, c);
|
|
1437
|
+
})), s._invokeAll(function(c) {
|
|
1437
1438
|
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
1438
1439
|
}).forEach(function(c) {
|
|
1439
1440
|
a.push(c);
|
|
@@ -1442,12 +1443,12 @@ class sn {
|
|
|
1442
1443
|
if (r.isBone === !0 ? u = new mt() : c.length > 1 ? u = new z() : c.length === 1 ? u = c[0] : u = new ce(), u !== c[0])
|
|
1443
1444
|
for (let l = 0, f = c.length; l < f; l++)
|
|
1444
1445
|
u.add(c[l]);
|
|
1445
|
-
if (r.name && (u.userData.name = r.name, u.name =
|
|
1446
|
+
if (r.name && (u.userData.name = r.name, u.name = n), F(u, r), r.extensions && G(o, u, r), r.matrix !== void 0) {
|
|
1446
1447
|
const l = new Y();
|
|
1447
1448
|
l.fromArray(r.matrix), u.applyMatrix4(l);
|
|
1448
1449
|
} else
|
|
1449
1450
|
r.translation !== void 0 && u.position.fromArray(r.translation), r.rotation !== void 0 && u.quaternion.fromArray(r.rotation), r.scale !== void 0 && u.scale.fromArray(r.scale);
|
|
1450
|
-
return
|
|
1451
|
+
return s.associations.has(u) || s.associations.set(u, {}), s.associations.get(u).nodes = e, u;
|
|
1451
1452
|
}), this.nodeCache[e];
|
|
1452
1453
|
}
|
|
1453
1454
|
/**
|
|
@@ -1456,28 +1457,28 @@ class sn {
|
|
|
1456
1457
|
* @return {Promise<Group>}
|
|
1457
1458
|
*/
|
|
1458
1459
|
loadScene(e) {
|
|
1459
|
-
const t = this.extensions, o = this.json.scenes[e],
|
|
1460
|
-
o.name && (r.name =
|
|
1461
|
-
const
|
|
1462
|
-
for (let i = 0, c =
|
|
1463
|
-
a.push(
|
|
1460
|
+
const t = this.extensions, o = this.json.scenes[e], s = this, r = new z();
|
|
1461
|
+
o.name && (r.name = s.createUniqueName(o.name)), F(r, o), o.extensions && G(t, r, o);
|
|
1462
|
+
const n = o.nodes || [], a = [];
|
|
1463
|
+
for (let i = 0, c = n.length; i < c; i++)
|
|
1464
|
+
a.push(s.getDependency("node", n[i]));
|
|
1464
1465
|
return Promise.all(a).then(function(i) {
|
|
1465
1466
|
for (let u = 0, l = i.length; u < l; u++)
|
|
1466
1467
|
r.add(i[u]);
|
|
1467
1468
|
const c = (u) => {
|
|
1468
1469
|
const l = /* @__PURE__ */ new Map();
|
|
1469
|
-
for (const [f, m] of
|
|
1470
|
+
for (const [f, m] of s.associations)
|
|
1470
1471
|
(f instanceof Z || f instanceof de) && l.set(f, m);
|
|
1471
1472
|
return u.traverse((f) => {
|
|
1472
|
-
const m =
|
|
1473
|
+
const m = s.associations.get(f);
|
|
1473
1474
|
m != null && l.set(f, m);
|
|
1474
1475
|
}), l;
|
|
1475
1476
|
};
|
|
1476
|
-
return
|
|
1477
|
+
return s.associations = c(r), r;
|
|
1477
1478
|
});
|
|
1478
1479
|
}
|
|
1479
|
-
_createAnimationTracks(e, t, o,
|
|
1480
|
-
const
|
|
1480
|
+
_createAnimationTracks(e, t, o, s, r) {
|
|
1481
|
+
const n = [], a = e.name ? e.name : e.uuid, i = [];
|
|
1481
1482
|
k[r.path] === k.weights ? e.traverse(function(f) {
|
|
1482
1483
|
f.morphTargetInfluences && i.push(f.name ? f.name : f.uuid);
|
|
1483
1484
|
}) : i.push(a);
|
|
@@ -1506,7 +1507,7 @@ class sn {
|
|
|
1506
1507
|
}
|
|
1507
1508
|
break;
|
|
1508
1509
|
}
|
|
1509
|
-
const u =
|
|
1510
|
+
const u = s.interpolation !== void 0 ? Jt[s.interpolation] : ke, l = this._getArrayFromAccessor(o);
|
|
1510
1511
|
for (let f = 0, m = i.length; f < m; f++) {
|
|
1511
1512
|
const T = new c(
|
|
1512
1513
|
i[f] + "." + k[r.path],
|
|
@@ -1514,38 +1515,38 @@ class sn {
|
|
|
1514
1515
|
l,
|
|
1515
1516
|
u
|
|
1516
1517
|
);
|
|
1517
|
-
|
|
1518
|
+
s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), n.push(T);
|
|
1518
1519
|
}
|
|
1519
|
-
return
|
|
1520
|
+
return n;
|
|
1520
1521
|
}
|
|
1521
1522
|
_getArrayFromAccessor(e) {
|
|
1522
1523
|
let t = e.array;
|
|
1523
1524
|
if (e.normalized) {
|
|
1524
|
-
const o = ie(t.constructor),
|
|
1525
|
-
for (let r = 0,
|
|
1526
|
-
|
|
1527
|
-
t =
|
|
1525
|
+
const o = ie(t.constructor), s = new Float32Array(t.length);
|
|
1526
|
+
for (let r = 0, n = t.length; r < n; r++)
|
|
1527
|
+
s[r] = t[r] * o;
|
|
1528
|
+
t = s;
|
|
1528
1529
|
}
|
|
1529
1530
|
return t;
|
|
1530
1531
|
}
|
|
1531
1532
|
_createCubicSplineTrackInterpolant(e) {
|
|
1532
1533
|
e.createInterpolant = function(o) {
|
|
1533
|
-
const
|
|
1534
|
-
return new
|
|
1534
|
+
const s = this instanceof me ? Yt : Ue;
|
|
1535
|
+
return new s(this.times, this.values, this.getValueSize() / 3, o);
|
|
1535
1536
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1536
1537
|
}
|
|
1537
1538
|
}
|
|
1538
1539
|
function rn(d, e, t) {
|
|
1539
|
-
const o = e.attributes,
|
|
1540
|
+
const o = e.attributes, s = new yt();
|
|
1540
1541
|
if (o.POSITION !== void 0) {
|
|
1541
1542
|
const a = t.json.accessors[o.POSITION], i = a.min, c = a.max;
|
|
1542
1543
|
if (i !== void 0 && c !== void 0) {
|
|
1543
|
-
if (
|
|
1544
|
+
if (s.set(
|
|
1544
1545
|
new B(i[0], i[1], i[2]),
|
|
1545
1546
|
new B(c[0], c[1], c[2])
|
|
1546
1547
|
), a.normalized) {
|
|
1547
1548
|
const u = ie(j[a.componentType]);
|
|
1548
|
-
|
|
1549
|
+
s.min.multiplyScalar(u), s.max.multiplyScalar(u);
|
|
1549
1550
|
}
|
|
1550
1551
|
} else {
|
|
1551
1552
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1562,38 +1563,38 @@ function rn(d, e, t) {
|
|
|
1562
1563
|
const f = t.json.accessors[l.POSITION], m = f.min, T = f.max;
|
|
1563
1564
|
if (m !== void 0 && T !== void 0) {
|
|
1564
1565
|
if (i.setX(Math.max(Math.abs(m[0]), Math.abs(T[0]))), i.setY(Math.max(Math.abs(m[1]), Math.abs(T[1]))), i.setZ(Math.max(Math.abs(m[2]), Math.abs(T[2]))), f.normalized) {
|
|
1565
|
-
const
|
|
1566
|
-
i.multiplyScalar(
|
|
1566
|
+
const R = ie(j[f.componentType]);
|
|
1567
|
+
i.multiplyScalar(R);
|
|
1567
1568
|
}
|
|
1568
1569
|
a.max(i);
|
|
1569
1570
|
} else
|
|
1570
1571
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1571
1572
|
}
|
|
1572
1573
|
}
|
|
1573
|
-
|
|
1574
|
+
s.expandByVector(a);
|
|
1574
1575
|
}
|
|
1575
|
-
d.boundingBox =
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1576
|
+
d.boundingBox = s;
|
|
1577
|
+
const n = new xt();
|
|
1578
|
+
s.getCenter(n.center), n.radius = s.min.distanceTo(s.max) / 2, d.boundingSphere = n;
|
|
1578
1579
|
}
|
|
1579
1580
|
function Se(d, e, t) {
|
|
1580
|
-
const o = e.attributes,
|
|
1581
|
-
function r(
|
|
1582
|
-
return t.getDependency("accessor",
|
|
1581
|
+
const o = e.attributes, s = [];
|
|
1582
|
+
function r(n, a) {
|
|
1583
|
+
return t.getDependency("accessor", n).then(function(i) {
|
|
1583
1584
|
d.setAttribute(a, i);
|
|
1584
1585
|
});
|
|
1585
1586
|
}
|
|
1586
|
-
for (const
|
|
1587
|
-
const a = oe[
|
|
1588
|
-
a in d.attributes ||
|
|
1587
|
+
for (const n in o) {
|
|
1588
|
+
const a = oe[n] || n.toLowerCase();
|
|
1589
|
+
a in d.attributes || s.push(r(o[n], a));
|
|
1589
1590
|
}
|
|
1590
1591
|
if (e.indices !== void 0 && !d.index) {
|
|
1591
|
-
const
|
|
1592
|
+
const n = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1592
1593
|
d.setIndex(a);
|
|
1593
1594
|
});
|
|
1594
|
-
|
|
1595
|
+
s.push(n);
|
|
1595
1596
|
}
|
|
1596
|
-
return ge.workingColorSpace !== D && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ge.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(
|
|
1597
|
+
return ge.workingColorSpace !== D && "COLOR_0" in o && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ge.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(s).then(function() {
|
|
1597
1598
|
return e.targets !== void 0 ? Zt(d, e.targets, t) : d;
|
|
1598
1599
|
});
|
|
1599
1600
|
}
|
|
@@ -1601,26 +1602,26 @@ class on {
|
|
|
1601
1602
|
parse(e) {
|
|
1602
1603
|
const t = {}, o = e.split(`
|
|
1603
1604
|
`);
|
|
1604
|
-
let
|
|
1605
|
-
const
|
|
1605
|
+
let s = null, r = t;
|
|
1606
|
+
const n = [t];
|
|
1606
1607
|
for (const a of o)
|
|
1607
1608
|
if (a.includes("=")) {
|
|
1608
1609
|
const i = a.split("="), c = i[0].trim(), u = i[1].trim();
|
|
1609
1610
|
if (u.endsWith("{")) {
|
|
1610
1611
|
const l = {};
|
|
1611
|
-
|
|
1612
|
+
n.push(l), r[c] = l, r = l;
|
|
1612
1613
|
} else
|
|
1613
1614
|
r[c] = u;
|
|
1614
1615
|
} else if (a.endsWith("{")) {
|
|
1615
|
-
const i = r[
|
|
1616
|
-
|
|
1616
|
+
const i = r[s] || {};
|
|
1617
|
+
n.push(i), r[s] = i, r = i;
|
|
1617
1618
|
} else if (a.endsWith("}")) {
|
|
1618
|
-
if (
|
|
1619
|
-
r =
|
|
1619
|
+
if (n.pop(), n.length === 0) continue;
|
|
1620
|
+
r = n[n.length - 1];
|
|
1620
1621
|
} else if (a.endsWith("(")) {
|
|
1621
1622
|
const i = {};
|
|
1622
|
-
|
|
1623
|
-
} else a.endsWith(")") ? (
|
|
1623
|
+
n.push(i), s = a.split("(")[0].trim() || s, r[s] = i, r = i;
|
|
1624
|
+
} else a.endsWith(")") ? (n.pop(), r = n[n.length - 1]) : s = a.trim();
|
|
1624
1625
|
return t;
|
|
1625
1626
|
}
|
|
1626
1627
|
}
|
|
@@ -1628,15 +1629,15 @@ class an extends ae {
|
|
|
1628
1629
|
constructor(e) {
|
|
1629
1630
|
super(e);
|
|
1630
1631
|
}
|
|
1631
|
-
load(e, t, o,
|
|
1632
|
-
const r = this,
|
|
1633
|
-
|
|
1632
|
+
load(e, t, o, s) {
|
|
1633
|
+
const r = this, n = new K(r.manager);
|
|
1634
|
+
n.setPath(r.path), n.setResponseType("arraybuffer"), n.setRequestHeader(r.requestHeader), n.setWithCredentials(r.withCredentials), n.load(e, function(a) {
|
|
1634
1635
|
try {
|
|
1635
1636
|
t(r.parse(a));
|
|
1636
1637
|
} catch (i) {
|
|
1637
|
-
|
|
1638
|
+
s ? s(i) : console.error(i), r.manager.itemError(e);
|
|
1638
1639
|
}
|
|
1639
|
-
}, o,
|
|
1640
|
+
}, o, s);
|
|
1640
1641
|
}
|
|
1641
1642
|
parse(e) {
|
|
1642
1643
|
const t = new on();
|
|
@@ -1649,7 +1650,7 @@ class an extends ae {
|
|
|
1649
1650
|
p[A] = URL.createObjectURL(w);
|
|
1650
1651
|
}
|
|
1651
1652
|
if (A.endsWith("usd") || A.endsWith("usda")) {
|
|
1652
|
-
if (
|
|
1653
|
+
if (s(h[A])) {
|
|
1653
1654
|
console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1654
1655
|
continue;
|
|
1655
1656
|
}
|
|
@@ -1659,7 +1660,7 @@ class an extends ae {
|
|
|
1659
1660
|
}
|
|
1660
1661
|
return p;
|
|
1661
1662
|
}
|
|
1662
|
-
function
|
|
1663
|
+
function s(h) {
|
|
1663
1664
|
const p = h.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
|
|
1664
1665
|
return p.every((A, w) => A === g[w]);
|
|
1665
1666
|
}
|
|
@@ -1671,13 +1672,13 @@ class an extends ae {
|
|
|
1671
1672
|
if (p.endsWith("usdc"))
|
|
1672
1673
|
g = !0;
|
|
1673
1674
|
else if (p.endsWith("usd"))
|
|
1674
|
-
if (
|
|
1675
|
+
if (s(h[p]))
|
|
1675
1676
|
g = !0;
|
|
1676
1677
|
else
|
|
1677
1678
|
return h[p];
|
|
1678
1679
|
g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1679
1680
|
}
|
|
1680
|
-
const
|
|
1681
|
+
const n = Rt(new Uint8Array(e)), a = o(n), i = r(n);
|
|
1681
1682
|
if (i === void 0)
|
|
1682
1683
|
return console.warn("THREE.USDZLoader: No usda file found."), new z();
|
|
1683
1684
|
const c = Ae(i), u = t.parse(c);
|
|
@@ -1745,7 +1746,7 @@ class an extends ae {
|
|
|
1745
1746
|
}
|
|
1746
1747
|
return new P(w, A);
|
|
1747
1748
|
}
|
|
1748
|
-
function
|
|
1749
|
+
function R(h) {
|
|
1749
1750
|
if (h) {
|
|
1750
1751
|
if ("rel material:binding" in h) {
|
|
1751
1752
|
const A = h["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
|
|
@@ -1765,7 +1766,7 @@ class an extends ae {
|
|
|
1765
1766
|
}
|
|
1766
1767
|
}
|
|
1767
1768
|
}
|
|
1768
|
-
function
|
|
1769
|
+
function x(h, p) {
|
|
1769
1770
|
p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new q().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (h.offset = new q().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
|
|
1770
1771
|
}
|
|
1771
1772
|
function E(h) {
|
|
@@ -1775,41 +1776,41 @@ class an extends ae {
|
|
|
1775
1776
|
const g = h['def Shader "PreviewSurface"'];
|
|
1776
1777
|
if ("color3f inputs:diffuseColor.connect" in g) {
|
|
1777
1778
|
const A = g["color3f inputs:diffuseColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1778
|
-
p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h &&
|
|
1779
|
+
p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h && x(p.map, h['def Shader "Transform2d_diffuse"']);
|
|
1779
1780
|
} else if ("color3f inputs:diffuseColor" in g) {
|
|
1780
1781
|
const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
|
|
1781
1782
|
p.color.fromArray(JSON.parse("[" + A + "]"));
|
|
1782
1783
|
}
|
|
1783
1784
|
if ("color3f inputs:emissiveColor.connect" in g) {
|
|
1784
1785
|
const A = g["color3f inputs:emissiveColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1785
|
-
p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h &&
|
|
1786
|
+
p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && x(p.emissiveMap, h['def Shader "Transform2d_emissive"']);
|
|
1786
1787
|
} else if ("color3f inputs:emissiveColor" in g) {
|
|
1787
1788
|
const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
|
|
1788
1789
|
p.emissive.fromArray(JSON.parse("[" + A + "]"));
|
|
1789
1790
|
}
|
|
1790
1791
|
if ("normal3f inputs:normal.connect" in g) {
|
|
1791
1792
|
const A = g["normal3f inputs:normal.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1792
|
-
p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h &&
|
|
1793
|
+
p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && x(p.normalMap, h['def Shader "Transform2d_normal"']);
|
|
1793
1794
|
}
|
|
1794
1795
|
if ("float inputs:roughness.connect" in g) {
|
|
1795
1796
|
const A = g["float inputs:roughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1796
|
-
p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h &&
|
|
1797
|
+
p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && x(p.roughnessMap, h['def Shader "Transform2d_roughness"']);
|
|
1797
1798
|
} else "float inputs:roughness" in g && (p.roughness = parseFloat(g["float inputs:roughness"]));
|
|
1798
1799
|
if ("float inputs:metallic.connect" in g) {
|
|
1799
1800
|
const A = g["float inputs:metallic.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1800
|
-
p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h &&
|
|
1801
|
+
p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && x(p.metalnessMap, h['def Shader "Transform2d_metallic"']);
|
|
1801
1802
|
} else "float inputs:metallic" in g && (p.metalness = parseFloat(g["float inputs:metallic"]));
|
|
1802
1803
|
if ("float inputs:clearcoat.connect" in g) {
|
|
1803
1804
|
const A = g["float inputs:clearcoat.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1804
|
-
p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h &&
|
|
1805
|
+
p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && x(p.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
|
|
1805
1806
|
} else "float inputs:clearcoat" in g && (p.clearcoat = parseFloat(g["float inputs:clearcoat"]));
|
|
1806
1807
|
if ("float inputs:clearcoatRoughness.connect" in g) {
|
|
1807
1808
|
const A = g["float inputs:clearcoatRoughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1808
|
-
p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h &&
|
|
1809
|
+
p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && x(p.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
|
|
1809
1810
|
} else "float inputs:clearcoatRoughness" in g && (p.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
|
|
1810
1811
|
if ("float inputs:ior" in g && (p.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
|
|
1811
1812
|
const A = g["float inputs:occlusion.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1812
|
-
p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h &&
|
|
1813
|
+
p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && x(p.aoMap, h['def Shader "Transform2d_occlusion"']);
|
|
1813
1814
|
}
|
|
1814
1815
|
}
|
|
1815
1816
|
if ('def Shader "diffuseColor_texture"' in h) {
|
|
@@ -1846,7 +1847,7 @@ class an extends ae {
|
|
|
1846
1847
|
return null;
|
|
1847
1848
|
}
|
|
1848
1849
|
function M(h) {
|
|
1849
|
-
const p = m(l(h)), g = E(
|
|
1850
|
+
const p = m(l(h)), g = E(R(h)), A = p ? new Pe(p, g) : new ce();
|
|
1850
1851
|
if ("matrix4d xformOp:transform" in h) {
|
|
1851
1852
|
const w = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
|
|
1852
1853
|
A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
|
|
@@ -1890,25 +1891,25 @@ class cn extends ae {
|
|
|
1890
1891
|
setWorkerLimit(e) {
|
|
1891
1892
|
return this.workerLimit = e, this;
|
|
1892
1893
|
}
|
|
1893
|
-
load(e, t, o,
|
|
1894
|
+
load(e, t, o, s) {
|
|
1894
1895
|
const r = new K(this.manager);
|
|
1895
|
-
r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (
|
|
1896
|
-
this.parse(
|
|
1897
|
-
}, o,
|
|
1896
|
+
r.setPath(this.path), r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setWithCredentials(this.withCredentials), r.load(e, (n) => {
|
|
1897
|
+
this.parse(n, t, s);
|
|
1898
|
+
}, o, s);
|
|
1898
1899
|
}
|
|
1899
1900
|
parse(e, t, o = () => {
|
|
1900
1901
|
}) {
|
|
1901
1902
|
this.decodeDracoFile(e, t, null, null, N).catch(o);
|
|
1902
1903
|
}
|
|
1903
|
-
decodeDracoFile(e, t, o,
|
|
1904
|
+
decodeDracoFile(e, t, o, s, r = D, n = () => {
|
|
1904
1905
|
}) {
|
|
1905
1906
|
const a = {
|
|
1906
1907
|
attributeIDs: o || this.defaultAttributeIDs,
|
|
1907
|
-
attributeTypes:
|
|
1908
|
+
attributeTypes: s || this.defaultAttributeTypes,
|
|
1908
1909
|
useUniqueIDs: !!o,
|
|
1909
1910
|
vertexColorSpace: r
|
|
1910
1911
|
};
|
|
1911
|
-
return this.decodeGeometry(e, a).then(t).catch(
|
|
1912
|
+
return this.decodeGeometry(e, a).then(t).catch(n);
|
|
1912
1913
|
}
|
|
1913
1914
|
decodeGeometry(e, t) {
|
|
1914
1915
|
const o = JSON.stringify(t);
|
|
@@ -1921,12 +1922,12 @@ class cn extends ae {
|
|
|
1921
1922
|
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
1922
1923
|
);
|
|
1923
1924
|
}
|
|
1924
|
-
let
|
|
1925
|
-
const r = this.workerNextTaskID++,
|
|
1926
|
-
|
|
1925
|
+
let s;
|
|
1926
|
+
const r = this.workerNextTaskID++, n = e.byteLength, a = this._getWorker(r, n).then((i) => (s = i, new Promise((c, u) => {
|
|
1927
|
+
s._callbacks[r] = { resolve: c, reject: u }, s.postMessage({ type: "decode", id: r, taskConfig: t, buffer: e }, [e]);
|
|
1927
1928
|
}))).then((i) => this._createGeometry(i.geometry));
|
|
1928
1929
|
return a.catch(() => !0).then(() => {
|
|
1929
|
-
|
|
1930
|
+
s && r && this._releaseTask(s, r);
|
|
1930
1931
|
}), ne.set(e, {
|
|
1931
1932
|
key: o,
|
|
1932
1933
|
promise: a
|
|
@@ -1936,21 +1937,21 @@ class cn extends ae {
|
|
|
1936
1937
|
const t = new ue();
|
|
1937
1938
|
e.index && t.setIndex(new P(e.index.array, 1));
|
|
1938
1939
|
for (let o = 0; o < e.attributes.length; o++) {
|
|
1939
|
-
const
|
|
1940
|
-
r === "color" && (this._assignVertexColorSpace(i,
|
|
1940
|
+
const s = e.attributes[o], r = s.name, n = s.array, a = s.itemSize, i = new P(n, a);
|
|
1941
|
+
r === "color" && (this._assignVertexColorSpace(i, s.vertexColorSpace), i.normalized = !(n instanceof Float32Array)), t.setAttribute(r, i);
|
|
1941
1942
|
}
|
|
1942
1943
|
return t;
|
|
1943
1944
|
}
|
|
1944
1945
|
_assignVertexColorSpace(e, t) {
|
|
1945
1946
|
if (t !== N) return;
|
|
1946
1947
|
const o = new U();
|
|
1947
|
-
for (let
|
|
1948
|
-
o.fromBufferAttribute(e,
|
|
1948
|
+
for (let s = 0, r = e.count; s < r; s++)
|
|
1949
|
+
o.fromBufferAttribute(e, s).convertSRGBToLinear(), e.setXYZ(s, o.r, o.g, o.b);
|
|
1949
1950
|
}
|
|
1950
1951
|
_loadLibrary(e, t) {
|
|
1951
1952
|
const o = new K(this.manager);
|
|
1952
|
-
return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((
|
|
1953
|
-
o.load(e,
|
|
1953
|
+
return o.setPath(this.decoderPath), o.setResponseType(t), o.setWithCredentials(this.withCredentials), new Promise((s, r) => {
|
|
1954
|
+
o.load(e, s, void 0, r);
|
|
1954
1955
|
});
|
|
1955
1956
|
}
|
|
1956
1957
|
preload() {
|
|
@@ -1960,39 +1961,39 @@ class cn extends ae {
|
|
|
1960
1961
|
if (this.decoderPending) return this.decoderPending;
|
|
1961
1962
|
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
1962
1963
|
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((o) => {
|
|
1963
|
-
const
|
|
1964
|
+
const s = o[0];
|
|
1964
1965
|
e || (this.decoderConfig.wasmBinary = o[1]);
|
|
1965
|
-
const r = un.toString(),
|
|
1966
|
+
const r = un.toString(), n = [
|
|
1966
1967
|
"/* draco decoder */",
|
|
1967
|
-
|
|
1968
|
+
s,
|
|
1968
1969
|
"",
|
|
1969
1970
|
"/* worker */",
|
|
1970
1971
|
r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
|
|
1971
1972
|
].join(`
|
|
1972
1973
|
`);
|
|
1973
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([
|
|
1974
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([n]));
|
|
1974
1975
|
}), this.decoderPending;
|
|
1975
1976
|
}
|
|
1976
1977
|
_getWorker(e, t) {
|
|
1977
1978
|
return this._initDecoder().then(() => {
|
|
1978
1979
|
if (this.workerPool.length < this.workerLimit) {
|
|
1979
|
-
const
|
|
1980
|
-
|
|
1981
|
-
const
|
|
1982
|
-
switch (
|
|
1980
|
+
const s = new Worker(this.workerSourceURL);
|
|
1981
|
+
s._callbacks = {}, s._taskCosts = {}, s._taskLoad = 0, s.postMessage({ type: "init", decoderConfig: this.decoderConfig }), s.onmessage = function(r) {
|
|
1982
|
+
const n = r.data;
|
|
1983
|
+
switch (n.type) {
|
|
1983
1984
|
case "decode":
|
|
1984
|
-
|
|
1985
|
+
s._callbacks[n.id].resolve(n);
|
|
1985
1986
|
break;
|
|
1986
1987
|
case "error":
|
|
1987
|
-
|
|
1988
|
+
s._callbacks[n.id].reject(n);
|
|
1988
1989
|
break;
|
|
1989
1990
|
default:
|
|
1990
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' +
|
|
1991
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + n.type + '"');
|
|
1991
1992
|
}
|
|
1992
|
-
}, this.workerPool.push(
|
|
1993
|
+
}, this.workerPool.push(s);
|
|
1993
1994
|
} else
|
|
1994
|
-
this.workerPool.sort(function(
|
|
1995
|
-
return
|
|
1995
|
+
this.workerPool.sort(function(s, r) {
|
|
1996
|
+
return s._taskLoad > r._taskLoad ? -1 : 1;
|
|
1996
1997
|
});
|
|
1997
1998
|
const o = this.workerPool[this.workerPool.length - 1];
|
|
1998
1999
|
return o._taskCosts[e] = t, o._taskLoad += t, o;
|
|
@@ -2012,8 +2013,8 @@ class cn extends ae {
|
|
|
2012
2013
|
}
|
|
2013
2014
|
function un() {
|
|
2014
2015
|
let d, e;
|
|
2015
|
-
onmessage = function(
|
|
2016
|
-
const a =
|
|
2016
|
+
onmessage = function(n) {
|
|
2017
|
+
const a = n.data;
|
|
2017
2018
|
switch (a.type) {
|
|
2018
2019
|
case "init":
|
|
2019
2020
|
d = a.decoderConfig, e = new Promise(function(u) {
|
|
@@ -2027,7 +2028,7 @@ function un() {
|
|
|
2027
2028
|
e.then((u) => {
|
|
2028
2029
|
const l = u.draco, f = new l.Decoder();
|
|
2029
2030
|
try {
|
|
2030
|
-
const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((
|
|
2031
|
+
const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((R) => R.array.buffer);
|
|
2031
2032
|
m.index && T.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, T);
|
|
2032
2033
|
} catch (m) {
|
|
2033
2034
|
console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
|
|
@@ -2038,72 +2039,72 @@ function un() {
|
|
|
2038
2039
|
break;
|
|
2039
2040
|
}
|
|
2040
2041
|
};
|
|
2041
|
-
function t(
|
|
2042
|
+
function t(n, a, i, c) {
|
|
2042
2043
|
const u = c.attributeIDs, l = c.attributeTypes;
|
|
2043
2044
|
let f, m;
|
|
2044
2045
|
const T = a.GetEncodedGeometryType(i);
|
|
2045
|
-
if (T ===
|
|
2046
|
-
f = new
|
|
2047
|
-
else if (T ===
|
|
2048
|
-
f = new
|
|
2046
|
+
if (T === n.TRIANGULAR_MESH)
|
|
2047
|
+
f = new n.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
|
|
2048
|
+
else if (T === n.POINT_CLOUD)
|
|
2049
|
+
f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
|
|
2049
2050
|
else
|
|
2050
2051
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2051
2052
|
if (!m.ok() || f.ptr === 0)
|
|
2052
2053
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
|
|
2053
|
-
const
|
|
2054
|
+
const R = { index: null, attributes: [] };
|
|
2054
2055
|
for (const y in u) {
|
|
2055
|
-
const
|
|
2056
|
+
const x = self[l[y]];
|
|
2056
2057
|
let E, S;
|
|
2057
2058
|
if (c.useUniqueIDs)
|
|
2058
2059
|
S = u[y], E = a.GetAttributeByUniqueId(f, S);
|
|
2059
2060
|
else {
|
|
2060
|
-
if (S = a.GetAttributeId(f,
|
|
2061
|
+
if (S = a.GetAttributeId(f, n[u[y]]), S === -1) continue;
|
|
2061
2062
|
E = a.GetAttribute(f, S);
|
|
2062
2063
|
}
|
|
2063
|
-
const _ = n
|
|
2064
|
-
y === "color" && (_.vertexColorSpace = c.vertexColorSpace),
|
|
2064
|
+
const _ = s(n, a, f, y, x, E);
|
|
2065
|
+
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
|
|
2065
2066
|
}
|
|
2066
|
-
return T ===
|
|
2067
|
+
return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
|
|
2067
2068
|
}
|
|
2068
|
-
function o(
|
|
2069
|
-
const u = i.num_faces() * 3, l = u * 4, f =
|
|
2069
|
+
function o(n, a, i) {
|
|
2070
|
+
const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
|
|
2070
2071
|
a.GetTrianglesUInt32Array(i, l, f);
|
|
2071
|
-
const m = new Uint32Array(
|
|
2072
|
-
return
|
|
2073
|
-
}
|
|
2074
|
-
function n
|
|
2075
|
-
const f = l.num_components(), T = i.num_points() * f,
|
|
2076
|
-
a.GetAttributeDataArrayForAllPoints(i, l, y,
|
|
2077
|
-
const E = new u(
|
|
2078
|
-
return
|
|
2072
|
+
const m = new Uint32Array(n.HEAPF32.buffer, f, u).slice();
|
|
2073
|
+
return n._free(f), { array: m, itemSize: 1 };
|
|
2074
|
+
}
|
|
2075
|
+
function s(n, a, i, c, u, l) {
|
|
2076
|
+
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
|
|
2077
|
+
a.GetAttributeDataArrayForAllPoints(i, l, y, R, x);
|
|
2078
|
+
const E = new u(n.HEAPF32.buffer, x, T).slice();
|
|
2079
|
+
return n._free(x), {
|
|
2079
2080
|
name: c,
|
|
2080
2081
|
array: E,
|
|
2081
2082
|
itemSize: f
|
|
2082
2083
|
};
|
|
2083
2084
|
}
|
|
2084
|
-
function r(
|
|
2085
|
+
function r(n, a) {
|
|
2085
2086
|
switch (a) {
|
|
2086
2087
|
case Float32Array:
|
|
2087
|
-
return
|
|
2088
|
+
return n.DT_FLOAT32;
|
|
2088
2089
|
case Int8Array:
|
|
2089
|
-
return
|
|
2090
|
+
return n.DT_INT8;
|
|
2090
2091
|
case Int16Array:
|
|
2091
|
-
return
|
|
2092
|
+
return n.DT_INT16;
|
|
2092
2093
|
case Int32Array:
|
|
2093
|
-
return
|
|
2094
|
+
return n.DT_INT32;
|
|
2094
2095
|
case Uint8Array:
|
|
2095
|
-
return
|
|
2096
|
+
return n.DT_UINT8;
|
|
2096
2097
|
case Uint16Array:
|
|
2097
|
-
return
|
|
2098
|
+
return n.DT_UINT16;
|
|
2098
2099
|
case Uint32Array:
|
|
2099
|
-
return
|
|
2100
|
+
return n.DT_UINT32;
|
|
2100
2101
|
}
|
|
2101
2102
|
}
|
|
2102
2103
|
}
|
|
2103
2104
|
function ln() {
|
|
2104
2105
|
let d, e;
|
|
2105
|
-
onmessage = function(
|
|
2106
|
-
const a =
|
|
2106
|
+
onmessage = function(n) {
|
|
2107
|
+
const a = n.data;
|
|
2107
2108
|
switch (a.type) {
|
|
2108
2109
|
case "init":
|
|
2109
2110
|
d = a.decoderConfig, e = new Promise(function(u) {
|
|
@@ -2123,7 +2124,7 @@ function ln() {
|
|
|
2123
2124
|
new Int8Array(i),
|
|
2124
2125
|
c
|
|
2125
2126
|
), T = m.attributes.map(
|
|
2126
|
-
(
|
|
2127
|
+
(R) => R.array.buffer
|
|
2127
2128
|
);
|
|
2128
2129
|
m.index && T.push(m.index.array.buffer), self.postMessage(
|
|
2129
2130
|
{ type: "decode", id: a.id, geometry: m },
|
|
@@ -2142,18 +2143,18 @@ function ln() {
|
|
|
2142
2143
|
break;
|
|
2143
2144
|
}
|
|
2144
2145
|
};
|
|
2145
|
-
function t(
|
|
2146
|
+
function t(n, a, i, c) {
|
|
2146
2147
|
const u = c.attributeIDs, l = c.attributeTypes;
|
|
2147
2148
|
let f, m;
|
|
2148
2149
|
const T = a.GetEncodedGeometryType(i);
|
|
2149
|
-
if (T ===
|
|
2150
|
-
f = new
|
|
2150
|
+
if (T === n.TRIANGULAR_MESH)
|
|
2151
|
+
f = new n.Mesh(), m = a.DecodeArrayToMesh(
|
|
2151
2152
|
i,
|
|
2152
2153
|
i.byteLength,
|
|
2153
2154
|
f
|
|
2154
2155
|
);
|
|
2155
|
-
else if (T ===
|
|
2156
|
-
f = new
|
|
2156
|
+
else if (T === n.POINT_CLOUD)
|
|
2157
|
+
f = new n.PointCloud(), m = a.DecodeArrayToPointCloud(
|
|
2157
2158
|
i,
|
|
2158
2159
|
i.byteLength,
|
|
2159
2160
|
f
|
|
@@ -2164,9 +2165,9 @@ function ln() {
|
|
|
2164
2165
|
throw new Error(
|
|
2165
2166
|
"THREE.DRACOLoader: Decoding failed: " + m.error_msg()
|
|
2166
2167
|
);
|
|
2167
|
-
const
|
|
2168
|
+
const R = { index: null, attributes: [] };
|
|
2168
2169
|
for (const y in u) {
|
|
2169
|
-
const
|
|
2170
|
+
const x = self[l[y]];
|
|
2170
2171
|
let E, S;
|
|
2171
2172
|
if (c.useUniqueIDs)
|
|
2172
2173
|
S = u[y], E = a.GetAttributeByUniqueId(
|
|
@@ -2176,68 +2177,68 @@ function ln() {
|
|
|
2176
2177
|
else {
|
|
2177
2178
|
if (S = a.GetAttributeId(
|
|
2178
2179
|
f,
|
|
2179
|
-
|
|
2180
|
+
n[u[y]]
|
|
2180
2181
|
), S === -1) continue;
|
|
2181
2182
|
E = a.GetAttribute(f, S);
|
|
2182
2183
|
}
|
|
2183
|
-
const _ =
|
|
2184
|
-
|
|
2184
|
+
const _ = s(
|
|
2185
|
+
n,
|
|
2185
2186
|
a,
|
|
2186
2187
|
f,
|
|
2187
2188
|
y,
|
|
2188
|
-
|
|
2189
|
+
x,
|
|
2189
2190
|
E
|
|
2190
2191
|
);
|
|
2191
|
-
y === "color" && (_.vertexColorSpace = c.vertexColorSpace),
|
|
2192
|
+
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
|
|
2192
2193
|
}
|
|
2193
|
-
return T ===
|
|
2194
|
+
return T === n.TRIANGULAR_MESH && (R.index = o(n, a, f)), n.destroy(f), R;
|
|
2194
2195
|
}
|
|
2195
|
-
function o(
|
|
2196
|
-
const u = i.num_faces() * 3, l = u * 4, f =
|
|
2196
|
+
function o(n, a, i) {
|
|
2197
|
+
const u = i.num_faces() * 3, l = u * 4, f = n._malloc(l);
|
|
2197
2198
|
a.GetTrianglesUInt32Array(i, l, f);
|
|
2198
2199
|
const m = new Uint32Array(
|
|
2199
|
-
|
|
2200
|
+
n.HEAPF32.buffer,
|
|
2200
2201
|
f,
|
|
2201
2202
|
u
|
|
2202
2203
|
).slice();
|
|
2203
|
-
return
|
|
2204
|
+
return n._free(f), { array: m, itemSize: 1 };
|
|
2204
2205
|
}
|
|
2205
|
-
function n
|
|
2206
|
-
const f = l.num_components(), T = i.num_points() * f,
|
|
2206
|
+
function s(n, a, i, c, u, l) {
|
|
2207
|
+
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = r(n, u), x = n._malloc(R);
|
|
2207
2208
|
a.GetAttributeDataArrayForAllPoints(
|
|
2208
2209
|
i,
|
|
2209
2210
|
l,
|
|
2210
2211
|
y,
|
|
2211
|
-
|
|
2212
|
-
|
|
2212
|
+
R,
|
|
2213
|
+
x
|
|
2213
2214
|
);
|
|
2214
2215
|
const E = new u(
|
|
2215
|
-
|
|
2216
|
-
|
|
2216
|
+
n.HEAPF32.buffer,
|
|
2217
|
+
x,
|
|
2217
2218
|
T
|
|
2218
2219
|
).slice();
|
|
2219
|
-
return
|
|
2220
|
+
return n._free(x), {
|
|
2220
2221
|
name: c,
|
|
2221
2222
|
array: E,
|
|
2222
2223
|
itemSize: f
|
|
2223
2224
|
};
|
|
2224
2225
|
}
|
|
2225
|
-
function r(
|
|
2226
|
+
function r(n, a) {
|
|
2226
2227
|
switch (a) {
|
|
2227
2228
|
case Float32Array:
|
|
2228
|
-
return
|
|
2229
|
+
return n.DT_FLOAT32;
|
|
2229
2230
|
case Int8Array:
|
|
2230
|
-
return
|
|
2231
|
+
return n.DT_INT8;
|
|
2231
2232
|
case Int16Array:
|
|
2232
|
-
return
|
|
2233
|
+
return n.DT_INT16;
|
|
2233
2234
|
case Int32Array:
|
|
2234
|
-
return
|
|
2235
|
+
return n.DT_INT32;
|
|
2235
2236
|
case Uint8Array:
|
|
2236
|
-
return
|
|
2237
|
+
return n.DT_UINT8;
|
|
2237
2238
|
case Uint16Array:
|
|
2238
|
-
return
|
|
2239
|
+
return n.DT_UINT16;
|
|
2239
2240
|
case Uint32Array:
|
|
2240
|
-
return
|
|
2241
|
+
return n.DT_UINT32;
|
|
2241
2242
|
}
|
|
2242
2243
|
}
|
|
2243
2244
|
}
|
|
@@ -2269,15 +2270,15 @@ class fn extends cn {
|
|
|
2269
2270
|
), o.push(
|
|
2270
2271
|
se.LOAD_DRACO_WASM_DECODER()
|
|
2271
2272
|
)), this.decoderPending = Promise.all(o).then(
|
|
2272
|
-
(
|
|
2273
|
-
const r =
|
|
2274
|
-
t || (this.decoderConfig.wasmBinary =
|
|
2275
|
-
const
|
|
2273
|
+
(s) => {
|
|
2274
|
+
const r = s[0];
|
|
2275
|
+
t || (this.decoderConfig.wasmBinary = s[1]);
|
|
2276
|
+
const n = ln.toString(), a = [
|
|
2276
2277
|
"/* draco decoder */",
|
|
2277
2278
|
r,
|
|
2278
2279
|
"",
|
|
2279
2280
|
"/* worker */",
|
|
2280
|
-
|
|
2281
|
+
n.substring(n.indexOf("{") + 1, n.lastIndexOf("}"))
|
|
2281
2282
|
].join(`
|
|
2282
2283
|
`);
|
|
2283
2284
|
this.workerSourceURL = URL.createObjectURL(new Blob([a]));
|
|
@@ -2285,54 +2286,56 @@ class fn extends cn {
|
|
|
2285
2286
|
), this.decoderPending;
|
|
2286
2287
|
}
|
|
2287
2288
|
}
|
|
2288
|
-
class
|
|
2289
|
+
class yn {
|
|
2289
2290
|
constructor() {
|
|
2290
2291
|
v(this, "_gltfLoader");
|
|
2291
2292
|
v(this, "_usdzLoader");
|
|
2292
2293
|
const e = new fn();
|
|
2293
2294
|
e.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new St(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new an();
|
|
2294
2295
|
}
|
|
2295
|
-
async _loadFile(e) {
|
|
2296
|
-
const t = await fetch(e);
|
|
2297
|
-
if (!t.ok)
|
|
2298
|
-
throw new Te(e, `Failed to fetch file from ${e}`);
|
|
2299
|
-
try {
|
|
2300
|
-
return await t.arrayBuffer();
|
|
2301
|
-
} catch {
|
|
2302
|
-
throw new Te(e, `Failed to fetch file from ${e}`);
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
2296
|
async load(e) {
|
|
2306
2297
|
const t = wt(e);
|
|
2307
2298
|
if (t.length === 0)
|
|
2308
|
-
throw new
|
|
2299
|
+
throw new Te("No file extension found in URI", "");
|
|
2309
2300
|
if (!Et(t))
|
|
2310
|
-
throw new
|
|
2301
|
+
throw new Te(
|
|
2311
2302
|
`Unsupported file type: ${t}. Supported types: ${_t.join(", ")}`,
|
|
2312
2303
|
t
|
|
2313
2304
|
);
|
|
2314
|
-
const o =
|
|
2305
|
+
const o = xe.read(e);
|
|
2306
|
+
if (o)
|
|
2307
|
+
return o.arrayBuffer ? this._parse(o.arrayBuffer, t) : o.promise.then((n) => this._parse(n, t));
|
|
2308
|
+
const r = await xe.create(e).load();
|
|
2309
|
+
return this._parse(r, t);
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* parse function for the chunk
|
|
2313
|
+
* @param arrayBuffer - the array buffer to parse, will be provided within the chunk
|
|
2314
|
+
* @param type - the file type of the array buffer
|
|
2315
|
+
* @returns the parsed object, will be stored within the chunk
|
|
2316
|
+
*/
|
|
2317
|
+
async _parse(e, t) {
|
|
2315
2318
|
try {
|
|
2316
2319
|
switch (t) {
|
|
2317
2320
|
case "glb":
|
|
2318
2321
|
case "gltf":
|
|
2319
2322
|
return (await this._gltfLoader.parseAsync(
|
|
2320
|
-
|
|
2323
|
+
e,
|
|
2321
2324
|
""
|
|
2322
2325
|
)).scene;
|
|
2323
2326
|
case "usdz":
|
|
2324
|
-
return await this._usdzLoader.parse(
|
|
2327
|
+
return await this._usdzLoader.parse(e);
|
|
2325
2328
|
}
|
|
2326
|
-
} catch (
|
|
2327
|
-
throw
|
|
2328
|
-
`Failed to parse ${t} file: ${
|
|
2329
|
-
|
|
2330
|
-
) : new
|
|
2329
|
+
} catch (o) {
|
|
2330
|
+
throw o instanceof Error ? new ye(
|
|
2331
|
+
`Failed to parse ${t} file: ${o.message}`,
|
|
2332
|
+
o
|
|
2333
|
+
) : new ye(`Failed to parse ${t} file`);
|
|
2331
2334
|
}
|
|
2332
2335
|
}
|
|
2333
2336
|
}
|
|
2334
2337
|
export {
|
|
2335
|
-
|
|
2338
|
+
yn as A,
|
|
2336
2339
|
fn as D,
|
|
2337
2340
|
ln as a
|
|
2338
2341
|
};
|