hz-particles 1.5.4 → 1.5.6
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-lib/hz-particles.cjs +5 -5
- package/dist-lib/hz-particles.d.ts +7 -0
- package/dist-lib/hz-particles.mjs +148 -105
- package/package.json +1 -1
|
@@ -361,6 +361,13 @@ export class ParticleSystemManager {
|
|
|
361
361
|
removeSystem(index: number): boolean;
|
|
362
362
|
destroy(): void;
|
|
363
363
|
respawnAllSystems(): void;
|
|
364
|
+
/** Respawn ONE group (the ids returned by addSystems) and leave every other system alone.
|
|
365
|
+
* The group gets its own time origin and duration: its startAt delays and keyframes are read
|
|
366
|
+
* from its birth, not from the shared timeline. Hosts that add groups to a LIVE overlay must
|
|
367
|
+
* use this - respawnAllSystems restarts every effect on screen. */
|
|
368
|
+
respawnSystems(ids: Iterable<number>): void;
|
|
369
|
+
/** Timeline length of an arbitrary set of configs (the group-scoped getTotalDuration). */
|
|
370
|
+
durationOfConfigs(configs: ParticleSystemConfig[]): number;
|
|
364
371
|
updateAllSystems(deltaTime: number): void;
|
|
365
372
|
getSystemsList(): SystemInfo[];
|
|
366
373
|
duplicateActiveSystem(): number;
|
|
@@ -193,8 +193,8 @@ class qs {
|
|
|
193
193
|
if (Math.abs(a) < 1e-6 || o <= 1e-6)
|
|
194
194
|
l = Math.random();
|
|
195
195
|
else {
|
|
196
|
-
const S = Math.random(), b = 0.5 * a, f = e, v = -S * o,
|
|
197
|
-
l = (-f + Math.sqrt(
|
|
196
|
+
const S = Math.random(), b = 0.5 * a, f = e, v = -S * o, U = Math.max(0, f * f - 4 * b * v);
|
|
197
|
+
l = (-f + Math.sqrt(U)) / (2 * b), Number.isFinite(l) || (l = Math.random()), l = Math.min(1, Math.max(0, l));
|
|
198
198
|
}
|
|
199
199
|
const c = l * r, d = e + a * l;
|
|
200
200
|
t[0] = Math.cos(n) * d, t[1] = c, t[2] = Math.sin(n) * d;
|
|
@@ -257,32 +257,32 @@ class qs {
|
|
|
257
257
|
}
|
|
258
258
|
calculateVelocity(t, e, i, r, n) {
|
|
259
259
|
const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, l = this.config.emissionPositionZ || 0, c = t - a, d = e - o, S = i - l, b = Math.sqrt(c * c + d * d + S * S);
|
|
260
|
-
let f, v,
|
|
260
|
+
let f, v, U;
|
|
261
261
|
if (b > 1e-4) {
|
|
262
262
|
let D = !1;
|
|
263
263
|
if (this.config.emissionShape === "circle" && this.config.circleVelocityDirection === "tangential") {
|
|
264
264
|
const M = this.inverseRotation(c, d, S), Z = Math.sqrt(M[0] * M[0] + M[1] * M[1]);
|
|
265
265
|
if (Z > 1e-4) {
|
|
266
266
|
const T = -M[1] / Z, G = M[0] / Z, F = this.applyRotation(T, G, 0);
|
|
267
|
-
f = F[0], v = F[1],
|
|
267
|
+
f = F[0], v = F[1], U = F[2], D = !0;
|
|
268
268
|
}
|
|
269
269
|
} else if (this.config.emissionShape === "cylinder" && this.config.cylinderVelocityDirection === "tangential") {
|
|
270
270
|
const M = this.inverseRotation(c, d, S), Z = Math.sqrt(M[0] * M[0] + M[2] * M[2]);
|
|
271
271
|
if (Z > 1e-4) {
|
|
272
272
|
const T = -M[2] / Z, G = M[0] / Z, F = this.applyRotation(T, 0, G);
|
|
273
|
-
f = F[0], v = F[1],
|
|
273
|
+
f = F[0], v = F[1], U = F[2], D = !0;
|
|
274
274
|
} else {
|
|
275
275
|
const T = Math.random() * Math.PI * 2, G = this.applyRotation(Math.cos(T), 0, Math.sin(T));
|
|
276
|
-
f = G[0], v = G[1],
|
|
276
|
+
f = G[0], v = G[1], U = G[2], D = !0;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
D || (f = c / b, v = d / b,
|
|
279
|
+
D || (f = c / b, v = d / b, U = S / b);
|
|
280
280
|
} else {
|
|
281
281
|
const D = Math.random() * Math.PI * 2, M = Math.acos(2 * Math.random() - 1);
|
|
282
|
-
f = Math.sin(M) * Math.cos(D), v = Math.sin(M) * Math.sin(D),
|
|
282
|
+
f = Math.sin(M) * Math.cos(D), v = Math.sin(M) * Math.sin(D), U = Math.cos(M);
|
|
283
283
|
}
|
|
284
284
|
let z;
|
|
285
|
-
this.config.randomSpeed ? z = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : z = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : f * z, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : v * z, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity :
|
|
285
|
+
this.config.randomSpeed ? z = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : z = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : f * z, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : v * z, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : U * z, r[n + 3] = 0;
|
|
286
286
|
}
|
|
287
287
|
setParticleColor(t, e) {
|
|
288
288
|
if (this.config.randomColorEnabled && this.config.randomColors.length > 0) {
|
|
@@ -1854,7 +1854,7 @@ async function or(s) {
|
|
|
1854
1854
|
const f = c.indices;
|
|
1855
1855
|
if (f === void 0)
|
|
1856
1856
|
throw new Error("Mesh primitive missing indices");
|
|
1857
|
-
const v = Fi(a, o, f),
|
|
1857
|
+
const v = Fi(a, o, f), U = S.length / 3, z = v.length;
|
|
1858
1858
|
let D = null;
|
|
1859
1859
|
c.attributes.TEXCOORD_0 !== void 0 && (D = ti(a, o, c.attributes.TEXCOORD_0, 2, 5126));
|
|
1860
1860
|
let M = !1;
|
|
@@ -1874,7 +1874,7 @@ async function or(s) {
|
|
|
1874
1874
|
normals: b,
|
|
1875
1875
|
indices: v,
|
|
1876
1876
|
texCoords: D,
|
|
1877
|
-
vertexCount:
|
|
1877
|
+
vertexCount: U,
|
|
1878
1878
|
indexCount: z,
|
|
1879
1879
|
animationData: Z,
|
|
1880
1880
|
hasBaseColorTexture: M
|
|
@@ -2011,12 +2011,12 @@ function hr(s, t, e) {
|
|
|
2011
2011
|
const S = [];
|
|
2012
2012
|
let b = 0;
|
|
2013
2013
|
for (const f of d.channels) {
|
|
2014
|
-
const v = d.samplers[f.sampler],
|
|
2014
|
+
const v = d.samplers[f.sampler], U = fr(s, t, v.input), z = pr(s, t, v.output), D = U[U.length - 1];
|
|
2015
2015
|
D > b && (b = D), S.push({
|
|
2016
2016
|
targetNode: f.target.node,
|
|
2017
2017
|
targetPath: f.target.path,
|
|
2018
2018
|
interpolation: v.interpolation || "LINEAR",
|
|
2019
|
-
timestamps:
|
|
2019
|
+
timestamps: U,
|
|
2020
2020
|
values: z
|
|
2021
2021
|
});
|
|
2022
2022
|
}
|
|
@@ -2070,7 +2070,7 @@ async function Vi(s) {
|
|
|
2070
2070
|
return null;
|
|
2071
2071
|
if (!o)
|
|
2072
2072
|
throw new Error("GLB file missing BIN chunk (required for embedded textures)");
|
|
2073
|
-
const v = a.bufferViews[b.bufferView],
|
|
2073
|
+
const v = a.bufferViews[b.bufferView], U = v.byteOffset || 0, z = v.byteLength, D = o.slice(U, U + z);
|
|
2074
2074
|
return { imageBlob: new Blob([D], { type: f }), mimeType: f };
|
|
2075
2075
|
}
|
|
2076
2076
|
function mr(s, t, e, i) {
|
|
@@ -2088,8 +2088,8 @@ function yr(s, t, e, i) {
|
|
|
2088
2088
|
return i[0] = s[0] * l + n * t[0] * c, i[1] = s[1] * l + n * t[1] * c, i[2] = s[2] * l + n * t[2] * c, i[3] = s[3] * l + n * t[3] * c, i;
|
|
2089
2089
|
}
|
|
2090
2090
|
function gr(s, t) {
|
|
2091
|
-
const e = s[0], i = s[1], r = s[2], n = s[3], a = e + e, o = i + i, l = r + r, c = e * a, d = e * o, S = e * l, b = i * o, f = i * l, v = r * l,
|
|
2092
|
-
return M[0] = 1 - (b + v), M[1] = d + D, M[2] = S - z, M[3] = 0, M[4] = d - D, M[5] = 1 - (c + v), M[6] = f +
|
|
2091
|
+
const e = s[0], i = s[1], r = s[2], n = s[3], a = e + e, o = i + i, l = r + r, c = e * a, d = e * o, S = e * l, b = i * o, f = i * l, v = r * l, U = n * a, z = n * o, D = n * l, M = t || new Float32Array(16);
|
|
2092
|
+
return M[0] = 1 - (b + v), M[1] = d + D, M[2] = S - z, M[3] = 0, M[4] = d - D, M[5] = 1 - (c + v), M[6] = f + U, M[7] = 0, M[8] = S + z, M[9] = f - U, M[10] = 1 - (c + b), M[11] = 0, M[12] = 0, M[13] = 0, M[14] = 0, M[15] = 1, M;
|
|
2093
2093
|
}
|
|
2094
2094
|
const br = new Float32Array(16);
|
|
2095
2095
|
function Sr(s, t, e, i) {
|
|
@@ -2260,8 +2260,8 @@ class xr {
|
|
|
2260
2260
|
return this._extractValue(n, r.length - 1, o, i);
|
|
2261
2261
|
let l = 0, c = r.length - 1;
|
|
2262
2262
|
for (; c - l > 1; ) {
|
|
2263
|
-
const
|
|
2264
|
-
r[
|
|
2263
|
+
const U = Math.floor((l + c) / 2);
|
|
2264
|
+
r[U] <= e ? l = U : c = U;
|
|
2265
2265
|
}
|
|
2266
2266
|
const d = r[l], S = r[c], b = (e - d) / (S - d), f = this._extractValue(n, l, o, this._sV0), v = this._extractValue(n, c, o, this._sV1);
|
|
2267
2267
|
return a === "STEP" ? (i[0] = f[0], i[1] = f[1], i[2] = f[2], o === "rotation" && (i[3] = f[3]), i) : o === "rotation" ? yr(f, v, b, i) : mr(f, v, b, i);
|
|
@@ -2322,13 +2322,13 @@ class xr {
|
|
|
2322
2322
|
_applySkinning() {
|
|
2323
2323
|
const t = this.restPositions.length / 3, e = this.restPositions, i = this.restNormals, r = this.skinnedPositions, n = this.skinnedNormals, a = this.jointWeights, o = this.jointIndices, l = this.jointFinalMatrices;
|
|
2324
2324
|
for (let c = 0; c < t; c++) {
|
|
2325
|
-
const d = c * 3, S = c * 4, b = e[d], f = e[d + 1], v = e[d + 2],
|
|
2325
|
+
const d = c * 3, S = c * 4, b = e[d], f = e[d + 1], v = e[d + 2], U = i[d], z = i[d + 1], D = i[d + 2];
|
|
2326
2326
|
let M = 0, Z = 0, T = 0, G = 0, F = 0, H = 0;
|
|
2327
2327
|
for (let ne = 0; ne < 4; ne++) {
|
|
2328
2328
|
const re = a[S + ne];
|
|
2329
2329
|
if (re === 0) continue;
|
|
2330
2330
|
const q = l[o[S + ne]];
|
|
2331
|
-
M += (q[0] * b + q[4] * f + q[8] * v + q[12]) * re, Z += (q[1] * b + q[5] * f + q[9] * v + q[13]) * re, T += (q[2] * b + q[6] * f + q[10] * v + q[14]) * re, G += (q[0] *
|
|
2331
|
+
M += (q[0] * b + q[4] * f + q[8] * v + q[12]) * re, Z += (q[1] * b + q[5] * f + q[9] * v + q[13]) * re, T += (q[2] * b + q[6] * f + q[10] * v + q[14]) * re, G += (q[0] * U + q[4] * z + q[8] * D) * re, F += (q[1] * U + q[5] * z + q[9] * D) * re, H += (q[2] * U + q[6] * z + q[10] * D) * re;
|
|
2332
2332
|
}
|
|
2333
2333
|
const se = Math.sqrt(G * G + F * F + H * H);
|
|
2334
2334
|
se > 1e-4 && (n[d] = G / se, n[d + 1] = F / se, n[d + 2] = H / se), r[d] = M, r[d + 1] = Z, r[d + 2] = T;
|
|
@@ -2381,7 +2381,7 @@ function Pr(s, t, e, i) {
|
|
|
2381
2381
|
if (f <= 0) return 0;
|
|
2382
2382
|
if (f >= 1) return 1;
|
|
2383
2383
|
let v = f;
|
|
2384
|
-
for (let
|
|
2384
|
+
for (let U = 0; U < 8; U++) {
|
|
2385
2385
|
const z = d(v) - f;
|
|
2386
2386
|
if (Math.abs(z) < 1e-5) break;
|
|
2387
2387
|
const D = b(v);
|
|
@@ -2935,7 +2935,11 @@ class Rr {
|
|
|
2935
2935
|
}, n = new ii(this.device, r);
|
|
2936
2936
|
return this.particleSystems.push({
|
|
2937
2937
|
system: n,
|
|
2938
|
-
config: r
|
|
2938
|
+
config: r,
|
|
2939
|
+
// Shared timeline by default: 0 means "read the manager clock as-is", which is what every
|
|
2940
|
+
// system did before groups could own a timeline. respawnSystems gives a group its own.
|
|
2941
|
+
timeOrigin: 0,
|
|
2942
|
+
groupDuration: 0
|
|
2939
2943
|
}), this.particleSystems.length === 1 && (this.activeSystemIndex = 0), this.onSystemCreated && typeof this.onSystemCreated == "function" && this.onSystemCreated(e, r), e;
|
|
2940
2944
|
}
|
|
2941
2945
|
getActiveSystem() {
|
|
@@ -2972,41 +2976,73 @@ class Rr {
|
|
|
2972
2976
|
respawnAllSystems() {
|
|
2973
2977
|
var t;
|
|
2974
2978
|
(t = this.clock) == null || t.reset();
|
|
2975
|
-
for (const
|
|
2976
|
-
e.spawnParticles(() => this._applyKeyframesToSystem(e,
|
|
2979
|
+
for (const e of this.particleSystems)
|
|
2980
|
+
e.timeOrigin = 0, e.system.spawnParticles(() => this._applyKeyframesToSystem(e.system, e.config, 0));
|
|
2981
|
+
}
|
|
2982
|
+
/**
|
|
2983
|
+
* Respawn ONE group and leave every other system alone.
|
|
2984
|
+
*
|
|
2985
|
+
* Why this exists: a host that keeps adding groups to a live overlay (a game spawning a splash,
|
|
2986
|
+
* a trail, a surface effect) used to go through respawnAllSystems, which resets the shared clock
|
|
2987
|
+
* and re-emits EVERY system. Every splash therefore restarted the whole map's effects, and any
|
|
2988
|
+
* burst still playing was restarted under the player's eyes.
|
|
2989
|
+
*
|
|
2990
|
+
* The group gets its own time origin, so its startAt delays and its keyframes are sampled from
|
|
2991
|
+
* ITS birth rather than from the shared timeline of effects that started minutes earlier.
|
|
2992
|
+
*/
|
|
2993
|
+
respawnSystems(t) {
|
|
2994
|
+
const e = t instanceof Set ? t : new Set(t || []);
|
|
2995
|
+
if (e.size === 0) return;
|
|
2996
|
+
const i = this.clock ? this.clock.currentTime : 0, r = [];
|
|
2997
|
+
for (const a of this.particleSystems)
|
|
2998
|
+
e.has(a.config.id) && (a.timeOrigin = i, r.push(a.config));
|
|
2999
|
+
if (r.length === 0) return;
|
|
3000
|
+
const n = this.durationOfConfigs(r);
|
|
3001
|
+
for (const a of this.particleSystems)
|
|
3002
|
+
e.has(a.config.id) && (a.groupDuration = n, a.system.spawnParticles(() => this._applyKeyframesToSystem(a.system, a.config, 0)));
|
|
2977
3003
|
}
|
|
2978
3004
|
// Total effect duration in seconds for the timeline/loop (Infinity if any system emits
|
|
2979
3005
|
// forever). Burst/one-only systems last only their lifetime (they emit at t=0). This is the
|
|
2980
3006
|
// single source of truth used by the unified clock (overlay + editor consume it).
|
|
2981
3007
|
getTotalDuration() {
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3008
|
+
return this.durationOfConfigs(this.particleSystems.map(({ config: t }) => t));
|
|
3009
|
+
}
|
|
3010
|
+
// Timeline length of an arbitrary set of configs. Extracted from getTotalDuration so a GROUP
|
|
3011
|
+
// added at runtime can own its own duration instead of borrowing the whole manager's.
|
|
3012
|
+
durationOfConfigs(t) {
|
|
3013
|
+
let e = 0;
|
|
3014
|
+
for (const i of t) {
|
|
3015
|
+
if (i.emissionDurationInfinite) return 1 / 0;
|
|
3016
|
+
const r = i.lifetime || 5, n = (i.burstMode || i.oneOnlyMode ? r : (i.emissionDuration || 10) + r) + (i.startAt || 0);
|
|
3017
|
+
n > e && (e = n);
|
|
2987
3018
|
}
|
|
2988
|
-
return
|
|
3019
|
+
return e || 1;
|
|
2989
3020
|
}
|
|
2990
3021
|
updateAllSystems(t) {
|
|
2991
3022
|
const e = this.device.createCommandEncoder({ label: "BatchedPhysicsEncoder" });
|
|
2992
3023
|
let i = !1;
|
|
2993
|
-
const r = this.clock ? this.clock.currentTime : 0
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3024
|
+
const r = this.clock ? this.clock.currentTime : 0;
|
|
3025
|
+
for (const a of this.particleSystems)
|
|
3026
|
+
a._localTime = Math.max(0, r - (a.timeOrigin || 0));
|
|
3027
|
+
const n = this.clock ? this.clock.duration : 0;
|
|
3028
|
+
if (this.clock)
|
|
3029
|
+
for (const a of this.particleSystems) {
|
|
3030
|
+
const o = a.groupDuration || n;
|
|
3031
|
+
!(o > 0) || !isFinite(o) || this._applyKeyframesToSystem(a.system, a.config, Math.min(1, a._localTime / o));
|
|
3032
|
+
}
|
|
3033
|
+
for (const a of this.particleSystems) {
|
|
3034
|
+
const { system: o, config: l } = a;
|
|
3035
|
+
if (l.hidden || l.followSystemId) continue;
|
|
3036
|
+
const c = o.activeParticles > 0;
|
|
3037
|
+
o.updateParticles(t, e, a._localTime), (c || o.activeParticles > 0) && (i = !0);
|
|
3003
3038
|
}
|
|
3004
|
-
for (const
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3039
|
+
for (const a of this.particleSystems) {
|
|
3040
|
+
const { system: o, config: l } = a;
|
|
3041
|
+
if (l.hidden || !l.followSystemId) continue;
|
|
3042
|
+
const c = this.getSystemById(l.followSystemId);
|
|
3043
|
+
c && (o._pendingFollowEmissions = c.system._newEmissions);
|
|
3044
|
+
const d = o.activeParticles > 0;
|
|
3045
|
+
o.updateParticles(t, e, a._localTime), (d || o.activeParticles > 0) && (i = !0);
|
|
3010
3046
|
}
|
|
3011
3047
|
i && this.device.queue.submit([e.finish()]);
|
|
3012
3048
|
for (const { system: a } of this.particleSystems)
|
|
@@ -3045,7 +3081,9 @@ class Rr {
|
|
|
3045
3081
|
}, o = new ii(this.device, a);
|
|
3046
3082
|
this.particleSystems.push({
|
|
3047
3083
|
system: o,
|
|
3048
|
-
config: a
|
|
3084
|
+
config: a,
|
|
3085
|
+
timeOrigin: 0,
|
|
3086
|
+
groupDuration: 0
|
|
3049
3087
|
});
|
|
3050
3088
|
}
|
|
3051
3089
|
const i = {};
|
|
@@ -3139,7 +3177,9 @@ class Rr {
|
|
|
3139
3177
|
const d = new ii(this.device, c);
|
|
3140
3178
|
this.particleSystems.push({
|
|
3141
3179
|
system: d,
|
|
3142
|
-
config: c
|
|
3180
|
+
config: c,
|
|
3181
|
+
timeOrigin: 0,
|
|
3182
|
+
groupDuration: 0
|
|
3143
3183
|
}), this.onSystemCreated && typeof this.onSystemCreated == "function" && this.onSystemCreated(l, c);
|
|
3144
3184
|
}
|
|
3145
3185
|
const n = this.particleSystems.length - t.systems.length, a = {};
|
|
@@ -3672,7 +3712,7 @@ function Ur(s, t, e, i = {}) {
|
|
|
3672
3712
|
code: Hs
|
|
3673
3713
|
}), v = s.createShaderModule({
|
|
3674
3714
|
code: Zs
|
|
3675
|
-
}),
|
|
3715
|
+
}), U = s.createShaderModule({
|
|
3676
3716
|
code: Ws
|
|
3677
3717
|
}), z = s.createShaderModule({
|
|
3678
3718
|
code: $s
|
|
@@ -3883,11 +3923,11 @@ function Ur(s, t, e, i = {}) {
|
|
|
3883
3923
|
}), se = s.createRenderPipeline({
|
|
3884
3924
|
layout: b,
|
|
3885
3925
|
vertex: {
|
|
3886
|
-
module:
|
|
3926
|
+
module: U,
|
|
3887
3927
|
entryPoint: "vs_main"
|
|
3888
3928
|
},
|
|
3889
3929
|
fragment: {
|
|
3890
|
-
module:
|
|
3930
|
+
module: U,
|
|
3891
3931
|
entryPoint: "fs_main",
|
|
3892
3932
|
targets: [{
|
|
3893
3933
|
format: Xe,
|
|
@@ -4227,7 +4267,7 @@ function si(s, t, e, i) {
|
|
|
4227
4267
|
resource: { buffer: o }
|
|
4228
4268
|
}
|
|
4229
4269
|
]
|
|
4230
|
-
}),
|
|
4270
|
+
}), U = s.createBindGroup({
|
|
4231
4271
|
layout: s.createBindGroupLayout({
|
|
4232
4272
|
entries: [
|
|
4233
4273
|
{
|
|
@@ -4318,7 +4358,7 @@ function si(s, t, e, i) {
|
|
|
4318
4358
|
particleBindGroup: b,
|
|
4319
4359
|
horizontalBlurBindGroup: f,
|
|
4320
4360
|
verticalBlurBindGroup: v,
|
|
4321
|
-
compositeBindGroup:
|
|
4361
|
+
compositeBindGroup: U,
|
|
4322
4362
|
directRenderBindGroup: z
|
|
4323
4363
|
};
|
|
4324
4364
|
}
|
|
@@ -4936,9 +4976,9 @@ async function Or(s, t = {}) {
|
|
|
4936
4976
|
let v = 0;
|
|
4937
4977
|
for (const G of n)
|
|
4938
4978
|
f.set(G, v), v += G.length;
|
|
4939
|
-
const
|
|
4979
|
+
const U = S.length + b, z = 20 + U + 8 + a, D = new ArrayBuffer(z), M = new DataView(D), Z = new Uint8Array(D);
|
|
4940
4980
|
let T = 0;
|
|
4941
|
-
M.setUint32(T, ai, !0), T += 4, M.setUint32(T, Ki, !0), T += 4, M.setUint32(T, z, !0), T += 4, M.setUint32(T,
|
|
4981
|
+
M.setUint32(T, ai, !0), T += 4, M.setUint32(T, Ki, !0), T += 4, M.setUint32(T, z, !0), T += 4, M.setUint32(T, U, !0), T += 4, M.setUint32(T, Qi, !0), T += 4, Z.set(S, T), T += S.length;
|
|
4942
4982
|
for (let G = 0; G < b; G++) Z[T++] = 32;
|
|
4943
4983
|
return M.setUint32(T, a, !0), T += 4, M.setUint32(T, es, !0), T += 4, Z.set(f, T), T += a, D;
|
|
4944
4984
|
}
|
|
@@ -5336,7 +5376,7 @@ async function Jr(s, t = {}) {
|
|
|
5336
5376
|
clear() {
|
|
5337
5377
|
this.systemBindGroups = {}, this.systemBloomHorizontalBindGroups = {}, this.secondHorizontalBindGroups = {}, this.systemBloomCompositeBindGroups = {}, this.combinedBloomCompositeBindGroups = {}, this.combinedInitialBindGroup = null, this.finalBindGroup = null, this.textureStates = {}, this.textureRefs = {};
|
|
5338
5378
|
}
|
|
5339
|
-
}, v = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }),
|
|
5379
|
+
}, v = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), U = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), z = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), D = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), Z = St(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), T = {}, G = () => St(r, new Float32Array([-0.5, -0.5, 0, 0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0]), GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST);
|
|
5340
5380
|
c.onSystemCreated = (u) => {
|
|
5341
5381
|
T[u] || (T[u] = G());
|
|
5342
5382
|
};
|
|
@@ -5464,8 +5504,8 @@ async function Jr(s, t = {}) {
|
|
|
5464
5504
|
g = !0, h = Math.max(3, y), P = [0, 0, 1];
|
|
5465
5505
|
const B = Math.max(3, Math.floor(u.polygonSides ?? 6)), x = u.polygonRadius ?? 2;
|
|
5466
5506
|
for (let R = 0; R < h; R++) {
|
|
5467
|
-
const m = R / h * B, w = Math.floor(m), E = m - w, N = w / B * pt, X = (w + 1) / B * pt, O = Math.cos(N) * x,
|
|
5468
|
-
ae[R] = O + (ye - O) * E, oe[R] =
|
|
5507
|
+
const m = R / h * B, w = Math.floor(m), E = m - w, N = w / B * pt, X = (w + 1) / B * pt, O = Math.cos(N) * x, A = Math.sin(N) * x, ye = Math.cos(X) * x, xe = Math.sin(X) * x;
|
|
5508
|
+
ae[R] = O + (ye - O) * E, oe[R] = A + (xe - A) * E, le[R] = 0;
|
|
5469
5509
|
}
|
|
5470
5510
|
} else
|
|
5471
5511
|
h = 0;
|
|
@@ -5491,7 +5531,7 @@ async function Jr(s, t = {}) {
|
|
|
5491
5531
|
N === "zigzag" ? he = I * Math.sign(Math.sin(Se) || 1) : N === "sine" ? he = I * Math.sin(Se) : N === "spiral" && (he = I * Math.sin(Se), me = I * Math.cos(Se)), ae[W] += ve * he + m * me, oe[W] += ue * he + w * me, le[W] += He * he + E * me;
|
|
5492
5532
|
}
|
|
5493
5533
|
}
|
|
5494
|
-
const X = g ? h : h - 1, O = y.bloomIntensity || 1,
|
|
5534
|
+
const X = g ? h : h - 1, O = y.bloomIntensity || 1, A = y.startColor ?? y.particleColor ?? [1, 1, 1], ye = y.endColor ?? A, xe = y.particleColor ?? A, Oe = y.randomColorEnabled && Array.isArray(y.randomColors) && y.randomColors.length > 0 ? y.randomColors[0] : null, fe = B * 0.5, _t = Math.max(B * 4, 1e-4), je = (y.shapeStrokeSpeed ?? 0) * Ve;
|
|
5495
5535
|
let it = 0;
|
|
5496
5536
|
for (let I = 0; I < X; I++) {
|
|
5497
5537
|
const K = g ? (I + 1) % h : I + 1;
|
|
@@ -5522,9 +5562,9 @@ async function Jr(s, t = {}) {
|
|
|
5522
5562
|
Q /= ce, J /= ce, te /= ce;
|
|
5523
5563
|
const be = g ? I / h : I / Math.max(1, h - 1), ve = g ? K / h : K / Math.max(1, h - 1), ue = qe * Mt + je, He = (qe + ce) * Mt + je;
|
|
5524
5564
|
let Me, Se, he, me, we, Be;
|
|
5525
|
-
Oe ? (Me = me = Oe[0], Se = we = Oe[1], he = Be = Oe[2]) : y.colorTransitionEnabled ? (Me =
|
|
5526
|
-
const Bt = Xt[I], gt = Nt[I], Le = Yt[I], ke = Xt[K], ze = Nt[K], Rt = Yt[K], Ot = Ie + Bt * fe, Lt = W + gt * fe, Tt = pe + Le * fe, Re = Ie - Bt * fe, Te = W - gt * fe, Ee = pe - Le * fe, st = ee + ke * fe, rt = ge + ze * fe, Et = $ + Rt * fe, Ze = ee - ke * fe, We = ge - ze * fe, $e = $ - Rt * fe, ft = (
|
|
5527
|
-
Ce[u++] =
|
|
5565
|
+
Oe ? (Me = me = Oe[0], Se = we = Oe[1], he = Be = Oe[2]) : y.colorTransitionEnabled ? (Me = A[0] + (ye[0] - A[0]) * be, Se = A[1] + (ye[1] - A[1]) * be, he = A[2] + (ye[2] - A[2]) * be, me = A[0] + (ye[0] - A[0]) * ve, we = A[1] + (ye[1] - A[1]) * ve, Be = A[2] + (ye[2] - A[2]) * ve) : (Me = me = xe[0], Se = we = xe[1], he = Be = xe[2]), Me = Math.min(1, Me * O), Se = Math.min(1, Se * O), he = Math.min(1, he * O), me = Math.min(1, me * O), we = Math.min(1, we * O), Be = Math.min(1, Be * O);
|
|
5566
|
+
const Bt = Xt[I], gt = Nt[I], Le = Yt[I], ke = Xt[K], ze = Nt[K], Rt = Yt[K], Ot = Ie + Bt * fe, Lt = W + gt * fe, Tt = pe + Le * fe, Re = Ie - Bt * fe, Te = W - gt * fe, Ee = pe - Le * fe, st = ee + ke * fe, rt = ge + ze * fe, Et = $ + Rt * fe, Ze = ee - ke * fe, We = ge - ze * fe, $e = $ - Rt * fe, ft = (C, k, de, Y, L, j, ie, Je, Ke) => {
|
|
5567
|
+
Ce[u++] = C, Ce[u++] = k, Ce[u++] = de, Ce[u++] = Y, Ce[u++] = L, Ce[u++] = j, Ce[u++] = ie, Ce[u++] = Je, Ce[u++] = Ke;
|
|
5528
5568
|
};
|
|
5529
5569
|
ft(Ot, Lt, Tt, Me, Se, he, x, ue, 0), ft(Re, Te, Ee, Me, Se, he, x, ue, 1), ft(st, rt, Et, me, we, Be, x, He, 0), ft(Re, Te, Ee, Me, Se, he, x, ue, 1), ft(Ze, We, $e, me, we, Be, x, He, 1), ft(st, rt, Et, me, we, Be, x, He, 0), qe += ce;
|
|
5530
5570
|
}
|
|
@@ -5541,7 +5581,7 @@ async function Jr(s, t = {}) {
|
|
|
5541
5581
|
h.readbackAndProcessParticles();
|
|
5542
5582
|
const _ = h.particleData, B = h.particleVelocities, x = h.activeParticles;
|
|
5543
5583
|
if (_ && B && x > 0) {
|
|
5544
|
-
const R = g.emissionTrailMode === "particles", m = u, w = g.emissionTrailDuration ?? 1, E = g.opacity ?? 1, N = g.particleSize ?? 0.5, X = g.bloomIntensity || 1, O = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)),
|
|
5584
|
+
const R = g.emissionTrailMode === "particles", m = u, w = g.emissionTrailDuration ?? 1, E = g.opacity ?? 1, N = g.particleSize ?? 0.5, X = g.bloomIntensity || 1, O = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)), A = g.emissionTrailShape || "straight", ye = g.followSystemTranslation ?? !0, xe = h._simPosition, Oe = ye && xe ? xe[0] : 0, fe = ye && xe ? xe[1] : 0, _t = ye && xe ? xe[2] : 0, je = h._simVelocity, it = je ? je[0] : 0, Qt = je ? je[1] : 0, Mt = je ? je[2] : 0, qe = oi(g.id), wt = !!(ye && qe && qe.hist && qe.hist.length > 1);
|
|
5545
5585
|
for (let ut = 0; ut < x; ut++) {
|
|
5546
5586
|
const Ue = ut * 8, dt = _[Ue], I = _[Ue + 1], K = _[Ue + 2], Ie = dt + Oe, W = I + fe, pe = K + _t;
|
|
5547
5587
|
let ee = _[Ue + 3], ge = _[Ue + 4], $ = _[Ue + 5];
|
|
@@ -5549,22 +5589,22 @@ async function Jr(s, t = {}) {
|
|
|
5549
5589
|
if (Q >= J || J <= 0) continue;
|
|
5550
5590
|
const te = Q / J;
|
|
5551
5591
|
if (g.colorTransitionEnabled) {
|
|
5552
|
-
const
|
|
5553
|
-
ee =
|
|
5592
|
+
const C = g.startColor ?? [1, 0, 0], k = g.endColor ?? [0, 0, 1];
|
|
5593
|
+
ee = C[0] + (k[0] - C[0]) * te, ge = C[1] + (k[1] - C[1]) * te, $ = C[2] + (k[2] - C[2]) * te;
|
|
5554
5594
|
}
|
|
5555
5595
|
ee = Math.min(1, ee * X), ge = Math.min(1, ge * X), $ = Math.min(1, $ * X);
|
|
5556
5596
|
let ce = N;
|
|
5557
5597
|
if (g.randomSize) {
|
|
5558
|
-
const
|
|
5598
|
+
const C = Math.sin(J * 54321.67) * 43758.5453 % 1, k = C < 0 ? C + 1 : C;
|
|
5559
5599
|
ce = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * k;
|
|
5560
5600
|
}
|
|
5561
5601
|
if (g.fadeSizeEnabled) {
|
|
5562
|
-
const
|
|
5563
|
-
ce *= 1 - Math.pow(te, 1 /
|
|
5602
|
+
const C = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
|
|
5603
|
+
ce *= 1 - Math.pow(te, 1 / C);
|
|
5564
5604
|
}
|
|
5565
5605
|
if (g.increaseSizeEnabled) {
|
|
5566
|
-
const
|
|
5567
|
-
ce *= 1 + Math.pow(te, 1 /
|
|
5606
|
+
const C = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
|
|
5607
|
+
ce *= 1 + Math.pow(te, 1 / C);
|
|
5568
5608
|
}
|
|
5569
5609
|
if (ce <= 0 || te > 0.9) continue;
|
|
5570
5610
|
const be = Math.min((0.9 - te) * (1 / 0.2), 1), ve = 0.75 * ce * us * be;
|
|
@@ -5575,15 +5615,15 @@ async function Jr(s, t = {}) {
|
|
|
5575
5615
|
const gt = 1 / Bt, Le = me * gt, ke = we * gt, ze = Be * gt, Rt = V.right[0], Ot = V.right[1], Lt = V.right[2];
|
|
5576
5616
|
let Tt = Rt * Le + Ot * ke + Lt * ze, Re = Rt - Tt * Le, Te = Ot - Tt * ke, Ee = Lt - Tt * ze, st = Math.sqrt(Re * Re + Te * Te + Ee * Ee);
|
|
5577
5617
|
if (st < 0.2) {
|
|
5578
|
-
const
|
|
5579
|
-
Re =
|
|
5618
|
+
const C = V.up[0], k = V.up[1], de = V.up[2], Y = C * Le + k * ke + de * ze;
|
|
5619
|
+
Re = C - Y * Le, Te = k - Y * ke, Ee = de - Y * ze, st = Math.sqrt(Re * Re + Te * Te + Ee * Ee) || 1;
|
|
5580
5620
|
}
|
|
5581
5621
|
Re /= st, Te /= st, Ee /= st;
|
|
5582
5622
|
const rt = Math.min(w, Q);
|
|
5583
5623
|
if (rt < 1e-3) continue;
|
|
5584
5624
|
const Et = g.gravityEnabled && g.gravityStrength || 0, Ze = _s, We = Ms, $e = ws;
|
|
5585
5625
|
if (g.orientToDirection && g.burstMode && wt) {
|
|
5586
|
-
const
|
|
5626
|
+
const C = h._emitSimRotY || 0, k = Bs, de = Rs, Y = Ts;
|
|
5587
5627
|
for (let L = 0; L <= O; L++) {
|
|
5588
5628
|
const j = li(qe, Ve - L / O * rt, Pi);
|
|
5589
5629
|
k[L] = j[0], de[L] = j[1], Y[L] = j[2];
|
|
@@ -5591,36 +5631,36 @@ async function Jr(s, t = {}) {
|
|
|
5591
5631
|
for (let L = 0; L <= O; L++) {
|
|
5592
5632
|
const j = L > 0 ? L - 1 : 0, ie = L < O ? L + 1 : O;
|
|
5593
5633
|
let Je = k[j] - k[ie], Ke = Y[j] - Y[ie];
|
|
5594
|
-
const nt = (Math.hypot(Je, Ke) > 1e-5 ? Math.atan2(Je, Ke) : Math.atan2(it, Mt)) -
|
|
5634
|
+
const nt = (Math.hypot(Je, Ke) > 1e-5 ? Math.atan2(Je, Ke) : Math.atan2(it, Mt)) - C, De = Math.cos(nt), Ge = Math.sin(nt), et = L / O * rt, ei = -0.5 * Et * et * et;
|
|
5595
5635
|
Ze[L] = De * dt + Ge * K + k[L], We[L] = I + ei + de[L], $e[L] = -Ge * dt + De * K + Y[L];
|
|
5596
5636
|
}
|
|
5597
|
-
} else for (let
|
|
5598
|
-
const k =
|
|
5637
|
+
} else for (let C = 0; C <= O; C++) {
|
|
5638
|
+
const k = C / O * rt, de = -0.5 * Et * k * k;
|
|
5599
5639
|
if (wt) {
|
|
5600
5640
|
const Y = li(qe, Ve - k, Pi);
|
|
5601
|
-
Ze[
|
|
5641
|
+
Ze[C] = dt - Me * k + Y[0], We[C] = I - Se * k + de + Y[1], $e[C] = K - he * k + Y[2];
|
|
5602
5642
|
} else
|
|
5603
|
-
Ze[
|
|
5643
|
+
Ze[C] = Ie - me * k, We[C] = W - we * k + de, $e[C] = pe - Be * k;
|
|
5604
5644
|
}
|
|
5605
|
-
if (
|
|
5606
|
-
const
|
|
5645
|
+
if (A !== "straight") {
|
|
5646
|
+
const C = g.emissionTrailShapeAmplitude ?? 0.1, k = g.emissionTrailShapeFrequency ?? 4, de = g.emissionTrailShapeSpeed ?? 0;
|
|
5607
5647
|
let Y = -ze, L = 0, j = Le, ie = Math.sqrt(Y * Y + j * j);
|
|
5608
5648
|
ie < 1e-6 && (Y = 0, L = ze, j = -ke, ie = Math.sqrt(Y * Y + L * L + j * j) || 1), Y /= ie, L /= ie, j /= ie;
|
|
5609
5649
|
const Je = ke * j - ze * L, Ke = ze * Y - Le * j, Qe = Le * L - ke * Y;
|
|
5610
5650
|
for (let Pe = 1; Pe <= O; Pe++) {
|
|
5611
5651
|
const nt = Pe / O * rt, De = 2 * Math.PI * k * (Ve - nt) + de * Ve;
|
|
5612
5652
|
let Ge = 0, et = 0;
|
|
5613
|
-
|
|
5653
|
+
A === "zigzag" ? Ge = C * Math.sign(Math.sin(De)) : A === "sine" ? Ge = C * Math.sin(De) : A === "spiral" && (Ge = C * Math.sin(De), et = C * Math.cos(De)), Ze[Pe] += Y * Ge + Je * et, We[Pe] += L * Ge + Ke * et, $e[Pe] += j * Ge + Qe * et;
|
|
5614
5654
|
}
|
|
5615
5655
|
}
|
|
5616
5656
|
if (R)
|
|
5617
|
-
for (let
|
|
5618
|
-
const k =
|
|
5657
|
+
for (let C = 1; C <= O && u < F; C++) {
|
|
5658
|
+
const k = C / O, de = Ze[C] - Oe, Y = We[C] - fe, L = $e[C] - _t, j = u * 8, ie = u * 4;
|
|
5619
5659
|
H[j] = de, H[j + 1] = Y, H[j + 2] = L, H[j + 3] = ee, H[j + 4] = ge, H[j + 5] = $, H[j + 6] = Q + (J - Q) * k, H[j + 7] = J, se[ie] = 0, se[ie + 1] = 0, se[ie + 2] = 0, se[ie + 3] = 0, ne[ie] = de, ne[ie + 1] = Y, ne[ie + 2] = L, ne[ie + 3] = 0, u++;
|
|
5620
5660
|
}
|
|
5621
5661
|
else
|
|
5622
|
-
for (let
|
|
5623
|
-
const k =
|
|
5662
|
+
for (let C = 0; C < O && !(p + 42 > Ye.length); C++) {
|
|
5663
|
+
const k = C / O, de = (C + 1) / O, Y = Ze[C], L = We[C], j = $e[C], ie = Ze[C + 1], Je = We[C + 1], Ke = $e[C + 1], Qe = ve * (1 - k), Pe = ve * (1 - de), nt = ue * (1 - k) * (1 - k), De = ue * (1 - de) * (1 - de), Ge = Y + Re * Qe, et = L + Te * Qe, ei = j + Ee * Qe, Ai = Y - Re * Qe, Ci = L - Te * Qe, Ui = j - Ee * Qe, Ii = ie + Re * Pe, zi = Je + Te * Pe, Di = Ke + Ee * Pe, Os = ie - Re * Pe, Ls = Je - Te * Pe, ks = Ke - Ee * Pe, bt = (Xs, Ns, Ys, js) => {
|
|
5624
5664
|
Ye[p++] = Xs, Ye[p++] = Ns, Ye[p++] = Ys, Ye[p++] = ee, Ye[p++] = ge, Ye[p++] = $, Ye[p++] = js;
|
|
5625
5665
|
};
|
|
5626
5666
|
bt(Ge, et, ei, nt), bt(Ai, Ci, Ui, nt), bt(Ii, zi, Di, De), bt(Ai, Ci, Ui, nt), bt(Os, Ls, ks, De), bt(Ii, zi, Di, De);
|
|
@@ -5867,7 +5907,7 @@ async function Jr(s, t = {}) {
|
|
|
5867
5907
|
ht = u(ot), Si = u(lt), Dt = u(ct), Pt = u(zt);
|
|
5868
5908
|
};
|
|
5869
5909
|
xi();
|
|
5870
|
-
const Zt = { uniformBuffer: v, appearanceUniformBuffer:
|
|
5910
|
+
const Zt = { uniformBuffer: v, appearanceUniformBuffer: U, horizontalBlurUniformBuffer: z, verticalBlurUniformBuffer: D, bloomIntensityBuffer: M };
|
|
5871
5911
|
let Gt = si(r, Fe, Zt, { sceneTexture: ot, bloomTexA: lt, bloomTexB: ct });
|
|
5872
5912
|
const V = {
|
|
5873
5913
|
mvp: new Float32Array(16),
|
|
@@ -5940,10 +5980,12 @@ async function Jr(s, t = {}) {
|
|
|
5940
5980
|
if (!(!E || E.historyOnly) && (w.hidden = !E.pos, E.pos)) {
|
|
5941
5981
|
let N = null;
|
|
5942
5982
|
if (E.orientToDirection && E.vel) {
|
|
5943
|
-
const
|
|
5944
|
-
Math.hypot(
|
|
5983
|
+
const O = E.vel[0], A = E.vel[2];
|
|
5984
|
+
Math.hypot(O, A) > 1e-4 && (N = [0, 0, Math.atan2(O, A)]);
|
|
5945
5985
|
}
|
|
5946
|
-
m.setSimulationTransform({ position: E.pos, velocity: E.vel, rotation: N }), m.updateAppearanceUniform()
|
|
5986
|
+
m.setSimulationTransform({ position: E.pos, velocity: E.vel, rotation: N }), m.updateAppearanceUniform();
|
|
5987
|
+
const X = m.activeParticles === 0 && !m.emitting;
|
|
5988
|
+
(E.justResumed || X) && m.spawnParticles();
|
|
5947
5989
|
}
|
|
5948
5990
|
}
|
|
5949
5991
|
for (const m of _e)
|
|
@@ -5973,11 +6015,11 @@ async function Jr(s, t = {}) {
|
|
|
5973
6015
|
layout: O,
|
|
5974
6016
|
entries: [{ binding: 0, resource: E() }]
|
|
5975
6017
|
}));
|
|
5976
|
-
const
|
|
6018
|
+
const A = h.beginRenderPass({
|
|
5977
6019
|
colorAttachments: [],
|
|
5978
6020
|
depthStencilAttachment: { view: Pt, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
|
|
5979
6021
|
});
|
|
5980
|
-
|
|
6022
|
+
A.setPipeline(X), A.setBindGroup(0, yt.bindGroup), A.draw(3), A.end(), g = !0;
|
|
5981
6023
|
}
|
|
5982
6024
|
}
|
|
5983
6025
|
} catch {
|
|
@@ -6016,19 +6058,19 @@ async function Jr(s, t = {}) {
|
|
|
6016
6058
|
{ binding: 2, resource: { buffer: z } }
|
|
6017
6059
|
]
|
|
6018
6060
|
}));
|
|
6019
|
-
let
|
|
6020
|
-
|
|
6061
|
+
let A = h.beginRenderPass(m);
|
|
6062
|
+
A.setPipeline(It), A.setBindGroup(0, f.systemBloomHorizontalBindGroups[E]), A.draw(3), A.end(), A = h.beginRenderPass(w), A.setPipeline(It), A.setBindGroup(0, Gt.verticalBlurBindGroup), A.draw(3), A.end(), f.secondHorizontalBindGroups[E] || (f.secondHorizontalBindGroups[E] = r.createBindGroup({
|
|
6021
6063
|
layout: Ne.bloomBindGroupLayout,
|
|
6022
6064
|
entries: [
|
|
6023
6065
|
{ binding: 0, resource: Fe },
|
|
6024
6066
|
{ binding: 1, resource: Dt },
|
|
6025
6067
|
{ binding: 2, resource: { buffer: z } }
|
|
6026
6068
|
]
|
|
6027
|
-
})),
|
|
6069
|
+
})), A = h.beginRenderPass(m), A.setPipeline(It), A.setBindGroup(0, f.secondHorizontalBindGroups[E]), A.draw(3), A.end(), A = h.beginRenderPass(w), A.setPipeline(It), A.setBindGroup(0, Gt.verticalBlurBindGroup), A.draw(3), A.end();
|
|
6028
6070
|
const ye = `${E}#${N.premier.config.id}`, xe = b.getBloomCompositeTexture(E, a.width, a.height);
|
|
6029
|
-
|
|
6071
|
+
A = h.beginRenderPass({
|
|
6030
6072
|
colorAttachments: [{ view: xe.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
|
|
6031
|
-
}),
|
|
6073
|
+
}), A.setPipeline(ms), f.systemBloomCompositeBindGroups[ye] || (f.systemBloomCompositeBindGroups[ye] = r.createBindGroup({
|
|
6032
6074
|
layout: Ne.compositeBindGroupLayout,
|
|
6033
6075
|
entries: [
|
|
6034
6076
|
{ binding: 0, resource: Fe },
|
|
@@ -6039,7 +6081,7 @@ async function Jr(s, t = {}) {
|
|
|
6039
6081
|
// écrit par `particleSystem`, pas le tampon partagé qui ne porte que l'intensité.
|
|
6040
6082
|
{ binding: 3, resource: { buffer: N.premier.bloomIntensityBuffer } }
|
|
6041
6083
|
]
|
|
6042
|
-
})),
|
|
6084
|
+
})), A.setBindGroup(0, f.systemBloomCompositeBindGroups[ye]), A.draw(3), A.end();
|
|
6043
6085
|
}
|
|
6044
6086
|
}
|
|
6045
6087
|
const B = b.getCombinedTexture(a.width, a.height), x = h.beginRenderPass({
|
|
@@ -6118,7 +6160,7 @@ async function Jr(s, t = {}) {
|
|
|
6118
6160
|
function Ds() {
|
|
6119
6161
|
_i = !0, c.destroy(), [ot, lt, ct, zt].forEach((u) => u == null ? void 0 : u.destroy()), b.resizeTextures(), [
|
|
6120
6162
|
v,
|
|
6121
|
-
|
|
6163
|
+
U,
|
|
6122
6164
|
z,
|
|
6123
6165
|
D,
|
|
6124
6166
|
M,
|
|
@@ -6132,9 +6174,10 @@ async function Jr(s, t = {}) {
|
|
|
6132
6174
|
}
|
|
6133
6175
|
async function Ti(u, p) {
|
|
6134
6176
|
const y = await c.addSystems(u, p);
|
|
6135
|
-
for (const { config:
|
|
6136
|
-
T[
|
|
6137
|
-
|
|
6177
|
+
for (const { config: g } of c.particleSystems)
|
|
6178
|
+
T[g.id] || (T[g.id] = G());
|
|
6179
|
+
const h = new Set(Array.isArray(y) ? y : []);
|
|
6180
|
+
return c.respawnSystems(h), h;
|
|
6138
6181
|
}
|
|
6139
6182
|
function Ei(u) {
|
|
6140
6183
|
var p;
|
|
@@ -6212,10 +6255,10 @@ function Kr(s) {
|
|
|
6212
6255
|
if (!c) return null;
|
|
6213
6256
|
const d = s.domElement.width, S = s.domElement.height, b = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
|
|
6214
6257
|
if (s.needsFrameBufferTarget && b) {
|
|
6215
|
-
const
|
|
6216
|
-
(r =
|
|
6217
|
-
|
|
6218
|
-
(n =
|
|
6258
|
+
const U = c.get(b), z = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, b)) == null ? void 0 : i.depthTexture) || b.depthTexture, D = [
|
|
6259
|
+
(r = U == null ? void 0 : U.depthTexture) == null ? void 0 : r.texture,
|
|
6260
|
+
U == null ? void 0 : U.depthTexture,
|
|
6261
|
+
(n = U == null ? void 0 : U.depthBuffer) == null ? void 0 : n.texture,
|
|
6219
6262
|
z ? (a = c.get(z)) == null ? void 0 : a.texture : null
|
|
6220
6263
|
];
|
|
6221
6264
|
for (const M of D)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hz-particles",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "High-performance WebGPU particle engine with compute shaders, GPU instancing, GLB model support, and skeletal animations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-lib/hz-particles.cjs",
|