@soonspacejs/plugin-effect 2.14.29 → 2.14.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +225 -225
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -901,8 +901,8 @@ l.utils = {
|
|
|
901
901
|
*/
|
|
902
902
|
interpolateArray: function(e, t) {
|
|
903
903
|
for (var r = e.length, a = [typeof e[0].clone == "function" ? e[0].clone() : e[0]], A = (r - 1) / (t - 1), s = 1; s < t - 1; ++s) {
|
|
904
|
-
var i = s * A, o = Math.floor(i), n = Math.ceil(i),
|
|
905
|
-
a[s] = this.lerpTypeAgnostic(e[o], e[n],
|
|
904
|
+
var i = s * A, o = Math.floor(i), n = Math.ceil(i), u = i - o;
|
|
905
|
+
a[s] = this.lerpTypeAgnostic(e[o], e[n], u);
|
|
906
906
|
}
|
|
907
907
|
return a.push(
|
|
908
908
|
typeof e[r - 1].clone == "function" ? e[r - 1].clone() : e[r - 1]
|
|
@@ -1084,8 +1084,8 @@ l.utils = {
|
|
|
1084
1084
|
* @param {Number} radiusSpreadClamp What numeric multiple the projected value should be clamped to.
|
|
1085
1085
|
*/
|
|
1086
1086
|
randomVector3OnSphere: function(e, t, r, a, A, s, i, o) {
|
|
1087
|
-
var n = 2 * Math.random() - 1,
|
|
1088
|
-
i && (
|
|
1087
|
+
var n = 2 * Math.random() - 1, u = 6.2832 * Math.random(), d = Math.sqrt(1 - n * n), c = this.randomFloat(a, A), k = 0, y = 0, W = 0;
|
|
1088
|
+
i && (c = Math.round(c / i) * i), k = d * Math.cos(u) * c, y = d * Math.sin(u) * c, W = n * c, k *= s.x, y *= s.y, W *= s.z, k += r.x, y += r.y, W += r.z, e.typedArray.setVec3Components(t, k, y, W);
|
|
1089
1089
|
},
|
|
1090
1090
|
seededRandom: function(e) {
|
|
1091
1091
|
var t = Math.sin(e) * 1e4;
|
|
@@ -1104,8 +1104,8 @@ l.utils = {
|
|
|
1104
1104
|
* @param {Number} radiusSpreadClamp What numeric multiple the projected value should be clamped to.
|
|
1105
1105
|
*/
|
|
1106
1106
|
randomVector3OnDisc: function(e, t, r, a, A, s, i) {
|
|
1107
|
-
var o = 6.2832 * Math.random(), n = Math.abs(this.randomFloat(a, A)),
|
|
1108
|
-
i && (n = Math.round(n / i) * i),
|
|
1107
|
+
var o = 6.2832 * Math.random(), n = Math.abs(this.randomFloat(a, A)), u = 0, d = 0, c = 0;
|
|
1108
|
+
i && (n = Math.round(n / i) * i), u = Math.cos(o) * n, d = Math.sin(o) * n, u *= s.x, d *= s.y, u += r.x, d += r.y, c += r.z, e.typedArray.setVec3Components(t, u, d, c);
|
|
1109
1109
|
},
|
|
1110
1110
|
randomDirectionVector3OnSphere: (function() {
|
|
1111
1111
|
var e = new p.Vector3();
|
|
@@ -1445,8 +1445,8 @@ l.Emitter.prototype._createGetterSetters = function(e, t) {
|
|
|
1445
1445
|
})(a),
|
|
1446
1446
|
set: /* @__PURE__ */ (function(s) {
|
|
1447
1447
|
return function(i) {
|
|
1448
|
-
var o = r.updateMap[t], n = this[s],
|
|
1449
|
-
s === "_rotationCenter" ? (r.updateFlags.rotationCenter = !0, r.updateCounts.rotationCenter = 0) : s === "_randomise" ? r.resetFlags[o] = i : (r.updateFlags[o] = !0, r.updateCounts[o] = 0), r.group._updateDefines(), this[s] = i, Array.isArray(n) && l.utils.ensureValueOverLifetimeCompliance(r[t],
|
|
1448
|
+
var o = r.updateMap[t], n = this[s], u = l.valueOverLifetimeLength;
|
|
1449
|
+
s === "_rotationCenter" ? (r.updateFlags.rotationCenter = !0, r.updateCounts.rotationCenter = 0) : s === "_randomise" ? r.resetFlags[o] = i : (r.updateFlags[o] = !0, r.updateCounts[o] = 0), r.group._updateDefines(), this[s] = i, Array.isArray(n) && l.utils.ensureValueOverLifetimeCompliance(r[t], u, u);
|
|
1450
1450
|
};
|
|
1451
1451
|
})(a)
|
|
1452
1452
|
});
|
|
@@ -1529,30 +1529,30 @@ l.Emitter.prototype._assignPositionValue = function(e) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
};
|
|
1531
1531
|
l.Emitter.prototype._assignForceValue = function(e, t) {
|
|
1532
|
-
var r = l.distributions, a = l.utils, A = this[t], s = A._value, i = A._spread, o = A._distribution, n,
|
|
1532
|
+
var r = l.distributions, a = l.utils, A = this[t], s = A._value, i = A._spread, o = A._distribution, n, u, d, c, k;
|
|
1533
1533
|
switch (o) {
|
|
1534
1534
|
case r.BOX:
|
|
1535
1535
|
a.randomVector3(this.attributes[t], e, s, i);
|
|
1536
1536
|
break;
|
|
1537
1537
|
case r.SPHERE:
|
|
1538
|
-
n = this.attributes.position.typedArray.array, k = e * 3,
|
|
1538
|
+
n = this.attributes.position.typedArray.array, k = e * 3, u = n[k], d = n[k + 1], c = n[k + 2], a.randomDirectionVector3OnSphere(
|
|
1539
1539
|
this.attributes[t],
|
|
1540
1540
|
e,
|
|
1541
|
+
u,
|
|
1542
|
+
d,
|
|
1541
1543
|
c,
|
|
1542
|
-
S,
|
|
1543
|
-
y,
|
|
1544
1544
|
this.position._value,
|
|
1545
1545
|
A._value.x,
|
|
1546
1546
|
A._spread.x
|
|
1547
1547
|
);
|
|
1548
1548
|
break;
|
|
1549
1549
|
case r.DISC:
|
|
1550
|
-
n = this.attributes.position.typedArray.array, k = e * 3,
|
|
1550
|
+
n = this.attributes.position.typedArray.array, k = e * 3, u = n[k], d = n[k + 1], c = n[k + 2], a.randomDirectionVector3OnDisc(
|
|
1551
1551
|
this.attributes[t],
|
|
1552
1552
|
e,
|
|
1553
|
+
u,
|
|
1554
|
+
d,
|
|
1553
1555
|
c,
|
|
1554
|
-
S,
|
|
1555
|
-
y,
|
|
1556
1556
|
this.position._value,
|
|
1557
1557
|
A._value.x,
|
|
1558
1558
|
A._spread.x
|
|
@@ -1563,8 +1563,8 @@ l.Emitter.prototype._assignForceValue = function(e, t) {
|
|
|
1563
1563
|
break;
|
|
1564
1564
|
}
|
|
1565
1565
|
if (t === "acceleration") {
|
|
1566
|
-
var
|
|
1567
|
-
this.attributes.acceleration.typedArray.array[e * 4 + 3] =
|
|
1566
|
+
var y = a.clamp(a.randomFloat(this.drag._value, this.drag._spread), 0, 1);
|
|
1567
|
+
this.attributes.acceleration.typedArray.array[e * 4 + 3] = y;
|
|
1568
1568
|
}
|
|
1569
1569
|
};
|
|
1570
1570
|
l.Emitter.prototype._assignAbsLifetimeValue = function(e, t) {
|
|
@@ -1649,8 +1649,8 @@ l.Emitter.prototype.tick = function(e) {
|
|
|
1649
1649
|
this.alive = !1, this.age = 0;
|
|
1650
1650
|
return;
|
|
1651
1651
|
}
|
|
1652
|
-
var i = this.particleCount === 1 ? s : s | 0, o = Math.min(i + A, this.activationEnd), n = o - this.activationIndex | 0,
|
|
1653
|
-
this._activateParticles(i, o, a,
|
|
1652
|
+
var i = this.particleCount === 1 ? s : s | 0, o = Math.min(i + A, this.activationEnd), n = o - this.activationIndex | 0, u = n > 0 ? e / n : 0;
|
|
1653
|
+
this._activateParticles(i, o, a, u), this.activationIndex += A, this.activationIndex > r && (this.activationIndex = t), this.age += e;
|
|
1654
1654
|
}
|
|
1655
1655
|
};
|
|
1656
1656
|
l.Emitter.prototype.reset = function(e) {
|
|
@@ -1739,7 +1739,7 @@ function Ve(e) {
|
|
|
1739
1739
|
pointMultiplier: {
|
|
1740
1740
|
value: window.innerHeight / (2 * Math.tan(30 * Math.PI / 180))
|
|
1741
1741
|
}
|
|
1742
|
-
},
|
|
1742
|
+
}, u = new p.ShaderMaterial({
|
|
1743
1743
|
uniforms: n,
|
|
1744
1744
|
vertexShader: ve,
|
|
1745
1745
|
fragmentShader: me,
|
|
@@ -1749,25 +1749,25 @@ function Ve(e) {
|
|
|
1749
1749
|
transparent: !0,
|
|
1750
1750
|
vertexColors: !0
|
|
1751
1751
|
});
|
|
1752
|
-
let
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
const k = new p.Points(
|
|
1756
|
-
|
|
1757
|
-
const W = gt((I, g,
|
|
1752
|
+
let d = [];
|
|
1753
|
+
const c = new p.BufferGeometry();
|
|
1754
|
+
c.setAttribute("position", new p.Float32BufferAttribute([], 3)), c.setAttribute("size", new p.Float32BufferAttribute([], 1)), c.setAttribute("aColor", new p.Float32BufferAttribute([], 4)), c.setAttribute("angle", new p.Float32BufferAttribute([], 1));
|
|
1755
|
+
const k = new p.Points(c, u), y = gt((I, g, S) => g + I * (S - g));
|
|
1756
|
+
y.addPoint(0, 0), y.addPoint(0.6, 1), y.addPoint(1, 0);
|
|
1757
|
+
const W = gt((I, g, S) => g.clone().lerp(S, I));
|
|
1758
1758
|
i.forEach((I, g) => {
|
|
1759
1759
|
W.addPoint(g / (i.length - 1), new p.Color(I));
|
|
1760
1760
|
});
|
|
1761
|
-
const v = gt((I, g,
|
|
1761
|
+
const v = gt((I, g, S) => g + I * (S - g));
|
|
1762
1762
|
v.addPoint(0, 0), v.addPoint(1, 1);
|
|
1763
1763
|
let m = 0;
|
|
1764
|
-
function
|
|
1764
|
+
function f(I) {
|
|
1765
1765
|
m += I;
|
|
1766
1766
|
const g = Math.floor(m * s);
|
|
1767
1767
|
m -= g / s;
|
|
1768
|
-
for (let
|
|
1768
|
+
for (let S = 0; S < g; S += 1) {
|
|
1769
1769
|
const b = (Math.random() * 0.75 + 0.25) * a;
|
|
1770
|
-
|
|
1770
|
+
d.push({
|
|
1771
1771
|
position: new p.Vector3(
|
|
1772
1772
|
(Math.random() * 2 - 1) * r,
|
|
1773
1773
|
(Math.random() * 2 - 1) * r,
|
|
@@ -1785,27 +1785,27 @@ function Ve(e) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
1787
|
function N() {
|
|
1788
|
-
const I = [], g = [],
|
|
1789
|
-
for (const V of
|
|
1790
|
-
I.push(V.position.x, V.position.y, V.position.z),
|
|
1791
|
-
|
|
1788
|
+
const I = [], g = [], S = [], b = [];
|
|
1789
|
+
for (const V of d)
|
|
1790
|
+
I.push(V.position.x, V.position.y, V.position.z), S.push(V.colour.r, V.colour.g, V.colour.b, V.alpha), g.push(V.currentSize), b.push(V.rotation);
|
|
1791
|
+
c.setAttribute("position", new p.Float32BufferAttribute(I, 3)), c.setAttribute("size", new p.Float32BufferAttribute(g, 1)), c.setAttribute("aColor", new p.Float32BufferAttribute(S, 4)), c.setAttribute("angle", new p.Float32BufferAttribute(b, 1));
|
|
1792
1792
|
}
|
|
1793
1793
|
N();
|
|
1794
1794
|
function R(I) {
|
|
1795
|
-
for (const g of
|
|
1795
|
+
for (const g of d)
|
|
1796
1796
|
g.life -= I;
|
|
1797
|
-
|
|
1798
|
-
for (const g of
|
|
1799
|
-
const
|
|
1800
|
-
g.rotation += g.rotationRate, g.alpha =
|
|
1797
|
+
d = d.filter((g) => g.life > 0);
|
|
1798
|
+
for (const g of d) {
|
|
1799
|
+
const S = 1 - g.life / g.maxLife;
|
|
1800
|
+
g.rotation += g.rotationRate, g.alpha = y.getValueAt(S), g.currentSize = g.size * v.getValueAt(S), g.colour.copy(W.getValueAt(S)), g.position.add(g.velocity.clone().multiplyScalar(I));
|
|
1801
1801
|
const b = g.velocity.clone();
|
|
1802
1802
|
b.multiplyScalar(I * 0.1), b.x = Math.sign(g.velocity.x) * Math.min(Math.abs(b.x), Math.abs(g.velocity.x)), b.y = Math.sign(g.velocity.y) * Math.min(Math.abs(b.y), Math.abs(g.velocity.y)), b.z = Math.sign(g.velocity.z) * Math.min(Math.abs(b.z), Math.abs(g.velocity.z)), g.velocity.sub(b);
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
|
-
function
|
|
1806
|
-
|
|
1805
|
+
function J(I) {
|
|
1806
|
+
f(I), R(I), N();
|
|
1807
1807
|
}
|
|
1808
|
-
return { points: k, update:
|
|
1808
|
+
return { points: k, update: J };
|
|
1809
1809
|
}
|
|
1810
1810
|
const Lt = {
|
|
1811
1811
|
vertexShader: `
|
|
@@ -1973,12 +1973,12 @@ function Ce(e) {
|
|
|
1973
1973
|
const t = e.length, r = [];
|
|
1974
1974
|
if (t === 0)
|
|
1975
1975
|
return r;
|
|
1976
|
-
const [a
|
|
1977
|
-
for (let
|
|
1978
|
-
const
|
|
1979
|
-
for (let
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1976
|
+
const [a] = z(e[0]);
|
|
1977
|
+
for (let A = 0; A < t; A++) {
|
|
1978
|
+
const s = e[A], i = new a().copy(s), o = s.radius, n = r[A] ?? (r[A] = []);
|
|
1979
|
+
for (let u = A + 1; u < t; u++) {
|
|
1980
|
+
const d = e[u];
|
|
1981
|
+
i.distanceToSquared(d) <= (d.radius + o) ** 2 && (n.push(u), (r[u] = []).push(A));
|
|
1982
1982
|
}
|
|
1983
1983
|
}
|
|
1984
1984
|
return r;
|
|
@@ -1995,8 +1995,8 @@ function St(e, t, r) {
|
|
|
1995
1995
|
return a === 0 ? a : e.clone().cross(t).dot(r) < 0 ? -a : a;
|
|
1996
1996
|
}
|
|
1997
1997
|
function Be(e, t, r) {
|
|
1998
|
-
const a = t.clone().negate(), A = r.clone().projectOnPlane(t), s = e.clone().projectOnPlane(A), i = St(t, s, A), o = t.clone().cross(A), n = e.clone().projectOnPlane(o),
|
|
1999
|
-
return { yaw: i, pitch:
|
|
1998
|
+
const a = t.clone().negate(), A = r.clone().projectOnPlane(t), s = e.clone().projectOnPlane(A), i = St(t, s, A), o = t.clone().cross(A), n = e.clone().projectOnPlane(o), u = St(t, n, o), d = e.clone().projectOnPlane(a), c = St(A, d, a);
|
|
1999
|
+
return { yaw: i, pitch: u, roll: c };
|
|
2000
2000
|
}
|
|
2001
2001
|
const dt = 180 / Math.PI, mt = {
|
|
2002
2002
|
yaw: [
|
|
@@ -2098,8 +2098,8 @@ let Ot = class {
|
|
|
2098
2098
|
*/
|
|
2099
2099
|
computeAzimuth(t, r, a) {
|
|
2100
2100
|
const A = new T().copy(t), s = new T().copy(r ?? this.front), i = new T().copy(a ?? this.up);
|
|
2101
|
-
let { yaw: o, pitch: n, roll:
|
|
2102
|
-
return this.degrees && (o *= dt, n *= dt,
|
|
2101
|
+
let { yaw: o, pitch: n, roll: u } = Be(A, s, i);
|
|
2102
|
+
return this.degrees && (o *= dt, n *= dt, u *= dt), {
|
|
2103
2103
|
yaw: {
|
|
2104
2104
|
angle: o,
|
|
2105
2105
|
name: this.findAzimuthNames("yaw", o)
|
|
@@ -2109,8 +2109,8 @@ let Ot = class {
|
|
|
2109
2109
|
name: this.findAzimuthNames("pitch", n)
|
|
2110
2110
|
},
|
|
2111
2111
|
roll: {
|
|
2112
|
-
angle:
|
|
2113
|
-
name: this.findAzimuthNames("roll",
|
|
2112
|
+
angle: u,
|
|
2113
|
+
name: this.findAzimuthNames("roll", u)
|
|
2114
2114
|
}
|
|
2115
2115
|
};
|
|
2116
2116
|
}
|
|
@@ -2157,9 +2157,9 @@ function cr(e, t) {
|
|
|
2157
2157
|
}
|
|
2158
2158
|
function He(e, t, r, a) {
|
|
2159
2159
|
const A = [], s = e - 1, i = s - 1;
|
|
2160
|
-
for (let
|
|
2161
|
-
const
|
|
2162
|
-
A.push(
|
|
2160
|
+
for (let u = 0; u < i; u++) {
|
|
2161
|
+
const d = (Math.random() - 0.5) * 2 * (t + r);
|
|
2162
|
+
A.push(d);
|
|
2163
2163
|
}
|
|
2164
2164
|
const o = Math.trunc(Math.random() * s);
|
|
2165
2165
|
let n = (Math.random() - 0.5) * 2 * r;
|
|
@@ -2203,47 +2203,47 @@ function Jt({ ratio: e, value: t }) {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
var nt = /* @__PURE__ */ ((e) => (e[e.Circle = 0] = "Circle", e[e.Square = 1] = "Square", e))(nt || {});
|
|
2205
2205
|
function Qt(e, t) {
|
|
2206
|
-
const { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape:
|
|
2206
|
+
const { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape: u, densityGradient: d, valueGradient: c } = e, k = e, [y, W] = z(e);
|
|
2207
2207
|
let v, m;
|
|
2208
2208
|
if (t) {
|
|
2209
|
-
const { lineStep: g, matrix:
|
|
2209
|
+
const { lineStep: g, matrix: S } = t, b = u === 1 ? He : Ze;
|
|
2210
2210
|
v = function(V, h, B) {
|
|
2211
2211
|
const U = b(V, h, B, g);
|
|
2212
|
-
return V === 2 && U.push(0), new T(...U).applyMatrix4(
|
|
2212
|
+
return V === 2 && U.push(0), new T(...U).applyMatrix4(S);
|
|
2213
2213
|
}, m = function(V, h) {
|
|
2214
2214
|
return V * h ** (W - 2) * g;
|
|
2215
2215
|
};
|
|
2216
2216
|
} else {
|
|
2217
|
-
const g =
|
|
2218
|
-
v = function(
|
|
2219
|
-
const h = g(
|
|
2220
|
-
return new
|
|
2221
|
-
}, m = function(
|
|
2222
|
-
return
|
|
2217
|
+
const g = u === 1 ? Pt : Et;
|
|
2218
|
+
v = function(S, b, V) {
|
|
2219
|
+
const h = g(S, b, V);
|
|
2220
|
+
return new y(...h);
|
|
2221
|
+
}, m = function(S, b) {
|
|
2222
|
+
return S * b ** (W - 1);
|
|
2223
2223
|
};
|
|
2224
2224
|
}
|
|
2225
|
-
const
|
|
2225
|
+
const f = [], N = [], R = A * i, J = A - R, I = A * o;
|
|
2226
2226
|
for (let g = I + a; g < A; g += a) {
|
|
2227
|
-
const
|
|
2228
|
-
ratio: (g - R) /
|
|
2227
|
+
const S = {
|
|
2228
|
+
ratio: (g - R) / J,
|
|
2229
2229
|
radius: A,
|
|
2230
2230
|
solid: i,
|
|
2231
2231
|
distance: g,
|
|
2232
2232
|
density: n,
|
|
2233
2233
|
solidRadius: R,
|
|
2234
|
-
gradientRadius:
|
|
2234
|
+
gradientRadius: J,
|
|
2235
2235
|
clim: r,
|
|
2236
2236
|
value: s,
|
|
2237
2237
|
hollow: o,
|
|
2238
2238
|
hollowRadius: I
|
|
2239
|
-
}, b = g < R ? n : S
|
|
2239
|
+
}, b = g < R ? n : d(S);
|
|
2240
2240
|
let V = m(b, g);
|
|
2241
2241
|
const h = g - a;
|
|
2242
2242
|
for (; V-- > -1; ) {
|
|
2243
|
-
const B = v(W, h, a), U = new
|
|
2244
|
-
U.add(k),
|
|
2245
|
-
const L =
|
|
2246
|
-
...
|
|
2243
|
+
const B = v(W, h, a), U = new y().copy(B), j = U.length();
|
|
2244
|
+
U.add(k), f.push(U);
|
|
2245
|
+
const L = c({
|
|
2246
|
+
...S,
|
|
2247
2247
|
ratio: j / A,
|
|
2248
2248
|
distance: j
|
|
2249
2249
|
});
|
|
@@ -2251,18 +2251,18 @@ function Qt(e, t) {
|
|
|
2251
2251
|
}
|
|
2252
2252
|
}
|
|
2253
2253
|
return {
|
|
2254
|
-
particles:
|
|
2254
|
+
particles: f,
|
|
2255
2255
|
values: N
|
|
2256
2256
|
};
|
|
2257
2257
|
}
|
|
2258
2258
|
function Xe(e) {
|
|
2259
|
-
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape:
|
|
2260
|
-
if (!
|
|
2259
|
+
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape: u = 0, densityGradient: d = Rt, valueGradient: c = Jt } = e, k = { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape: u, densityGradient: d, valueGradient: c }, y = t[0];
|
|
2260
|
+
if (!y)
|
|
2261
2261
|
return [];
|
|
2262
|
-
const [W
|
|
2263
|
-
return t.map((
|
|
2264
|
-
const
|
|
2265
|
-
return Object.assign(
|
|
2262
|
+
const [W] = z(y);
|
|
2263
|
+
return t.map((v) => {
|
|
2264
|
+
const m = new W();
|
|
2265
|
+
return Object.assign(m, { ...k, ...v }), Qt(m);
|
|
2266
2266
|
});
|
|
2267
2267
|
}
|
|
2268
2268
|
class Ke extends bt {
|
|
@@ -2313,9 +2313,9 @@ class Ke extends bt {
|
|
|
2313
2313
|
const { colorGradient: t, clim: r, values: a } = this;
|
|
2314
2314
|
if (!t)
|
|
2315
2315
|
return !1;
|
|
2316
|
-
const { width: A, data: s } = t, i = [], { x: o, y: n } = r,
|
|
2317
|
-
for (const
|
|
2318
|
-
const k = 1 - (x.clamp(
|
|
2316
|
+
const { width: A, data: s } = t, i = [], { x: o, y: n } = r, u = n - o, d = A - 1;
|
|
2317
|
+
for (const c of a) {
|
|
2318
|
+
const k = 1 - (x.clamp(c, o, n) - o) / u, y = Math.trunc(k * d) * 4, W = s.slice(y, y + 4);
|
|
2319
2319
|
i.push(...W);
|
|
2320
2320
|
}
|
|
2321
2321
|
this.setAttribute("color", new M(new Uint8ClampedArray(i), 4, !0));
|
|
@@ -2350,8 +2350,8 @@ class Ke extends bt {
|
|
|
2350
2350
|
const o = s.length;
|
|
2351
2351
|
for (let n = 0; n < o; n++, A++) {
|
|
2352
2352
|
s[n].toArray(r, A * 3);
|
|
2353
|
-
const
|
|
2354
|
-
a.push(
|
|
2353
|
+
const u = i[n];
|
|
2354
|
+
a.push(u);
|
|
2355
2355
|
}
|
|
2356
2356
|
}
|
|
2357
2357
|
this.setAttribute("position", new M(new Float32Array(r), 3)), this.values = a;
|
|
@@ -2380,11 +2380,11 @@ class Ke extends bt {
|
|
|
2380
2380
|
let A = [];
|
|
2381
2381
|
const s = [];
|
|
2382
2382
|
let i = 0;
|
|
2383
|
-
for (const { particles: n, values:
|
|
2384
|
-
const
|
|
2385
|
-
for (let
|
|
2386
|
-
n[
|
|
2387
|
-
const k = c
|
|
2383
|
+
for (const { particles: n, values: u } of r) {
|
|
2384
|
+
const d = n.length;
|
|
2385
|
+
for (let c = 0; c < d; c++, i++) {
|
|
2386
|
+
n[c].toArray(A, i * 3);
|
|
2387
|
+
const k = u[c];
|
|
2388
2388
|
s.push(k);
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
@@ -2402,10 +2402,10 @@ class Ke extends bt {
|
|
|
2402
2402
|
return !1;
|
|
2403
2403
|
const { width: s, data: i } = r;
|
|
2404
2404
|
let o = [];
|
|
2405
|
-
const { x: n, y:
|
|
2406
|
-
for (const
|
|
2407
|
-
const W = 1 - (x.clamp(
|
|
2408
|
-
o.push(...m), A.push(
|
|
2405
|
+
const { x: n, y: u } = a, d = u - n, c = s - 1;
|
|
2406
|
+
for (const y of t) {
|
|
2407
|
+
const W = 1 - (x.clamp(y, n, u) - n) / d, v = Math.trunc(W * c) * 4, m = i.slice(v, v + 4);
|
|
2408
|
+
o.push(...m), A.push(y);
|
|
2409
2409
|
}
|
|
2410
2410
|
const k = this.getAttribute("color");
|
|
2411
2411
|
k && (o = [...k.array, ...o]), this.setAttribute("color", new M(new Uint8ClampedArray(o), 4, !0));
|
|
@@ -2421,14 +2421,14 @@ function we({ startValue: e, addedValue: t, ratio: r }) {
|
|
|
2421
2421
|
return t * r + e;
|
|
2422
2422
|
}
|
|
2423
2423
|
function Ge(e) {
|
|
2424
|
-
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape:
|
|
2424
|
+
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape: u = nt.Circle, densityGradient: d = Rt, valueGradient: c = Jt, radiusGradient: k = Fe, lineDensityGradient: y = De, lineValueGradient: W = we } = e, v = e.lineStep ?? a, m = { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape: u, densityGradient: d, valueGradient: c, radiusGradient: k, lineDensityGradient: y }, { total: f, lengths: N } = Me(t), R = t.length, J = t[0], I = t[R - 1], g = J.radius ?? A, S = J.density ?? n, b = J.value ?? s, V = I.radius ?? A, h = I.density ?? n, B = I.value ?? s, U = V - g, j = h - S, L = B - b, C = { length: f, startRadius: g, endRadius: V, addedRadius: U, defaultRadius: A, startDensity: S, endDensity: h, addedDensity: j, defaultDensity: n, startValue: b, endValue: B, addedValue: L, defaultValue: s }, Z = [];
|
|
2425
2425
|
for (let q = 0; q < R; q++) {
|
|
2426
2426
|
const X = t[q];
|
|
2427
2427
|
let { radius: K, value: H, density: F } = X;
|
|
2428
|
-
const D = N[q] /
|
|
2429
|
-
K = K ?? k(w), F = F ??
|
|
2428
|
+
const D = N[q] / f, w = { ...C, ratio: D, index: q - 1 };
|
|
2429
|
+
K = K ?? k(w), F = F ?? y(w), H = H ?? W(w), Z.push({ ...m, ...X, radius: K, density: F, value: H });
|
|
2430
2430
|
}
|
|
2431
|
-
const [_, pt] = z(
|
|
2431
|
+
const [_, pt] = z(J), G = [], $ = R - 1;
|
|
2432
2432
|
for (let q = 0; q < $; q++) {
|
|
2433
2433
|
const X = Z[q], { radius: K, density: H, value: F } = X, D = new _();
|
|
2434
2434
|
D.lineStep = v;
|
|
@@ -2444,7 +2444,7 @@ function Ge(e) {
|
|
|
2444
2444
|
lt = yt * v;
|
|
2445
2445
|
const Ut = O.clone().multiplyScalar(lt).add(D), te = lt / it;
|
|
2446
2446
|
ot.ratio = te;
|
|
2447
|
-
const ee = k(ot), re =
|
|
2447
|
+
const ee = k(ot), re = y(ot), ae = W(ot), et = { ...X, lineDir: O, matrix: qt, radius: ee, density: re, value: ae, lineStep: v };
|
|
2448
2448
|
delete et.x, delete et.y, delete et.z, delete et.w, Object.assign(Ut, et), G.push(Ut);
|
|
2449
2449
|
}
|
|
2450
2450
|
G[G.length - 1].lineStep = it - lt;
|
|
@@ -2457,15 +2457,15 @@ function Ge(e) {
|
|
|
2457
2457
|
function Me(e) {
|
|
2458
2458
|
const t = e.length;
|
|
2459
2459
|
let r = e[0];
|
|
2460
|
-
const [a
|
|
2461
|
-
let
|
|
2462
|
-
for (let
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2460
|
+
const [a] = z(r), A = [0];
|
|
2461
|
+
let s = 0;
|
|
2462
|
+
for (let i = 1; i < t; i++) {
|
|
2463
|
+
const o = new a().copy(e[i]).distanceTo(r);
|
|
2464
|
+
A.push(o), s += o;
|
|
2465
2465
|
}
|
|
2466
2466
|
return {
|
|
2467
|
-
lengths:
|
|
2468
|
-
total:
|
|
2467
|
+
lengths: A,
|
|
2468
|
+
total: s
|
|
2469
2469
|
};
|
|
2470
2470
|
}
|
|
2471
2471
|
function Oe(e, t) {
|
|
@@ -2476,39 +2476,39 @@ function Oe(e, t) {
|
|
|
2476
2476
|
return A * (a - r) + r;
|
|
2477
2477
|
}
|
|
2478
2478
|
function Pe(e, t) {
|
|
2479
|
-
const { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape:
|
|
2479
|
+
const { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape: u, densityGradient: d, valueGradient: c, valuesAccumulate: k } = e, [y, W] = z(e), v = new y().copy(e), m = u === nt.Square ? Pt : Et, f = [], N = [], R = A * i, J = A - R, I = A * o, g = t.map((S) => ({
|
|
2480
2480
|
// @ts-ignore
|
|
2481
|
-
dist: v.distanceTo(
|
|
2482
|
-
point:
|
|
2481
|
+
dist: v.distanceTo(S),
|
|
2482
|
+
point: S
|
|
2483
2483
|
}));
|
|
2484
|
-
for (let
|
|
2484
|
+
for (let S = I + a; S < A; S += a) {
|
|
2485
2485
|
const b = {
|
|
2486
|
-
ratio: (
|
|
2486
|
+
ratio: (S - R) / J,
|
|
2487
2487
|
radius: A,
|
|
2488
2488
|
solid: i,
|
|
2489
2489
|
hollow: o,
|
|
2490
2490
|
hollowRadius: I,
|
|
2491
|
-
distance:
|
|
2491
|
+
distance: S,
|
|
2492
2492
|
density: n,
|
|
2493
2493
|
solidRadius: R,
|
|
2494
|
-
gradientRadius:
|
|
2494
|
+
gradientRadius: J,
|
|
2495
2495
|
clim: r,
|
|
2496
2496
|
value: s
|
|
2497
|
-
}, V =
|
|
2498
|
-
let h = V *
|
|
2499
|
-
const B =
|
|
2497
|
+
}, V = S < R ? n : d(b);
|
|
2498
|
+
let h = V * S ** (W - 1);
|
|
2499
|
+
const B = S - a, U = g.filter(({ dist: j, point: L }) => {
|
|
2500
2500
|
const C = L.radius;
|
|
2501
|
-
return j -
|
|
2501
|
+
return j - S <= C;
|
|
2502
2502
|
});
|
|
2503
2503
|
t:
|
|
2504
2504
|
for (; h-- > -1; ) {
|
|
2505
|
-
const j = m(W, B, a), L = new
|
|
2505
|
+
const j = m(W, B, a), L = new y(...j), C = L.length();
|
|
2506
2506
|
L.add(v);
|
|
2507
2507
|
const Z = [], _ = {
|
|
2508
2508
|
...b,
|
|
2509
2509
|
ratio: C / A,
|
|
2510
2510
|
distance: C
|
|
2511
|
-
}, pt =
|
|
2511
|
+
}, pt = c(_);
|
|
2512
2512
|
Z.push({
|
|
2513
2513
|
...e,
|
|
2514
2514
|
..._,
|
|
@@ -2528,25 +2528,25 @@ function Pe(e, t) {
|
|
|
2528
2528
|
solidRadius: F,
|
|
2529
2529
|
gradientRadius: D,
|
|
2530
2530
|
hollowRadius: w
|
|
2531
|
-
}, st =
|
|
2531
|
+
}, st = c(tt);
|
|
2532
2532
|
Z.push({ ...tt, value: st });
|
|
2533
2533
|
}
|
|
2534
2534
|
}
|
|
2535
|
-
|
|
2535
|
+
f.push(L);
|
|
2536
2536
|
const G = k(Z, r, V);
|
|
2537
2537
|
N.push(G);
|
|
2538
2538
|
}
|
|
2539
2539
|
}
|
|
2540
2540
|
return {
|
|
2541
|
-
particles:
|
|
2541
|
+
particles: f,
|
|
2542
2542
|
values: N
|
|
2543
2543
|
};
|
|
2544
2544
|
}
|
|
2545
2545
|
function Ee(e) {
|
|
2546
|
-
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape:
|
|
2547
|
-
return W.map((m,
|
|
2548
|
-
const N = v[
|
|
2549
|
-
return Pe({ ...
|
|
2546
|
+
const { points: t, clim: r = { x: 0, y: 100 }, step: a = 3, radius: A = 10, value: s = 100, solid: i = 0.7, hollow: o = 0, density: n = 1, shape: u = nt.Circle, densityGradient: d = Rt, valueGradient: c = Jt, valuesAccumulate: k = Oe } = e, y = { clim: r, step: a, radius: A, value: s, solid: i, hollow: o, density: n, shape: u, densityGradient: d, valueGradient: c, valuesAccumulate: k }, W = t.map((m) => ({ ...y, ...m })), v = Ce(W);
|
|
2547
|
+
return W.map((m, f) => {
|
|
2548
|
+
const N = v[f].map((R) => W[R]);
|
|
2549
|
+
return Pe({ ...y, ...m }, N);
|
|
2550
2550
|
});
|
|
2551
2551
|
}
|
|
2552
2552
|
var Qe = /* @__PURE__ */ ((e) => (e[e.Point = 0] = "Point", e[e.Line = 1] = "Line", e[e.Heat = 2] = "Heat", e))(Qe || {});
|
|
@@ -2811,8 +2811,8 @@ const Ar = "data:image/jpeg;base64,/9j/4R1GRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAA
|
|
|
2811
2811
|
function or(e) {
|
|
2812
2812
|
const { polygon: t, waterNormals: r = Ar, height: a, speed: A = 1, ...s } = e, i = ar(t, a);
|
|
2813
2813
|
let o;
|
|
2814
|
-
ir(r) ? o = sr.load(r, function(
|
|
2815
|
-
|
|
2814
|
+
ir(r) ? o = sr.load(r, function(u) {
|
|
2815
|
+
u.wrapS = u.wrapT = pe;
|
|
2816
2816
|
}) : o = r;
|
|
2817
2817
|
const n = new Ie(
|
|
2818
2818
|
i,
|
|
@@ -2841,9 +2841,9 @@ class Sr {
|
|
|
2841
2841
|
* @returns
|
|
2842
2842
|
*/
|
|
2843
2843
|
createFlame(t) {
|
|
2844
|
-
const { magnitude: r = 1.3, gain: a = 0.5 } = t, A = 50, s = (
|
|
2845
|
-
const { imgUrl: k = be } =
|
|
2846
|
-
|
|
2844
|
+
const { magnitude: r = 1.3, gain: a = 0.5 } = t, A = 50, s = (c) => {
|
|
2845
|
+
const { imgUrl: k = be } = c, y = Y.utils.textureLoader.load(k);
|
|
2846
|
+
y.magFilter = y.minFilter = ge, y.wrapS = y.wrapT = Se;
|
|
2847
2847
|
const W = new kt({
|
|
2848
2848
|
defines: {
|
|
2849
2849
|
ITERATIONS: 20,
|
|
@@ -2854,7 +2854,7 @@ class Sr {
|
|
|
2854
2854
|
uniforms: de.merge([
|
|
2855
2855
|
We.phong.uniforms,
|
|
2856
2856
|
{
|
|
2857
|
-
fireTex: { value:
|
|
2857
|
+
fireTex: { value: y },
|
|
2858
2858
|
time: { value: 0 },
|
|
2859
2859
|
seed: { value: Math.random() * 19.19 },
|
|
2860
2860
|
invModelMatrix: { value: new Nt() },
|
|
@@ -2876,18 +2876,18 @@ class Sr {
|
|
|
2876
2876
|
depthTest: !0,
|
|
2877
2877
|
lights: !0
|
|
2878
2878
|
});
|
|
2879
|
-
return W.uniforms.fireTex.value =
|
|
2879
|
+
return W.uniforms.fireTex.value = y, W;
|
|
2880
2880
|
}, i = new At(new Ct(1, 1, 1), s(t));
|
|
2881
2881
|
i.scale.set(A, A, A);
|
|
2882
|
-
const o = (
|
|
2883
|
-
const k = i.material,
|
|
2884
|
-
i.updateMatrixWorld(),
|
|
2882
|
+
const o = (c) => {
|
|
2883
|
+
const k = i.material, y = k.uniforms.invModelMatrix.value;
|
|
2884
|
+
i.updateMatrixWorld(), y.copy(i.matrixWorld).invert(), c !== void 0 && (k.uniforms.time.value = c / 1e3), k.uniforms.invModelMatrix.value = y, k.uniforms.scale.value = i.getWorldScale(new T()), k.uniforms.magnitude.value = r || 1.3, k.uniforms.gain.value = a || 0.5, k.needsUpdate = !0, this.ssp.render();
|
|
2885
2885
|
};
|
|
2886
2886
|
this.ssp.viewport.postUpdate.set(t.id, o);
|
|
2887
|
-
const n = this.ssp.createPluginObject(t, i),
|
|
2888
|
-
|
|
2889
|
-
const
|
|
2890
|
-
return n.addEventListener("added",
|
|
2887
|
+
const n = this.ssp.createPluginObject(t, i), u = () => this.ssp.viewport.postUpdate.set(t.id, o);
|
|
2888
|
+
u();
|
|
2889
|
+
const d = () => this.ssp.viewport.postUpdate.delete(t.id);
|
|
2890
|
+
return n.addEventListener("added", u), n.addEventListener("removed", d), n;
|
|
2891
2891
|
}
|
|
2892
2892
|
/**
|
|
2893
2893
|
* 创建烟雾
|
|
@@ -2903,12 +2903,12 @@ class Sr {
|
|
|
2903
2903
|
acceleration: i = 10,
|
|
2904
2904
|
velocity: o = { x: 100, y: 100, z: 100 },
|
|
2905
2905
|
color: n = [3355443, 1118481]
|
|
2906
|
-
} = t,
|
|
2906
|
+
} = t, u = new ue(), c = Y.utils.textureLoader.load(r), k = new l.Group({
|
|
2907
2907
|
texture: {
|
|
2908
|
-
value:
|
|
2908
|
+
value: c
|
|
2909
2909
|
},
|
|
2910
2910
|
blending: Tt
|
|
2911
|
-
}),
|
|
2911
|
+
}), y = new l.Emitter({
|
|
2912
2912
|
particleCount: a,
|
|
2913
2913
|
maxAge: { value: A },
|
|
2914
2914
|
position: {
|
|
@@ -2937,13 +2937,13 @@ class Sr {
|
|
|
2937
2937
|
value: n.map((N) => new E(N))
|
|
2938
2938
|
}
|
|
2939
2939
|
});
|
|
2940
|
-
k.addEmitter(
|
|
2940
|
+
k.addEmitter(y);
|
|
2941
2941
|
const W = () => {
|
|
2942
|
-
k.tick(
|
|
2942
|
+
k.tick(u.getDelta()), this.ssp.render();
|
|
2943
2943
|
}, v = this.ssp.createPluginObject(t, k.mesh), m = () => this.ssp.viewport.postUpdate.set(t.id, W);
|
|
2944
2944
|
m();
|
|
2945
|
-
const
|
|
2946
|
-
return v.addEventListener("added", m), v.addEventListener("removed",
|
|
2945
|
+
const f = () => this.ssp.viewport.postUpdate.delete(t.id);
|
|
2946
|
+
return v.addEventListener("added", m), v.addEventListener("removed", f), v;
|
|
2947
2947
|
}
|
|
2948
2948
|
createSmoke2(t) {
|
|
2949
2949
|
const {
|
|
@@ -2954,7 +2954,7 @@ class Sr {
|
|
|
2954
2954
|
rate: i = 10,
|
|
2955
2955
|
colors: o = [0, 16777215],
|
|
2956
2956
|
blending: n = Tt
|
|
2957
|
-
} = t, { points:
|
|
2957
|
+
} = t, { points: u, update: d } = Ve({
|
|
2958
2958
|
texture: r,
|
|
2959
2959
|
radius: a,
|
|
2960
2960
|
maxLife: A,
|
|
@@ -2962,12 +2962,12 @@ class Sr {
|
|
|
2962
2962
|
rate: i,
|
|
2963
2963
|
colors: o,
|
|
2964
2964
|
blending: n
|
|
2965
|
-
}),
|
|
2966
|
-
|
|
2967
|
-
}, k = this.ssp.createPluginObject(t,
|
|
2968
|
-
|
|
2965
|
+
}), c = () => {
|
|
2966
|
+
d(this.ssp.viewport.state.delta), this.ssp.render();
|
|
2967
|
+
}, k = this.ssp.createPluginObject(t, u), y = () => this.ssp.viewport.postUpdate.set(t.id, c);
|
|
2968
|
+
y();
|
|
2969
2969
|
const W = () => this.ssp.viewport.postUpdate.delete(t.id);
|
|
2970
|
-
return k.addEventListener("added",
|
|
2970
|
+
return k.addEventListener("added", y), k.addEventListener("removed", W), k;
|
|
2971
2971
|
}
|
|
2972
2972
|
/**
|
|
2973
2973
|
* 创建星星
|
|
@@ -2983,17 +2983,17 @@ class Sr {
|
|
|
2983
2983
|
noise: i = 1,
|
|
2984
2984
|
color: o = "#fff",
|
|
2985
2985
|
size: n = 2
|
|
2986
|
-
} = t, { ssp:
|
|
2986
|
+
} = t, { ssp: u } = this, { THREE: d } = u, { Points: c, ShaderMaterial: k, BufferGeometry: y, BufferAttribute: W } = d, v = Float32Array.from(
|
|
2987
2987
|
Array.from(
|
|
2988
2988
|
{ length: r },
|
|
2989
|
-
() => Mt(a).map(
|
|
2989
|
+
() => Mt(a).map(d.MathUtils.randFloatSpread)
|
|
2990
2990
|
).flat()
|
|
2991
|
-
), m = rt(r, n, Math.random),
|
|
2991
|
+
), m = rt(r, n, Math.random), f = rt(r, s), N = rt(r, A), R = rt(r * 3, i), J = rt(
|
|
2992
2992
|
o === void 0 ? r * 3 : r,
|
|
2993
|
-
wt(o) ? o : new
|
|
2993
|
+
wt(o) ? o : new d.Color(o),
|
|
2994
2994
|
() => 1
|
|
2995
|
-
), I = new
|
|
2996
|
-
I.setAttribute("position", new W(v, 3)), I.setAttribute("size", new W(m, 1)), I.setAttribute("opacity", new W(
|
|
2995
|
+
), I = new y();
|
|
2996
|
+
I.setAttribute("position", new W(v, 3)), I.setAttribute("size", new W(m, 1)), I.setAttribute("opacity", new W(f, 1)), I.setAttribute("speed", new W(N, 1)), I.setAttribute("color", new W(J, 3)), I.setAttribute("noise", new W(R, 3));
|
|
2997
2997
|
const g = new k({
|
|
2998
2998
|
uniforms: {
|
|
2999
2999
|
time: { value: 0 },
|
|
@@ -3004,9 +3004,9 @@ class Sr {
|
|
|
3004
3004
|
depthWrite: !1,
|
|
3005
3005
|
transparent: !0,
|
|
3006
3006
|
blending: ye
|
|
3007
|
-
}),
|
|
3008
|
-
g.uniforms.time.value =
|
|
3009
|
-
}, V = this.ssp.createPluginObject(t,
|
|
3007
|
+
}), S = new c(I, g), b = () => {
|
|
3008
|
+
g.uniforms.time.value = u.viewport.clock.elapsedTime, this.ssp.render();
|
|
3009
|
+
}, V = this.ssp.createPluginObject(t, S), h = () => this.ssp.viewport.postUpdate.set(t.id, b);
|
|
3010
3010
|
h();
|
|
3011
3011
|
const B = () => this.ssp.viewport.postUpdate.delete(t.id);
|
|
3012
3012
|
return V.addEventListener("added", h), V.addEventListener("removed", B), V;
|
|
@@ -3024,15 +3024,15 @@ class Sr {
|
|
|
3024
3024
|
blur: i = 1,
|
|
3025
3025
|
darkness: o = 1,
|
|
3026
3026
|
far: n = 10,
|
|
3027
|
-
resolution:
|
|
3028
|
-
...
|
|
3027
|
+
resolution: u = 512,
|
|
3028
|
+
...d
|
|
3029
3029
|
}) {
|
|
3030
3030
|
const {
|
|
3031
|
-
viewport: { renderer:
|
|
3032
|
-
THREE:
|
|
3031
|
+
viewport: { renderer: c, scene: k },
|
|
3032
|
+
THREE: y
|
|
3033
3033
|
} = this.ssp;
|
|
3034
3034
|
A = A * (Array.isArray(t) ? t[0] : t || 1), s = s * (Array.isArray(t) ? t[1] : t || 1);
|
|
3035
|
-
const W = new
|
|
3035
|
+
const W = new y.Group(), v = new y.OrthographicCamera(
|
|
3036
3036
|
-A / 2,
|
|
3037
3037
|
A / 2,
|
|
3038
3038
|
s / 2,
|
|
@@ -3041,23 +3041,23 @@ class Sr {
|
|
|
3041
3041
|
n
|
|
3042
3042
|
);
|
|
3043
3043
|
v.rotation.x = Math.PI / 2, W.add(v);
|
|
3044
|
-
const m = new
|
|
3045
|
-
|
|
3046
|
-
|
|
3044
|
+
const m = new y.WebGLRenderTarget(u, u), f = new y.WebGLRenderTarget(
|
|
3045
|
+
u,
|
|
3046
|
+
u
|
|
3047
3047
|
);
|
|
3048
|
-
|
|
3049
|
-
const N = new
|
|
3048
|
+
f.texture.generateMipmaps = m.texture.generateMipmaps = !1;
|
|
3049
|
+
const N = new y.PlaneGeometry(A, s).rotateX(
|
|
3050
3050
|
Math.PI / 2
|
|
3051
|
-
), R = new
|
|
3051
|
+
), R = new y.MeshBasicMaterial({
|
|
3052
3052
|
map: m.texture,
|
|
3053
3053
|
opacity: a,
|
|
3054
3054
|
transparent: !0,
|
|
3055
3055
|
depthWrite: !1
|
|
3056
|
-
}),
|
|
3057
|
-
|
|
3058
|
-
const I = new
|
|
3056
|
+
}), J = new y.Mesh(N, R);
|
|
3057
|
+
J.renderOrder = 1, J.scale.y = -1, W.add(J);
|
|
3058
|
+
const I = new y.Mesh(N);
|
|
3059
3059
|
I.visible = !1, W.add(I);
|
|
3060
|
-
const g = new
|
|
3060
|
+
const g = new y.MeshDepthMaterial();
|
|
3061
3061
|
g.userData.darkness = { value: o }, g.onBeforeCompile = function(C) {
|
|
3062
3062
|
C.uniforms.darkness = g.userData.darkness, C.fragmentShader = /* glsl */
|
|
3063
3063
|
`
|
|
@@ -3068,14 +3068,14 @@ class Sr {
|
|
|
3068
3068
|
)}
|
|
3069
3069
|
`;
|
|
3070
3070
|
}, g.depthTest = !1, g.depthWrite = !1;
|
|
3071
|
-
const
|
|
3071
|
+
const S = new y.ShaderMaterial(
|
|
3072
3072
|
Re
|
|
3073
3073
|
);
|
|
3074
|
-
|
|
3075
|
-
const b = new
|
|
3074
|
+
S.depthTest = !1;
|
|
3075
|
+
const b = new y.ShaderMaterial(Je);
|
|
3076
3076
|
b.depthTest = !1;
|
|
3077
3077
|
function V(C) {
|
|
3078
|
-
I.visible = !0, I.material =
|
|
3078
|
+
I.visible = !0, I.material = S, S.uniforms.tDiffuse.value = m.texture, S.uniforms.h.value = C * 1 / 256, c.setRenderTarget(f), c.render(I, v), I.material = b, b.uniforms.tDiffuse.value = f.texture, b.uniforms.v.value = C * 1 / 256, c.setRenderTarget(m), c.render(I, v), I.visible = !1;
|
|
3079
3079
|
}
|
|
3080
3080
|
let h = 0;
|
|
3081
3081
|
const B = () => {
|
|
@@ -3084,10 +3084,10 @@ class Sr {
|
|
|
3084
3084
|
h++;
|
|
3085
3085
|
const C = k.background;
|
|
3086
3086
|
k.background = null, k.overrideMaterial = g;
|
|
3087
|
-
const Z =
|
|
3088
|
-
|
|
3087
|
+
const Z = c.getClearAlpha();
|
|
3088
|
+
c.setClearAlpha(0), c.setRenderTarget(m), c.render(k, v), k.overrideMaterial = null, V(i), V(i * 0.4), c.setRenderTarget(null), c.setClearAlpha(Z), k.background = C;
|
|
3089
3089
|
}, U = this.ssp.createPluginObject(
|
|
3090
|
-
|
|
3090
|
+
d,
|
|
3091
3091
|
W
|
|
3092
3092
|
), j = () => this.ssp.signals.beforeRender.add(B);
|
|
3093
3093
|
j();
|
|
@@ -3107,42 +3107,42 @@ class Sr {
|
|
|
3107
3107
|
opacity: i = 0.9,
|
|
3108
3108
|
color: o = 16777215,
|
|
3109
3109
|
velocityX: n = [-0.02, 0.02],
|
|
3110
|
-
velocityY:
|
|
3110
|
+
velocityY: u = [0.4, 0.8]
|
|
3111
3111
|
} = t;
|
|
3112
3112
|
this._weatherId && this.closeWeather();
|
|
3113
3113
|
const {
|
|
3114
|
-
viewport: { renderer:
|
|
3114
|
+
viewport: { renderer: d, container: c },
|
|
3115
3115
|
utils: k
|
|
3116
|
-
} = this.ssp,
|
|
3116
|
+
} = this.ssp, y = new Float32Array(a * 3), W = Array.from({ length: a }).fill({
|
|
3117
3117
|
x: 0,
|
|
3118
3118
|
y: 0
|
|
3119
3119
|
}), v = new bt();
|
|
3120
|
-
for (let
|
|
3121
|
-
|
|
3120
|
+
for (let S = 0; S < a; S++)
|
|
3121
|
+
y[S * 3] = x.randFloatSpread(A), y[S * 3 + 1] = x.randFloatSpread(A), y[S * 3 + 2] = x.randFloatSpread(A), W[S].x = x.randFloat(...n), W[S].y = x.randFloat(...u);
|
|
3122
3122
|
const m = new M(
|
|
3123
|
-
|
|
3123
|
+
y,
|
|
3124
3124
|
3
|
|
3125
3125
|
);
|
|
3126
3126
|
m.setUsage(ct), v.setAttribute("position", m);
|
|
3127
|
-
const
|
|
3128
|
-
|
|
3127
|
+
const f = Y.utils.textureLoader.load(r);
|
|
3128
|
+
f.colorSpace = d.outputColorSpace;
|
|
3129
3129
|
const N = new Kt({
|
|
3130
3130
|
color: o,
|
|
3131
3131
|
size: s,
|
|
3132
3132
|
opacity: i,
|
|
3133
|
-
map:
|
|
3133
|
+
map: f,
|
|
3134
3134
|
transparent: !0
|
|
3135
|
-
}), R = new vt(v, N),
|
|
3135
|
+
}), R = new vt(v, N), J = new ce(), I = new ke(
|
|
3136
3136
|
45,
|
|
3137
|
-
|
|
3137
|
+
c.offsetWidth / c.offsetHeight,
|
|
3138
3138
|
0.1,
|
|
3139
3139
|
1e3
|
|
3140
3140
|
);
|
|
3141
|
-
I.position.set(0, 0, A / 2),
|
|
3141
|
+
I.position.set(0, 0, A / 2), J.add(R);
|
|
3142
3142
|
const g = () => {
|
|
3143
|
-
W.forEach((
|
|
3144
|
-
|
|
3145
|
-
}), m.needsUpdate = !0,
|
|
3143
|
+
W.forEach((S, b) => {
|
|
3144
|
+
y[b * 3] -= S.x, y[b * 3 + 1] -= S.y, (y[b * 3] <= -A / 2 || y[b * 3] >= A / 2) && (W[b].x *= -1), y[b * 3 + 1] <= -A / 2 && (y[b * 3 + 1] = A / 2);
|
|
3145
|
+
}), m.needsUpdate = !0, d.render(J, I), this.ssp.render();
|
|
3146
3146
|
};
|
|
3147
3147
|
this._weatherId = `weather_${k.randomString()}`, this.ssp.viewport.postRender.set(this._weatherId, g), this.ssp.render();
|
|
3148
3148
|
}
|
|
@@ -3209,29 +3209,29 @@ class Sr {
|
|
|
3209
3209
|
separation: i = 20,
|
|
3210
3210
|
size: o = 5,
|
|
3211
3211
|
maxFluctua: n = 0.1,
|
|
3212
|
-
color:
|
|
3213
|
-
opacity:
|
|
3214
|
-
} = t,
|
|
3212
|
+
color: u = "#485c7c",
|
|
3213
|
+
opacity: d = 1
|
|
3214
|
+
} = t, c = a * A, k = new Float32Array(c * 3), y = new Float32Array(c);
|
|
3215
3215
|
let W = 0, v = 0;
|
|
3216
|
-
for (let
|
|
3216
|
+
for (let S = 0; S < a; S++)
|
|
3217
3217
|
for (let b = 0; b < A; b++)
|
|
3218
|
-
k[W] =
|
|
3218
|
+
k[W] = S * i - a * i / 2, k[W + 1] = 0, k[W + 2] = b * i - A * i / 2, y[v] = 1, W += 3, v++;
|
|
3219
3219
|
const m = new bt();
|
|
3220
|
-
m.setAttribute("position", new M(k, 3).setUsage(ct)), m.setAttribute("size", new M(
|
|
3221
|
-
const
|
|
3220
|
+
m.setAttribute("position", new M(k, 3).setUsage(ct)), m.setAttribute("size", new M(y, 1).setUsage(ct));
|
|
3221
|
+
const f = new kt({
|
|
3222
3222
|
transparent: !0,
|
|
3223
3223
|
depthWrite: !1,
|
|
3224
3224
|
uniforms: {
|
|
3225
|
-
color: { value: new E(
|
|
3226
|
-
opacity: { value:
|
|
3225
|
+
color: { value: new E(u) },
|
|
3226
|
+
opacity: { value: d },
|
|
3227
3227
|
showDistance: { value: s }
|
|
3228
3228
|
},
|
|
3229
3229
|
vertexShader: xt.vertexShader,
|
|
3230
3230
|
fragmentShader: xt.fragmentShader
|
|
3231
|
-
}), N = new vt(m,
|
|
3231
|
+
}), N = new vt(m, f);
|
|
3232
3232
|
N.renderOrder = -1;
|
|
3233
3233
|
const R = () => {
|
|
3234
|
-
const
|
|
3234
|
+
const S = N.geometry.attributes.position.array, b = N.geometry.attributes.size.array;
|
|
3235
3235
|
let V = 0, h = 0;
|
|
3236
3236
|
const B = Math.sqrt(
|
|
3237
3237
|
a / 2 * (a / 2) + A / 2 * (A / 2)
|
|
@@ -3239,13 +3239,13 @@ class Sr {
|
|
|
3239
3239
|
for (let U = 0; U < a; U++)
|
|
3240
3240
|
for (let j = 0; j < A; j++) {
|
|
3241
3241
|
const L = U - a / 2, C = j - A / 2, Z = Math.sqrt(L * L + C * C);
|
|
3242
|
-
|
|
3242
|
+
S[V + 1] = Math.cos((Z / B * 50 - r) * 1) * 50 * n, b[h] = o, V += 3, h++;
|
|
3243
3243
|
}
|
|
3244
3244
|
N.geometry.attributes.position.needsUpdate = !0, N.geometry.attributes.size.needsUpdate = !0, r += 0.01, this.ssp.render();
|
|
3245
|
-
},
|
|
3245
|
+
}, J = this.ssp.createPluginObject(t, N), I = () => this.ssp.viewport.postUpdate.set(t.id, R);
|
|
3246
3246
|
I();
|
|
3247
3247
|
const g = () => this.ssp.viewport.postUpdate.delete(t.id);
|
|
3248
|
-
return
|
|
3248
|
+
return J.addEventListener("added", I), J.addEventListener("removed", g), J;
|
|
3249
3249
|
}
|
|
3250
3250
|
/**
|
|
3251
3251
|
* 创建建筑
|
|
@@ -3261,28 +3261,28 @@ class Sr {
|
|
|
3261
3261
|
gapX: i = 2,
|
|
3262
3262
|
gapZ: o = 2,
|
|
3263
3263
|
showDistance: n = 1e3,
|
|
3264
|
-
randShift:
|
|
3265
|
-
color:
|
|
3266
|
-
} = t,
|
|
3264
|
+
randShift: u = 0.5,
|
|
3265
|
+
color: d = "#485c7c"
|
|
3266
|
+
} = t, c = this.ssp.createPluginObject(t);
|
|
3267
3267
|
for (let k = 0; k < s; k++)
|
|
3268
|
-
for (let
|
|
3269
|
-
const W = (k - s / 2) * r * i + (Math.random() - 1) *
|
|
3268
|
+
for (let y = 0; y < s; y++) {
|
|
3269
|
+
const W = (k - s / 2) * r * i + (Math.random() - 1) * u * r * i, v = (y - s / 2) * a * o + (Math.random() - 1) * u * a * o;
|
|
3270
3270
|
if (Math.sqrt(W * W + v * v) < n) continue;
|
|
3271
3271
|
const N = Math.floor(Math.random() * A) + A, R = new Ct(r, N, a, 1, 1, 1);
|
|
3272
3272
|
R.translate(W, N / 2, v), R.computeBoundingBox();
|
|
3273
|
-
const
|
|
3273
|
+
const J = R.boundingBox, I = new kt({
|
|
3274
3274
|
transparent: !0,
|
|
3275
3275
|
depthWrite: !1,
|
|
3276
3276
|
uniforms: {
|
|
3277
|
-
color: { value: new E(
|
|
3278
|
-
lowHeight: { value: new Vt(
|
|
3277
|
+
color: { value: new E(d) },
|
|
3278
|
+
lowHeight: { value: new Vt(J.min.y, J.max.y) }
|
|
3279
3279
|
},
|
|
3280
3280
|
vertexShader: Ht.vertexShader,
|
|
3281
3281
|
fragmentShader: Ht.fragmentShader
|
|
3282
3282
|
}), g = new At(R, I);
|
|
3283
|
-
|
|
3283
|
+
c.add(g);
|
|
3284
3284
|
}
|
|
3285
|
-
return
|
|
3285
|
+
return c;
|
|
3286
3286
|
}
|
|
3287
3287
|
createWater(t) {
|
|
3288
3288
|
const { animation: r = !0 } = t, { ssp: a } = this, A = or({ ...t, fog: !!a.viewport.scene.fog }), s = a.createPluginObject(t, A), i = () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-effect",
|
|
3
3
|
"pluginName": "EffectPlugin",
|
|
4
|
-
"version": "2.14.
|
|
4
|
+
"version": "2.14.30",
|
|
5
5
|
"description": "Effect plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"gitHead": "4a87dd85050651088e11c3da777c49fab3db7e5d",
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"soonspacejs": "2.14.
|
|
22
|
+
"soonspacejs": "2.14.30"
|
|
23
23
|
}
|
|
24
24
|
}
|