@shopware-ag/dive 2.2.16 → 2.2.18
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/build/chunks/{AssetCache-PycNkZlv.cjs → AssetCache-BElKTasn.cjs} +1 -1
- package/build/chunks/{AssetCache-BkU-YbyI.mjs → AssetCache-DbUJFLZt.mjs} +1 -1
- package/build/chunks/AssetLoader-CT_t_ZfO.cjs +4 -0
- package/build/chunks/{AssetLoader-2zJQGAPS.mjs → AssetLoader-D5zuGw5p.mjs} +705 -677
- package/build/chunks/FileTypes-Bq4uWglF.mjs +2105 -0
- package/build/chunks/FileTypes-Vbu3ti7s.cjs +33 -0
- package/build/chunks/{SelectTool-CwFPCf-b.cjs → SelectTool-4zYuuCRL.cjs} +1 -1
- package/build/chunks/{SelectTool-DujSa1r0.mjs → SelectTool-PaTy0iER.mjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +50 -48
- package/build/engine/Dive.d.ts +6 -0
- package/build/engine/environment/Environment.d.ts +133 -0
- package/build/engine/index.d.ts +1 -0
- package/build/engine/renderer/Renderer.d.ts +3 -0
- package/build/engine/scene/Scene.d.ts +1 -0
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/assetloader/src/loader/AssetLoader.d.ts +8 -1
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +16 -24
- package/build/plugins/quickview/src/QuickView.d.ts +1 -3
- package/build/plugins/quickview/types/QuickViewSettings.d.ts +0 -5
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +2 -2
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +6 -8
- package/build/chunks/AssetLoader-CgeC94PN.cjs +0 -4
- package/build/chunks/FileTypes-Bf3Ffk3D.cjs +0 -29
- package/build/chunks/FileTypes-Qg_Zc7TF.mjs +0 -1802
- package/build/chunks/HDREnvorinment-CP2Uvq4_.cjs +0 -5
- package/build/chunks/HDREnvorinment-DKzwfsKr.mjs +0 -257
- package/build/plugins/hdr/index.cjs +0 -1
- package/build/plugins/hdr/index.d.ts +0 -2
- package/build/plugins/hdr/index.mjs +0 -5
- package/build/plugins/hdr/src/HDREnvorinment.d.ts +0 -35
- package/build/plugins/hdr/src/index.d.ts +0 -1
- package/build/plugins/hdr/types/HDREnvironmentSettings.d.ts +0 -44
- package/build/plugins/hdr/types/index.d.ts +0 -1
|
@@ -1,40 +1,40 @@
|
|
|
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
|
|
5
|
-
import { u as Rt, a as
|
|
6
|
-
import { S as _t } from "./FileTypes-
|
|
4
|
+
import { TrianglesDrawMode as je, TriangleFanDrawMode as oe, TriangleStripDrawMode as be, Loader as ce, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as Y, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as J, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ue, 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 Q, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as $, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as le, 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 he, VectorKeyframeTrack as pe, NumberKeyframeTrack as me, QuaternionKeyframeTrack as ge, ColorManagement as Ae, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as xt, NoColorSpace as H } from "three";
|
|
5
|
+
import { u as Rt, a as Te } from "./fflate.module-xyO_T3Zm.mjs";
|
|
6
|
+
import { S as _t } from "./FileTypes-Bq4uWglF.mjs";
|
|
7
7
|
import { g as wt, i as Et } from "./isFileTypeSupported-BSpswPHU.mjs";
|
|
8
|
-
import { F as
|
|
9
|
-
import { A as
|
|
8
|
+
import { F as ye, P as xe } from "./parse-error-DfOPyLWM.mjs";
|
|
9
|
+
import { A as q } from "./AssetCache-DbUJFLZt.mjs";
|
|
10
10
|
function Re(d, e) {
|
|
11
11
|
if (e === je)
|
|
12
12
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
|
13
|
-
if (e ===
|
|
13
|
+
if (e === oe || e === be) {
|
|
14
14
|
let t = d.getIndex();
|
|
15
15
|
if (t === null) {
|
|
16
|
-
const
|
|
16
|
+
const s = [], a = d.getAttribute("position");
|
|
17
17
|
if (a !== void 0) {
|
|
18
18
|
for (let i = 0; i < a.count; i++)
|
|
19
|
-
|
|
20
|
-
d.setIndex(
|
|
19
|
+
s.push(i);
|
|
20
|
+
d.setIndex(s), t = d.getIndex();
|
|
21
21
|
} else
|
|
22
22
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
if (e ===
|
|
26
|
-
for (let
|
|
27
|
-
|
|
24
|
+
const r = t.count - 2, n = [];
|
|
25
|
+
if (e === oe)
|
|
26
|
+
for (let s = 1; s <= r; s++)
|
|
27
|
+
n.push(t.getX(0)), n.push(t.getX(s)), n.push(t.getX(s + 1));
|
|
28
28
|
else
|
|
29
|
-
for (let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
return
|
|
29
|
+
for (let s = 0; s < r; s++)
|
|
30
|
+
s % 2 === 0 ? (n.push(t.getX(s)), n.push(t.getX(s + 1)), n.push(t.getX(s + 2))) : (n.push(t.getX(s + 2)), n.push(t.getX(s + 1)), n.push(t.getX(s)));
|
|
31
|
+
n.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
32
|
+
const o = d.clone();
|
|
33
|
+
return o.setIndex(n), o.clearGroups(), o;
|
|
34
34
|
} else
|
|
35
35
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), d;
|
|
36
36
|
}
|
|
37
|
-
class St extends
|
|
37
|
+
class St extends ce {
|
|
38
38
|
constructor(e) {
|
|
39
39
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
40
40
|
return new Ct(t);
|
|
@@ -70,29 +70,29 @@ class St extends ae {
|
|
|
70
70
|
return new Kt(t);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
load(e, t,
|
|
74
|
-
const
|
|
75
|
-
let
|
|
73
|
+
load(e, t, r, n) {
|
|
74
|
+
const o = this;
|
|
75
|
+
let s;
|
|
76
76
|
if (this.resourcePath !== "")
|
|
77
|
-
|
|
77
|
+
s = this.resourcePath;
|
|
78
78
|
else if (this.path !== "") {
|
|
79
79
|
const c = X.extractUrlBase(e);
|
|
80
|
-
|
|
80
|
+
s = X.resolveURL(c, this.path);
|
|
81
81
|
} else
|
|
82
|
-
|
|
82
|
+
s = X.extractUrlBase(e);
|
|
83
83
|
this.manager.itemStart(e);
|
|
84
84
|
const a = function(c) {
|
|
85
|
-
|
|
85
|
+
n ? n(c) : console.error(c), o.manager.itemError(e), o.manager.itemEnd(e);
|
|
86
86
|
}, i = new K(this.manager);
|
|
87
87
|
i.setPath(this.path), i.setResponseType("arraybuffer"), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials), i.load(e, function(c) {
|
|
88
88
|
try {
|
|
89
|
-
|
|
90
|
-
t(u),
|
|
89
|
+
o.parse(c, s, function(u) {
|
|
90
|
+
t(u), o.manager.itemEnd(e);
|
|
91
91
|
}, a);
|
|
92
92
|
} catch (u) {
|
|
93
93
|
a(u);
|
|
94
94
|
}
|
|
95
|
-
},
|
|
95
|
+
}, r, a);
|
|
96
96
|
}
|
|
97
97
|
setDRACOLoader(e) {
|
|
98
98
|
return this.dracoLoader = e, this;
|
|
@@ -114,29 +114,29 @@ class St extends ae {
|
|
|
114
114
|
unregister(e) {
|
|
115
115
|
return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
|
|
116
116
|
}
|
|
117
|
-
parse(e, t,
|
|
118
|
-
let
|
|
119
|
-
const
|
|
117
|
+
parse(e, t, r, n) {
|
|
118
|
+
let o;
|
|
119
|
+
const s = {}, a = {}, i = new TextDecoder();
|
|
120
120
|
if (typeof e == "string")
|
|
121
|
-
|
|
121
|
+
o = JSON.parse(e);
|
|
122
122
|
else if (e instanceof ArrayBuffer)
|
|
123
123
|
if (i.decode(new Uint8Array(e, 0, 4)) === Fe) {
|
|
124
124
|
try {
|
|
125
|
-
|
|
125
|
+
s[b.KHR_BINARY_GLTF] = new Vt(e);
|
|
126
126
|
} catch (l) {
|
|
127
|
-
|
|
127
|
+
n && n(l);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
o = JSON.parse(s[b.KHR_BINARY_GLTF].content);
|
|
131
131
|
} else
|
|
132
|
-
|
|
132
|
+
o = JSON.parse(i.decode(e));
|
|
133
133
|
else
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
|
|
134
|
+
o = e;
|
|
135
|
+
if (o.asset === void 0 || o.asset.version[0] < 2) {
|
|
136
|
+
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
const c = new sn(
|
|
139
|
+
const c = new sn(o, {
|
|
140
140
|
path: t || this.resourcePath || "",
|
|
141
141
|
crossOrigin: this.crossOrigin,
|
|
142
142
|
requestHeader: this.requestHeader,
|
|
@@ -147,34 +147,34 @@ class St extends ae {
|
|
|
147
147
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
148
148
|
for (let u = 0; u < this.pluginCallbacks.length; u++) {
|
|
149
149
|
const l = this.pluginCallbacks[u](c);
|
|
150
|
-
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, s[l.name] = !0;
|
|
151
151
|
}
|
|
152
|
-
if (
|
|
153
|
-
for (let u = 0; u <
|
|
154
|
-
const l =
|
|
152
|
+
if (o.extensionsUsed)
|
|
153
|
+
for (let u = 0; u < o.extensionsUsed.length; ++u) {
|
|
154
|
+
const l = o.extensionsUsed[u], f = o.extensionsRequired || [];
|
|
155
155
|
switch (l) {
|
|
156
156
|
case b.KHR_MATERIALS_UNLIT:
|
|
157
|
-
|
|
157
|
+
s[l] = new Mt();
|
|
158
158
|
break;
|
|
159
159
|
case b.KHR_DRACO_MESH_COMPRESSION:
|
|
160
|
-
|
|
160
|
+
s[l] = new Wt(o, this.dracoLoader);
|
|
161
161
|
break;
|
|
162
162
|
case b.KHR_TEXTURE_TRANSFORM:
|
|
163
|
-
|
|
163
|
+
s[l] = new Xt();
|
|
164
164
|
break;
|
|
165
165
|
case b.KHR_MESH_QUANTIZATION:
|
|
166
|
-
|
|
166
|
+
s[l] = new zt();
|
|
167
167
|
break;
|
|
168
168
|
default:
|
|
169
169
|
f.indexOf(l) >= 0 && a[l] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + l + '".');
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
c.setExtensions(
|
|
172
|
+
c.setExtensions(s), c.setPlugins(a), c.parse(r, n);
|
|
173
173
|
}
|
|
174
174
|
parseAsync(e, t) {
|
|
175
|
-
const
|
|
176
|
-
return new Promise(function(
|
|
177
|
-
|
|
175
|
+
const r = this;
|
|
176
|
+
return new Promise(function(n, o) {
|
|
177
|
+
r.parse(e, t, n, o);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -224,16 +224,16 @@ class Lt {
|
|
|
224
224
|
}
|
|
225
225
|
_markDefs() {
|
|
226
226
|
const e = this.parser, t = this.parser.json.nodes || [];
|
|
227
|
-
for (let
|
|
228
|
-
const
|
|
229
|
-
|
|
227
|
+
for (let r = 0, n = t.length; r < n; r++) {
|
|
228
|
+
const o = t[r];
|
|
229
|
+
o.extensions && o.extensions[this.name] && o.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, o.extensions[this.name].light);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
_loadLight(e) {
|
|
233
|
-
const t = this.parser,
|
|
234
|
-
let
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
233
|
+
const t = this.parser, r = "light:" + e;
|
|
234
|
+
let n = t.cache.get(r);
|
|
235
|
+
if (n) return n;
|
|
236
|
+
const o = t.json, i = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e];
|
|
237
237
|
let c;
|
|
238
238
|
const u = new U(16777215);
|
|
239
239
|
i.color !== void 0 && u.setRGB(i.color[0], i.color[1], i.color[2], D);
|
|
@@ -251,16 +251,16 @@ class Lt {
|
|
|
251
251
|
default:
|
|
252
252
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + i.type);
|
|
253
253
|
}
|
|
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),
|
|
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), n = Promise.resolve(c), t.cache.add(r, n), n;
|
|
255
255
|
}
|
|
256
256
|
getDependency(e, t) {
|
|
257
257
|
if (e === "light")
|
|
258
258
|
return this._loadLight(t);
|
|
259
259
|
}
|
|
260
260
|
createNodeAttachment(e) {
|
|
261
|
-
const t = this,
|
|
261
|
+
const t = this, r = this.parser, o = r.json.nodes[e], a = (o.extensions && o.extensions[this.name] || {}).light;
|
|
262
262
|
return a === void 0 ? null : this._loadLight(a).then(function(i) {
|
|
263
|
-
return
|
|
263
|
+
return r._getNodeRef(t.cache, a, i);
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
}
|
|
@@ -271,18 +271,18 @@ class Mt {
|
|
|
271
271
|
getMaterialType() {
|
|
272
272
|
return W;
|
|
273
273
|
}
|
|
274
|
-
extendParams(e, t,
|
|
275
|
-
const
|
|
274
|
+
extendParams(e, t, r) {
|
|
275
|
+
const n = [];
|
|
276
276
|
e.color = new U(1, 1, 1), e.opacity = 1;
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
if (Array.isArray(
|
|
280
|
-
const
|
|
281
|
-
e.color.setRGB(
|
|
277
|
+
const o = t.pbrMetallicRoughness;
|
|
278
|
+
if (o) {
|
|
279
|
+
if (Array.isArray(o.baseColorFactor)) {
|
|
280
|
+
const s = o.baseColorFactor;
|
|
281
|
+
e.color.setRGB(s[0], s[1], s[2], D), e.opacity = s[3];
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
o.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", o.baseColorTexture, N));
|
|
284
284
|
}
|
|
285
|
-
return Promise.all(
|
|
285
|
+
return Promise.all(n);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
class It {
|
|
@@ -290,11 +290,11 @@ class It {
|
|
|
290
290
|
this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
291
291
|
}
|
|
292
292
|
extendMaterialParams(e, t) {
|
|
293
|
-
const
|
|
294
|
-
if (!
|
|
293
|
+
const n = this.parser.json.materials[e];
|
|
294
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
295
295
|
return Promise.resolve();
|
|
296
|
-
const
|
|
297
|
-
return
|
|
296
|
+
const o = n.extensions[this.name].emissiveStrength;
|
|
297
|
+
return o !== void 0 && (t.emissiveIntensity = o), Promise.resolve();
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
class Ct {
|
|
@@ -302,19 +302,19 @@ class Ct {
|
|
|
302
302
|
this.parser = e, this.name = b.KHR_MATERIALS_CLEARCOAT;
|
|
303
303
|
}
|
|
304
304
|
getMaterialType(e) {
|
|
305
|
-
const
|
|
306
|
-
return !
|
|
305
|
+
const r = this.parser.json.materials[e];
|
|
306
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
307
307
|
}
|
|
308
308
|
extendMaterialParams(e, t) {
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
309
|
+
const r = this.parser, n = r.json.materials[e];
|
|
310
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
311
311
|
return Promise.resolve();
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
const a =
|
|
315
|
-
t.clearcoatNormalScale = new
|
|
312
|
+
const o = [], s = n.extensions[this.name];
|
|
313
|
+
if (s.clearcoatFactor !== void 0 && (t.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && o.push(r.assignTexture(t, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && o.push(r.assignTexture(t, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (o.push(r.assignTexture(t, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
|
|
314
|
+
const a = s.clearcoatNormalTexture.scale;
|
|
315
|
+
t.clearcoatNormalScale = new Y(a, a);
|
|
316
316
|
}
|
|
317
|
-
return Promise.all(
|
|
317
|
+
return Promise.all(o);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
class Nt {
|
|
@@ -322,15 +322,15 @@ class Nt {
|
|
|
322
322
|
this.parser = e, this.name = b.KHR_MATERIALS_IRIDESCENCE;
|
|
323
323
|
}
|
|
324
324
|
getMaterialType(e) {
|
|
325
|
-
const
|
|
326
|
-
return !
|
|
325
|
+
const r = this.parser.json.materials[e];
|
|
326
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
327
327
|
}
|
|
328
328
|
extendMaterialParams(e, t) {
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
329
|
+
const r = this.parser, n = r.json.materials[e];
|
|
330
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
331
331
|
return Promise.resolve();
|
|
332
|
-
const
|
|
333
|
-
return
|
|
332
|
+
const o = [], s = n.extensions[this.name];
|
|
333
|
+
return s.iridescenceFactor !== void 0 && (t.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && o.push(r.assignTexture(t, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (t.iridescenceIOR = s.iridescenceIor), t.iridescenceThicknessRange === void 0 && (t.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && o.push(r.assignTexture(t, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(o);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
class Dt {
|
|
@@ -338,21 +338,21 @@ class Dt {
|
|
|
338
338
|
this.parser = e, this.name = b.KHR_MATERIALS_SHEEN;
|
|
339
339
|
}
|
|
340
340
|
getMaterialType(e) {
|
|
341
|
-
const
|
|
342
|
-
return !
|
|
341
|
+
const r = this.parser.json.materials[e];
|
|
342
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
343
343
|
}
|
|
344
344
|
extendMaterialParams(e, t) {
|
|
345
|
-
const
|
|
346
|
-
if (!
|
|
345
|
+
const r = this.parser, n = r.json.materials[e];
|
|
346
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
347
347
|
return Promise.resolve();
|
|
348
|
-
const
|
|
348
|
+
const o = [];
|
|
349
349
|
t.sheenColor = new U(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
const a =
|
|
350
|
+
const s = n.extensions[this.name];
|
|
351
|
+
if (s.sheenColorFactor !== void 0) {
|
|
352
|
+
const a = s.sheenColorFactor;
|
|
353
353
|
t.sheenColor.setRGB(a[0], a[1], a[2], D);
|
|
354
354
|
}
|
|
355
|
-
return
|
|
355
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && o.push(r.assignTexture(t, "sheenColorMap", s.sheenColorTexture, N)), s.sheenRoughnessTexture !== void 0 && o.push(r.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(o);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
class Ot {
|
|
@@ -360,15 +360,15 @@ class Ot {
|
|
|
360
360
|
this.parser = e, this.name = b.KHR_MATERIALS_TRANSMISSION;
|
|
361
361
|
}
|
|
362
362
|
getMaterialType(e) {
|
|
363
|
-
const
|
|
364
|
-
return !
|
|
363
|
+
const r = this.parser.json.materials[e];
|
|
364
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
365
365
|
}
|
|
366
366
|
extendMaterialParams(e, t) {
|
|
367
|
-
const
|
|
368
|
-
if (!
|
|
367
|
+
const r = this.parser, n = r.json.materials[e];
|
|
368
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
369
369
|
return Promise.resolve();
|
|
370
|
-
const
|
|
371
|
-
return
|
|
370
|
+
const o = [], s = n.extensions[this.name];
|
|
371
|
+
return s.transmissionFactor !== void 0 && (t.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && o.push(r.assignTexture(t, "transmissionMap", s.transmissionTexture)), Promise.all(o);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
class Pt {
|
|
@@ -376,17 +376,17 @@ class Pt {
|
|
|
376
376
|
this.parser = e, this.name = b.KHR_MATERIALS_VOLUME;
|
|
377
377
|
}
|
|
378
378
|
getMaterialType(e) {
|
|
379
|
-
const
|
|
380
|
-
return !
|
|
379
|
+
const r = this.parser.json.materials[e];
|
|
380
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
381
381
|
}
|
|
382
382
|
extendMaterialParams(e, t) {
|
|
383
|
-
const
|
|
384
|
-
if (!
|
|
383
|
+
const r = this.parser, n = r.json.materials[e];
|
|
384
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
385
385
|
return Promise.resolve();
|
|
386
|
-
const
|
|
387
|
-
t.thickness =
|
|
388
|
-
const a =
|
|
389
|
-
return t.attenuationColor = new U().setRGB(a[0], a[1], a[2], D), Promise.all(
|
|
386
|
+
const o = [], s = n.extensions[this.name];
|
|
387
|
+
t.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && o.push(r.assignTexture(t, "thicknessMap", s.thicknessTexture)), t.attenuationDistance = s.attenuationDistance || 1 / 0;
|
|
388
|
+
const a = s.attenuationColor || [1, 1, 1];
|
|
389
|
+
return t.attenuationColor = new U().setRGB(a[0], a[1], a[2], D), Promise.all(o);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
class kt {
|
|
@@ -394,15 +394,15 @@ class kt {
|
|
|
394
394
|
this.parser = e, this.name = b.KHR_MATERIALS_IOR;
|
|
395
395
|
}
|
|
396
396
|
getMaterialType(e) {
|
|
397
|
-
const
|
|
398
|
-
return !
|
|
397
|
+
const r = this.parser.json.materials[e];
|
|
398
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
399
399
|
}
|
|
400
400
|
extendMaterialParams(e, t) {
|
|
401
|
-
const
|
|
402
|
-
if (!
|
|
401
|
+
const n = this.parser.json.materials[e];
|
|
402
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
403
403
|
return Promise.resolve();
|
|
404
|
-
const
|
|
405
|
-
return t.ior =
|
|
404
|
+
const o = n.extensions[this.name];
|
|
405
|
+
return t.ior = o.ior !== void 0 ? o.ior : 1.5, Promise.resolve();
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
class Ft {
|
|
@@ -410,17 +410,17 @@ class Ft {
|
|
|
410
410
|
this.parser = e, this.name = b.KHR_MATERIALS_SPECULAR;
|
|
411
411
|
}
|
|
412
412
|
getMaterialType(e) {
|
|
413
|
-
const
|
|
414
|
-
return !
|
|
413
|
+
const r = this.parser.json.materials[e];
|
|
414
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
415
415
|
}
|
|
416
416
|
extendMaterialParams(e, t) {
|
|
417
|
-
const
|
|
418
|
-
if (!
|
|
417
|
+
const r = this.parser, n = r.json.materials[e];
|
|
418
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
419
419
|
return Promise.resolve();
|
|
420
|
-
const
|
|
421
|
-
t.specularIntensity =
|
|
422
|
-
const a =
|
|
423
|
-
return t.specularColor = new U().setRGB(a[0], a[1], a[2], D),
|
|
420
|
+
const o = [], s = n.extensions[this.name];
|
|
421
|
+
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && o.push(r.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
422
|
+
const a = s.specularColorFactor || [1, 1, 1];
|
|
423
|
+
return t.specularColor = new U().setRGB(a[0], a[1], a[2], D), s.specularColorTexture !== void 0 && o.push(r.assignTexture(t, "specularColorMap", s.specularColorTexture, N)), Promise.all(o);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
class Ut {
|
|
@@ -428,15 +428,15 @@ class Ut {
|
|
|
428
428
|
this.parser = e, this.name = b.EXT_MATERIALS_BUMP;
|
|
429
429
|
}
|
|
430
430
|
getMaterialType(e) {
|
|
431
|
-
const
|
|
432
|
-
return !
|
|
431
|
+
const r = this.parser.json.materials[e];
|
|
432
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
433
433
|
}
|
|
434
434
|
extendMaterialParams(e, t) {
|
|
435
|
-
const
|
|
436
|
-
if (!
|
|
435
|
+
const r = this.parser, n = r.json.materials[e];
|
|
436
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
437
437
|
return Promise.resolve();
|
|
438
|
-
const
|
|
439
|
-
return t.bumpScale =
|
|
438
|
+
const o = [], s = n.extensions[this.name];
|
|
439
|
+
return t.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && o.push(r.assignTexture(t, "bumpMap", s.bumpTexture)), Promise.all(o);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
class Ht {
|
|
@@ -444,15 +444,15 @@ class Ht {
|
|
|
444
444
|
this.parser = e, this.name = b.KHR_MATERIALS_ANISOTROPY;
|
|
445
445
|
}
|
|
446
446
|
getMaterialType(e) {
|
|
447
|
-
const
|
|
448
|
-
return !
|
|
447
|
+
const r = this.parser.json.materials[e];
|
|
448
|
+
return !r.extensions || !r.extensions[this.name] ? null : O;
|
|
449
449
|
}
|
|
450
450
|
extendMaterialParams(e, t) {
|
|
451
|
-
const
|
|
452
|
-
if (!
|
|
451
|
+
const r = this.parser, n = r.json.materials[e];
|
|
452
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
453
453
|
return Promise.resolve();
|
|
454
|
-
const
|
|
455
|
-
return
|
|
454
|
+
const o = [], s = n.extensions[this.name];
|
|
455
|
+
return s.anisotropyStrength !== void 0 && (t.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (t.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && o.push(r.assignTexture(t, "anisotropyMap", s.anisotropyTexture)), Promise.all(o);
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
class Gt {
|
|
@@ -460,16 +460,16 @@ class Gt {
|
|
|
460
460
|
this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
|
|
461
461
|
}
|
|
462
462
|
loadTexture(e) {
|
|
463
|
-
const t = this.parser,
|
|
464
|
-
if (!
|
|
463
|
+
const t = this.parser, r = t.json, n = r.textures[e];
|
|
464
|
+
if (!n.extensions || !n.extensions[this.name])
|
|
465
465
|
return null;
|
|
466
|
-
const
|
|
467
|
-
if (!
|
|
468
|
-
if (
|
|
466
|
+
const o = n.extensions[this.name], s = t.options.ktx2Loader;
|
|
467
|
+
if (!s) {
|
|
468
|
+
if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
|
|
469
469
|
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
470
470
|
return null;
|
|
471
471
|
}
|
|
472
|
-
return t.loadTextureImage(e,
|
|
472
|
+
return t.loadTextureImage(e, o.source, s);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
475
|
class vt {
|
|
@@ -477,20 +477,20 @@ class vt {
|
|
|
477
477
|
this.parser = e, this.name = b.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
478
478
|
}
|
|
479
479
|
loadTexture(e) {
|
|
480
|
-
const t = this.name,
|
|
481
|
-
if (!
|
|
480
|
+
const t = this.name, r = this.parser, n = r.json, o = n.textures[e];
|
|
481
|
+
if (!o.extensions || !o.extensions[t])
|
|
482
482
|
return null;
|
|
483
|
-
const
|
|
484
|
-
let i =
|
|
483
|
+
const s = o.extensions[t], a = n.images[s.source];
|
|
484
|
+
let i = r.textureLoader;
|
|
485
485
|
if (a.uri) {
|
|
486
|
-
const c =
|
|
486
|
+
const c = r.options.manager.getHandler(a.uri);
|
|
487
487
|
c !== null && (i = c);
|
|
488
488
|
}
|
|
489
489
|
return this.detectSupport().then(function(c) {
|
|
490
|
-
if (c) return
|
|
491
|
-
if (
|
|
490
|
+
if (c) return r.loadTextureImage(e, s.source, i);
|
|
491
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
492
492
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
493
|
-
return
|
|
493
|
+
return r.loadTexture(e);
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
496
|
detectSupport() {
|
|
@@ -507,20 +507,20 @@ class Bt {
|
|
|
507
507
|
this.parser = e, this.name = b.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
508
508
|
}
|
|
509
509
|
loadTexture(e) {
|
|
510
|
-
const t = this.name,
|
|
511
|
-
if (!
|
|
510
|
+
const t = this.name, r = this.parser, n = r.json, o = n.textures[e];
|
|
511
|
+
if (!o.extensions || !o.extensions[t])
|
|
512
512
|
return null;
|
|
513
|
-
const
|
|
514
|
-
let i =
|
|
513
|
+
const s = o.extensions[t], a = n.images[s.source];
|
|
514
|
+
let i = r.textureLoader;
|
|
515
515
|
if (a.uri) {
|
|
516
|
-
const c =
|
|
516
|
+
const c = r.options.manager.getHandler(a.uri);
|
|
517
517
|
c !== null && (i = c);
|
|
518
518
|
}
|
|
519
519
|
return this.detectSupport().then(function(c) {
|
|
520
|
-
if (c) return
|
|
521
|
-
if (
|
|
520
|
+
if (c) return r.loadTextureImage(e, s.source, i);
|
|
521
|
+
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
522
522
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
523
|
-
return
|
|
523
|
+
return r.loadTexture(e);
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
detectSupport() {
|
|
@@ -537,21 +537,21 @@ class jt {
|
|
|
537
537
|
this.name = b.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
538
538
|
}
|
|
539
539
|
loadBufferView(e) {
|
|
540
|
-
const t = this.parser.json,
|
|
541
|
-
if (
|
|
542
|
-
const
|
|
543
|
-
if (!
|
|
540
|
+
const t = this.parser.json, r = t.bufferViews[e];
|
|
541
|
+
if (r.extensions && r.extensions[this.name]) {
|
|
542
|
+
const n = r.extensions[this.name], o = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
|
|
543
|
+
if (!s || !s.supported) {
|
|
544
544
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
|
|
545
545
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
546
546
|
return null;
|
|
547
547
|
}
|
|
548
|
-
return
|
|
549
|
-
const i =
|
|
550
|
-
return
|
|
548
|
+
return o.then(function(a) {
|
|
549
|
+
const i = n.byteOffset || 0, c = n.byteLength || 0, u = n.count, l = n.byteStride, f = new Uint8Array(a, i, c);
|
|
550
|
+
return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(u, l, f, n.mode, n.filter).then(function(m) {
|
|
551
551
|
return m.buffer;
|
|
552
|
-
}) :
|
|
552
|
+
}) : s.ready.then(function() {
|
|
553
553
|
const m = new ArrayBuffer(u * l);
|
|
554
|
-
return
|
|
554
|
+
return s.decodeGltfBuffer(new Uint8Array(m), u, l, f, n.mode, n.filter), m;
|
|
555
555
|
});
|
|
556
556
|
});
|
|
557
557
|
} else
|
|
@@ -563,20 +563,20 @@ class Kt {
|
|
|
563
563
|
this.name = b.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
564
564
|
}
|
|
565
565
|
createNodeMesh(e) {
|
|
566
|
-
const t = this.parser.json,
|
|
567
|
-
if (!
|
|
566
|
+
const t = this.parser.json, r = t.nodes[e];
|
|
567
|
+
if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
|
|
568
568
|
return null;
|
|
569
|
-
const
|
|
570
|
-
for (const c of
|
|
569
|
+
const n = t.meshes[r.mesh];
|
|
570
|
+
for (const c of n.primitives)
|
|
571
571
|
if (c.mode !== C.TRIANGLES && c.mode !== C.TRIANGLE_STRIP && c.mode !== C.TRIANGLE_FAN && c.mode !== void 0)
|
|
572
572
|
return null;
|
|
573
|
-
const
|
|
574
|
-
for (const c in
|
|
575
|
-
a.push(this.parser.getDependency("accessor",
|
|
573
|
+
const s = r.extensions[this.name].attributes, a = [], i = {};
|
|
574
|
+
for (const c in s)
|
|
575
|
+
a.push(this.parser.getDependency("accessor", s[c]).then((u) => (i[c] = u, i[c])));
|
|
576
576
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
577
577
|
const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, m = [];
|
|
578
578
|
for (const T of l) {
|
|
579
|
-
const R = new
|
|
579
|
+
const R = new J(), y = new B(), x = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
|
|
580
580
|
for (let _ = 0; _ < f; _++)
|
|
581
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));
|
|
582
582
|
for (const _ in i)
|
|
@@ -584,7 +584,7 @@ class Kt {
|
|
|
584
584
|
const M = i[_];
|
|
585
585
|
S.instanceColor = new ze(M.array, M.itemSize, M.normalized);
|
|
586
586
|
} else _ !== "TRANSLATION" && _ !== "ROTATION" && _ !== "SCALE" && T.geometry.setAttribute(_, i[_]);
|
|
587
|
-
|
|
587
|
+
ue.prototype.copy.call(S, T), this.parser.assignFinalMaterial(S), m.push(S);
|
|
588
588
|
}
|
|
589
589
|
return u.isGroup ? (u.clear(), u.add(...m), u) : m[0];
|
|
590
590
|
}));
|
|
@@ -594,29 +594,29 @@ const Fe = "glTF", V = 12, _e = { JSON: 1313821514, BIN: 5130562 };
|
|
|
594
594
|
class Vt {
|
|
595
595
|
constructor(e) {
|
|
596
596
|
this.name = b.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
597
|
-
const t = new DataView(e, 0, V),
|
|
597
|
+
const t = new DataView(e, 0, V), r = new TextDecoder();
|
|
598
598
|
if (this.header = {
|
|
599
|
-
magic:
|
|
599
|
+
magic: r.decode(new Uint8Array(e.slice(0, 4))),
|
|
600
600
|
version: t.getUint32(4, !0),
|
|
601
601
|
length: t.getUint32(8, !0)
|
|
602
602
|
}, this.header.magic !== Fe)
|
|
603
603
|
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
604
604
|
if (this.header.version < 2)
|
|
605
605
|
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
606
|
-
const
|
|
607
|
-
let
|
|
608
|
-
for (;
|
|
609
|
-
const a =
|
|
610
|
-
|
|
611
|
-
const i =
|
|
612
|
-
if (
|
|
613
|
-
const c = new Uint8Array(e, V +
|
|
614
|
-
this.content =
|
|
606
|
+
const n = this.header.length - V, o = new DataView(e, V);
|
|
607
|
+
let s = 0;
|
|
608
|
+
for (; s < n; ) {
|
|
609
|
+
const a = o.getUint32(s, !0);
|
|
610
|
+
s += 4;
|
|
611
|
+
const i = o.getUint32(s, !0);
|
|
612
|
+
if (s += 4, i === _e.JSON) {
|
|
613
|
+
const c = new Uint8Array(e, V + s, a);
|
|
614
|
+
this.content = r.decode(c);
|
|
615
615
|
} else if (i === _e.BIN) {
|
|
616
|
-
const c = V +
|
|
616
|
+
const c = V + s;
|
|
617
617
|
this.body = e.slice(c, c + a);
|
|
618
618
|
}
|
|
619
|
-
|
|
619
|
+
s += a;
|
|
620
620
|
}
|
|
621
621
|
if (this.content === null)
|
|
622
622
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
@@ -629,21 +629,21 @@ class Wt {
|
|
|
629
629
|
this.name = b.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
|
|
630
630
|
}
|
|
631
631
|
decodePrimitive(e, t) {
|
|
632
|
-
const
|
|
633
|
-
for (const u in
|
|
634
|
-
const l =
|
|
635
|
-
a[l] =
|
|
632
|
+
const r = this.json, n = this.dracoLoader, o = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes, a = {}, i = {}, c = {};
|
|
633
|
+
for (const u in s) {
|
|
634
|
+
const l = ie[u] || u.toLowerCase();
|
|
635
|
+
a[l] = s[u];
|
|
636
636
|
}
|
|
637
637
|
for (const u in e.attributes) {
|
|
638
|
-
const l =
|
|
639
|
-
if (
|
|
640
|
-
const f =
|
|
638
|
+
const l = ie[u] || u.toLowerCase();
|
|
639
|
+
if (s[u] !== void 0) {
|
|
640
|
+
const f = r.accessors[e.attributes[u]], m = j[f.componentType];
|
|
641
641
|
c[l] = m.name, i[l] = f.normalized === !0;
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
return t.getDependency("bufferView",
|
|
644
|
+
return t.getDependency("bufferView", o).then(function(u) {
|
|
645
645
|
return new Promise(function(l, f) {
|
|
646
|
-
|
|
646
|
+
n.decodeDracoFile(u, function(m) {
|
|
647
647
|
for (const T in m.attributes) {
|
|
648
648
|
const R = m.attributes[T], y = i[T];
|
|
649
649
|
y !== void 0 && (R.normalized = y);
|
|
@@ -668,29 +668,29 @@ class zt {
|
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
class Ue extends Tt {
|
|
671
|
-
constructor(e, t,
|
|
672
|
-
super(e, t,
|
|
671
|
+
constructor(e, t, r, n) {
|
|
672
|
+
super(e, t, r, n);
|
|
673
673
|
}
|
|
674
674
|
copySampleValue_(e) {
|
|
675
|
-
const t = this.resultBuffer,
|
|
676
|
-
for (let
|
|
677
|
-
t[
|
|
675
|
+
const t = this.resultBuffer, r = this.sampleValues, n = this.valueSize, o = e * n * 3 + n;
|
|
676
|
+
for (let s = 0; s !== n; s++)
|
|
677
|
+
t[s] = r[o + s];
|
|
678
678
|
return t;
|
|
679
679
|
}
|
|
680
|
-
interpolate_(e, t,
|
|
681
|
-
const
|
|
680
|
+
interpolate_(e, t, r, n) {
|
|
681
|
+
const o = this.resultBuffer, s = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = n - t, l = (r - 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;
|
|
682
682
|
for (let _ = 0; _ !== a; _++) {
|
|
683
|
-
const M =
|
|
684
|
-
|
|
683
|
+
const M = s[R + _ + a], I = s[R + _ + i] * u, L = s[T + _ + a], h = s[T + _] * u;
|
|
684
|
+
o[_] = E * M + S * I + y * L + x * h;
|
|
685
685
|
}
|
|
686
|
-
return
|
|
686
|
+
return o;
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
const qt = new Le();
|
|
690
690
|
class Yt extends Ue {
|
|
691
|
-
interpolate_(e, t,
|
|
692
|
-
const
|
|
693
|
-
return qt.fromArray(
|
|
691
|
+
interpolate_(e, t, r, n) {
|
|
692
|
+
const o = super.interpolate_(e, t, r, n);
|
|
693
|
+
return qt.fromArray(o).normalize().toArray(o), o;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
const C = {
|
|
@@ -718,8 +718,8 @@ const C = {
|
|
|
718
718
|
}, Ee = {
|
|
719
719
|
33071: De,
|
|
720
720
|
33648: Ne,
|
|
721
|
-
10497:
|
|
722
|
-
},
|
|
721
|
+
10497: Q
|
|
722
|
+
}, ee = {
|
|
723
723
|
SCALAR: 1,
|
|
724
724
|
VEC2: 2,
|
|
725
725
|
VEC3: 3,
|
|
@@ -727,7 +727,7 @@ const C = {
|
|
|
727
727
|
MAT2: 4,
|
|
728
728
|
MAT3: 9,
|
|
729
729
|
MAT4: 16
|
|
730
|
-
},
|
|
730
|
+
}, ie = {
|
|
731
731
|
POSITION: "position",
|
|
732
732
|
NORMAL: "normal",
|
|
733
733
|
TANGENT: "tangent",
|
|
@@ -749,7 +749,7 @@ const C = {
|
|
|
749
749
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
750
750
|
LINEAR: ke,
|
|
751
751
|
STEP: gt
|
|
752
|
-
},
|
|
752
|
+
}, te = {
|
|
753
753
|
OPAQUE: "OPAQUE",
|
|
754
754
|
MASK: "MASK",
|
|
755
755
|
BLEND: "BLEND"
|
|
@@ -766,54 +766,54 @@ function Qt(d) {
|
|
|
766
766
|
})), d.DefaultMaterial;
|
|
767
767
|
}
|
|
768
768
|
function G(d, e, t) {
|
|
769
|
-
for (const
|
|
770
|
-
d[
|
|
769
|
+
for (const r in t.extensions)
|
|
770
|
+
d[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
|
|
771
771
|
}
|
|
772
772
|
function F(d, e) {
|
|
773
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));
|
|
774
774
|
}
|
|
775
775
|
function Zt(d, e, t) {
|
|
776
|
-
let
|
|
776
|
+
let r = !1, n = !1, o = !1;
|
|
777
777
|
for (let c = 0, u = e.length; c < u; c++) {
|
|
778
778
|
const l = e[c];
|
|
779
|
-
if (l.POSITION !== void 0 && (
|
|
779
|
+
if (l.POSITION !== void 0 && (r = !0), l.NORMAL !== void 0 && (n = !0), l.COLOR_0 !== void 0 && (o = !0), r && n && o) break;
|
|
780
780
|
}
|
|
781
|
-
if (!
|
|
782
|
-
const
|
|
781
|
+
if (!r && !n && !o) return Promise.resolve(d);
|
|
782
|
+
const s = [], a = [], i = [];
|
|
783
783
|
for (let c = 0, u = e.length; c < u; c++) {
|
|
784
784
|
const l = e[c];
|
|
785
|
-
if (
|
|
785
|
+
if (r) {
|
|
786
786
|
const f = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : d.attributes.position;
|
|
787
|
-
|
|
787
|
+
s.push(f);
|
|
788
788
|
}
|
|
789
|
-
if (
|
|
789
|
+
if (n) {
|
|
790
790
|
const f = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : d.attributes.normal;
|
|
791
791
|
a.push(f);
|
|
792
792
|
}
|
|
793
|
-
if (
|
|
793
|
+
if (o) {
|
|
794
794
|
const f = l.COLOR_0 !== void 0 ? t.getDependency("accessor", l.COLOR_0) : d.attributes.color;
|
|
795
795
|
i.push(f);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
return Promise.all([
|
|
799
|
-
Promise.all(
|
|
799
|
+
Promise.all(s),
|
|
800
800
|
Promise.all(a),
|
|
801
801
|
Promise.all(i)
|
|
802
802
|
]).then(function(c) {
|
|
803
803
|
const u = c[0], l = c[1], f = c[2];
|
|
804
|
-
return
|
|
804
|
+
return r && (d.morphAttributes.position = u), n && (d.morphAttributes.normal = l), o && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
|
|
805
805
|
});
|
|
806
806
|
}
|
|
807
807
|
function $t(d, e) {
|
|
808
808
|
if (d.updateMorphTargets(), e.weights !== void 0)
|
|
809
|
-
for (let t = 0,
|
|
809
|
+
for (let t = 0, r = e.weights.length; t < r; t++)
|
|
810
810
|
d.morphTargetInfluences[t] = e.weights[t];
|
|
811
811
|
if (e.extras && Array.isArray(e.extras.targetNames)) {
|
|
812
812
|
const t = e.extras.targetNames;
|
|
813
813
|
if (d.morphTargetInfluences.length === t.length) {
|
|
814
814
|
d.morphTargetDictionary = {};
|
|
815
|
-
for (let
|
|
816
|
-
d.morphTargetDictionary[t[
|
|
815
|
+
for (let r = 0, n = t.length; r < n; r++)
|
|
816
|
+
d.morphTargetDictionary[t[r]] = r;
|
|
817
817
|
} else
|
|
818
818
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
819
819
|
}
|
|
@@ -821,19 +821,19 @@ function $t(d, e) {
|
|
|
821
821
|
function en(d) {
|
|
822
822
|
let e;
|
|
823
823
|
const t = d.extensions && d.extensions[b.KHR_DRACO_MESH_COMPRESSION];
|
|
824
|
-
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" +
|
|
825
|
-
for (let
|
|
826
|
-
e += ":" +
|
|
824
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + ne(t.attributes) : e = d.indices + ":" + ne(d.attributes) + ":" + d.mode, d.targets !== void 0)
|
|
825
|
+
for (let r = 0, n = d.targets.length; r < n; r++)
|
|
826
|
+
e += ":" + ne(d.targets[r]);
|
|
827
827
|
return e;
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function ne(d) {
|
|
830
830
|
let e = "";
|
|
831
831
|
const t = Object.keys(d).sort();
|
|
832
|
-
for (let
|
|
833
|
-
e += t[
|
|
832
|
+
for (let r = 0, n = t.length; r < n; r++)
|
|
833
|
+
e += t[r] + ":" + d[t[r]] + ";";
|
|
834
834
|
return e;
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function ae(d) {
|
|
837
837
|
switch (d) {
|
|
838
838
|
case Int8Array:
|
|
839
839
|
return 1 / 127;
|
|
@@ -850,12 +850,12 @@ function ie(d) {
|
|
|
850
850
|
function tn(d) {
|
|
851
851
|
return d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : d.search(/\.webp($|\?)/i) > 0 || d.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
|
|
852
852
|
}
|
|
853
|
-
const nn = new
|
|
853
|
+
const nn = new J();
|
|
854
854
|
class sn {
|
|
855
855
|
constructor(e = {}, t = {}) {
|
|
856
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 = {};
|
|
857
|
-
let
|
|
858
|
-
typeof navigator < "u" && (
|
|
857
|
+
let r = !1, n = !1, o = -1;
|
|
858
|
+
typeof navigator < "u" && (r = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, o = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || r || n && o < 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);
|
|
859
859
|
}
|
|
860
860
|
setExtensions(e) {
|
|
861
861
|
this.extensions = e;
|
|
@@ -864,28 +864,28 @@ class sn {
|
|
|
864
864
|
this.plugins = e;
|
|
865
865
|
}
|
|
866
866
|
parse(e, t) {
|
|
867
|
-
const
|
|
868
|
-
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(
|
|
869
|
-
return
|
|
870
|
-
}), Promise.all(this._invokeAll(function(
|
|
871
|
-
return
|
|
867
|
+
const r = this, n = this.json, o = this.extensions;
|
|
868
|
+
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
|
|
869
|
+
return s._markDefs && s._markDefs();
|
|
870
|
+
}), Promise.all(this._invokeAll(function(s) {
|
|
871
|
+
return s.beforeRoot && s.beforeRoot();
|
|
872
872
|
})).then(function() {
|
|
873
873
|
return Promise.all([
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
874
|
+
r.getDependencies("scene"),
|
|
875
|
+
r.getDependencies("animation"),
|
|
876
|
+
r.getDependencies("camera")
|
|
877
877
|
]);
|
|
878
|
-
}).then(function(
|
|
878
|
+
}).then(function(s) {
|
|
879
879
|
const a = {
|
|
880
|
-
scene:
|
|
881
|
-
scenes:
|
|
882
|
-
animations:
|
|
883
|
-
cameras:
|
|
884
|
-
asset:
|
|
885
|
-
parser:
|
|
880
|
+
scene: s[0][n.scene || 0],
|
|
881
|
+
scenes: s[0],
|
|
882
|
+
animations: s[1],
|
|
883
|
+
cameras: s[2],
|
|
884
|
+
asset: n.asset,
|
|
885
|
+
parser: r,
|
|
886
886
|
userData: {}
|
|
887
887
|
};
|
|
888
|
-
return G(
|
|
888
|
+
return G(o, a, n), F(a, n), Promise.all(r._invokeAll(function(i) {
|
|
889
889
|
return i.afterRoot && i.afterRoot(a);
|
|
890
890
|
})).then(function() {
|
|
891
891
|
for (const i of a.scenes)
|
|
@@ -898,15 +898,15 @@ class sn {
|
|
|
898
898
|
* Marks the special nodes/meshes in json for efficient parse.
|
|
899
899
|
*/
|
|
900
900
|
_markDefs() {
|
|
901
|
-
const e = this.json.nodes || [], t = this.json.skins || [],
|
|
902
|
-
for (let
|
|
903
|
-
const
|
|
904
|
-
for (let a = 0, i =
|
|
905
|
-
e[
|
|
901
|
+
const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
|
|
902
|
+
for (let n = 0, o = t.length; n < o; n++) {
|
|
903
|
+
const s = t[n].joints;
|
|
904
|
+
for (let a = 0, i = s.length; a < i; a++)
|
|
905
|
+
e[s[a]].isBone = !0;
|
|
906
906
|
}
|
|
907
|
-
for (let
|
|
908
|
-
const
|
|
909
|
-
|
|
907
|
+
for (let n = 0, o = e.length; n < o; n++) {
|
|
908
|
+
const s = e[n];
|
|
909
|
+
s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (r[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
/**
|
|
@@ -922,34 +922,34 @@ class sn {
|
|
|
922
922
|
t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
|
|
923
923
|
}
|
|
924
924
|
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
925
|
-
_getNodeRef(e, t,
|
|
926
|
-
if (e.refs[t] <= 1) return
|
|
927
|
-
const
|
|
928
|
-
const i = this.associations.get(
|
|
925
|
+
_getNodeRef(e, t, r) {
|
|
926
|
+
if (e.refs[t] <= 1) return r;
|
|
927
|
+
const n = r.clone(), o = (s, a) => {
|
|
928
|
+
const i = this.associations.get(s);
|
|
929
929
|
i != null && this.associations.set(a, i);
|
|
930
|
-
for (const [c, u] of
|
|
931
|
-
|
|
930
|
+
for (const [c, u] of s.children.entries())
|
|
931
|
+
o(u, a.children[c]);
|
|
932
932
|
};
|
|
933
|
-
return r
|
|
933
|
+
return o(r, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
934
934
|
}
|
|
935
935
|
_invokeOne(e) {
|
|
936
936
|
const t = Object.values(this.plugins);
|
|
937
937
|
t.push(this);
|
|
938
|
-
for (let
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
938
|
+
for (let r = 0; r < t.length; r++) {
|
|
939
|
+
const n = e(t[r]);
|
|
940
|
+
if (n) return n;
|
|
941
941
|
}
|
|
942
942
|
return null;
|
|
943
943
|
}
|
|
944
944
|
_invokeAll(e) {
|
|
945
945
|
const t = Object.values(this.plugins);
|
|
946
946
|
t.unshift(this);
|
|
947
|
-
const
|
|
948
|
-
for (let
|
|
949
|
-
const
|
|
950
|
-
|
|
947
|
+
const r = [];
|
|
948
|
+
for (let n = 0; n < t.length; n++) {
|
|
949
|
+
const o = e(t[n]);
|
|
950
|
+
o && r.push(o);
|
|
951
951
|
}
|
|
952
|
-
return
|
|
952
|
+
return r;
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
955
955
|
* Requests the specified dependency asynchronously, with caching.
|
|
@@ -958,65 +958,65 @@ class sn {
|
|
|
958
958
|
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
959
959
|
*/
|
|
960
960
|
getDependency(e, t) {
|
|
961
|
-
const
|
|
962
|
-
let
|
|
963
|
-
if (!
|
|
961
|
+
const r = e + ":" + t;
|
|
962
|
+
let n = this.cache.get(r);
|
|
963
|
+
if (!n) {
|
|
964
964
|
switch (e) {
|
|
965
965
|
case "scene":
|
|
966
|
-
|
|
966
|
+
n = this.loadScene(t);
|
|
967
967
|
break;
|
|
968
968
|
case "node":
|
|
969
|
-
|
|
970
|
-
return
|
|
969
|
+
n = this._invokeOne(function(o) {
|
|
970
|
+
return o.loadNode && o.loadNode(t);
|
|
971
971
|
});
|
|
972
972
|
break;
|
|
973
973
|
case "mesh":
|
|
974
|
-
|
|
975
|
-
return
|
|
974
|
+
n = this._invokeOne(function(o) {
|
|
975
|
+
return o.loadMesh && o.loadMesh(t);
|
|
976
976
|
});
|
|
977
977
|
break;
|
|
978
978
|
case "accessor":
|
|
979
|
-
|
|
979
|
+
n = this.loadAccessor(t);
|
|
980
980
|
break;
|
|
981
981
|
case "bufferView":
|
|
982
|
-
|
|
983
|
-
return
|
|
982
|
+
n = this._invokeOne(function(o) {
|
|
983
|
+
return o.loadBufferView && o.loadBufferView(t);
|
|
984
984
|
});
|
|
985
985
|
break;
|
|
986
986
|
case "buffer":
|
|
987
|
-
|
|
987
|
+
n = this.loadBuffer(t);
|
|
988
988
|
break;
|
|
989
989
|
case "material":
|
|
990
|
-
|
|
991
|
-
return
|
|
990
|
+
n = this._invokeOne(function(o) {
|
|
991
|
+
return o.loadMaterial && o.loadMaterial(t);
|
|
992
992
|
});
|
|
993
993
|
break;
|
|
994
994
|
case "texture":
|
|
995
|
-
|
|
996
|
-
return
|
|
995
|
+
n = this._invokeOne(function(o) {
|
|
996
|
+
return o.loadTexture && o.loadTexture(t);
|
|
997
997
|
});
|
|
998
998
|
break;
|
|
999
999
|
case "skin":
|
|
1000
|
-
|
|
1000
|
+
n = this.loadSkin(t);
|
|
1001
1001
|
break;
|
|
1002
1002
|
case "animation":
|
|
1003
|
-
|
|
1004
|
-
return
|
|
1003
|
+
n = this._invokeOne(function(o) {
|
|
1004
|
+
return o.loadAnimation && o.loadAnimation(t);
|
|
1005
1005
|
});
|
|
1006
1006
|
break;
|
|
1007
1007
|
case "camera":
|
|
1008
|
-
|
|
1008
|
+
n = this.loadCamera(t);
|
|
1009
1009
|
break;
|
|
1010
1010
|
default:
|
|
1011
|
-
if (
|
|
1012
|
-
return
|
|
1013
|
-
}), !
|
|
1011
|
+
if (n = this._invokeOne(function(o) {
|
|
1012
|
+
return o != this && o.getDependency && o.getDependency(e, t);
|
|
1013
|
+
}), !n)
|
|
1014
1014
|
throw new Error("Unknown type: " + e);
|
|
1015
1015
|
break;
|
|
1016
1016
|
}
|
|
1017
|
-
this.cache.add(
|
|
1017
|
+
this.cache.add(r, n);
|
|
1018
1018
|
}
|
|
1019
|
-
return
|
|
1019
|
+
return n;
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
1022
1022
|
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
@@ -1026,9 +1026,9 @@ class sn {
|
|
|
1026
1026
|
getDependencies(e) {
|
|
1027
1027
|
let t = this.cache.get(e);
|
|
1028
1028
|
if (!t) {
|
|
1029
|
-
const
|
|
1030
|
-
t = Promise.all(
|
|
1031
|
-
return
|
|
1029
|
+
const r = this, n = this.json[e + (e === "mesh" ? "es" : "s")] || [];
|
|
1030
|
+
t = Promise.all(n.map(function(o, s) {
|
|
1031
|
+
return r.getDependency(e, s);
|
|
1032
1032
|
})), this.cache.add(e, t);
|
|
1033
1033
|
}
|
|
1034
1034
|
return t;
|
|
@@ -1039,15 +1039,15 @@ class sn {
|
|
|
1039
1039
|
* @return {Promise<ArrayBuffer>}
|
|
1040
1040
|
*/
|
|
1041
1041
|
loadBuffer(e) {
|
|
1042
|
-
const t = this.json.buffers[e],
|
|
1042
|
+
const t = this.json.buffers[e], r = this.fileLoader;
|
|
1043
1043
|
if (t.type && t.type !== "arraybuffer")
|
|
1044
1044
|
throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
1045
1045
|
if (t.uri === void 0 && e === 0)
|
|
1046
1046
|
return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
|
|
1047
|
-
const
|
|
1048
|
-
return new Promise(function(
|
|
1049
|
-
|
|
1050
|
-
|
|
1047
|
+
const n = this.options;
|
|
1048
|
+
return new Promise(function(o, s) {
|
|
1049
|
+
r.load(X.resolveURL(t.uri, n.path), o, void 0, function() {
|
|
1050
|
+
s(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1051
1051
|
});
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
@@ -1058,9 +1058,9 @@ class sn {
|
|
|
1058
1058
|
*/
|
|
1059
1059
|
loadBufferView(e) {
|
|
1060
1060
|
const t = this.json.bufferViews[e];
|
|
1061
|
-
return this.getDependency("buffer", t.buffer).then(function(
|
|
1062
|
-
const
|
|
1063
|
-
return
|
|
1061
|
+
return this.getDependency("buffer", t.buffer).then(function(r) {
|
|
1062
|
+
const n = t.byteLength || 0, o = t.byteOffset || 0;
|
|
1063
|
+
return r.slice(o, o + n);
|
|
1064
1064
|
});
|
|
1065
1065
|
}
|
|
1066
1066
|
/**
|
|
@@ -1069,23 +1069,23 @@ class sn {
|
|
|
1069
1069
|
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1070
1070
|
*/
|
|
1071
1071
|
loadAccessor(e) {
|
|
1072
|
-
const t = this,
|
|
1073
|
-
if (
|
|
1074
|
-
const
|
|
1075
|
-
return Promise.resolve(new P(c,
|
|
1072
|
+
const t = this, r = this.json, n = this.json.accessors[e];
|
|
1073
|
+
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1074
|
+
const s = ee[n.type], a = j[n.componentType], i = n.normalized === !0, c = new a(n.count * s);
|
|
1075
|
+
return Promise.resolve(new P(c, s, i));
|
|
1076
1076
|
}
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1079
|
-
const a =
|
|
1077
|
+
const o = [];
|
|
1078
|
+
return n.bufferView !== void 0 ? o.push(this.getDependency("bufferView", n.bufferView)) : o.push(null), n.sparse !== void 0 && (o.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), o.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(o).then(function(s) {
|
|
1079
|
+
const a = s[0], i = ee[n.type], c = j[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = n.byteOffset || 0, m = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, T = n.normalized === !0;
|
|
1080
1080
|
let R, y;
|
|
1081
1081
|
if (m && m !== l) {
|
|
1082
|
-
const x = Math.floor(f / m), E = "InterleavedBuffer:" +
|
|
1082
|
+
const x = Math.floor(f / m), E = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + x + ":" + n.count;
|
|
1083
1083
|
let S = t.cache.get(E);
|
|
1084
|
-
S || (R = new c(a, x * m,
|
|
1084
|
+
S || (R = new c(a, x * m, n.count * m / u), S = new Ye(R, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
|
|
1085
1085
|
} else
|
|
1086
|
-
a === null ? R = new c(
|
|
1087
|
-
if (
|
|
1088
|
-
const x =
|
|
1086
|
+
a === null ? R = new c(n.count * i) : R = new c(a, f, n.count * i), y = new P(R, i, T);
|
|
1087
|
+
if (n.sparse !== void 0) {
|
|
1088
|
+
const x = ee.SCALAR, E = j[n.sparse.indices.componentType], S = n.sparse.indices.byteOffset || 0, _ = n.sparse.values.byteOffset || 0, M = new E(s[1], S, n.sparse.count * x), I = new c(s[2], _, n.sparse.count * i);
|
|
1089
1089
|
a !== null && (y = new P(y.array.slice(), y.itemSize, y.normalized));
|
|
1090
1090
|
for (let L = 0, h = M.length; L < h; L++) {
|
|
1091
1091
|
const p = M[L];
|
|
@@ -1101,51 +1101,51 @@ class sn {
|
|
|
1101
1101
|
* @return {Promise<THREE.Texture|null>}
|
|
1102
1102
|
*/
|
|
1103
1103
|
loadTexture(e) {
|
|
1104
|
-
const t = this.json,
|
|
1104
|
+
const t = this.json, r = this.options, o = t.textures[e].source, s = t.images[o];
|
|
1105
1105
|
let a = this.textureLoader;
|
|
1106
|
-
if (
|
|
1107
|
-
const i =
|
|
1106
|
+
if (s.uri) {
|
|
1107
|
+
const i = r.manager.getHandler(s.uri);
|
|
1108
1108
|
i !== null && (a = i);
|
|
1109
1109
|
}
|
|
1110
|
-
return this.loadTextureImage(e,
|
|
1110
|
+
return this.loadTextureImage(e, o, a);
|
|
1111
1111
|
}
|
|
1112
|
-
loadTextureImage(e, t,
|
|
1113
|
-
const
|
|
1112
|
+
loadTextureImage(e, t, r) {
|
|
1113
|
+
const n = this, o = this.json, s = o.textures[e], a = o.images[t], i = (a.uri || a.bufferView) + ":" + s.sampler;
|
|
1114
1114
|
if (this.textureCache[i])
|
|
1115
1115
|
return this.textureCache[i];
|
|
1116
|
-
const c = this.loadImageSource(t,
|
|
1117
|
-
u.flipY = !1, u.name =
|
|
1118
|
-
const f = (
|
|
1119
|
-
return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] ||
|
|
1116
|
+
const c = this.loadImageSource(t, r).then(function(u) {
|
|
1117
|
+
u.flipY = !1, u.name = s.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
1118
|
+
const f = (o.samplers || {})[s.sampler] || {};
|
|
1119
|
+
return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || Q, u.wrapT = Ee[f.wrapT] || Q, n.associations.set(u, { textures: e }), u;
|
|
1120
1120
|
}).catch(function() {
|
|
1121
1121
|
return null;
|
|
1122
1122
|
});
|
|
1123
1123
|
return this.textureCache[i] = c, c;
|
|
1124
1124
|
}
|
|
1125
1125
|
loadImageSource(e, t) {
|
|
1126
|
-
const
|
|
1126
|
+
const r = this, n = this.json, o = this.options;
|
|
1127
1127
|
if (this.sourceCache[e] !== void 0)
|
|
1128
1128
|
return this.sourceCache[e].then((l) => l.clone());
|
|
1129
|
-
const
|
|
1130
|
-
let i =
|
|
1131
|
-
if (
|
|
1132
|
-
i =
|
|
1129
|
+
const s = n.images[e], a = self.URL || self.webkitURL;
|
|
1130
|
+
let i = s.uri || "", c = !1;
|
|
1131
|
+
if (s.bufferView !== void 0)
|
|
1132
|
+
i = r.getDependency("bufferView", s.bufferView).then(function(l) {
|
|
1133
1133
|
c = !0;
|
|
1134
|
-
const f = new Blob([l], { type:
|
|
1134
|
+
const f = new Blob([l], { type: s.mimeType });
|
|
1135
1135
|
return i = a.createObjectURL(f), i;
|
|
1136
1136
|
});
|
|
1137
|
-
else if (
|
|
1137
|
+
else if (s.uri === void 0)
|
|
1138
1138
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1139
1139
|
const u = Promise.resolve(i).then(function(l) {
|
|
1140
1140
|
return new Promise(function(f, m) {
|
|
1141
1141
|
let T = f;
|
|
1142
1142
|
t.isImageBitmapLoader === !0 && (T = function(R) {
|
|
1143
|
-
const y = new
|
|
1143
|
+
const y = new he(R);
|
|
1144
1144
|
y.needsUpdate = !0, f(y);
|
|
1145
|
-
}), t.load(X.resolveURL(l,
|
|
1145
|
+
}), t.load(X.resolveURL(l, o.path), T, void 0, m);
|
|
1146
1146
|
});
|
|
1147
1147
|
}).then(function(l) {
|
|
1148
|
-
return c === !0 && a.revokeObjectURL(i), l.userData.mimeType =
|
|
1148
|
+
return c === !0 && a.revokeObjectURL(i), l.userData.mimeType = s.mimeType || tn(s.uri), l;
|
|
1149
1149
|
}).catch(function(l) {
|
|
1150
1150
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", i), l;
|
|
1151
1151
|
});
|
|
@@ -1158,18 +1158,18 @@ class sn {
|
|
|
1158
1158
|
* @param {Object} mapDef
|
|
1159
1159
|
* @return {Promise<Texture>}
|
|
1160
1160
|
*/
|
|
1161
|
-
assignTexture(e, t,
|
|
1162
|
-
const
|
|
1163
|
-
return this.getDependency("texture",
|
|
1164
|
-
if (!
|
|
1165
|
-
if (
|
|
1166
|
-
const a =
|
|
1161
|
+
assignTexture(e, t, r, n) {
|
|
1162
|
+
const o = this;
|
|
1163
|
+
return this.getDependency("texture", r.index).then(function(s) {
|
|
1164
|
+
if (!s) return null;
|
|
1165
|
+
if (r.texCoord !== void 0 && r.texCoord > 0 && (s = s.clone(), s.channel = r.texCoord), o.extensions[b.KHR_TEXTURE_TRANSFORM]) {
|
|
1166
|
+
const a = r.extensions !== void 0 ? r.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1167
1167
|
if (a) {
|
|
1168
|
-
const i =
|
|
1169
|
-
|
|
1168
|
+
const i = o.associations.get(s);
|
|
1169
|
+
s = o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), o.associations.set(s, i);
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
|
-
return
|
|
1172
|
+
return n !== void 0 && (s.colorSpace = n), e[t] = s, s;
|
|
1173
1173
|
});
|
|
1174
1174
|
}
|
|
1175
1175
|
/**
|
|
@@ -1182,24 +1182,24 @@ class sn {
|
|
|
1182
1182
|
*/
|
|
1183
1183
|
assignFinalMaterial(e) {
|
|
1184
1184
|
const t = e.geometry;
|
|
1185
|
-
let
|
|
1186
|
-
const
|
|
1185
|
+
let r = e.material;
|
|
1186
|
+
const n = t.attributes.tangent === void 0, o = t.attributes.color !== void 0, s = t.attributes.normal === void 0;
|
|
1187
1187
|
if (e.isPoints) {
|
|
1188
|
-
const a = "PointsMaterial:" +
|
|
1188
|
+
const a = "PointsMaterial:" + r.uuid;
|
|
1189
1189
|
let i = this.cache.get(a);
|
|
1190
|
-
i || (i = new tt(),
|
|
1190
|
+
i || (i = new tt(), $.prototype.copy.call(i, r), i.color.copy(r.color), i.map = r.map, i.sizeAttenuation = !1, this.cache.add(a, i)), r = i;
|
|
1191
1191
|
} else if (e.isLine) {
|
|
1192
|
-
const a = "LineBasicMaterial:" +
|
|
1192
|
+
const a = "LineBasicMaterial:" + r.uuid;
|
|
1193
1193
|
let i = this.cache.get(a);
|
|
1194
|
-
i || (i = new nt(),
|
|
1194
|
+
i || (i = new nt(), $.prototype.copy.call(i, r), i.color.copy(r.color), i.map = r.map, this.cache.add(a, i)), r = i;
|
|
1195
1195
|
}
|
|
1196
|
-
if (
|
|
1197
|
-
let a = "ClonedMaterial:" +
|
|
1198
|
-
|
|
1196
|
+
if (n || o || s) {
|
|
1197
|
+
let a = "ClonedMaterial:" + r.uuid + ":";
|
|
1198
|
+
n && (a += "derivative-tangents:"), o && (a += "vertex-colors:"), s && (a += "flat-shading:");
|
|
1199
1199
|
let i = this.cache.get(a);
|
|
1200
|
-
i || (i =
|
|
1200
|
+
i || (i = r.clone(), o && (i.vertexColors = !0), s && (i.flatShading = !0), n && (i.normalScale && (i.normalScale.y *= -1), i.clearcoatNormalScale && (i.clearcoatNormalScale.y *= -1)), this.cache.add(a, i), this.associations.set(i, this.associations.get(r))), r = i;
|
|
1201
1201
|
}
|
|
1202
|
-
e.material =
|
|
1202
|
+
e.material = r;
|
|
1203
1203
|
}
|
|
1204
1204
|
getMaterialType() {
|
|
1205
1205
|
return Oe;
|
|
@@ -1210,37 +1210,37 @@ class sn {
|
|
|
1210
1210
|
* @return {Promise<Material>}
|
|
1211
1211
|
*/
|
|
1212
1212
|
loadMaterial(e) {
|
|
1213
|
-
const t = this,
|
|
1214
|
-
let
|
|
1215
|
-
const a = {}, i =
|
|
1213
|
+
const t = this, r = this.json, n = this.extensions, o = r.materials[e];
|
|
1214
|
+
let s;
|
|
1215
|
+
const a = {}, i = o.extensions || {}, c = [];
|
|
1216
1216
|
if (i[b.KHR_MATERIALS_UNLIT]) {
|
|
1217
|
-
const l =
|
|
1218
|
-
|
|
1217
|
+
const l = n[b.KHR_MATERIALS_UNLIT];
|
|
1218
|
+
s = l.getMaterialType(), c.push(l.extendParams(a, o, t));
|
|
1219
1219
|
} else {
|
|
1220
|
-
const l =
|
|
1220
|
+
const l = o.pbrMetallicRoughness || {};
|
|
1221
1221
|
if (a.color = new U(1, 1, 1), a.opacity = 1, Array.isArray(l.baseColorFactor)) {
|
|
1222
1222
|
const f = l.baseColorFactor;
|
|
1223
1223
|
a.color.setRGB(f[0], f[1], f[2], D), a.opacity = f[3];
|
|
1224
1224
|
}
|
|
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))),
|
|
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))), s = this._invokeOne(function(f) {
|
|
1226
1226
|
return f.getMaterialType && f.getMaterialType(e);
|
|
1227
1227
|
}), c.push(Promise.all(this._invokeAll(function(f) {
|
|
1228
1228
|
return f.extendMaterialParams && f.extendMaterialParams(e, a);
|
|
1229
1229
|
})));
|
|
1230
1230
|
}
|
|
1231
|
-
|
|
1232
|
-
const u =
|
|
1233
|
-
if (u ===
|
|
1234
|
-
const l =
|
|
1231
|
+
o.doubleSided === !0 && (a.side = st);
|
|
1232
|
+
const u = o.alphaMode || te.OPAQUE;
|
|
1233
|
+
if (u === te.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, u === te.MASK && (a.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && s !== W && (c.push(t.assignTexture(a, "normalMap", o.normalTexture)), a.normalScale = new Y(1, 1), o.normalTexture.scale !== void 0)) {
|
|
1234
|
+
const l = o.normalTexture.scale;
|
|
1235
1235
|
a.normalScale.set(l, l);
|
|
1236
1236
|
}
|
|
1237
|
-
if (
|
|
1238
|
-
const l =
|
|
1237
|
+
if (o.occlusionTexture !== void 0 && s !== W && (c.push(t.assignTexture(a, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && s !== W) {
|
|
1238
|
+
const l = o.emissiveFactor;
|
|
1239
1239
|
a.emissive = new U().setRGB(l[0], l[1], l[2], D);
|
|
1240
1240
|
}
|
|
1241
|
-
return
|
|
1242
|
-
const l = new
|
|
1243
|
-
return
|
|
1241
|
+
return o.emissiveTexture !== void 0 && s !== W && c.push(t.assignTexture(a, "emissiveMap", o.emissiveTexture, N)), Promise.all(c).then(function() {
|
|
1242
|
+
const l = new s(a);
|
|
1243
|
+
return o.name && (l.name = o.name), F(l, o), t.associations.set(l, { materials: e }), o.extensions && G(n, l, o), l;
|
|
1244
1244
|
});
|
|
1245
1245
|
}
|
|
1246
1246
|
/** When Object3D instances are targeted by animation, they need unique names. */
|
|
@@ -1257,23 +1257,23 @@ class sn {
|
|
|
1257
1257
|
* @return {Promise<Array<BufferGeometry>>}
|
|
1258
1258
|
*/
|
|
1259
1259
|
loadGeometries(e) {
|
|
1260
|
-
const t = this,
|
|
1261
|
-
function
|
|
1262
|
-
return
|
|
1260
|
+
const t = this, r = this.extensions, n = this.primitiveCache;
|
|
1261
|
+
function o(a) {
|
|
1262
|
+
return r[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
|
|
1263
1263
|
return Se(i, a, t);
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
|
-
const
|
|
1266
|
+
const s = [];
|
|
1267
1267
|
for (let a = 0, i = e.length; a < i; a++) {
|
|
1268
|
-
const c = e[a], u = en(c), l =
|
|
1268
|
+
const c = e[a], u = en(c), l = n[u];
|
|
1269
1269
|
if (l)
|
|
1270
|
-
|
|
1270
|
+
s.push(l.promise);
|
|
1271
1271
|
else {
|
|
1272
1272
|
let f;
|
|
1273
|
-
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f =
|
|
1273
|
+
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = o(c) : f = Se(new le(), c, t), n[u] = { primitive: c, promise: f }, s.push(f);
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
1276
|
-
return Promise.all(
|
|
1276
|
+
return Promise.all(s);
|
|
1277
1277
|
}
|
|
1278
1278
|
/**
|
|
1279
1279
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
@@ -1281,19 +1281,19 @@ class sn {
|
|
|
1281
1281
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1282
1282
|
*/
|
|
1283
1283
|
loadMesh(e) {
|
|
1284
|
-
const t = this,
|
|
1285
|
-
for (let i = 0, c =
|
|
1286
|
-
const u =
|
|
1284
|
+
const t = this, r = this.json, n = this.extensions, o = r.meshes[e], s = o.primitives, a = [];
|
|
1285
|
+
for (let i = 0, c = s.length; i < c; i++) {
|
|
1286
|
+
const u = s[i].material === void 0 ? Qt(this.cache) : this.getDependency("material", s[i].material);
|
|
1287
1287
|
a.push(u);
|
|
1288
1288
|
}
|
|
1289
|
-
return a.push(t.loadGeometries(
|
|
1289
|
+
return a.push(t.loadGeometries(s)), Promise.all(a).then(function(i) {
|
|
1290
1290
|
const c = i.slice(0, i.length - 1), u = i[i.length - 1], l = [];
|
|
1291
1291
|
for (let m = 0, T = u.length; m < T; m++) {
|
|
1292
|
-
const R = u[m], y =
|
|
1292
|
+
const R = u[m], y = s[m];
|
|
1293
1293
|
let x;
|
|
1294
1294
|
const E = c[m];
|
|
1295
1295
|
if (y.mode === C.TRIANGLES || y.mode === C.TRIANGLE_STRIP || y.mode === C.TRIANGLE_FAN || y.mode === void 0)
|
|
1296
|
-
x =
|
|
1296
|
+
x = o.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, oe));
|
|
1297
1297
|
else if (y.mode === C.LINES)
|
|
1298
1298
|
x = new it(R, E);
|
|
1299
1299
|
else if (y.mode === C.LINE_STRIP)
|
|
@@ -1304,7 +1304,7 @@ class sn {
|
|
|
1304
1304
|
x = new ut(R, E);
|
|
1305
1305
|
else
|
|
1306
1306
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
1307
|
-
Object.keys(x.geometry.morphAttributes).length > 0 && $t(x,
|
|
1307
|
+
Object.keys(x.geometry.morphAttributes).length > 0 && $t(x, o), x.name = t.createUniqueName(o.name || "mesh_" + e), F(x, o), y.extensions && G(n, x, y), t.assignFinalMaterial(x), l.push(x);
|
|
1308
1308
|
}
|
|
1309
1309
|
for (let m = 0, T = l.length; m < T; m++)
|
|
1310
1310
|
t.associations.set(l[m], {
|
|
@@ -1312,9 +1312,9 @@ class sn {
|
|
|
1312
1312
|
primitives: m
|
|
1313
1313
|
});
|
|
1314
1314
|
if (l.length === 1)
|
|
1315
|
-
return
|
|
1315
|
+
return o.extensions && G(n, l[0], o), l[0];
|
|
1316
1316
|
const f = new z();
|
|
1317
|
-
|
|
1317
|
+
o.extensions && G(n, f, o), t.associations.set(f, { meshes: e });
|
|
1318
1318
|
for (let m = 0, T = l.length; m < T; m++)
|
|
1319
1319
|
f.add(l[m]);
|
|
1320
1320
|
return f;
|
|
@@ -1327,12 +1327,12 @@ class sn {
|
|
|
1327
1327
|
*/
|
|
1328
1328
|
loadCamera(e) {
|
|
1329
1329
|
let t;
|
|
1330
|
-
const
|
|
1331
|
-
if (!
|
|
1330
|
+
const r = this.json.cameras[e], n = r[r.type];
|
|
1331
|
+
if (!n) {
|
|
1332
1332
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1333
1333
|
return;
|
|
1334
1334
|
}
|
|
1335
|
-
return
|
|
1335
|
+
return r.type === "perspective" ? t = new lt(ft.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (t = new dt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (t.name = this.createUniqueName(r.name)), F(t, r), Promise.resolve(t);
|
|
1336
1336
|
}
|
|
1337
1337
|
/**
|
|
1338
1338
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1340,17 +1340,17 @@ class sn {
|
|
|
1340
1340
|
* @return {Promise<Skeleton>}
|
|
1341
1341
|
*/
|
|
1342
1342
|
loadSkin(e) {
|
|
1343
|
-
const t = this.json.skins[e],
|
|
1344
|
-
for (let
|
|
1345
|
-
|
|
1346
|
-
return t.inverseBindMatrices !== void 0 ?
|
|
1347
|
-
const
|
|
1348
|
-
for (let c = 0, u =
|
|
1349
|
-
const l =
|
|
1343
|
+
const t = this.json.skins[e], r = [];
|
|
1344
|
+
for (let n = 0, o = t.joints.length; n < o; n++)
|
|
1345
|
+
r.push(this._loadNodeShallow(t.joints[n]));
|
|
1346
|
+
return t.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", t.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(n) {
|
|
1347
|
+
const o = n.pop(), s = n, a = [], i = [];
|
|
1348
|
+
for (let c = 0, u = s.length; c < u; c++) {
|
|
1349
|
+
const l = s[c];
|
|
1350
1350
|
if (l) {
|
|
1351
1351
|
a.push(l);
|
|
1352
|
-
const f = new
|
|
1353
|
-
|
|
1352
|
+
const f = new J();
|
|
1353
|
+
o !== null && f.fromArray(o.array, c * 16), i.push(f);
|
|
1354
1354
|
} else
|
|
1355
1355
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
1356
1356
|
}
|
|
@@ -1363,13 +1363,13 @@ class sn {
|
|
|
1363
1363
|
* @return {Promise<AnimationClip>}
|
|
1364
1364
|
*/
|
|
1365
1365
|
loadAnimation(e) {
|
|
1366
|
-
const t = this.json,
|
|
1367
|
-
for (let l = 0, f =
|
|
1368
|
-
const m =
|
|
1369
|
-
R.node !== void 0 && (
|
|
1366
|
+
const t = this.json, r = this, n = t.animations[e], o = n.name ? n.name : "animation_" + e, s = [], a = [], i = [], c = [], u = [];
|
|
1367
|
+
for (let l = 0, f = n.channels.length; l < f; l++) {
|
|
1368
|
+
const m = n.channels[l], T = n.samplers[m.sampler], R = m.target, y = R.node, x = n.parameters !== void 0 ? n.parameters[T.input] : T.input, E = n.parameters !== void 0 ? n.parameters[T.output] : T.output;
|
|
1369
|
+
R.node !== void 0 && (s.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", x)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(R));
|
|
1370
1370
|
}
|
|
1371
1371
|
return Promise.all([
|
|
1372
|
-
Promise.all(
|
|
1372
|
+
Promise.all(s),
|
|
1373
1373
|
Promise.all(a),
|
|
1374
1374
|
Promise.all(i),
|
|
1375
1375
|
Promise.all(c),
|
|
@@ -1380,23 +1380,23 @@ class sn {
|
|
|
1380
1380
|
const _ = f[E], M = m[E], I = T[E], L = R[E], h = y[E];
|
|
1381
1381
|
if (_ === void 0) continue;
|
|
1382
1382
|
_.updateMatrix && _.updateMatrix();
|
|
1383
|
-
const p =
|
|
1383
|
+
const p = r._createAnimationTracks(_, M, I, L, h);
|
|
1384
1384
|
if (p)
|
|
1385
1385
|
for (let g = 0; g < p.length; g++)
|
|
1386
1386
|
x.push(p[g]);
|
|
1387
1387
|
}
|
|
1388
|
-
return new pt(
|
|
1388
|
+
return new pt(o, void 0, x);
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
1391
|
createNodeMesh(e) {
|
|
1392
|
-
const t = this.json,
|
|
1393
|
-
return
|
|
1394
|
-
const
|
|
1395
|
-
return
|
|
1392
|
+
const t = this.json, r = this, n = t.nodes[e];
|
|
1393
|
+
return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(o) {
|
|
1394
|
+
const s = r._getNodeRef(r.meshCache, n.mesh, o);
|
|
1395
|
+
return n.weights !== void 0 && s.traverse(function(a) {
|
|
1396
1396
|
if (a.isMesh)
|
|
1397
|
-
for (let i = 0, c =
|
|
1398
|
-
a.morphTargetInfluences[i] =
|
|
1399
|
-
}),
|
|
1397
|
+
for (let i = 0, c = n.weights.length; i < c; i++)
|
|
1398
|
+
a.morphTargetInfluences[i] = n.weights[i];
|
|
1399
|
+
}), s;
|
|
1400
1400
|
});
|
|
1401
1401
|
}
|
|
1402
1402
|
/**
|
|
@@ -1405,13 +1405,13 @@ class sn {
|
|
|
1405
1405
|
* @return {Promise<Object3D>}
|
|
1406
1406
|
*/
|
|
1407
1407
|
loadNode(e) {
|
|
1408
|
-
const t = this.json,
|
|
1408
|
+
const t = this.json, r = this, n = t.nodes[e], o = r._loadNodeShallow(e), s = [], a = n.children || [];
|
|
1409
1409
|
for (let c = 0, u = a.length; c < u; c++)
|
|
1410
|
-
|
|
1411
|
-
const i =
|
|
1410
|
+
s.push(r.getDependency("node", a[c]));
|
|
1411
|
+
const i = n.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", n.skin);
|
|
1412
1412
|
return Promise.all([
|
|
1413
|
-
|
|
1414
|
-
Promise.all(
|
|
1413
|
+
o,
|
|
1414
|
+
Promise.all(s),
|
|
1415
1415
|
i
|
|
1416
1416
|
]).then(function(c) {
|
|
1417
1417
|
const u = c[0], l = c[1], f = c[2];
|
|
@@ -1426,29 +1426,29 @@ class sn {
|
|
|
1426
1426
|
// ._loadNodeShallow() parses a single node.
|
|
1427
1427
|
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1428
1428
|
_loadNodeShallow(e) {
|
|
1429
|
-
const t = this.json,
|
|
1429
|
+
const t = this.json, r = this.extensions, n = this;
|
|
1430
1430
|
if (this.nodeCache[e] !== void 0)
|
|
1431
1431
|
return this.nodeCache[e];
|
|
1432
|
-
const
|
|
1432
|
+
const o = t.nodes[e], s = o.name ? n.createUniqueName(o.name) : "", a = [], i = n._invokeOne(function(c) {
|
|
1433
1433
|
return c.createNodeMesh && c.createNodeMesh(e);
|
|
1434
1434
|
});
|
|
1435
|
-
return i && a.push(i),
|
|
1436
|
-
return
|
|
1437
|
-
})),
|
|
1435
|
+
return i && a.push(i), o.camera !== void 0 && a.push(n.getDependency("camera", o.camera).then(function(c) {
|
|
1436
|
+
return n._getNodeRef(n.cameraCache, o.camera, c);
|
|
1437
|
+
})), n._invokeAll(function(c) {
|
|
1438
1438
|
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
1439
1439
|
}).forEach(function(c) {
|
|
1440
1440
|
a.push(c);
|
|
1441
1441
|
}), this.nodeCache[e] = Promise.all(a).then(function(c) {
|
|
1442
1442
|
let u;
|
|
1443
|
-
if (
|
|
1443
|
+
if (o.isBone === !0 ? u = new mt() : c.length > 1 ? u = new z() : c.length === 1 ? u = c[0] : u = new ue(), u !== c[0])
|
|
1444
1444
|
for (let l = 0, f = c.length; l < f; l++)
|
|
1445
1445
|
u.add(c[l]);
|
|
1446
|
-
if (
|
|
1447
|
-
const l = new
|
|
1448
|
-
l.fromArray(
|
|
1446
|
+
if (o.name && (u.userData.name = o.name, u.name = s), F(u, o), o.extensions && G(r, u, o), o.matrix !== void 0) {
|
|
1447
|
+
const l = new J();
|
|
1448
|
+
l.fromArray(o.matrix), u.applyMatrix4(l);
|
|
1449
1449
|
} else
|
|
1450
|
-
|
|
1451
|
-
return
|
|
1450
|
+
o.translation !== void 0 && u.position.fromArray(o.translation), o.rotation !== void 0 && u.quaternion.fromArray(o.rotation), o.scale !== void 0 && u.scale.fromArray(o.scale);
|
|
1451
|
+
return n.associations.has(u) || n.associations.set(u, {}), n.associations.get(u).nodes = e, u;
|
|
1452
1452
|
}), this.nodeCache[e];
|
|
1453
1453
|
}
|
|
1454
1454
|
/**
|
|
@@ -1457,96 +1457,96 @@ class sn {
|
|
|
1457
1457
|
* @return {Promise<Group>}
|
|
1458
1458
|
*/
|
|
1459
1459
|
loadScene(e) {
|
|
1460
|
-
const t = this.extensions,
|
|
1461
|
-
|
|
1462
|
-
const
|
|
1463
|
-
for (let i = 0, c =
|
|
1464
|
-
a.push(
|
|
1460
|
+
const t = this.extensions, r = this.json.scenes[e], n = this, o = new z();
|
|
1461
|
+
r.name && (o.name = n.createUniqueName(r.name)), F(o, r), r.extensions && G(t, o, r);
|
|
1462
|
+
const s = r.nodes || [], a = [];
|
|
1463
|
+
for (let i = 0, c = s.length; i < c; i++)
|
|
1464
|
+
a.push(n.getDependency("node", s[i]));
|
|
1465
1465
|
return Promise.all(a).then(function(i) {
|
|
1466
1466
|
for (let u = 0, l = i.length; u < l; u++)
|
|
1467
|
-
|
|
1467
|
+
o.add(i[u]);
|
|
1468
1468
|
const c = (u) => {
|
|
1469
1469
|
const l = /* @__PURE__ */ new Map();
|
|
1470
|
-
for (const [f, m] of
|
|
1471
|
-
(f instanceof
|
|
1470
|
+
for (const [f, m] of n.associations)
|
|
1471
|
+
(f instanceof $ || f instanceof he) && l.set(f, m);
|
|
1472
1472
|
return u.traverse((f) => {
|
|
1473
|
-
const m =
|
|
1473
|
+
const m = n.associations.get(f);
|
|
1474
1474
|
m != null && l.set(f, m);
|
|
1475
1475
|
}), l;
|
|
1476
1476
|
};
|
|
1477
|
-
return
|
|
1477
|
+
return n.associations = c(o), o;
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
1480
|
-
_createAnimationTracks(e, t,
|
|
1481
|
-
const
|
|
1482
|
-
k[
|
|
1480
|
+
_createAnimationTracks(e, t, r, n, o) {
|
|
1481
|
+
const s = [], a = e.name ? e.name : e.uuid, i = [];
|
|
1482
|
+
k[o.path] === k.weights ? e.traverse(function(f) {
|
|
1483
1483
|
f.morphTargetInfluences && i.push(f.name ? f.name : f.uuid);
|
|
1484
1484
|
}) : i.push(a);
|
|
1485
1485
|
let c;
|
|
1486
|
-
switch (k[
|
|
1486
|
+
switch (k[o.path]) {
|
|
1487
1487
|
case k.weights:
|
|
1488
|
-
c =
|
|
1488
|
+
c = me;
|
|
1489
1489
|
break;
|
|
1490
1490
|
case k.rotation:
|
|
1491
|
-
c =
|
|
1491
|
+
c = ge;
|
|
1492
1492
|
break;
|
|
1493
1493
|
case k.position:
|
|
1494
1494
|
case k.scale:
|
|
1495
|
-
c =
|
|
1495
|
+
c = pe;
|
|
1496
1496
|
break;
|
|
1497
1497
|
default:
|
|
1498
|
-
switch (
|
|
1498
|
+
switch (r.itemSize) {
|
|
1499
1499
|
case 1:
|
|
1500
|
-
c =
|
|
1500
|
+
c = me;
|
|
1501
1501
|
break;
|
|
1502
1502
|
case 2:
|
|
1503
1503
|
case 3:
|
|
1504
1504
|
default:
|
|
1505
|
-
c =
|
|
1505
|
+
c = pe;
|
|
1506
1506
|
break;
|
|
1507
1507
|
}
|
|
1508
1508
|
break;
|
|
1509
1509
|
}
|
|
1510
|
-
const u =
|
|
1510
|
+
const u = n.interpolation !== void 0 ? Jt[n.interpolation] : ke, l = this._getArrayFromAccessor(r);
|
|
1511
1511
|
for (let f = 0, m = i.length; f < m; f++) {
|
|
1512
1512
|
const T = new c(
|
|
1513
|
-
i[f] + "." + k[
|
|
1513
|
+
i[f] + "." + k[o.path],
|
|
1514
1514
|
t.array,
|
|
1515
1515
|
l,
|
|
1516
1516
|
u
|
|
1517
1517
|
);
|
|
1518
|
-
|
|
1518
|
+
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), s.push(T);
|
|
1519
1519
|
}
|
|
1520
|
-
return
|
|
1520
|
+
return s;
|
|
1521
1521
|
}
|
|
1522
1522
|
_getArrayFromAccessor(e) {
|
|
1523
1523
|
let t = e.array;
|
|
1524
1524
|
if (e.normalized) {
|
|
1525
|
-
const
|
|
1526
|
-
for (let
|
|
1527
|
-
|
|
1528
|
-
t =
|
|
1525
|
+
const r = ae(t.constructor), n = new Float32Array(t.length);
|
|
1526
|
+
for (let o = 0, s = t.length; o < s; o++)
|
|
1527
|
+
n[o] = t[o] * r;
|
|
1528
|
+
t = n;
|
|
1529
1529
|
}
|
|
1530
1530
|
return t;
|
|
1531
1531
|
}
|
|
1532
1532
|
_createCubicSplineTrackInterpolant(e) {
|
|
1533
|
-
e.createInterpolant = function(
|
|
1534
|
-
const
|
|
1535
|
-
return new
|
|
1533
|
+
e.createInterpolant = function(r) {
|
|
1534
|
+
const n = this instanceof ge ? Yt : Ue;
|
|
1535
|
+
return new n(this.times, this.values, this.getValueSize() / 3, r);
|
|
1536
1536
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
1539
|
function rn(d, e, t) {
|
|
1540
|
-
const
|
|
1541
|
-
if (
|
|
1542
|
-
const a = t.json.accessors[
|
|
1540
|
+
const r = e.attributes, n = new yt();
|
|
1541
|
+
if (r.POSITION !== void 0) {
|
|
1542
|
+
const a = t.json.accessors[r.POSITION], i = a.min, c = a.max;
|
|
1543
1543
|
if (i !== void 0 && c !== void 0) {
|
|
1544
|
-
if (
|
|
1544
|
+
if (n.set(
|
|
1545
1545
|
new B(i[0], i[1], i[2]),
|
|
1546
1546
|
new B(c[0], c[1], c[2])
|
|
1547
1547
|
), a.normalized) {
|
|
1548
|
-
const u =
|
|
1549
|
-
|
|
1548
|
+
const u = ae(j[a.componentType]);
|
|
1549
|
+
n.min.multiplyScalar(u), n.max.multiplyScalar(u);
|
|
1550
1550
|
}
|
|
1551
1551
|
} else {
|
|
1552
1552
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1554,16 +1554,16 @@ function rn(d, e, t) {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
} else
|
|
1556
1556
|
return;
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
1557
|
+
const o = e.targets;
|
|
1558
|
+
if (o !== void 0) {
|
|
1559
1559
|
const a = new B(), i = new B();
|
|
1560
|
-
for (let c = 0, u =
|
|
1561
|
-
const l =
|
|
1560
|
+
for (let c = 0, u = o.length; c < u; c++) {
|
|
1561
|
+
const l = o[c];
|
|
1562
1562
|
if (l.POSITION !== void 0) {
|
|
1563
1563
|
const f = t.json.accessors[l.POSITION], m = f.min, T = f.max;
|
|
1564
1564
|
if (m !== void 0 && T !== void 0) {
|
|
1565
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) {
|
|
1566
|
-
const R =
|
|
1566
|
+
const R = ae(j[f.componentType]);
|
|
1567
1567
|
i.multiplyScalar(R);
|
|
1568
1568
|
}
|
|
1569
1569
|
a.max(i);
|
|
@@ -1571,77 +1571,77 @@ function rn(d, e, t) {
|
|
|
1571
1571
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1572
1572
|
}
|
|
1573
1573
|
}
|
|
1574
|
-
|
|
1574
|
+
n.expandByVector(a);
|
|
1575
1575
|
}
|
|
1576
|
-
d.boundingBox =
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1576
|
+
d.boundingBox = n;
|
|
1577
|
+
const s = new xt();
|
|
1578
|
+
n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
|
|
1579
1579
|
}
|
|
1580
1580
|
function Se(d, e, t) {
|
|
1581
|
-
const
|
|
1582
|
-
function
|
|
1583
|
-
return t.getDependency("accessor",
|
|
1581
|
+
const r = e.attributes, n = [];
|
|
1582
|
+
function o(s, a) {
|
|
1583
|
+
return t.getDependency("accessor", s).then(function(i) {
|
|
1584
1584
|
d.setAttribute(a, i);
|
|
1585
1585
|
});
|
|
1586
1586
|
}
|
|
1587
|
-
for (const
|
|
1588
|
-
const a =
|
|
1589
|
-
a in d.attributes ||
|
|
1587
|
+
for (const s in r) {
|
|
1588
|
+
const a = ie[s] || s.toLowerCase();
|
|
1589
|
+
a in d.attributes || n.push(o(r[s], a));
|
|
1590
1590
|
}
|
|
1591
1591
|
if (e.indices !== void 0 && !d.index) {
|
|
1592
|
-
const
|
|
1592
|
+
const s = t.getDependency("accessor", e.indices).then(function(a) {
|
|
1593
1593
|
d.setIndex(a);
|
|
1594
1594
|
});
|
|
1595
|
-
|
|
1595
|
+
n.push(s);
|
|
1596
1596
|
}
|
|
1597
|
-
return
|
|
1597
|
+
return Ae.workingColorSpace !== D && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ae.workingColorSpace}" not supported.`), F(d, e), rn(d, e, t), Promise.all(n).then(function() {
|
|
1598
1598
|
return e.targets !== void 0 ? Zt(d, e.targets, t) : d;
|
|
1599
1599
|
});
|
|
1600
1600
|
}
|
|
1601
1601
|
class on {
|
|
1602
1602
|
parse(e) {
|
|
1603
|
-
const t = {},
|
|
1603
|
+
const t = {}, r = e.split(`
|
|
1604
1604
|
`);
|
|
1605
|
-
let
|
|
1606
|
-
const
|
|
1607
|
-
for (const a of
|
|
1605
|
+
let n = null, o = t;
|
|
1606
|
+
const s = [t];
|
|
1607
|
+
for (const a of r)
|
|
1608
1608
|
if (a.includes("=")) {
|
|
1609
1609
|
const i = a.split("="), c = i[0].trim(), u = i[1].trim();
|
|
1610
1610
|
if (u.endsWith("{")) {
|
|
1611
1611
|
const l = {};
|
|
1612
|
-
|
|
1612
|
+
s.push(l), o[c] = l, o = l;
|
|
1613
1613
|
} else
|
|
1614
|
-
|
|
1614
|
+
o[c] = u;
|
|
1615
1615
|
} else if (a.endsWith("{")) {
|
|
1616
|
-
const i =
|
|
1617
|
-
|
|
1616
|
+
const i = o[n] || {};
|
|
1617
|
+
s.push(i), o[n] = i, o = i;
|
|
1618
1618
|
} else if (a.endsWith("}")) {
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1619
|
+
if (s.pop(), s.length === 0) continue;
|
|
1620
|
+
o = s[s.length - 1];
|
|
1621
1621
|
} else if (a.endsWith("(")) {
|
|
1622
1622
|
const i = {};
|
|
1623
|
-
|
|
1624
|
-
} else a.endsWith(")") ? (
|
|
1623
|
+
s.push(i), n = a.split("(")[0].trim() || n, o[n] = i, o = i;
|
|
1624
|
+
} else a.endsWith(")") ? (s.pop(), o = s[s.length - 1]) : n = a.trim();
|
|
1625
1625
|
return t;
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
-
class an extends
|
|
1628
|
+
class an extends ce {
|
|
1629
1629
|
constructor(e) {
|
|
1630
1630
|
super(e);
|
|
1631
1631
|
}
|
|
1632
|
-
load(e, t,
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1632
|
+
load(e, t, r, n) {
|
|
1633
|
+
const o = this, s = new K(o.manager);
|
|
1634
|
+
s.setPath(o.path), s.setResponseType("arraybuffer"), s.setRequestHeader(o.requestHeader), s.setWithCredentials(o.withCredentials), s.load(e, function(a) {
|
|
1635
1635
|
try {
|
|
1636
|
-
t(
|
|
1636
|
+
t(o.parse(a));
|
|
1637
1637
|
} catch (i) {
|
|
1638
|
-
|
|
1638
|
+
n ? n(i) : console.error(i), o.manager.itemError(e);
|
|
1639
1639
|
}
|
|
1640
|
-
},
|
|
1640
|
+
}, r, n);
|
|
1641
1641
|
}
|
|
1642
1642
|
parse(e) {
|
|
1643
1643
|
const t = new on();
|
|
1644
|
-
function
|
|
1644
|
+
function r(h) {
|
|
1645
1645
|
const p = {};
|
|
1646
1646
|
new K().setResponseType("arraybuffer");
|
|
1647
1647
|
for (const A in h) {
|
|
@@ -1650,21 +1650,21 @@ class an extends ae {
|
|
|
1650
1650
|
p[A] = URL.createObjectURL(w);
|
|
1651
1651
|
}
|
|
1652
1652
|
if (A.endsWith("usd") || A.endsWith("usda")) {
|
|
1653
|
-
if (
|
|
1653
|
+
if (n(h[A])) {
|
|
1654
1654
|
console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1655
1655
|
continue;
|
|
1656
1656
|
}
|
|
1657
|
-
const w =
|
|
1657
|
+
const w = Te(h[A]);
|
|
1658
1658
|
p[A] = t.parse(w);
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
1661
|
return p;
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function n(h) {
|
|
1664
1664
|
const p = h.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
|
|
1665
1665
|
return p.every((A, w) => A === g[w]);
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1667
|
+
function o(h) {
|
|
1668
1668
|
if (h.length < 1) return;
|
|
1669
1669
|
const p = Object.keys(h)[0];
|
|
1670
1670
|
let g = !1;
|
|
@@ -1672,16 +1672,16 @@ class an extends ae {
|
|
|
1672
1672
|
if (p.endsWith("usdc"))
|
|
1673
1673
|
g = !0;
|
|
1674
1674
|
else if (p.endsWith("usd"))
|
|
1675
|
-
if (
|
|
1675
|
+
if (n(h[p]))
|
|
1676
1676
|
g = !0;
|
|
1677
1677
|
else
|
|
1678
1678
|
return h[p];
|
|
1679
1679
|
g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1680
1680
|
}
|
|
1681
|
-
const
|
|
1681
|
+
const s = Rt(new Uint8Array(e)), a = r(s), i = o(s);
|
|
1682
1682
|
if (i === void 0)
|
|
1683
1683
|
return console.warn("THREE.USDZLoader: No usda file found."), new z();
|
|
1684
|
-
const c =
|
|
1684
|
+
const c = Te(i), u = t.parse(c);
|
|
1685
1685
|
function l(h) {
|
|
1686
1686
|
if (h) {
|
|
1687
1687
|
if ("prepend references" in h) {
|
|
@@ -1711,7 +1711,7 @@ class an extends ae {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
function m(h) {
|
|
1713
1713
|
if (!h) return;
|
|
1714
|
-
let p = new
|
|
1714
|
+
let p = new le();
|
|
1715
1715
|
if ("int[] faceVertexIndices" in h) {
|
|
1716
1716
|
const g = JSON.parse(h["int[] faceVertexIndices"]);
|
|
1717
1717
|
p.setIndex(g);
|
|
@@ -1738,11 +1738,11 @@ class an extends ae {
|
|
|
1738
1738
|
}
|
|
1739
1739
|
function T(h, p) {
|
|
1740
1740
|
const g = h.array, A = h.itemSize, w = new g.constructor(p.length * A);
|
|
1741
|
-
let
|
|
1742
|
-
for (let
|
|
1743
|
-
|
|
1744
|
-
for (let
|
|
1745
|
-
w[He++] = g[
|
|
1741
|
+
let fe = 0, He = 0;
|
|
1742
|
+
for (let Z = 0, Ge = p.length; Z < Ge; Z++) {
|
|
1743
|
+
fe = p[Z] * A;
|
|
1744
|
+
for (let de = 0; de < A; de++)
|
|
1745
|
+
w[He++] = g[fe++];
|
|
1746
1746
|
}
|
|
1747
1747
|
return new P(w, A);
|
|
1748
1748
|
}
|
|
@@ -1767,7 +1767,7 @@ class an extends ae {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
}
|
|
1769
1769
|
function x(h, p) {
|
|
1770
|
-
p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new
|
|
1770
|
+
p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new Y().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (h.offset = new Y().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
|
|
1771
1771
|
}
|
|
1772
1772
|
function E(h) {
|
|
1773
1773
|
const p = new O();
|
|
@@ -1840,14 +1840,14 @@ class an extends ae {
|
|
|
1840
1840
|
const p = h["asset inputs:file"].replace(/@*/g, ""), A = new Me().load(a[p]), w = {
|
|
1841
1841
|
'"clamp"': De,
|
|
1842
1842
|
'"mirror"': Ne,
|
|
1843
|
-
'"repeat"':
|
|
1843
|
+
'"repeat"': Q
|
|
1844
1844
|
};
|
|
1845
1845
|
return "token inputs:wrapS" in h && (A.wrapS = w[h["token inputs:wrapS"]]), "token inputs:wrapT" in h && (A.wrapT = w[h["token inputs:wrapT"]]), A;
|
|
1846
1846
|
}
|
|
1847
1847
|
return null;
|
|
1848
1848
|
}
|
|
1849
1849
|
function M(h) {
|
|
1850
|
-
const p = m(l(h)), g = E(R(h)), A = p ? new Pe(p, g) : new
|
|
1850
|
+
const p = m(l(h)), g = E(R(h)), A = p ? new Pe(p, g) : new ue();
|
|
1851
1851
|
if ("matrix4d xformOp:transform" in h) {
|
|
1852
1852
|
const w = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
|
|
1853
1853
|
A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
|
|
@@ -1867,8 +1867,8 @@ class an extends ae {
|
|
|
1867
1867
|
return I(u, L), L;
|
|
1868
1868
|
}
|
|
1869
1869
|
}
|
|
1870
|
-
const
|
|
1871
|
-
class cn extends
|
|
1870
|
+
const se = /* @__PURE__ */ new WeakMap();
|
|
1871
|
+
class cn extends ce {
|
|
1872
1872
|
constructor(e) {
|
|
1873
1873
|
super(e), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
|
|
1874
1874
|
position: "POSITION",
|
|
@@ -1891,67 +1891,67 @@ class cn extends ae {
|
|
|
1891
1891
|
setWorkerLimit(e) {
|
|
1892
1892
|
return this.workerLimit = e, this;
|
|
1893
1893
|
}
|
|
1894
|
-
load(e, t,
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
this.parse(
|
|
1898
|
-
},
|
|
1894
|
+
load(e, t, r, n) {
|
|
1895
|
+
const o = new K(this.manager);
|
|
1896
|
+
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, (s) => {
|
|
1897
|
+
this.parse(s, t, n);
|
|
1898
|
+
}, r, n);
|
|
1899
1899
|
}
|
|
1900
|
-
parse(e, t,
|
|
1900
|
+
parse(e, t, r = () => {
|
|
1901
1901
|
}) {
|
|
1902
|
-
this.decodeDracoFile(e, t, null, null, N).catch(
|
|
1902
|
+
this.decodeDracoFile(e, t, null, null, N).catch(r);
|
|
1903
1903
|
}
|
|
1904
|
-
decodeDracoFile(e, t,
|
|
1904
|
+
decodeDracoFile(e, t, r, n, o = D, s = () => {
|
|
1905
1905
|
}) {
|
|
1906
1906
|
const a = {
|
|
1907
|
-
attributeIDs:
|
|
1908
|
-
attributeTypes:
|
|
1909
|
-
useUniqueIDs: !!
|
|
1910
|
-
vertexColorSpace:
|
|
1907
|
+
attributeIDs: r || this.defaultAttributeIDs,
|
|
1908
|
+
attributeTypes: n || this.defaultAttributeTypes,
|
|
1909
|
+
useUniqueIDs: !!r,
|
|
1910
|
+
vertexColorSpace: o
|
|
1911
1911
|
};
|
|
1912
|
-
return this.decodeGeometry(e, a).then(t).catch(
|
|
1912
|
+
return this.decodeGeometry(e, a).then(t).catch(s);
|
|
1913
1913
|
}
|
|
1914
1914
|
decodeGeometry(e, t) {
|
|
1915
|
-
const
|
|
1916
|
-
if (
|
|
1917
|
-
const i =
|
|
1918
|
-
if (i.key ===
|
|
1915
|
+
const r = JSON.stringify(t);
|
|
1916
|
+
if (se.has(e)) {
|
|
1917
|
+
const i = se.get(e);
|
|
1918
|
+
if (i.key === r)
|
|
1919
1919
|
return i.promise;
|
|
1920
1920
|
if (e.byteLength === 0)
|
|
1921
1921
|
throw new Error(
|
|
1922
1922
|
"THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
|
|
1923
1923
|
);
|
|
1924
1924
|
}
|
|
1925
|
-
let
|
|
1926
|
-
const
|
|
1927
|
-
|
|
1925
|
+
let n;
|
|
1926
|
+
const o = this.workerNextTaskID++, s = e.byteLength, a = this._getWorker(o, s).then((i) => (n = i, new Promise((c, u) => {
|
|
1927
|
+
n._callbacks[o] = { resolve: c, reject: u }, n.postMessage({ type: "decode", id: o, taskConfig: t, buffer: e }, [e]);
|
|
1928
1928
|
}))).then((i) => this._createGeometry(i.geometry));
|
|
1929
1929
|
return a.catch(() => !0).then(() => {
|
|
1930
|
-
|
|
1931
|
-
}),
|
|
1932
|
-
key:
|
|
1930
|
+
n && o && this._releaseTask(n, o);
|
|
1931
|
+
}), se.set(e, {
|
|
1932
|
+
key: r,
|
|
1933
1933
|
promise: a
|
|
1934
1934
|
}), a;
|
|
1935
1935
|
}
|
|
1936
1936
|
_createGeometry(e) {
|
|
1937
|
-
const t = new
|
|
1937
|
+
const t = new le();
|
|
1938
1938
|
e.index && t.setIndex(new P(e.index.array, 1));
|
|
1939
|
-
for (let
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1939
|
+
for (let r = 0; r < e.attributes.length; r++) {
|
|
1940
|
+
const n = e.attributes[r], o = n.name, s = n.array, a = n.itemSize, i = new P(s, a);
|
|
1941
|
+
o === "color" && (this._assignVertexColorSpace(i, n.vertexColorSpace), i.normalized = !(s instanceof Float32Array)), t.setAttribute(o, i);
|
|
1942
1942
|
}
|
|
1943
1943
|
return t;
|
|
1944
1944
|
}
|
|
1945
1945
|
_assignVertexColorSpace(e, t) {
|
|
1946
1946
|
if (t !== N) return;
|
|
1947
|
-
const
|
|
1948
|
-
for (let
|
|
1949
|
-
|
|
1947
|
+
const r = new U();
|
|
1948
|
+
for (let n = 0, o = e.count; n < o; n++)
|
|
1949
|
+
r.fromBufferAttribute(e, n).convertSRGBToLinear(), e.setXYZ(n, r.r, r.g, r.b);
|
|
1950
1950
|
}
|
|
1951
1951
|
_loadLibrary(e, t) {
|
|
1952
|
-
const
|
|
1953
|
-
return
|
|
1954
|
-
|
|
1952
|
+
const r = new K(this.manager);
|
|
1953
|
+
return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((n, o) => {
|
|
1954
|
+
r.load(e, n, void 0, o);
|
|
1955
1955
|
});
|
|
1956
1956
|
}
|
|
1957
1957
|
preload() {
|
|
@@ -1960,43 +1960,43 @@ class cn extends ae {
|
|
|
1960
1960
|
_initDecoder() {
|
|
1961
1961
|
if (this.decoderPending) return this.decoderPending;
|
|
1962
1962
|
const e = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
|
|
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((
|
|
1964
|
-
const
|
|
1965
|
-
e || (this.decoderConfig.wasmBinary =
|
|
1966
|
-
const
|
|
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((r) => {
|
|
1964
|
+
const n = r[0];
|
|
1965
|
+
e || (this.decoderConfig.wasmBinary = r[1]);
|
|
1966
|
+
const o = un.toString(), s = [
|
|
1967
1967
|
"/* draco decoder */",
|
|
1968
|
-
|
|
1968
|
+
n,
|
|
1969
1969
|
"",
|
|
1970
1970
|
"/* worker */",
|
|
1971
|
-
|
|
1971
|
+
o.substring(o.indexOf("{") + 1, o.lastIndexOf("}"))
|
|
1972
1972
|
].join(`
|
|
1973
1973
|
`);
|
|
1974
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([
|
|
1974
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([s]));
|
|
1975
1975
|
}), this.decoderPending;
|
|
1976
1976
|
}
|
|
1977
1977
|
_getWorker(e, t) {
|
|
1978
1978
|
return this._initDecoder().then(() => {
|
|
1979
1979
|
if (this.workerPool.length < this.workerLimit) {
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1982
|
-
const
|
|
1983
|
-
switch (
|
|
1980
|
+
const n = new Worker(this.workerSourceURL);
|
|
1981
|
+
n._callbacks = {}, n._taskCosts = {}, n._taskLoad = 0, n.postMessage({ type: "init", decoderConfig: this.decoderConfig }), n.onmessage = function(o) {
|
|
1982
|
+
const s = o.data;
|
|
1983
|
+
switch (s.type) {
|
|
1984
1984
|
case "decode":
|
|
1985
|
-
|
|
1985
|
+
n._callbacks[s.id].resolve(s);
|
|
1986
1986
|
break;
|
|
1987
1987
|
case "error":
|
|
1988
|
-
|
|
1988
|
+
n._callbacks[s.id].reject(s);
|
|
1989
1989
|
break;
|
|
1990
1990
|
default:
|
|
1991
|
-
console.error('THREE.DRACOLoader: Unexpected message, "' +
|
|
1991
|
+
console.error('THREE.DRACOLoader: Unexpected message, "' + s.type + '"');
|
|
1992
1992
|
}
|
|
1993
|
-
}, this.workerPool.push(
|
|
1993
|
+
}, this.workerPool.push(n);
|
|
1994
1994
|
} else
|
|
1995
|
-
this.workerPool.sort(function(
|
|
1996
|
-
return
|
|
1995
|
+
this.workerPool.sort(function(n, o) {
|
|
1996
|
+
return n._taskLoad > o._taskLoad ? -1 : 1;
|
|
1997
1997
|
});
|
|
1998
|
-
const
|
|
1999
|
-
return
|
|
1998
|
+
const r = this.workerPool[this.workerPool.length - 1];
|
|
1999
|
+
return r._taskCosts[e] = t, r._taskLoad += t, r;
|
|
2000
2000
|
});
|
|
2001
2001
|
}
|
|
2002
2002
|
_releaseTask(e, t) {
|
|
@@ -2013,8 +2013,8 @@ class cn extends ae {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
function un() {
|
|
2015
2015
|
let d, e;
|
|
2016
|
-
onmessage = function(
|
|
2017
|
-
const a =
|
|
2016
|
+
onmessage = function(s) {
|
|
2017
|
+
const a = s.data;
|
|
2018
2018
|
switch (a.type) {
|
|
2019
2019
|
case "init":
|
|
2020
2020
|
d = a.decoderConfig, e = new Promise(function(u) {
|
|
@@ -2039,14 +2039,14 @@ function un() {
|
|
|
2039
2039
|
break;
|
|
2040
2040
|
}
|
|
2041
2041
|
};
|
|
2042
|
-
function t(
|
|
2042
|
+
function t(s, a, i, c) {
|
|
2043
2043
|
const u = c.attributeIDs, l = c.attributeTypes;
|
|
2044
2044
|
let f, m;
|
|
2045
2045
|
const T = a.GetEncodedGeometryType(i);
|
|
2046
|
-
if (T ===
|
|
2047
|
-
f = new
|
|
2048
|
-
else if (T ===
|
|
2049
|
-
f = new
|
|
2046
|
+
if (T === s.TRIANGULAR_MESH)
|
|
2047
|
+
f = new s.Mesh(), m = a.DecodeArrayToMesh(i, i.byteLength, f);
|
|
2048
|
+
else if (T === s.POINT_CLOUD)
|
|
2049
|
+
f = new s.PointCloud(), m = a.DecodeArrayToPointCloud(i, i.byteLength, f);
|
|
2050
2050
|
else
|
|
2051
2051
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2052
2052
|
if (!m.ok() || f.ptr === 0)
|
|
@@ -2058,53 +2058,53 @@ function un() {
|
|
|
2058
2058
|
if (c.useUniqueIDs)
|
|
2059
2059
|
S = u[y], E = a.GetAttributeByUniqueId(f, S);
|
|
2060
2060
|
else {
|
|
2061
|
-
if (S = a.GetAttributeId(f,
|
|
2061
|
+
if (S = a.GetAttributeId(f, s[u[y]]), S === -1) continue;
|
|
2062
2062
|
E = a.GetAttribute(f, S);
|
|
2063
2063
|
}
|
|
2064
|
-
const _ = s
|
|
2064
|
+
const _ = n(s, a, f, y, x, E);
|
|
2065
2065
|
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
|
|
2066
2066
|
}
|
|
2067
|
-
return T ===
|
|
2067
|
+
return T === s.TRIANGULAR_MESH && (R.index = r(s, a, f)), s.destroy(f), R;
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2070
|
-
const u = i.num_faces() * 3, l = u * 4, f =
|
|
2069
|
+
function r(s, a, i) {
|
|
2070
|
+
const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
|
|
2071
2071
|
a.GetTrianglesUInt32Array(i, l, f);
|
|
2072
|
-
const m = new Uint32Array(
|
|
2073
|
-
return
|
|
2072
|
+
const m = new Uint32Array(s.HEAPF32.buffer, f, u).slice();
|
|
2073
|
+
return s._free(f), { array: m, itemSize: 1 };
|
|
2074
2074
|
}
|
|
2075
|
-
function s
|
|
2076
|
-
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y =
|
|
2075
|
+
function n(s, a, i, c, u, l) {
|
|
2076
|
+
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = o(s, u), x = s._malloc(R);
|
|
2077
2077
|
a.GetAttributeDataArrayForAllPoints(i, l, y, R, x);
|
|
2078
|
-
const E = new u(
|
|
2079
|
-
return
|
|
2078
|
+
const E = new u(s.HEAPF32.buffer, x, T).slice();
|
|
2079
|
+
return s._free(x), {
|
|
2080
2080
|
name: c,
|
|
2081
2081
|
array: E,
|
|
2082
2082
|
itemSize: f
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
2085
|
-
function
|
|
2085
|
+
function o(s, a) {
|
|
2086
2086
|
switch (a) {
|
|
2087
2087
|
case Float32Array:
|
|
2088
|
-
return
|
|
2088
|
+
return s.DT_FLOAT32;
|
|
2089
2089
|
case Int8Array:
|
|
2090
|
-
return
|
|
2090
|
+
return s.DT_INT8;
|
|
2091
2091
|
case Int16Array:
|
|
2092
|
-
return
|
|
2092
|
+
return s.DT_INT16;
|
|
2093
2093
|
case Int32Array:
|
|
2094
|
-
return
|
|
2094
|
+
return s.DT_INT32;
|
|
2095
2095
|
case Uint8Array:
|
|
2096
|
-
return
|
|
2096
|
+
return s.DT_UINT8;
|
|
2097
2097
|
case Uint16Array:
|
|
2098
|
-
return
|
|
2098
|
+
return s.DT_UINT16;
|
|
2099
2099
|
case Uint32Array:
|
|
2100
|
-
return
|
|
2100
|
+
return s.DT_UINT32;
|
|
2101
2101
|
}
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
2104
|
function ln() {
|
|
2105
2105
|
let d, e;
|
|
2106
|
-
onmessage = function(
|
|
2107
|
-
const a =
|
|
2106
|
+
onmessage = function(s) {
|
|
2107
|
+
const a = s.data;
|
|
2108
2108
|
switch (a.type) {
|
|
2109
2109
|
case "init":
|
|
2110
2110
|
d = a.decoderConfig, e = new Promise(function(u) {
|
|
@@ -2143,18 +2143,18 @@ function ln() {
|
|
|
2143
2143
|
break;
|
|
2144
2144
|
}
|
|
2145
2145
|
};
|
|
2146
|
-
function t(
|
|
2146
|
+
function t(s, a, i, c) {
|
|
2147
2147
|
const u = c.attributeIDs, l = c.attributeTypes;
|
|
2148
2148
|
let f, m;
|
|
2149
2149
|
const T = a.GetEncodedGeometryType(i);
|
|
2150
|
-
if (T ===
|
|
2151
|
-
f = new
|
|
2150
|
+
if (T === s.TRIANGULAR_MESH)
|
|
2151
|
+
f = new s.Mesh(), m = a.DecodeArrayToMesh(
|
|
2152
2152
|
i,
|
|
2153
2153
|
i.byteLength,
|
|
2154
2154
|
f
|
|
2155
2155
|
);
|
|
2156
|
-
else if (T ===
|
|
2157
|
-
f = new
|
|
2156
|
+
else if (T === s.POINT_CLOUD)
|
|
2157
|
+
f = new s.PointCloud(), m = a.DecodeArrayToPointCloud(
|
|
2158
2158
|
i,
|
|
2159
2159
|
i.byteLength,
|
|
2160
2160
|
f
|
|
@@ -2177,12 +2177,12 @@ function ln() {
|
|
|
2177
2177
|
else {
|
|
2178
2178
|
if (S = a.GetAttributeId(
|
|
2179
2179
|
f,
|
|
2180
|
-
|
|
2180
|
+
s[u[y]]
|
|
2181
2181
|
), S === -1) continue;
|
|
2182
2182
|
E = a.GetAttribute(f, S);
|
|
2183
2183
|
}
|
|
2184
|
-
const _ =
|
|
2185
|
-
|
|
2184
|
+
const _ = n(
|
|
2185
|
+
s,
|
|
2186
2186
|
a,
|
|
2187
2187
|
f,
|
|
2188
2188
|
y,
|
|
@@ -2191,20 +2191,20 @@ function ln() {
|
|
|
2191
2191
|
);
|
|
2192
2192
|
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), R.attributes.push(_);
|
|
2193
2193
|
}
|
|
2194
|
-
return T ===
|
|
2194
|
+
return T === s.TRIANGULAR_MESH && (R.index = r(s, a, f)), s.destroy(f), R;
|
|
2195
2195
|
}
|
|
2196
|
-
function
|
|
2197
|
-
const u = i.num_faces() * 3, l = u * 4, f =
|
|
2196
|
+
function r(s, a, i) {
|
|
2197
|
+
const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
|
|
2198
2198
|
a.GetTrianglesUInt32Array(i, l, f);
|
|
2199
2199
|
const m = new Uint32Array(
|
|
2200
|
-
|
|
2200
|
+
s.HEAPF32.buffer,
|
|
2201
2201
|
f,
|
|
2202
2202
|
u
|
|
2203
2203
|
).slice();
|
|
2204
|
-
return
|
|
2204
|
+
return s._free(f), { array: m, itemSize: 1 };
|
|
2205
2205
|
}
|
|
2206
|
-
function s
|
|
2207
|
-
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y =
|
|
2206
|
+
function n(s, a, i, c, u, l) {
|
|
2207
|
+
const f = l.num_components(), T = i.num_points() * f, R = T * u.BYTES_PER_ELEMENT, y = o(s, u), x = s._malloc(R);
|
|
2208
2208
|
a.GetAttributeDataArrayForAllPoints(
|
|
2209
2209
|
i,
|
|
2210
2210
|
l,
|
|
@@ -2213,36 +2213,36 @@ function ln() {
|
|
|
2213
2213
|
x
|
|
2214
2214
|
);
|
|
2215
2215
|
const E = new u(
|
|
2216
|
-
|
|
2216
|
+
s.HEAPF32.buffer,
|
|
2217
2217
|
x,
|
|
2218
2218
|
T
|
|
2219
2219
|
).slice();
|
|
2220
|
-
return
|
|
2220
|
+
return s._free(x), {
|
|
2221
2221
|
name: c,
|
|
2222
2222
|
array: E,
|
|
2223
2223
|
itemSize: f
|
|
2224
2224
|
};
|
|
2225
2225
|
}
|
|
2226
|
-
function
|
|
2226
|
+
function o(s, a) {
|
|
2227
2227
|
switch (a) {
|
|
2228
2228
|
case Float32Array:
|
|
2229
|
-
return
|
|
2229
|
+
return s.DT_FLOAT32;
|
|
2230
2230
|
case Int8Array:
|
|
2231
|
-
return
|
|
2231
|
+
return s.DT_INT8;
|
|
2232
2232
|
case Int16Array:
|
|
2233
|
-
return
|
|
2233
|
+
return s.DT_INT16;
|
|
2234
2234
|
case Int32Array:
|
|
2235
|
-
return
|
|
2235
|
+
return s.DT_INT32;
|
|
2236
2236
|
case Uint8Array:
|
|
2237
|
-
return
|
|
2237
|
+
return s.DT_UINT8;
|
|
2238
2238
|
case Uint16Array:
|
|
2239
|
-
return
|
|
2239
|
+
return s.DT_UINT16;
|
|
2240
2240
|
case Uint32Array:
|
|
2241
|
-
return
|
|
2241
|
+
return s.DT_UINT32;
|
|
2242
2242
|
}
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
|
-
const
|
|
2245
|
+
const re = {
|
|
2246
2246
|
LOAD_DRACO_JS_DECODER: async () => (await import("./draco_decoder-CEzwqP9o.mjs")).default,
|
|
2247
2247
|
LOAD_DRACO_WASM_WRAPPER: async () => (await import("./draco_wasm_wrapper-yQy2VLhb.mjs")).default,
|
|
2248
2248
|
LOAD_DRACO_WASM_DECODER: async () => {
|
|
@@ -2262,23 +2262,23 @@ class fn extends cn {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
async _initDecoder() {
|
|
2264
2264
|
if (this.decoderPending) return this.decoderPending;
|
|
2265
|
-
const t = typeof WebAssembly != "object" || this.decoderConfig.type === "js",
|
|
2266
|
-
return t ?
|
|
2267
|
-
|
|
2268
|
-
) : (
|
|
2269
|
-
|
|
2270
|
-
),
|
|
2271
|
-
|
|
2272
|
-
)), this.decoderPending = Promise.all(
|
|
2273
|
-
(
|
|
2274
|
-
const
|
|
2275
|
-
t || (this.decoderConfig.wasmBinary =
|
|
2276
|
-
const
|
|
2265
|
+
const t = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
|
|
2266
|
+
return t ? r.push(
|
|
2267
|
+
re.LOAD_DRACO_JS_DECODER()
|
|
2268
|
+
) : (r.push(
|
|
2269
|
+
re.LOAD_DRACO_WASM_WRAPPER()
|
|
2270
|
+
), r.push(
|
|
2271
|
+
re.LOAD_DRACO_WASM_DECODER()
|
|
2272
|
+
)), this.decoderPending = Promise.all(r).then(
|
|
2273
|
+
(n) => {
|
|
2274
|
+
const o = n[0];
|
|
2275
|
+
t || (this.decoderConfig.wasmBinary = n[1]);
|
|
2276
|
+
const s = ln.toString(), a = [
|
|
2277
2277
|
"/* draco decoder */",
|
|
2278
|
-
|
|
2278
|
+
o,
|
|
2279
2279
|
"",
|
|
2280
2280
|
"/* worker */",
|
|
2281
|
-
|
|
2281
|
+
s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"))
|
|
2282
2282
|
].join(`
|
|
2283
2283
|
`);
|
|
2284
2284
|
this.workerSourceURL = URL.createObjectURL(new Blob([a]));
|
|
@@ -2293,20 +2293,48 @@ class yn {
|
|
|
2293
2293
|
const e = new fn();
|
|
2294
2294
|
e.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new St(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new an();
|
|
2295
2295
|
}
|
|
2296
|
-
async load(e) {
|
|
2297
|
-
|
|
2298
|
-
if (t
|
|
2299
|
-
|
|
2300
|
-
if (
|
|
2301
|
-
throw new
|
|
2302
|
-
|
|
2303
|
-
|
|
2296
|
+
async load(e, t) {
|
|
2297
|
+
let r;
|
|
2298
|
+
if (t)
|
|
2299
|
+
r = t;
|
|
2300
|
+
else if (r = wt(e), r.length === 0 && (r = await this._detectFileTypeFromContent(e), r.length === 0))
|
|
2301
|
+
throw new ye(
|
|
2302
|
+
"No file extension found in URI",
|
|
2303
|
+
""
|
|
2304
2304
|
);
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2305
|
+
if (!Et(r))
|
|
2306
|
+
throw new ye(
|
|
2307
|
+
`Unsupported file type: ${r}. Supported types: ${_t.join(", ")}`,
|
|
2308
|
+
r
|
|
2309
|
+
);
|
|
2310
|
+
const n = q.read(e);
|
|
2311
|
+
if (n)
|
|
2312
|
+
return n.arrayBuffer ? this._parse(n.arrayBuffer, r) : n.promise.then((a) => this._parse(a, r));
|
|
2313
|
+
const s = await q.create(e).load();
|
|
2314
|
+
return this._parse(s, r);
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* Detects file type from content (magic bytes)
|
|
2318
|
+
* @param uri - The URI to load and detect
|
|
2319
|
+
* @returns The detected file extension or empty string if detection fails
|
|
2320
|
+
*/
|
|
2321
|
+
async _detectFileTypeFromContent(e) {
|
|
2322
|
+
try {
|
|
2323
|
+
const t = q.read(e);
|
|
2324
|
+
let r;
|
|
2325
|
+
t ? t.arrayBuffer ? r = t.arrayBuffer : r = await t.promise : r = await q.create(e).load();
|
|
2326
|
+
const n = new Uint8Array(r);
|
|
2327
|
+
return n.length >= 12 && String.fromCharCode(
|
|
2328
|
+
n[0],
|
|
2329
|
+
n[1],
|
|
2330
|
+
n[2],
|
|
2331
|
+
n[3]
|
|
2332
|
+
) === "glTF" ? n[12] === 0 ? "glb" : "gltf" : n.length >= 4 && n[0] === 80 && // 'P'
|
|
2333
|
+
n[1] === 75 && // 'K'
|
|
2334
|
+
(n[2] === 3 || n[2] === 5) && (n[3] === 4 || n[3] === 6) ? "usdz" : "";
|
|
2335
|
+
} catch {
|
|
2336
|
+
return "";
|
|
2337
|
+
}
|
|
2310
2338
|
}
|
|
2311
2339
|
/**
|
|
2312
2340
|
* parse function for the chunk
|
|
@@ -2326,11 +2354,11 @@ class yn {
|
|
|
2326
2354
|
case "usdz":
|
|
2327
2355
|
return await this._usdzLoader.parse(e);
|
|
2328
2356
|
}
|
|
2329
|
-
} catch (
|
|
2330
|
-
throw
|
|
2331
|
-
`Failed to parse ${t} file: ${
|
|
2332
|
-
|
|
2333
|
-
) : new
|
|
2357
|
+
} catch (r) {
|
|
2358
|
+
throw r instanceof Error ? new xe(
|
|
2359
|
+
`Failed to parse ${t} file: ${r.message}`,
|
|
2360
|
+
r
|
|
2361
|
+
) : new xe(`Failed to parse ${t} file`);
|
|
2334
2362
|
}
|
|
2335
2363
|
}
|
|
2336
2364
|
}
|