@shopware-ag/dive 2.2.29 → 2.2.30
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-DUmXyTTh.mjs → AssetCache-BAVgjwZD.mjs} +1 -1
- package/build/chunks/{AssetCache-5v3VEUpV.cjs → AssetCache-DqR9MuYr.cjs} +1 -1
- package/build/chunks/{AssetLoader-CAboRD-N.mjs → AssetLoader-DYfC6o4E.mjs} +984 -772
- package/build/chunks/AssetLoader-ULFVz0k1.cjs +5 -0
- package/build/chunks/{FileTypes-OWYPzqcN.mjs → FileTypes-Bf6fWggQ.mjs} +25 -9
- package/build/chunks/{FileTypes-BQ2AN2gJ.cjs → FileTypes-DvYQDBRG.cjs} +1 -1
- package/build/chunks/{isFileTypeSupported-BSpswPHU.mjs → isFileTypeSupported-DRAnF6K8.mjs} +6 -5
- package/build/chunks/isFileTypeSupported-rlWKlVtV.cjs +1 -0
- package/build/chunks/occt-import-js-BQ1yZHCj.cjs +1 -0
- package/build/chunks/occt-import-js-D-bjjBtk.mjs +4 -0
- package/build/chunks/occt-import-js-DdbbsFBH.cjs +1 -0
- package/build/chunks/occt-import-js-ekuHaP1Z.mjs +4 -0
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- 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/assetexporter/src/AssetExporter.d.ts +4 -0
- 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 +1 -0
- package/build/plugins/assetloader/src/step/STEPLoader.d.ts +29 -0
- 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 +1 -1
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +1 -1
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +1 -1
- package/build/types/file/FileTypes.d.ts +16 -0
- package/package.json +3 -2
- package/build/chunks/AssetLoader-tskoQtbb.cjs +0 -4
- package/build/chunks/isFileTypeSupported-CrEqYiv9.cjs +0 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { TrianglesDrawMode as
|
|
5
|
-
import { u as Rt, a as
|
|
6
|
-
import { S as
|
|
7
|
-
import { g as
|
|
8
|
-
import { F as
|
|
9
|
-
import { A as q } from "./AssetCache-
|
|
10
|
-
function
|
|
11
|
-
if (e ===
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var je = (d, e, t) => e in d ? Be(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
3
|
+
var O = (d, e, t) => je(d, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { TrianglesDrawMode as Ke, TriangleFanDrawMode as ie, TriangleStripDrawMode as Ie, Loader as le, LoaderUtils as z, FileLoader as W, MeshPhysicalMaterial as P, Vector2 as Y, Color as G, LinearSRGBColorSpace as k, SRGBColorSpace as D, SpotLight as We, PointLight as Ve, DirectionalLight as Xe, Matrix4 as J, Vector3 as j, Quaternion as Ce, InstancedMesh as ze, InstancedBufferAttribute as qe, Object3D as ue, TextureLoader as Ne, ImageBitmapLoader as Ye, BufferAttribute as N, InterleavedBuffer as Je, InterleavedBufferAttribute as Qe, LinearMipmapLinearFilter as Oe, NearestMipmapLinearFilter as Ze, LinearMipmapNearestFilter as $e, NearestMipmapNearestFilter as et, LinearFilter as De, NearestFilter as tt, RepeatWrapping as Q, MirroredRepeatWrapping as ke, ClampToEdgeWrapping as Pe, PointsMaterial as nt, Material as ee, LineBasicMaterial as st, MeshStandardMaterial as fe, DoubleSide as rt, MeshBasicMaterial as X, PropertyBinding as ot, BufferGeometry as Z, SkinnedMesh as it, Mesh as de, LineSegments as at, Line as ct, LineLoop as lt, Points as ut, Group as B, PerspectiveCamera as ft, MathUtils as dt, OrthographicCamera as ht, Skeleton as pt, AnimationClip as mt, Bone as gt, InterpolateDiscrete as At, InterpolateLinear as Fe, Texture as me, VectorKeyframeTrack as ge, NumberKeyframeTrack as Ae, QuaternionKeyframeTrack as Te, ColorManagement as _e, FrontSide as Tt, Interpolant as _t, Box3 as yt, Sphere as wt, NoColorSpace as H } from "three";
|
|
5
|
+
import { u as Rt, a as ye } from "./fflate.module-xyO_T3Zm.mjs";
|
|
6
|
+
import { S as xt } from "./FileTypes-Bf6fWggQ.mjs";
|
|
7
|
+
import { g as Et, i as St } from "./isFileTypeSupported-DRAnF6K8.mjs";
|
|
8
|
+
import { F as we, P as Re } from "./parse-error-DfOPyLWM.mjs";
|
|
9
|
+
import { A as q } from "./AssetCache-BAVgjwZD.mjs";
|
|
10
|
+
function xe(d, e) {
|
|
11
|
+
if (e === Ke)
|
|
12
12
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
|
13
|
-
if (e ===
|
|
13
|
+
if (e === ie || e === Ie) {
|
|
14
14
|
let t = d.getIndex();
|
|
15
15
|
if (t === null) {
|
|
16
|
-
const s = [],
|
|
17
|
-
if (
|
|
18
|
-
for (let
|
|
19
|
-
s.push(
|
|
16
|
+
const s = [], i = d.getAttribute("position");
|
|
17
|
+
if (i !== void 0) {
|
|
18
|
+
for (let a = 0; a < i.count; a++)
|
|
19
|
+
s.push(a);
|
|
20
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
24
|
const r = t.count - 2, n = [];
|
|
25
|
-
if (e ===
|
|
25
|
+
if (e === ie)
|
|
26
26
|
for (let s = 1; s <= r; s++)
|
|
27
27
|
n.push(t.getX(0)), n.push(t.getX(s)), n.push(t.getX(s + 1));
|
|
28
28
|
else
|
|
@@ -34,40 +34,40 @@ function Re(d, e) {
|
|
|
34
34
|
} else
|
|
35
35
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", e), d;
|
|
36
36
|
}
|
|
37
|
-
class
|
|
37
|
+
class bt extends le {
|
|
38
38
|
constructor(e) {
|
|
39
39
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
40
|
-
return new
|
|
41
|
-
}), this.register(function(t) {
|
|
42
|
-
return new Gt(t);
|
|
40
|
+
return new Nt(t);
|
|
43
41
|
}), this.register(function(t) {
|
|
44
42
|
return new vt(t);
|
|
45
43
|
}), this.register(function(t) {
|
|
46
44
|
return new Bt(t);
|
|
45
|
+
}), this.register(function(t) {
|
|
46
|
+
return new jt(t);
|
|
47
47
|
}), this.register(function(t) {
|
|
48
48
|
return new Dt(t);
|
|
49
49
|
}), this.register(function(t) {
|
|
50
|
-
return new
|
|
50
|
+
return new kt(t);
|
|
51
51
|
}), this.register(function(t) {
|
|
52
52
|
return new Pt(t);
|
|
53
53
|
}), this.register(function(t) {
|
|
54
|
-
return new
|
|
54
|
+
return new Ft(t);
|
|
55
55
|
}), this.register(function(t) {
|
|
56
|
-
return new
|
|
56
|
+
return new Ct(t);
|
|
57
57
|
}), this.register(function(t) {
|
|
58
|
-
return new
|
|
58
|
+
return new Ut(t);
|
|
59
59
|
}), this.register(function(t) {
|
|
60
|
-
return new
|
|
60
|
+
return new Ot(t);
|
|
61
61
|
}), this.register(function(t) {
|
|
62
62
|
return new Ht(t);
|
|
63
63
|
}), this.register(function(t) {
|
|
64
|
-
return new
|
|
64
|
+
return new Gt(t);
|
|
65
65
|
}), this.register(function(t) {
|
|
66
|
-
return new
|
|
67
|
-
}), this.register(function(t) {
|
|
68
|
-
return new jt(t);
|
|
66
|
+
return new Mt(t);
|
|
69
67
|
}), this.register(function(t) {
|
|
70
68
|
return new Kt(t);
|
|
69
|
+
}), this.register(function(t) {
|
|
70
|
+
return new Wt(t);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
load(e, t, r, n) {
|
|
@@ -76,23 +76,23 @@ class St extends ce {
|
|
|
76
76
|
if (this.resourcePath !== "")
|
|
77
77
|
s = this.resourcePath;
|
|
78
78
|
else if (this.path !== "") {
|
|
79
|
-
const c =
|
|
80
|
-
s =
|
|
79
|
+
const c = z.extractUrlBase(e);
|
|
80
|
+
s = z.resolveURL(c, this.path);
|
|
81
81
|
} else
|
|
82
|
-
s =
|
|
82
|
+
s = z.extractUrlBase(e);
|
|
83
83
|
this.manager.itemStart(e);
|
|
84
|
-
const
|
|
84
|
+
const i = function(c) {
|
|
85
85
|
n ? n(c) : console.error(c), o.manager.itemError(e), o.manager.itemEnd(e);
|
|
86
|
-
},
|
|
87
|
-
|
|
86
|
+
}, a = new W(this.manager);
|
|
87
|
+
a.setPath(this.path), a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) {
|
|
88
88
|
try {
|
|
89
|
-
o.parse(c, s, function(
|
|
90
|
-
t(
|
|
91
|
-
},
|
|
92
|
-
} catch (
|
|
93
|
-
|
|
89
|
+
o.parse(c, s, function(l) {
|
|
90
|
+
t(l), o.manager.itemEnd(e);
|
|
91
|
+
}, i);
|
|
92
|
+
} catch (l) {
|
|
93
|
+
i(l);
|
|
94
94
|
}
|
|
95
|
-
}, r,
|
|
95
|
+
}, r, i);
|
|
96
96
|
}
|
|
97
97
|
setDRACOLoader(e) {
|
|
98
98
|
return this.dracoLoader = e, this;
|
|
@@ -116,27 +116,27 @@ class St extends ce {
|
|
|
116
116
|
}
|
|
117
117
|
parse(e, t, r, n) {
|
|
118
118
|
let o;
|
|
119
|
-
const s = {},
|
|
119
|
+
const s = {}, i = {}, a = new TextDecoder();
|
|
120
120
|
if (typeof e == "string")
|
|
121
121
|
o = JSON.parse(e);
|
|
122
122
|
else if (e instanceof ArrayBuffer)
|
|
123
|
-
if (
|
|
123
|
+
if (a.decode(new Uint8Array(e, 0, 4)) === Ue) {
|
|
124
124
|
try {
|
|
125
125
|
s[b.KHR_BINARY_GLTF] = new Vt(e);
|
|
126
|
-
} catch (
|
|
127
|
-
n && n(
|
|
126
|
+
} catch (u) {
|
|
127
|
+
n && n(u);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
o = JSON.parse(s[b.KHR_BINARY_GLTF].content);
|
|
131
131
|
} else
|
|
132
|
-
o = JSON.parse(
|
|
132
|
+
o = JSON.parse(a.decode(e));
|
|
133
133
|
else
|
|
134
134
|
o = e;
|
|
135
135
|
if (o.asset === void 0 || o.asset.version[0] < 2) {
|
|
136
136
|
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
const c = new
|
|
139
|
+
const c = new rn(o, {
|
|
140
140
|
path: t || this.resourcePath || "",
|
|
141
141
|
crossOrigin: this.crossOrigin,
|
|
142
142
|
requestHeader: this.requestHeader,
|
|
@@ -145,31 +145,31 @@ class St extends ce {
|
|
|
145
145
|
meshoptDecoder: this.meshoptDecoder
|
|
146
146
|
});
|
|
147
147
|
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
148
|
-
for (let
|
|
149
|
-
const
|
|
150
|
-
|
|
148
|
+
for (let l = 0; l < this.pluginCallbacks.length; l++) {
|
|
149
|
+
const u = this.pluginCallbacks[l](c);
|
|
150
|
+
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), i[u.name] = u, s[u.name] = !0;
|
|
151
151
|
}
|
|
152
152
|
if (o.extensionsUsed)
|
|
153
|
-
for (let
|
|
154
|
-
const
|
|
155
|
-
switch (
|
|
153
|
+
for (let l = 0; l < o.extensionsUsed.length; ++l) {
|
|
154
|
+
const u = o.extensionsUsed[l], f = o.extensionsRequired || [];
|
|
155
|
+
switch (u) {
|
|
156
156
|
case b.KHR_MATERIALS_UNLIT:
|
|
157
|
-
s[
|
|
157
|
+
s[u] = new It();
|
|
158
158
|
break;
|
|
159
159
|
case b.KHR_DRACO_MESH_COMPRESSION:
|
|
160
|
-
s[
|
|
160
|
+
s[u] = new Xt(o, this.dracoLoader);
|
|
161
161
|
break;
|
|
162
162
|
case b.KHR_TEXTURE_TRANSFORM:
|
|
163
|
-
s[
|
|
163
|
+
s[u] = new zt();
|
|
164
164
|
break;
|
|
165
165
|
case b.KHR_MESH_QUANTIZATION:
|
|
166
|
-
s[
|
|
166
|
+
s[u] = new qt();
|
|
167
167
|
break;
|
|
168
168
|
default:
|
|
169
|
-
f.indexOf(
|
|
169
|
+
f.indexOf(u) >= 0 && i[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
c.setExtensions(s), c.setPlugins(
|
|
172
|
+
c.setExtensions(s), c.setPlugins(i), c.parse(r, n);
|
|
173
173
|
}
|
|
174
174
|
parseAsync(e, t) {
|
|
175
175
|
const r = this;
|
|
@@ -178,7 +178,7 @@ class St extends ce {
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Lt() {
|
|
182
182
|
let d = {};
|
|
183
183
|
return {
|
|
184
184
|
get: function(e) {
|
|
@@ -218,7 +218,7 @@ const b = {
|
|
|
218
218
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
219
219
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
220
220
|
};
|
|
221
|
-
class
|
|
221
|
+
class Mt {
|
|
222
222
|
constructor(e) {
|
|
223
223
|
this.parser = e, this.name = b.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
224
224
|
}
|
|
@@ -233,59 +233,59 @@ class Lt {
|
|
|
233
233
|
const t = this.parser, r = "light:" + e;
|
|
234
234
|
let n = t.cache.get(r);
|
|
235
235
|
if (n) return n;
|
|
236
|
-
const o = t.json,
|
|
236
|
+
const o = t.json, a = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e];
|
|
237
237
|
let c;
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
switch (
|
|
238
|
+
const l = new G(16777215);
|
|
239
|
+
a.color !== void 0 && l.setRGB(a.color[0], a.color[1], a.color[2], k);
|
|
240
|
+
const u = a.range !== void 0 ? a.range : 0;
|
|
241
|
+
switch (a.type) {
|
|
242
242
|
case "directional":
|
|
243
|
-
c = new
|
|
243
|
+
c = new Xe(l), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
244
244
|
break;
|
|
245
245
|
case "point":
|
|
246
|
-
c = new Ve(
|
|
246
|
+
c = new Ve(l), c.distance = u;
|
|
247
247
|
break;
|
|
248
248
|
case "spot":
|
|
249
|
-
c = new
|
|
249
|
+
c = new We(l), c.distance = u, a.spot = a.spot || {}, a.spot.innerConeAngle = a.spot.innerConeAngle !== void 0 ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = a.spot.outerConeAngle !== void 0 ? a.spot.outerConeAngle : Math.PI / 4, c.angle = a.spot.outerConeAngle, c.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
250
250
|
break;
|
|
251
251
|
default:
|
|
252
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " +
|
|
252
|
+
throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type);
|
|
253
253
|
}
|
|
254
|
-
return c.position.set(0, 0, 0), c.decay = 2,
|
|
254
|
+
return c.position.set(0, 0, 0), c.decay = 2, U(c, a), a.intensity !== void 0 && (c.intensity = a.intensity), c.name = t.createUniqueName(a.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, r = this.parser, o = r.json.nodes[e],
|
|
262
|
-
return
|
|
263
|
-
return r._getNodeRef(t.cache,
|
|
261
|
+
const t = this, r = this.parser, o = r.json.nodes[e], i = (o.extensions && o.extensions[this.name] || {}).light;
|
|
262
|
+
return i === void 0 ? null : this._loadLight(i).then(function(a) {
|
|
263
|
+
return r._getNodeRef(t.cache, i, a);
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
class
|
|
267
|
+
class It {
|
|
268
268
|
constructor() {
|
|
269
269
|
this.name = b.KHR_MATERIALS_UNLIT;
|
|
270
270
|
}
|
|
271
271
|
getMaterialType() {
|
|
272
|
-
return
|
|
272
|
+
return X;
|
|
273
273
|
}
|
|
274
274
|
extendParams(e, t, r) {
|
|
275
275
|
const n = [];
|
|
276
|
-
e.color = new
|
|
276
|
+
e.color = new G(1, 1, 1), e.opacity = 1;
|
|
277
277
|
const o = t.pbrMetallicRoughness;
|
|
278
278
|
if (o) {
|
|
279
279
|
if (Array.isArray(o.baseColorFactor)) {
|
|
280
280
|
const s = o.baseColorFactor;
|
|
281
|
-
e.color.setRGB(s[0], s[1], s[2],
|
|
281
|
+
e.color.setRGB(s[0], s[1], s[2], k), e.opacity = s[3];
|
|
282
282
|
}
|
|
283
|
-
o.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", o.baseColorTexture,
|
|
283
|
+
o.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", o.baseColorTexture, D));
|
|
284
284
|
}
|
|
285
285
|
return Promise.all(n);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
class
|
|
288
|
+
class Ct {
|
|
289
289
|
constructor(e) {
|
|
290
290
|
this.parser = e, this.name = b.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
291
291
|
}
|
|
@@ -297,13 +297,13 @@ class It {
|
|
|
297
297
|
return o !== void 0 && (t.emissiveIntensity = o), Promise.resolve();
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
class
|
|
300
|
+
class Nt {
|
|
301
301
|
constructor(e) {
|
|
302
302
|
this.parser = e, this.name = b.KHR_MATERIALS_CLEARCOAT;
|
|
303
303
|
}
|
|
304
304
|
getMaterialType(e) {
|
|
305
305
|
const r = this.parser.json.materials[e];
|
|
306
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
306
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
307
307
|
}
|
|
308
308
|
extendMaterialParams(e, t) {
|
|
309
309
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -311,19 +311,19 @@ class Ct {
|
|
|
311
311
|
return Promise.resolve();
|
|
312
312
|
const o = [], s = n.extensions[this.name];
|
|
313
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
|
|
315
|
-
t.clearcoatNormalScale = new Y(
|
|
314
|
+
const i = s.clearcoatNormalTexture.scale;
|
|
315
|
+
t.clearcoatNormalScale = new Y(i, i);
|
|
316
316
|
}
|
|
317
317
|
return Promise.all(o);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
class
|
|
320
|
+
class Ot {
|
|
321
321
|
constructor(e) {
|
|
322
322
|
this.parser = e, this.name = b.KHR_MATERIALS_IRIDESCENCE;
|
|
323
323
|
}
|
|
324
324
|
getMaterialType(e) {
|
|
325
325
|
const r = this.parser.json.materials[e];
|
|
326
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
326
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
327
327
|
}
|
|
328
328
|
extendMaterialParams(e, t) {
|
|
329
329
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -339,29 +339,29 @@ class Dt {
|
|
|
339
339
|
}
|
|
340
340
|
getMaterialType(e) {
|
|
341
341
|
const r = this.parser.json.materials[e];
|
|
342
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
342
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
343
343
|
}
|
|
344
344
|
extendMaterialParams(e, t) {
|
|
345
345
|
const r = this.parser, n = r.json.materials[e];
|
|
346
346
|
if (!n.extensions || !n.extensions[this.name])
|
|
347
347
|
return Promise.resolve();
|
|
348
348
|
const o = [];
|
|
349
|
-
t.sheenColor = new
|
|
349
|
+
t.sheenColor = new G(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
350
350
|
const s = n.extensions[this.name];
|
|
351
351
|
if (s.sheenColorFactor !== void 0) {
|
|
352
|
-
const
|
|
353
|
-
t.sheenColor.setRGB(
|
|
352
|
+
const i = s.sheenColorFactor;
|
|
353
|
+
t.sheenColor.setRGB(i[0], i[1], i[2], k);
|
|
354
354
|
}
|
|
355
|
-
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && o.push(r.assignTexture(t, "sheenColorMap", s.sheenColorTexture,
|
|
355
|
+
return s.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && o.push(r.assignTexture(t, "sheenColorMap", s.sheenColorTexture, D)), s.sheenRoughnessTexture !== void 0 && o.push(r.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(o);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
class
|
|
358
|
+
class kt {
|
|
359
359
|
constructor(e) {
|
|
360
360
|
this.parser = e, this.name = b.KHR_MATERIALS_TRANSMISSION;
|
|
361
361
|
}
|
|
362
362
|
getMaterialType(e) {
|
|
363
363
|
const r = this.parser.json.materials[e];
|
|
364
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
364
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
365
365
|
}
|
|
366
366
|
extendMaterialParams(e, t) {
|
|
367
367
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -377,7 +377,7 @@ class Pt {
|
|
|
377
377
|
}
|
|
378
378
|
getMaterialType(e) {
|
|
379
379
|
const r = this.parser.json.materials[e];
|
|
380
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
380
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
381
381
|
}
|
|
382
382
|
extendMaterialParams(e, t) {
|
|
383
383
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -385,17 +385,17 @@ class Pt {
|
|
|
385
385
|
return Promise.resolve();
|
|
386
386
|
const o = [], s = n.extensions[this.name];
|
|
387
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
|
|
389
|
-
return t.attenuationColor = new
|
|
388
|
+
const i = s.attenuationColor || [1, 1, 1];
|
|
389
|
+
return t.attenuationColor = new G().setRGB(i[0], i[1], i[2], k), Promise.all(o);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
class
|
|
392
|
+
class Ft {
|
|
393
393
|
constructor(e) {
|
|
394
394
|
this.parser = e, this.name = b.KHR_MATERIALS_IOR;
|
|
395
395
|
}
|
|
396
396
|
getMaterialType(e) {
|
|
397
397
|
const r = this.parser.json.materials[e];
|
|
398
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
398
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
399
399
|
}
|
|
400
400
|
extendMaterialParams(e, t) {
|
|
401
401
|
const n = this.parser.json.materials[e];
|
|
@@ -405,13 +405,13 @@ class kt {
|
|
|
405
405
|
return t.ior = o.ior !== void 0 ? o.ior : 1.5, Promise.resolve();
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
class
|
|
408
|
+
class Ut {
|
|
409
409
|
constructor(e) {
|
|
410
410
|
this.parser = e, this.name = b.KHR_MATERIALS_SPECULAR;
|
|
411
411
|
}
|
|
412
412
|
getMaterialType(e) {
|
|
413
413
|
const r = this.parser.json.materials[e];
|
|
414
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
414
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
415
415
|
}
|
|
416
416
|
extendMaterialParams(e, t) {
|
|
417
417
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -419,17 +419,17 @@ class Ft {
|
|
|
419
419
|
return Promise.resolve();
|
|
420
420
|
const o = [], s = n.extensions[this.name];
|
|
421
421
|
t.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && o.push(r.assignTexture(t, "specularIntensityMap", s.specularTexture));
|
|
422
|
-
const
|
|
423
|
-
return t.specularColor = new
|
|
422
|
+
const i = s.specularColorFactor || [1, 1, 1];
|
|
423
|
+
return t.specularColor = new G().setRGB(i[0], i[1], i[2], k), s.specularColorTexture !== void 0 && o.push(r.assignTexture(t, "specularColorMap", s.specularColorTexture, D)), Promise.all(o);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
class
|
|
426
|
+
class Gt {
|
|
427
427
|
constructor(e) {
|
|
428
428
|
this.parser = e, this.name = b.EXT_MATERIALS_BUMP;
|
|
429
429
|
}
|
|
430
430
|
getMaterialType(e) {
|
|
431
431
|
const r = this.parser.json.materials[e];
|
|
432
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
432
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
433
433
|
}
|
|
434
434
|
extendMaterialParams(e, t) {
|
|
435
435
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -445,7 +445,7 @@ class Ht {
|
|
|
445
445
|
}
|
|
446
446
|
getMaterialType(e) {
|
|
447
447
|
const r = this.parser.json.materials[e];
|
|
448
|
-
return !r.extensions || !r.extensions[this.name] ? null :
|
|
448
|
+
return !r.extensions || !r.extensions[this.name] ? null : P;
|
|
449
449
|
}
|
|
450
450
|
extendMaterialParams(e, t) {
|
|
451
451
|
const r = this.parser, n = r.json.materials[e];
|
|
@@ -455,7 +455,7 @@ class Ht {
|
|
|
455
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
|
-
class
|
|
458
|
+
class vt {
|
|
459
459
|
constructor(e) {
|
|
460
460
|
this.parser = e, this.name = b.KHR_TEXTURE_BASISU;
|
|
461
461
|
}
|
|
@@ -472,7 +472,7 @@ class Gt {
|
|
|
472
472
|
return t.loadTextureImage(e, o.source, s);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
class
|
|
475
|
+
class Bt {
|
|
476
476
|
constructor(e) {
|
|
477
477
|
this.parser = e, this.name = b.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
478
478
|
}
|
|
@@ -480,14 +480,14 @@ class vt {
|
|
|
480
480
|
const t = this.name, r = this.parser, n = r.json, o = n.textures[e];
|
|
481
481
|
if (!o.extensions || !o.extensions[t])
|
|
482
482
|
return null;
|
|
483
|
-
const s = o.extensions[t],
|
|
484
|
-
let
|
|
485
|
-
if (
|
|
486
|
-
const c = r.options.manager.getHandler(
|
|
487
|
-
c !== null && (
|
|
483
|
+
const s = o.extensions[t], i = n.images[s.source];
|
|
484
|
+
let a = r.textureLoader;
|
|
485
|
+
if (i.uri) {
|
|
486
|
+
const c = r.options.manager.getHandler(i.uri);
|
|
487
|
+
c !== null && (a = c);
|
|
488
488
|
}
|
|
489
489
|
return this.detectSupport().then(function(c) {
|
|
490
|
-
if (c) return r.loadTextureImage(e, s.source,
|
|
490
|
+
if (c) return r.loadTextureImage(e, s.source, a);
|
|
491
491
|
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
492
492
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
493
493
|
return r.loadTexture(e);
|
|
@@ -502,7 +502,7 @@ class vt {
|
|
|
502
502
|
})), this.isSupported;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
class
|
|
505
|
+
class jt {
|
|
506
506
|
constructor(e) {
|
|
507
507
|
this.parser = e, this.name = b.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
508
508
|
}
|
|
@@ -510,14 +510,14 @@ class Bt {
|
|
|
510
510
|
const t = this.name, r = this.parser, n = r.json, o = n.textures[e];
|
|
511
511
|
if (!o.extensions || !o.extensions[t])
|
|
512
512
|
return null;
|
|
513
|
-
const s = o.extensions[t],
|
|
514
|
-
let
|
|
515
|
-
if (
|
|
516
|
-
const c = r.options.manager.getHandler(
|
|
517
|
-
c !== null && (
|
|
513
|
+
const s = o.extensions[t], i = n.images[s.source];
|
|
514
|
+
let a = r.textureLoader;
|
|
515
|
+
if (i.uri) {
|
|
516
|
+
const c = r.options.manager.getHandler(i.uri);
|
|
517
|
+
c !== null && (a = c);
|
|
518
518
|
}
|
|
519
519
|
return this.detectSupport().then(function(c) {
|
|
520
|
-
if (c) return r.loadTextureImage(e, s.source,
|
|
520
|
+
if (c) return r.loadTextureImage(e, s.source, a);
|
|
521
521
|
if (n.extensionsRequired && n.extensionsRequired.indexOf(t) >= 0)
|
|
522
522
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
523
523
|
return r.loadTexture(e);
|
|
@@ -532,7 +532,7 @@ class Bt {
|
|
|
532
532
|
})), this.isSupported;
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
class
|
|
535
|
+
class Kt {
|
|
536
536
|
constructor(e) {
|
|
537
537
|
this.name = b.EXT_MESHOPT_COMPRESSION, this.parser = e;
|
|
538
538
|
}
|
|
@@ -545,20 +545,20 @@ class jt {
|
|
|
545
545
|
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
546
546
|
return null;
|
|
547
547
|
}
|
|
548
|
-
return o.then(function(
|
|
549
|
-
const
|
|
550
|
-
return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(
|
|
551
|
-
return
|
|
548
|
+
return o.then(function(i) {
|
|
549
|
+
const a = n.byteOffset || 0, c = n.byteLength || 0, l = n.count, u = n.byteStride, f = new Uint8Array(i, a, c);
|
|
550
|
+
return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(l, u, f, n.mode, n.filter).then(function(p) {
|
|
551
|
+
return p.buffer;
|
|
552
552
|
}) : s.ready.then(function() {
|
|
553
|
-
const
|
|
554
|
-
return s.decodeGltfBuffer(new Uint8Array(
|
|
553
|
+
const p = new ArrayBuffer(l * u);
|
|
554
|
+
return s.decodeGltfBuffer(new Uint8Array(p), l, u, f, n.mode, n.filter), p;
|
|
555
555
|
});
|
|
556
556
|
});
|
|
557
557
|
} else
|
|
558
558
|
return null;
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
class
|
|
561
|
+
class Wt {
|
|
562
562
|
constructor(e) {
|
|
563
563
|
this.name = b.EXT_MESH_GPU_INSTANCING, this.parser = e;
|
|
564
564
|
}
|
|
@@ -570,27 +570,27 @@ class Kt {
|
|
|
570
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 s = r.extensions[this.name].attributes,
|
|
573
|
+
const s = r.extensions[this.name].attributes, i = [], a = {};
|
|
574
574
|
for (const c in s)
|
|
575
|
-
|
|
576
|
-
return
|
|
577
|
-
const
|
|
578
|
-
for (const T of
|
|
579
|
-
const
|
|
580
|
-
for (let
|
|
581
|
-
|
|
582
|
-
for (const
|
|
583
|
-
if (
|
|
584
|
-
const M =
|
|
585
|
-
S.instanceColor = new
|
|
586
|
-
} else
|
|
587
|
-
ue.prototype.copy.call(S, T), this.parser.assignFinalMaterial(S),
|
|
575
|
+
i.push(this.parser.getDependency("accessor", s[c]).then((l) => (a[c] = l, a[c])));
|
|
576
|
+
return i.length < 1 ? null : (i.push(this.parser.createNodeMesh(e)), Promise.all(i).then((c) => {
|
|
577
|
+
const l = c.pop(), u = l.isGroup ? l.children : [l], f = c[0].count, p = [];
|
|
578
|
+
for (const T of u) {
|
|
579
|
+
const w = new J(), _ = new j(), y = new Ce(), E = new j(1, 1, 1), S = new ze(T.geometry, T.material, f);
|
|
580
|
+
for (let R = 0; R < f; R++)
|
|
581
|
+
a.TRANSLATION && _.fromBufferAttribute(a.TRANSLATION, R), a.ROTATION && y.fromBufferAttribute(a.ROTATION, R), a.SCALE && E.fromBufferAttribute(a.SCALE, R), S.setMatrixAt(R, w.compose(_, y, E));
|
|
582
|
+
for (const R in a)
|
|
583
|
+
if (R === "_COLOR_0") {
|
|
584
|
+
const M = a[R];
|
|
585
|
+
S.instanceColor = new qe(M.array, M.itemSize, M.normalized);
|
|
586
|
+
} else R !== "TRANSLATION" && R !== "ROTATION" && R !== "SCALE" && T.geometry.setAttribute(R, a[R]);
|
|
587
|
+
ue.prototype.copy.call(S, T), this.parser.assignFinalMaterial(S), p.push(S);
|
|
588
588
|
}
|
|
589
|
-
return
|
|
589
|
+
return l.isGroup ? (l.clear(), l.add(...p), l) : p[0];
|
|
590
590
|
}));
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
const
|
|
593
|
+
const Ue = "glTF", V = 12, Ee = { 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;
|
|
@@ -599,62 +599,62 @@ class Vt {
|
|
|
599
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
|
-
}, this.header.magic !==
|
|
602
|
+
}, this.header.magic !== Ue)
|
|
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
606
|
const n = this.header.length - V, o = new DataView(e, V);
|
|
607
607
|
let s = 0;
|
|
608
608
|
for (; s < n; ) {
|
|
609
|
-
const a = o.getUint32(s, !0);
|
|
610
|
-
s += 4;
|
|
611
609
|
const i = o.getUint32(s, !0);
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
s += 4;
|
|
611
|
+
const a = o.getUint32(s, !0);
|
|
612
|
+
if (s += 4, a === Ee.JSON) {
|
|
613
|
+
const c = new Uint8Array(e, V + s, i);
|
|
614
614
|
this.content = r.decode(c);
|
|
615
|
-
} else if (
|
|
615
|
+
} else if (a === Ee.BIN) {
|
|
616
616
|
const c = V + s;
|
|
617
|
-
this.body = e.slice(c, c +
|
|
617
|
+
this.body = e.slice(c, c + i);
|
|
618
618
|
}
|
|
619
|
-
s +=
|
|
619
|
+
s += i;
|
|
620
620
|
}
|
|
621
621
|
if (this.content === null)
|
|
622
622
|
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
class
|
|
625
|
+
class Xt {
|
|
626
626
|
constructor(e, t) {
|
|
627
627
|
if (!t)
|
|
628
628
|
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
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 r = this.json, n = this.dracoLoader, o = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes,
|
|
633
|
-
for (const
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
for (const
|
|
638
|
-
const
|
|
639
|
-
if (s[
|
|
640
|
-
const f = r.accessors[e.attributes[
|
|
641
|
-
c[
|
|
632
|
+
const r = this.json, n = this.dracoLoader, o = e.extensions[this.name].bufferView, s = e.extensions[this.name].attributes, i = {}, a = {}, c = {};
|
|
633
|
+
for (const l in s) {
|
|
634
|
+
const u = ae[l] || l.toLowerCase();
|
|
635
|
+
i[u] = s[l];
|
|
636
|
+
}
|
|
637
|
+
for (const l in e.attributes) {
|
|
638
|
+
const u = ae[l] || l.toLowerCase();
|
|
639
|
+
if (s[l] !== void 0) {
|
|
640
|
+
const f = r.accessors[e.attributes[l]], p = K[f.componentType];
|
|
641
|
+
c[u] = p.name, a[u] = f.normalized === !0;
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
return t.getDependency("bufferView", o).then(function(
|
|
645
|
-
return new Promise(function(
|
|
646
|
-
n.decodeDracoFile(
|
|
647
|
-
for (const T in
|
|
648
|
-
const
|
|
649
|
-
|
|
644
|
+
return t.getDependency("bufferView", o).then(function(l) {
|
|
645
|
+
return new Promise(function(u, f) {
|
|
646
|
+
n.decodeDracoFile(l, function(p) {
|
|
647
|
+
for (const T in p.attributes) {
|
|
648
|
+
const w = p.attributes[T], _ = a[T];
|
|
649
|
+
_ !== void 0 && (w.normalized = _);
|
|
650
650
|
}
|
|
651
|
-
|
|
652
|
-
},
|
|
651
|
+
u(p);
|
|
652
|
+
}, i, c, k, f);
|
|
653
653
|
});
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
class
|
|
657
|
+
class zt {
|
|
658
658
|
constructor() {
|
|
659
659
|
this.name = b.KHR_TEXTURE_TRANSFORM;
|
|
660
660
|
}
|
|
@@ -662,12 +662,12 @@ class Xt {
|
|
|
662
662
|
return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
class
|
|
665
|
+
class qt {
|
|
666
666
|
constructor() {
|
|
667
667
|
this.name = b.KHR_MESH_QUANTIZATION;
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
class
|
|
670
|
+
class Ge extends _t {
|
|
671
671
|
constructor(e, t, r, n) {
|
|
672
672
|
super(e, t, r, n);
|
|
673
673
|
}
|
|
@@ -678,19 +678,19 @@ class Ue extends Tt {
|
|
|
678
678
|
return t;
|
|
679
679
|
}
|
|
680
680
|
interpolate_(e, t, r, n) {
|
|
681
|
-
const o = this.resultBuffer, s = this.sampleValues,
|
|
682
|
-
for (let
|
|
683
|
-
const M = s[
|
|
684
|
-
o[
|
|
681
|
+
const o = this.resultBuffer, s = this.sampleValues, i = this.valueSize, a = i * 2, c = i * 3, l = n - t, u = (r - t) / l, f = u * u, p = f * u, T = e * c, w = T - c, _ = -2 * p + 3 * f, y = p - f, E = 1 - _, S = y - f + u;
|
|
682
|
+
for (let R = 0; R !== i; R++) {
|
|
683
|
+
const M = s[w + R + i], I = s[w + R + a] * l, L = s[T + R + i], h = s[T + R] * l;
|
|
684
|
+
o[R] = E * M + S * I + _ * L + y * h;
|
|
685
685
|
}
|
|
686
686
|
return o;
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
const
|
|
690
|
-
class
|
|
689
|
+
const Yt = new Ce();
|
|
690
|
+
class Jt extends Ge {
|
|
691
691
|
interpolate_(e, t, r, n) {
|
|
692
692
|
const o = super.interpolate_(e, t, r, n);
|
|
693
|
-
return
|
|
693
|
+
return Yt.fromArray(o).normalize().toArray(o), o;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
const C = {
|
|
@@ -701,25 +701,25 @@ const C = {
|
|
|
701
701
|
TRIANGLES: 4,
|
|
702
702
|
TRIANGLE_STRIP: 5,
|
|
703
703
|
TRIANGLE_FAN: 6
|
|
704
|
-
},
|
|
704
|
+
}, K = {
|
|
705
705
|
5120: Int8Array,
|
|
706
706
|
5121: Uint8Array,
|
|
707
707
|
5122: Int16Array,
|
|
708
708
|
5123: Uint16Array,
|
|
709
709
|
5125: Uint32Array,
|
|
710
710
|
5126: Float32Array
|
|
711
|
-
},
|
|
712
|
-
9728:
|
|
713
|
-
9729:
|
|
714
|
-
9984:
|
|
715
|
-
9985:
|
|
716
|
-
9986:
|
|
717
|
-
9987:
|
|
718
|
-
},
|
|
719
|
-
33071:
|
|
720
|
-
33648:
|
|
711
|
+
}, Se = {
|
|
712
|
+
9728: tt,
|
|
713
|
+
9729: De,
|
|
714
|
+
9984: et,
|
|
715
|
+
9985: $e,
|
|
716
|
+
9986: Ze,
|
|
717
|
+
9987: Oe
|
|
718
|
+
}, be = {
|
|
719
|
+
33071: Pe,
|
|
720
|
+
33648: ke,
|
|
721
721
|
10497: Q
|
|
722
|
-
},
|
|
722
|
+
}, te = {
|
|
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
|
+
}, ae = {
|
|
731
731
|
POSITION: "position",
|
|
732
732
|
NORMAL: "normal",
|
|
733
733
|
TANGENT: "tangent",
|
|
@@ -738,73 +738,73 @@ const C = {
|
|
|
738
738
|
COLOR_0: "color",
|
|
739
739
|
WEIGHTS_0: "skinWeight",
|
|
740
740
|
JOINTS_0: "skinIndex"
|
|
741
|
-
},
|
|
741
|
+
}, F = {
|
|
742
742
|
scale: "scale",
|
|
743
743
|
translation: "position",
|
|
744
744
|
rotation: "quaternion",
|
|
745
745
|
weights: "morphTargetInfluences"
|
|
746
|
-
},
|
|
746
|
+
}, Qt = {
|
|
747
747
|
CUBICSPLINE: void 0,
|
|
748
748
|
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
749
749
|
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
750
|
-
LINEAR:
|
|
751
|
-
STEP:
|
|
752
|
-
},
|
|
750
|
+
LINEAR: Fe,
|
|
751
|
+
STEP: At
|
|
752
|
+
}, ne = {
|
|
753
753
|
OPAQUE: "OPAQUE",
|
|
754
754
|
MASK: "MASK",
|
|
755
755
|
BLEND: "BLEND"
|
|
756
756
|
};
|
|
757
|
-
function
|
|
758
|
-
return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new
|
|
757
|
+
function Zt(d) {
|
|
758
|
+
return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new fe({
|
|
759
759
|
color: 16777215,
|
|
760
760
|
emissive: 0,
|
|
761
761
|
metalness: 1,
|
|
762
762
|
roughness: 1,
|
|
763
763
|
transparent: !1,
|
|
764
764
|
depthTest: !0,
|
|
765
|
-
side:
|
|
765
|
+
side: Tt
|
|
766
766
|
})), d.DefaultMaterial;
|
|
767
767
|
}
|
|
768
|
-
function
|
|
768
|
+
function v(d, e, t) {
|
|
769
769
|
for (const r in t.extensions)
|
|
770
770
|
d[r] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[r] = t.extensions[r]);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function U(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
|
-
function
|
|
775
|
+
function $t(d, e, t) {
|
|
776
776
|
let r = !1, n = !1, o = !1;
|
|
777
|
-
for (let c = 0,
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
777
|
+
for (let c = 0, l = e.length; c < l; c++) {
|
|
778
|
+
const u = e[c];
|
|
779
|
+
if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (o = !0), r && n && o) break;
|
|
780
780
|
}
|
|
781
781
|
if (!r && !n && !o) return Promise.resolve(d);
|
|
782
|
-
const s = [],
|
|
783
|
-
for (let c = 0,
|
|
784
|
-
const
|
|
782
|
+
const s = [], i = [], a = [];
|
|
783
|
+
for (let c = 0, l = e.length; c < l; c++) {
|
|
784
|
+
const u = e[c];
|
|
785
785
|
if (r) {
|
|
786
|
-
const f =
|
|
786
|
+
const f = u.POSITION !== void 0 ? t.getDependency("accessor", u.POSITION) : d.attributes.position;
|
|
787
787
|
s.push(f);
|
|
788
788
|
}
|
|
789
789
|
if (n) {
|
|
790
|
-
const f =
|
|
791
|
-
|
|
790
|
+
const f = u.NORMAL !== void 0 ? t.getDependency("accessor", u.NORMAL) : d.attributes.normal;
|
|
791
|
+
i.push(f);
|
|
792
792
|
}
|
|
793
793
|
if (o) {
|
|
794
|
-
const f =
|
|
795
|
-
|
|
794
|
+
const f = u.COLOR_0 !== void 0 ? t.getDependency("accessor", u.COLOR_0) : d.attributes.color;
|
|
795
|
+
a.push(f);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
return Promise.all([
|
|
799
799
|
Promise.all(s),
|
|
800
|
-
Promise.all(
|
|
801
|
-
Promise.all(
|
|
800
|
+
Promise.all(i),
|
|
801
|
+
Promise.all(a)
|
|
802
802
|
]).then(function(c) {
|
|
803
|
-
const
|
|
804
|
-
return r && (d.morphAttributes.position =
|
|
803
|
+
const l = c[0], u = c[1], f = c[2];
|
|
804
|
+
return r && (d.morphAttributes.position = l), n && (d.morphAttributes.normal = u), o && (d.morphAttributes.color = f), d.morphTargetsRelative = !0, d;
|
|
805
805
|
});
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function en(d, e) {
|
|
808
808
|
if (d.updateMorphTargets(), e.weights !== void 0)
|
|
809
809
|
for (let t = 0, r = e.weights.length; t < r; t++)
|
|
810
810
|
d.morphTargetInfluences[t] = e.weights[t];
|
|
@@ -818,22 +818,22 @@ function $t(d, e) {
|
|
|
818
818
|
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function tn(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 + ":" +
|
|
824
|
+
if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + se(t.attributes) : e = d.indices + ":" + se(d.attributes) + ":" + d.mode, d.targets !== void 0)
|
|
825
825
|
for (let r = 0, n = d.targets.length; r < n; r++)
|
|
826
|
-
e += ":" +
|
|
826
|
+
e += ":" + se(d.targets[r]);
|
|
827
827
|
return e;
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function se(d) {
|
|
830
830
|
let e = "";
|
|
831
831
|
const t = Object.keys(d).sort();
|
|
832
832
|
for (let r = 0, n = t.length; r < n; r++)
|
|
833
833
|
e += t[r] + ":" + d[t[r]] + ";";
|
|
834
834
|
return e;
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function ce(d) {
|
|
837
837
|
switch (d) {
|
|
838
838
|
case Int8Array:
|
|
839
839
|
return 1 / 127;
|
|
@@ -847,15 +847,15 @@ function ae(d) {
|
|
|
847
847
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function nn(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
|
|
854
|
-
class
|
|
853
|
+
const sn = new J();
|
|
854
|
+
class rn {
|
|
855
855
|
constructor(e = {}, t = {}) {
|
|
856
|
-
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new
|
|
856
|
+
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new Lt(), 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
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
|
|
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 Ne(this.options.manager) : this.textureLoader = new Ye(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new W(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;
|
|
@@ -876,7 +876,7 @@ class sn {
|
|
|
876
876
|
r.getDependencies("camera")
|
|
877
877
|
]);
|
|
878
878
|
}).then(function(s) {
|
|
879
|
-
const
|
|
879
|
+
const i = {
|
|
880
880
|
scene: s[0][n.scene || 0],
|
|
881
881
|
scenes: s[0],
|
|
882
882
|
animations: s[1],
|
|
@@ -885,12 +885,12 @@ class sn {
|
|
|
885
885
|
parser: r,
|
|
886
886
|
userData: {}
|
|
887
887
|
};
|
|
888
|
-
return
|
|
889
|
-
return
|
|
888
|
+
return v(o, i, n), U(i, n), Promise.all(r._invokeAll(function(a) {
|
|
889
|
+
return a.afterRoot && a.afterRoot(i);
|
|
890
890
|
})).then(function() {
|
|
891
|
-
for (const
|
|
892
|
-
|
|
893
|
-
e(
|
|
891
|
+
for (const a of i.scenes)
|
|
892
|
+
a.updateMatrixWorld();
|
|
893
|
+
e(i);
|
|
894
894
|
});
|
|
895
895
|
}).catch(t);
|
|
896
896
|
}
|
|
@@ -901,8 +901,8 @@ class sn {
|
|
|
901
901
|
const e = this.json.nodes || [], t = this.json.skins || [], r = this.json.meshes || [];
|
|
902
902
|
for (let n = 0, o = t.length; n < o; n++) {
|
|
903
903
|
const s = t[n].joints;
|
|
904
|
-
for (let
|
|
905
|
-
e[s[
|
|
904
|
+
for (let i = 0, a = s.length; i < a; i++)
|
|
905
|
+
e[s[i]].isBone = !0;
|
|
906
906
|
}
|
|
907
907
|
for (let n = 0, o = e.length; n < o; n++) {
|
|
908
908
|
const s = e[n];
|
|
@@ -924,11 +924,11 @@ class sn {
|
|
|
924
924
|
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
925
925
|
_getNodeRef(e, t, r) {
|
|
926
926
|
if (e.refs[t] <= 1) return r;
|
|
927
|
-
const n = r.clone(), o = (s,
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
for (const [c,
|
|
931
|
-
o(
|
|
927
|
+
const n = r.clone(), o = (s, i) => {
|
|
928
|
+
const a = this.associations.get(s);
|
|
929
|
+
a != null && this.associations.set(i, a);
|
|
930
|
+
for (const [c, l] of s.children.entries())
|
|
931
|
+
o(l, i.children[c]);
|
|
932
932
|
};
|
|
933
933
|
return o(r, n), n.name += "_instance_" + e.uses[t]++, n;
|
|
934
934
|
}
|
|
@@ -1046,7 +1046,7 @@ class sn {
|
|
|
1046
1046
|
return Promise.resolve(this.extensions[b.KHR_BINARY_GLTF].body);
|
|
1047
1047
|
const n = this.options;
|
|
1048
1048
|
return new Promise(function(o, s) {
|
|
1049
|
-
r.load(
|
|
1049
|
+
r.load(z.resolveURL(t.uri, n.path), o, void 0, function() {
|
|
1050
1050
|
s(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
|
|
1051
1051
|
});
|
|
1052
1052
|
});
|
|
@@ -1071,28 +1071,28 @@ class sn {
|
|
|
1071
1071
|
loadAccessor(e) {
|
|
1072
1072
|
const t = this, r = this.json, n = this.json.accessors[e];
|
|
1073
1073
|
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1074
|
-
const s =
|
|
1075
|
-
return Promise.resolve(new
|
|
1074
|
+
const s = te[n.type], i = K[n.componentType], a = n.normalized === !0, c = new i(n.count * s);
|
|
1075
|
+
return Promise.resolve(new N(c, s, a));
|
|
1076
1076
|
}
|
|
1077
1077
|
const o = [];
|
|
1078
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
|
|
1080
|
-
let
|
|
1081
|
-
if (
|
|
1082
|
-
const
|
|
1079
|
+
const i = s[0], a = te[n.type], c = K[n.componentType], l = c.BYTES_PER_ELEMENT, u = l * a, f = n.byteOffset || 0, p = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, T = n.normalized === !0;
|
|
1080
|
+
let w, _;
|
|
1081
|
+
if (p && p !== u) {
|
|
1082
|
+
const y = Math.floor(f / p), E = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + y + ":" + n.count;
|
|
1083
1083
|
let S = t.cache.get(E);
|
|
1084
|
-
S || (
|
|
1084
|
+
S || (w = new c(i, y * p, n.count * p / l), S = new Je(w, p / l), t.cache.add(E, S)), _ = new Qe(S, a, f % p / l, T);
|
|
1085
1085
|
} else
|
|
1086
|
-
|
|
1086
|
+
i === null ? w = new c(n.count * a) : w = new c(i, f, n.count * a), _ = new N(w, a, T);
|
|
1087
1087
|
if (n.sparse !== void 0) {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1088
|
+
const y = te.SCALAR, E = K[n.sparse.indices.componentType], S = n.sparse.indices.byteOffset || 0, R = n.sparse.values.byteOffset || 0, M = new E(s[1], S, n.sparse.count * y), I = new c(s[2], R, n.sparse.count * a);
|
|
1089
|
+
i !== null && (_ = new N(_.array.slice(), _.itemSize, _.normalized));
|
|
1090
1090
|
for (let L = 0, h = M.length; L < h; L++) {
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1091
|
+
const m = M[L];
|
|
1092
|
+
if (_.setX(m, I[L * a]), a >= 2 && _.setY(m, I[L * a + 1]), a >= 3 && _.setZ(m, I[L * a + 2]), a >= 4 && _.setW(m, I[L * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
|
-
return
|
|
1095
|
+
return _;
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
@@ -1102,54 +1102,54 @@ class sn {
|
|
|
1102
1102
|
*/
|
|
1103
1103
|
loadTexture(e) {
|
|
1104
1104
|
const t = this.json, r = this.options, o = t.textures[e].source, s = t.images[o];
|
|
1105
|
-
let
|
|
1105
|
+
let i = this.textureLoader;
|
|
1106
1106
|
if (s.uri) {
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1107
|
+
const a = r.manager.getHandler(s.uri);
|
|
1108
|
+
a !== null && (i = a);
|
|
1109
1109
|
}
|
|
1110
|
-
return this.loadTextureImage(e, o,
|
|
1110
|
+
return this.loadTextureImage(e, o, i);
|
|
1111
1111
|
}
|
|
1112
1112
|
loadTextureImage(e, t, r) {
|
|
1113
|
-
const n = this, o = this.json, s = o.textures[e],
|
|
1114
|
-
if (this.textureCache[
|
|
1115
|
-
return this.textureCache[
|
|
1116
|
-
const c = this.loadImageSource(t, r).then(function(
|
|
1117
|
-
|
|
1113
|
+
const n = this, o = this.json, s = o.textures[e], i = o.images[t], a = (i.uri || i.bufferView) + ":" + s.sampler;
|
|
1114
|
+
if (this.textureCache[a])
|
|
1115
|
+
return this.textureCache[a];
|
|
1116
|
+
const c = this.loadImageSource(t, r).then(function(l) {
|
|
1117
|
+
l.flipY = !1, l.name = s.name || i.name || "", l.name === "" && typeof i.uri == "string" && i.uri.startsWith("data:image/") === !1 && (l.name = i.uri);
|
|
1118
1118
|
const f = (o.samplers || {})[s.sampler] || {};
|
|
1119
|
-
return
|
|
1119
|
+
return l.magFilter = Se[f.magFilter] || De, l.minFilter = Se[f.minFilter] || Oe, l.wrapS = be[f.wrapS] || Q, l.wrapT = be[f.wrapT] || Q, n.associations.set(l, { textures: e }), l;
|
|
1120
1120
|
}).catch(function() {
|
|
1121
1121
|
return null;
|
|
1122
1122
|
});
|
|
1123
|
-
return this.textureCache[
|
|
1123
|
+
return this.textureCache[a] = c, c;
|
|
1124
1124
|
}
|
|
1125
1125
|
loadImageSource(e, t) {
|
|
1126
1126
|
const r = this, n = this.json, o = this.options;
|
|
1127
1127
|
if (this.sourceCache[e] !== void 0)
|
|
1128
|
-
return this.sourceCache[e].then((
|
|
1129
|
-
const s = n.images[e],
|
|
1130
|
-
let
|
|
1128
|
+
return this.sourceCache[e].then((u) => u.clone());
|
|
1129
|
+
const s = n.images[e], i = self.URL || self.webkitURL;
|
|
1130
|
+
let a = s.uri || "", c = !1;
|
|
1131
1131
|
if (s.bufferView !== void 0)
|
|
1132
|
-
|
|
1132
|
+
a = r.getDependency("bufferView", s.bufferView).then(function(u) {
|
|
1133
1133
|
c = !0;
|
|
1134
|
-
const f = new Blob([
|
|
1135
|
-
return
|
|
1134
|
+
const f = new Blob([u], { type: s.mimeType });
|
|
1135
|
+
return a = i.createObjectURL(f), a;
|
|
1136
1136
|
});
|
|
1137
1137
|
else if (s.uri === void 0)
|
|
1138
1138
|
throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
1139
|
-
const
|
|
1140
|
-
return new Promise(function(f,
|
|
1139
|
+
const l = Promise.resolve(a).then(function(u) {
|
|
1140
|
+
return new Promise(function(f, p) {
|
|
1141
1141
|
let T = f;
|
|
1142
|
-
t.isImageBitmapLoader === !0 && (T = function(
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
}), t.load(
|
|
1142
|
+
t.isImageBitmapLoader === !0 && (T = function(w) {
|
|
1143
|
+
const _ = new me(w);
|
|
1144
|
+
_.needsUpdate = !0, f(_);
|
|
1145
|
+
}), t.load(z.resolveURL(u, o.path), T, void 0, p);
|
|
1146
1146
|
});
|
|
1147
|
-
}).then(function(
|
|
1148
|
-
return c === !0 &&
|
|
1149
|
-
}).catch(function(
|
|
1150
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture",
|
|
1147
|
+
}).then(function(u) {
|
|
1148
|
+
return c === !0 && i.revokeObjectURL(a), u.userData.mimeType = s.mimeType || nn(s.uri), u;
|
|
1149
|
+
}).catch(function(u) {
|
|
1150
|
+
throw console.error("THREE.GLTFLoader: Couldn't load texture", a), u;
|
|
1151
1151
|
});
|
|
1152
|
-
return this.sourceCache[e] =
|
|
1152
|
+
return this.sourceCache[e] = l, l;
|
|
1153
1153
|
}
|
|
1154
1154
|
/**
|
|
1155
1155
|
* Asynchronously assigns a texture to the given material parameters.
|
|
@@ -1163,10 +1163,10 @@ class sn {
|
|
|
1163
1163
|
return this.getDependency("texture", r.index).then(function(s) {
|
|
1164
1164
|
if (!s) return null;
|
|
1165
1165
|
if (r.texCoord !== void 0 && r.texCoord > 0 && (s = s.clone(), s.channel = r.texCoord), o.extensions[b.KHR_TEXTURE_TRANSFORM]) {
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
const
|
|
1169
|
-
s = o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s,
|
|
1166
|
+
const i = r.extensions !== void 0 ? r.extensions[b.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1167
|
+
if (i) {
|
|
1168
|
+
const a = o.associations.get(s);
|
|
1169
|
+
s = o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s, i), o.associations.set(s, a);
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
1172
|
return n !== void 0 && (s.colorSpace = n), e[t] = s, s;
|
|
@@ -1185,24 +1185,24 @@ class sn {
|
|
|
1185
1185
|
let r = e.material;
|
|
1186
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
|
|
1189
|
-
let
|
|
1190
|
-
|
|
1188
|
+
const i = "PointsMaterial:" + r.uuid;
|
|
1189
|
+
let a = this.cache.get(i);
|
|
1190
|
+
a || (a = new nt(), ee.prototype.copy.call(a, r), a.color.copy(r.color), a.map = r.map, a.sizeAttenuation = !1, this.cache.add(i, a)), r = a;
|
|
1191
1191
|
} else if (e.isLine) {
|
|
1192
|
-
const
|
|
1193
|
-
let
|
|
1194
|
-
|
|
1192
|
+
const i = "LineBasicMaterial:" + r.uuid;
|
|
1193
|
+
let a = this.cache.get(i);
|
|
1194
|
+
a || (a = new st(), ee.prototype.copy.call(a, r), a.color.copy(r.color), a.map = r.map, this.cache.add(i, a)), r = a;
|
|
1195
1195
|
}
|
|
1196
1196
|
if (n || o || s) {
|
|
1197
|
-
let
|
|
1198
|
-
n && (
|
|
1199
|
-
let
|
|
1200
|
-
|
|
1197
|
+
let i = "ClonedMaterial:" + r.uuid + ":";
|
|
1198
|
+
n && (i += "derivative-tangents:"), o && (i += "vertex-colors:"), s && (i += "flat-shading:");
|
|
1199
|
+
let a = this.cache.get(i);
|
|
1200
|
+
a || (a = r.clone(), o && (a.vertexColors = !0), s && (a.flatShading = !0), n && (a.normalScale && (a.normalScale.y *= -1), a.clearcoatNormalScale && (a.clearcoatNormalScale.y *= -1)), this.cache.add(i, a), this.associations.set(a, this.associations.get(r))), r = a;
|
|
1201
1201
|
}
|
|
1202
1202
|
e.material = r;
|
|
1203
1203
|
}
|
|
1204
1204
|
getMaterialType() {
|
|
1205
|
-
return
|
|
1205
|
+
return fe;
|
|
1206
1206
|
}
|
|
1207
1207
|
/**
|
|
1208
1208
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
@@ -1212,40 +1212,40 @@ class sn {
|
|
|
1212
1212
|
loadMaterial(e) {
|
|
1213
1213
|
const t = this, r = this.json, n = this.extensions, o = r.materials[e];
|
|
1214
1214
|
let s;
|
|
1215
|
-
const
|
|
1216
|
-
if (
|
|
1217
|
-
const
|
|
1218
|
-
s =
|
|
1215
|
+
const i = {}, a = o.extensions || {}, c = [];
|
|
1216
|
+
if (a[b.KHR_MATERIALS_UNLIT]) {
|
|
1217
|
+
const u = n[b.KHR_MATERIALS_UNLIT];
|
|
1218
|
+
s = u.getMaterialType(), c.push(u.extendParams(i, o, t));
|
|
1219
1219
|
} else {
|
|
1220
|
-
const
|
|
1221
|
-
if (
|
|
1222
|
-
const f =
|
|
1223
|
-
|
|
1220
|
+
const u = o.pbrMetallicRoughness || {};
|
|
1221
|
+
if (i.color = new G(1, 1, 1), i.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
1222
|
+
const f = u.baseColorFactor;
|
|
1223
|
+
i.color.setRGB(f[0], f[1], f[2], k), i.opacity = f[3];
|
|
1224
1224
|
}
|
|
1225
|
-
|
|
1225
|
+
u.baseColorTexture !== void 0 && c.push(t.assignTexture(i, "map", u.baseColorTexture, D)), i.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, i.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(t.assignTexture(i, "metalnessMap", u.metallicRoughnessTexture)), c.push(t.assignTexture(i, "roughnessMap", u.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
|
-
return f.extendMaterialParams && f.extendMaterialParams(e,
|
|
1228
|
+
return f.extendMaterialParams && f.extendMaterialParams(e, i);
|
|
1229
1229
|
})));
|
|
1230
1230
|
}
|
|
1231
|
-
o.doubleSided === !0 && (
|
|
1232
|
-
const
|
|
1233
|
-
if (
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1231
|
+
o.doubleSided === !0 && (i.side = rt);
|
|
1232
|
+
const l = o.alphaMode || ne.OPAQUE;
|
|
1233
|
+
if (l === ne.BLEND ? (i.transparent = !0, i.depthWrite = !1) : (i.transparent = !1, l === ne.MASK && (i.alphaTest = o.alphaCutoff !== void 0 ? o.alphaCutoff : 0.5)), o.normalTexture !== void 0 && s !== X && (c.push(t.assignTexture(i, "normalMap", o.normalTexture)), i.normalScale = new Y(1, 1), o.normalTexture.scale !== void 0)) {
|
|
1234
|
+
const u = o.normalTexture.scale;
|
|
1235
|
+
i.normalScale.set(u, u);
|
|
1236
1236
|
}
|
|
1237
|
-
if (o.occlusionTexture !== void 0 && s !==
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1237
|
+
if (o.occlusionTexture !== void 0 && s !== X && (c.push(t.assignTexture(i, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (i.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && s !== X) {
|
|
1238
|
+
const u = o.emissiveFactor;
|
|
1239
|
+
i.emissive = new G().setRGB(u[0], u[1], u[2], k);
|
|
1240
1240
|
}
|
|
1241
|
-
return o.emissiveTexture !== void 0 && s !==
|
|
1242
|
-
const
|
|
1243
|
-
return o.name && (
|
|
1241
|
+
return o.emissiveTexture !== void 0 && s !== X && c.push(t.assignTexture(i, "emissiveMap", o.emissiveTexture, D)), Promise.all(c).then(function() {
|
|
1242
|
+
const u = new s(i);
|
|
1243
|
+
return o.name && (u.name = o.name), U(u, o), t.associations.set(u, { materials: e }), o.extensions && v(n, u, o), u;
|
|
1244
1244
|
});
|
|
1245
1245
|
}
|
|
1246
1246
|
/** When Object3D instances are targeted by animation, they need unique names. */
|
|
1247
1247
|
createUniqueName(e) {
|
|
1248
|
-
const t =
|
|
1248
|
+
const t = ot.sanitizeNodeName(e || "");
|
|
1249
1249
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t);
|
|
1250
1250
|
}
|
|
1251
1251
|
/**
|
|
@@ -1258,19 +1258,19 @@ class sn {
|
|
|
1258
1258
|
*/
|
|
1259
1259
|
loadGeometries(e) {
|
|
1260
1260
|
const t = this, r = this.extensions, n = this.primitiveCache;
|
|
1261
|
-
function o(
|
|
1262
|
-
return r[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(
|
|
1263
|
-
return
|
|
1261
|
+
function o(i) {
|
|
1262
|
+
return r[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(i, t).then(function(a) {
|
|
1263
|
+
return Le(a, i, t);
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
1266
|
const s = [];
|
|
1267
|
-
for (let
|
|
1268
|
-
const c = e[
|
|
1269
|
-
if (
|
|
1270
|
-
s.push(
|
|
1267
|
+
for (let i = 0, a = e.length; i < a; i++) {
|
|
1268
|
+
const c = e[i], l = tn(c), u = n[l];
|
|
1269
|
+
if (u)
|
|
1270
|
+
s.push(u.promise);
|
|
1271
1271
|
else {
|
|
1272
1272
|
let f;
|
|
1273
|
-
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = o(c) : f =
|
|
1273
|
+
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = o(c) : f = Le(new Z(), c, t), n[l] = { primitive: c, promise: f }, s.push(f);
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
1276
1276
|
return Promise.all(s);
|
|
@@ -1281,42 +1281,42 @@ class sn {
|
|
|
1281
1281
|
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1282
1282
|
*/
|
|
1283
1283
|
loadMesh(e) {
|
|
1284
|
-
const t = this, r = this.json, n = this.extensions, o = r.meshes[e], s = o.primitives,
|
|
1285
|
-
for (let
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
}
|
|
1289
|
-
return
|
|
1290
|
-
const c =
|
|
1291
|
-
for (let
|
|
1292
|
-
const
|
|
1293
|
-
let
|
|
1294
|
-
const E = c[
|
|
1295
|
-
if (
|
|
1296
|
-
|
|
1297
|
-
else if (
|
|
1298
|
-
|
|
1299
|
-
else if (
|
|
1300
|
-
|
|
1301
|
-
else if (
|
|
1302
|
-
|
|
1303
|
-
else if (
|
|
1304
|
-
|
|
1284
|
+
const t = this, r = this.json, n = this.extensions, o = r.meshes[e], s = o.primitives, i = [];
|
|
1285
|
+
for (let a = 0, c = s.length; a < c; a++) {
|
|
1286
|
+
const l = s[a].material === void 0 ? Zt(this.cache) : this.getDependency("material", s[a].material);
|
|
1287
|
+
i.push(l);
|
|
1288
|
+
}
|
|
1289
|
+
return i.push(t.loadGeometries(s)), Promise.all(i).then(function(a) {
|
|
1290
|
+
const c = a.slice(0, a.length - 1), l = a[a.length - 1], u = [];
|
|
1291
|
+
for (let p = 0, T = l.length; p < T; p++) {
|
|
1292
|
+
const w = l[p], _ = s[p];
|
|
1293
|
+
let y;
|
|
1294
|
+
const E = c[p];
|
|
1295
|
+
if (_.mode === C.TRIANGLES || _.mode === C.TRIANGLE_STRIP || _.mode === C.TRIANGLE_FAN || _.mode === void 0)
|
|
1296
|
+
y = o.isSkinnedMesh === !0 ? new it(w, E) : new de(w, E), y.isSkinnedMesh === !0 && y.normalizeSkinWeights(), _.mode === C.TRIANGLE_STRIP ? y.geometry = xe(y.geometry, Ie) : _.mode === C.TRIANGLE_FAN && (y.geometry = xe(y.geometry, ie));
|
|
1297
|
+
else if (_.mode === C.LINES)
|
|
1298
|
+
y = new at(w, E);
|
|
1299
|
+
else if (_.mode === C.LINE_STRIP)
|
|
1300
|
+
y = new ct(w, E);
|
|
1301
|
+
else if (_.mode === C.LINE_LOOP)
|
|
1302
|
+
y = new lt(w, E);
|
|
1303
|
+
else if (_.mode === C.POINTS)
|
|
1304
|
+
y = new ut(w, E);
|
|
1305
1305
|
else
|
|
1306
|
-
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " +
|
|
1307
|
-
Object.keys(
|
|
1306
|
+
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + _.mode);
|
|
1307
|
+
Object.keys(y.geometry.morphAttributes).length > 0 && en(y, o), y.name = t.createUniqueName(o.name || "mesh_" + e), U(y, o), _.extensions && v(n, y, _), t.assignFinalMaterial(y), u.push(y);
|
|
1308
1308
|
}
|
|
1309
|
-
for (let
|
|
1310
|
-
t.associations.set(
|
|
1309
|
+
for (let p = 0, T = u.length; p < T; p++)
|
|
1310
|
+
t.associations.set(u[p], {
|
|
1311
1311
|
meshes: e,
|
|
1312
|
-
primitives:
|
|
1312
|
+
primitives: p
|
|
1313
1313
|
});
|
|
1314
|
-
if (
|
|
1315
|
-
return o.extensions &&
|
|
1316
|
-
const f = new
|
|
1317
|
-
o.extensions &&
|
|
1318
|
-
for (let
|
|
1319
|
-
f.add(
|
|
1314
|
+
if (u.length === 1)
|
|
1315
|
+
return o.extensions && v(n, u[0], o), u[0];
|
|
1316
|
+
const f = new B();
|
|
1317
|
+
o.extensions && v(n, f, o), t.associations.set(f, { meshes: e });
|
|
1318
|
+
for (let p = 0, T = u.length; p < T; p++)
|
|
1319
|
+
f.add(u[p]);
|
|
1320
1320
|
return f;
|
|
1321
1321
|
});
|
|
1322
1322
|
}
|
|
@@ -1332,7 +1332,7 @@ class sn {
|
|
|
1332
1332
|
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1333
1333
|
return;
|
|
1334
1334
|
}
|
|
1335
|
-
return r.type === "perspective" ? t = new
|
|
1335
|
+
return r.type === "perspective" ? t = new ft(dt.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (t = new ht(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (t.name = this.createUniqueName(r.name)), U(t, r), Promise.resolve(t);
|
|
1336
1336
|
}
|
|
1337
1337
|
/**
|
|
1338
1338
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
@@ -1344,17 +1344,17 @@ class sn {
|
|
|
1344
1344
|
for (let n = 0, o = t.joints.length; n < o; n++)
|
|
1345
1345
|
r.push(this._loadNodeShallow(t.joints[n]));
|
|
1346
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,
|
|
1348
|
-
for (let c = 0,
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1347
|
+
const o = n.pop(), s = n, i = [], a = [];
|
|
1348
|
+
for (let c = 0, l = s.length; c < l; c++) {
|
|
1349
|
+
const u = s[c];
|
|
1350
|
+
if (u) {
|
|
1351
|
+
i.push(u);
|
|
1352
1352
|
const f = new J();
|
|
1353
|
-
o !== null && f.fromArray(o.array, c * 16),
|
|
1353
|
+
o !== null && f.fromArray(o.array, c * 16), a.push(f);
|
|
1354
1354
|
} else
|
|
1355
1355
|
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[c]);
|
|
1356
1356
|
}
|
|
1357
|
-
return new
|
|
1357
|
+
return new pt(i, a);
|
|
1358
1358
|
});
|
|
1359
1359
|
}
|
|
1360
1360
|
/**
|
|
@@ -1363,39 +1363,39 @@ class sn {
|
|
|
1363
1363
|
* @return {Promise<AnimationClip>}
|
|
1364
1364
|
*/
|
|
1365
1365
|
loadAnimation(e) {
|
|
1366
|
-
const t = this.json, r = this, n = t.animations[e], o = n.name ? n.name : "animation_" + e, s = [],
|
|
1367
|
-
for (let
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1366
|
+
const t = this.json, r = this, n = t.animations[e], o = n.name ? n.name : "animation_" + e, s = [], i = [], a = [], c = [], l = [];
|
|
1367
|
+
for (let u = 0, f = n.channels.length; u < f; u++) {
|
|
1368
|
+
const p = n.channels[u], T = n.samplers[p.sampler], w = p.target, _ = w.node, y = n.parameters !== void 0 ? n.parameters[T.input] : T.input, E = n.parameters !== void 0 ? n.parameters[T.output] : T.output;
|
|
1369
|
+
w.node !== void 0 && (s.push(this.getDependency("node", _)), i.push(this.getDependency("accessor", y)), a.push(this.getDependency("accessor", E)), c.push(T), l.push(w));
|
|
1370
1370
|
}
|
|
1371
1371
|
return Promise.all([
|
|
1372
1372
|
Promise.all(s),
|
|
1373
|
-
Promise.all(a),
|
|
1374
1373
|
Promise.all(i),
|
|
1374
|
+
Promise.all(a),
|
|
1375
1375
|
Promise.all(c),
|
|
1376
|
-
Promise.all(
|
|
1377
|
-
]).then(function(
|
|
1378
|
-
const f =
|
|
1376
|
+
Promise.all(l)
|
|
1377
|
+
]).then(function(u) {
|
|
1378
|
+
const f = u[0], p = u[1], T = u[2], w = u[3], _ = u[4], y = [];
|
|
1379
1379
|
for (let E = 0, S = f.length; E < S; E++) {
|
|
1380
|
-
const
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
if (
|
|
1385
|
-
for (let g = 0; g <
|
|
1386
|
-
|
|
1380
|
+
const R = f[E], M = p[E], I = T[E], L = w[E], h = _[E];
|
|
1381
|
+
if (R === void 0) continue;
|
|
1382
|
+
R.updateMatrix && R.updateMatrix();
|
|
1383
|
+
const m = r._createAnimationTracks(R, M, I, L, h);
|
|
1384
|
+
if (m)
|
|
1385
|
+
for (let g = 0; g < m.length; g++)
|
|
1386
|
+
y.push(m[g]);
|
|
1387
1387
|
}
|
|
1388
|
-
return new
|
|
1388
|
+
return new mt(o, void 0, y);
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
1391
|
createNodeMesh(e) {
|
|
1392
1392
|
const t = this.json, r = this, n = t.nodes[e];
|
|
1393
1393
|
return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(o) {
|
|
1394
1394
|
const s = r._getNodeRef(r.meshCache, n.mesh, o);
|
|
1395
|
-
return n.weights !== void 0 && s.traverse(function(
|
|
1396
|
-
if (
|
|
1397
|
-
for (let
|
|
1398
|
-
|
|
1395
|
+
return n.weights !== void 0 && s.traverse(function(i) {
|
|
1396
|
+
if (i.isMesh)
|
|
1397
|
+
for (let a = 0, c = n.weights.length; a < c; a++)
|
|
1398
|
+
i.morphTargetInfluences[a] = n.weights[a];
|
|
1399
1399
|
}), s;
|
|
1400
1400
|
});
|
|
1401
1401
|
}
|
|
@@ -1405,22 +1405,22 @@ class sn {
|
|
|
1405
1405
|
* @return {Promise<Object3D>}
|
|
1406
1406
|
*/
|
|
1407
1407
|
loadNode(e) {
|
|
1408
|
-
const t = this.json, r = this, n = t.nodes[e], o = r._loadNodeShallow(e), s = [],
|
|
1409
|
-
for (let c = 0,
|
|
1410
|
-
s.push(r.getDependency("node",
|
|
1411
|
-
const
|
|
1408
|
+
const t = this.json, r = this, n = t.nodes[e], o = r._loadNodeShallow(e), s = [], i = n.children || [];
|
|
1409
|
+
for (let c = 0, l = i.length; c < l; c++)
|
|
1410
|
+
s.push(r.getDependency("node", i[c]));
|
|
1411
|
+
const a = n.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", n.skin);
|
|
1412
1412
|
return Promise.all([
|
|
1413
1413
|
o,
|
|
1414
1414
|
Promise.all(s),
|
|
1415
|
-
|
|
1415
|
+
a
|
|
1416
1416
|
]).then(function(c) {
|
|
1417
|
-
const
|
|
1418
|
-
f !== null &&
|
|
1419
|
-
|
|
1417
|
+
const l = c[0], u = c[1], f = c[2];
|
|
1418
|
+
f !== null && l.traverse(function(p) {
|
|
1419
|
+
p.isSkinnedMesh && p.bind(f, sn);
|
|
1420
1420
|
});
|
|
1421
|
-
for (let
|
|
1422
|
-
|
|
1423
|
-
return
|
|
1421
|
+
for (let p = 0, T = u.length; p < T; p++)
|
|
1422
|
+
l.add(u[p]);
|
|
1423
|
+
return l;
|
|
1424
1424
|
});
|
|
1425
1425
|
}
|
|
1426
1426
|
// ._loadNodeShallow() parses a single node.
|
|
@@ -1429,26 +1429,26 @@ class sn {
|
|
|
1429
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 o = t.nodes[e], s = o.name ? n.createUniqueName(o.name) : "",
|
|
1432
|
+
const o = t.nodes[e], s = o.name ? n.createUniqueName(o.name) : "", i = [], a = n._invokeOne(function(c) {
|
|
1433
1433
|
return c.createNodeMesh && c.createNodeMesh(e);
|
|
1434
1434
|
});
|
|
1435
|
-
return
|
|
1435
|
+
return a && i.push(a), o.camera !== void 0 && i.push(n.getDependency("camera", o.camera).then(function(c) {
|
|
1436
1436
|
return n._getNodeRef(n.cameraCache, o.camera, c);
|
|
1437
1437
|
})), n._invokeAll(function(c) {
|
|
1438
1438
|
return c.createNodeAttachment && c.createNodeAttachment(e);
|
|
1439
1439
|
}).forEach(function(c) {
|
|
1440
|
-
|
|
1441
|
-
}), this.nodeCache[e] = Promise.all(
|
|
1442
|
-
let
|
|
1443
|
-
if (o.isBone === !0 ?
|
|
1444
|
-
for (let
|
|
1445
|
-
|
|
1446
|
-
if (o.name && (
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1440
|
+
i.push(c);
|
|
1441
|
+
}), this.nodeCache[e] = Promise.all(i).then(function(c) {
|
|
1442
|
+
let l;
|
|
1443
|
+
if (o.isBone === !0 ? l = new gt() : c.length > 1 ? l = new B() : c.length === 1 ? l = c[0] : l = new ue(), l !== c[0])
|
|
1444
|
+
for (let u = 0, f = c.length; u < f; u++)
|
|
1445
|
+
l.add(c[u]);
|
|
1446
|
+
if (o.name && (l.userData.name = o.name, l.name = s), U(l, o), o.extensions && v(r, l, o), o.matrix !== void 0) {
|
|
1447
|
+
const u = new J();
|
|
1448
|
+
u.fromArray(o.matrix), l.applyMatrix4(u);
|
|
1449
1449
|
} else
|
|
1450
|
-
o.translation !== void 0 &&
|
|
1451
|
-
return n.associations.has(
|
|
1450
|
+
o.translation !== void 0 && l.position.fromArray(o.translation), o.rotation !== void 0 && l.quaternion.fromArray(o.rotation), o.scale !== void 0 && l.scale.fromArray(o.scale);
|
|
1451
|
+
return n.associations.has(l) || n.associations.set(l, {}), n.associations.get(l).nodes = e, l;
|
|
1452
1452
|
}), this.nodeCache[e];
|
|
1453
1453
|
}
|
|
1454
1454
|
/**
|
|
@@ -1457,63 +1457,63 @@ class sn {
|
|
|
1457
1457
|
* @return {Promise<Group>}
|
|
1458
1458
|
*/
|
|
1459
1459
|
loadScene(e) {
|
|
1460
|
-
const t = this.extensions, r = this.json.scenes[e], n = this, o = new
|
|
1461
|
-
r.name && (o.name = n.createUniqueName(r.name)),
|
|
1462
|
-
const s = r.nodes || [],
|
|
1463
|
-
for (let
|
|
1464
|
-
|
|
1465
|
-
return Promise.all(
|
|
1466
|
-
for (let
|
|
1467
|
-
o.add(
|
|
1468
|
-
const c = (
|
|
1469
|
-
const
|
|
1470
|
-
for (const [f,
|
|
1471
|
-
(f instanceof
|
|
1472
|
-
return
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
}),
|
|
1460
|
+
const t = this.extensions, r = this.json.scenes[e], n = this, o = new B();
|
|
1461
|
+
r.name && (o.name = n.createUniqueName(r.name)), U(o, r), r.extensions && v(t, o, r);
|
|
1462
|
+
const s = r.nodes || [], i = [];
|
|
1463
|
+
for (let a = 0, c = s.length; a < c; a++)
|
|
1464
|
+
i.push(n.getDependency("node", s[a]));
|
|
1465
|
+
return Promise.all(i).then(function(a) {
|
|
1466
|
+
for (let l = 0, u = a.length; l < u; l++)
|
|
1467
|
+
o.add(a[l]);
|
|
1468
|
+
const c = (l) => {
|
|
1469
|
+
const u = /* @__PURE__ */ new Map();
|
|
1470
|
+
for (const [f, p] of n.associations)
|
|
1471
|
+
(f instanceof ee || f instanceof me) && u.set(f, p);
|
|
1472
|
+
return l.traverse((f) => {
|
|
1473
|
+
const p = n.associations.get(f);
|
|
1474
|
+
p != null && u.set(f, p);
|
|
1475
|
+
}), u;
|
|
1476
1476
|
};
|
|
1477
1477
|
return n.associations = c(o), o;
|
|
1478
1478
|
});
|
|
1479
1479
|
}
|
|
1480
1480
|
_createAnimationTracks(e, t, r, n, o) {
|
|
1481
|
-
const s = [],
|
|
1482
|
-
|
|
1483
|
-
f.morphTargetInfluences &&
|
|
1484
|
-
}) :
|
|
1481
|
+
const s = [], i = e.name ? e.name : e.uuid, a = [];
|
|
1482
|
+
F[o.path] === F.weights ? e.traverse(function(f) {
|
|
1483
|
+
f.morphTargetInfluences && a.push(f.name ? f.name : f.uuid);
|
|
1484
|
+
}) : a.push(i);
|
|
1485
1485
|
let c;
|
|
1486
|
-
switch (
|
|
1487
|
-
case
|
|
1488
|
-
c =
|
|
1486
|
+
switch (F[o.path]) {
|
|
1487
|
+
case F.weights:
|
|
1488
|
+
c = Ae;
|
|
1489
1489
|
break;
|
|
1490
|
-
case
|
|
1491
|
-
c =
|
|
1490
|
+
case F.rotation:
|
|
1491
|
+
c = Te;
|
|
1492
1492
|
break;
|
|
1493
|
-
case
|
|
1494
|
-
case
|
|
1495
|
-
c =
|
|
1493
|
+
case F.position:
|
|
1494
|
+
case F.scale:
|
|
1495
|
+
c = ge;
|
|
1496
1496
|
break;
|
|
1497
1497
|
default:
|
|
1498
1498
|
switch (r.itemSize) {
|
|
1499
1499
|
case 1:
|
|
1500
|
-
c =
|
|
1500
|
+
c = Ae;
|
|
1501
1501
|
break;
|
|
1502
1502
|
case 2:
|
|
1503
1503
|
case 3:
|
|
1504
1504
|
default:
|
|
1505
|
-
c =
|
|
1505
|
+
c = ge;
|
|
1506
1506
|
break;
|
|
1507
1507
|
}
|
|
1508
1508
|
break;
|
|
1509
1509
|
}
|
|
1510
|
-
const
|
|
1511
|
-
for (let f = 0,
|
|
1510
|
+
const l = n.interpolation !== void 0 ? Qt[n.interpolation] : Fe, u = this._getArrayFromAccessor(r);
|
|
1511
|
+
for (let f = 0, p = a.length; f < p; f++) {
|
|
1512
1512
|
const T = new c(
|
|
1513
|
-
|
|
1513
|
+
a[f] + "." + F[o.path],
|
|
1514
1514
|
t.array,
|
|
1515
|
-
|
|
1516
|
-
|
|
1515
|
+
u,
|
|
1516
|
+
l
|
|
1517
1517
|
);
|
|
1518
1518
|
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(T), s.push(T);
|
|
1519
1519
|
}
|
|
@@ -1522,7 +1522,7 @@ class sn {
|
|
|
1522
1522
|
_getArrayFromAccessor(e) {
|
|
1523
1523
|
let t = e.array;
|
|
1524
1524
|
if (e.normalized) {
|
|
1525
|
-
const r =
|
|
1525
|
+
const r = ce(t.constructor), n = new Float32Array(t.length);
|
|
1526
1526
|
for (let o = 0, s = t.length; o < s; o++)
|
|
1527
1527
|
n[o] = t[o] * r;
|
|
1528
1528
|
t = n;
|
|
@@ -1531,22 +1531,22 @@ class sn {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
_createCubicSplineTrackInterpolant(e) {
|
|
1533
1533
|
e.createInterpolant = function(r) {
|
|
1534
|
-
const n = this instanceof
|
|
1534
|
+
const n = this instanceof Te ? Jt : Ge;
|
|
1535
1535
|
return new n(this.times, this.values, this.getValueSize() / 3, r);
|
|
1536
1536
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
|
-
function
|
|
1539
|
+
function on(d, e, t) {
|
|
1540
1540
|
const r = e.attributes, n = new yt();
|
|
1541
1541
|
if (r.POSITION !== void 0) {
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1542
|
+
const i = t.json.accessors[r.POSITION], a = i.min, c = i.max;
|
|
1543
|
+
if (a !== void 0 && c !== void 0) {
|
|
1544
1544
|
if (n.set(
|
|
1545
|
-
new
|
|
1546
|
-
new
|
|
1547
|
-
),
|
|
1548
|
-
const
|
|
1549
|
-
n.min.multiplyScalar(
|
|
1545
|
+
new j(a[0], a[1], a[2]),
|
|
1546
|
+
new j(c[0], c[1], c[2])
|
|
1547
|
+
), i.normalized) {
|
|
1548
|
+
const l = ce(K[i.componentType]);
|
|
1549
|
+
n.min.multiplyScalar(l), n.max.multiplyScalar(l);
|
|
1550
1550
|
}
|
|
1551
1551
|
} else {
|
|
1552
1552
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
@@ -1556,145 +1556,145 @@ function rn(d, e, t) {
|
|
|
1556
1556
|
return;
|
|
1557
1557
|
const o = e.targets;
|
|
1558
1558
|
if (o !== void 0) {
|
|
1559
|
-
const
|
|
1560
|
-
for (let c = 0,
|
|
1561
|
-
const
|
|
1562
|
-
if (
|
|
1563
|
-
const f = t.json.accessors[
|
|
1564
|
-
if (
|
|
1565
|
-
if (
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1559
|
+
const i = new j(), a = new j();
|
|
1560
|
+
for (let c = 0, l = o.length; c < l; c++) {
|
|
1561
|
+
const u = o[c];
|
|
1562
|
+
if (u.POSITION !== void 0) {
|
|
1563
|
+
const f = t.json.accessors[u.POSITION], p = f.min, T = f.max;
|
|
1564
|
+
if (p !== void 0 && T !== void 0) {
|
|
1565
|
+
if (a.setX(Math.max(Math.abs(p[0]), Math.abs(T[0]))), a.setY(Math.max(Math.abs(p[1]), Math.abs(T[1]))), a.setZ(Math.max(Math.abs(p[2]), Math.abs(T[2]))), f.normalized) {
|
|
1566
|
+
const w = ce(K[f.componentType]);
|
|
1567
|
+
a.multiplyScalar(w);
|
|
1568
1568
|
}
|
|
1569
|
-
|
|
1569
|
+
i.max(a);
|
|
1570
1570
|
} else
|
|
1571
1571
|
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1572
1572
|
}
|
|
1573
1573
|
}
|
|
1574
|
-
n.expandByVector(
|
|
1574
|
+
n.expandByVector(i);
|
|
1575
1575
|
}
|
|
1576
1576
|
d.boundingBox = n;
|
|
1577
|
-
const s = new
|
|
1577
|
+
const s = new wt();
|
|
1578
1578
|
n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1580
|
+
function Le(d, e, t) {
|
|
1581
1581
|
const r = e.attributes, n = [];
|
|
1582
|
-
function o(s,
|
|
1583
|
-
return t.getDependency("accessor", s).then(function(
|
|
1584
|
-
d.setAttribute(
|
|
1582
|
+
function o(s, i) {
|
|
1583
|
+
return t.getDependency("accessor", s).then(function(a) {
|
|
1584
|
+
d.setAttribute(i, a);
|
|
1585
1585
|
});
|
|
1586
1586
|
}
|
|
1587
1587
|
for (const s in r) {
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1588
|
+
const i = ae[s] || s.toLowerCase();
|
|
1589
|
+
i in d.attributes || n.push(o(r[s], i));
|
|
1590
1590
|
}
|
|
1591
1591
|
if (e.indices !== void 0 && !d.index) {
|
|
1592
|
-
const s = t.getDependency("accessor", e.indices).then(function(
|
|
1593
|
-
d.setIndex(
|
|
1592
|
+
const s = t.getDependency("accessor", e.indices).then(function(i) {
|
|
1593
|
+
d.setIndex(i);
|
|
1594
1594
|
});
|
|
1595
1595
|
n.push(s);
|
|
1596
1596
|
}
|
|
1597
|
-
return
|
|
1598
|
-
return e.targets !== void 0 ?
|
|
1597
|
+
return _e.workingColorSpace !== k && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${_e.workingColorSpace}" not supported.`), U(d, e), on(d, e, t), Promise.all(n).then(function() {
|
|
1598
|
+
return e.targets !== void 0 ? $t(d, e.targets, t) : d;
|
|
1599
1599
|
});
|
|
1600
1600
|
}
|
|
1601
|
-
class
|
|
1601
|
+
class an {
|
|
1602
1602
|
parse(e) {
|
|
1603
1603
|
const t = {}, r = e.split(`
|
|
1604
1604
|
`);
|
|
1605
1605
|
let n = null, o = t;
|
|
1606
1606
|
const s = [t];
|
|
1607
|
-
for (const
|
|
1608
|
-
if (
|
|
1609
|
-
const
|
|
1610
|
-
if (
|
|
1611
|
-
const
|
|
1612
|
-
s.push(
|
|
1607
|
+
for (const i of r)
|
|
1608
|
+
if (i.includes("=")) {
|
|
1609
|
+
const a = i.split("="), c = a[0].trim(), l = a[1].trim();
|
|
1610
|
+
if (l.endsWith("{")) {
|
|
1611
|
+
const u = {};
|
|
1612
|
+
s.push(u), o[c] = u, o = u;
|
|
1613
1613
|
} else
|
|
1614
|
-
o[c] =
|
|
1615
|
-
} else if (
|
|
1616
|
-
const
|
|
1617
|
-
s.push(
|
|
1618
|
-
} else if (
|
|
1614
|
+
o[c] = l;
|
|
1615
|
+
} else if (i.endsWith("{")) {
|
|
1616
|
+
const a = o[n] || {};
|
|
1617
|
+
s.push(a), o[n] = a, o = a;
|
|
1618
|
+
} else if (i.endsWith("}")) {
|
|
1619
1619
|
if (s.pop(), s.length === 0) continue;
|
|
1620
1620
|
o = s[s.length - 1];
|
|
1621
|
-
} else if (
|
|
1622
|
-
const
|
|
1623
|
-
s.push(
|
|
1624
|
-
} else
|
|
1621
|
+
} else if (i.endsWith("(")) {
|
|
1622
|
+
const a = {};
|
|
1623
|
+
s.push(a), n = i.split("(")[0].trim() || n, o[n] = a, o = a;
|
|
1624
|
+
} else i.endsWith(")") ? (s.pop(), o = s[s.length - 1]) : n = i.trim();
|
|
1625
1625
|
return t;
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
-
class
|
|
1628
|
+
class cn extends le {
|
|
1629
1629
|
constructor(e) {
|
|
1630
1630
|
super(e);
|
|
1631
1631
|
}
|
|
1632
1632
|
load(e, t, r, n) {
|
|
1633
|
-
const o = this, s = new
|
|
1634
|
-
s.setPath(o.path), s.setResponseType("arraybuffer"), s.setRequestHeader(o.requestHeader), s.setWithCredentials(o.withCredentials), s.load(e, function(
|
|
1633
|
+
const o = this, s = new W(o.manager);
|
|
1634
|
+
s.setPath(o.path), s.setResponseType("arraybuffer"), s.setRequestHeader(o.requestHeader), s.setWithCredentials(o.withCredentials), s.load(e, function(i) {
|
|
1635
1635
|
try {
|
|
1636
|
-
t(o.parse(
|
|
1637
|
-
} catch (
|
|
1638
|
-
n ? n(
|
|
1636
|
+
t(o.parse(i));
|
|
1637
|
+
} catch (a) {
|
|
1638
|
+
n ? n(a) : console.error(a), o.manager.itemError(e);
|
|
1639
1639
|
}
|
|
1640
1640
|
}, r, n);
|
|
1641
1641
|
}
|
|
1642
1642
|
parse(e) {
|
|
1643
|
-
const t = new
|
|
1643
|
+
const t = new an();
|
|
1644
1644
|
function r(h) {
|
|
1645
|
-
const
|
|
1646
|
-
new
|
|
1645
|
+
const m = {};
|
|
1646
|
+
new W().setResponseType("arraybuffer");
|
|
1647
1647
|
for (const A in h) {
|
|
1648
1648
|
if (A.endsWith("png")) {
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1649
|
+
const x = new Blob([h[A]], { type: { type: "image/png" } });
|
|
1650
|
+
m[A] = URL.createObjectURL(x);
|
|
1651
1651
|
}
|
|
1652
1652
|
if (A.endsWith("usd") || A.endsWith("usda")) {
|
|
1653
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
|
|
1658
|
-
|
|
1657
|
+
const x = ye(h[A]);
|
|
1658
|
+
m[A] = t.parse(x);
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
|
-
return
|
|
1661
|
+
return m;
|
|
1662
1662
|
}
|
|
1663
1663
|
function n(h) {
|
|
1664
|
-
const
|
|
1665
|
-
return
|
|
1664
|
+
const m = h.slice(0, 7), g = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
|
|
1665
|
+
return m.every((A, x) => A === g[x]);
|
|
1666
1666
|
}
|
|
1667
1667
|
function o(h) {
|
|
1668
1668
|
if (h.length < 1) return;
|
|
1669
|
-
const
|
|
1669
|
+
const m = Object.keys(h)[0];
|
|
1670
1670
|
let g = !1;
|
|
1671
|
-
if (
|
|
1672
|
-
if (
|
|
1671
|
+
if (m.endsWith("usda")) return h[m];
|
|
1672
|
+
if (m.endsWith("usdc"))
|
|
1673
1673
|
g = !0;
|
|
1674
|
-
else if (
|
|
1675
|
-
if (n(h[
|
|
1674
|
+
else if (m.endsWith("usd"))
|
|
1675
|
+
if (n(h[m]))
|
|
1676
1676
|
g = !0;
|
|
1677
1677
|
else
|
|
1678
|
-
return h[
|
|
1678
|
+
return h[m];
|
|
1679
1679
|
g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1680
1680
|
}
|
|
1681
|
-
const s = Rt(new Uint8Array(e)),
|
|
1682
|
-
if (
|
|
1683
|
-
return console.warn("THREE.USDZLoader: No usda file found."), new
|
|
1684
|
-
const c =
|
|
1685
|
-
function
|
|
1681
|
+
const s = Rt(new Uint8Array(e)), i = r(s), a = o(s);
|
|
1682
|
+
if (a === void 0)
|
|
1683
|
+
return console.warn("THREE.USDZLoader: No usda file found."), new B();
|
|
1684
|
+
const c = ye(a), l = t.parse(c);
|
|
1685
|
+
function u(h) {
|
|
1686
1686
|
if (h) {
|
|
1687
1687
|
if ("prepend references" in h) {
|
|
1688
|
-
const g = h["prepend references"].split("@"), A = g[1].replace(/^.\//, ""),
|
|
1689
|
-
return f(
|
|
1688
|
+
const g = h["prepend references"].split("@"), A = g[1].replace(/^.\//, ""), x = g[2].replace(/^<\//, "").replace(/>$/, "");
|
|
1689
|
+
return f(i[A], x);
|
|
1690
1690
|
}
|
|
1691
1691
|
return f(h);
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
|
-
function f(h,
|
|
1694
|
+
function f(h, m) {
|
|
1695
1695
|
if (h) {
|
|
1696
|
-
if (
|
|
1697
|
-
const g = `def Mesh "${
|
|
1696
|
+
if (m !== void 0) {
|
|
1697
|
+
const g = `def Mesh "${m}"`;
|
|
1698
1698
|
if (g in h)
|
|
1699
1699
|
return h[g];
|
|
1700
1700
|
}
|
|
@@ -1703,172 +1703,172 @@ class an extends ce {
|
|
|
1703
1703
|
if (g.startsWith("def Mesh"))
|
|
1704
1704
|
return "point3f[] points" in h && (A["point3f[] points"] = h["point3f[] points"]), "texCoord2f[] primvars:st" in h && (A["texCoord2f[] primvars:st"] = h["texCoord2f[] primvars:st"]), "int[] primvars:st:indices" in h && (A["int[] primvars:st:indices"] = h["int[] primvars:st:indices"]), A;
|
|
1705
1705
|
if (typeof A == "object") {
|
|
1706
|
-
const
|
|
1707
|
-
if (
|
|
1706
|
+
const x = f(A);
|
|
1707
|
+
if (x) return x;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
|
-
function
|
|
1712
|
+
function p(h) {
|
|
1713
1713
|
if (!h) return;
|
|
1714
|
-
let
|
|
1714
|
+
let m = new Z();
|
|
1715
1715
|
if ("int[] faceVertexIndices" in h) {
|
|
1716
1716
|
const g = JSON.parse(h["int[] faceVertexIndices"]);
|
|
1717
|
-
|
|
1717
|
+
m.setIndex(g);
|
|
1718
1718
|
}
|
|
1719
1719
|
if ("point3f[] points" in h) {
|
|
1720
|
-
const g = JSON.parse(h["point3f[] points"].replace(/[()]*/g, "")), A = new
|
|
1721
|
-
|
|
1720
|
+
const g = JSON.parse(h["point3f[] points"].replace(/[()]*/g, "")), A = new N(new Float32Array(g), 3);
|
|
1721
|
+
m.setAttribute("position", A);
|
|
1722
1722
|
}
|
|
1723
1723
|
if ("normal3f[] normals" in h) {
|
|
1724
|
-
const g = JSON.parse(h["normal3f[] normals"].replace(/[()]*/g, "")), A = new
|
|
1725
|
-
|
|
1724
|
+
const g = JSON.parse(h["normal3f[] normals"].replace(/[()]*/g, "")), A = new N(new Float32Array(g), 3);
|
|
1725
|
+
m.setAttribute("normal", A);
|
|
1726
1726
|
} else
|
|
1727
|
-
|
|
1727
|
+
m.computeVertexNormals();
|
|
1728
1728
|
if ("float2[] primvars:st" in h && (h["texCoord2f[] primvars:st"] = h["float2[] primvars:st"]), "texCoord2f[] primvars:st" in h) {
|
|
1729
|
-
const g = JSON.parse(h["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), A = new
|
|
1729
|
+
const g = JSON.parse(h["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), A = new N(new Float32Array(g), 2);
|
|
1730
1730
|
if ("int[] primvars:st:indices" in h) {
|
|
1731
|
-
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1731
|
+
m = m.toNonIndexed();
|
|
1732
|
+
const x = JSON.parse(h["int[] primvars:st:indices"]);
|
|
1733
|
+
m.setAttribute("uv", T(A, x));
|
|
1734
1734
|
} else
|
|
1735
|
-
|
|
1735
|
+
m.setAttribute("uv", A);
|
|
1736
1736
|
}
|
|
1737
|
-
return
|
|
1738
|
-
}
|
|
1739
|
-
function T(h,
|
|
1740
|
-
const g = h.array, A = h.itemSize,
|
|
1741
|
-
let
|
|
1742
|
-
for (let
|
|
1743
|
-
|
|
1744
|
-
for (let
|
|
1745
|
-
|
|
1737
|
+
return m;
|
|
1738
|
+
}
|
|
1739
|
+
function T(h, m) {
|
|
1740
|
+
const g = h.array, A = h.itemSize, x = new g.constructor(m.length * A);
|
|
1741
|
+
let he = 0, He = 0;
|
|
1742
|
+
for (let $ = 0, ve = m.length; $ < ve; $++) {
|
|
1743
|
+
he = m[$] * A;
|
|
1744
|
+
for (let pe = 0; pe < A; pe++)
|
|
1745
|
+
x[He++] = g[he++];
|
|
1746
1746
|
}
|
|
1747
|
-
return new
|
|
1747
|
+
return new N(x, A);
|
|
1748
1748
|
}
|
|
1749
|
-
function
|
|
1749
|
+
function w(h) {
|
|
1750
1750
|
if (h) {
|
|
1751
1751
|
if ("rel material:binding" in h) {
|
|
1752
1752
|
const A = h["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
|
|
1753
|
-
return
|
|
1753
|
+
return _(l, ` "${A[1]}"`);
|
|
1754
1754
|
}
|
|
1755
|
-
return
|
|
1755
|
+
return _(h);
|
|
1756
1756
|
}
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function _(h, m = "") {
|
|
1759
1759
|
for (const g in h) {
|
|
1760
1760
|
const A = h[g];
|
|
1761
|
-
if (g.startsWith("def Material" +
|
|
1761
|
+
if (g.startsWith("def Material" + m))
|
|
1762
1762
|
return A;
|
|
1763
1763
|
if (typeof A == "object") {
|
|
1764
|
-
const
|
|
1765
|
-
if (
|
|
1764
|
+
const x = _(A, m);
|
|
1765
|
+
if (x) return x;
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1769
|
+
function y(h, m) {
|
|
1770
|
+
m["float inputs:rotation"] && (h.rotation = parseFloat(m["float inputs:rotation"])), m["float2 inputs:scale"] && (h.repeat = new Y().fromArray(JSON.parse("[" + m["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), m["float2 inputs:translation"] && (h.offset = new Y().fromArray(JSON.parse("[" + m["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
|
|
1771
1771
|
}
|
|
1772
1772
|
function E(h) {
|
|
1773
|
-
const
|
|
1773
|
+
const m = new P();
|
|
1774
1774
|
if (h !== void 0) {
|
|
1775
1775
|
if ('def Shader "PreviewSurface"' in h) {
|
|
1776
1776
|
const g = h['def Shader "PreviewSurface"'];
|
|
1777
1777
|
if ("color3f inputs:diffuseColor.connect" in g) {
|
|
1778
|
-
const A = g["color3f inputs:diffuseColor.connect"],
|
|
1779
|
-
|
|
1778
|
+
const A = g["color3f inputs:diffuseColor.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1779
|
+
m.map = R(x), m.map.colorSpace = D, 'def Shader "Transform2d_diffuse"' in h && y(m.map, h['def Shader "Transform2d_diffuse"']);
|
|
1780
1780
|
} else if ("color3f inputs:diffuseColor" in g) {
|
|
1781
1781
|
const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
|
|
1782
|
-
|
|
1782
|
+
m.color.fromArray(JSON.parse("[" + A + "]"));
|
|
1783
1783
|
}
|
|
1784
1784
|
if ("color3f inputs:emissiveColor.connect" in g) {
|
|
1785
|
-
const A = g["color3f inputs:emissiveColor.connect"],
|
|
1786
|
-
|
|
1785
|
+
const A = g["color3f inputs:emissiveColor.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1786
|
+
m.emissiveMap = R(x), m.emissiveMap.colorSpace = D, m.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && y(m.emissiveMap, h['def Shader "Transform2d_emissive"']);
|
|
1787
1787
|
} else if ("color3f inputs:emissiveColor" in g) {
|
|
1788
1788
|
const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
|
|
1789
|
-
|
|
1789
|
+
m.emissive.fromArray(JSON.parse("[" + A + "]"));
|
|
1790
1790
|
}
|
|
1791
1791
|
if ("normal3f inputs:normal.connect" in g) {
|
|
1792
|
-
const A = g["normal3f inputs:normal.connect"],
|
|
1793
|
-
|
|
1792
|
+
const A = g["normal3f inputs:normal.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1793
|
+
m.normalMap = R(x), m.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && y(m.normalMap, h['def Shader "Transform2d_normal"']);
|
|
1794
1794
|
}
|
|
1795
1795
|
if ("float inputs:roughness.connect" in g) {
|
|
1796
|
-
const A = g["float inputs:roughness.connect"],
|
|
1797
|
-
|
|
1798
|
-
} else "float inputs:roughness" in g && (
|
|
1796
|
+
const A = g["float inputs:roughness.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1797
|
+
m.roughness = 1, m.roughnessMap = R(x), m.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && y(m.roughnessMap, h['def Shader "Transform2d_roughness"']);
|
|
1798
|
+
} else "float inputs:roughness" in g && (m.roughness = parseFloat(g["float inputs:roughness"]));
|
|
1799
1799
|
if ("float inputs:metallic.connect" in g) {
|
|
1800
|
-
const A = g["float inputs:metallic.connect"],
|
|
1801
|
-
|
|
1802
|
-
} else "float inputs:metallic" in g && (
|
|
1800
|
+
const A = g["float inputs:metallic.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1801
|
+
m.metalness = 1, m.metalnessMap = R(x), m.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && y(m.metalnessMap, h['def Shader "Transform2d_metallic"']);
|
|
1802
|
+
} else "float inputs:metallic" in g && (m.metalness = parseFloat(g["float inputs:metallic"]));
|
|
1803
1803
|
if ("float inputs:clearcoat.connect" in g) {
|
|
1804
|
-
const A = g["float inputs:clearcoat.connect"],
|
|
1805
|
-
|
|
1806
|
-
} else "float inputs:clearcoat" in g && (
|
|
1804
|
+
const A = g["float inputs:clearcoat.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1805
|
+
m.clearcoat = 1, m.clearcoatMap = R(x), m.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && y(m.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
|
|
1806
|
+
} else "float inputs:clearcoat" in g && (m.clearcoat = parseFloat(g["float inputs:clearcoat"]));
|
|
1807
1807
|
if ("float inputs:clearcoatRoughness.connect" in g) {
|
|
1808
|
-
const A = g["float inputs:clearcoatRoughness.connect"],
|
|
1809
|
-
|
|
1810
|
-
} else "float inputs:clearcoatRoughness" in g && (
|
|
1811
|
-
if ("float inputs:ior" in g && (
|
|
1812
|
-
const A = g["float inputs:occlusion.connect"],
|
|
1813
|
-
|
|
1808
|
+
const A = g["float inputs:clearcoatRoughness.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1809
|
+
m.clearcoatRoughness = 1, m.clearcoatRoughnessMap = R(x), m.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && y(m.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
|
|
1810
|
+
} else "float inputs:clearcoatRoughness" in g && (m.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
|
|
1811
|
+
if ("float inputs:ior" in g && (m.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
|
|
1812
|
+
const A = g["float inputs:occlusion.connect"], x = S(l, /(\w+).output/.exec(A)[1]);
|
|
1813
|
+
m.aoMap = R(x), m.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && y(m.aoMap, h['def Shader "Transform2d_occlusion"']);
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
1816
|
if ('def Shader "diffuseColor_texture"' in h) {
|
|
1817
1817
|
const g = h['def Shader "diffuseColor_texture"'];
|
|
1818
|
-
|
|
1818
|
+
m.map = R(g), m.map.colorSpace = D;
|
|
1819
1819
|
}
|
|
1820
1820
|
if ('def Shader "normal_texture"' in h) {
|
|
1821
1821
|
const g = h['def Shader "normal_texture"'];
|
|
1822
|
-
|
|
1822
|
+
m.normalMap = R(g), m.normalMap.colorSpace = H;
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
|
-
return
|
|
1825
|
+
return m;
|
|
1826
1826
|
}
|
|
1827
|
-
function S(h,
|
|
1827
|
+
function S(h, m) {
|
|
1828
1828
|
for (const g in h) {
|
|
1829
1829
|
const A = h[g];
|
|
1830
|
-
if (g.startsWith(`def Shader "${
|
|
1830
|
+
if (g.startsWith(`def Shader "${m}"`))
|
|
1831
1831
|
return A;
|
|
1832
1832
|
if (typeof A == "object") {
|
|
1833
|
-
const
|
|
1834
|
-
if (
|
|
1833
|
+
const x = S(A, m);
|
|
1834
|
+
if (x) return x;
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function R(h) {
|
|
1839
1839
|
if ("asset inputs:file" in h) {
|
|
1840
|
-
const
|
|
1841
|
-
'"clamp"':
|
|
1842
|
-
'"mirror"':
|
|
1840
|
+
const m = h["asset inputs:file"].replace(/@*/g, ""), A = new Ne().load(i[m]), x = {
|
|
1841
|
+
'"clamp"': Pe,
|
|
1842
|
+
'"mirror"': ke,
|
|
1843
1843
|
'"repeat"': Q
|
|
1844
1844
|
};
|
|
1845
|
-
return "token inputs:wrapS" in h && (A.wrapS =
|
|
1845
|
+
return "token inputs:wrapS" in h && (A.wrapS = x[h["token inputs:wrapS"]]), "token inputs:wrapT" in h && (A.wrapT = x[h["token inputs:wrapT"]]), A;
|
|
1846
1846
|
}
|
|
1847
1847
|
return null;
|
|
1848
1848
|
}
|
|
1849
1849
|
function M(h) {
|
|
1850
|
-
const
|
|
1850
|
+
const m = p(u(h)), g = E(w(h)), A = m ? new de(m, g) : new ue();
|
|
1851
1851
|
if ("matrix4d xformOp:transform" in h) {
|
|
1852
|
-
const
|
|
1853
|
-
A.matrix.fromArray(
|
|
1852
|
+
const x = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
|
|
1853
|
+
A.matrix.fromArray(x), A.matrix.decompose(A.position, A.quaternion, A.scale);
|
|
1854
1854
|
}
|
|
1855
1855
|
return A;
|
|
1856
1856
|
}
|
|
1857
|
-
function I(h,
|
|
1857
|
+
function I(h, m) {
|
|
1858
1858
|
for (const g in h)
|
|
1859
1859
|
if (g.startsWith("def Scope"))
|
|
1860
|
-
I(h[g],
|
|
1860
|
+
I(h[g], m);
|
|
1861
1861
|
else if (g.startsWith("def Xform")) {
|
|
1862
1862
|
const A = M(h[g]);
|
|
1863
|
-
/def Xform "(\w+)"/.test(g) && (A.name = /def Xform "(\w+)"/.exec(g)[1]),
|
|
1863
|
+
/def Xform "(\w+)"/.test(g) && (A.name = /def Xform "(\w+)"/.exec(g)[1]), m.add(A), I(h[g], A);
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
|
-
const L = new
|
|
1867
|
-
return I(
|
|
1866
|
+
const L = new B();
|
|
1867
|
+
return I(l, L), L;
|
|
1868
1868
|
}
|
|
1869
1869
|
}
|
|
1870
|
-
const
|
|
1871
|
-
class
|
|
1870
|
+
const re = /* @__PURE__ */ new WeakMap();
|
|
1871
|
+
class ln extends le {
|
|
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",
|
|
@@ -1892,64 +1892,64 @@ class cn extends ce {
|
|
|
1892
1892
|
return this.workerLimit = e, this;
|
|
1893
1893
|
}
|
|
1894
1894
|
load(e, t, r, n) {
|
|
1895
|
-
const o = new
|
|
1895
|
+
const o = new W(this.manager);
|
|
1896
1896
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, (s) => {
|
|
1897
1897
|
this.parse(s, t, n);
|
|
1898
1898
|
}, r, n);
|
|
1899
1899
|
}
|
|
1900
1900
|
parse(e, t, r = () => {
|
|
1901
1901
|
}) {
|
|
1902
|
-
this.decodeDracoFile(e, t, null, null,
|
|
1902
|
+
this.decodeDracoFile(e, t, null, null, D).catch(r);
|
|
1903
1903
|
}
|
|
1904
|
-
decodeDracoFile(e, t, r, n, o =
|
|
1904
|
+
decodeDracoFile(e, t, r, n, o = k, s = () => {
|
|
1905
1905
|
}) {
|
|
1906
|
-
const
|
|
1906
|
+
const i = {
|
|
1907
1907
|
attributeIDs: r || this.defaultAttributeIDs,
|
|
1908
1908
|
attributeTypes: n || this.defaultAttributeTypes,
|
|
1909
1909
|
useUniqueIDs: !!r,
|
|
1910
1910
|
vertexColorSpace: o
|
|
1911
1911
|
};
|
|
1912
|
-
return this.decodeGeometry(e,
|
|
1912
|
+
return this.decodeGeometry(e, i).then(t).catch(s);
|
|
1913
1913
|
}
|
|
1914
1914
|
decodeGeometry(e, t) {
|
|
1915
1915
|
const r = JSON.stringify(t);
|
|
1916
|
-
if (
|
|
1917
|
-
const
|
|
1918
|
-
if (
|
|
1919
|
-
return
|
|
1916
|
+
if (re.has(e)) {
|
|
1917
|
+
const a = re.get(e);
|
|
1918
|
+
if (a.key === r)
|
|
1919
|
+
return a.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
1925
|
let n;
|
|
1926
|
-
const o = this.workerNextTaskID++, s = e.byteLength,
|
|
1927
|
-
n._callbacks[o] = { resolve: c, reject:
|
|
1928
|
-
}))).then((
|
|
1929
|
-
return
|
|
1926
|
+
const o = this.workerNextTaskID++, s = e.byteLength, i = this._getWorker(o, s).then((a) => (n = a, new Promise((c, l) => {
|
|
1927
|
+
n._callbacks[o] = { resolve: c, reject: l }, n.postMessage({ type: "decode", id: o, taskConfig: t, buffer: e }, [e]);
|
|
1928
|
+
}))).then((a) => this._createGeometry(a.geometry));
|
|
1929
|
+
return i.catch(() => !0).then(() => {
|
|
1930
1930
|
n && o && this._releaseTask(n, o);
|
|
1931
|
-
}),
|
|
1931
|
+
}), re.set(e, {
|
|
1932
1932
|
key: r,
|
|
1933
|
-
promise:
|
|
1934
|
-
}),
|
|
1933
|
+
promise: i
|
|
1934
|
+
}), i;
|
|
1935
1935
|
}
|
|
1936
1936
|
_createGeometry(e) {
|
|
1937
|
-
const t = new
|
|
1938
|
-
e.index && t.setIndex(new
|
|
1937
|
+
const t = new Z();
|
|
1938
|
+
e.index && t.setIndex(new N(e.index.array, 1));
|
|
1939
1939
|
for (let r = 0; r < e.attributes.length; r++) {
|
|
1940
|
-
const n = e.attributes[r], o = n.name, s = n.array,
|
|
1941
|
-
o === "color" && (this._assignVertexColorSpace(
|
|
1940
|
+
const n = e.attributes[r], o = n.name, s = n.array, i = n.itemSize, a = new N(s, i);
|
|
1941
|
+
o === "color" && (this._assignVertexColorSpace(a, n.vertexColorSpace), a.normalized = !(s instanceof Float32Array)), t.setAttribute(o, a);
|
|
1942
1942
|
}
|
|
1943
1943
|
return t;
|
|
1944
1944
|
}
|
|
1945
1945
|
_assignVertexColorSpace(e, t) {
|
|
1946
|
-
if (t !==
|
|
1947
|
-
const r = new
|
|
1946
|
+
if (t !== D) return;
|
|
1947
|
+
const r = new G();
|
|
1948
1948
|
for (let n = 0, o = e.count; n < o; n++)
|
|
1949
1949
|
r.fromBufferAttribute(e, n).convertSRGBToLinear(), e.setXYZ(n, r.r, r.g, r.b);
|
|
1950
1950
|
}
|
|
1951
1951
|
_loadLibrary(e, t) {
|
|
1952
|
-
const r = new
|
|
1952
|
+
const r = new W(this.manager);
|
|
1953
1953
|
return r.setPath(this.decoderPath), r.setResponseType(t), r.setWithCredentials(this.withCredentials), new Promise((n, o) => {
|
|
1954
1954
|
r.load(e, n, void 0, o);
|
|
1955
1955
|
});
|
|
@@ -2014,76 +2014,76 @@ class cn extends ce {
|
|
|
2014
2014
|
function un() {
|
|
2015
2015
|
let d, e;
|
|
2016
2016
|
onmessage = function(s) {
|
|
2017
|
-
const
|
|
2018
|
-
switch (
|
|
2017
|
+
const i = s.data;
|
|
2018
|
+
switch (i.type) {
|
|
2019
2019
|
case "init":
|
|
2020
|
-
d =
|
|
2021
|
-
d.onModuleLoaded = function(
|
|
2022
|
-
|
|
2020
|
+
d = i.decoderConfig, e = new Promise(function(l) {
|
|
2021
|
+
d.onModuleLoaded = function(u) {
|
|
2022
|
+
l({ draco: u });
|
|
2023
2023
|
}, DracoDecoderModule(d);
|
|
2024
2024
|
});
|
|
2025
2025
|
break;
|
|
2026
2026
|
case "decode":
|
|
2027
|
-
const
|
|
2028
|
-
e.then((
|
|
2029
|
-
const
|
|
2027
|
+
const a = i.buffer, c = i.taskConfig;
|
|
2028
|
+
e.then((l) => {
|
|
2029
|
+
const u = l.draco, f = new u.Decoder();
|
|
2030
2030
|
try {
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
} catch (
|
|
2034
|
-
console.error(
|
|
2031
|
+
const p = t(u, f, new Int8Array(a), c), T = p.attributes.map((w) => w.array.buffer);
|
|
2032
|
+
p.index && T.push(p.index.array.buffer), self.postMessage({ type: "decode", id: i.id, geometry: p }, T);
|
|
2033
|
+
} catch (p) {
|
|
2034
|
+
console.error(p), self.postMessage({ type: "error", id: i.id, error: p.message });
|
|
2035
2035
|
} finally {
|
|
2036
|
-
|
|
2036
|
+
u.destroy(f);
|
|
2037
2037
|
}
|
|
2038
2038
|
});
|
|
2039
2039
|
break;
|
|
2040
2040
|
}
|
|
2041
2041
|
};
|
|
2042
|
-
function t(s,
|
|
2043
|
-
const
|
|
2044
|
-
let f,
|
|
2045
|
-
const T =
|
|
2042
|
+
function t(s, i, a, c) {
|
|
2043
|
+
const l = c.attributeIDs, u = c.attributeTypes;
|
|
2044
|
+
let f, p;
|
|
2045
|
+
const T = i.GetEncodedGeometryType(a);
|
|
2046
2046
|
if (T === s.TRIANGULAR_MESH)
|
|
2047
|
-
f = new s.Mesh(),
|
|
2047
|
+
f = new s.Mesh(), p = i.DecodeArrayToMesh(a, a.byteLength, f);
|
|
2048
2048
|
else if (T === s.POINT_CLOUD)
|
|
2049
|
-
f = new s.PointCloud(),
|
|
2049
|
+
f = new s.PointCloud(), p = i.DecodeArrayToPointCloud(a, a.byteLength, f);
|
|
2050
2050
|
else
|
|
2051
2051
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2052
|
-
if (!
|
|
2053
|
-
throw new Error("THREE.DRACOLoader: Decoding failed: " +
|
|
2054
|
-
const
|
|
2055
|
-
for (const
|
|
2056
|
-
const
|
|
2052
|
+
if (!p.ok() || f.ptr === 0)
|
|
2053
|
+
throw new Error("THREE.DRACOLoader: Decoding failed: " + p.error_msg());
|
|
2054
|
+
const w = { index: null, attributes: [] };
|
|
2055
|
+
for (const _ in l) {
|
|
2056
|
+
const y = self[u[_]];
|
|
2057
2057
|
let E, S;
|
|
2058
2058
|
if (c.useUniqueIDs)
|
|
2059
|
-
S =
|
|
2059
|
+
S = l[_], E = i.GetAttributeByUniqueId(f, S);
|
|
2060
2060
|
else {
|
|
2061
|
-
if (S =
|
|
2062
|
-
E =
|
|
2061
|
+
if (S = i.GetAttributeId(f, s[l[_]]), S === -1) continue;
|
|
2062
|
+
E = i.GetAttribute(f, S);
|
|
2063
2063
|
}
|
|
2064
|
-
const
|
|
2065
|
-
|
|
2066
|
-
}
|
|
2067
|
-
return T === s.TRIANGULAR_MESH && (
|
|
2068
|
-
}
|
|
2069
|
-
function r(s,
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2072
|
-
const
|
|
2073
|
-
return s._free(f), { array:
|
|
2074
|
-
}
|
|
2075
|
-
function n(s,
|
|
2076
|
-
const f =
|
|
2077
|
-
|
|
2078
|
-
const E = new
|
|
2079
|
-
return s._free(
|
|
2064
|
+
const R = n(s, i, f, _, y, E);
|
|
2065
|
+
_ === "color" && (R.vertexColorSpace = c.vertexColorSpace), w.attributes.push(R);
|
|
2066
|
+
}
|
|
2067
|
+
return T === s.TRIANGULAR_MESH && (w.index = r(s, i, f)), s.destroy(f), w;
|
|
2068
|
+
}
|
|
2069
|
+
function r(s, i, a) {
|
|
2070
|
+
const l = a.num_faces() * 3, u = l * 4, f = s._malloc(u);
|
|
2071
|
+
i.GetTrianglesUInt32Array(a, u, f);
|
|
2072
|
+
const p = new Uint32Array(s.HEAPF32.buffer, f, l).slice();
|
|
2073
|
+
return s._free(f), { array: p, itemSize: 1 };
|
|
2074
|
+
}
|
|
2075
|
+
function n(s, i, a, c, l, u) {
|
|
2076
|
+
const f = u.num_components(), T = a.num_points() * f, w = T * l.BYTES_PER_ELEMENT, _ = o(s, l), y = s._malloc(w);
|
|
2077
|
+
i.GetAttributeDataArrayForAllPoints(a, u, _, w, y);
|
|
2078
|
+
const E = new l(s.HEAPF32.buffer, y, T).slice();
|
|
2079
|
+
return s._free(y), {
|
|
2080
2080
|
name: c,
|
|
2081
2081
|
array: E,
|
|
2082
2082
|
itemSize: f
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
2085
|
-
function o(s,
|
|
2086
|
-
switch (
|
|
2085
|
+
function o(s, i) {
|
|
2086
|
+
switch (i) {
|
|
2087
2087
|
case Float32Array:
|
|
2088
2088
|
return s.DT_FLOAT32;
|
|
2089
2089
|
case Int8Array:
|
|
@@ -2101,130 +2101,130 @@ function un() {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2104
|
+
function fn() {
|
|
2105
2105
|
let d, e;
|
|
2106
2106
|
onmessage = function(s) {
|
|
2107
|
-
const
|
|
2108
|
-
switch (
|
|
2107
|
+
const i = s.data;
|
|
2108
|
+
switch (i.type) {
|
|
2109
2109
|
case "init":
|
|
2110
|
-
d =
|
|
2111
|
-
d.onModuleLoaded = function(
|
|
2112
|
-
|
|
2110
|
+
d = i.decoderConfig, e = new Promise(function(l) {
|
|
2111
|
+
d.onModuleLoaded = function(u) {
|
|
2112
|
+
l({ draco: u });
|
|
2113
2113
|
}, DracoDecoderModule(d);
|
|
2114
2114
|
});
|
|
2115
2115
|
break;
|
|
2116
2116
|
case "decode":
|
|
2117
|
-
const
|
|
2118
|
-
e.then((
|
|
2119
|
-
const
|
|
2117
|
+
const a = i.buffer, c = i.taskConfig;
|
|
2118
|
+
e.then((l) => {
|
|
2119
|
+
const u = l.draco, f = new u.Decoder();
|
|
2120
2120
|
try {
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2121
|
+
const p = t(
|
|
2122
|
+
u,
|
|
2123
2123
|
f,
|
|
2124
|
-
new Int8Array(
|
|
2124
|
+
new Int8Array(a),
|
|
2125
2125
|
c
|
|
2126
|
-
), T =
|
|
2127
|
-
(
|
|
2126
|
+
), T = p.attributes.map(
|
|
2127
|
+
(w) => w.array.buffer
|
|
2128
2128
|
);
|
|
2129
|
-
|
|
2130
|
-
{ type: "decode", id:
|
|
2129
|
+
p.index && T.push(p.index.array.buffer), self.postMessage(
|
|
2130
|
+
{ type: "decode", id: i.id, geometry: p },
|
|
2131
2131
|
T
|
|
2132
2132
|
);
|
|
2133
|
-
} catch (
|
|
2134
|
-
console.error(
|
|
2133
|
+
} catch (p) {
|
|
2134
|
+
console.error(p), self.postMessage({
|
|
2135
2135
|
type: "error",
|
|
2136
|
-
id:
|
|
2137
|
-
error:
|
|
2136
|
+
id: i.id,
|
|
2137
|
+
error: p.message
|
|
2138
2138
|
});
|
|
2139
2139
|
} finally {
|
|
2140
|
-
|
|
2140
|
+
u.destroy(f);
|
|
2141
2141
|
}
|
|
2142
2142
|
});
|
|
2143
2143
|
break;
|
|
2144
2144
|
}
|
|
2145
2145
|
};
|
|
2146
|
-
function t(s,
|
|
2147
|
-
const
|
|
2148
|
-
let f,
|
|
2149
|
-
const T =
|
|
2146
|
+
function t(s, i, a, c) {
|
|
2147
|
+
const l = c.attributeIDs, u = c.attributeTypes;
|
|
2148
|
+
let f, p;
|
|
2149
|
+
const T = i.GetEncodedGeometryType(a);
|
|
2150
2150
|
if (T === s.TRIANGULAR_MESH)
|
|
2151
|
-
f = new s.Mesh(),
|
|
2152
|
-
|
|
2153
|
-
|
|
2151
|
+
f = new s.Mesh(), p = i.DecodeArrayToMesh(
|
|
2152
|
+
a,
|
|
2153
|
+
a.byteLength,
|
|
2154
2154
|
f
|
|
2155
2155
|
);
|
|
2156
2156
|
else if (T === s.POINT_CLOUD)
|
|
2157
|
-
f = new s.PointCloud(),
|
|
2158
|
-
|
|
2159
|
-
|
|
2157
|
+
f = new s.PointCloud(), p = i.DecodeArrayToPointCloud(
|
|
2158
|
+
a,
|
|
2159
|
+
a.byteLength,
|
|
2160
2160
|
f
|
|
2161
2161
|
);
|
|
2162
2162
|
else
|
|
2163
2163
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2164
|
-
if (!
|
|
2164
|
+
if (!p.ok() || f.ptr === 0)
|
|
2165
2165
|
throw new Error(
|
|
2166
|
-
"THREE.DRACOLoader: Decoding failed: " +
|
|
2166
|
+
"THREE.DRACOLoader: Decoding failed: " + p.error_msg()
|
|
2167
2167
|
);
|
|
2168
|
-
const
|
|
2169
|
-
for (const
|
|
2170
|
-
const
|
|
2168
|
+
const w = { index: null, attributes: [] };
|
|
2169
|
+
for (const _ in l) {
|
|
2170
|
+
const y = self[u[_]];
|
|
2171
2171
|
let E, S;
|
|
2172
2172
|
if (c.useUniqueIDs)
|
|
2173
|
-
S =
|
|
2173
|
+
S = l[_], E = i.GetAttributeByUniqueId(
|
|
2174
2174
|
f,
|
|
2175
2175
|
S
|
|
2176
2176
|
);
|
|
2177
2177
|
else {
|
|
2178
|
-
if (S =
|
|
2178
|
+
if (S = i.GetAttributeId(
|
|
2179
2179
|
f,
|
|
2180
|
-
s[
|
|
2180
|
+
s[l[_]]
|
|
2181
2181
|
), S === -1) continue;
|
|
2182
|
-
E =
|
|
2182
|
+
E = i.GetAttribute(f, S);
|
|
2183
2183
|
}
|
|
2184
|
-
const
|
|
2184
|
+
const R = n(
|
|
2185
2185
|
s,
|
|
2186
|
-
|
|
2186
|
+
i,
|
|
2187
2187
|
f,
|
|
2188
|
+
_,
|
|
2188
2189
|
y,
|
|
2189
|
-
x,
|
|
2190
2190
|
E
|
|
2191
2191
|
);
|
|
2192
|
-
|
|
2192
|
+
_ === "color" && (R.vertexColorSpace = c.vertexColorSpace), w.attributes.push(R);
|
|
2193
2193
|
}
|
|
2194
|
-
return T === s.TRIANGULAR_MESH && (
|
|
2194
|
+
return T === s.TRIANGULAR_MESH && (w.index = r(s, i, f)), s.destroy(f), w;
|
|
2195
2195
|
}
|
|
2196
|
-
function r(s,
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
const
|
|
2196
|
+
function r(s, i, a) {
|
|
2197
|
+
const l = a.num_faces() * 3, u = l * 4, f = s._malloc(u);
|
|
2198
|
+
i.GetTrianglesUInt32Array(a, u, f);
|
|
2199
|
+
const p = new Uint32Array(
|
|
2200
2200
|
s.HEAPF32.buffer,
|
|
2201
2201
|
f,
|
|
2202
|
-
|
|
2202
|
+
l
|
|
2203
2203
|
).slice();
|
|
2204
|
-
return s._free(f), { array:
|
|
2205
|
-
}
|
|
2206
|
-
function n(s,
|
|
2207
|
-
const f =
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2204
|
+
return s._free(f), { array: p, itemSize: 1 };
|
|
2205
|
+
}
|
|
2206
|
+
function n(s, i, a, c, l, u) {
|
|
2207
|
+
const f = u.num_components(), T = a.num_points() * f, w = T * l.BYTES_PER_ELEMENT, _ = o(s, l), y = s._malloc(w);
|
|
2208
|
+
i.GetAttributeDataArrayForAllPoints(
|
|
2209
|
+
a,
|
|
2210
|
+
u,
|
|
2211
|
+
_,
|
|
2212
|
+
w,
|
|
2213
|
+
y
|
|
2214
2214
|
);
|
|
2215
|
-
const E = new
|
|
2215
|
+
const E = new l(
|
|
2216
2216
|
s.HEAPF32.buffer,
|
|
2217
|
-
|
|
2217
|
+
y,
|
|
2218
2218
|
T
|
|
2219
2219
|
).slice();
|
|
2220
|
-
return s._free(
|
|
2220
|
+
return s._free(y), {
|
|
2221
2221
|
name: c,
|
|
2222
2222
|
array: E,
|
|
2223
2223
|
itemSize: f
|
|
2224
2224
|
};
|
|
2225
2225
|
}
|
|
2226
|
-
function o(s,
|
|
2227
|
-
switch (
|
|
2226
|
+
function o(s, i) {
|
|
2227
|
+
switch (i) {
|
|
2228
2228
|
case Float32Array:
|
|
2229
2229
|
return s.DT_FLOAT32;
|
|
2230
2230
|
case Int8Array:
|
|
@@ -2242,7 +2242,7 @@ function ln() {
|
|
|
2242
2242
|
}
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
|
-
const
|
|
2245
|
+
const oe = {
|
|
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 () => {
|
|
@@ -2250,30 +2250,30 @@ const re = {
|
|
|
2250
2250
|
return await (await fetch(d)).arrayBuffer();
|
|
2251
2251
|
}
|
|
2252
2252
|
};
|
|
2253
|
-
class
|
|
2253
|
+
class dn extends ln {
|
|
2254
2254
|
constructor() {
|
|
2255
2255
|
super(...arguments);
|
|
2256
|
-
|
|
2257
|
-
|
|
2256
|
+
O(this, "decoderPending", null);
|
|
2257
|
+
O(this, "decoderConfig", {
|
|
2258
2258
|
type: "js",
|
|
2259
2259
|
wasmBinary: null
|
|
2260
2260
|
});
|
|
2261
|
-
|
|
2261
|
+
O(this, "workerSourceURL", "");
|
|
2262
2262
|
}
|
|
2263
2263
|
async _initDecoder() {
|
|
2264
2264
|
if (this.decoderPending) return this.decoderPending;
|
|
2265
2265
|
const t = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
|
|
2266
2266
|
return t ? r.push(
|
|
2267
|
-
|
|
2267
|
+
oe.LOAD_DRACO_JS_DECODER()
|
|
2268
2268
|
) : (r.push(
|
|
2269
|
-
|
|
2269
|
+
oe.LOAD_DRACO_WASM_WRAPPER()
|
|
2270
2270
|
), r.push(
|
|
2271
|
-
|
|
2271
|
+
oe.LOAD_DRACO_WASM_DECODER()
|
|
2272
2272
|
)), this.decoderPending = Promise.all(r).then(
|
|
2273
2273
|
(n) => {
|
|
2274
2274
|
const o = n[0];
|
|
2275
2275
|
t || (this.decoderConfig.wasmBinary = n[1]);
|
|
2276
|
-
const s =
|
|
2276
|
+
const s = fn.toString(), i = [
|
|
2277
2277
|
"/* draco decoder */",
|
|
2278
2278
|
o,
|
|
2279
2279
|
"",
|
|
@@ -2281,35 +2281,233 @@ class fn extends cn {
|
|
|
2281
2281
|
s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"))
|
|
2282
2282
|
].join(`
|
|
2283
2283
|
`);
|
|
2284
|
-
this.workerSourceURL = URL.createObjectURL(new Blob([
|
|
2284
|
+
this.workerSourceURL = URL.createObjectURL(new Blob([i]));
|
|
2285
2285
|
}
|
|
2286
2286
|
), this.decoderPending;
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
|
-
|
|
2289
|
+
function hn() {
|
|
2290
|
+
let d = null, e = null;
|
|
2291
|
+
const t = [
|
|
2292
|
+
[
|
|
2293
|
+
/'CONFIG_CONTROL_DESIGN'\s*\)/g,
|
|
2294
|
+
"'AP203_CONFIGURATION_CONTROLLED_3D_DESIGN_OF_MECHANICAL_PARTS_AND_ASSEMBLIES_MIM_LF')"
|
|
2295
|
+
],
|
|
2296
|
+
[
|
|
2297
|
+
/'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF\.\s*\{[\s\S]*?\}\s*'/g,
|
|
2298
|
+
"'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'"
|
|
2299
|
+
]
|
|
2300
|
+
];
|
|
2301
|
+
function r() {
|
|
2302
|
+
return d || (d = occtimportjs({
|
|
2303
|
+
// eslint-disable-line no-undef
|
|
2304
|
+
locateFile: function() {
|
|
2305
|
+
return e;
|
|
2306
|
+
}
|
|
2307
|
+
})), d;
|
|
2308
|
+
}
|
|
2309
|
+
function n(s) {
|
|
2310
|
+
for (var i = new TextDecoder("utf-8", { fatal: !1 }), a = new TextEncoder(), c = i.decode(s), l = 0; l < t.length; l++) {
|
|
2311
|
+
var u = t[l][0], f = t[l][1];
|
|
2312
|
+
c = c.replace(u, f);
|
|
2313
|
+
}
|
|
2314
|
+
return new Uint8Array(a.encode(c));
|
|
2315
|
+
}
|
|
2316
|
+
function o(s, i) {
|
|
2317
|
+
var a = n(i);
|
|
2318
|
+
try {
|
|
2319
|
+
var c = s.ReadStepFile(a, null);
|
|
2320
|
+
if (c.success && c.root) return c;
|
|
2321
|
+
} catch {
|
|
2322
|
+
}
|
|
2323
|
+
try {
|
|
2324
|
+
return s.ReadStepFile(i, null);
|
|
2325
|
+
} catch {
|
|
2326
|
+
return {
|
|
2327
|
+
success: !1,
|
|
2328
|
+
root: { meshes: [], children: [] },
|
|
2329
|
+
meshes: []
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
onmessage = async function(s) {
|
|
2334
|
+
var i = s.data;
|
|
2335
|
+
switch (i.type) {
|
|
2336
|
+
case "init":
|
|
2337
|
+
e = i.wasmUrl;
|
|
2338
|
+
break;
|
|
2339
|
+
case "parse":
|
|
2340
|
+
try {
|
|
2341
|
+
var a = await r(), c = new Uint8Array(i.buffer), l = i.fileType, u;
|
|
2342
|
+
if (l === "step" || l === "stp" ? u = o(a, c) : u = a.ReadIgesFile(c, null), !u.success || !u.root) {
|
|
2343
|
+
self.postMessage({
|
|
2344
|
+
type: "error",
|
|
2345
|
+
id: i.id,
|
|
2346
|
+
error: "Failed to parse CAD file"
|
|
2347
|
+
});
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
self.postMessage({
|
|
2351
|
+
type: "result",
|
|
2352
|
+
id: i.id,
|
|
2353
|
+
result: u
|
|
2354
|
+
});
|
|
2355
|
+
} catch (f) {
|
|
2356
|
+
self.postMessage({
|
|
2357
|
+
type: "error",
|
|
2358
|
+
id: i.id,
|
|
2359
|
+
error: f instanceof Error ? f.message : String(f)
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
break;
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
const Me = {
|
|
2367
|
+
LOAD_OCCT_JS: async () => (await import("./occt-import-js-D-bjjBtk.mjs")).default,
|
|
2368
|
+
LOAD_OCCT_WASM_URL: async () => (await import("./occt-import-js-ekuHaP1Z.mjs")).default
|
|
2369
|
+
};
|
|
2370
|
+
class pn {
|
|
2371
|
+
constructor() {
|
|
2372
|
+
O(this, "_workerPending", null);
|
|
2373
|
+
O(this, "_worker", null);
|
|
2374
|
+
O(this, "_nextId", 0);
|
|
2375
|
+
O(this, "_pending", /* @__PURE__ */ new Map());
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Create (or return existing) blob-URL worker.
|
|
2379
|
+
* Loads occt-import-js JS as raw text, concatenates with STEPWorker
|
|
2380
|
+
* function body, and creates a classic (non-module) worker.
|
|
2381
|
+
*/
|
|
2382
|
+
_getWorker() {
|
|
2383
|
+
return this._workerPending ? this._workerPending : (this._workerPending = (async () => {
|
|
2384
|
+
const [
|
|
2385
|
+
e,
|
|
2386
|
+
t
|
|
2387
|
+
] = await Promise.all([
|
|
2388
|
+
Me.LOAD_OCCT_JS(),
|
|
2389
|
+
Me.LOAD_OCCT_WASM_URL()
|
|
2390
|
+
]), r = hn.toString(), n = [
|
|
2391
|
+
"/* occt-import-js */",
|
|
2392
|
+
e,
|
|
2393
|
+
"",
|
|
2394
|
+
"/* step worker */",
|
|
2395
|
+
r.substring(r.indexOf("{") + 1, r.lastIndexOf("}"))
|
|
2396
|
+
].join(`
|
|
2397
|
+
`), o = URL.createObjectURL(new Blob([n])), s = new Worker(o), i = new URL(t, window.location.href).href;
|
|
2398
|
+
return s.postMessage({ type: "init", wasmUrl: i }), s.onmessage = (a) => {
|
|
2399
|
+
const { type: c, id: l, result: u, error: f } = a.data, p = this._pending.get(l);
|
|
2400
|
+
if (p)
|
|
2401
|
+
if (this._pending.delete(l), c === "result")
|
|
2402
|
+
try {
|
|
2403
|
+
p.resolve(this._buildScene(u));
|
|
2404
|
+
} catch (T) {
|
|
2405
|
+
p.reject(
|
|
2406
|
+
T instanceof Error ? T : new Error(String(T))
|
|
2407
|
+
);
|
|
2408
|
+
}
|
|
2409
|
+
else
|
|
2410
|
+
p.reject(new Error(f ?? "Worker error"));
|
|
2411
|
+
}, s.onerror = (a) => {
|
|
2412
|
+
for (const [
|
|
2413
|
+
,
|
|
2414
|
+
{ reject: c }
|
|
2415
|
+
] of this._pending)
|
|
2416
|
+
c(new Error(a.message ?? "Worker error"));
|
|
2417
|
+
this._pending.clear();
|
|
2418
|
+
}, this._worker = s, s;
|
|
2419
|
+
})(), this._workerPending);
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* Parse STEP or IGES file content and return a Three.js Object3D
|
|
2423
|
+
*/
|
|
2424
|
+
async parseAsync(e, t) {
|
|
2425
|
+
const r = this._nextId++, n = await this._getWorker();
|
|
2426
|
+
return new Promise((o, s) => {
|
|
2427
|
+
this._pending.set(r, { resolve: o, reject: s });
|
|
2428
|
+
const i = e.slice(0);
|
|
2429
|
+
n.postMessage({ type: "parse", id: r, buffer: i, fileType: t }, [
|
|
2430
|
+
i
|
|
2431
|
+
]);
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Dispose the worker. Call when the loader is no longer needed.
|
|
2436
|
+
*/
|
|
2437
|
+
dispose() {
|
|
2438
|
+
if (this._worker) {
|
|
2439
|
+
for (const [
|
|
2440
|
+
,
|
|
2441
|
+
{ reject: e }
|
|
2442
|
+
] of this._pending)
|
|
2443
|
+
e(new Error("STEPLoader disposed"));
|
|
2444
|
+
this._pending.clear(), this._worker.terminate(), this._worker = null, this._workerPending = null;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
_buildScene(e) {
|
|
2448
|
+
const t = new B();
|
|
2449
|
+
return t.name = e.root.name ?? "CAD Model", this._buildNode(e.root, e.meshes, t), t.rotation.x = -Math.PI / 2, t.rotation.z = Math.PI / 2, t;
|
|
2450
|
+
}
|
|
2451
|
+
_buildNode(e, t, r) {
|
|
2452
|
+
const n = new B();
|
|
2453
|
+
n.name = e.name ?? "Part";
|
|
2454
|
+
for (const o of e.meshes) {
|
|
2455
|
+
const s = t[o];
|
|
2456
|
+
if (s != null && s.attributes) {
|
|
2457
|
+
const i = this._createMesh(s);
|
|
2458
|
+
n.add(i);
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
for (const o of e.children)
|
|
2462
|
+
this._buildNode(o, t, n);
|
|
2463
|
+
r.add(n);
|
|
2464
|
+
}
|
|
2465
|
+
_createMesh(e) {
|
|
2466
|
+
var c, l;
|
|
2467
|
+
const { position: t, normal: r } = e.attributes, n = e.index ?? e.attributes.index, o = new Z();
|
|
2468
|
+
o.setAttribute(
|
|
2469
|
+
"position",
|
|
2470
|
+
new N(new Float32Array(t.array), 3)
|
|
2471
|
+
), (c = r == null ? void 0 : r.array) != null && c.length ? o.setAttribute(
|
|
2472
|
+
"normal",
|
|
2473
|
+
new N(new Float32Array(r.array), 3)
|
|
2474
|
+
) : o.computeVertexNormals(), (l = n == null ? void 0 : n.array) != null && l.length && o.setIndex(
|
|
2475
|
+
new N(new Uint32Array(n.array), 1)
|
|
2476
|
+
);
|
|
2477
|
+
const s = e.color, i = new fe({
|
|
2478
|
+
metalness: 0.3,
|
|
2479
|
+
roughness: 0.6
|
|
2480
|
+
});
|
|
2481
|
+
s && s.length >= 3 ? i.color.setRGB(s[0], s[1], s[2]) : i.color.setHex(13421772);
|
|
2482
|
+
const a = new de(o, i);
|
|
2483
|
+
return a.name = e.name ?? "Mesh", a.castShadow = !0, a.receiveShadow = !0, a;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
class Rn {
|
|
2290
2487
|
constructor() {
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2488
|
+
O(this, "_gltfLoader");
|
|
2489
|
+
O(this, "_usdzLoader");
|
|
2490
|
+
O(this, "_stepLoader");
|
|
2491
|
+
const e = new dn();
|
|
2492
|
+
e.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new bt(), this._gltfLoader.setDRACOLoader(e), this._usdzLoader = new cn(), this._stepLoader = new pn();
|
|
2295
2493
|
}
|
|
2296
2494
|
async load(e, t) {
|
|
2297
2495
|
let r;
|
|
2298
2496
|
if (t)
|
|
2299
2497
|
r = t;
|
|
2300
|
-
else if (r =
|
|
2301
|
-
throw new
|
|
2498
|
+
else if (r = Et(e), r.length === 0 && (r = await this._detectFileTypeFromContent(e), r.length === 0))
|
|
2499
|
+
throw new we(
|
|
2302
2500
|
"No file extension found in URI",
|
|
2303
2501
|
""
|
|
2304
2502
|
);
|
|
2305
|
-
if (!
|
|
2306
|
-
throw new
|
|
2307
|
-
`Unsupported file type: ${r}. Supported types: ${
|
|
2503
|
+
if (!St(r))
|
|
2504
|
+
throw new we(
|
|
2505
|
+
`Unsupported file type: ${r}. Supported types: ${xt.join(", ")}`,
|
|
2308
2506
|
r
|
|
2309
2507
|
);
|
|
2310
2508
|
const n = q.read(e);
|
|
2311
2509
|
if (n)
|
|
2312
|
-
return n.arrayBuffer ? this._parse(n.arrayBuffer, r) : n.promise.then((
|
|
2510
|
+
return n.arrayBuffer ? this._parse(n.arrayBuffer, r) : n.promise.then((i) => this._parse(i, r));
|
|
2313
2511
|
const s = await q.create(e).load();
|
|
2314
2512
|
return this._parse(s, r);
|
|
2315
2513
|
}
|
|
@@ -2331,7 +2529,9 @@ class yn {
|
|
|
2331
2529
|
n[3]
|
|
2332
2530
|
) === "glTF" ? n[12] === 0 ? "glb" : "gltf" : n.length >= 4 && n[0] === 80 && // 'P'
|
|
2333
2531
|
n[1] === 75 && // 'K'
|
|
2334
|
-
(n[2] === 3 || n[2] === 5) && (n[3] === 4 || n[3] === 6) ? "usdz" : ""
|
|
2532
|
+
(n[2] === 3 || n[2] === 5) && (n[3] === 4 || n[3] === 6) ? "usdz" : n.length >= 20 && new TextDecoder("ascii").decode(
|
|
2533
|
+
n.subarray(0, 20)
|
|
2534
|
+
).startsWith("ISO-10303-21") ? "step" : n.length >= 80 && n[72] === 83 ? "iges" : "";
|
|
2335
2535
|
} catch {
|
|
2336
2536
|
return "";
|
|
2337
2537
|
}
|
|
@@ -2352,18 +2552,30 @@ class yn {
|
|
|
2352
2552
|
""
|
|
2353
2553
|
)).scene;
|
|
2354
2554
|
case "usdz":
|
|
2355
|
-
return
|
|
2555
|
+
return this._usdzLoader.parse(e);
|
|
2556
|
+
case "step":
|
|
2557
|
+
case "stp":
|
|
2558
|
+
return await this._stepLoader.parseAsync(
|
|
2559
|
+
e,
|
|
2560
|
+
t
|
|
2561
|
+
);
|
|
2562
|
+
case "iges":
|
|
2563
|
+
case "igs":
|
|
2564
|
+
return await this._stepLoader.parseAsync(
|
|
2565
|
+
e,
|
|
2566
|
+
t
|
|
2567
|
+
);
|
|
2356
2568
|
}
|
|
2357
2569
|
} catch (r) {
|
|
2358
|
-
throw r instanceof Error ? new
|
|
2570
|
+
throw r instanceof Error ? new Re(
|
|
2359
2571
|
`Failed to parse ${t} file: ${r.message}`,
|
|
2360
2572
|
r
|
|
2361
|
-
) : new
|
|
2573
|
+
) : new Re(`Failed to parse ${t} file`);
|
|
2362
2574
|
}
|
|
2363
2575
|
}
|
|
2364
2576
|
}
|
|
2365
2577
|
export {
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2578
|
+
Rn as A,
|
|
2579
|
+
dn as D,
|
|
2580
|
+
fn as a
|
|
2369
2581
|
};
|