@shopware-ag/dive 1.18.5-beta.2 → 1.18.5-beta.3
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/AR-BzVanQ-t.js +722 -0
- package/build/AR-BzVanQ-t.js.map +1 -0
- package/build/AR-ySzrfSW3.cjs +2 -0
- package/build/AR-ySzrfSW3.cjs.map +1 -0
- package/build/IO-BTWL9Zfp.cjs +19 -0
- package/build/IO-BTWL9Zfp.cjs.map +1 -0
- package/build/{IO-BgiJzKrU.js → IO-CYzpSt1J.js} +257 -225
- package/build/IO-CYzpSt1J.js.map +1 -0
- package/build/{MediaCreator-4zmvmUWH.js → MediaCreator-BFa3Xfwk.js} +2 -2
- package/build/{MediaCreator-4zmvmUWH.js.map → MediaCreator-BFa3Xfwk.js.map} +1 -1
- package/build/{MediaCreator-BNxZVYyZ.cjs → MediaCreator-BqLcaXbl.cjs} +2 -2
- package/build/{MediaCreator-BNxZVYyZ.cjs.map → MediaCreator-BqLcaXbl.cjs.map} +1 -1
- package/build/{dive-_-yiZbhn.cjs → dive-BTQZqHRt.cjs} +3 -3
- package/build/{dive-_-yiZbhn.cjs.map → dive-BTQZqHRt.cjs.map} +1 -1
- package/build/{dive-Mi8g8Khn.js → dive-Dk0rFfvA.js} +35 -35
- package/build/{dive-Mi8g8Khn.js.map → dive-Dk0rFfvA.js.map} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.js +1 -1
- package/build/src/ar/arquicklook/ARQuickLook.d.ts +2 -3
- package/package.json +1 -1
- package/src/ar/arquicklook/ARQuickLook.ts +75 -48
- package/src/ar/arquicklook/__test__/ARQuickLook.test.ts +45 -80
- package/src/ar/sceneviewer/__test__/SceneViewer.test.ts +0 -12
- package/build/AR-B-g0updz.js +0 -1450
- package/build/AR-B-g0updz.js.map +0 -1
- package/build/AR-BWQebw6-.cjs +0 -153
- package/build/AR-BWQebw6-.cjs.map +0 -1
- package/build/IO-BgiJzKrU.js.map +0 -1
- package/build/IO-CuYml7Y5.cjs +0 -2
- package/build/IO-CuYml7Y5.cjs.map +0 -1
- package/build/TextureUtils-CxpuVgwF.js +0 -38
- package/build/TextureUtils-CxpuVgwF.js.map +0 -1
- package/build/TextureUtils-DNG-yR77.cjs +0 -19
- package/build/TextureUtils-DNG-yR77.cjs.map +0 -1
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { P as oe, S as ae, U as ce, a as te, M as le, b as ue, c as K, W as fe, C as he, d as pe, e as ne, V as G, Q as de, B as L, f as k, g as xe, N as ge, h as W, R as Te, i as me, j as P, I as Me, k as ye, l as we, m as Ee, L as Ie, n as Ae, o as Re, p as be, q as Ne, r as Le, s as Se, G as _e } from "./dive-Dk0rFfvA.js";
|
|
2
|
+
let F, H, _, B;
|
|
3
|
+
function V(a, e = 1 / 0, s = null) {
|
|
4
|
+
H || (H = new oe(2, 2, 1, 1)), _ || (_ = new ae({
|
|
5
|
+
uniforms: { blitTexture: new ce(a) },
|
|
6
|
+
vertexShader: `
|
|
7
|
+
varying vec2 vUv;
|
|
8
|
+
void main(){
|
|
9
|
+
vUv = uv;
|
|
10
|
+
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
11
|
+
}`,
|
|
12
|
+
fragmentShader: `
|
|
13
|
+
uniform sampler2D blitTexture;
|
|
14
|
+
varying vec2 vUv;
|
|
15
|
+
|
|
16
|
+
void main(){
|
|
17
|
+
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
18
|
+
|
|
19
|
+
#ifdef IS_SRGB
|
|
20
|
+
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
|
|
21
|
+
#else
|
|
22
|
+
gl_FragColor = texture2D( blitTexture, vUv);
|
|
23
|
+
#endif
|
|
24
|
+
}`
|
|
25
|
+
})), _.uniforms.blitTexture.value = a, _.defines.IS_SRGB = a.colorSpace == te, _.needsUpdate = !0, B || (B = new le(H, _), B.frustumCulled = !1);
|
|
26
|
+
const n = new ue(), t = new K();
|
|
27
|
+
t.add(B), s === null && (s = F = new fe({ antialias: !1 }));
|
|
28
|
+
const i = Math.min(a.image.width, e), r = Math.min(a.image.height, e);
|
|
29
|
+
s.setSize(i, r), s.clear(), s.render(t, n);
|
|
30
|
+
const o = document.createElement("canvas"), c = o.getContext("2d");
|
|
31
|
+
o.width = i, o.height = r, c.drawImage(s.domElement, 0, 0, i, r);
|
|
32
|
+
const l = new he(o);
|
|
33
|
+
return l.minFilter = a.minFilter, l.magFilter = a.magFilter, l.wrapS = a.wrapS, l.wrapT = a.wrapT, l.name = a.name, F && (F.forceContextLoss(), F.dispose(), F = null), l;
|
|
34
|
+
}
|
|
35
|
+
const J = {
|
|
4
36
|
POSITION: [
|
|
5
37
|
"byte",
|
|
6
38
|
"byte normalized",
|
|
@@ -28,34 +60,34 @@ const K = {
|
|
|
28
60
|
"unsigned short"
|
|
29
61
|
]
|
|
30
62
|
};
|
|
31
|
-
class
|
|
63
|
+
class q {
|
|
32
64
|
constructor() {
|
|
33
65
|
this.pluginCallbacks = [], this.register(function(e) {
|
|
34
|
-
return new
|
|
66
|
+
return new ze(e);
|
|
35
67
|
}), this.register(function(e) {
|
|
36
|
-
return new
|
|
68
|
+
return new ke(e);
|
|
37
69
|
}), this.register(function(e) {
|
|
38
|
-
return new
|
|
70
|
+
return new je(e);
|
|
39
71
|
}), this.register(function(e) {
|
|
40
|
-
return new
|
|
72
|
+
return new Ye(e);
|
|
41
73
|
}), this.register(function(e) {
|
|
42
|
-
return new
|
|
74
|
+
return new Ke(e);
|
|
43
75
|
}), this.register(function(e) {
|
|
44
|
-
return new
|
|
76
|
+
return new We(e);
|
|
45
77
|
}), this.register(function(e) {
|
|
46
|
-
return new
|
|
78
|
+
return new He(e);
|
|
47
79
|
}), this.register(function(e) {
|
|
48
|
-
return new
|
|
80
|
+
return new Ve(e);
|
|
49
81
|
}), this.register(function(e) {
|
|
50
|
-
return new
|
|
82
|
+
return new qe(e);
|
|
51
83
|
}), this.register(function(e) {
|
|
52
|
-
return new
|
|
84
|
+
return new Xe(e);
|
|
53
85
|
}), this.register(function(e) {
|
|
54
|
-
return new
|
|
86
|
+
return new Je(e);
|
|
55
87
|
}), this.register(function(e) {
|
|
56
|
-
return new
|
|
88
|
+
return new Qe(e);
|
|
57
89
|
}), this.register(function(e) {
|
|
58
|
-
return new
|
|
90
|
+
return new Ze(e);
|
|
59
91
|
});
|
|
60
92
|
}
|
|
61
93
|
register(e) {
|
|
@@ -72,8 +104,8 @@ class V {
|
|
|
72
104
|
* @param {Object} options options
|
|
73
105
|
*/
|
|
74
106
|
parse(e, s, n, t) {
|
|
75
|
-
const i = new
|
|
76
|
-
for (let o = 0,
|
|
107
|
+
const i = new Pe(), r = [];
|
|
108
|
+
for (let o = 0, c = this.pluginCallbacks.length; o < c; o++)
|
|
77
109
|
r.push(this.pluginCallbacks[o](i));
|
|
78
110
|
i.setPlugins(r), i.write(e, s, t).catch(n);
|
|
79
111
|
}
|
|
@@ -108,72 +140,72 @@ const T = {
|
|
|
108
140
|
CLAMP_TO_EDGE: 33071,
|
|
109
141
|
MIRRORED_REPEAT: 33648,
|
|
110
142
|
REPEAT: 10497
|
|
111
|
-
},
|
|
112
|
-
R[
|
|
113
|
-
R[
|
|
114
|
-
R[
|
|
115
|
-
R[
|
|
116
|
-
R[
|
|
117
|
-
R[
|
|
118
|
-
R[
|
|
119
|
-
R[
|
|
120
|
-
R[
|
|
121
|
-
const
|
|
143
|
+
}, j = "KHR_mesh_quantization", R = {};
|
|
144
|
+
R[ye] = T.NEAREST;
|
|
145
|
+
R[we] = T.NEAREST_MIPMAP_NEAREST;
|
|
146
|
+
R[Ee] = T.NEAREST_MIPMAP_LINEAR;
|
|
147
|
+
R[Ie] = T.LINEAR;
|
|
148
|
+
R[Ae] = T.LINEAR_MIPMAP_NEAREST;
|
|
149
|
+
R[Re] = T.LINEAR_MIPMAP_LINEAR;
|
|
150
|
+
R[be] = T.CLAMP_TO_EDGE;
|
|
151
|
+
R[Ne] = T.REPEAT;
|
|
152
|
+
R[Le] = T.MIRRORED_REPEAT;
|
|
153
|
+
const Q = {
|
|
122
154
|
scale: "scale",
|
|
123
155
|
position: "translation",
|
|
124
156
|
quaternion: "rotation",
|
|
125
157
|
morphTargetInfluences: "weights"
|
|
126
|
-
},
|
|
127
|
-
function
|
|
128
|
-
return
|
|
158
|
+
}, Ce = new pe(), Z = 12, Ue = 1179937895, ve = 2, $ = 8, Fe = 1313821514, Oe = 5130562;
|
|
159
|
+
function O(a, e) {
|
|
160
|
+
return a.length === e.length && a.every(function(s, n) {
|
|
129
161
|
return s === e[n];
|
|
130
162
|
});
|
|
131
163
|
}
|
|
132
|
-
function
|
|
133
|
-
return new TextEncoder().encode(
|
|
164
|
+
function De(a) {
|
|
165
|
+
return new TextEncoder().encode(a).buffer;
|
|
134
166
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
167
|
+
function Be(a) {
|
|
168
|
+
return O(a.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
137
169
|
}
|
|
138
|
-
function
|
|
170
|
+
function Ge(a, e, s) {
|
|
139
171
|
const n = {
|
|
140
|
-
min: new Array(
|
|
141
|
-
max: new Array(
|
|
172
|
+
min: new Array(a.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
173
|
+
max: new Array(a.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
142
174
|
};
|
|
143
175
|
for (let t = e; t < e + s; t++)
|
|
144
|
-
for (let i = 0; i <
|
|
176
|
+
for (let i = 0; i < a.itemSize; i++) {
|
|
145
177
|
let r;
|
|
146
|
-
|
|
178
|
+
a.itemSize > 4 ? r = a.array[t * a.itemSize + i] : (i === 0 ? r = a.getX(t) : i === 1 ? r = a.getY(t) : i === 2 ? r = a.getZ(t) : i === 3 && (r = a.getW(t)), a.normalized === !0 && (r = W.normalize(r, a.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
|
|
147
179
|
}
|
|
148
180
|
return n;
|
|
149
181
|
}
|
|
150
|
-
function
|
|
151
|
-
return Math.ceil(
|
|
182
|
+
function re(a) {
|
|
183
|
+
return Math.ceil(a / 4) * 4;
|
|
152
184
|
}
|
|
153
|
-
function
|
|
154
|
-
const s =
|
|
155
|
-
if (s !==
|
|
185
|
+
function Y(a, e = 0) {
|
|
186
|
+
const s = re(a.byteLength);
|
|
187
|
+
if (s !== a.byteLength) {
|
|
156
188
|
const n = new Uint8Array(s);
|
|
157
|
-
if (n.set(new Uint8Array(
|
|
158
|
-
for (let t =
|
|
189
|
+
if (n.set(new Uint8Array(a)), e !== 0)
|
|
190
|
+
for (let t = a.byteLength; t < s; t++)
|
|
159
191
|
n[t] = e;
|
|
160
192
|
return n.buffer;
|
|
161
193
|
}
|
|
162
|
-
return
|
|
194
|
+
return a;
|
|
163
195
|
}
|
|
164
|
-
function
|
|
196
|
+
function ee() {
|
|
165
197
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
166
198
|
}
|
|
167
|
-
function
|
|
168
|
-
if (
|
|
169
|
-
return new Promise((n) =>
|
|
199
|
+
function se(a, e) {
|
|
200
|
+
if (a.toBlob !== void 0)
|
|
201
|
+
return new Promise((n) => a.toBlob(n, e));
|
|
170
202
|
let s;
|
|
171
|
-
return e === "image/jpeg" ? s = 0.92 : e === "image/webp" && (s = 0.8),
|
|
203
|
+
return e === "image/jpeg" ? s = 0.92 : e === "image/webp" && (s = 0.8), a.convertToBlob({
|
|
172
204
|
type: e,
|
|
173
205
|
quality: s
|
|
174
206
|
});
|
|
175
207
|
}
|
|
176
|
-
class
|
|
208
|
+
class Pe {
|
|
177
209
|
constructor() {
|
|
178
210
|
this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
|
|
179
211
|
asset: {
|
|
@@ -210,24 +242,24 @@ class Le {
|
|
|
210
242
|
}, n), this.options.animations.length > 0 && (this.options.trs = !0), this.processInput(e), await Promise.all(this.pending);
|
|
211
243
|
const t = this, i = t.buffers, r = t.json;
|
|
212
244
|
n = t.options;
|
|
213
|
-
const o = t.extensionsUsed,
|
|
214
|
-
if (
|
|
245
|
+
const o = t.extensionsUsed, c = t.extensionsRequired, l = new Blob(i, { type: "application/octet-stream" }), h = Object.keys(o), u = Object.keys(c);
|
|
246
|
+
if (h.length > 0 && (r.extensionsUsed = h), u.length > 0 && (r.extensionsRequired = u), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = l.size), n.binary === !0) {
|
|
215
247
|
const m = new FileReader();
|
|
216
248
|
m.readAsArrayBuffer(l), m.onloadend = function() {
|
|
217
|
-
const
|
|
218
|
-
p.setUint32(0,
|
|
219
|
-
const d =
|
|
220
|
-
g.setUint32(0, d.byteLength, !0), g.setUint32(4,
|
|
221
|
-
const y = new ArrayBuffer(
|
|
222
|
-
b.setUint32(0,
|
|
223
|
-
const
|
|
224
|
-
b.setUint32(8,
|
|
249
|
+
const f = Y(m.result), p = new DataView(new ArrayBuffer($));
|
|
250
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Oe, !0);
|
|
251
|
+
const d = Y(De(JSON.stringify(r)), 32), g = new DataView(new ArrayBuffer($));
|
|
252
|
+
g.setUint32(0, d.byteLength, !0), g.setUint32(4, Fe, !0);
|
|
253
|
+
const y = new ArrayBuffer(Z), b = new DataView(y);
|
|
254
|
+
b.setUint32(0, Ue, !0), b.setUint32(4, ve, !0);
|
|
255
|
+
const D = Z + g.byteLength + d.byteLength + p.byteLength + f.byteLength;
|
|
256
|
+
b.setUint32(8, D, !0);
|
|
225
257
|
const x = new Blob([
|
|
226
258
|
y,
|
|
227
259
|
g,
|
|
228
260
|
d,
|
|
229
261
|
p,
|
|
230
|
-
|
|
262
|
+
f
|
|
231
263
|
], { type: "application/octet-stream" }), M = new FileReader();
|
|
232
264
|
M.readAsArrayBuffer(x), M.onloadend = function() {
|
|
233
265
|
s(M.result);
|
|
@@ -236,8 +268,8 @@ class Le {
|
|
|
236
268
|
} else if (r.buffers && r.buffers.length > 0) {
|
|
237
269
|
const m = new FileReader();
|
|
238
270
|
m.readAsDataURL(l), m.onloadend = function() {
|
|
239
|
-
const
|
|
240
|
-
r.buffers[0].uri =
|
|
271
|
+
const f = m.result;
|
|
272
|
+
r.buffers[0].uri = f, s(r);
|
|
241
273
|
};
|
|
242
274
|
} else
|
|
243
275
|
s(r);
|
|
@@ -284,7 +316,7 @@ class Le {
|
|
|
284
316
|
*/
|
|
285
317
|
isNormalizedNormalAttribute(e) {
|
|
286
318
|
if (this.cache.attributesNormalized.has(e)) return !1;
|
|
287
|
-
const n = new
|
|
319
|
+
const n = new G();
|
|
288
320
|
for (let t = 0, i = e.count; t < i; t++)
|
|
289
321
|
if (Math.abs(n.fromBufferAttribute(e, t).length() - 1) > 5e-4) return !1;
|
|
290
322
|
return !0;
|
|
@@ -299,7 +331,7 @@ class Le {
|
|
|
299
331
|
createNormalizedNormalAttribute(e) {
|
|
300
332
|
const s = this.cache;
|
|
301
333
|
if (s.attributesNormalized.has(e)) return s.attributesNormalized.get(e);
|
|
302
|
-
const n = e.clone(), t = new
|
|
334
|
+
const n = e.clone(), t = new G();
|
|
303
335
|
for (let i = 0, r = n.count; i < r; i++)
|
|
304
336
|
t.fromBufferAttribute(n, i), t.x === 0 && t.y === 0 && t.z === 0 ? t.setX(1) : t.normalize(), n.setXYZ(i, t.x, t.y, t.z);
|
|
305
337
|
return s.attributesNormalized.set(e, n), n;
|
|
@@ -318,34 +350,34 @@ class Le {
|
|
|
318
350
|
}
|
|
319
351
|
buildMetalRoughTexture(e, s) {
|
|
320
352
|
if (e === s) return e;
|
|
321
|
-
function n(
|
|
322
|
-
return
|
|
353
|
+
function n(f) {
|
|
354
|
+
return f.colorSpace === te ? function(d) {
|
|
323
355
|
return d < 0.04045 ? d * 0.0773993808 : Math.pow(d * 0.9478672986 + 0.0521327014, 2.4);
|
|
324
356
|
} : function(d) {
|
|
325
357
|
return d;
|
|
326
358
|
};
|
|
327
359
|
}
|
|
328
|
-
console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), e instanceof
|
|
329
|
-
const t = e ? e.image : null, i = s ? s.image : null, r = Math.max(t ? t.width : 0, i ? i.width : 0), o = Math.max(t ? t.height : 0, i ? i.height : 0),
|
|
330
|
-
|
|
331
|
-
const l =
|
|
360
|
+
console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), e instanceof k && (e = V(e)), s instanceof k && (s = V(s));
|
|
361
|
+
const t = e ? e.image : null, i = s ? s.image : null, r = Math.max(t ? t.width : 0, i ? i.width : 0), o = Math.max(t ? t.height : 0, i ? i.height : 0), c = ee();
|
|
362
|
+
c.width = r, c.height = o;
|
|
363
|
+
const l = c.getContext("2d");
|
|
332
364
|
l.fillStyle = "#00ffff", l.fillRect(0, 0, r, o);
|
|
333
|
-
const
|
|
365
|
+
const h = l.getImageData(0, 0, r, o);
|
|
334
366
|
if (t) {
|
|
335
367
|
l.drawImage(t, 0, 0, r, o);
|
|
336
|
-
const
|
|
368
|
+
const f = n(e), p = l.getImageData(0, 0, r, o).data;
|
|
337
369
|
for (let d = 2; d < p.length; d += 4)
|
|
338
|
-
|
|
370
|
+
h.data[d] = f(p[d] / 256) * 256;
|
|
339
371
|
}
|
|
340
372
|
if (i) {
|
|
341
373
|
l.drawImage(i, 0, 0, r, o);
|
|
342
|
-
const
|
|
374
|
+
const f = n(s), p = l.getImageData(0, 0, r, o).data;
|
|
343
375
|
for (let d = 1; d < p.length; d += 4)
|
|
344
|
-
|
|
376
|
+
h.data[d] = f(p[d] / 256) * 256;
|
|
345
377
|
}
|
|
346
|
-
l.putImageData(
|
|
378
|
+
l.putImageData(h, 0, 0);
|
|
347
379
|
const m = (e || s).clone();
|
|
348
|
-
return m.source = new
|
|
380
|
+
return m.source = new xe(c), m.colorSpace = ge, m.channel = (e || s).channel, e && s && e.channel !== s.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), m;
|
|
349
381
|
}
|
|
350
382
|
/**
|
|
351
383
|
* Process a buffer to append to the default one.
|
|
@@ -381,23 +413,23 @@ class Le {
|
|
|
381
413
|
default:
|
|
382
414
|
o = 4;
|
|
383
415
|
}
|
|
384
|
-
let
|
|
385
|
-
i === T.ARRAY_BUFFER && (
|
|
386
|
-
const l =
|
|
416
|
+
let c = e.itemSize * o;
|
|
417
|
+
i === T.ARRAY_BUFFER && (c = Math.ceil(c / 4) * 4);
|
|
418
|
+
const l = re(t * c), h = new DataView(new ArrayBuffer(l));
|
|
387
419
|
let u = 0;
|
|
388
420
|
for (let p = n; p < n + t; p++) {
|
|
389
421
|
for (let d = 0; d < e.itemSize; d++) {
|
|
390
422
|
let g;
|
|
391
|
-
e.itemSize > 4 ? g = e.array[p * e.itemSize + d] : (d === 0 ? g = e.getX(p) : d === 1 ? g = e.getY(p) : d === 2 ? g = e.getZ(p) : d === 3 && (g = e.getW(p)), e.normalized === !0 && (g =
|
|
423
|
+
e.itemSize > 4 ? g = e.array[p * e.itemSize + d] : (d === 0 ? g = e.getX(p) : d === 1 ? g = e.getY(p) : d === 2 ? g = e.getZ(p) : d === 3 && (g = e.getW(p)), e.normalized === !0 && (g = W.normalize(g, e.array))), s === T.FLOAT ? h.setFloat32(u, g, !0) : s === T.INT ? h.setInt32(u, g, !0) : s === T.UNSIGNED_INT ? h.setUint32(u, g, !0) : s === T.SHORT ? h.setInt16(u, g, !0) : s === T.UNSIGNED_SHORT ? h.setUint16(u, g, !0) : s === T.BYTE ? h.setInt8(u, g) : s === T.UNSIGNED_BYTE && h.setUint8(u, g), u += o;
|
|
392
424
|
}
|
|
393
|
-
u %
|
|
425
|
+
u % c !== 0 && (u += c - u % c);
|
|
394
426
|
}
|
|
395
427
|
const m = {
|
|
396
|
-
buffer: this.processBuffer(
|
|
428
|
+
buffer: this.processBuffer(h.buffer),
|
|
397
429
|
byteOffset: this.byteOffset,
|
|
398
430
|
byteLength: l
|
|
399
431
|
};
|
|
400
|
-
return i !== void 0 && (m.target = i), i === T.ARRAY_BUFFER && (m.byteStride =
|
|
432
|
+
return i !== void 0 && (m.target = i), i === T.ARRAY_BUFFER && (m.byteStride = c), this.byteOffset += l, r.bufferViews.push(m), {
|
|
401
433
|
id: r.bufferViews.length - 1,
|
|
402
434
|
byteLength: 0
|
|
403
435
|
};
|
|
@@ -412,7 +444,7 @@ class Le {
|
|
|
412
444
|
return n.bufferViews || (n.bufferViews = []), new Promise(function(t) {
|
|
413
445
|
const i = new FileReader();
|
|
414
446
|
i.readAsArrayBuffer(e), i.onloadend = function() {
|
|
415
|
-
const r =
|
|
447
|
+
const r = Y(i.result), o = {
|
|
416
448
|
buffer: s.processBuffer(r),
|
|
417
449
|
byteOffset: s.byteOffset,
|
|
418
450
|
byteLength: r.byteLength
|
|
@@ -456,16 +488,16 @@ class Le {
|
|
|
456
488
|
else
|
|
457
489
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + e.array.constructor.name);
|
|
458
490
|
if (n === void 0 && (n = 0), (t === void 0 || t === 1 / 0) && (t = e.count), t === 0) return null;
|
|
459
|
-
const
|
|
491
|
+
const c = Ge(e, n, t);
|
|
460
492
|
let l;
|
|
461
493
|
s !== void 0 && (l = e === s.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
|
|
462
|
-
const
|
|
463
|
-
bufferView:
|
|
464
|
-
byteOffset:
|
|
494
|
+
const h = this.processBufferView(e, o, n, t, l), u = {
|
|
495
|
+
bufferView: h.id,
|
|
496
|
+
byteOffset: h.byteOffset,
|
|
465
497
|
componentType: o,
|
|
466
498
|
count: t,
|
|
467
|
-
max:
|
|
468
|
-
min:
|
|
499
|
+
max: c.max,
|
|
500
|
+
min: c.min,
|
|
469
501
|
type: r[e.itemSize]
|
|
470
502
|
};
|
|
471
503
|
return e.normalized === !0 && (u.normalized = !0), i.accessors || (i.accessors = []), i.accessors.push(u) - 1;
|
|
@@ -480,35 +512,35 @@ class Le {
|
|
|
480
512
|
*/
|
|
481
513
|
processImage(e, s, n, t = "image/png") {
|
|
482
514
|
if (e !== null) {
|
|
483
|
-
const i = this, r = i.cache, o = i.json,
|
|
515
|
+
const i = this, r = i.cache, o = i.json, c = i.options, l = i.pending;
|
|
484
516
|
r.images.has(e) || r.images.set(e, {});
|
|
485
|
-
const
|
|
486
|
-
if (
|
|
517
|
+
const h = r.images.get(e), u = t + ":flipY/" + n.toString();
|
|
518
|
+
if (h[u] !== void 0) return h[u];
|
|
487
519
|
o.images || (o.images = []);
|
|
488
|
-
const m = { mimeType: t },
|
|
489
|
-
|
|
490
|
-
const p =
|
|
491
|
-
if (n === !0 && (p.translate(0,
|
|
492
|
-
s !==
|
|
520
|
+
const m = { mimeType: t }, f = ee();
|
|
521
|
+
f.width = Math.min(e.width, c.maxTextureSize), f.height = Math.min(e.height, c.maxTextureSize);
|
|
522
|
+
const p = f.getContext("2d");
|
|
523
|
+
if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), e.data !== void 0) {
|
|
524
|
+
s !== Te && console.error("GLTFExporter: Only RGBAFormat is supported.", s), (e.width > c.maxTextureSize || e.height > c.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", e);
|
|
493
525
|
const g = new Uint8ClampedArray(e.height * e.width * 4);
|
|
494
526
|
for (let y = 0; y < g.length; y += 4)
|
|
495
527
|
g[y + 0] = e.data[y + 0], g[y + 1] = e.data[y + 1], g[y + 2] = e.data[y + 2], g[y + 3] = e.data[y + 3];
|
|
496
528
|
p.putImageData(new ImageData(g, e.width, e.height), 0, 0);
|
|
497
529
|
} else if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap || typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas)
|
|
498
|
-
p.drawImage(e, 0, 0,
|
|
530
|
+
p.drawImage(e, 0, 0, f.width, f.height);
|
|
499
531
|
else
|
|
500
532
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
501
|
-
|
|
502
|
-
|
|
533
|
+
c.binary === !0 ? l.push(
|
|
534
|
+
se(f, t).then((g) => i.processBufferViewImage(g)).then((g) => {
|
|
503
535
|
m.bufferView = g;
|
|
504
536
|
})
|
|
505
|
-
) :
|
|
506
|
-
|
|
537
|
+
) : f.toDataURL !== void 0 ? m.uri = f.toDataURL(t) : l.push(
|
|
538
|
+
se(f, t).then((g) => new FileReader().readAsDataURL(g)).then((g) => {
|
|
507
539
|
m.uri = g;
|
|
508
540
|
})
|
|
509
541
|
);
|
|
510
542
|
const d = o.images.push(m) - 1;
|
|
511
|
-
return
|
|
543
|
+
return h[u] = d, d;
|
|
512
544
|
} else
|
|
513
545
|
throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");
|
|
514
546
|
}
|
|
@@ -536,7 +568,7 @@ class Le {
|
|
|
536
568
|
processTexture(e) {
|
|
537
569
|
const n = this.options, t = this.cache, i = this.json;
|
|
538
570
|
if (t.textures.has(e)) return t.textures.get(e);
|
|
539
|
-
i.textures || (i.textures = []), e instanceof
|
|
571
|
+
i.textures || (i.textures = []), e instanceof k && (e = V(e, n.maxTextureSize));
|
|
540
572
|
let r = e.userData.mimeType;
|
|
541
573
|
r === "image/webp" && (r = "image/png");
|
|
542
574
|
const o = {
|
|
@@ -546,8 +578,8 @@ class Le {
|
|
|
546
578
|
e.name && (o.name = e.name), this._invokeAll(function(l) {
|
|
547
579
|
l.writeTexture && l.writeTexture(e, o);
|
|
548
580
|
});
|
|
549
|
-
const
|
|
550
|
-
return t.textures.set(e,
|
|
581
|
+
const c = i.textures.push(o) - 1;
|
|
582
|
+
return t.textures.set(e, c), c;
|
|
551
583
|
}
|
|
552
584
|
/**
|
|
553
585
|
* Process material
|
|
@@ -563,12 +595,12 @@ class Le {
|
|
|
563
595
|
const t = { pbrMetallicRoughness: {} };
|
|
564
596
|
e.isMeshStandardMaterial !== !0 && e.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
565
597
|
const i = e.color.toArray().concat([e.opacity]);
|
|
566
|
-
if (
|
|
567
|
-
const o = this.buildMetalRoughTexture(e.metalnessMap, e.roughnessMap),
|
|
598
|
+
if (O(i, [1, 1, 1, 1]) || (t.pbrMetallicRoughness.baseColorFactor = i), e.isMeshStandardMaterial ? (t.pbrMetallicRoughness.metallicFactor = e.metalness, t.pbrMetallicRoughness.roughnessFactor = e.roughness) : (t.pbrMetallicRoughness.metallicFactor = 0.5, t.pbrMetallicRoughness.roughnessFactor = 0.5), e.metalnessMap || e.roughnessMap) {
|
|
599
|
+
const o = this.buildMetalRoughTexture(e.metalnessMap, e.roughnessMap), c = {
|
|
568
600
|
index: this.processTexture(o),
|
|
569
601
|
channel: o.channel
|
|
570
602
|
};
|
|
571
|
-
this.applyTextureTransform(
|
|
603
|
+
this.applyTextureTransform(c, o), t.pbrMetallicRoughness.metallicRoughnessTexture = c;
|
|
572
604
|
}
|
|
573
605
|
if (e.map) {
|
|
574
606
|
const o = {
|
|
@@ -601,7 +633,7 @@ class Le {
|
|
|
601
633
|
};
|
|
602
634
|
e.aoMapIntensity !== 1 && (o.strength = e.aoMapIntensity), this.applyTextureTransform(o, e.aoMap), t.occlusionTexture = o;
|
|
603
635
|
}
|
|
604
|
-
e.transparent ? t.alphaMode = "BLEND" : e.alphaTest > 0 && (t.alphaMode = "MASK", t.alphaCutoff = e.alphaTest), e.side ===
|
|
636
|
+
e.transparent ? t.alphaMode = "BLEND" : e.alphaTest > 0 && (t.alphaMode = "MASK", t.alphaCutoff = e.alphaTest), e.side === me && (t.doubleSided = !0), e.name !== "" && (t.name = e.name), this.serializeUserData(e, t), this._invokeAll(function(o) {
|
|
605
637
|
o.writeMaterial && o.writeMaterial(e, t);
|
|
606
638
|
});
|
|
607
639
|
const r = n.materials.push(t) - 1;
|
|
@@ -624,7 +656,7 @@ class Le {
|
|
|
624
656
|
const r = e.geometry;
|
|
625
657
|
let o;
|
|
626
658
|
e.isLineSegments ? o = T.LINES : e.isLineLoop ? o = T.LINE_LOOP : e.isLine ? o = T.LINE_STRIP : e.isPoints ? o = T.POINTS : o = e.material.wireframe ? T.LINES : T.TRIANGLES;
|
|
627
|
-
const
|
|
659
|
+
const c = {}, l = {}, h = [], u = [], m = {
|
|
628
660
|
uv: "TEXCOORD_0",
|
|
629
661
|
uv1: "TEXCOORD_1",
|
|
630
662
|
uv2: "TEXCOORD_2",
|
|
@@ -632,8 +664,8 @@ class Le {
|
|
|
632
664
|
color: "COLOR_0",
|
|
633
665
|
skinWeight: "WEIGHTS_0",
|
|
634
666
|
skinIndex: "JOINTS_0"
|
|
635
|
-
},
|
|
636
|
-
|
|
667
|
+
}, f = r.getAttribute("normal");
|
|
668
|
+
f !== void 0 && !this.isNormalizedNormalAttribute(f) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), r.setAttribute("normal", this.createNormalizedNormalAttribute(f)));
|
|
637
669
|
let p = null;
|
|
638
670
|
for (let x in r.attributes) {
|
|
639
671
|
if (x.slice(0, 5) === "morph") continue;
|
|
@@ -648,7 +680,7 @@ class Le {
|
|
|
648
680
|
const A = this.processAccessor(p || M, r);
|
|
649
681
|
A !== null && (x.startsWith("_") || this.detectMeshQuantization(x, M), l[x] = A, s.attributes.set(this.getUID(M), A));
|
|
650
682
|
}
|
|
651
|
-
if (
|
|
683
|
+
if (f !== void 0 && r.setAttribute("normal", f), Object.keys(l).length === 0) return null;
|
|
652
684
|
if (e.morphTargetInfluences !== void 0 && e.morphTargetInfluences.length > 0) {
|
|
653
685
|
const x = [], M = [], w = {};
|
|
654
686
|
if (e.morphTargetDictionary !== void 0)
|
|
@@ -656,27 +688,27 @@ class Le {
|
|
|
656
688
|
w[e.morphTargetDictionary[E]] = E;
|
|
657
689
|
for (let E = 0; E < e.morphTargetInfluences.length; ++E) {
|
|
658
690
|
const A = {};
|
|
659
|
-
let
|
|
660
|
-
for (const
|
|
661
|
-
if (
|
|
662
|
-
|
|
691
|
+
let X = !1;
|
|
692
|
+
for (const C in r.morphAttributes) {
|
|
693
|
+
if (C !== "position" && C !== "normal") {
|
|
694
|
+
X || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), X = !0);
|
|
663
695
|
continue;
|
|
664
696
|
}
|
|
665
|
-
const N = r.morphAttributes[
|
|
697
|
+
const N = r.morphAttributes[C][E], z = C.toUpperCase(), U = r.attributes[C];
|
|
666
698
|
if (s.attributes.has(this.getUID(N, !0))) {
|
|
667
|
-
A[
|
|
699
|
+
A[z] = s.attributes.get(this.getUID(N, !0));
|
|
668
700
|
continue;
|
|
669
701
|
}
|
|
670
|
-
const
|
|
702
|
+
const v = N.clone();
|
|
671
703
|
if (!r.morphTargetsRelative)
|
|
672
|
-
for (let I = 0,
|
|
704
|
+
for (let I = 0, ie = N.count; I < ie; I++)
|
|
673
705
|
for (let S = 0; S < N.itemSize; S++)
|
|
674
|
-
S === 0 &&
|
|
675
|
-
A[
|
|
706
|
+
S === 0 && v.setX(I, N.getX(I) - U.getX(I)), S === 1 && v.setY(I, N.getY(I) - U.getY(I)), S === 2 && v.setZ(I, N.getZ(I) - U.getZ(I)), S === 3 && v.setW(I, N.getW(I) - U.getW(I));
|
|
707
|
+
A[z] = this.processAccessor(v, r), s.attributes.set(this.getUID(U, !0), A[z]);
|
|
676
708
|
}
|
|
677
709
|
u.push(A), x.push(e.morphTargetInfluences[E]), e.morphTargetDictionary !== void 0 && M.push(w[E]);
|
|
678
710
|
}
|
|
679
|
-
|
|
711
|
+
c.weights = x, M.length > 0 && (c.extras = {}, c.extras.targetNames = M);
|
|
680
712
|
}
|
|
681
713
|
const d = Array.isArray(e.material);
|
|
682
714
|
if (d && r.groups.length === 0) return null;
|
|
@@ -698,13 +730,13 @@ class Le {
|
|
|
698
730
|
(b[x].start !== void 0 || b[x].count !== void 0) && (A += ":" + b[x].start + ":" + b[x].count), s.attributes.has(A) ? w.indices = s.attributes.get(A) : (w.indices = this.processAccessor(r.index, r, b[x].start, b[x].count), s.attributes.set(A, w.indices)), w.indices === null && delete w.indices;
|
|
699
731
|
}
|
|
700
732
|
const E = this.processMaterial(y[b[x].materialIndex]);
|
|
701
|
-
E !== null && (w.material = E),
|
|
733
|
+
E !== null && (w.material = E), h.push(w);
|
|
702
734
|
}
|
|
703
|
-
g === !0 && r.setIndex(null),
|
|
704
|
-
x.writeMesh && x.writeMesh(e,
|
|
735
|
+
g === !0 && r.setIndex(null), c.primitives = h, n.meshes || (n.meshes = []), this._invokeAll(function(x) {
|
|
736
|
+
x.writeMesh && x.writeMesh(e, c);
|
|
705
737
|
});
|
|
706
|
-
const
|
|
707
|
-
return s.meshes.set(i,
|
|
738
|
+
const D = n.meshes.push(c) - 1;
|
|
739
|
+
return s.meshes.set(i, D), D;
|
|
708
740
|
}
|
|
709
741
|
/**
|
|
710
742
|
* If a vertex attribute with a
|
|
@@ -718,7 +750,7 @@ class Le {
|
|
|
718
750
|
* @param {THREE.BufferAttribute} attribute
|
|
719
751
|
*/
|
|
720
752
|
detectMeshQuantization(e, s) {
|
|
721
|
-
if (this.extensionsUsed[
|
|
753
|
+
if (this.extensionsUsed[j]) return;
|
|
722
754
|
let n;
|
|
723
755
|
switch (s.array.constructor) {
|
|
724
756
|
case Int8Array:
|
|
@@ -738,7 +770,7 @@ class Le {
|
|
|
738
770
|
}
|
|
739
771
|
s.normalized && (n += " normalized");
|
|
740
772
|
const t = e.split("_", 1)[0];
|
|
741
|
-
|
|
773
|
+
J[t] && J[t].includes(n) && (this.extensionsUsed[j] = !0, this.extensionsRequired[j] = !0);
|
|
742
774
|
}
|
|
743
775
|
/**
|
|
744
776
|
* Process camera
|
|
@@ -758,7 +790,7 @@ class Le {
|
|
|
758
790
|
znear: e.near < 0 ? 0 : e.near
|
|
759
791
|
} : t.perspective = {
|
|
760
792
|
aspectRatio: e.aspect,
|
|
761
|
-
yfov:
|
|
793
|
+
yfov: W.degToRad(e.fov),
|
|
762
794
|
zfar: e.far <= 0 ? 1e-3 : e.far,
|
|
763
795
|
znear: e.near < 0 ? 0 : e.near
|
|
764
796
|
}, e.name !== "" && (t.name = e.type), s.cameras.push(t) - 1;
|
|
@@ -775,20 +807,20 @@ class Le {
|
|
|
775
807
|
*/
|
|
776
808
|
processAnimation(e, s) {
|
|
777
809
|
const n = this.json, t = this.nodeMap;
|
|
778
|
-
n.animations || (n.animations = []), e =
|
|
810
|
+
n.animations || (n.animations = []), e = q.Utils.mergeMorphTargetTracks(e.clone(), s);
|
|
779
811
|
const i = e.tracks, r = [], o = [];
|
|
780
|
-
for (let
|
|
781
|
-
const l = i[
|
|
782
|
-
let u =
|
|
783
|
-
const m =
|
|
784
|
-
if (
|
|
812
|
+
for (let c = 0; c < i.length; ++c) {
|
|
813
|
+
const l = i[c], h = P.parseTrackName(l.name);
|
|
814
|
+
let u = P.findNode(s, h.nodeName);
|
|
815
|
+
const m = Q[h.propertyName];
|
|
816
|
+
if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !m)
|
|
785
817
|
return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name), null;
|
|
786
|
-
const
|
|
818
|
+
const f = 1;
|
|
787
819
|
let p = l.values.length / l.times.length;
|
|
788
|
-
m ===
|
|
820
|
+
m === Q.morphTargetInfluences && (p /= u.morphTargetInfluences.length);
|
|
789
821
|
let d;
|
|
790
|
-
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (d = "CUBICSPLINE", p /= 3) : l.getInterpolation() ===
|
|
791
|
-
input: this.processAccessor(new L(l.times,
|
|
822
|
+
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (d = "CUBICSPLINE", p /= 3) : l.getInterpolation() === Me ? d = "STEP" : d = "LINEAR", o.push({
|
|
823
|
+
input: this.processAccessor(new L(l.times, f)),
|
|
792
824
|
output: this.processAccessor(new L(l.values, p)),
|
|
793
825
|
interpolation: d
|
|
794
826
|
}), r.push({
|
|
@@ -814,11 +846,11 @@ class Le {
|
|
|
814
846
|
if (i === void 0) return null;
|
|
815
847
|
const r = e.skeleton.bones[0];
|
|
816
848
|
if (r === void 0) return null;
|
|
817
|
-
const o = [],
|
|
849
|
+
const o = [], c = new Float32Array(i.bones.length * 16), l = new ne();
|
|
818
850
|
for (let u = 0; u < i.bones.length; ++u)
|
|
819
|
-
o.push(n.get(i.bones[u])), l.copy(i.boneInverses[u]), l.multiply(e.bindMatrix).toArray(
|
|
851
|
+
o.push(n.get(i.bones[u])), l.copy(i.boneInverses[u]), l.multiply(e.bindMatrix).toArray(c, u * 16);
|
|
820
852
|
return s.skins === void 0 && (s.skins = []), s.skins.push({
|
|
821
|
-
inverseBindMatrices: this.processAccessor(new L(
|
|
853
|
+
inverseBindMatrices: this.processAccessor(new L(c, 16)),
|
|
822
854
|
joints: o,
|
|
823
855
|
skeleton: n.get(r)
|
|
824
856
|
}), t.skin = s.skins.length - 1;
|
|
@@ -833,20 +865,20 @@ class Le {
|
|
|
833
865
|
s.nodes || (s.nodes = []);
|
|
834
866
|
const i = {};
|
|
835
867
|
if (n.trs) {
|
|
836
|
-
const o = e.quaternion.toArray(),
|
|
837
|
-
|
|
868
|
+
const o = e.quaternion.toArray(), c = e.position.toArray(), l = e.scale.toArray();
|
|
869
|
+
O(o, [0, 0, 0, 1]) || (i.rotation = o), O(c, [0, 0, 0]) || (i.translation = c), O(l, [1, 1, 1]) || (i.scale = l);
|
|
838
870
|
} else
|
|
839
|
-
e.matrixAutoUpdate && e.updateMatrix(),
|
|
871
|
+
e.matrixAutoUpdate && e.updateMatrix(), Be(e.matrix) === !1 && (i.matrix = e.matrix.elements);
|
|
840
872
|
if (e.name !== "" && (i.name = String(e.name)), this.serializeUserData(e, i), e.isMesh || e.isLine || e.isPoints) {
|
|
841
873
|
const o = this.processMesh(e);
|
|
842
874
|
o !== null && (i.mesh = o);
|
|
843
875
|
} else e.isCamera && (i.camera = this.processCamera(e));
|
|
844
876
|
if (e.isSkinnedMesh && this.skins.push(e), e.children.length > 0) {
|
|
845
877
|
const o = [];
|
|
846
|
-
for (let
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
849
|
-
const u = this.processNode(
|
|
878
|
+
for (let c = 0, l = e.children.length; c < l; c++) {
|
|
879
|
+
const h = e.children[c];
|
|
880
|
+
if (h.visible || n.onlyVisible === !1) {
|
|
881
|
+
const u = this.processNode(h);
|
|
850
882
|
u !== null && o.push(u);
|
|
851
883
|
}
|
|
852
884
|
}
|
|
@@ -869,9 +901,9 @@ class Le {
|
|
|
869
901
|
e.name !== "" && (t.name = e.name), s.scenes.push(t);
|
|
870
902
|
const i = [];
|
|
871
903
|
for (let r = 0, o = e.children.length; r < o; r++) {
|
|
872
|
-
const
|
|
873
|
-
if (
|
|
874
|
-
const l = this.processNode(
|
|
904
|
+
const c = e.children[r];
|
|
905
|
+
if (c.visible || n.onlyVisible === !1) {
|
|
906
|
+
const l = this.processNode(c);
|
|
875
907
|
l !== null && i.push(l);
|
|
876
908
|
}
|
|
877
909
|
}
|
|
@@ -882,7 +914,7 @@ class Le {
|
|
|
882
914
|
* @param {Array} objects List of objects to process
|
|
883
915
|
*/
|
|
884
916
|
processObjects(e) {
|
|
885
|
-
const s = new
|
|
917
|
+
const s = new K();
|
|
886
918
|
s.name = "AuxScene";
|
|
887
919
|
for (let n = 0; n < e.length; n++)
|
|
888
920
|
s.children.push(e[n]);
|
|
@@ -898,7 +930,7 @@ class Le {
|
|
|
898
930
|
});
|
|
899
931
|
const n = [];
|
|
900
932
|
for (let t = 0; t < e.length; t++)
|
|
901
|
-
e[t] instanceof
|
|
933
|
+
e[t] instanceof K ? this.processScene(e[t]) : n.push(e[t]);
|
|
902
934
|
n.length > 0 && this.processObjects(n);
|
|
903
935
|
for (let t = 0; t < this.skins.length; ++t)
|
|
904
936
|
this.processSkin(this.skins[t]);
|
|
@@ -913,7 +945,7 @@ class Le {
|
|
|
913
945
|
e(this.plugins[s]);
|
|
914
946
|
}
|
|
915
947
|
}
|
|
916
|
-
class
|
|
948
|
+
class ze {
|
|
917
949
|
constructor(e) {
|
|
918
950
|
this.writer = e, this.name = "KHR_lights_punctual";
|
|
919
951
|
}
|
|
@@ -929,7 +961,7 @@ class Se {
|
|
|
929
961
|
o.push(r), s.extensions = s.extensions || {}, s.extensions[this.name] = { light: o.length - 1 };
|
|
930
962
|
}
|
|
931
963
|
}
|
|
932
|
-
class
|
|
964
|
+
class ke {
|
|
933
965
|
constructor(e) {
|
|
934
966
|
this.writer = e, this.name = "KHR_materials_unlit";
|
|
935
967
|
}
|
|
@@ -939,7 +971,7 @@ class _e {
|
|
|
939
971
|
s.extensions = s.extensions || {}, s.extensions[this.name] = {}, t[this.name] = !0, s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
940
972
|
}
|
|
941
973
|
}
|
|
942
|
-
class
|
|
974
|
+
class He {
|
|
943
975
|
constructor(e) {
|
|
944
976
|
this.writer = e, this.name = "KHR_materials_clearcoat";
|
|
945
977
|
}
|
|
@@ -970,7 +1002,7 @@ class Ce {
|
|
|
970
1002
|
s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
971
1003
|
}
|
|
972
1004
|
}
|
|
973
|
-
class
|
|
1005
|
+
class Ve {
|
|
974
1006
|
constructor(e) {
|
|
975
1007
|
this.writer = e, this.name = "KHR_materials_iridescence";
|
|
976
1008
|
}
|
|
@@ -994,7 +1026,7 @@ class Ue {
|
|
|
994
1026
|
s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
995
1027
|
}
|
|
996
1028
|
}
|
|
997
|
-
class
|
|
1029
|
+
class je {
|
|
998
1030
|
constructor(e) {
|
|
999
1031
|
this.writer = e, this.name = "KHR_materials_transmission";
|
|
1000
1032
|
}
|
|
@@ -1011,7 +1043,7 @@ class Fe {
|
|
|
1011
1043
|
s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1012
1044
|
}
|
|
1013
1045
|
}
|
|
1014
|
-
class
|
|
1046
|
+
class Ye {
|
|
1015
1047
|
constructor(e) {
|
|
1016
1048
|
this.writer = e, this.name = "KHR_materials_volume";
|
|
1017
1049
|
}
|
|
@@ -1028,7 +1060,7 @@ class Oe {
|
|
|
1028
1060
|
i.attenuationDistance = e.attenuationDistance, i.attenuationColor = e.attenuationColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1029
1061
|
}
|
|
1030
1062
|
}
|
|
1031
|
-
class
|
|
1063
|
+
class Ke {
|
|
1032
1064
|
constructor(e) {
|
|
1033
1065
|
this.writer = e, this.name = "KHR_materials_ior";
|
|
1034
1066
|
}
|
|
@@ -1038,12 +1070,12 @@ class ve {
|
|
|
1038
1070
|
i.ior = e.ior, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1039
1071
|
}
|
|
1040
1072
|
}
|
|
1041
|
-
class
|
|
1073
|
+
class We {
|
|
1042
1074
|
constructor(e) {
|
|
1043
1075
|
this.writer = e, this.name = "KHR_materials_specular";
|
|
1044
1076
|
}
|
|
1045
1077
|
writeMaterial(e, s) {
|
|
1046
|
-
if (!e.isMeshPhysicalMaterial || e.specularIntensity === 1 && e.specularColor.equals(
|
|
1078
|
+
if (!e.isMeshPhysicalMaterial || e.specularIntensity === 1 && e.specularColor.equals(Ce) && !e.specularIntensityMap && !e.specularColorMap) return;
|
|
1047
1079
|
const n = this.writer, t = n.extensionsUsed, i = {};
|
|
1048
1080
|
if (e.specularIntensityMap) {
|
|
1049
1081
|
const r = {
|
|
@@ -1062,7 +1094,7 @@ class De {
|
|
|
1062
1094
|
i.specularFactor = e.specularIntensity, i.specularColorFactor = e.specularColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1063
1095
|
}
|
|
1064
1096
|
}
|
|
1065
|
-
class
|
|
1097
|
+
class qe {
|
|
1066
1098
|
constructor(e) {
|
|
1067
1099
|
this.writer = e, this.name = "KHR_materials_sheen";
|
|
1068
1100
|
}
|
|
@@ -1086,7 +1118,7 @@ class Be {
|
|
|
1086
1118
|
i.sheenRoughnessFactor = e.sheenRoughness, i.sheenColorFactor = e.sheenColor.toArray(), s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1087
1119
|
}
|
|
1088
1120
|
}
|
|
1089
|
-
class
|
|
1121
|
+
class Xe {
|
|
1090
1122
|
constructor(e) {
|
|
1091
1123
|
this.writer = e, this.name = "KHR_materials_anisotropy";
|
|
1092
1124
|
}
|
|
@@ -1100,7 +1132,7 @@ class Ge {
|
|
|
1100
1132
|
i.anisotropyStrength = e.anisotropy, i.anisotropyRotation = e.anisotropyRotation, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1101
1133
|
}
|
|
1102
1134
|
}
|
|
1103
|
-
class
|
|
1135
|
+
class Je {
|
|
1104
1136
|
constructor(e) {
|
|
1105
1137
|
this.writer = e, this.name = "KHR_materials_emissive_strength";
|
|
1106
1138
|
}
|
|
@@ -1110,7 +1142,7 @@ class ze {
|
|
|
1110
1142
|
i.emissiveStrength = e.emissiveIntensity, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1111
1143
|
}
|
|
1112
1144
|
}
|
|
1113
|
-
class
|
|
1145
|
+
class Qe {
|
|
1114
1146
|
constructor(e) {
|
|
1115
1147
|
this.writer = e, this.name = "EXT_materials_bump";
|
|
1116
1148
|
}
|
|
@@ -1127,15 +1159,15 @@ class Pe {
|
|
|
1127
1159
|
i.bumpFactor = e.bumpScale, s.extensions = s.extensions || {}, s.extensions[this.name] = i, t[this.name] = !0;
|
|
1128
1160
|
}
|
|
1129
1161
|
}
|
|
1130
|
-
class
|
|
1162
|
+
class Ze {
|
|
1131
1163
|
constructor(e) {
|
|
1132
1164
|
this.writer = e, this.name = "EXT_mesh_gpu_instancing";
|
|
1133
1165
|
}
|
|
1134
1166
|
writeNode(e, s) {
|
|
1135
1167
|
if (!e.isInstancedMesh) return;
|
|
1136
|
-
const n = this.writer, t = e, i = new Float32Array(t.count * 3), r = new Float32Array(t.count * 4), o = new Float32Array(t.count * 3),
|
|
1137
|
-
for (let
|
|
1138
|
-
t.getMatrixAt(
|
|
1168
|
+
const n = this.writer, t = e, i = new Float32Array(t.count * 3), r = new Float32Array(t.count * 4), o = new Float32Array(t.count * 3), c = new ne(), l = new G(), h = new de(), u = new G();
|
|
1169
|
+
for (let f = 0; f < t.count; f++)
|
|
1170
|
+
t.getMatrixAt(f, c), c.decompose(l, h, u), l.toArray(i, f * 3), h.toArray(r, f * 4), u.toArray(o, f * 3);
|
|
1139
1171
|
const m = {
|
|
1140
1172
|
TRANSLATION: n.processAccessor(new L(i, 3)),
|
|
1141
1173
|
ROTATION: n.processAccessor(new L(r, 4)),
|
|
@@ -1144,37 +1176,37 @@ class ke {
|
|
|
1144
1176
|
t.instanceColor && (m._COLOR_0 = n.processAccessor(t.instanceColor)), s.extensions = s.extensions || {}, s.extensions[this.name] = { attributes: m }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
|
|
1145
1177
|
}
|
|
1146
1178
|
}
|
|
1147
|
-
|
|
1148
|
-
insertKeyframe: function(
|
|
1149
|
-
const n =
|
|
1179
|
+
q.Utils = {
|
|
1180
|
+
insertKeyframe: function(a, e) {
|
|
1181
|
+
const n = a.getValueSize(), t = new a.TimeBufferType(a.times.length + 1), i = new a.ValueBufferType(a.values.length + n), r = a.createInterpolant(new a.ValueBufferType(n));
|
|
1150
1182
|
let o;
|
|
1151
|
-
if (
|
|
1183
|
+
if (a.times.length === 0) {
|
|
1152
1184
|
t[0] = e;
|
|
1153
|
-
for (let
|
|
1154
|
-
i[
|
|
1185
|
+
for (let c = 0; c < n; c++)
|
|
1186
|
+
i[c] = 0;
|
|
1155
1187
|
o = 0;
|
|
1156
|
-
} else if (e <
|
|
1157
|
-
if (Math.abs(
|
|
1158
|
-
t[0] = e, t.set(
|
|
1159
|
-
} else if (e >
|
|
1160
|
-
if (Math.abs(
|
|
1161
|
-
return
|
|
1162
|
-
t[t.length - 1] = e, t.set(
|
|
1188
|
+
} else if (e < a.times[0]) {
|
|
1189
|
+
if (Math.abs(a.times[0] - e) < 1e-3) return 0;
|
|
1190
|
+
t[0] = e, t.set(a.times, 1), i.set(r.evaluate(e), 0), i.set(a.values, n), o = 0;
|
|
1191
|
+
} else if (e > a.times[a.times.length - 1]) {
|
|
1192
|
+
if (Math.abs(a.times[a.times.length - 1] - e) < 1e-3)
|
|
1193
|
+
return a.times.length - 1;
|
|
1194
|
+
t[t.length - 1] = e, t.set(a.times, 0), i.set(a.values, 0), i.set(r.evaluate(e), a.values.length), o = t.length - 1;
|
|
1163
1195
|
} else
|
|
1164
|
-
for (let
|
|
1165
|
-
if (Math.abs(
|
|
1166
|
-
if (
|
|
1167
|
-
t.set(
|
|
1196
|
+
for (let c = 0; c < a.times.length; c++) {
|
|
1197
|
+
if (Math.abs(a.times[c] - e) < 1e-3) return c;
|
|
1198
|
+
if (a.times[c] < e && a.times[c + 1] > e) {
|
|
1199
|
+
t.set(a.times.slice(0, c + 1), 0), t[c + 1] = e, t.set(a.times.slice(c + 1), c + 2), i.set(a.values.slice(0, (c + 1) * n), 0), i.set(r.evaluate(e), (c + 1) * n), i.set(a.values.slice((c + 1) * n), (c + 2) * n), o = c + 1;
|
|
1168
1200
|
break;
|
|
1169
1201
|
}
|
|
1170
1202
|
}
|
|
1171
|
-
return
|
|
1203
|
+
return a.times = t, a.values = i, o;
|
|
1172
1204
|
},
|
|
1173
|
-
mergeMorphTargetTracks: function(
|
|
1174
|
-
const s = [], n = {}, t =
|
|
1205
|
+
mergeMorphTargetTracks: function(a, e) {
|
|
1206
|
+
const s = [], n = {}, t = a.tracks;
|
|
1175
1207
|
for (let i = 0; i < t.length; ++i) {
|
|
1176
1208
|
let r = t[i];
|
|
1177
|
-
const o =
|
|
1209
|
+
const o = P.parseTrackName(r.name), c = P.findNode(e, o.nodeName);
|
|
1178
1210
|
if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
|
|
1179
1211
|
s.push(r);
|
|
1180
1212
|
continue;
|
|
@@ -1182,35 +1214,35 @@ V.Utils = {
|
|
|
1182
1214
|
if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
|
|
1183
1215
|
if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
|
|
1184
1216
|
throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
|
|
1185
|
-
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(
|
|
1217
|
+
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(Se);
|
|
1186
1218
|
}
|
|
1187
|
-
const l =
|
|
1188
|
-
if (
|
|
1219
|
+
const l = c.morphTargetInfluences.length, h = c.morphTargetDictionary[o.propertyIndex];
|
|
1220
|
+
if (h === void 0)
|
|
1189
1221
|
throw new Error("THREE.GLTFExporter: Morph target name not found: " + o.propertyIndex);
|
|
1190
1222
|
let u;
|
|
1191
|
-
if (n[
|
|
1223
|
+
if (n[c.uuid] === void 0) {
|
|
1192
1224
|
u = r.clone();
|
|
1193
|
-
const
|
|
1225
|
+
const f = new u.ValueBufferType(l * u.times.length);
|
|
1194
1226
|
for (let p = 0; p < u.times.length; p++)
|
|
1195
|
-
|
|
1196
|
-
u.name = (o.nodeName || "") + ".morphTargetInfluences", u.values =
|
|
1227
|
+
f[p * l + h] = u.values[p];
|
|
1228
|
+
u.name = (o.nodeName || "") + ".morphTargetInfluences", u.values = f, n[c.uuid] = u, s.push(u);
|
|
1197
1229
|
continue;
|
|
1198
1230
|
}
|
|
1199
1231
|
const m = r.createInterpolant(new r.ValueBufferType(1));
|
|
1200
|
-
u = n[
|
|
1201
|
-
for (let
|
|
1202
|
-
u.values[
|
|
1203
|
-
for (let
|
|
1204
|
-
const p = this.insertKeyframe(u, r.times[
|
|
1205
|
-
u.values[p * l +
|
|
1232
|
+
u = n[c.uuid];
|
|
1233
|
+
for (let f = 0; f < u.times.length; f++)
|
|
1234
|
+
u.values[f * l + h] = m.evaluate(u.times[f]);
|
|
1235
|
+
for (let f = 0; f < r.times.length; f++) {
|
|
1236
|
+
const p = this.insertKeyframe(u, r.times[f]);
|
|
1237
|
+
u.values[p * l + h] = r.values[f];
|
|
1206
1238
|
}
|
|
1207
1239
|
}
|
|
1208
|
-
return
|
|
1240
|
+
return a.tracks = s, a;
|
|
1209
1241
|
}
|
|
1210
1242
|
};
|
|
1211
|
-
class
|
|
1243
|
+
class $e {
|
|
1212
1244
|
constructor() {
|
|
1213
|
-
this._importer = new
|
|
1245
|
+
this._importer = new _e(), this._exporter = new q();
|
|
1214
1246
|
}
|
|
1215
1247
|
Import(e, s) {
|
|
1216
1248
|
return this._importer.loadAsync(e, (n) => {
|
|
@@ -1227,9 +1259,9 @@ class He {
|
|
|
1227
1259
|
});
|
|
1228
1260
|
}
|
|
1229
1261
|
}
|
|
1230
|
-
class
|
|
1262
|
+
class ss {
|
|
1231
1263
|
constructor(e) {
|
|
1232
|
-
this._scene = e, this._gltfIO = new
|
|
1264
|
+
this._scene = e, this._gltfIO = new $e();
|
|
1233
1265
|
}
|
|
1234
1266
|
Import(e, s) {
|
|
1235
1267
|
switch (e) {
|
|
@@ -1252,6 +1284,6 @@ class Ye {
|
|
|
1252
1284
|
}
|
|
1253
1285
|
}
|
|
1254
1286
|
export {
|
|
1255
|
-
|
|
1287
|
+
ss as DIVEIO
|
|
1256
1288
|
};
|
|
1257
|
-
//# sourceMappingURL=IO-
|
|
1289
|
+
//# sourceMappingURL=IO-CYzpSt1J.js.map
|