@shopware-ag/dive 2.2.33 → 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-DITWKcA3.cjs → AssetCache-BZhTsybC.cjs} +1 -1
- package/build/chunks/{AssetCache-Bf5zeBf8.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-C_jb3yoa.mjs → AssetLoader-Dcr75VNw.mjs} +20 -12
- package/build/chunks/{AssetLoader-Bzy-S1g6.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-BZhCMKod.cjs → FileTypes-35x8Ekp6.cjs} +2 -2
- package/build/chunks/{FileTypes-G8UMidQm.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-DmYBJKl4.cjs → isFileTypeSupported-BmjxgShb.cjs} +1 -1
- package/build/chunks/{isFileTypeSupported-Dm54ZeVd.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var HA = Object.defineProperty;
|
|
2
2
|
var qA = (h, g, A) => g in h ? HA(h, g, { enumerable: !0, configurable: !0, writable: !0, value: A }) : h[g] = A;
|
|
3
3
|
var e = (h, g, A) => qA(h, typeof g != "symbol" ? g + "" : g, A);
|
|
4
|
-
import { DataTextureLoader as dA, HalfFloatType as j, FloatType as U, DataUtils as
|
|
4
|
+
import { DataTextureLoader as dA, HalfFloatType as j, FloatType as U, DataUtils as k, LinearSRGBColorSpace as CA, LinearFilter as hA, PMREMGenerator as aA, Scene as wA, SphereGeometry as S, MeshBasicMaterial as iA, BackSide as YA, Mesh as Z, NoToneMapping as bA, WebGLCubeRenderTarget as yA, CubeCamera as OA, EquirectangularReflectionMapping as MA, WebGLRenderer as LA, PCFSoftShadowMap as FA, PCFShadowMap as XA, BasicShadowMap as jA, SRGBColorSpace as EA, LinearToneMapping as ZA, MathUtils as eA, Object3D as O, AmbientLight as QA, PointLight as WA, FrontSide as uA, HemisphereLight as NA, DirectionalLight as kA, Vector3 as w, Box3 as y, Box3Helper as xA, Sphere as TA, MeshStandardMaterial as gA, Raycaster as JA, CylinderGeometry as SA, BufferGeometry as GA, BufferAttribute as rA, BoxGeometry as $, ConeGeometry as _A, LineDashedMaterial as VA, Line as RA, PlaneGeometry as UA, Color as J, GridHelper as $A, TOUCH as l, MOUSE as K, EventDispatcher as Ai, Spherical as BA, Vector2 as G, Quaternion as cA } from "three";
|
|
5
5
|
import { P as v, U as ii, H as ei, a as gi, D as PA } from "./PerspectiveCamera-BFzE2TQU.mjs";
|
|
6
6
|
class ti {
|
|
7
7
|
constructor() {
|
|
@@ -56,12 +56,12 @@ class oi extends dA {
|
|
|
56
56
|
}, Q = `
|
|
57
57
|
`, q = function(n, a, c) {
|
|
58
58
|
a = a || 1024;
|
|
59
|
-
let
|
|
60
|
-
for (; 0 > (
|
|
61
|
-
C += r, f += r.length,
|
|
62
|
-
return -1 <
|
|
59
|
+
let z = n.pos, I = -1, f = 0, C = "", r = String.fromCharCode.apply(null, new Uint16Array(n.subarray(z, z + 128)));
|
|
60
|
+
for (; 0 > (I = r.indexOf(Q)) && f < a && z < n.byteLength; )
|
|
61
|
+
C += r, f += r.length, z += 128, r += String.fromCharCode.apply(null, new Uint16Array(n.subarray(z, z + 128)));
|
|
62
|
+
return -1 < I ? (n.pos += f + I + 1, C + r.slice(0, I)) : !1;
|
|
63
63
|
}, M = function(n) {
|
|
64
|
-
const a = /^#\?(\S+)/, c = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, P = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,
|
|
64
|
+
const a = /^#\?(\S+)/, c = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, P = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, z = /^\s*FORMAT=(\S+)\s*$/, I = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, f = {
|
|
65
65
|
valid: 0,
|
|
66
66
|
/* indicate which fields are valid */
|
|
67
67
|
string: "",
|
|
@@ -89,7 +89,7 @@ class oi extends dA {
|
|
|
89
89
|
`;
|
|
90
90
|
continue;
|
|
91
91
|
}
|
|
92
|
-
if ((r = C.match(c)) && (f.gamma = parseFloat(r[1])), (r = C.match(P)) && (f.exposure = parseFloat(r[1])), (r = C.match(
|
|
92
|
+
if ((r = C.match(c)) && (f.gamma = parseFloat(r[1])), (r = C.match(P)) && (f.exposure = parseFloat(r[1])), (r = C.match(z)) && (f.valid |= 2, f.format = r[1]), (r = C.match(I)) && (f.valid |= 4, f.height = parseInt(r[1], 10), f.width = parseInt(r[2], 10)), f.valid & 2 && f.valid & 4) break;
|
|
93
93
|
}
|
|
94
94
|
return f.valid & 2 || s(3, "missing format specifier"), f.valid & 4 || s(3, "missing image size specifier"), f;
|
|
95
95
|
}, d = function(n, a, c) {
|
|
@@ -101,9 +101,9 @@ class oi extends dA {
|
|
|
101
101
|
)
|
|
102
102
|
return new Uint8Array(n);
|
|
103
103
|
P !== (n[2] << 8 | n[3]) && s(3, "wrong scanline width");
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
let
|
|
104
|
+
const z = new Uint8Array(4 * a * c);
|
|
105
|
+
z.length || s(4, "unable to allocate buffer space");
|
|
106
|
+
let I = 0, f = 0;
|
|
107
107
|
const C = 4 * P, r = new Uint8Array(4), b = new Uint8Array(C);
|
|
108
108
|
let nA = c;
|
|
109
109
|
for (; nA > 0 && f < n.byteLength; ) {
|
|
@@ -122,34 +122,34 @@ class oi extends dA {
|
|
|
122
122
|
const vA = P;
|
|
123
123
|
for (let m = 0; m < vA; m++) {
|
|
124
124
|
let p = 0;
|
|
125
|
-
I
|
|
125
|
+
z[I] = b[m + p], p += P, z[I + 1] = b[m + p], p += P, z[I + 2] = b[m + p], p += P, z[I + 3] = b[m + p], I += 4;
|
|
126
126
|
}
|
|
127
127
|
nA--;
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return z;
|
|
130
130
|
}, W = function(n, a, c, P) {
|
|
131
|
-
const
|
|
132
|
-
c[P + 0] = n[a + 0] *
|
|
131
|
+
const z = n[a + 3], I = Math.pow(2, z - 128) / 255;
|
|
132
|
+
c[P + 0] = n[a + 0] * I, c[P + 1] = n[a + 1] * I, c[P + 2] = n[a + 2] * I, c[P + 3] = 1;
|
|
133
133
|
}, _ = function(n, a, c, P) {
|
|
134
|
-
const
|
|
135
|
-
c[P + 0] =
|
|
134
|
+
const z = n[a + 3], I = Math.pow(2, z - 128) / 255;
|
|
135
|
+
c[P + 0] = k.toHalfFloat(Math.min(n[a + 0] * I, 65504)), c[P + 1] = k.toHalfFloat(Math.min(n[a + 1] * I, 65504)), c[P + 2] = k.toHalfFloat(Math.min(n[a + 2] * I, 65504)), c[P + 3] = k.toHalfFloat(1);
|
|
136
136
|
}, L = new Uint8Array(g);
|
|
137
137
|
L.pos = 0;
|
|
138
|
-
const F = M(L), oA = F.width, sA = F.height,
|
|
138
|
+
const F = M(L), oA = F.width, sA = F.height, N = d(L.subarray(L.pos), oA, sA);
|
|
139
139
|
let V, R, Y;
|
|
140
140
|
switch (this.type) {
|
|
141
141
|
case U:
|
|
142
|
-
Y =
|
|
142
|
+
Y = N.length / 4;
|
|
143
143
|
const n = new Float32Array(Y * 4);
|
|
144
144
|
for (let c = 0; c < Y; c++)
|
|
145
|
-
W(
|
|
145
|
+
W(N, c * 4, n, c * 4);
|
|
146
146
|
V = n, R = U;
|
|
147
147
|
break;
|
|
148
148
|
case j:
|
|
149
|
-
Y =
|
|
149
|
+
Y = N.length / 4;
|
|
150
150
|
const a = new Uint16Array(Y * 4);
|
|
151
151
|
for (let c = 0; c < Y; c++)
|
|
152
|
-
_(
|
|
152
|
+
_(N, c * 4, a, c * 4);
|
|
153
153
|
V = a, R = j;
|
|
154
154
|
break;
|
|
155
155
|
default:
|
|
@@ -369,8 +369,11 @@ class pA {
|
|
|
369
369
|
this._webglrenderer.dispose(), this._settings.canvas = g, this._webglrenderer = this._createWebGLRenderer(), this._environment.setRenderer(this._webglrenderer);
|
|
370
370
|
}
|
|
371
371
|
_createWebGLRenderer() {
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
var i;
|
|
373
|
+
const g = (i = this._settings.canvas) == null ? void 0 : i.getContext("webgl2");
|
|
374
|
+
g == null || g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL, !1), g == null || g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1);
|
|
375
|
+
const A = new LA(this._settings);
|
|
376
|
+
return A.shadowMap.enabled = this._settings.shadows, A.shadowMap.type = this._settings.shadowQuality === "high" ? FA : this._settings.shadowQuality === "medium" ? XA : jA, A.setPixelRatio(window.devicePixelRatio), A.outputColorSpace = EA, A.toneMapping = ZA, A.toneMappingExposure = 1, A;
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
379
|
const Hi = pA;
|
|
@@ -403,7 +406,7 @@ class fi {
|
|
|
403
406
|
}
|
|
404
407
|
}
|
|
405
408
|
}
|
|
406
|
-
class
|
|
409
|
+
class IA {
|
|
407
410
|
constructor(g, A, i) {
|
|
408
411
|
e(this, "isDIVEView", !0);
|
|
409
412
|
e(this, "uuid", eA.generateUUID());
|
|
@@ -536,7 +539,7 @@ class ri extends O {
|
|
|
536
539
|
e(this, "isSelectable", !0);
|
|
537
540
|
e(this, "_hemiLight");
|
|
538
541
|
e(this, "_dirLight");
|
|
539
|
-
this.name = "DIVESceneLight", this._hemiLight = new
|
|
542
|
+
this.name = "DIVESceneLight", this._hemiLight = new NA(16777215, 16777215, 2), this._hemiLight.layers.mask = v, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new kA(16777215, 3), this._dirLight.layers.mask = v, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
540
543
|
const A = 5;
|
|
541
544
|
this._dirLight.shadow.camera.left = -A, this._dirLight.shadow.camera.right = A, this._dirLight.shadow.camera.top = A, this._dirLight.shadow.camera.bottom = -A, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
542
545
|
}
|
|
@@ -775,7 +778,7 @@ class lA extends tA {
|
|
|
775
778
|
let i = null;
|
|
776
779
|
return A.traverse((t) => {
|
|
777
780
|
!i && t.userData.isDIVEModel && (i = t), t.castShadow = !0, t.receiveShadow = !0, t.layers.mask = this.layers.mask, this._boundingBox.expandByObject(t), !this._mesh && "isMesh" in t && (this._mesh = t, this._material ? this._mesh.material = this._material : this._material = t.material);
|
|
778
|
-
}), i || (i = A), this.position.copy(i.position), this.quaternion.copy(i.quaternion), this.scale.copy(i.scale), this.add(...i.children), this;
|
|
781
|
+
}), i || (i = A), this.position.copy(i.position), this.quaternion.copy(i.quaternion), this.scale.copy(i.scale), this.add(...i.children), this.animations = A.animations, this;
|
|
779
782
|
}
|
|
780
783
|
setMaterial(A) {
|
|
781
784
|
this._material || (this._material = new gA()), A.vertexColors !== void 0 && (this._material.vertexColors = A.vertexColors), A.color !== void 0 && this._material.color.set(A.color), A.map !== void 0 && (this._material.map = A.map), A.normalMap !== void 0 && (this._material.normalMap = A.normalMap), A.roughness !== void 0 && (this._material.roughness = A.roughness), A.roughnessMap !== void 0 && (this._material.roughnessMap = A.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), A.metalness !== void 0 && (this._material.metalness = A.metalness), A.metalnessMap !== void 0 && (this._material.metalnessMap = A.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
@@ -1095,7 +1098,7 @@ class Pi extends Z {
|
|
|
1095
1098
|
this.material.color = new J(A);
|
|
1096
1099
|
}
|
|
1097
1100
|
}
|
|
1098
|
-
class
|
|
1101
|
+
class Ii extends O {
|
|
1099
1102
|
constructor() {
|
|
1100
1103
|
super();
|
|
1101
1104
|
e(this, "isDIVERoot", !0);
|
|
@@ -1287,14 +1290,14 @@ class zi extends O {
|
|
|
1287
1290
|
return A.parent !== null ? this._findScene(A.parent) : A;
|
|
1288
1291
|
}
|
|
1289
1292
|
}
|
|
1290
|
-
const
|
|
1293
|
+
const zi = "#888888", Ci = "#dddddd";
|
|
1291
1294
|
class wi extends O {
|
|
1292
1295
|
constructor() {
|
|
1293
1296
|
super(), this.name = "Grid";
|
|
1294
1297
|
const g = new $A(
|
|
1295
1298
|
100,
|
|
1296
1299
|
100,
|
|
1297
|
-
|
|
1300
|
+
zi,
|
|
1298
1301
|
Ci
|
|
1299
1302
|
);
|
|
1300
1303
|
g.material.depthTest = !1, g.layers.mask = ei, this.add(g);
|
|
@@ -1316,7 +1319,7 @@ class ui extends wA {
|
|
|
1316
1319
|
e(this, "_grid");
|
|
1317
1320
|
this.setBackground(
|
|
1318
1321
|
(A == null ? void 0 : A.backgroundColor) ?? T.backgroundColor
|
|
1319
|
-
), this._root = new
|
|
1322
|
+
), this._root = new Ii(), this._root.floor.setVisibility(
|
|
1320
1323
|
(A == null ? void 0 : A.displayFloor) ?? T.displayFloor
|
|
1321
1324
|
), this.add(this._root), this._grid = new wi(), this._grid.setVisibility(
|
|
1322
1325
|
(A == null ? void 0 : A.displayGrid) ?? T.displayGrid
|
|
@@ -1896,7 +1899,7 @@ const Gi = {
|
|
|
1896
1899
|
}
|
|
1897
1900
|
};
|
|
1898
1901
|
e(E, "DEFAULT_ZOOM_FACTOR", 1);
|
|
1899
|
-
let
|
|
1902
|
+
let zA = E;
|
|
1900
1903
|
const Di = `
|
|
1901
1904
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
1902
1905
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
@@ -1958,7 +1961,7 @@ class mi {
|
|
|
1958
1961
|
displayGrid: (g == null ? void 0 : g.displayGrid) ?? x.displayGrid,
|
|
1959
1962
|
displayFloor: (g == null ? void 0 : g.displayFloor) ?? x.displayFloor
|
|
1960
1963
|
});
|
|
1961
|
-
const A = new
|
|
1964
|
+
const A = new IA(
|
|
1962
1965
|
this._scene,
|
|
1963
1966
|
new PA(),
|
|
1964
1967
|
this._settings
|
|
@@ -1972,7 +1975,7 @@ class mi {
|
|
|
1972
1975
|
), this._clock.addTicker(this._orientationDisplay);
|
|
1973
1976
|
}
|
|
1974
1977
|
), this._settings.autoStart && this.start(), console.log(
|
|
1975
|
-
"DIVE 2.
|
|
1978
|
+
"DIVE 2.3.0 initialized successfully!"
|
|
1976
1979
|
), console.log(Di), window.DIVE.instances.push(this);
|
|
1977
1980
|
}
|
|
1978
1981
|
/**
|
|
@@ -2040,7 +2043,7 @@ class mi {
|
|
|
2040
2043
|
* @deprecated This method will be removed in a future version. To create a new view, use `QuickView` instead.
|
|
2041
2044
|
*/
|
|
2042
2045
|
createView(g) {
|
|
2043
|
-
const A = new
|
|
2046
|
+
const A = new IA(
|
|
2044
2047
|
this._scene,
|
|
2045
2048
|
g ?? new PA(),
|
|
2046
2049
|
{
|
|
@@ -2094,8 +2097,8 @@ export {
|
|
|
2094
2097
|
AA as B,
|
|
2095
2098
|
x as D,
|
|
2096
2099
|
pi as F,
|
|
2097
|
-
|
|
2098
|
-
|
|
2100
|
+
zi as G,
|
|
2101
|
+
zA as O,
|
|
2099
2102
|
di as S,
|
|
2100
2103
|
Gi as a,
|
|
2101
2104
|
mi as b,
|
|
@@ -2115,11 +2118,11 @@ export {
|
|
|
2115
2118
|
pA as p,
|
|
2116
2119
|
mA as q,
|
|
2117
2120
|
fi as r,
|
|
2118
|
-
|
|
2121
|
+
Ii as s,
|
|
2119
2122
|
ui as t,
|
|
2120
2123
|
T as u,
|
|
2121
2124
|
ri as v,
|
|
2122
|
-
|
|
2125
|
+
IA as w,
|
|
2123
2126
|
Ci as x,
|
|
2124
2127
|
KA as y
|
|
2125
2128
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var d = (n, o, t) => o in n ? c(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
|
|
3
|
+
var s = (n, o, t) => d(n, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { Group as l, Tween as g, Easing as f } from "@tweenjs/tween.js";
|
|
5
|
+
import { A as y } from "./Animator-BGFdF70Z.mjs";
|
|
6
|
+
class v extends y {
|
|
7
|
+
constructor(t, i, h) {
|
|
8
|
+
super();
|
|
9
|
+
s(this, "_group", new l());
|
|
10
|
+
s(this, "_tweens", []);
|
|
11
|
+
s(this, "_snapshots", []);
|
|
12
|
+
s(this, "_state", "idle");
|
|
13
|
+
s(this, "_duration");
|
|
14
|
+
s(this, "_loop", "once");
|
|
15
|
+
s(this, "_options");
|
|
16
|
+
s(this, "_completedCount", 0);
|
|
17
|
+
this._duration = i, this._options = h;
|
|
18
|
+
const _ = Array.isArray(t) ? t : [t];
|
|
19
|
+
for (const r of _) {
|
|
20
|
+
const p = {};
|
|
21
|
+
for (const e of Object.keys(r.to))
|
|
22
|
+
p[e] = r.object[e];
|
|
23
|
+
this._snapshots.push({ object: r.object, values: p });
|
|
24
|
+
const u = new g(r.object, this._group).to(r.to, i).easing((h == null ? void 0 : h.easing) ?? f.Quadratic.Out).onUpdate(() => {
|
|
25
|
+
var e, a;
|
|
26
|
+
(a = (e = this._options) == null ? void 0 : e.onUpdate) == null || a.call(e), this.dispatchEvent({ type: "update", target: this });
|
|
27
|
+
}).onComplete(() => {
|
|
28
|
+
var e, a;
|
|
29
|
+
this._completedCount++, this._completedCount >= this._tweens.length && (this._state = "idle", (a = (e = this._options) == null ? void 0 : e.onComplete) == null || a.call(e), this.dispatchEvent({ type: "complete", target: this }));
|
|
30
|
+
});
|
|
31
|
+
this._tweens.push(u);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
get state() {
|
|
35
|
+
return this._state;
|
|
36
|
+
}
|
|
37
|
+
get duration() {
|
|
38
|
+
return this._duration;
|
|
39
|
+
}
|
|
40
|
+
get loop() {
|
|
41
|
+
return this._loop;
|
|
42
|
+
}
|
|
43
|
+
set loop(t) {
|
|
44
|
+
this._loop = t, this._tweens.forEach((i) => {
|
|
45
|
+
i.repeat(t === "once" ? 0 : 1 / 0), i.yoyo(t === "pingpong");
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
get time() {
|
|
49
|
+
return this._tweens.length > 0 ? this._tweens[0].getDuration() : 0;
|
|
50
|
+
}
|
|
51
|
+
set time(t) {
|
|
52
|
+
}
|
|
53
|
+
play() {
|
|
54
|
+
return this._tweens.forEach((t) => t.stop()), this._state = "playing", this._completedCount = 0, this._restoreSnapshots(), this._tweens.forEach((t) => t.start()), this.dispatchEvent({ type: "play", target: this }), this;
|
|
55
|
+
}
|
|
56
|
+
pause() {
|
|
57
|
+
return this._state = "paused", this._tweens.forEach((t) => t.pause()), this.dispatchEvent({ type: "pause", target: this }), this;
|
|
58
|
+
}
|
|
59
|
+
resume() {
|
|
60
|
+
return this._state = "playing", this._tweens.forEach((t) => t.resume()), this.dispatchEvent({ type: "resume", target: this }), this;
|
|
61
|
+
}
|
|
62
|
+
stop() {
|
|
63
|
+
return this._state = "idle", this._tweens.forEach((t) => t.stop()), this._restoreSnapshots(), this.dispatchEvent({ type: "stop", target: this }), this;
|
|
64
|
+
}
|
|
65
|
+
update() {
|
|
66
|
+
this._state !== "idle" && this._group.update();
|
|
67
|
+
}
|
|
68
|
+
_restoreSnapshots() {
|
|
69
|
+
for (const { object: t, values: i } of this._snapshots)
|
|
70
|
+
for (const h of Object.keys(i))
|
|
71
|
+
t[h] = i[h];
|
|
72
|
+
}
|
|
73
|
+
dispose() {
|
|
74
|
+
this._tweens.forEach((t) => t.stop()), this._tweens = [], this._group.removeAll(), this._state = "idle";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
v as TargetAnimator
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var d=(r,o,t)=>o in r?l(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t;var s=(r,o,t)=>d(r,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@tweenjs/tween.js"),g=require("./Animator-Cu7NIkVg.cjs");class y extends g.Animator{constructor(t,i,n){super();s(this,"_group",new p.Group);s(this,"_tweens",[]);s(this,"_snapshots",[]);s(this,"_state","idle");s(this,"_duration");s(this,"_loop","once");s(this,"_options");s(this,"_completedCount",0);this._duration=i,this._options=n;const u=Array.isArray(t)?t:[t];for(const h of u){const _={};for(const e of Object.keys(h.to))_[e]=h.object[e];this._snapshots.push({object:h.object,values:_});const c=new p.Tween(h.object,this._group).to(h.to,i).easing((n==null?void 0:n.easing)??p.Easing.Quadratic.Out).onUpdate(()=>{var e,a;(a=(e=this._options)==null?void 0:e.onUpdate)==null||a.call(e),this.dispatchEvent({type:"update",target:this})}).onComplete(()=>{var e,a;this._completedCount++,this._completedCount>=this._tweens.length&&(this._state="idle",(a=(e=this._options)==null?void 0:e.onComplete)==null||a.call(e),this.dispatchEvent({type:"complete",target:this}))});this._tweens.push(c)}}get state(){return this._state}get duration(){return this._duration}get loop(){return this._loop}set loop(t){this._loop=t,this._tweens.forEach(i=>{i.repeat(t==="once"?0:1/0),i.yoyo(t==="pingpong")})}get time(){return this._tweens.length>0?this._tweens[0].getDuration():0}set time(t){}play(){return this._tweens.forEach(t=>t.stop()),this._state="playing",this._completedCount=0,this._restoreSnapshots(),this._tweens.forEach(t=>t.start()),this.dispatchEvent({type:"play",target:this}),this}pause(){return this._state="paused",this._tweens.forEach(t=>t.pause()),this.dispatchEvent({type:"pause",target:this}),this}resume(){return this._state="playing",this._tweens.forEach(t=>t.resume()),this.dispatchEvent({type:"resume",target:this}),this}stop(){return this._state="idle",this._tweens.forEach(t=>t.stop()),this._restoreSnapshots(),this.dispatchEvent({type:"stop",target:this}),this}update(){this._state!=="idle"&&this._group.update()}_restoreSnapshots(){for(const{object:t,values:i}of this._snapshots)for(const n of Object.keys(i))t[n]=i[n]}dispose(){this._tweens.forEach(t=>t.stop()),this._tweens=[],this._group.removeAll(),this._state="idle"}}exports.TargetAnimator=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./FileTypes-
|
|
1
|
+
"use strict";const n=require("./FileTypes-35x8Ekp6.cjs");function o(e){var t;const i=e.split("/").pop()||"";return!i.includes(".")||i.endsWith(".")?"":((t=i.split(".").pop())==null?void 0:t.toLowerCase().split("?")[0])||""}function r(e){return e.toLowerCase()in n.FILE_TYPES}exports.getFileTypeFromUri=o;exports.isFileTypeSupported=r;
|
package/build/dive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var R=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>R(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./chunks/FileTypes-BZhCMKod.cjs"),u=require("./chunks/PerspectiveCamera-iAsZqrnY.cjs"),_=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),s=require("three"),V=require("./chunks/findInterface-C6mrvf_t.cjs"),y=require("./chunks/isFileTypeSupported-DmYBJKl4.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),A=require("./chunks/parse-error-Dy_EE4rL.cjs"),P=require("./chunks/PovSchema-Co9FznEz.cjs");class m extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const l=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const g=new s.TorusGeometry(t,.1,3,48,o),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function p(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function O(r,i=0){const e=p(r,+i);return p(Math.ceil(e),-i)}function v(r,i=0){const e=p(r,+i);return p(Math.floor(e),-i)}function x(r,i=0){if(r<0)return-x(-r,i);const e=p(r,+i);return p(Math.round(e),-i)}function H(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function z(r,i=0){const e=p(r,+i);return p(Math.round(e),-i).toFixed(i)}function G(r,i=0){const e=p(r,+i);return p(Math.trunc(e),-i)}function C(r){return(s.MathUtils.radToDeg(r)+360)%360}function L(r){return s.MathUtils.degToRad(r)}const S={ceilExp:O,floorExp:v,roundExp:x,toFixedExp:z,truncateExp:G,signedAngleTo:H,radToDeg:C,degToRad:L};class T extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new m("x",1,Math.PI/2,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new m("y",1,-Math.PI/2,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new m("z",1,Math.PI/2,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),l=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,l)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const l=new s.Mesh(a,this._lineMaterial);l.layers.mask=u.UI_LAYER_MASK,l.renderOrder=1/0,l.rotateX(Math.PI/2),l.translateY(t/2),this.add(l);const d=new s.CylinderGeometry(.1,.1,t,3),g=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class Y extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class M extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const l=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const g=new s.CylinderGeometry(.1,.1,t+a/2,3),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new M("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new M("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new M("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class N extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(l,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class F extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new Y(e),this._rotateGizmo=new T(e),this._scaleGizmo=new j(e),this._gizmoPlane=new N,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class U{constructor(){n(this,"isMovable",!0)}}class K{constructor(){n(this,"isSelectable",!0)}}function X(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function f(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let l=0;l<r.length;l++)a[l]=f(r[l],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[l,d]of r)a.set(f(l,i),f(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const l of r)a.add(f(l,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}return t}const I=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((l,d)=>{const g=I(o[d],h[d]);Object.keys(g).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=I(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function q(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.BoundingBox=c.BoundingBox;exports.DIVE=c.DIVE;exports.DIVEAmbientLight=c.DIVEAmbientLight;exports.DIVEClock=c.DIVEClock;exports.DIVEDefaultSettings=c.DIVEDefaultSettings;exports.DIVEEngine=c.DIVEEngine;exports.DIVEEnvironment=c.DIVEEnvironment;exports.DIVEEnvironmentDefaultSettings=c.DIVEEnvironmentDefaultSettings;exports.DIVEFloor=c.DIVEFloor;exports.DIVEGrid=c.DIVEGrid;exports.DIVEGroup=c.DIVEGroup;exports.DIVEModel=c.DIVEModel;exports.DIVENode=c.DIVENode;exports.DIVEPointLight=c.DIVEPointLight;exports.DIVEPrimitive=c.DIVEPrimitive;exports.DIVERenderPipeline=c.DIVERenderPipeline;exports.DIVERenderer=c.DIVERenderer;exports.DIVERendererDefaultSettings=c.DIVERendererDefaultSettings;exports.DIVEResizeManager=c.DIVEResizeManager;exports.DIVERoot=c.DIVERoot;exports.DIVEScene=c.DIVEScene;exports.DIVESceneDefaultSettings=c.DIVESceneDefaultSettings;exports.DIVESceneLight=c.DIVESceneLight;exports.DIVEView=c.DIVEView;exports.FILE_TYPES=c.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=c.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=c.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=c.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=c.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.AxesColorBlue=_.AxesColorBlue;exports.AxesColorBlueLetter=_.AxesColorBlueLetter;exports.AxesColorGreen=_.AxesColorGreen;exports.AxesColorGreenLetter=_.AxesColorGreenLetter;exports.AxesColorRed=_.AxesColorRed;exports.AxesColorRedLetter=_.AxesColorRedLetter;exports.findInterface=V.findInterface;exports.implementsInterface=V.implementsInterface;exports.getFileTypeFromUri=y.getFileTypeFromUri;exports.isFileTypeSupported=y.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=A.FileTypeError;exports.ParseError=A.ParseError;exports.isModelSchema=P.isModelSchema;exports.isPovSchema=P.isPovSchema;exports.DIVEGizmo=F;exports.DIVEMath=S;exports.DIVEMovable=U;exports.DIVESelectable=K;exports.applyMixins=X;exports.deepClone=f;exports.getObjectDelta=I;exports.isGroupSchema=q;exports.isLightSchema=B;exports.isPrimitiveSchema=Z;
|
|
1
|
+
"use strict";var b=Object.defineProperty;var R=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>R(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./chunks/FileTypes-35x8Ekp6.cjs"),u=require("./chunks/PerspectiveCamera-iAsZqrnY.cjs"),_=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),s=require("three"),V=require("./chunks/findInterface-C6mrvf_t.cjs"),y=require("./chunks/isFileTypeSupported-BmjxgShb.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),A=require("./chunks/parse-error-Dy_EE4rL.cjs"),P=require("./chunks/PovSchema-Co9FznEz.cjs");class m extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const l=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const g=new s.TorusGeometry(t,.1,3,48,o),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function p(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function O(r,i=0){const e=p(r,+i);return p(Math.ceil(e),-i)}function v(r,i=0){const e=p(r,+i);return p(Math.floor(e),-i)}function x(r,i=0){if(r<0)return-x(-r,i);const e=p(r,+i);return p(Math.round(e),-i)}function H(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function z(r,i=0){const e=p(r,+i);return p(Math.round(e),-i).toFixed(i)}function G(r,i=0){const e=p(r,+i);return p(Math.trunc(e),-i)}function C(r){return(s.MathUtils.radToDeg(r)+360)%360}function L(r){return s.MathUtils.degToRad(r)}const S={ceilExp:O,floorExp:v,roundExp:x,toFixedExp:z,truncateExp:G,signedAngleTo:H,radToDeg:C,degToRad:L};class T extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new m("x",1,Math.PI/2,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new m("y",1,-Math.PI/2,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new m("z",1,Math.PI/2,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),l=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,l)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const l=new s.Mesh(a,this._lineMaterial);l.layers.mask=u.UI_LAYER_MASK,l.renderOrder=1/0,l.rotateX(Math.PI/2),l.translateY(t/2),this.add(l);const d=new s.CylinderGeometry(.1,.1,t,3),g=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class Y extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class M extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const l=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const g=new s.CylinderGeometry(.1,.1,t+a/2,3),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new M("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new M("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new M("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class N extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(l,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class F extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new Y(e),this._rotateGizmo=new T(e),this._scaleGizmo=new j(e),this._gizmoPlane=new N,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class U{constructor(){n(this,"isMovable",!0)}}class K{constructor(){n(this,"isSelectable",!0)}}function X(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function f(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let l=0;l<r.length;l++)a[l]=f(r[l],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[l,d]of r)a.set(f(l,i),f(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const l of r)a.add(f(l,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}return t}const I=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((l,d)=>{const g=I(o[d],h[d]);Object.keys(g).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=I(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function q(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.BoundingBox=c.BoundingBox;exports.DIVE=c.DIVE;exports.DIVEAmbientLight=c.DIVEAmbientLight;exports.DIVEClock=c.DIVEClock;exports.DIVEDefaultSettings=c.DIVEDefaultSettings;exports.DIVEEngine=c.DIVEEngine;exports.DIVEEnvironment=c.DIVEEnvironment;exports.DIVEEnvironmentDefaultSettings=c.DIVEEnvironmentDefaultSettings;exports.DIVEFloor=c.DIVEFloor;exports.DIVEGrid=c.DIVEGrid;exports.DIVEGroup=c.DIVEGroup;exports.DIVEModel=c.DIVEModel;exports.DIVENode=c.DIVENode;exports.DIVEPointLight=c.DIVEPointLight;exports.DIVEPrimitive=c.DIVEPrimitive;exports.DIVERenderPipeline=c.DIVERenderPipeline;exports.DIVERenderer=c.DIVERenderer;exports.DIVERendererDefaultSettings=c.DIVERendererDefaultSettings;exports.DIVEResizeManager=c.DIVEResizeManager;exports.DIVERoot=c.DIVERoot;exports.DIVEScene=c.DIVEScene;exports.DIVESceneDefaultSettings=c.DIVESceneDefaultSettings;exports.DIVESceneLight=c.DIVESceneLight;exports.DIVEView=c.DIVEView;exports.FILE_TYPES=c.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=c.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=c.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=c.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=c.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.AxesColorBlue=_.AxesColorBlue;exports.AxesColorBlueLetter=_.AxesColorBlueLetter;exports.AxesColorGreen=_.AxesColorGreen;exports.AxesColorGreenLetter=_.AxesColorGreenLetter;exports.AxesColorRed=_.AxesColorRed;exports.AxesColorRedLetter=_.AxesColorRedLetter;exports.findInterface=V.findInterface;exports.implementsInterface=V.implementsInterface;exports.getFileTypeFromUri=y.getFileTypeFromUri;exports.isFileTypeSupported=y.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=A.FileTypeError;exports.ParseError=A.ParseError;exports.isModelSchema=P.isModelSchema;exports.isPovSchema=P.isPovSchema;exports.DIVEGizmo=F;exports.DIVEMath=S;exports.DIVEMovable=U;exports.DIVESelectable=K;exports.applyMixins=X;exports.deepClone=f;exports.getObjectDelta=I;exports.isGroupSchema=q;exports.isLightSchema=B;exports.isPrimitiveSchema=Z;
|
package/build/dive.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var A = (r, s, t) => s in r ? S(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
3
|
var i = (r, s, t) => A(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { B as ot, b as ht, d as lt, e as ct, D as dt, f as pt, g as ut, h as ft, i as _t, j as gt, k as mt, c as Et, l as Dt, m as wt, n as yt, o as Mt, p as xt, q as It, r as Pt, s as Vt, t as bt, u as Ht, v as zt, w as vt, F as Ot, G as St, x as At, S as Gt, y as Rt } from "./chunks/FileTypes-
|
|
4
|
+
import { B as ot, b as ht, d as lt, e as ct, D as dt, f as pt, g as ut, h as ft, i as _t, j as gt, k as mt, c as Et, l as Dt, m as wt, n as yt, o as Mt, p as xt, q as It, r as Pt, s as Vt, t as bt, u as Ht, v as zt, w as vt, F as Ot, G as St, x as At, S as Gt, y as Rt } from "./chunks/FileTypes-BSG8CC2s.mjs";
|
|
5
5
|
import { U as d } from "./chunks/PerspectiveCamera-BFzE2TQU.mjs";
|
|
6
6
|
import { C as Yt, b as jt, D as Ct, a as Lt, H as Nt, P as Xt } from "./chunks/PerspectiveCamera-BFzE2TQU.mjs";
|
|
7
7
|
import { A as I, a as P, b as V } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
8
8
|
import { e as Zt, d as qt, c as Qt } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
|
|
9
9
|
import { Object3D as f, Color as b, Vector3 as c, TorusGeometry as H, MeshBasicMaterial as g, Mesh as p, MathUtils as v, Euler as G, CylinderGeometry as E, BoxGeometry as R, PlaneGeometry as w } from "three";
|
|
10
10
|
import { f as kt, i as Ut } from "./chunks/findInterface-DbJ5qzbc.mjs";
|
|
11
|
-
import { g as Kt, i as Jt } from "./chunks/isFileTypeSupported-
|
|
11
|
+
import { g as Kt, i as Jt } from "./chunks/isFileTypeSupported-DBPOEmTI.mjs";
|
|
12
12
|
import { F as te, N as ee } from "./chunks/network-error-BONfHWQq.mjs";
|
|
13
13
|
import { F as se, P as ie } from "./chunks/parse-error-DfOPyLWM.mjs";
|
|
14
14
|
import { i as ae, a as oe } from "./chunks/PovSchema-DWWvr_ED.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var u=(s,t,e)=>t in s?m(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var n=(s,t,e)=>u(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tweenjs/tween.js"),c=require("three");class l{constructor(){n(this,"uuid",c.MathUtils.generateUUID());n(this,"Easing",o.Easing);n(this,"_animators",new Map)}dispose(){for(const t of this._animators.values())t.dispose();this._animators.clear()}tick(t){for(const e of this._animators.values())e.update(t)}async animate(t,e,i){const a=await this.fromTargets(t,e,i);return a.play(),a}async fromTargets(t,e,i){const{TargetAnimator:a}=await Promise.resolve().then(()=>require("../../chunks/TargetAnimator-DuqPk2eq.cjs")),r=new a(t,e,i);return this._animators.set(r.uuid,r),r}async fromClips(t,e){const{ClipAnimator:i}=await Promise.resolve().then(()=>require("../../chunks/ClipAnimator-BcDOC3qJ.cjs")),a=new i(t,e);return this._animators.set(a.uuid,a),a}remove(t){const e=this._animators.get(t);if(!e){console.warn(`Animator with uuid ${t} not found`);return}e.dispose(),this._animators.delete(t)}}Object.defineProperty(exports,"Easing",{enumerable:!0,get:()=>o.Easing});exports.AnimationSystem=l;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './src/index.ts';
|
|
2
|
-
export
|
|
2
|
+
export { Easing } from '@tweenjs/tween.js';
|