@shopware-ag/dive 2.2.34 → 2.3.0
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/Animator-BGFdF70Z.mjs +47 -0
- package/build/chunks/Animator-Cu7NIkVg.cjs +1 -0
- package/build/chunks/{AssetCache-BOMaDRGn.cjs → AssetCache-BZhTsybC.cjs} +1 -1
- package/build/chunks/{AssetCache-lGp7KKQA.mjs → AssetCache-p0Zr71Yh.mjs} +1 -1
- package/build/chunks/{AssetExporter-brT7ogoM.mjs → AssetExporter-BBaDvZ8D.mjs} +68 -61
- package/build/chunks/{AssetExporter-DsbC2rqv.cjs → AssetExporter-Bqv27MWV.cjs} +15 -15
- package/build/chunks/{AssetLoader-BDP2bROu.mjs → AssetLoader-Dcr75VNw.mjs} +20 -12
- package/build/chunks/{AssetLoader-B00ge8um.cjs → AssetLoader-Drtmvqgs.cjs} +2 -2
- package/build/chunks/ClipAnimator-BL9qzfWl.mjs +83 -0
- package/build/chunks/ClipAnimator-BcDOC3qJ.cjs +1 -0
- package/build/chunks/{FileTypes-DOUQk-mF.cjs → FileTypes-35x8Ekp6.cjs} +2 -2
- package/build/chunks/{FileTypes-DeUmmPCi.mjs → FileTypes-BSG8CC2s.mjs} +41 -38
- package/build/chunks/TargetAnimator-DUqkkdVb.mjs +79 -0
- package/build/chunks/TargetAnimator-DuqPk2eq.cjs +1 -0
- package/build/chunks/{isFileTypeSupported-D8QKkffJ.cjs → isFileTypeSupported-BmjxgShb.cjs} +1 -1
- package/build/chunks/{isFileTypeSupported-DsYDdT2J.mjs → isFileTypeSupported-DBPOEmTI.mjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/plugins/animation/index.cjs +1 -1
- package/build/plugins/animation/index.d.ts +1 -1
- package/build/plugins/animation/index.mjs +84 -109
- package/build/plugins/animation/src/animator/Animator.d.ts +23 -22
- package/build/plugins/animation/src/animator/ClipAnimator.d.ts +33 -0
- package/build/plugins/animation/src/animator/TargetAnimator.d.ts +45 -0
- package/build/plugins/animation/src/index.d.ts +4 -2
- package/build/plugins/animation/src/system/AnimationSystem.d.ts +136 -14
- package/build/plugins/animation/src/types/AnimatorTypes.d.ts +11 -0
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +2 -2
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetexporter/index.cjs +1 -1
- package/build/plugins/assetexporter/index.mjs +1 -1
- package/build/plugins/assetexporter/src/AssetExporter.d.ts +1 -0
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +2 -2
- 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 +7 -7
- package/build/plugins/quickview/src/QuickView.d.ts +2 -1
- package/build/plugins/state/index.cjs +4 -4
- package/build/plugins/state/index.mjs +791 -794
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +1 -1
- package/package.json +2 -2
- package/build/plugins/animation/src/types/AnimatorParameters.d.ts +0 -7
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var u = (n, e, s) => e in n ? f(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
|
|
3
|
+
var l = (n, e, s) => u(n, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { MathUtils as a } from "three";
|
|
5
|
+
class h {
|
|
6
|
+
addEventListener(e, s) {
|
|
7
|
+
this._listeners === void 0 && (this._listeners = {});
|
|
8
|
+
const i = this._listeners;
|
|
9
|
+
i[e] === void 0 && (i[e] = []), i[e].indexOf(s) === -1 && i[e].push(s);
|
|
10
|
+
}
|
|
11
|
+
hasEventListener(e, s) {
|
|
12
|
+
if (this._listeners === void 0) return !1;
|
|
13
|
+
const i = this._listeners;
|
|
14
|
+
return i[e] !== void 0 && i[e].indexOf(s) !== -1;
|
|
15
|
+
}
|
|
16
|
+
removeEventListener(e, s) {
|
|
17
|
+
if (this._listeners === void 0) return;
|
|
18
|
+
const t = this._listeners[e];
|
|
19
|
+
if (t !== void 0) {
|
|
20
|
+
const r = t.indexOf(s);
|
|
21
|
+
r !== -1 && t.splice(r, 1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
dispatchEvent(e) {
|
|
25
|
+
if (this._listeners === void 0) return;
|
|
26
|
+
const i = this._listeners[e.type];
|
|
27
|
+
if (i !== void 0) {
|
|
28
|
+
e.target = this;
|
|
29
|
+
const t = i.slice(0);
|
|
30
|
+
for (let r = 0, d = t.length; r < d; r++)
|
|
31
|
+
t[r].call(this, e);
|
|
32
|
+
e.target = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class _ extends h {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
l(this, "_uuid", a.generateUUID());
|
|
40
|
+
}
|
|
41
|
+
get uuid() {
|
|
42
|
+
return this._uuid;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
_ as A
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var f=(t,e,s)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var l=(t,e,s)=>f(t,typeof e!="symbol"?e+"":e,s);const h=require("three");class a{addEventListener(e,s){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(s)===-1&&i[e].push(s)}hasEventListener(e,s){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(s)!==-1}removeEventListener(e,s){if(this._listeners===void 0)return;const n=this._listeners[e];if(n!==void 0){const r=n.indexOf(s);r!==-1&&n.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const n=i.slice(0);for(let r=0,d=n.length;r<d;r++)n[r].call(this,e);e.target=null}}}class c extends a{constructor(){super(...arguments);l(this,"_uuid",h.MathUtils.generateUUID())}get uuid(){return this._uuid}}exports.Animator=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var u=(s,e,t)=>e in s?n(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>u(s,typeof e!="symbol"?e+"":e,t);require("./FileTypes-
|
|
1
|
+
"use strict";var n=Object.defineProperty;var u=(s,e,t)=>e in s?n(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>u(s,typeof e!="symbol"?e+"":e,t);require("./FileTypes-35x8Ekp6.cjs");require("three");const h=require("./network-error-CdDXil5g.cjs");class c{constructor(e){r(this,"_promise");r(this,"_resolve");r(this,"_arrayBuffer",null);r(this,"_size",0);r(this,"_createdAt");r(this,"_updatedAt");this._uri=e,this._promise=new Promise(t=>{this._resolve=t}),this._createdAt=new Date,this._updatedAt=new Date}get promise(){return this._promise}get size(){return this._size}get createdAt(){return this._createdAt}get updatedAt(){return this._updatedAt}get arrayBuffer(){return this._arrayBuffer}async load(){const e=await fetch(this._uri);if(!e.ok)throw new h.NetworkError(this._uri);try{this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new h.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class o{constructor(){r(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new c(e);return this._cache.set(e,t),t}write(e,t){this._cache.set(e,t)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(t=>{this._cache.delete(t)})}clear(){this._cache.clear()}}const a=Symbol.for("@shopware-ag/dive/assetcache"),i=globalThis;i[a]||(i[a]=new o);const _=i[a];exports.AssetCache=_;exports.Chunk=c;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var h = Object.defineProperty;
|
|
2
2
|
var c = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
3
|
var r = (s, e, t) => c(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import "./FileTypes-
|
|
4
|
+
import "./FileTypes-BSG8CC2s.mjs";
|
|
5
5
|
import "three";
|
|
6
6
|
import { N as o, F as _ } from "./network-error-BONfHWQq.mjs";
|
|
7
7
|
class n {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Y = (n, e, s) =>
|
|
4
|
-
import { PlaneGeometry as
|
|
5
|
-
import { s as
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var ye = (n, e, s) => e in n ? Me(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s;
|
|
3
|
+
var Y = (n, e, s) => ye(n, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { PlaneGeometry as we, ShaderMaterial as Ee, Uniform as Ae, SRGBColorSpace as ue, Mesh as le, PerspectiveCamera as Ie, Scene as Z, WebGLRenderer as be, CanvasTexture as Re, Color as _e, Matrix4 as fe, Vector3 as B, Quaternion as Se, BufferAttribute as v, CompressedTexture as K, Source as Ne, NoColorSpace as pe, MathUtils as q, RGBAFormat as ve, DoubleSide as he, PropertyBinding as H, InterpolateDiscrete as Le, NearestFilter as Ce, NearestMipmapNearestFilter as Ue, NearestMipmapLinearFilter as Fe, LinearFilter as $e, LinearMipmapNearestFilter as Oe, LinearMipmapLinearFilter as Pe, ClampToEdgeWrapping as De, RepeatWrapping as Ge, MirroredRepeatWrapping as ke, InterpolateLinear as ze } from "three";
|
|
5
|
+
import { s as de, z as Be } from "./fflate.module-xyO_T3Zm.mjs";
|
|
6
6
|
import { F as He, P as N } from "./parse-error-DfOPyLWM.mjs";
|
|
7
|
-
let O,
|
|
7
|
+
let O, W, C, G;
|
|
8
8
|
function z(n, e = 1 / 0, s = null) {
|
|
9
|
-
|
|
10
|
-
uniforms: { blitTexture: new
|
|
9
|
+
W || (W = new we(2, 2, 1, 1)), C || (C = new Ee({
|
|
10
|
+
uniforms: { blitTexture: new Ae(n) },
|
|
11
11
|
vertexShader: `
|
|
12
12
|
varying vec2 vUv;
|
|
13
13
|
void main(){
|
|
@@ -27,9 +27,9 @@ function z(n, e = 1 / 0, s = null) {
|
|
|
27
27
|
gl_FragColor = texture2D( blitTexture, vUv);
|
|
28
28
|
#endif
|
|
29
29
|
}`
|
|
30
|
-
})), C.uniforms.blitTexture.value = n, C.defines.IS_SRGB = n.colorSpace == ue, C.needsUpdate = !0, G || (G = new
|
|
31
|
-
const t = new
|
|
32
|
-
i.add(G), s === null && (s = O = new
|
|
30
|
+
})), C.uniforms.blitTexture.value = n, C.defines.IS_SRGB = n.colorSpace == ue, C.needsUpdate = !0, G || (G = new le(W, C), G.frustumCulled = !1);
|
|
31
|
+
const t = new Ie(), i = new Z();
|
|
32
|
+
i.add(G), s === null && (s = O = new be({ antialias: !1 }));
|
|
33
33
|
const r = Math.min(n.image.width, e), o = Math.min(n.image.height, e);
|
|
34
34
|
s.setSize(r, o), s.clear(), s.render(i, t);
|
|
35
35
|
const a = document.createElement("canvas"), c = a.getContext("2d");
|
|
@@ -145,7 +145,7 @@ const T = {
|
|
|
145
145
|
CLAMP_TO_EDGE: 33071,
|
|
146
146
|
MIRRORED_REPEAT: 33648,
|
|
147
147
|
REPEAT: 10497
|
|
148
|
-
},
|
|
148
|
+
}, j = "KHR_mesh_quantization", R = {};
|
|
149
149
|
R[Ce] = T.NEAREST;
|
|
150
150
|
R[Ue] = T.NEAREST_MIPMAP_NEAREST;
|
|
151
151
|
R[Fe] = T.NEAREST_MIPMAP_LINEAR;
|
|
@@ -160,7 +160,7 @@ const se = {
|
|
|
160
160
|
position: "translation",
|
|
161
161
|
quaternion: "rotation",
|
|
162
162
|
morphTargetInfluences: "weights"
|
|
163
|
-
}, Ve = new _e(), ne = 12, Ye = 1179937895,
|
|
163
|
+
}, Ve = new _e(), ne = 12, Ye = 1179937895, Ke = 2, ie = 8, We = 1313821514, je = 5130562;
|
|
164
164
|
function P(n, e) {
|
|
165
165
|
return n.length === e.length && n.every(function(s, t) {
|
|
166
166
|
return s === e[t];
|
|
@@ -184,11 +184,11 @@ function qe(n, e, s) {
|
|
|
184
184
|
}
|
|
185
185
|
return t;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function xe(n) {
|
|
188
188
|
return Math.ceil(n / 4) * 4;
|
|
189
189
|
}
|
|
190
190
|
function X(n, e = 0) {
|
|
191
|
-
const s =
|
|
191
|
+
const s = xe(n.byteLength);
|
|
192
192
|
if (s !== n.byteLength) {
|
|
193
193
|
const t = new Uint8Array(s);
|
|
194
194
|
if (t.set(new Uint8Array(n)), e !== 0)
|
|
@@ -252,11 +252,11 @@ class Je {
|
|
|
252
252
|
const x = new FileReader();
|
|
253
253
|
x.readAsArrayBuffer(u), x.onloadend = function() {
|
|
254
254
|
const f = X(x.result), h = new DataView(new ArrayBuffer(ie));
|
|
255
|
-
h.setUint32(0, f.byteLength, !0), h.setUint32(4,
|
|
255
|
+
h.setUint32(0, f.byteLength, !0), h.setUint32(4, je, !0);
|
|
256
256
|
const d = X(Xe(JSON.stringify(o)), 32), g = new DataView(new ArrayBuffer(ie));
|
|
257
|
-
g.setUint32(0, d.byteLength, !0), g.setUint32(4,
|
|
257
|
+
g.setUint32(0, d.byteLength, !0), g.setUint32(4, We, !0);
|
|
258
258
|
const y = new ArrayBuffer(ne), _ = new DataView(y);
|
|
259
|
-
_.setUint32(0, Ye, !0), _.setUint32(4,
|
|
259
|
+
_.setUint32(0, Ye, !0), _.setUint32(4, Ke, !0);
|
|
260
260
|
const D = ne + g.byteLength + d.byteLength + h.byteLength + f.byteLength;
|
|
261
261
|
_.setUint32(8, D, !0);
|
|
262
262
|
const m = new Blob([
|
|
@@ -362,7 +362,7 @@ class Je {
|
|
|
362
362
|
return d;
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
-
console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), e instanceof
|
|
365
|
+
console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), e instanceof K && (e = z(e)), s instanceof K && (s = z(s));
|
|
366
366
|
const i = e ? e.image : null, r = s ? s.image : null, o = Math.max(i ? i.width : 0, r ? r.width : 0), a = Math.max(i ? i.height : 0, r ? r.height : 0), c = re();
|
|
367
367
|
c.width = o, c.height = a;
|
|
368
368
|
const u = c.getContext("2d");
|
|
@@ -382,7 +382,7 @@ class Je {
|
|
|
382
382
|
}
|
|
383
383
|
u.putImageData(p, 0, 0);
|
|
384
384
|
const x = (e || s).clone();
|
|
385
|
-
return x.source = new Ne(c), x.colorSpace =
|
|
385
|
+
return x.source = new Ne(c), x.colorSpace = pe, x.channel = (e || s).channel, e && s && e.channel !== s.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), x;
|
|
386
386
|
}
|
|
387
387
|
/**
|
|
388
388
|
* Process a buffer to append to the default one.
|
|
@@ -420,7 +420,7 @@ class Je {
|
|
|
420
420
|
}
|
|
421
421
|
let c = e.itemSize * a;
|
|
422
422
|
r === T.ARRAY_BUFFER && (c = Math.ceil(c / 4) * 4);
|
|
423
|
-
const u =
|
|
423
|
+
const u = xe(i * c), p = new DataView(new ArrayBuffer(u));
|
|
424
424
|
let l = 0;
|
|
425
425
|
for (let h = t; h < t + i; h++) {
|
|
426
426
|
for (let d = 0; d < e.itemSize; d++) {
|
|
@@ -526,7 +526,7 @@ class Je {
|
|
|
526
526
|
f.width = Math.min(e.width, c.maxTextureSize), f.height = Math.min(e.height, c.maxTextureSize);
|
|
527
527
|
const h = f.getContext("2d");
|
|
528
528
|
if (t === !0 && (h.translate(0, f.height), h.scale(1, -1)), e.data !== void 0) {
|
|
529
|
-
s !==
|
|
529
|
+
s !== ve && 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);
|
|
530
530
|
const g = new Uint8ClampedArray(e.height * e.width * 4);
|
|
531
531
|
for (let y = 0; y < g.length; y += 4)
|
|
532
532
|
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];
|
|
@@ -573,7 +573,7 @@ class Je {
|
|
|
573
573
|
processTexture(e) {
|
|
574
574
|
const t = this.options, i = this.cache, r = this.json;
|
|
575
575
|
if (i.textures.has(e)) return i.textures.get(e);
|
|
576
|
-
r.textures || (r.textures = []), e instanceof
|
|
576
|
+
r.textures || (r.textures = []), e instanceof K && (e = z(e, t.maxTextureSize));
|
|
577
577
|
let o = e.userData.mimeType;
|
|
578
578
|
o === "image/webp" && (o = "image/png");
|
|
579
579
|
const a = {
|
|
@@ -638,7 +638,7 @@ class Je {
|
|
|
638
638
|
};
|
|
639
639
|
e.aoMapIntensity !== 1 && (a.strength = e.aoMapIntensity), this.applyTextureTransform(a, e.aoMap), i.occlusionTexture = a;
|
|
640
640
|
}
|
|
641
|
-
e.transparent ? i.alphaMode = "BLEND" : e.alphaTest > 0 && (i.alphaMode = "MASK", i.alphaCutoff = e.alphaTest), e.side ===
|
|
641
|
+
e.transparent ? i.alphaMode = "BLEND" : e.alphaTest > 0 && (i.alphaMode = "MASK", i.alphaCutoff = e.alphaTest), e.side === he && (i.doubleSided = !0), e.name !== "" && (i.name = e.name), this.serializeUserData(e, i), this._invokeAll(function(a) {
|
|
642
642
|
a.writeMaterial && a.writeMaterial(e, i);
|
|
643
643
|
});
|
|
644
644
|
const o = t.materials.push(i) - 1;
|
|
@@ -681,9 +681,9 @@ class Je {
|
|
|
681
681
|
}
|
|
682
682
|
h = null;
|
|
683
683
|
const A = M.array;
|
|
684
|
-
m === "JOINTS_0" && !(A instanceof Uint16Array) && !(A instanceof Uint8Array) && (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), h = new
|
|
685
|
-
const
|
|
686
|
-
|
|
684
|
+
m === "JOINTS_0" && !(A instanceof Uint16Array) && !(A instanceof Uint8Array) && (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), h = new v(new Uint16Array(A), M.itemSize, M.normalized));
|
|
685
|
+
const b = this.processAccessor(h || M, o);
|
|
686
|
+
b !== null && (m.startsWith("_") || this.detectMeshQuantization(m, M), u[m] = b, s.attributes.set(this.getUID(M), b));
|
|
687
687
|
}
|
|
688
688
|
if (f !== void 0 && o.setAttribute("normal", f), Object.keys(u).length === 0) return null;
|
|
689
689
|
if (e.morphTargetInfluences !== void 0 && e.morphTargetInfluences.length > 0) {
|
|
@@ -692,7 +692,7 @@ class Je {
|
|
|
692
692
|
for (const A in e.morphTargetDictionary)
|
|
693
693
|
E[e.morphTargetDictionary[A]] = A;
|
|
694
694
|
for (let A = 0; A < e.morphTargetInfluences.length; ++A) {
|
|
695
|
-
const
|
|
695
|
+
const b = {};
|
|
696
696
|
let ee = !1;
|
|
697
697
|
for (const U in o.morphAttributes) {
|
|
698
698
|
if (U !== "position" && U !== "normal") {
|
|
@@ -701,17 +701,17 @@ class Je {
|
|
|
701
701
|
}
|
|
702
702
|
const S = o.morphAttributes[U][A], V = U.toUpperCase(), F = o.attributes[U];
|
|
703
703
|
if (s.attributes.has(this.getUID(S, !0))) {
|
|
704
|
-
|
|
704
|
+
b[V] = s.attributes.get(this.getUID(S, !0));
|
|
705
705
|
continue;
|
|
706
706
|
}
|
|
707
707
|
const $ = S.clone();
|
|
708
708
|
if (!o.morphTargetsRelative)
|
|
709
|
-
for (let
|
|
710
|
-
for (let
|
|
711
|
-
|
|
712
|
-
|
|
709
|
+
for (let I = 0, Te = S.count; I < Te; I++)
|
|
710
|
+
for (let L = 0; L < S.itemSize; L++)
|
|
711
|
+
L === 0 && $.setX(I, S.getX(I) - F.getX(I)), L === 1 && $.setY(I, S.getY(I) - F.getY(I)), L === 2 && $.setZ(I, S.getZ(I) - F.getZ(I)), L === 3 && $.setW(I, S.getW(I) - F.getW(I));
|
|
712
|
+
b[V] = this.processAccessor($, o), s.attributes.set(this.getUID(F, !0), b[V]);
|
|
713
713
|
}
|
|
714
|
-
l.push(
|
|
714
|
+
l.push(b), m.push(e.morphTargetInfluences[A]), e.morphTargetDictionary !== void 0 && M.push(E[A]);
|
|
715
715
|
}
|
|
716
716
|
c.weights = m, M.length > 0 && (c.extras = {}, c.extras.targetNames = M);
|
|
717
717
|
}
|
|
@@ -731,8 +731,8 @@ class Je {
|
|
|
731
731
|
attributes: u
|
|
732
732
|
};
|
|
733
733
|
if (this.serializeUserData(o, E), l.length > 0 && (E.targets = l), o.index !== null) {
|
|
734
|
-
let
|
|
735
|
-
(_[m].start !== void 0 || _[m].count !== void 0) && (
|
|
734
|
+
let b = this.getUID(o.index);
|
|
735
|
+
(_[m].start !== void 0 || _[m].count !== void 0) && (b += ":" + _[m].start + ":" + _[m].count), s.attributes.has(b) ? E.indices = s.attributes.get(b) : (E.indices = this.processAccessor(o.index, o, _[m].start, _[m].count), s.attributes.set(b, E.indices)), E.indices === null && delete E.indices;
|
|
736
736
|
}
|
|
737
737
|
const A = this.processMaterial(y[_[m].materialIndex]);
|
|
738
738
|
A !== null && (E.material = A), p.push(E);
|
|
@@ -755,7 +755,7 @@ class Je {
|
|
|
755
755
|
* @param {THREE.BufferAttribute} attribute
|
|
756
756
|
*/
|
|
757
757
|
detectMeshQuantization(e, s) {
|
|
758
|
-
if (this.extensionsUsed[
|
|
758
|
+
if (this.extensionsUsed[j]) return;
|
|
759
759
|
let t;
|
|
760
760
|
switch (s.array.constructor) {
|
|
761
761
|
case Int8Array:
|
|
@@ -775,7 +775,7 @@ class Je {
|
|
|
775
775
|
}
|
|
776
776
|
s.normalized && (t += " normalized");
|
|
777
777
|
const i = e.split("_", 1)[0];
|
|
778
|
-
te[i] && te[i].includes(t) && (this.extensionsUsed[
|
|
778
|
+
te[i] && te[i].includes(t) && (this.extensionsUsed[j] = !0, this.extensionsRequired[j] = !0);
|
|
779
779
|
}
|
|
780
780
|
/**
|
|
781
781
|
* Process camera
|
|
@@ -824,9 +824,9 @@ class Je {
|
|
|
824
824
|
let h = u.values.length / u.times.length;
|
|
825
825
|
x === se.morphTargetInfluences && (h /= l.morphTargetInfluences.length);
|
|
826
826
|
let d;
|
|
827
|
-
u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (d = "CUBICSPLINE", h /= 3) : u.getInterpolation() ===
|
|
828
|
-
input: this.processAccessor(new
|
|
829
|
-
output: this.processAccessor(new
|
|
827
|
+
u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (d = "CUBICSPLINE", h /= 3) : u.getInterpolation() === Le ? d = "STEP" : d = "LINEAR", a.push({
|
|
828
|
+
input: this.processAccessor(new v(u.times, f)),
|
|
829
|
+
output: this.processAccessor(new v(u.values, h)),
|
|
830
830
|
interpolation: d
|
|
831
831
|
}), o.push({
|
|
832
832
|
sampler: a.length - 1,
|
|
@@ -851,11 +851,11 @@ class Je {
|
|
|
851
851
|
if (r === void 0) return null;
|
|
852
852
|
const o = e.skeleton.bones[0];
|
|
853
853
|
if (o === void 0) return null;
|
|
854
|
-
const a = [], c = new Float32Array(r.bones.length * 16), u = new
|
|
854
|
+
const a = [], c = new Float32Array(r.bones.length * 16), u = new fe();
|
|
855
855
|
for (let l = 0; l < r.bones.length; ++l)
|
|
856
856
|
a.push(t.get(r.bones[l])), u.copy(r.boneInverses[l]), u.multiply(e.bindMatrix).toArray(c, l * 16);
|
|
857
857
|
return s.skins === void 0 && (s.skins = []), s.skins.push({
|
|
858
|
-
inverseBindMatrices: this.processAccessor(new
|
|
858
|
+
inverseBindMatrices: this.processAccessor(new v(c, 16)),
|
|
859
859
|
joints: a,
|
|
860
860
|
skeleton: t.get(o)
|
|
861
861
|
}), i.skin = s.skins.length - 1;
|
|
@@ -1170,13 +1170,13 @@ class ft {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
writeNode(e, s) {
|
|
1172
1172
|
if (!e.isInstancedMesh) return;
|
|
1173
|
-
const t = this.writer, i = e, r = new Float32Array(i.count * 3), o = new Float32Array(i.count * 4), a = new Float32Array(i.count * 3), c = new
|
|
1173
|
+
const t = this.writer, i = e, r = new Float32Array(i.count * 3), o = new Float32Array(i.count * 4), a = new Float32Array(i.count * 3), c = new fe(), u = new B(), p = new Se(), l = new B();
|
|
1174
1174
|
for (let f = 0; f < i.count; f++)
|
|
1175
1175
|
i.getMatrixAt(f, c), c.decompose(u, p, l), u.toArray(r, f * 3), p.toArray(o, f * 4), l.toArray(a, f * 3);
|
|
1176
1176
|
const x = {
|
|
1177
|
-
TRANSLATION: t.processAccessor(new
|
|
1178
|
-
ROTATION: t.processAccessor(new
|
|
1179
|
-
SCALE: t.processAccessor(new
|
|
1177
|
+
TRANSLATION: t.processAccessor(new v(r, 3)),
|
|
1178
|
+
ROTATION: t.processAccessor(new v(o, 4)),
|
|
1179
|
+
SCALE: t.processAccessor(new v(a, 3))
|
|
1180
1180
|
};
|
|
1181
1181
|
i.instanceColor && (x._COLOR_0 = t.processAccessor(i.instanceColor)), s.extensions = s.extensions || {}, s.extensions[this.name] = { attributes: x }, t.extensionsUsed[this.name] = !0, t.extensionsRequired[this.name] = !0;
|
|
1182
1182
|
}
|
|
@@ -1257,7 +1257,7 @@ class pt {
|
|
|
1257
1257
|
}, s);
|
|
1258
1258
|
const t = {}, i = "model.usda";
|
|
1259
1259
|
t[i] = null;
|
|
1260
|
-
let r =
|
|
1260
|
+
let r = ge();
|
|
1261
1261
|
r += dt(s);
|
|
1262
1262
|
const o = {}, a = {};
|
|
1263
1263
|
e.traverseVisible((u) => {
|
|
@@ -1273,7 +1273,7 @@ class pt {
|
|
|
1273
1273
|
} else
|
|
1274
1274
|
console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)", u);
|
|
1275
1275
|
} else u.isCamera && (r += _t(u));
|
|
1276
|
-
}), r += xt(), r +=
|
|
1276
|
+
}), r += xt(), r += It(o, a, s.quickLookCompatible), t[i] = de(r), r = null;
|
|
1277
1277
|
for (const u in a) {
|
|
1278
1278
|
let p = a[u];
|
|
1279
1279
|
p.isCompressedTexture === !0 && (p = z(p));
|
|
@@ -1304,7 +1304,7 @@ function ht(n, e, s) {
|
|
|
1304
1304
|
throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.");
|
|
1305
1305
|
}
|
|
1306
1306
|
const w = 7;
|
|
1307
|
-
function
|
|
1307
|
+
function ge() {
|
|
1308
1308
|
return `#usda 1.0
|
|
1309
1309
|
(
|
|
1310
1310
|
customLayerData = {
|
|
@@ -1346,11 +1346,11 @@ function xt() {
|
|
|
1346
1346
|
`;
|
|
1347
1347
|
}
|
|
1348
1348
|
function gt(n) {
|
|
1349
|
-
let e =
|
|
1350
|
-
return e += n,
|
|
1349
|
+
let e = ge();
|
|
1350
|
+
return e += n, de(e);
|
|
1351
1351
|
}
|
|
1352
1352
|
function mt(n, e, s) {
|
|
1353
|
-
const t = "Object_" + n.id, i =
|
|
1353
|
+
const t = "Object_" + n.id, i = me(n.matrixWorld);
|
|
1354
1354
|
return n.matrixWorld.determinant() < 0 && console.warn("THREE.USDZExporter: USDZ does not support negative scales", n), `def Xform "${t}" (
|
|
1355
1355
|
prepend references = @./geometries/Geometry_${e.id}.usda@</Geometry>
|
|
1356
1356
|
prepend apiSchemas = ["MaterialBindingAPI"]
|
|
@@ -1364,7 +1364,7 @@ function mt(n, e, s) {
|
|
|
1364
1364
|
|
|
1365
1365
|
`;
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1367
|
+
function me(n) {
|
|
1368
1368
|
const e = n.elements;
|
|
1369
1369
|
return `( ${k(e, 0)}, ${k(e, 4)}, ${k(e, 8)}, ${k(e, 12)} )`;
|
|
1370
1370
|
}
|
|
@@ -1448,11 +1448,11 @@ function At(n) {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
return e;
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function It(n, e, s = !1) {
|
|
1452
1452
|
const t = [];
|
|
1453
1453
|
for (const i in n) {
|
|
1454
1454
|
const r = n[i];
|
|
1455
|
-
t.push(
|
|
1455
|
+
t.push(bt(r, e, s));
|
|
1456
1456
|
}
|
|
1457
1457
|
return `def "Materials"
|
|
1458
1458
|
{
|
|
@@ -1461,7 +1461,7 @@ ${t.join("")}
|
|
|
1461
1461
|
|
|
1462
1462
|
`;
|
|
1463
1463
|
}
|
|
1464
|
-
function
|
|
1464
|
+
function bt(n, e, s = !1) {
|
|
1465
1465
|
const t = " ", i = [], r = [];
|
|
1466
1466
|
function o(a, c, u) {
|
|
1467
1467
|
const p = a.source.id + "_" + a.flipY;
|
|
@@ -1499,7 +1499,7 @@ function It(n, e, s = !1) {
|
|
|
1499
1499
|
asset inputs:file = @textures/Texture_${p}.png@
|
|
1500
1500
|
float2 inputs:st.connect = </Materials/Material_${n.id}/Transform2d_${c}.outputs:result>
|
|
1501
1501
|
${u !== void 0 ? "float4 inputs:scale = " + Rt(u) : ""}
|
|
1502
|
-
token inputs:sourceColorSpace = "${a.colorSpace ===
|
|
1502
|
+
token inputs:sourceColorSpace = "${a.colorSpace === pe ? "raw" : "sRGB"}"
|
|
1503
1503
|
token inputs:wrapS = "${x[a.wrapS]}"
|
|
1504
1504
|
token inputs:wrapT = "${x[a.wrapT]}"
|
|
1505
1505
|
float outputs:r
|
|
@@ -1509,7 +1509,7 @@ function It(n, e, s = !1) {
|
|
|
1509
1509
|
${n.transparent || n.alphaTest > 0 ? "float outputs:a" : ""}
|
|
1510
1510
|
}`;
|
|
1511
1511
|
}
|
|
1512
|
-
return n.side ===
|
|
1512
|
+
return n.side === he && console.warn("THREE.USDZExporter: USDZ does not support double sided materials", n), n.map !== null ? (i.push(`${t}color3f inputs:diffuseColor.connect = </Materials/Material_${n.id}/Texture_${n.map.id}_diffuse.outputs:rgb>`), n.transparent ? i.push(`${t}float inputs:opacity.connect = </Materials/Material_${n.id}/Texture_${n.map.id}_diffuse.outputs:a>`) : n.alphaTest > 0 && (i.push(`${t}float inputs:opacity.connect = </Materials/Material_${n.id}/Texture_${n.map.id}_diffuse.outputs:a>`), i.push(`${t}float inputs:opacityThreshold = ${n.alphaTest}`)), r.push(o(n.map, "diffuse", n.color))) : i.push(`${t}color3f inputs:diffuseColor = ${ae(n.color)}`), n.emissiveMap !== null ? (i.push(`${t}color3f inputs:emissiveColor.connect = </Materials/Material_${n.id}/Texture_${n.emissiveMap.id}_emissive.outputs:rgb>`), r.push(o(n.emissiveMap, "emissive"))) : n.emissive.getHex() > 0 && i.push(`${t}color3f inputs:emissiveColor = ${ae(n.emissive)}`), n.normalMap !== null && (i.push(`${t}normal3f inputs:normal.connect = </Materials/Material_${n.id}/Texture_${n.normalMap.id}_normal.outputs:rgb>`), r.push(o(n.normalMap, "normal"))), n.aoMap !== null && (i.push(`${t}float inputs:occlusion.connect = </Materials/Material_${n.id}/Texture_${n.aoMap.id}_occlusion.outputs:r>`), r.push(o(n.aoMap, "occlusion"))), n.roughnessMap !== null && n.roughness === 1 ? (i.push(`${t}float inputs:roughness.connect = </Materials/Material_${n.id}/Texture_${n.roughnessMap.id}_roughness.outputs:g>`), r.push(o(n.roughnessMap, "roughness"))) : i.push(`${t}float inputs:roughness = ${n.roughness}`), n.metalnessMap !== null && n.metalness === 1 ? (i.push(`${t}float inputs:metallic.connect = </Materials/Material_${n.id}/Texture_${n.metalnessMap.id}_metallic.outputs:b>`), r.push(o(n.metalnessMap, "metallic"))) : i.push(`${t}float inputs:metallic = ${n.metalness}`), n.alphaMap !== null ? (i.push(`${t}float inputs:opacity.connect = </Materials/Material_${n.id}/Texture_${n.alphaMap.id}_opacity.outputs:r>`), i.push(`${t}float inputs:opacityThreshold = 0.0001`), r.push(o(n.alphaMap, "opacity"))) : i.push(`${t}float inputs:opacity = ${n.opacity}`), n.isMeshPhysicalMaterial && (i.push(`${t}float inputs:clearcoat = ${n.clearcoat}`), i.push(`${t}float inputs:clearcoatRoughness = ${n.clearcoatRoughness}`), i.push(`${t}float inputs:ior = ${n.ior}`)), `
|
|
1513
1513
|
def Material "Material_${n.id}"
|
|
1514
1514
|
{
|
|
1515
1515
|
def Shader "PreviewSurface"
|
|
@@ -1539,7 +1539,7 @@ function ce(n) {
|
|
|
1539
1539
|
return `(${n.x}, ${n.y})`;
|
|
1540
1540
|
}
|
|
1541
1541
|
function _t(n) {
|
|
1542
|
-
const e = n.name ? n.name : "Camera_" + n.id, s =
|
|
1542
|
+
const e = n.name ? n.name : "Camera_" + n.id, s = me(n.matrixWorld);
|
|
1543
1543
|
return n.matrixWorld.determinant() < 0 && console.warn("THREE.USDZExporter: USDZ does not support negative scales", n), n.isOrthographicCamera ? `def Camera "${e}"
|
|
1544
1544
|
{
|
|
1545
1545
|
matrix4d xformOp:transform = ${s}
|
|
@@ -1573,7 +1573,7 @@ class Ct {
|
|
|
1573
1573
|
this._gltfExporter = new Q(), this._usdzExporter = new pt();
|
|
1574
1574
|
}
|
|
1575
1575
|
async export(e, s, t) {
|
|
1576
|
-
switch (s) {
|
|
1576
|
+
switch (this._computeNormals(e), s) {
|
|
1577
1577
|
case "glb":
|
|
1578
1578
|
return this._exportGlb(e, t);
|
|
1579
1579
|
case "gltf":
|
|
@@ -1587,6 +1587,7 @@ class Ct {
|
|
|
1587
1587
|
async _exportGlb(e, s) {
|
|
1588
1588
|
try {
|
|
1589
1589
|
const t = await this._gltfExporter.parseAsync(e, {
|
|
1590
|
+
animations: e.animations.length > 0 ? e.animations : void 0,
|
|
1590
1591
|
...s,
|
|
1591
1592
|
binary: !0
|
|
1592
1593
|
});
|
|
@@ -1600,6 +1601,7 @@ class Ct {
|
|
|
1600
1601
|
async _exportGltf(e, s) {
|
|
1601
1602
|
try {
|
|
1602
1603
|
const t = await this._gltfExporter.parseAsync(e, {
|
|
1604
|
+
animations: e.animations.length > 0 ? e.animations : void 0,
|
|
1603
1605
|
...s,
|
|
1604
1606
|
binary: !1
|
|
1605
1607
|
}), i = JSON.stringify(t);
|
|
@@ -1615,6 +1617,11 @@ class Ct {
|
|
|
1615
1617
|
throw t instanceof N ? t : new N("Failed to export USDZ", t);
|
|
1616
1618
|
}
|
|
1617
1619
|
}
|
|
1620
|
+
_computeNormals(e) {
|
|
1621
|
+
e.traverse((s) => {
|
|
1622
|
+
s instanceof le && s.geometry && (s.geometry.getAttribute("normal") || s.geometry.computeVertexNormals());
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1618
1625
|
}
|
|
1619
1626
|
export {
|
|
1620
1627
|
Ct as A
|