hz-particles 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,14 +10,14 @@ class ms {
10
10
  if (t === this._cachedRotX && e === this._cachedRotY && i === this._cachedRotZ)
11
11
  return;
12
12
  this._cachedRotX = t, this._cachedRotY = e, this._cachedRotZ = i;
13
- const r = t * Math.PI / 180, n = e * Math.PI / 180, a = i * Math.PI / 180, o = Math.cos(r), c = Math.sin(r), l = Math.cos(n), u = Math.sin(n), m = Math.cos(a), p = Math.sin(a);
13
+ const r = t * Math.PI / 180, n = e * Math.PI / 180, a = i * Math.PI / 180, o = Math.cos(r), c = Math.sin(r), l = Math.cos(n), u = Math.sin(n), p = Math.cos(a), h = Math.sin(a);
14
14
  this._rotMatrix = [
15
- l * m,
16
- c * u * m - o * p,
17
- o * u * m + c * p,
18
15
  l * p,
19
- c * u * p + o * m,
20
- o * u * p - c * m,
16
+ c * u * p - o * h,
17
+ o * u * p + c * h,
18
+ l * h,
19
+ c * u * h + o * p,
20
+ o * u * h - c * p,
21
21
  -u,
22
22
  c * l,
23
23
  o * l
@@ -35,7 +35,7 @@ class ms {
35
35
  }
36
36
  emitParticle(t, e, i) {
37
37
  const r = this._posOut;
38
- if (this.config.emissionShape === "cube" || this.config.emissionShape === "box" ? this._emitFromCube(r) : this.config.emissionShape === "sphere" ? this._emitFromSphere(r) : this.config.emissionShape === "square" ? this._emitFromSquare(r) : this.config.emissionShape === "circle" ? this._emitFromCircle(r) : this.config.emissionShape === "cylinder" ? this._emitFromCylinder(r) : this.config.emissionShape === "plain" ? this._emitFromPlain(r) : this.config.emissionShape === "cone" ? this._emitFromCone(r) : this.config.emissionShape === "torus" ? this._emitFromTorus(r) : this.config.emissionShape === "line" ? this._emitFromLine(r) : this.config.emissionShape === "hemisphere" ? this._emitFromHemisphere(r) : this.config.emissionShape === "disc" ? this._emitFromDisc(r) : this.config.emissionShape === "annulus" ? this._emitFromAnnulus(r) : this.config.emissionShape === "capsule" ? this._emitFromCapsule(r) : this.config.emissionShape === "arc" ? this._emitFromArc(r) : this.config.emissionShape === "spiral" ? this._emitFromSpiral(r) : this.config.emissionShape === "frustum" ? this._emitFromFrustum(r) : this.config.emissionShape === "cubeSurface" ? this._emitFromCubeSurface(r) : this.config.emissionShape === "sphereSurface" ? this._emitFromSphereSurface(r) : this.config.emissionShape === "boxFrame" ? this._emitFromBoxFrame(r) : this.config.emissionShape === "polygon" ? this._emitFromPolygon(r) : this.config.emissionShape === "rectangle" ? this._emitFromRectangle(r) : (r[0] = 0, r[1] = 0, r[2] = 0), this.config.emissionRotationX || this.config.emissionRotationY || this.config.emissionRotationZ) {
38
+ if (this.config.emissionShape === "cube" || this.config.emissionShape === "box" ? this._emitFromCube(r) : this.config.emissionShape === "sphere" ? this._emitFromSphere(r) : this.config.emissionShape === "square" ? this._emitFromSquare(r) : this.config.emissionShape === "circle" ? this._emitFromCircle(r) : this.config.emissionShape === "cylinder" ? this._emitFromCylinder(r) : this.config.emissionShape === "plain" ? this._emitFromPlain(r) : this.config.emissionShape === "cone" ? this._emitFromCone(r) : this.config.emissionShape === "torus" ? this._emitFromTorus(r) : this.config.emissionShape === "line" ? this._emitFromLine(r) : this.config.emissionShape === "hemisphere" ? this._emitFromHemisphere(r) : this.config.emissionShape === "disc" ? this._emitFromDisc(r) : this.config.emissionShape === "annulus" ? this._emitFromAnnulus(r) : this.config.emissionShape === "capsule" ? this._emitFromCapsule(r) : this.config.emissionShape === "arc" ? this._emitFromArc(r) : this.config.emissionShape === "spiral" ? this._emitFromSpiral(r) : this.config.emissionShape === "frustum" ? this._emitFromFrustum(r) : this.config.emissionShape === "frustumSurface" ? this._emitFromFrustumSurface(r) : this.config.emissionShape === "cubeSurface" ? this._emitFromCubeSurface(r) : this.config.emissionShape === "sphereSurface" ? this._emitFromSphereSurface(r) : this.config.emissionShape === "boxFrame" ? this._emitFromBoxFrame(r) : this.config.emissionShape === "polygon" ? this._emitFromPolygon(r) : this.config.emissionShape === "rectangle" ? this._emitFromRectangle(r) : (r[0] = 0, r[1] = 0, r[2] = 0), this.config.emissionRotationX || this.config.emissionRotationY || this.config.emissionRotationZ) {
39
39
  this._updateRotationMatrix();
40
40
  const o = this._rotMatrix, c = r[0], l = r[1], u = r[2];
41
41
  r[0] = o[0] * c + o[1] * l + o[2] * u, r[1] = o[3] * c + o[4] * l + o[5] * u, r[2] = o[6] * c + o[7] * l + o[8] * u;
@@ -91,8 +91,8 @@ class ms {
91
91
  o = n, c = -0.5, l = a;
92
92
  break;
93
93
  }
94
- const u = Math.random(), m = e + u * (i - e);
95
- t[0] = o * m, t[1] = c * m, t[2] = l * m;
94
+ const u = Math.random(), p = e + u * (i - e);
95
+ t[0] = o * p, t[1] = c * p, t[2] = l * p;
96
96
  } else
97
97
  t[0] = (Math.random() - 0.5) * i, t[1] = (Math.random() - 0.5) * i, t[2] = (Math.random() - 0.5) * i;
98
98
  }
@@ -187,6 +187,18 @@ class ms {
187
187
  const e = this.config.frustumRadiusNear || 0.5, i = this.config.frustumRadiusFar || 2, r = this.config.frustumHeight || 4, n = Math.random() * Math.PI * 2, a = Math.random(), o = a * r, l = (e + (i - e) * a) * Math.sqrt(Math.random());
188
188
  t[0] = Math.cos(n) * l, t[1] = o, t[2] = Math.sin(n) * l;
189
189
  }
190
+ _emitFromFrustumSurface(t) {
191
+ const e = this.config.frustumRadiusNear ?? 0.5, i = this.config.frustumRadiusFar ?? 2, r = this.config.frustumHeight ?? 4, n = Math.random() * Math.PI * 2, a = i - e, o = e + a * 0.5;
192
+ let c;
193
+ if (Math.abs(a) < 1e-6 || o <= 1e-6)
194
+ c = Math.random();
195
+ else {
196
+ const p = Math.random(), h = 0.5 * a, d = e, b = -p * o, _ = Math.max(0, d * d - 4 * h * b);
197
+ c = (-d + Math.sqrt(_)) / (2 * h), Number.isFinite(c) || (c = Math.random()), c = Math.min(1, Math.max(0, c));
198
+ }
199
+ const l = c * r, u = e + a * c;
200
+ t[0] = Math.cos(n) * u, t[1] = l, t[2] = Math.sin(n) * u;
201
+ }
190
202
  _emitFromCubeSurface(t) {
191
203
  const e = this.config.cubeSurfaceSize || 2, i = e * 0.5, r = Math.floor(Math.random() * 6), n = (Math.random() - 0.5) * e, a = (Math.random() - 0.5) * e;
192
204
  switch (r) {
@@ -244,33 +256,33 @@ class ms {
244
256
  e > 0 ? a = e + (i - e) * Math.random() : a = i * Math.sqrt(Math.random()), t[0] = Math.cos(n) * a, t[1] = (Math.random() - 0.5) * r, t[2] = Math.sin(n) * a;
245
257
  }
246
258
  calculateVelocity(t, e, i, r, n) {
247
- const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o, m = i - c, p = Math.sqrt(l * l + u * u + m * m);
248
- let d, b, w;
249
- if (p > 1e-4) {
259
+ const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o, p = i - c, h = Math.sqrt(l * l + u * u + p * p);
260
+ let d, b, _;
261
+ if (h > 1e-4) {
250
262
  let R = !1;
251
263
  if (this.config.emissionShape === "circle" && this.config.circleVelocityDirection === "tangential") {
252
- const x = this.inverseRotation(l, u, m), L = Math.sqrt(x[0] * x[0] + x[1] * x[1]);
264
+ const x = this.inverseRotation(l, u, p), L = Math.sqrt(x[0] * x[0] + x[1] * x[1]);
253
265
  if (L > 1e-4) {
254
266
  const P = -x[1] / L, T = x[0] / L, E = this.applyRotation(P, T, 0);
255
- d = E[0], b = E[1], w = E[2], R = !0;
267
+ d = E[0], b = E[1], _ = E[2], R = !0;
256
268
  }
257
269
  } else if (this.config.emissionShape === "cylinder" && this.config.cylinderVelocityDirection === "tangential") {
258
- const x = this.inverseRotation(l, u, m), L = Math.sqrt(x[0] * x[0] + x[2] * x[2]);
270
+ const x = this.inverseRotation(l, u, p), L = Math.sqrt(x[0] * x[0] + x[2] * x[2]);
259
271
  if (L > 1e-4) {
260
272
  const P = -x[2] / L, T = x[0] / L, E = this.applyRotation(P, 0, T);
261
- d = E[0], b = E[1], w = E[2], R = !0;
273
+ d = E[0], b = E[1], _ = E[2], R = !0;
262
274
  } else {
263
275
  const P = Math.random() * Math.PI * 2, T = this.applyRotation(Math.cos(P), 0, Math.sin(P));
264
- d = T[0], b = T[1], w = T[2], R = !0;
276
+ d = T[0], b = T[1], _ = T[2], R = !0;
265
277
  }
266
278
  }
267
- R || (d = l / p, b = u / p, w = m / p);
279
+ R || (d = l / h, b = u / h, _ = p / h);
268
280
  } else {
269
281
  const R = Math.random() * Math.PI * 2, x = Math.acos(2 * Math.random() - 1);
270
- d = Math.sin(x) * Math.cos(R), b = Math.sin(x) * Math.sin(R), w = Math.cos(x);
282
+ d = Math.sin(x) * Math.cos(R), b = Math.sin(x) * Math.sin(R), _ = Math.cos(x);
271
283
  }
272
284
  let M;
273
- this.config.randomSpeed ? M = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : M = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * M, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : b * M, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : w * M, r[n + 3] = 0;
285
+ this.config.randomSpeed ? M = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : M = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * M, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : b * M, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : _ * M, r[n + 3] = 0;
274
286
  }
275
287
  setParticleColor(t, e) {
276
288
  if (this.config.randomColorEnabled && this.config.randomColors.length > 0) {
@@ -380,7 +392,7 @@ const ys = `
380
392
  }
381
393
 
382
394
  @vertex
383
- fn vs_main(input: VertexInput) -> VertexOutput {
395
+ fn vs_main(input: VertexInput, @builtin(instance_index) instanceIdx: u32) -> VertexOutput {
384
396
  var output : VertexOutput;
385
397
 
386
398
  let center = input.particlePosition + appearance.systemOffset;
@@ -412,10 +424,11 @@ const ys = `
412
424
  // Determine particle size - use random size if enabled
413
425
  var particleSizeFactor = appearance.particleSize;
414
426
  if (appearance.randomSize > 0.5) {
415
- // Use the particle's lifetime as a seed to create a consistent random size
416
- // between minSize and maxSize, similar to how random rotation works
417
- particleSizeFactor = appearance.minSize +
418
- fract(sin(lifetime * 54321.67) * 43758.5453) *
427
+ // Seed from the PARTICLE INDEX (stable per slot, unique per particle) so each particle in an
428
+ // emission gets its own size. The old seed used lifetime, which is identical for every
429
+ // particle of an emission, so they all came out the SAME size (most visible in burst mode).
430
+ particleSizeFactor = appearance.minSize +
431
+ fract(sin(f32(instanceIdx) * 12.9898 + 78.233) * 43758.5453) *
419
432
  (appearance.maxSize - appearance.minSize);
420
433
  }
421
434
 
@@ -448,10 +461,11 @@ const ys = `
448
461
  // Create a unique rotation value for each particle
449
462
  var particleRotation = appearance.rotation;
450
463
  if (appearance.rotationMode == 1.0) {
451
- // Use the particle's lifetime as a seed to create a consistent random rotation
452
- // between minRotation and maxRotation
453
- particleRotation = appearance.minRotation +
454
- fract(sin(lifetime * 12345.67) * 43758.5453) *
464
+ // Per-particle seed (particle index) — same fix as random size (was seeded on lifetime,
465
+ // identical across an emission, so every particle shared one rotation). Distinct hash constants
466
+ // from size so a particle's size and rotation aren't correlated.
467
+ particleRotation = appearance.minRotation +
468
+ fract(sin(f32(instanceIdx) * 63.746 + 11.135) * 43758.5453) *
455
469
  (appearance.maxRotation - appearance.minRotation);
456
470
  } else if (appearance.rotationMode == 2.0) {
457
471
  // Calculate rotation based on velocity direction in screen space. Use the COMBINED velocity
@@ -975,7 +989,7 @@ const ys = `
975
989
  }
976
990
 
977
991
  // 2. Attractor
978
- if (physics.attractorStrength > 0.0) {
992
+ if (physics.attractorStrength != 0.0) {
979
993
  let attractorPos = vec3<f32>(physics.attractorPositionX, physics.attractorPositionY, physics.attractorPositionZ);
980
994
  let toAttractor = attractorPos - vec3<f32>(posX, posY, posZ);
981
995
  let dist = length(toAttractor);
@@ -1273,8 +1287,8 @@ class _s {
1273
1287
  o[0] = t, o[1] = i.particleSpeed, o[2] = c.gravity, o[3] = c.turbulence, o[4] = c.attractorStrength, o[5] = c.damping, o[6] = c.attractorPosition[0], o[7] = c.attractorPosition[1], o[8] = c.attractorPosition[2], this._physicsDataU32View[9] = e, o[10] = c.confinementEnabled ? 1 : 0, o[11] = c.confinementShape === "sphere" ? 1 : 0, o[12] = c.confinementMode === "kill" ? 1 : 0, o[13] = c.confinementSpace === "local" ? 1 : 0, o[14] = c.confinementBoxHalfSize[0], o[15] = c.confinementBoxHalfSize[1], o[16] = c.confinementBoxHalfSize[2], o[17] = c.confinementSphereRadius, o[18] = c.confinementRestitution, o[19] = c.confinementFriction, o[20] = c.confinementCenter[0], o[21] = c.confinementCenter[1], o[22] = c.confinementCenter[2], o[23] = c.softBoundaryEnabled ? 1 : 0, o[24] = c.softBoundaryStrength, o[25] = c.softBoundaryFalloff, o[26] = i.velocityStretchEnabled ? 1 : 0, o[27] = i.velocityStretchFactor ?? 1, o[28] = 0, o[29] = 0, o[30] = 0, o[31] = 0, this.device.queue.writeBuffer(this.physicsUniformBuffer, 0, o);
1274
1288
  const l = a || this.device.createCommandEncoder({ label: "ParticlePhysicsEncoder" }), u = l.beginComputePass({ label: "ParticlePhysicsPass" });
1275
1289
  u.setPipeline(this.computePipeline), u.setBindGroup(0, this.computeBindGroup);
1276
- const m = Math.max(1, Math.ceil(e / 64));
1277
- u.dispatchWorkgroups(m, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1290
+ const p = Math.max(1, Math.ceil(e / 64));
1291
+ u.dispatchWorkgroups(p, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1278
1292
  }
1279
1293
  async readbackAndProcessParticles(t, e, i, r, n) {
1280
1294
  if (t <= 0)
@@ -1326,8 +1340,9 @@ class _s {
1326
1340
  setGravity(t) {
1327
1341
  this.physicsSettings.gravity = t;
1328
1342
  }
1329
- setAttractor(t, e) {
1330
- this.physicsSettings.attractorStrength = t, this.physicsSettings.attractorPosition = e;
1343
+ setAttractor(t, e, i = !1) {
1344
+ const r = Math.abs(t || 0);
1345
+ this.physicsSettings.attractorStrength = i ? -r : r, this.physicsSettings.attractorPosition = e;
1331
1346
  }
1332
1347
  setConfinement(t) {
1333
1348
  const e = this.physicsSettings;
@@ -1520,6 +1535,7 @@ const Pi = Object.freeze({
1520
1535
  "gravityStrength",
1521
1536
  "dampingStrength",
1522
1537
  "attractorStrength",
1538
+ "attractorReverse",
1523
1539
  "attractorPosition",
1524
1540
  "pulseAmplitude",
1525
1541
  "pulseFrequency",
@@ -1753,7 +1769,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1753
1769
  this._fn = null, this._particles = null, this._configProxy = null, this._configSnapshot = null;
1754
1770
  }
1755
1771
  }
1756
- async function Cs(s) {
1772
+ async function As(s) {
1757
1773
  const t = new DataView(s);
1758
1774
  if (t.getUint32(0, !0) !== 1179937895)
1759
1775
  throw new Error("Invalid GLB file: incorrect magic number");
@@ -1765,8 +1781,8 @@ async function Cs(s) {
1765
1781
  for (; n < r; ) {
1766
1782
  const P = t.getUint32(n, !0), T = t.getUint32(n + 4, !0), E = s.slice(n + 8, n + 8 + P);
1767
1783
  if (T === 1313821514) {
1768
- const k = new TextDecoder("utf-8").decode(E);
1769
- a = JSON.parse(k);
1784
+ const N = new TextDecoder("utf-8").decode(E);
1785
+ a = JSON.parse(N);
1770
1786
  } else T === 5130562 && (o = E);
1771
1787
  n += 8 + P;
1772
1788
  }
@@ -1780,21 +1796,21 @@ async function Cs(s) {
1780
1796
  const u = l.attributes.POSITION;
1781
1797
  if (u === void 0)
1782
1798
  throw new Error("Mesh primitive missing POSITION attribute");
1783
- const m = xt(a, o, u, 3, 5126);
1784
- let p;
1799
+ const p = xt(a, o, u, 3, 5126);
1800
+ let h;
1785
1801
  if (l.attributes.NORMAL !== void 0)
1786
- p = xt(a, o, l.attributes.NORMAL, 3, 5126);
1802
+ h = xt(a, o, l.attributes.NORMAL, 3, 5126);
1787
1803
  else {
1788
1804
  const P = l.indices;
1789
1805
  if (P === void 0)
1790
1806
  throw new Error("Cannot generate normals without indices");
1791
1807
  const T = di(a, o, P);
1792
- p = As(m, T);
1808
+ h = Cs(p, T);
1793
1809
  }
1794
1810
  const d = l.indices;
1795
1811
  if (d === void 0)
1796
1812
  throw new Error("Mesh primitive missing indices");
1797
- const b = di(a, o, d), w = m.length / 3, M = b.length;
1813
+ const b = di(a, o, d), _ = p.length / 3, M = b.length;
1798
1814
  let R = null;
1799
1815
  l.attributes.TEXCOORD_0 !== void 0 && (R = xt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
1800
1816
  let x = !1;
@@ -1805,16 +1821,16 @@ async function Cs(s) {
1805
1821
  let L = null;
1806
1822
  if (a.skins && a.skins.length > 0)
1807
1823
  try {
1808
- L = Fs(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", L);
1824
+ L = Ds(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", L);
1809
1825
  } catch (P) {
1810
1826
  console.warn("Failed to extract animation data:", P);
1811
1827
  }
1812
1828
  return {
1813
- positions: m,
1814
- normals: p,
1829
+ positions: p,
1830
+ normals: h,
1815
1831
  indices: b,
1816
1832
  texCoords: R,
1817
- vertexCount: w,
1833
+ vertexCount: _,
1818
1834
  indexCount: M,
1819
1835
  animationData: L,
1820
1836
  hasBaseColorTexture: x
@@ -1831,10 +1847,10 @@ function xt(s, t, e, i, r) {
1831
1847
  throw new Error(`Attribute accessor type mismatch: expected ${i} components, got ${o}`);
1832
1848
  if (n.componentType !== r)
1833
1849
  throw new Error(`Attribute component type mismatch: expected ${r}, got ${n.componentType}`);
1834
- const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count, m = new DataView(t, l, u * i * 4), p = new Float32Array(u * i);
1850
+ const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count, p = new DataView(t, l, u * i * 4), h = new Float32Array(u * i);
1835
1851
  for (let d = 0; d < u * i; d++)
1836
- p[d] = m.getFloat32(d * 4, !0);
1837
- return p;
1852
+ h[d] = p.getFloat32(d * 4, !0);
1853
+ return h;
1838
1854
  }
1839
1855
  function di(s, t, e) {
1840
1856
  const i = s.accessors[e];
@@ -1854,15 +1870,15 @@ function di(s, t, e) {
1854
1870
  } else
1855
1871
  throw new Error(`Unsupported index component type: ${i.componentType}`);
1856
1872
  }
1857
- function As(s, t) {
1873
+ function Cs(s, t) {
1858
1874
  const e = new Float32Array(s.length);
1859
1875
  for (let i = 0; i < t.length; i += 3) {
1860
- const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], u = [c[0] - o[0], c[1] - o[1], c[2] - o[2]], m = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], p = [
1861
- u[1] * m[2] - u[2] * m[1],
1862
- u[2] * m[0] - u[0] * m[2],
1863
- u[0] * m[1] - u[1] * m[0]
1864
- ], d = Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
1865
- d > 0 && (p[0] /= d, p[1] /= d, p[2] /= d), e[r] = e[n] = e[a] = p[0], e[r + 1] = e[n + 1] = e[a + 1] = p[1], e[r + 2] = e[n + 2] = e[a + 2] = p[2];
1876
+ const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], u = [c[0] - o[0], c[1] - o[1], c[2] - o[2]], p = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], h = [
1877
+ u[1] * p[2] - u[2] * p[1],
1878
+ u[2] * p[0] - u[0] * p[2],
1879
+ u[0] * p[1] - u[1] * p[0]
1880
+ ], d = Math.sqrt(h[0] * h[0] + h[1] * h[1] + h[2] * h[2]);
1881
+ d > 0 && (h[0] /= d, h[1] /= d, h[2] /= d), e[r] = e[n] = e[a] = h[0], e[r + 1] = e[n + 1] = e[a + 1] = h[1], e[r + 2] = e[n + 2] = e[a + 2] = h[2];
1866
1882
  }
1867
1883
  return e;
1868
1884
  }
@@ -1924,18 +1940,18 @@ function Gs(s, t, e) {
1924
1940
  c[l] = o.getFloat32(l * 4, !0);
1925
1941
  return c;
1926
1942
  }
1927
- function Ds(s, t, e) {
1943
+ function Fs(s, t, e) {
1928
1944
  const i = s.accessors[e], n = { VEC3: 3, VEC4: 4 }[i.type];
1929
1945
  if (!n)
1930
1946
  throw new Error(`Expected VEC3 or VEC4, got ${i.type}`);
1931
1947
  if (i.componentType !== 5126)
1932
1948
  throw new Error(`Expected FLOAT component type, got ${i.componentType}`);
1933
1949
  const o = (s.bufferViews[i.bufferView].byteOffset || 0) + (i.byteOffset || 0), c = i.count, l = new DataView(t, o, c * n * 4), u = new Float32Array(c * n);
1934
- for (let m = 0; m < c * n; m++)
1935
- u[m] = l.getFloat32(m * 4, !0);
1950
+ for (let p = 0; p < c * n; p++)
1951
+ u[p] = l.getFloat32(p * 4, !0);
1936
1952
  return u;
1937
1953
  }
1938
- function Fs(s, t, e) {
1954
+ function Ds(s, t, e) {
1939
1955
  const i = s.skins[0], r = i.joints, n = zs(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? Us(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? Is(s, t, e.attributes.WEIGHTS_0) : null;
1940
1956
  if (!a || !o)
1941
1957
  throw new Error("Mesh missing JOINTS_0 or WEIGHTS_0 attributes");
@@ -1948,22 +1964,22 @@ function Fs(s, t, e) {
1948
1964
  })), l = [];
1949
1965
  if (s.animations && s.animations.length > 0)
1950
1966
  for (const u of s.animations) {
1951
- const m = [];
1952
- let p = 0;
1967
+ const p = [];
1968
+ let h = 0;
1953
1969
  for (const d of u.channels) {
1954
- const b = u.samplers[d.sampler], w = Gs(s, t, b.input), M = Ds(s, t, b.output), R = w[w.length - 1];
1955
- R > p && (p = R), m.push({
1970
+ const b = u.samplers[d.sampler], _ = Gs(s, t, b.input), M = Fs(s, t, b.output), R = _[_.length - 1];
1971
+ R > h && (h = R), p.push({
1956
1972
  targetNode: d.target.node,
1957
1973
  targetPath: d.target.path,
1958
1974
  interpolation: b.interpolation || "LINEAR",
1959
- timestamps: w,
1975
+ timestamps: _,
1960
1976
  values: M
1961
1977
  });
1962
1978
  }
1963
1979
  l.push({
1964
1980
  name: u.name || `Animation ${l.length}`,
1965
- duration: p,
1966
- channels: m
1981
+ duration: h,
1982
+ channels: p
1967
1983
  });
1968
1984
  }
1969
1985
  return {
@@ -1987,8 +2003,8 @@ async function fi(s) {
1987
2003
  for (; n < r; ) {
1988
2004
  const L = t.getUint32(n, !0), P = t.getUint32(n + 4, !0), T = s.slice(n + 8, n + 8 + L);
1989
2005
  if (P === 1313821514) {
1990
- const F = new TextDecoder("utf-8").decode(T);
1991
- a = JSON.parse(F);
2006
+ const D = new TextDecoder("utf-8").decode(T);
2007
+ a = JSON.parse(D);
1992
2008
  } else P === 5130562 && (o = T);
1993
2009
  n += 8 + L;
1994
2010
  }
@@ -2002,15 +2018,15 @@ async function fi(s) {
2002
2018
  const l = c.pbrMetallicRoughness.baseColorTexture.index;
2003
2019
  if (!a.textures || !a.textures[l])
2004
2020
  return null;
2005
- const m = a.textures[l].source;
2006
- if (m === void 0 || !a.images || !a.images[m])
2021
+ const p = a.textures[l].source;
2022
+ if (p === void 0 || !a.images || !a.images[p])
2007
2023
  return null;
2008
- const p = a.images[m], d = p.mimeType || "image/png";
2009
- if (p.bufferView === void 0)
2024
+ const h = a.images[p], d = h.mimeType || "image/png";
2025
+ if (h.bufferView === void 0)
2010
2026
  return null;
2011
2027
  if (!o)
2012
2028
  throw new Error("GLB file missing BIN chunk (required for embedded textures)");
2013
- const b = a.bufferViews[p.bufferView], w = b.byteOffset || 0, M = b.byteLength, R = o.slice(w, w + M);
2029
+ const b = a.bufferViews[h.bufferView], _ = b.byteOffset || 0, M = b.byteLength, R = o.slice(_, _ + M);
2014
2030
  return { imageBlob: new Blob([R], { type: d }), mimeType: d };
2015
2031
  }
2016
2032
  function Vs(s, t, e, i) {
@@ -2028,22 +2044,22 @@ function Os(s, t, e, i) {
2028
2044
  return i[0] = s[0] * c + n * t[0] * l, i[1] = s[1] * c + n * t[1] * l, i[2] = s[2] * c + n * t[2] * l, i[3] = s[3] * c + n * t[3] * l, i;
2029
2045
  }
2030
2046
  function Ls(s, t) {
2031
- const e = s[0], i = s[1], r = s[2], n = s[3], a = e + e, o = i + i, c = r + r, l = e * a, u = e * o, m = e * c, p = i * o, d = i * c, b = r * c, w = n * a, M = n * o, R = n * c, x = t || new Float32Array(16);
2032
- return x[0] = 1 - (p + b), x[1] = u + R, x[2] = m - M, x[3] = 0, x[4] = u - R, x[5] = 1 - (l + b), x[6] = d + w, x[7] = 0, x[8] = m + M, x[9] = d - w, x[10] = 1 - (l + p), x[11] = 0, x[12] = 0, x[13] = 0, x[14] = 0, x[15] = 1, x;
2047
+ const e = s[0], i = s[1], r = s[2], n = s[3], a = e + e, o = i + i, c = r + r, l = e * a, u = e * o, p = e * c, h = i * o, d = i * c, b = r * c, _ = n * a, M = n * o, R = n * c, x = t || new Float32Array(16);
2048
+ return x[0] = 1 - (h + b), x[1] = u + R, x[2] = p - M, x[3] = 0, x[4] = u - R, x[5] = 1 - (l + b), x[6] = d + _, x[7] = 0, x[8] = p + M, x[9] = d - _, x[10] = 1 - (l + h), x[11] = 0, x[12] = 0, x[13] = 0, x[14] = 0, x[15] = 1, x;
2033
2049
  }
2034
2050
  const Xs = new Float32Array(16);
2035
- function ks(s, t, e, i) {
2051
+ function Ns(s, t, e, i) {
2036
2052
  const r = Ls(t, Xs), n = i || new Float32Array(16);
2037
2053
  return n[0] = r[0] * e[0], n[1] = r[1] * e[0], n[2] = r[2] * e[0], n[3] = 0, n[4] = r[4] * e[1], n[5] = r[5] * e[1], n[6] = r[6] * e[1], n[7] = 0, n[8] = r[8] * e[2], n[9] = r[9] * e[2], n[10] = r[10] * e[2], n[11] = 0, n[12] = s[0], n[13] = s[1], n[14] = s[2], n[15] = 1, n;
2038
2054
  }
2039
- function pi(s, t, e) {
2055
+ function hi(s, t, e) {
2040
2056
  const i = e || new Float32Array(16);
2041
2057
  for (let r = 0; r < 4; r++)
2042
2058
  for (let n = 0; n < 4; n++)
2043
2059
  i[r * 4 + n] = s[0 + n] * t[r * 4 + 0] + s[4 + n] * t[r * 4 + 1] + s[8 + n] * t[r * 4 + 2] + s[12 + n] * t[r * 4 + 3];
2044
2060
  return i;
2045
2061
  }
2046
- class Ns {
2062
+ class ks {
2047
2063
  constructor(t) {
2048
2064
  this.joints = t.joints, this.inverseBindMatrices = t.inverseBindMatrices, this.jointWeights = t.jointWeights, this.jointIndices = t.jointIndices, this.nodes = t.nodes, this.animations = t.animations, this.restPositions = null, this.restNormals = null, this.currentAnimIndex = 0, this.currentTime = 0, this.playing = !0, this.speed = 1, this.loop = !0, this.jointLocalTransforms = new Array(this.nodes.length), this.jointGlobalTransforms = new Array(this.nodes.length), this.jointFinalMatrices = new Array(this.joints.length);
2049
2065
  for (let e = 0; e < this.nodes.length; e++)
@@ -2074,8 +2090,8 @@ class Ns {
2074
2090
  this._gpuDevice = t, this._gpuOutputBuffer = e;
2075
2091
  const r = this.restPositions.length / 3, n = new Float32Array(r * 8);
2076
2092
  for (let c = 0; c < r; c++) {
2077
- const l = c * 8, u = c * 3, m = c * 2;
2078
- n[l] = this.restPositions[u], n[l + 1] = this.restPositions[u + 1], n[l + 2] = this.restPositions[u + 2], n[l + 3] = this.restNormals[u], n[l + 4] = this.restNormals[u + 1], n[l + 5] = this.restNormals[u + 2], n[l + 6] = i ? i[m] : 0, n[l + 7] = i ? i[m + 1] : 0;
2093
+ const l = c * 8, u = c * 3, p = c * 2;
2094
+ n[l] = this.restPositions[u], n[l + 1] = this.restPositions[u + 1], n[l + 2] = this.restPositions[u + 2], n[l + 3] = this.restNormals[u], n[l + 4] = this.restNormals[u + 1], n[l + 5] = this.restNormals[u + 2], n[l + 6] = i ? i[p] : 0, n[l + 7] = i ? i[p + 1] : 0;
2079
2095
  }
2080
2096
  this._gpuRestDataBuffer = t.createBuffer({
2081
2097
  size: n.byteLength,
@@ -2200,11 +2216,11 @@ class Ns {
2200
2216
  return this._extractValue(n, r.length - 1, o, i);
2201
2217
  let c = 0, l = r.length - 1;
2202
2218
  for (; l - c > 1; ) {
2203
- const w = Math.floor((c + l) / 2);
2204
- r[w] <= e ? c = w : l = w;
2219
+ const _ = Math.floor((c + l) / 2);
2220
+ r[_] <= e ? c = _ : l = _;
2205
2221
  }
2206
- const u = r[c], m = r[l], p = (e - u) / (m - u), d = this._extractValue(n, c, o, this._sV0), b = this._extractValue(n, l, o, this._sV1);
2207
- return a === "STEP" ? (i[0] = d[0], i[1] = d[1], i[2] = d[2], o === "rotation" && (i[3] = d[3]), i) : o === "rotation" ? Os(d, b, p, i) : Vs(d, b, p, i);
2222
+ const u = r[c], p = r[l], h = (e - u) / (p - u), d = this._extractValue(n, c, o, this._sV0), b = this._extractValue(n, l, o, this._sV1);
2223
+ return a === "STEP" ? (i[0] = d[0], i[1] = d[1], i[2] = d[2], o === "rotation" && (i[3] = d[3]), i) : o === "rotation" ? Os(d, b, h, i) : Vs(d, b, h, i);
2208
2224
  }
2209
2225
  /**
2210
2226
  * Extract value from values array at the given index.
@@ -2229,7 +2245,7 @@ class Ns {
2229
2245
  let n = r.translation, a = r.rotation, o = r.scale;
2230
2246
  for (const c of e.channels)
2231
2247
  c.targetNode === i && (c.targetPath === "translation" ? n = this._sampleChannel(c, t, this._scrT) : c.targetPath === "rotation" ? a = this._sampleChannel(c, t, this._scrR) : c.targetPath === "scale" && (o = this._sampleChannel(c, t, this._scrS)));
2232
- ks(n, a, o, this.jointLocalTransforms[i]);
2248
+ Ns(n, a, o, this.jointLocalTransforms[i]);
2233
2249
  }
2234
2250
  }
2235
2251
  /**
@@ -2239,7 +2255,7 @@ class Ns {
2239
2255
  const t = this._parentMap;
2240
2256
  for (const e of this.topologicalOrder) {
2241
2257
  const i = t[e];
2242
- i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : pi(
2258
+ i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : hi(
2243
2259
  this.jointGlobalTransforms[i],
2244
2260
  this.jointLocalTransforms[e],
2245
2261
  this.jointGlobalTransforms[e]
@@ -2252,7 +2268,7 @@ class Ns {
2252
2268
  _computeFinalMatrices() {
2253
2269
  for (let t = 0; t < this.joints.length; t++) {
2254
2270
  const e = this.joints[t], i = this.jointGlobalTransforms[e];
2255
- pi(i, this._invBindViews[t], this.jointFinalMatrices[t]);
2271
+ hi(i, this._invBindViews[t], this.jointFinalMatrices[t]);
2256
2272
  }
2257
2273
  }
2258
2274
  /**
@@ -2262,16 +2278,16 @@ class Ns {
2262
2278
  _applySkinning() {
2263
2279
  const t = this.restPositions.length / 3, e = this.restPositions, i = this.restNormals, r = this.skinnedPositions, n = this.skinnedNormals, a = this.jointWeights, o = this.jointIndices, c = this.jointFinalMatrices;
2264
2280
  for (let l = 0; l < t; l++) {
2265
- const u = l * 3, m = l * 4, p = e[u], d = e[u + 1], b = e[u + 2], w = i[u], M = i[u + 1], R = i[u + 2];
2266
- let x = 0, L = 0, P = 0, T = 0, E = 0, F = 0;
2281
+ const u = l * 3, p = l * 4, h = e[u], d = e[u + 1], b = e[u + 2], _ = i[u], M = i[u + 1], R = i[u + 2];
2282
+ let x = 0, L = 0, P = 0, T = 0, E = 0, D = 0;
2267
2283
  for (let Y = 0; Y < 4; Y++) {
2268
- const N = a[m + Y];
2269
- if (N === 0) continue;
2270
- const G = c[o[m + Y]];
2271
- x += (G[0] * p + G[4] * d + G[8] * b + G[12]) * N, L += (G[1] * p + G[5] * d + G[9] * b + G[13]) * N, P += (G[2] * p + G[6] * d + G[10] * b + G[14]) * N, T += (G[0] * w + G[4] * M + G[8] * R) * N, E += (G[1] * w + G[5] * M + G[9] * R) * N, F += (G[2] * w + G[6] * M + G[10] * R) * N;
2284
+ const k = a[p + Y];
2285
+ if (k === 0) continue;
2286
+ const G = c[o[p + Y]];
2287
+ x += (G[0] * h + G[4] * d + G[8] * b + G[12]) * k, L += (G[1] * h + G[5] * d + G[9] * b + G[13]) * k, P += (G[2] * h + G[6] * d + G[10] * b + G[14]) * k, T += (G[0] * _ + G[4] * M + G[8] * R) * k, E += (G[1] * _ + G[5] * M + G[9] * R) * k, D += (G[2] * _ + G[6] * M + G[10] * R) * k;
2272
2288
  }
2273
- const k = Math.sqrt(T * T + E * E + F * F);
2274
- k > 1e-4 && (n[u] = T / k, n[u + 1] = E / k, n[u + 2] = F / k), r[u] = x, r[u + 1] = L, r[u + 2] = P;
2289
+ const N = Math.sqrt(T * T + E * E + D * D);
2290
+ N > 1e-4 && (n[u] = T / N, n[u + 1] = E / N, n[u + 2] = D / N), r[u] = x, r[u + 1] = L, r[u + 2] = P;
2275
2291
  }
2276
2292
  }
2277
2293
  }
@@ -2296,7 +2312,7 @@ class js {
2296
2312
  this.currentTime = Math.max(0, t || 0), this._justLooped = !1;
2297
2313
  }
2298
2314
  }
2299
- const hi = {
2315
+ const pi = {
2300
2316
  linear: (s) => s,
2301
2317
  easeInQuad: (s) => s * s,
2302
2318
  easeOutQuad: (s) => 1 - (1 - s) * (1 - s),
@@ -2316,25 +2332,25 @@ const hi = {
2316
2332
  }
2317
2333
  };
2318
2334
  function Ys(s, t, e, i) {
2319
- const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, u = (d) => ((a * d + n) * d + r) * d, m = (d) => ((l * d + c) * d + o) * d, p = (d) => (3 * a * d + 2 * n) * d + r;
2335
+ const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, u = (d) => ((a * d + n) * d + r) * d, p = (d) => ((l * d + c) * d + o) * d, h = (d) => (3 * a * d + 2 * n) * d + r;
2320
2336
  return (d) => {
2321
2337
  if (d <= 0) return 0;
2322
2338
  if (d >= 1) return 1;
2323
2339
  let b = d;
2324
- for (let w = 0; w < 8; w++) {
2340
+ for (let _ = 0; _ < 8; _++) {
2325
2341
  const M = u(b) - d;
2326
2342
  if (Math.abs(M) < 1e-5) break;
2327
- const R = p(b);
2343
+ const R = h(b);
2328
2344
  if (Math.abs(R) < 1e-6) break;
2329
2345
  b -= M / R;
2330
2346
  }
2331
- return m(b);
2347
+ return p(b);
2332
2348
  };
2333
2349
  }
2334
2350
  function _i(s, t) {
2335
- return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Ys(s[0], s[1], s[2], s[3])(t) : (hi[s] || hi.linear)(t);
2351
+ return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Ys(s[0], s[1], s[2], s[3])(t) : (pi[s] || pi.linear)(t);
2336
2352
  }
2337
- function Hs(s, t) {
2353
+ function qs(s, t) {
2338
2354
  if (!Array.isArray(s) || s.length === 0) return;
2339
2355
  if (s.length === 1 || t <= s[0].t) return s[0].v;
2340
2356
  const e = s[s.length - 1];
@@ -2348,7 +2364,7 @@ function Hs(s, t) {
2348
2364
  }
2349
2365
  return e.v;
2350
2366
  }
2351
- function qs(s, t, e) {
2367
+ function Hs(s, t, e) {
2352
2368
  if (!Array.isArray(s) || s.length === 0) return;
2353
2369
  const i = s.length, r = s[i - 1];
2354
2370
  let n, a, o;
@@ -2358,11 +2374,11 @@ function qs(s, t, e) {
2358
2374
  n = a = r.v, o = 0;
2359
2375
  else {
2360
2376
  n = a = r.v, o = 0;
2361
- for (let m = 0; m < i - 1; m++) {
2362
- const p = s[m], d = s[m + 1];
2363
- if (t >= p.t && t <= d.t) {
2364
- const b = d.t - p.t;
2365
- n = p.v, a = d.v, o = _i(p.ease, b > 0 ? (t - p.t) / b : 0);
2377
+ for (let p = 0; p < i - 1; p++) {
2378
+ const h = s[p], d = s[p + 1];
2379
+ if (t >= h.t && t <= d.t) {
2380
+ const b = d.t - h.t;
2381
+ n = h.v, a = d.v, o = _i(h.ease, b > 0 ? (t - h.t) / b : 0);
2366
2382
  break;
2367
2383
  }
2368
2384
  }
@@ -2379,7 +2395,7 @@ function mi(s) {
2379
2395
  }
2380
2396
  class vt {
2381
2397
  constructor(t, e) {
2382
- this.device = t, this.config = e, this.MAX_PARTICLES = e.maxParticles || 1e4, this.particleCount = e.particleCount || 100, this.activeParticles = 0, this.emitting = !1, this.currentEmissionTime = 0, this.destroyed = !1, this.particleData = new Float32Array(this.MAX_PARTICLES * 8), this.particleVelocities = new Float32Array(this.MAX_PARTICLES * 4), this.instanceBuffer = t.createBuffer({
2398
+ this.device = t, this.config = e, this.MAX_PARTICLES = e.maxParticles || 1e4, this.particleCount = e.particleCount || 100, this.activeParticles = 0, this.emitting = !1, this.currentEmissionTime = 0, this.emissionAccumulator = 0, this.destroyed = !1, this.particleData = new Float32Array(this.MAX_PARTICLES * 8), this.particleVelocities = new Float32Array(this.MAX_PARTICLES * 4), this.instanceBuffer = t.createBuffer({
2383
2399
  size: this.MAX_PARTICLES * 8 * 4,
2384
2400
  usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
2385
2401
  label: "particleInstanceBuffer"
@@ -2403,7 +2419,7 @@ class vt {
2403
2419
  // intensity (f32) + padding
2404
2420
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
2405
2421
  label: "systemBloomIntensityBuffer"
2406
- }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(56), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this._emitSimRotY = 0, this.emitter = new ms(e), this.physics = new _s(t, this.MAX_PARTICLES), this.textureManager = new ws(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition), e.confinementEnabled && this.setConfinement({
2422
+ }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.attractorReverse === void 0 && (e.attractorReverse = !1), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(56), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this._emitSimRotY = 0, this.emitter = new ms(e), this.physics = new _s(t, this.MAX_PARTICLES), this.textureManager = new ws(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition, e.attractorReverse), e.confinementEnabled && this.setConfinement({
2407
2423
  enabled: !0,
2408
2424
  shape: e.confinementShape,
2409
2425
  mode: e.confinementMode,
@@ -2437,7 +2453,7 @@ class vt {
2437
2453
  async setGLBModel(t) {
2438
2454
  try {
2439
2455
  this.glbRawArrayBuffer = t;
2440
- const e = await Cs(t);
2456
+ const e = await As(t);
2441
2457
  this.glbMeshData = e, this.config.glbHasTexture = e.hasBaseColorTexture || !1;
2442
2458
  const i = new Float32Array(e.vertexCount * 8);
2443
2459
  for (let r = 0; r < e.vertexCount; r++) {
@@ -2453,7 +2469,7 @@ class vt {
2453
2469
  usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
2454
2470
  label: "glbIndexBuffer"
2455
2471
  }), this.device.queue.writeBuffer(this.glbIndexBuffer, 0, e.indices), this.glbIndexCount = e.indexCount, this.glbIndexFormat = e.indices instanceof Uint32Array ? "uint32" : "uint16", this.config.glbModelEnabled = !0, this.config.textureType = "glb", e.animationData) {
2456
- this.glbAnimator = new Ns(e.animationData), this.glbAnimator.setRestPose(e.positions, e.normals), this.glbAnimated = !0, this.config.glbAnimated = !0, this.glbAnimator.loop = this.config.animationLoop, this._glbInterleavedData = new Float32Array(e.vertexCount * 8);
2472
+ this.glbAnimator = new ks(e.animationData), this.glbAnimator.setRestPose(e.positions, e.normals), this.glbAnimated = !0, this.config.glbAnimated = !0, this.glbAnimator.loop = this.config.animationLoop, this._glbInterleavedData = new Float32Array(e.vertexCount * 8);
2457
2473
  try {
2458
2474
  await this.glbAnimator.initGPUSkinning(this.device, this.glbVertexBuffer, e.texCoords);
2459
2475
  } catch (r) {
@@ -2527,7 +2543,7 @@ class vt {
2527
2543
  t[4] = e[0], t[5] = e[1], t[6] = e[2], this.device.queue.writeBuffer(this.bloomIntensityBuffer, 0, t);
2528
2544
  }
2529
2545
  spawnParticles() {
2530
- if (this.activeParticles = 0, this.currentEmissionTime = 0, this._newEmissions.length = 0, this._pendingFollowEmissions = this._emptyEmissions, this._scriptFrame = 0, this._scriptTime = 0, this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptConfigRestored = !1, this._particleScript && (this._particleScript._configSnapshot ? (this._particleScript.restoreConfig(this.config), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition), this.updateAppearanceUniform(), this.updateBloomIntensity()) : this._particleScript.snapshotConfig(this.config)), this.device.queue.writeBuffer(this.trailBuffer, 0, this._trailResetData, 0, this.MAX_PARTICLES * 4), this.glbAnimator && (this.glbAnimator.currentTime = 0, this.glbAnimator.playing = !0), this.config.followSystemId) {
2546
+ if (this.activeParticles = 0, this.currentEmissionTime = 0, this.emissionAccumulator = 0, this._newEmissions.length = 0, this._pendingFollowEmissions = this._emptyEmissions, this._scriptFrame = 0, this._scriptTime = 0, this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptConfigRestored = !1, this._particleScript && (this._particleScript._configSnapshot ? (this._particleScript.restoreConfig(this.config), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse), this.updateAppearanceUniform(), this.updateBloomIntensity()) : this._particleScript.snapshotConfig(this.config)), this.device.queue.writeBuffer(this.trailBuffer, 0, this._trailResetData, 0, this.MAX_PARTICLES * 4), this.glbAnimator && (this.glbAnimator.currentTime = 0, this.glbAnimator.playing = !0), this.config.followSystemId) {
2531
2547
  this.emitting = !0, this.particleCount = this.MAX_PARTICLES;
2532
2548
  return;
2533
2549
  }
@@ -2612,13 +2628,13 @@ class vt {
2612
2628
  this._scriptReadbackReady = !1, this._scriptTime += t, this._scriptFrame++;
2613
2629
  const u = this.config.emissionDurationInfinite ? 1 / 0 : (this.config.emissionDuration || 0) + (this.config.lifetime || 0);
2614
2630
  if (u > 0 && this._scriptTime >= u && !this._scriptConfigRestored)
2615
- this._scriptConfigRestored = !0, this._particleScript._configSnapshot && (this._particleScript.restoreConfig(this.config), this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition));
2631
+ this._scriptConfigRestored = !0, this._particleScript._configSnapshot && (this._particleScript.restoreConfig(this.config), this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse));
2616
2632
  else if (!this._scriptConfigRestored) {
2617
- const m = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: p, particlesDirty: d } = this._particleScript.execute(
2633
+ const p = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: h, particlesDirty: d } = this._particleScript.execute(
2618
2634
  t,
2619
2635
  this._scriptTime,
2620
2636
  this._scriptFrame,
2621
- m,
2637
+ p,
2622
2638
  this._scriptParticleData,
2623
2639
  this._scriptVelocityData,
2624
2640
  this.activeParticles
@@ -2635,7 +2651,7 @@ class vt {
2635
2651
  this._scriptVelocityData,
2636
2652
  0,
2637
2653
  this.activeParticles * 4
2638
- )), p && (this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition));
2654
+ )), h && (this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse));
2639
2655
  }
2640
2656
  }
2641
2657
  this.physics.physicsAccumulator += t;
@@ -2643,52 +2659,50 @@ class vt {
2643
2659
  if (!n && !this.emitting && !this.config.burstMode && !this.config.followSystemId && this.currentEmissionTime < this.effectiveEmissionDuration && (this.emitting = !0), !n && this.emitting)
2644
2660
  if (this.currentEmissionTime += t, this.currentEmissionTime < this.effectiveEmissionDuration) {
2645
2661
  const u = this.activeParticles;
2646
- let m = !1;
2662
+ let p = !1;
2647
2663
  if (this.config.followSystemId) {
2648
2664
  if (this._pendingFollowEmissions.length > 0) {
2649
- const p = this._pendingFollowEmissions.length / 6;
2650
- for (let d = 0; d < p; d++) {
2665
+ const h = this._pendingFollowEmissions.length / 6;
2666
+ for (let d = 0; d < h; d++) {
2651
2667
  const b = d * 6;
2652
2668
  if (this.emitFollowerParticle(
2653
2669
  this._pendingFollowEmissions[b],
2654
2670
  this._pendingFollowEmissions[b + 1],
2655
2671
  this._pendingFollowEmissions[b + 2]
2656
2672
  ))
2657
- m = !0;
2673
+ p = !0;
2658
2674
  else
2659
2675
  break;
2660
2676
  }
2661
2677
  }
2662
2678
  } else {
2663
- let p = 0;
2664
- if (this.config.emissionRate >= 1) {
2665
- p = Math.floor(this.config.emissionRate * t);
2666
- const d = this.config.emissionRate * t - p;
2667
- Math.random() < d && (p += 1);
2668
- } else {
2669
- const d = this.config.emissionRate * t;
2670
- Math.random() < d && (p = 1);
2671
- }
2672
- p === 0 && c && this.config.emissionRate > 0 && this.activeParticles < this.particleCount && (p = 1);
2673
- for (let d = 0; d < p && this.emitParticle(); d++)
2674
- m = !0;
2679
+ let h = 0;
2680
+ const d = Math.max(0, this.config.emissionRate || 0);
2681
+ this.activeParticles < this.particleCount && d > 0 ? (this.emissionAccumulator += d * t, h = Math.floor(this.emissionAccumulator + 1e-9), h > 0 && (this.emissionAccumulator -= h)) : this.activeParticles >= this.particleCount && (this.emissionAccumulator = 0);
2682
+ for (let b = 0; b < h; b++)
2683
+ if (this.emitParticle())
2684
+ p = !0;
2685
+ else {
2686
+ this.emissionAccumulator = 0;
2687
+ break;
2688
+ }
2675
2689
  }
2676
- if (m) {
2677
- const p = this.activeParticles - u, d = u * 8, b = u * 4;
2690
+ if (p) {
2691
+ const h = this.activeParticles - u, d = u * 8, b = u * 4;
2678
2692
  this.device.queue.writeBuffer(
2679
2693
  this.instanceBuffer,
2680
2694
  d * 4,
2681
2695
  // Offset in bytes (float32 = 4 bytes)
2682
2696
  this.particleData,
2683
2697
  d,
2684
- p * 8
2698
+ h * 8
2685
2699
  ), this.device.queue.writeBuffer(
2686
2700
  this.velocityBuffer,
2687
2701
  b * 4,
2688
2702
  // Offset in bytes (float32 = 4 bytes)
2689
2703
  this.particleVelocities,
2690
2704
  b,
2691
- p * 4
2705
+ h * 4
2692
2706
  );
2693
2707
  }
2694
2708
  } else
@@ -2778,13 +2792,13 @@ class vt {
2778
2792
  o * o + c * c + l * l
2779
2793
  );
2780
2794
  if (u > 1e-3) {
2781
- const m = this.config.particleSpeed * 2;
2782
- this.particleVelocities[i] = o / u * m, this.particleVelocities[i + 1] = c / u * m, this.particleVelocities[i + 2] = l / u * m;
2795
+ const p = this.config.particleSpeed * 2;
2796
+ this.particleVelocities[i] = o / u * p, this.particleVelocities[i + 1] = c / u * p, this.particleVelocities[i + 2] = l / u * p;
2783
2797
  } else {
2784
- const m = Math.sqrt(r * r + n * n + a * a);
2785
- if (m > 1e-3) {
2786
- const p = this.config.particleSpeed * 2;
2787
- this.particleVelocities[i] = r / m * p, this.particleVelocities[i + 1] = n / m * p, this.particleVelocities[i + 2] = a / m * p;
2798
+ const p = Math.sqrt(r * r + n * n + a * a);
2799
+ if (p > 1e-3) {
2800
+ const h = this.config.particleSpeed * 2;
2801
+ this.particleVelocities[i] = r / p * h, this.particleVelocities[i + 1] = n / p * h, this.particleVelocities[i + 2] = a / p * h;
2788
2802
  } else
2789
2803
  this.particleVelocities[i] = 0, this.particleVelocities[i + 1] = this.config.particleSpeed * 2, this.particleVelocities[i + 2] = 0;
2790
2804
  }
@@ -2818,8 +2832,8 @@ class vt {
2818
2832
  setGravity(t) {
2819
2833
  this.physics.setGravity(t);
2820
2834
  }
2821
- setAttractor(t, e) {
2822
- this.physics.setAttractor(t, e);
2835
+ setAttractor(t, e, i = this.config.attractorReverse) {
2836
+ this.config.attractorStrength = t, this.config.attractorPosition = e, this.config.attractorReverse = !!i, this.physics.setAttractor(t, e, i);
2823
2837
  }
2824
2838
  setConfinement(t) {
2825
2839
  const e = t.center || this.config.confinementCenter || [0, 0, 0], i = t.space === "local" ? [this.config.emissionPositionX || 0, this.config.emissionPositionY || 0, this.config.emissionPositionZ || 0] : [0, 0, 0], r = [i[0] + (e[0] || 0), i[1] + (e[1] || 0), i[2] + (e[2] || 0)];
@@ -2903,15 +2917,15 @@ class Ws {
2903
2917
  const l = c.keyframes;
2904
2918
  if (!(!l || c.keyframesEnabled === !1)) {
2905
2919
  for (const u of Zs) {
2906
- const m = l[u];
2907
- if (m && m.length) {
2908
- const p = Hs(m, a);
2909
- p !== void 0 && (c[u] = p);
2920
+ const p = l[u];
2921
+ if (p && p.length) {
2922
+ const h = qs(p, a);
2923
+ h !== void 0 && (c[u] = h);
2910
2924
  }
2911
2925
  }
2912
2926
  if (l.particleColor && l.particleColor.length) {
2913
- const u = c.particleColor, m = u && typeof u.length == "number" && u.length >= 3 ? u : void 0, p = qs(l.particleColor, a, m);
2914
- p && (c.particleColor = p, o.updateAppearanceUniform());
2927
+ const u = c.particleColor, p = u && typeof u.length == "number" && u.length >= 3 ? u : void 0, h = Hs(l.particleColor, a, p);
2928
+ h && (c.particleColor = h, o.updateAppearanceUniform());
2915
2929
  }
2916
2930
  }
2917
2931
  }
@@ -3051,6 +3065,10 @@ class Ws {
3051
3065
  o.attractorPosition[0] + e[0],
3052
3066
  o.attractorPosition[1] + e[1],
3053
3067
  o.attractorPosition[2] + e[2]
3068
+ ]), o.confinementEnabled && o.confinementSpace === "world" && Array.isArray(o.confinementCenter) && (l.confinementCenter = [
3069
+ (o.confinementCenter[0] || 0) + e[0],
3070
+ (o.confinementCenter[1] || 0) + e[1],
3071
+ (o.confinementCenter[2] || 0) + e[2]
3054
3072
  ]);
3055
3073
  const u = new vt(this.device, l);
3056
3074
  this.particleSystems.push({
@@ -3081,8 +3099,8 @@ class Ws {
3081
3099
  try {
3082
3100
  const u = await fi(l);
3083
3101
  if (u) {
3084
- const m = await createImageBitmap(u.imageBlob);
3085
- await o.setTexture(m), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
3102
+ const p = await createImageBitmap(u.imageBlob);
3103
+ await o.setTexture(p), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
3086
3104
  }
3087
3105
  } catch (u) {
3088
3106
  console.warn(`Failed to restore GLB texture for ${c.name}:`, u), c.useGlbTexture = !1;
@@ -3096,8 +3114,8 @@ class Ws {
3096
3114
  if (c.textureEnabled && !c.glbModelEnabled && c.textureImageData && !o._textureRestored)
3097
3115
  try {
3098
3116
  const l = new Image();
3099
- await new Promise((m, p) => {
3100
- l.onload = m, l.onerror = p, l.src = c.textureImageData;
3117
+ await new Promise((p, h) => {
3118
+ l.onload = p, l.onerror = h, l.src = c.textureImageData;
3101
3119
  });
3102
3120
  const u = await createImageBitmap(l);
3103
3121
  await o.setTexture(u), o._textureRestored = !0;
@@ -3300,7 +3318,7 @@ const Qs = `
3300
3318
  }
3301
3319
 
3302
3320
  @vertex
3303
- fn vs_main(input: VertexInput) -> VertexOutput {
3321
+ fn vs_main(input: VertexInput, @builtin(instance_index) instanceIdx: u32) -> VertexOutput {
3304
3322
  var output : VertexOutput;
3305
3323
 
3306
3324
  let age = input.particleAgeAndLife.x;
@@ -3331,9 +3349,10 @@ const Qs = `
3331
3349
  // Determine particle size
3332
3350
  var particleSizeFactor = appearance.particleSize;
3333
3351
  if (appearance.randomSize > 0.5) {
3334
- // Use the particle's lifetime as a seed to create a consistent random size
3352
+ // Per-particle seed (particle index), not lifetime — otherwise every particle of an emission
3353
+ // gets the SAME size (see the quad shader for the full explanation).
3335
3354
  particleSizeFactor = appearance.minSize +
3336
- fract(sin(lifetime * 54321.67) * 43758.5453) *
3355
+ fract(sin(f32(instanceIdx) * 12.9898 + 78.233) * 43758.5453) *
3337
3356
  (appearance.maxSize - appearance.minSize);
3338
3357
  }
3339
3358
 
@@ -3356,7 +3375,7 @@ const Qs = `
3356
3375
  var particleRotation = appearance.rotation;
3357
3376
  if (appearance.rotationMode == 1.0) {
3358
3377
  particleRotation = appearance.minRotation +
3359
- fract(sin(lifetime * 12345.67) * 43758.5453) *
3378
+ fract(sin(f32(instanceIdx) * 63.746 + 11.135) * 43758.5453) *
3360
3379
  (appearance.maxRotation - appearance.minRotation);
3361
3380
  } else if (appearance.rotationMode == 2.0) {
3362
3381
  let viewVelocity = (uniforms.transform * vec4<f32>(input.particleVelocity, 0.0)).xyz;
@@ -3554,15 +3573,15 @@ function tr(s, t, e, i = {}) {
3554
3573
  object3dBindGroupLayout: l
3555
3574
  } = e, u = s.createPipelineLayout({
3556
3575
  bindGroupLayouts: [a]
3557
- }), m = s.createPipelineLayout({
3558
- bindGroupLayouts: [o]
3559
3576
  }), p = s.createPipelineLayout({
3577
+ bindGroupLayouts: [o]
3578
+ }), h = s.createPipelineLayout({
3560
3579
  bindGroupLayouts: [c]
3561
3580
  }), d = s.createShaderModule({
3562
3581
  code: ys
3563
3582
  }), b = s.createShaderModule({
3564
3583
  code: gs
3565
- }), w = s.createShaderModule({
3584
+ }), _ = s.createShaderModule({
3566
3585
  code: bs
3567
3586
  }), M = s.createShaderModule({
3568
3587
  code: Ss
@@ -3754,8 +3773,8 @@ function tr(s, t, e, i = {}) {
3754
3773
  // Always write depth (don't self-occlude)
3755
3774
  format: "depth24plus"
3756
3775
  }
3757
- }), F = s.createRenderPipeline({
3758
- layout: m,
3776
+ }), D = s.createRenderPipeline({
3777
+ layout: p,
3759
3778
  vertex: {
3760
3779
  module: b,
3761
3780
  entryPoint: "vs_main"
@@ -3770,14 +3789,14 @@ function tr(s, t, e, i = {}) {
3770
3789
  primitive: {
3771
3790
  topology: "triangle-list"
3772
3791
  }
3773
- }), k = s.createRenderPipeline({
3774
- layout: p,
3792
+ }), N = s.createRenderPipeline({
3793
+ layout: h,
3775
3794
  vertex: {
3776
- module: w,
3795
+ module: _,
3777
3796
  entryPoint: "vs_main"
3778
3797
  },
3779
3798
  fragment: {
3780
- module: w,
3799
+ module: _,
3781
3800
  entryPoint: "fs_main",
3782
3801
  targets: [{
3783
3802
  format: oe,
@@ -3799,7 +3818,7 @@ function tr(s, t, e, i = {}) {
3799
3818
  topology: "triangle-list"
3800
3819
  }
3801
3820
  }), Y = s.createRenderPipeline({
3802
- layout: p,
3821
+ layout: h,
3803
3822
  vertex: {
3804
3823
  module: M,
3805
3824
  entryPoint: "vs_main"
@@ -3826,11 +3845,11 @@ function tr(s, t, e, i = {}) {
3826
3845
  primitive: {
3827
3846
  topology: "triangle-list"
3828
3847
  }
3829
- }), N = s.createShaderModule({ code: xs }), G = s.createRenderPipeline({
3830
- layout: p,
3831
- vertex: { module: N, entryPoint: "vs_main" },
3848
+ }), k = s.createShaderModule({ code: xs }), G = s.createRenderPipeline({
3849
+ layout: h,
3850
+ vertex: { module: k, entryPoint: "vs_main" },
3832
3851
  fragment: {
3833
- module: N,
3852
+ module: k,
3834
3853
  entryPoint: "fs_main",
3835
3854
  targets: [{
3836
3855
  format: t,
@@ -3843,7 +3862,7 @@ function tr(s, t, e, i = {}) {
3843
3862
  primitive: { topology: "triangle-list" }
3844
3863
  }), de = s.createPipelineLayout({
3845
3864
  bindGroupLayouts: [l]
3846
- }), De = s.createRenderPipeline({
3865
+ }), Fe = s.createRenderPipeline({
3847
3866
  layout: de,
3848
3867
  vertex: {
3849
3868
  module: R,
@@ -4005,11 +4024,11 @@ function tr(s, t, e, i = {}) {
4005
4024
  particlePipeline: P,
4006
4025
  particleAdditivePipeline: T,
4007
4026
  particleDepthWritePipeline: E,
4008
- blurPipeline: F,
4009
- compositePipeline: k,
4027
+ blurPipeline: D,
4028
+ compositePipeline: N,
4010
4029
  directRenderPipeline: Y,
4011
4030
  finalCompositePipeline: G,
4012
- object3dPipeline: De,
4031
+ object3dPipeline: Fe,
4013
4032
  glbMeshPipeline: ct
4014
4033
  };
4015
4034
  }
@@ -4023,8 +4042,8 @@ function Pt(s, t, e, i) {
4023
4042
  } = e, {
4024
4043
  sceneTexture: l,
4025
4044
  bloomTexA: u,
4026
- bloomTexB: m
4027
- } = i, p = s.createBindGroup({
4045
+ bloomTexB: p
4046
+ } = i, h = s.createBindGroup({
4028
4047
  layout: s.createBindGroupLayout({
4029
4048
  entries: [
4030
4049
  {
@@ -4117,7 +4136,7 @@ function Pt(s, t, e, i) {
4117
4136
  resource: { buffer: o }
4118
4137
  }
4119
4138
  ]
4120
- }), w = s.createBindGroup({
4139
+ }), _ = s.createBindGroup({
4121
4140
  layout: s.createBindGroupLayout({
4122
4141
  entries: [
4123
4142
  {
@@ -4153,7 +4172,7 @@ function Pt(s, t, e, i) {
4153
4172
  },
4154
4173
  {
4155
4174
  binding: 2,
4156
- resource: m.createView()
4175
+ resource: p.createView()
4157
4176
  },
4158
4177
  {
4159
4178
  binding: 3,
@@ -4196,7 +4215,7 @@ function Pt(s, t, e, i) {
4196
4215
  },
4197
4216
  {
4198
4217
  binding: 2,
4199
- resource: m.createView()
4218
+ resource: p.createView()
4200
4219
  },
4201
4220
  {
4202
4221
  binding: 3,
@@ -4205,10 +4224,10 @@ function Pt(s, t, e, i) {
4205
4224
  ]
4206
4225
  });
4207
4226
  return {
4208
- particleBindGroup: p,
4227
+ particleBindGroup: h,
4209
4228
  horizontalBlurBindGroup: d,
4210
4229
  verticalBlurBindGroup: b,
4211
- compositeBindGroup: w,
4230
+ compositeBindGroup: _,
4212
4231
  directRenderBindGroup: M
4213
4232
  };
4214
4233
  }
@@ -4425,8 +4444,8 @@ function rr(s = 16, t = 16) {
4425
4444
  for (let r = 0; r <= s; r++) {
4426
4445
  const n = r * Math.PI / s, a = Math.sin(n), o = Math.cos(n);
4427
4446
  for (let c = 0; c <= t; c++) {
4428
- const l = c * 2 * Math.PI / t, u = Math.sin(l), p = Math.cos(l) * a, d = o, b = u * a;
4429
- e.push(p * 0.5, d * 0.5, b * 0.5), e.push(p, d, b);
4447
+ const l = c * 2 * Math.PI / t, u = Math.sin(l), h = Math.cos(l) * a, d = o, b = u * a;
4448
+ e.push(h * 0.5, d * 0.5, b * 0.5), e.push(h, d, b);
4430
4449
  }
4431
4450
  }
4432
4451
  for (let r = 0; r < s; r++)
@@ -4573,7 +4592,7 @@ class nr {
4573
4592
  return i;
4574
4593
  }
4575
4594
  }
4576
- class pr {
4595
+ class hr {
4577
4596
  constructor(t) {
4578
4597
  this.device = t, this.objects = [], this.nextId = 0, this.initializeGeometry(), this.onObjectAdded = null, this.onObjectRemoved = null, this.onObjectUpdated = null;
4579
4598
  }
@@ -4698,7 +4717,7 @@ class pr {
4698
4717
  }
4699
4718
  }
4700
4719
  }
4701
- function hr(s) {
4720
+ function pr(s) {
4702
4721
  const t = parseInt(s.slice(1, 3), 16) / 255, e = parseInt(s.slice(3, 5), 16) / 255, i = parseInt(s.slice(5, 7), 16) / 255;
4703
4722
  return [t, e, i];
4704
4723
  }
@@ -4796,40 +4815,40 @@ function vi(s) {
4796
4815
  async function lr(s, t = {}) {
4797
4816
  const { textureFormat: e = "keep", quality: i = 0.85 } = t, r = [], n = [];
4798
4817
  let a = 0;
4799
- const o = (T, E, F) => {
4800
- const k = a, Y = T.length;
4801
- r.push({ offset: k, length: Y, mime: E, kind: F }), n.push(T), a += Y;
4802
- const N = vi(Y);
4803
- return N && (n.push(new Uint8Array(N)), a += N), r.length - 1;
4818
+ const o = (T, E, D) => {
4819
+ const N = a, Y = T.length;
4820
+ r.push({ offset: N, length: Y, mime: E, kind: D }), n.push(T), a += Y;
4821
+ const k = vi(Y);
4822
+ return k && (n.push(new Uint8Array(k)), a += k), r.length - 1;
4804
4823
  }, c = e === "webp" && typeof OffscreenCanvas < "u" && typeof createImageBitmap == "function", l = [];
4805
4824
  for (const T of s.systems || []) {
4806
4825
  const E = { ...T };
4807
4826
  if (typeof E.textureImageData == "string" && E.textureImageData.startsWith("data:")) {
4808
- let { mime: F, bytes: k } = or(E.textureImageData);
4809
- if (c && F !== "image/webp")
4827
+ let { mime: D, bytes: N } = or(E.textureImageData);
4828
+ if (c && D !== "image/webp")
4810
4829
  try {
4811
- const Y = await createImageBitmap(new Blob([k], { type: F })), N = new OffscreenCanvas(Y.width, Y.height);
4812
- N.getContext("2d").drawImage(Y, 0, 0);
4813
- const G = await N.convertToBlob({ type: "image/webp", quality: i }), de = new Uint8Array(await G.arrayBuffer());
4814
- de.length < k.length && (k = de, F = "image/webp");
4830
+ const Y = await createImageBitmap(new Blob([N], { type: D })), k = new OffscreenCanvas(Y.width, Y.height);
4831
+ k.getContext("2d").drawImage(Y, 0, 0);
4832
+ const G = await k.convertToBlob({ type: "image/webp", quality: i }), de = new Uint8Array(await G.arrayBuffer());
4833
+ de.length < N.length && (N = de, D = "image/webp");
4815
4834
  } catch {
4816
4835
  }
4817
- E.textureImageData = { [Ze]: o(k, F, "texture") };
4836
+ E.textureImageData = { [Ze]: o(N, D, "texture") };
4818
4837
  }
4819
4838
  if (typeof E.glbModelData == "string" && E.glbModelData.length > 0) {
4820
- const F = Ri(E.glbModelData);
4821
- E.glbModelData = { [Ze]: o(F, "model/gltf-binary", "glb") };
4839
+ const D = Ri(E.glbModelData);
4840
+ E.glbModelData = { [Ze]: o(D, "model/gltf-binary", "glb") };
4822
4841
  }
4823
4842
  l.push(E);
4824
4843
  }
4825
- const u = { ...s, systems: l, assets: r }, m = new TextEncoder().encode(JSON.stringify(u)), p = vi(m.length), d = new Uint8Array(a);
4844
+ const u = { ...s, systems: l, assets: r }, p = new TextEncoder().encode(JSON.stringify(u)), h = vi(p.length), d = new Uint8Array(a);
4826
4845
  let b = 0;
4827
4846
  for (const T of n)
4828
4847
  d.set(T, b), b += T.length;
4829
- const w = m.length + p, M = 20 + w + 8 + a, R = new ArrayBuffer(M), x = new DataView(R), L = new Uint8Array(R);
4848
+ const _ = p.length + h, M = 20 + _ + 8 + a, R = new ArrayBuffer(M), x = new DataView(R), L = new Uint8Array(R);
4830
4849
  let P = 0;
4831
- x.setUint32(P, Bt, !0), P += 4, x.setUint32(P, wi, !0), P += 4, x.setUint32(P, M, !0), P += 4, x.setUint32(P, w, !0), P += 4, x.setUint32(P, Bi, !0), P += 4, L.set(m, P), P += m.length;
4832
- for (let T = 0; T < p; T++) L[P++] = 32;
4850
+ x.setUint32(P, Bt, !0), P += 4, x.setUint32(P, wi, !0), P += 4, x.setUint32(P, M, !0), P += 4, x.setUint32(P, _, !0), P += 4, x.setUint32(P, Bi, !0), P += 4, L.set(p, P), P += p.length;
4851
+ for (let T = 0; T < h; T++) L[P++] = 32;
4833
4852
  return x.setUint32(P, a, !0), P += 4, x.setUint32(P, Mi, !0), P += 4, L.set(d, P), P += a, R;
4834
4853
  }
4835
4854
  function Ti(s) {
@@ -4843,17 +4862,17 @@ function Ei(s) {
4843
4862
  let i = 12, r = null, n = -1;
4844
4863
  const a = new Uint8Array(s);
4845
4864
  for (; i + 8 <= s.byteLength; ) {
4846
- const p = t.getUint32(i, !0);
4865
+ const h = t.getUint32(i, !0);
4847
4866
  i += 4;
4848
4867
  const d = t.getUint32(i, !0);
4849
- i += 4, d === Bi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + p))) : d === Mi && (n = i), i += p;
4868
+ i += 4, d === Bi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + h))) : d === Mi && (n = i), i += h;
4850
4869
  }
4851
4870
  if (!r) throw new Error("[unpackHZFX] missing JSON chunk");
4852
- const o = r.assets || [], c = (p) => {
4853
- const d = o[p];
4871
+ const o = r.assets || [], c = (h) => {
4872
+ const d = o[h];
4854
4873
  return !d || n < 0 ? null : { ...d, bytes: a.subarray(n + d.offset, n + d.offset + d.length) };
4855
- }, l = (p) => p && typeof p == "object" && typeof p[Ze] == "number", u = (r.systems || []).map((p) => {
4856
- const d = { ...p };
4874
+ }, l = (h) => h && typeof h == "object" && typeof h[Ze] == "number", u = (r.systems || []).map((h) => {
4875
+ const d = { ...h };
4857
4876
  if (l(d.textureImageData)) {
4858
4877
  const b = c(d.textureImageData[Ze]);
4859
4878
  d.textureImageData = b ? `data:${b.mime};base64,${xi(b.bytes)}` : void 0;
@@ -4863,8 +4882,8 @@ function Ei(s) {
4863
4882
  d.glbModelData = b ? xi(b.bytes) : void 0;
4864
4883
  }
4865
4884
  return d;
4866
- }), m = { ...r, systems: u };
4867
- return delete m.assets, m;
4885
+ }), p = { ...r, systems: u };
4886
+ return delete p.assets, p;
4868
4887
  }
4869
4888
  function cr(s) {
4870
4889
  const t = new Uint8Array(s);
@@ -4926,6 +4945,7 @@ function ur(s) {
4926
4945
  dampingStrength: s.dampingStrength,
4927
4946
  attractorEnabled: s.attractorEnabled,
4928
4947
  attractorStrength: s.attractorStrength,
4948
+ attractorReverse: s.attractorReverse ?? !1,
4929
4949
  attractorPosition: s.attractorPosition,
4930
4950
  emissionRotationX: s.emissionRotationX,
4931
4951
  emissionRotationY: s.emissionRotationY,
@@ -5060,12 +5080,12 @@ async function br(s, t, e = "hzfx") {
5060
5080
  const i = {
5061
5081
  version: "1.0",
5062
5082
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
5063
- systems: s.particleSystems.map(({ config: u, system: m }) => ({
5083
+ systems: s.particleSystems.map(({ config: u, system: p }) => ({
5064
5084
  ...ur(u),
5065
5085
  // single source of truth for config fields
5066
5086
  // Binary assets embedded so replaceSystems() can restore them
5067
5087
  textureImageData: u.textureEnabled && !u.glbModelEnabled && u.textureImageData ? u.textureImageData : void 0,
5068
- glbModelData: u.glbModelEnabled && m.glbRawArrayBuffer ? cr(m.glbRawArrayBuffer) : void 0
5088
+ glbModelData: u.glbModelEnabled && p.glbRawArrayBuffer ? cr(p.glbRawArrayBuffer) : void 0
5069
5089
  })),
5070
5090
  activeSystemIndex: s.activeSystemIndex,
5071
5091
  loop: s.loop || !1
@@ -5153,13 +5173,13 @@ async function vr(s, t = {}) {
5153
5173
  const o = !!(s && s.device && s.context);
5154
5174
  o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await Js(a));
5155
5175
  const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new Ws(r), u = { layouts: {}, pipelines: {} };
5156
- function m(f) {
5157
- const h = f ? "ms" : "ss";
5158
- if (!u.pipelines[h]) {
5176
+ function p(f) {
5177
+ const m = f ? "ms" : "ss";
5178
+ if (!u.pipelines[m]) {
5159
5179
  const S = r.createShaderModule({ code: dr(f) }), g = r.createBindGroupLayout({
5160
5180
  entries: [{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "depth", multisampled: f } }]
5161
5181
  });
5162
- u.layouts[h] = g, u.pipelines[h] = r.createRenderPipeline({
5182
+ u.layouts[m] = g, u.pipelines[m] = r.createRenderPipeline({
5163
5183
  layout: r.createPipelineLayout({ bindGroupLayouts: [g] }),
5164
5184
  vertex: { module: S, entryPoint: "vs" },
5165
5185
  fragment: { module: S, entryPoint: "fs", targets: [] },
@@ -5167,31 +5187,31 @@ async function vr(s, t = {}) {
5167
5187
  depthStencil: { format: "depth24plus", depthWriteEnabled: !0, depthCompare: "always" }
5168
5188
  });
5169
5189
  }
5170
- return { pipeline: u.pipelines[h], layout: u.layouts[h] };
5190
+ return { pipeline: u.pipelines[m], layout: u.layouts[m] };
5171
5191
  }
5172
- const p = {
5192
+ const h = {
5173
5193
  bloomSourceTextures: {},
5174
5194
  bloomCompositeTextures: {},
5175
5195
  combinedTexture: null,
5176
- getBloomSourceTexture(f, h, S) {
5196
+ getBloomSourceTexture(f, m, S) {
5177
5197
  return this.bloomSourceTextures[f] || (this.bloomSourceTextures[f] = r.createTexture({
5178
- size: [h, S],
5198
+ size: [m, S],
5179
5199
  format: "rgba16float",
5180
5200
  // HDR chain (see webgpu.js HDR_FORMAT) — avoids additive clip
5181
5201
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5182
5202
  })), this.bloomSourceTextures[f];
5183
5203
  },
5184
- getBloomCompositeTexture(f, h, S) {
5204
+ getBloomCompositeTexture(f, m, S) {
5185
5205
  return this.bloomCompositeTextures[f] || (this.bloomCompositeTextures[f] = r.createTexture({
5186
- size: [h, S],
5206
+ size: [m, S],
5187
5207
  format: "rgba16float",
5188
5208
  // HDR chain
5189
5209
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5190
5210
  })), this.bloomCompositeTextures[f];
5191
5211
  },
5192
- getCombinedTexture(f, h) {
5212
+ getCombinedTexture(f, m) {
5193
5213
  return this.combinedTexture || (this.combinedTexture = r.createTexture({
5194
- size: [f, h],
5214
+ size: [f, m],
5195
5215
  format: "rgba16float",
5196
5216
  // HDR chain — tonemapped to canvas in the final pass
5197
5217
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
@@ -5216,137 +5236,137 @@ async function vr(s, t = {}) {
5216
5236
  clear() {
5217
5237
  this.systemBindGroups = {}, this.systemBloomHorizontalBindGroups = {}, this.secondHorizontalBindGroups = {}, this.systemBloomCompositeBindGroups = {}, this.combinedBloomCompositeBindGroups = {}, this.combinedInitialBindGroup = null, this.finalBindGroup = null, this.textureStates = {}, this.textureRefs = {};
5218
5238
  }
5219
- }, b = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), w = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), R = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), x = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), L = Ge(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), P = {}, T = () => Ge(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);
5239
+ }, b = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), _ = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), R = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), x = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), L = Ge(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), P = {}, T = () => Ge(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);
5220
5240
  l.onSystemCreated = (f) => {
5221
5241
  P[f] || (P[f] = T());
5222
5242
  };
5223
- const E = 4e4, F = new Float32Array(E * 8), k = new Float32Array(E * 4), Y = new Float32Array(E * 4), N = r.createBuffer({ size: E * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), G = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), de = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), De = /* @__PURE__ */ new Map(), ct = 8, W = [];
5243
+ const E = 4e4, D = new Float32Array(E * 8), N = new Float32Array(E * 4), Y = new Float32Array(E * 4), k = r.createBuffer({ size: E * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), G = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), de = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), Fe = /* @__PURE__ */ new Map(), ct = 8, W = [];
5224
5244
  function Mt(f) {
5225
- for (const h of W) if (h.ids.has(f)) return h;
5245
+ for (const m of W) if (m.ids.has(f)) return m;
5226
5246
  return null;
5227
5247
  }
5228
- function Ci(f, h) {
5248
+ function Ai(f, m) {
5229
5249
  if (!f.pos) return;
5230
- f.hist.push({ t: h, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
5231
- const S = h - ct;
5250
+ f.hist.push({ t: m, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
5251
+ const S = m - ct;
5232
5252
  for (; f.hist.length > 2 && f.hist[0].t < S; ) f.hist.shift();
5233
5253
  }
5234
- function Rt(f, h, S) {
5254
+ function Rt(f, m, S) {
5235
5255
  const g = f.hist;
5236
5256
  if (g.length === 0) {
5237
- const H = f.pos;
5238
- return H && (S[0] = H[0], S[1] = H[1], S[2] = H[2]), S;
5257
+ const q = f.pos;
5258
+ return q && (S[0] = q[0], S[1] = q[1], S[2] = q[2]), S;
5239
5259
  }
5240
5260
  let v;
5241
- if (h >= g[g.length - 1].t)
5261
+ if (m >= g[g.length - 1].t)
5242
5262
  return v = g[g.length - 1], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5243
- if (h <= g[0].t)
5263
+ if (m <= g[0].t)
5244
5264
  return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5245
- for (let H = g.length - 1; H > 0; H--)
5246
- if (g[H - 1].t <= h) {
5247
- const j = g[H - 1], Q = g[H], Z = (h - j.t) / Math.max(1e-6, Q.t - j.t);
5265
+ for (let q = g.length - 1; q > 0; q--)
5266
+ if (g[q - 1].t <= m) {
5267
+ const j = g[q - 1], Q = g[q], Z = (m - j.t) / Math.max(1e-6, Q.t - j.t);
5248
5268
  return S[0] = j.x + (Q.x - j.x) * Z, S[1] = j.y + (Q.y - j.y) * Z, S[2] = j.z + (Q.z - j.z) * Z, S;
5249
5269
  }
5250
5270
  return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5251
5271
  }
5252
- const Ai = 0.41421356;
5272
+ const Ci = 0.41421356;
5253
5273
  function Ui() {
5254
- De.clear();
5255
- let f = 0, h = 0;
5256
- A.position[0], A.position[1], A.position[2];
5274
+ Fe.clear();
5275
+ let f = 0, m = 0;
5276
+ C.position[0], C.position[1], C.position[2];
5257
5277
  for (const { system: S, config: g } of l.particleSystems) {
5258
5278
  if (!g.emissionTrailEnabled || g.hidden || g.glbModelEnabled) continue;
5259
5279
  S.readbackAndProcessParticles();
5260
- const v = S.particleData, H = S.particleVelocities, j = S.activeParticles;
5261
- if (!v || !H || j <= 0) continue;
5262
- const Q = g.emissionTrailMode === "particles", Z = f, Ae = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1, B = g.particleSize ?? 0.5, U = g.bloomIntensity || 1, I = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)), D = g.emissionTrailShape || "straight", J = g.followSystemTranslation ?? !0, K = S._simPosition, X = J && K ? K[0] : 0, it = J && K ? K[1] : 0, jt = J && K ? K[2] : 0, Ue = S._simVelocity, Yt = Ue ? Ue[0] : 0, rs = Ue ? Ue[1] : 0, Ht = Ue ? Ue[2] : 0, Oe = Mt(g.id), qt = !!(J && Oe && Oe.hist && Oe.hist.length > 1);
5280
+ const v = S.particleData, q = S.particleVelocities, j = S.activeParticles;
5281
+ if (!v || !q || j <= 0) continue;
5282
+ const Q = g.emissionTrailMode === "particles", Z = f, Ce = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1, B = g.particleSize ?? 0.5, U = g.bloomIntensity || 1, I = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)), F = g.emissionTrailShape || "straight", J = g.followSystemTranslation ?? !0, K = S._simPosition, X = J && K ? K[0] : 0, it = J && K ? K[1] : 0, jt = J && K ? K[2] : 0, Ue = S._simVelocity, Yt = Ue ? Ue[0] : 0, rs = Ue ? Ue[1] : 0, qt = Ue ? Ue[2] : 0, Oe = Mt(g.id), Ht = !!(J && Oe && Oe.hist && Oe.hist.length > 1);
5263
5283
  for (let st = 0; st < j; st++) {
5264
- const he = st * 8, rt = v[he], mt = v[he + 1], nt = v[he + 2], ns = rt + X, as = mt + it, os = nt + jt;
5265
- let Le = v[he + 3], Xe = v[he + 4], ke = v[he + 5];
5266
- const Ne = v[he + 6], Ie = v[he + 7];
5267
- if (Ne >= Ie || Ie <= 0) continue;
5268
- const me = Ne / Ie;
5284
+ const pe = st * 8, rt = v[pe], mt = v[pe + 1], nt = v[pe + 2], ns = rt + X, as = mt + it, os = nt + jt;
5285
+ let Le = v[pe + 3], Xe = v[pe + 4], Ne = v[pe + 5];
5286
+ const ke = v[pe + 6], Ie = v[pe + 7];
5287
+ if (ke >= Ie || Ie <= 0) continue;
5288
+ const me = ke / Ie;
5269
5289
  if (g.colorTransitionEnabled) {
5270
- const _ = g.startColor ?? [1, 0, 0], z = g.endColor ?? [0, 0, 1];
5271
- Le = _[0] + (z[0] - _[0]) * me, Xe = _[1] + (z[1] - _[1]) * me, ke = _[2] + (z[2] - _[2]) * me;
5290
+ const w = g.startColor ?? [1, 0, 0], z = g.endColor ?? [0, 0, 1];
5291
+ Le = w[0] + (z[0] - w[0]) * me, Xe = w[1] + (z[1] - w[1]) * me, Ne = w[2] + (z[2] - w[2]) * me;
5272
5292
  }
5273
- Le = Math.min(1, Le * U), Xe = Math.min(1, Xe * U), ke = Math.min(1, ke * U);
5293
+ Le = Math.min(1, Le * U), Xe = Math.min(1, Xe * U), Ne = Math.min(1, Ne * U);
5274
5294
  let je = B;
5275
5295
  if (g.randomSize) {
5276
- const _ = Math.sin(Ie * 54321.67) * 43758.5453 % 1, z = _ < 0 ? _ + 1 : _;
5296
+ const w = Math.sin(Ie * 54321.67) * 43758.5453 % 1, z = w < 0 ? w + 1 : w;
5277
5297
  je = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * z;
5278
5298
  }
5279
5299
  if (g.fadeSizeEnabled) {
5280
- const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5281
- je *= 1 - Math.pow(me, 1 / _);
5300
+ const w = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5301
+ je *= 1 - Math.pow(me, 1 / w);
5282
5302
  }
5283
5303
  if (g.increaseSizeEnabled) {
5284
- const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5285
- je *= 1 + Math.pow(me, 1 / _);
5304
+ const w = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5305
+ je *= 1 + Math.pow(me, 1 / w);
5286
5306
  }
5287
5307
  if (je <= 0 || me > 0.9) continue;
5288
- const Zt = Math.min((0.9 - me) * (1 / 0.2), 1), $t = 0.75 * je * Ai * Zt;
5308
+ const Zt = Math.min((0.9 - me) * (1 / 0.2), 1), $t = 0.75 * je * Ci * Zt;
5289
5309
  let Ye = y;
5290
5310
  if (g.fadeEnabled && (Ye *= Math.max(0, 1 - me)), Ye *= Zt, Ye < 0.01) continue;
5291
- const yt = st * 4, Wt = H[yt], Jt = H[yt + 1], Qt = H[yt + 2], at = Wt + Yt, ot = Jt + rs, lt = Qt + Ht, Kt = Math.sqrt(at * at + ot * ot + lt * lt);
5311
+ const yt = st * 4, Wt = q[yt], Jt = q[yt + 1], Qt = q[yt + 2], at = Wt + Yt, ot = Jt + rs, lt = Qt + qt, Kt = Math.sqrt(at * at + ot * ot + lt * lt);
5292
5312
  if (Kt < 1e-3) continue;
5293
- const gt = 1 / Kt, ve = at * gt, Pe = ot * gt, ye = lt * gt, ei = A.right[0], ti = A.right[1], ii = A.right[2];
5294
- let bt = ei * ve + ti * Pe + ii * ye, re = ei - bt * ve, ne = ti - bt * Pe, ae = ii - bt * ye, He = Math.sqrt(re * re + ne * ne + ae * ae);
5295
- if (He < 0.2) {
5296
- const _ = A.up[0], z = A.up[1], $ = A.up[2], V = _ * ve + z * Pe + $ * ye;
5297
- re = _ - V * ve, ne = z - V * Pe, ae = $ - V * ye, He = Math.sqrt(re * re + ne * ne + ae * ae) || 1;
5313
+ const gt = 1 / Kt, ve = at * gt, Pe = ot * gt, ye = lt * gt, ei = C.right[0], ti = C.right[1], ii = C.right[2];
5314
+ let bt = ei * ve + ti * Pe + ii * ye, re = ei - bt * ve, ne = ti - bt * Pe, ae = ii - bt * ye, qe = Math.sqrt(re * re + ne * ne + ae * ae);
5315
+ if (qe < 0.2) {
5316
+ const w = C.up[0], z = C.up[1], $ = C.up[2], V = w * ve + z * Pe + $ * ye;
5317
+ re = w - V * ve, ne = z - V * Pe, ae = $ - V * ye, qe = Math.sqrt(re * re + ne * ne + ae * ae) || 1;
5298
5318
  }
5299
- re /= He, ne /= He, ae /= He;
5300
- const qe = Math.min(Ae, Ne);
5301
- if (qe < 1e-3) continue;
5302
- const si = g.gravityEnabled && g.gravityStrength || 0, _e = ki, we = Ni, Be = ji;
5303
- if (g.orientToDirection && g.burstMode && qt) {
5304
- const _ = S._emitSimRotY || 0, z = Yi, $ = Hi, V = qi;
5305
- for (let C = 0; C <= I; C++) {
5306
- const O = Rt(Oe, pe - C / I * qe, Vt);
5307
- z[C] = O[0], $[C] = O[1], V[C] = O[2];
5319
+ re /= qe, ne /= qe, ae /= qe;
5320
+ const He = Math.min(Ce, ke);
5321
+ if (He < 1e-3) continue;
5322
+ const si = g.gravityEnabled && g.gravityStrength || 0, _e = Ni, we = ki, Be = ji;
5323
+ if (g.orientToDirection && g.burstMode && Ht) {
5324
+ const w = S._emitSimRotY || 0, z = Yi, $ = qi, V = Hi;
5325
+ for (let A = 0; A <= I; A++) {
5326
+ const O = Rt(Oe, he - A / I * He, Vt);
5327
+ z[A] = O[0], $[A] = O[1], V[A] = O[2];
5308
5328
  }
5309
- for (let C = 0; C <= I; C++) {
5310
- const O = C > 0 ? C - 1 : 0, q = C < I ? C + 1 : I;
5311
- let Me = z[O] - z[q], Re = V[O] - V[q];
5312
- const ge = (Math.hypot(Me, Re) > 1e-5 ? Math.atan2(Me, Re) : Math.atan2(Yt, Ht)) - _, te = Math.cos(ge), ie = Math.sin(ge), ue = C / I * qe, St = -0.5 * si * ue * ue;
5313
- _e[C] = te * rt + ie * nt + z[C], we[C] = mt + St + $[C], Be[C] = -ie * rt + te * nt + V[C];
5329
+ for (let A = 0; A <= I; A++) {
5330
+ const O = A > 0 ? A - 1 : 0, H = A < I ? A + 1 : I;
5331
+ let Me = z[O] - z[H], Re = V[O] - V[H];
5332
+ const ge = (Math.hypot(Me, Re) > 1e-5 ? Math.atan2(Me, Re) : Math.atan2(Yt, qt)) - w, te = Math.cos(ge), ie = Math.sin(ge), ue = A / I * He, St = -0.5 * si * ue * ue;
5333
+ _e[A] = te * rt + ie * nt + z[A], we[A] = mt + St + $[A], Be[A] = -ie * rt + te * nt + V[A];
5314
5334
  }
5315
- } else for (let _ = 0; _ <= I; _++) {
5316
- const z = _ / I * qe, $ = -0.5 * si * z * z;
5317
- if (qt) {
5318
- const V = Rt(Oe, pe - z, Vt);
5319
- _e[_] = rt - Wt * z + V[0], we[_] = mt - Jt * z + $ + V[1], Be[_] = nt - Qt * z + V[2];
5335
+ } else for (let w = 0; w <= I; w++) {
5336
+ const z = w / I * He, $ = -0.5 * si * z * z;
5337
+ if (Ht) {
5338
+ const V = Rt(Oe, he - z, Vt);
5339
+ _e[w] = rt - Wt * z + V[0], we[w] = mt - Jt * z + $ + V[1], Be[w] = nt - Qt * z + V[2];
5320
5340
  } else
5321
- _e[_] = ns - at * z, we[_] = as - ot * z + $, Be[_] = os - lt * z;
5341
+ _e[w] = ns - at * z, we[w] = as - ot * z + $, Be[w] = os - lt * z;
5322
5342
  }
5323
- if (D !== "straight") {
5324
- const _ = g.emissionTrailShapeAmplitude ?? 0.1, z = g.emissionTrailShapeFrequency ?? 4, $ = g.emissionTrailShapeSpeed ?? 0;
5325
- let V = -ye, C = 0, O = ve, q = Math.sqrt(V * V + O * O);
5326
- q < 1e-6 && (V = 0, C = ye, O = -Pe, q = Math.sqrt(V * V + C * C + O * O) || 1), V /= q, C /= q, O /= q;
5327
- const Me = Pe * O - ye * C, Re = ye * V - ve * O, ce = ve * C - Pe * V;
5343
+ if (F !== "straight") {
5344
+ const w = g.emissionTrailShapeAmplitude ?? 0.1, z = g.emissionTrailShapeFrequency ?? 4, $ = g.emissionTrailShapeSpeed ?? 0;
5345
+ let V = -ye, A = 0, O = ve, H = Math.sqrt(V * V + O * O);
5346
+ H < 1e-6 && (V = 0, A = ye, O = -Pe, H = Math.sqrt(V * V + A * A + O * O) || 1), V /= H, A /= H, O /= H;
5347
+ const Me = Pe * O - ye * A, Re = ye * V - ve * O, ce = ve * A - Pe * V;
5328
5348
  for (let ee = 1; ee <= I; ee++) {
5329
- const ge = ee / I * qe, te = 2 * Math.PI * z * (pe - ge) + $ * pe;
5349
+ const ge = ee / I * He, te = 2 * Math.PI * z * (he - ge) + $ * he;
5330
5350
  let ie = 0, ue = 0;
5331
- D === "zigzag" ? ie = _ * Math.sign(Math.sin(te)) : D === "sine" ? ie = _ * Math.sin(te) : D === "spiral" && (ie = _ * Math.sin(te), ue = _ * Math.cos(te)), _e[ee] += V * ie + Me * ue, we[ee] += C * ie + Re * ue, Be[ee] += O * ie + ce * ue;
5351
+ F === "zigzag" ? ie = w * Math.sign(Math.sin(te)) : F === "sine" ? ie = w * Math.sin(te) : F === "spiral" && (ie = w * Math.sin(te), ue = w * Math.cos(te)), _e[ee] += V * ie + Me * ue, we[ee] += A * ie + Re * ue, Be[ee] += O * ie + ce * ue;
5332
5352
  }
5333
5353
  }
5334
5354
  if (Q)
5335
- for (let _ = 1; _ <= I && f < E; _++) {
5336
- const z = _ / I, $ = _e[_] - X, V = we[_] - it, C = Be[_] - jt, O = f * 8, q = f * 4;
5337
- F[O] = $, F[O + 1] = V, F[O + 2] = C, F[O + 3] = Le, F[O + 4] = Xe, F[O + 5] = ke, F[O + 6] = Ne + (Ie - Ne) * z, F[O + 7] = Ie, k[q] = 0, k[q + 1] = 0, k[q + 2] = 0, k[q + 3] = 0, Y[q] = $, Y[q + 1] = V, Y[q + 2] = C, Y[q + 3] = 0, f++;
5355
+ for (let w = 1; w <= I && f < E; w++) {
5356
+ const z = w / I, $ = _e[w] - X, V = we[w] - it, A = Be[w] - jt, O = f * 8, H = f * 4;
5357
+ D[O] = $, D[O + 1] = V, D[O + 2] = A, D[O + 3] = Le, D[O + 4] = Xe, D[O + 5] = Ne, D[O + 6] = ke + (Ie - ke) * z, D[O + 7] = Ie, N[H] = 0, N[H + 1] = 0, N[H + 2] = 0, N[H + 3] = 0, Y[H] = $, Y[H + 1] = V, Y[H + 2] = A, Y[H + 3] = 0, f++;
5338
5358
  }
5339
5359
  else
5340
- for (let _ = 0; _ < I && !(h + 42 > le.length); _++) {
5341
- const z = _ / I, $ = (_ + 1) / I, V = _e[_], C = we[_], O = Be[_], q = _e[_ + 1], Me = we[_ + 1], Re = Be[_ + 1], ce = $t * (1 - z), ee = $t * (1 - $), ge = Ye * (1 - z) * (1 - z), te = Ye * (1 - $) * (1 - $), ie = V + re * ce, ue = C + ne * ce, St = O + ae * ce, ri = V - re * ce, ni = C - ne * ce, ai = O - ae * ce, oi = q + re * ee, li = Me + ne * ee, ci = Re + ae * ee, ls = q - re * ee, cs = Me - ne * ee, us = Re - ae * ee, ze = (ds, fs, ps, hs) => {
5342
- le[h++] = ds, le[h++] = fs, le[h++] = ps, le[h++] = Le, le[h++] = Xe, le[h++] = ke, le[h++] = hs;
5360
+ for (let w = 0; w < I && !(m + 42 > le.length); w++) {
5361
+ const z = w / I, $ = (w + 1) / I, V = _e[w], A = we[w], O = Be[w], H = _e[w + 1], Me = we[w + 1], Re = Be[w + 1], ce = $t * (1 - z), ee = $t * (1 - $), ge = Ye * (1 - z) * (1 - z), te = Ye * (1 - $) * (1 - $), ie = V + re * ce, ue = A + ne * ce, St = O + ae * ce, ri = V - re * ce, ni = A - ne * ce, ai = O - ae * ce, oi = H + re * ee, li = Me + ne * ee, ci = Re + ae * ee, ls = H - re * ee, cs = Me - ne * ee, us = Re - ae * ee, ze = (ds, fs, hs, ps) => {
5362
+ le[m++] = ds, le[m++] = fs, le[m++] = hs, le[m++] = Le, le[m++] = Xe, le[m++] = Ne, le[m++] = ps;
5343
5363
  };
5344
5364
  ze(ie, ue, St, ge), ze(ri, ni, ai, ge), ze(oi, li, ci, te), ze(ri, ni, ai, ge), ze(ls, cs, us, te), ze(oi, li, ci, te);
5345
5365
  }
5346
5366
  }
5347
- Q && f > Z && De.set(g.id, { first: Z, count: f - Z });
5367
+ Q && f > Z && Fe.set(g.id, { first: Z, count: f - Z });
5348
5368
  }
5349
- f > 0 && (r.queue.writeBuffer(N, 0, F, 0, f * 8), r.queue.writeBuffer(G, 0, k, 0, f * 4), r.queue.writeBuffer(de, 0, Y, 0, f * 4)), Fe = h / 7, Fe > 0 && r.queue.writeBuffer(zt, 0, le, 0, h);
5369
+ f > 0 && (r.queue.writeBuffer(k, 0, D, 0, f * 8), r.queue.writeBuffer(G, 0, N, 0, f * 4), r.queue.writeBuffer(de, 0, Y, 0, f * 4)), De = m / 7, De > 0 && r.queue.writeBuffer(zt, 0, le, 0, m);
5350
5370
  }
5351
5371
  const Tt = () => {
5352
5372
  r.queue.writeBuffer(M, 0, new Float32Array([1, 0, a.width, a.height, 0, 0, 0, 0])), r.queue.writeBuffer(R, 0, new Float32Array([0, 1, a.width, a.height, 0, 0, 0, 0]));
@@ -5359,11 +5379,11 @@ async function vr(s, t = {}) {
5359
5379
  particleAdditivePipeline: zi,
5360
5380
  particleDepthWritePipeline: Gi,
5361
5381
  blurPipeline: We,
5362
- compositePipeline: Di,
5363
- directRenderPipeline: Ct,
5364
- finalCompositePipeline: Fi,
5382
+ compositePipeline: Fi,
5383
+ directRenderPipeline: At,
5384
+ finalCompositePipeline: Di,
5365
5385
  glbMeshPipeline: Vi
5366
- } = tr(r, c, fe), At = r.createShaderModule({ code: `
5386
+ } = tr(r, c, fe), Ct = r.createShaderModule({ code: `
5367
5387
  struct U { mvp: mat4x4<f32> };
5368
5388
  @group(0) @binding(0) var<uniform> u: U;
5369
5389
  struct VIn { @location(0) pos: vec3<f32>, @location(1) col: vec4<f32> };
@@ -5375,7 +5395,7 @@ async function vr(s, t = {}) {
5375
5395
  }), Oi = r.createRenderPipeline({
5376
5396
  layout: r.createPipelineLayout({ bindGroupLayouts: [Ut] }),
5377
5397
  vertex: {
5378
- module: At,
5398
+ module: Ct,
5379
5399
  entryPoint: "vs",
5380
5400
  buffers: [{ arrayStride: 28, attributes: [
5381
5401
  { shaderLocation: 0, offset: 0, format: "float32x3" },
@@ -5383,7 +5403,7 @@ async function vr(s, t = {}) {
5383
5403
  ] }]
5384
5404
  },
5385
5405
  fragment: {
5386
- module: At,
5406
+ module: Ct,
5387
5407
  entryPoint: "fs",
5388
5408
  targets: [{ format: "rgba16float", blend: {
5389
5409
  // renders into the HDR sceneTexture
@@ -5403,15 +5423,15 @@ async function vr(s, t = {}) {
5403
5423
  layout: Ut,
5404
5424
  entries: [{ binding: 0, resource: { buffer: b } }]
5405
5425
  });
5406
- let Fe = 0, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe } = yi(r, c, a.width, a.height), Je = gi(r, a.width, a.height), Te, Gt, Qe, Ve;
5407
- const Dt = () => {
5408
- const f = (h) => h.createView();
5426
+ let De = 0, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe } = yi(r, c, a.width, a.height), Je = gi(r, a.width, a.height), Te, Gt, Qe, Ve;
5427
+ const Ft = () => {
5428
+ const f = (m) => m.createView();
5409
5429
  Te = f(be), Gt = f(Se), Qe = f(xe), Ve = f(Je);
5410
5430
  };
5411
- Dt();
5412
- const ut = { uniformBuffer: b, appearanceUniformBuffer: w, horizontalBlurUniformBuffer: M, verticalBlurUniformBuffer: R, bloomIntensityBuffer: x };
5431
+ Ft();
5432
+ const ut = { uniformBuffer: b, appearanceUniformBuffer: _, horizontalBlurUniformBuffer: M, verticalBlurUniformBuffer: R, bloomIntensityBuffer: x };
5413
5433
  let Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
5414
- const A = {
5434
+ const C = {
5415
5435
  mvp: new Float32Array(16),
5416
5436
  position: new Float32Array([0, 0, 10]),
5417
5437
  right: new Float32Array([1, 0, 0]),
@@ -5419,12 +5439,12 @@ async function vr(s, t = {}) {
5419
5439
  up: new Float32Array([0, 1, 0]),
5420
5440
  hasCamera: !1
5421
5441
  };
5422
- let pe = 0, Xi = 0;
5423
- const Ee = new Float32Array(5), Ft = new Float32Array(16), ki = new Array(65), Ni = new Array(65), ji = new Array(65), Yi = new Array(65), Hi = new Array(65), qi = new Array(65), Vt = [0, 0, 0], Ce = { key: null, ms: !1, bindGroup: null };
5424
- let Ot = !1, dt = !0, et = !1, tt = null, ft = a.width, pt = a.height;
5442
+ let he = 0, Xi = 0;
5443
+ const Ee = new Float32Array(5), Dt = new Float32Array(16), Ni = new Array(65), ki = new Array(65), ji = new Array(65), Yi = new Array(65), qi = new Array(65), Hi = new Array(65), Vt = [0, 0, 0], Ae = { key: null, ms: !1, bindGroup: null };
5444
+ let Ot = !1, dt = !0, et = !1, tt = null, ft = a.width, ht = a.height;
5425
5445
  function Lt() {
5426
- const f = [be, Se, xe, Je], h = yi(r, c, a.width, a.height);
5427
- be = h.sceneTexture, Se = h.bloomTexA, xe = h.bloomTexB, Je = gi(r, a.width, a.height), Dt(), Tt(), d.clear(), p.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
5446
+ const f = [be, Se, xe, Je], m = yi(r, c, a.width, a.height);
5447
+ be = m.sceneTexture, Se = m.bloomTexA, xe = m.bloomTexB, Je = gi(r, a.width, a.height), Ft(), Tt(), d.clear(), h.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
5428
5448
  let S = !1;
5429
5449
  const g = () => {
5430
5450
  if (!S) {
@@ -5435,41 +5455,41 @@ async function vr(s, t = {}) {
5435
5455
  };
5436
5456
  requestAnimationFrame(g);
5437
5457
  }
5438
- function Zi(f, h, S) {
5439
- A.mvp.set(ar(f, h)), h && h.length >= 10 && (A.right[0] = h[0], A.right[1] = h[4], A.right[2] = h[8], A.up[0] = h[1], A.up[1] = h[5], A.up[2] = h[9]), S && (A.position[0] = S.x ?? S[0], A.position[1] = S.y ?? S[1], A.position[2] = S.z ?? S[2]), A.hasCamera = !0;
5458
+ function Zi(f, m, S) {
5459
+ C.mvp.set(ar(f, m)), m && m.length >= 10 && (C.right[0] = m[0], C.right[1] = m[4], C.right[2] = m[8], C.up[0] = m[1], C.up[1] = m[5], C.up[2] = m[9]), S && (C.position[0] = S.x ?? S[0], C.position[1] = S.y ?? S[1], C.position[2] = S.z ?? S[2]), C.hasCamera = !0;
5440
5460
  }
5441
- function $i(f, h) {
5442
- A.mvp.set(f), h && (A.position[0] = h.x ?? h[0], A.position[1] = h.y ?? h[1], A.position[2] = h.z ?? h[2]), A.hasCamera = !0;
5461
+ function $i(f, m) {
5462
+ C.mvp.set(f), m && (C.position[0] = m.x ?? m[0], C.position[1] = m.y ?? m[1], C.position[2] = m.z ?? m[2]), C.hasCamera = !0;
5443
5463
  }
5444
- async function ht(f) {
5464
+ async function pt(f) {
5445
5465
  if (et) {
5446
5466
  tt = f;
5447
5467
  return;
5448
5468
  }
5449
5469
  et = !0;
5450
5470
  try {
5451
- for (const h in P) delete P[h];
5452
- d.clear(), p.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5453
- for (const h of f)
5454
- await l.addSystems(h.preset, h.position || [0, 0, 0]);
5455
- for (const { config: h } of l.particleSystems)
5456
- P[h.id] || (P[h.id] = T());
5471
+ for (const m in P) delete P[m];
5472
+ d.clear(), h.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5473
+ for (const m of f)
5474
+ await l.addSystems(m.preset, m.position || [0, 0, 0]);
5475
+ for (const { config: m } of l.particleSystems)
5476
+ P[m.id] || (P[m.id] = T());
5457
5477
  dt = !0, l.respawnAllSystems();
5458
5478
  } finally {
5459
5479
  if (et = !1, tt) {
5460
- const h = tt;
5461
- tt = null, ht(h);
5480
+ const m = tt;
5481
+ tt = null, pt(m);
5462
5482
  }
5463
5483
  }
5464
5484
  }
5465
- async function Wi(f, h = [0, 0, 0]) {
5466
- return ht([{ preset: f, position: h }]);
5485
+ async function Wi(f, m = [0, 0, 0]) {
5486
+ return pt([{ preset: f, position: m }]);
5467
5487
  }
5468
5488
  function Ji(f) {
5469
5489
  if (Ot || et || !l.ready || f <= 0 || l.particleSystems.length === 0) return;
5470
- const h = l.clock;
5471
- if (h && (h.loop = l.loop ?? i, h.duration = l.getTotalDuration(), f = h.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
5472
- if ((a.width !== ft || a.height !== pt) && (ft = a.width, pt = a.height, Lt()), pe += f, W.length) {
5490
+ const m = l.clock;
5491
+ if (m && (m.loop = l.loop ?? i, m.duration = l.getTotalDuration(), f = m.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
5492
+ if ((a.width !== ft || a.height !== ht) && (ft = a.width, ht = a.height, Lt()), he += f, W.length) {
5473
5493
  for (const y of W) {
5474
5494
  if (y.getPosition) {
5475
5495
  const B = y.getPosition();
@@ -5482,36 +5502,36 @@ async function vr(s, t = {}) {
5482
5502
  if (!(!U || U.historyOnly) && (B.hidden = !U.pos, U.pos)) {
5483
5503
  let I = null;
5484
5504
  if (U.orientToDirection && U.vel) {
5485
- const D = U.vel[0], J = U.vel[2];
5486
- Math.hypot(D, J) > 1e-4 && (I = [0, 0, Math.atan2(D, J)]);
5505
+ const F = U.vel[0], J = U.vel[2];
5506
+ Math.hypot(F, J) > 1e-4 && (I = [0, 0, Math.atan2(F, J)]);
5487
5507
  }
5488
5508
  y.setSimulationTransform({ position: U.pos, velocity: U.vel, rotation: I }), y.updateAppearanceUniform(), (U.justResumed || y.activeParticles === 0) && y.spawnParticles();
5489
5509
  }
5490
5510
  }
5491
5511
  for (const y of W)
5492
- y.pos ? Ci(y, pe) : y.hist.length = 0, y.pos ? (y._prevPosBuf[0] = y.pos[0], y._prevPosBuf[1] = y.pos[1], y._prevPosBuf[2] = y.pos[2], y.prevPos = y._prevPosBuf) : y.prevPos = null, y.wasActive = !!y.pos;
5512
+ y.pos ? Ai(y, he) : y.hist.length = 0, y.pos ? (y._prevPosBuf[0] = y.pos[0], y._prevPosBuf[1] = y.pos[1], y._prevPosBuf[2] = y.pos[2], y.prevPos = y._prevPosBuf) : y.prevPos = null, y.wasActive = !!y.pos;
5493
5513
  if (globalThis.__HZFX_DEBUG && (Xi++ & 63) === 0) {
5494
- const y = l.particleSystems.reduce((D, J) => D + (J.system.activeParticles | 0), 0), B = W.find((D) => D.pos), U = B ? Math.hypot(A.position[0] - B.pos[0], A.position[1] - B.pos[1], A.position[2] - B.pos[2]).toFixed(1) : "-", I = W.map((D) => `{ids:[${[...D.ids]}],pos:${D.pos ? "1" : "0"},hist:${D.hist.length}}`).join(",");
5495
- console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${Fe} camDist=${U} t=${pe.toFixed(1)}`);
5514
+ const y = l.particleSystems.reduce((F, J) => F + (J.system.activeParticles | 0), 0), B = W.find((F) => F.pos), U = B ? Math.hypot(C.position[0] - B.pos[0], C.position[1] - B.pos[1], C.position[2] - B.pos[2]).toFixed(1) : "-", I = W.map((F) => `{ids:[${[...F.ids]}],pos:${F.pos ? "1" : "0"},hist:${F.hist.length}}`).join(",");
5515
+ console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${De} camDist=${U} t=${he.toFixed(1)}`);
5496
5516
  }
5497
5517
  }
5498
- if (l.updateAllSystems(f), h ? h.loop : l.loop ?? i) {
5518
+ if (l.updateAllSystems(f), m ? m.loop : l.loop ?? i) {
5499
5519
  const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system: B }) => B.activeParticles === 0 && !B.emitting);
5500
- (h && h.justLooped || y && dt) && l.respawnAllSystems(), dt = !y;
5520
+ (m && m.justLooped || y && dt) && l.respawnAllSystems(), dt = !y;
5501
5521
  }
5502
5522
  for (const { system: y, config: B } of l.particleSystems)
5503
5523
  B.glbModelEnabled && y.glbAnimator && (y.glbAnimator.update(f), y.updateAnimatedGLBBuffer());
5504
- r.queue.writeBuffer(b, 0, A.mvp), Ee[0] = A.position[0], Ee[1] = A.position[1], Ee[2] = A.position[2], Ee[3] = a.height / Math.max(1, a.width), Ee[4] = pe, r.queue.writeBuffer(b, 64, Ee), Ui();
5524
+ r.queue.writeBuffer(b, 0, C.mvp), Ee[0] = C.position[0], Ee[1] = C.position[1], Ee[2] = C.position[2], Ee[3] = a.height / Math.max(1, a.width), Ee[4] = he, r.queue.writeBuffer(b, 64, Ee), Ui();
5505
5525
  const g = l.particleSystems.some(({ config: y }) => y.bloomEnabled), v = r.createCommandEncoder();
5506
- let H = !1;
5526
+ let q = !1;
5507
5527
  if (e)
5508
5528
  try {
5509
5529
  const y = e();
5510
5530
  if (y) {
5511
5531
  let B = null, U = null, I = !1;
5512
5532
  if (y instanceof GPUTexture ? y.width === a.width && y.height === a.height && (B = y, U = () => y.createView({ aspect: "depth-only" }), I = y.sampleCount > 1) : y.view && (B = y.view, U = () => y.view, I = !!y.multisampled), B) {
5513
- const { pipeline: D, layout: J } = m(I);
5514
- (Ce.key !== B || Ce.ms !== I) && (Ce.key = B, Ce.ms = I, Ce.bindGroup = r.createBindGroup({
5533
+ const { pipeline: F, layout: J } = p(I);
5534
+ (Ae.key !== B || Ae.ms !== I) && (Ae.key = B, Ae.ms = I, Ae.bindGroup = r.createBindGroup({
5515
5535
  layout: J,
5516
5536
  entries: [{ binding: 0, resource: U() }]
5517
5537
  }));
@@ -5519,18 +5539,18 @@ async function vr(s, t = {}) {
5519
5539
  colorAttachments: [],
5520
5540
  depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5521
5541
  });
5522
- K.setPipeline(D), K.setBindGroup(0, Ce.bindGroup), K.draw(3), K.end(), H = !0;
5542
+ K.setPipeline(F), K.setBindGroup(0, Ae.bindGroup), K.draw(3), K.end(), q = !0;
5523
5543
  }
5524
5544
  }
5525
5545
  } catch {
5526
5546
  }
5527
5547
  const j = v.beginRenderPass({
5528
5548
  colorAttachments: [{ view: Te, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5529
- depthStencilAttachment: H ? { view: Ve, depthLoadOp: "load", depthStoreOp: "store" } : { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5549
+ depthStencilAttachment: q ? { view: Ve, depthLoadOp: "load", depthStoreOp: "store" } : { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5530
5550
  });
5531
5551
  for (const { system: y, config: B } of l.particleSystems)
5532
5552
  B.bloomEnabled || B.hidden || y.activeParticles === 0 || Xt(j, y, B);
5533
- if (Fe > 0 && (j.setPipeline(Oi), j.setBindGroup(0, Li), j.setVertexBuffer(0, zt), j.draw(Fe)), j.end(), g) {
5553
+ if (De > 0 && (j.setPipeline(Oi), j.setBindGroup(0, Li), j.setVertexBuffer(0, zt), j.draw(De)), j.end(), g) {
5534
5554
  const y = {
5535
5555
  colorAttachments: [{ view: Gt, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5536
5556
  }, B = {
@@ -5538,11 +5558,11 @@ async function vr(s, t = {}) {
5538
5558
  };
5539
5559
  for (const { system: U, config: I } of l.particleSystems) {
5540
5560
  if (!I.bloomEnabled || I.hidden || U.activeParticles === 0) continue;
5541
- const D = U.config.id, J = p.getBloomSourceTexture(D, a.width, a.height), K = v.beginRenderPass({
5561
+ const F = U.config.id, J = h.getBloomSourceTexture(F, a.width, a.height), K = v.beginRenderPass({
5542
5562
  colorAttachments: [{ view: J.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5543
5563
  depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "load", depthStoreOp: "store" }
5544
5564
  });
5545
- Xt(K, U, I), K.end(), Ft[0] = I.bloomIntensity, r.queue.writeBuffer(x, 0, Ft), d.systemBloomHorizontalBindGroups[D] || (d.systemBloomHorizontalBindGroups[D] = r.createBindGroup({
5565
+ Xt(K, U, I), K.end(), Dt[0] = I.bloomIntensity, r.queue.writeBuffer(x, 0, Dt), d.systemBloomHorizontalBindGroups[F] || (d.systemBloomHorizontalBindGroups[F] = r.createBindGroup({
5546
5566
  layout: fe.bloomBindGroupLayout,
5547
5567
  entries: [
5548
5568
  { binding: 0, resource: se },
@@ -5551,18 +5571,18 @@ async function vr(s, t = {}) {
5551
5571
  ]
5552
5572
  }));
5553
5573
  let X = v.beginRenderPass(y);
5554
- X.setPipeline(We), X.setBindGroup(0, d.systemBloomHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end(), d.secondHorizontalBindGroups[D] || (d.secondHorizontalBindGroups[D] = r.createBindGroup({
5574
+ X.setPipeline(We), X.setBindGroup(0, d.systemBloomHorizontalBindGroups[F]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end(), d.secondHorizontalBindGroups[F] || (d.secondHorizontalBindGroups[F] = r.createBindGroup({
5555
5575
  layout: fe.bloomBindGroupLayout,
5556
5576
  entries: [
5557
5577
  { binding: 0, resource: se },
5558
5578
  { binding: 1, resource: Qe },
5559
5579
  { binding: 2, resource: { buffer: M } }
5560
5580
  ]
5561
- })), X = v.beginRenderPass(y), X.setPipeline(We), X.setBindGroup(0, d.secondHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end();
5562
- const it = p.getBloomCompositeTexture(D, a.width, a.height);
5581
+ })), X = v.beginRenderPass(y), X.setPipeline(We), X.setBindGroup(0, d.secondHorizontalBindGroups[F]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end();
5582
+ const it = h.getBloomCompositeTexture(F, a.width, a.height);
5563
5583
  X = v.beginRenderPass({
5564
5584
  colorAttachments: [{ view: it.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5565
- }), X.setPipeline(Di), d.systemBloomCompositeBindGroups[D] || (d.systemBloomCompositeBindGroups[D] = r.createBindGroup({
5585
+ }), X.setPipeline(Fi), d.systemBloomCompositeBindGroups[F] || (d.systemBloomCompositeBindGroups[F] = r.createBindGroup({
5566
5586
  layout: fe.compositeBindGroupLayout,
5567
5587
  entries: [
5568
5588
  { binding: 0, resource: se },
@@ -5570,13 +5590,13 @@ async function vr(s, t = {}) {
5570
5590
  { binding: 2, resource: Qe },
5571
5591
  { binding: 3, resource: { buffer: U.bloomIntensityBuffer } }
5572
5592
  ]
5573
- })), X.setBindGroup(0, d.systemBloomCompositeBindGroups[D]), X.draw(3), X.end();
5593
+ })), X.setBindGroup(0, d.systemBloomCompositeBindGroups[F]), X.draw(3), X.end();
5574
5594
  }
5575
5595
  }
5576
- const Q = p.getCombinedTexture(a.width, a.height), Z = v.beginRenderPass({
5596
+ const Q = h.getCombinedTexture(a.width, a.height), Z = v.beginRenderPass({
5577
5597
  colorAttachments: [{ view: Q.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5578
5598
  });
5579
- Z.setPipeline(Ct), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
5599
+ Z.setPipeline(At), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
5580
5600
  layout: fe.compositeBindGroupLayout,
5581
5601
  entries: [
5582
5602
  { binding: 0, resource: se },
@@ -5588,18 +5608,18 @@ async function vr(s, t = {}) {
5588
5608
  for (const { config: y, system: B } of l.particleSystems) {
5589
5609
  if (!y.bloomEnabled || y.hidden || B.activeParticles === 0) continue;
5590
5610
  const U = B.config.id;
5591
- Z.setPipeline(Ct), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
5611
+ Z.setPipeline(At), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
5592
5612
  layout: fe.compositeBindGroupLayout,
5593
5613
  entries: [
5594
5614
  { binding: 0, resource: se },
5595
- { binding: 1, resource: p.getBloomCompositeTexture(U, a.width, a.height).createView() },
5615
+ { binding: 1, resource: h.getBloomCompositeTexture(U, a.width, a.height).createView() },
5596
5616
  { binding: 2, resource: Te },
5597
5617
  { binding: 3, resource: { buffer: x } }
5598
5618
  ]
5599
5619
  })), Z.setBindGroup(0, d.combinedBloomCompositeBindGroups[U]), Z.draw(3);
5600
5620
  }
5601
5621
  Z.end();
5602
- const Ae = v.beginRenderPass({
5622
+ const Ce = v.beginRenderPass({
5603
5623
  colorAttachments: [{
5604
5624
  view: n.getCurrentTexture().createView(),
5605
5625
  loadOp: o ? "load" : "clear",
@@ -5607,7 +5627,7 @@ async function vr(s, t = {}) {
5607
5627
  clearValue: { r: 0, g: 0, b: 0, a: 0 }
5608
5628
  }]
5609
5629
  });
5610
- Ae.setPipeline(Fi), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
5630
+ Ce.setPipeline(Di), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
5611
5631
  layout: fe.compositeBindGroupLayout,
5612
5632
  entries: [
5613
5633
  { binding: 0, resource: se },
@@ -5615,69 +5635,69 @@ async function vr(s, t = {}) {
5615
5635
  { binding: 2, resource: Te },
5616
5636
  { binding: 3, resource: { buffer: x } }
5617
5637
  ]
5618
- })), Ae.setBindGroup(0, d.finalBindGroup), Ae.draw(3), Ae.end(), r.queue.submit([v.finish()]);
5638
+ })), Ce.setBindGroup(0, d.finalBindGroup), Ce.draw(3), Ce.end(), r.queue.submit([v.finish()]);
5619
5639
  }
5620
- function Xt(f, h, S) {
5621
- const g = h.config.id, v = S.glbModelEnabled && h.glbMeshData, H = !d.systemBindGroups[g] || d.textureStates[g] !== S.textureEnabled || d.textureRefs[g] !== h.particleTexture;
5622
- d.textureStates[g] = S.textureEnabled, d.textureRefs[g] = h.particleTexture, H && (d.systemBindGroups[g] = r.createBindGroup({
5640
+ function Xt(f, m, S) {
5641
+ const g = m.config.id, v = S.glbModelEnabled && m.glbMeshData, q = !d.systemBindGroups[g] || d.textureStates[g] !== S.textureEnabled || d.textureRefs[g] !== m.particleTexture;
5642
+ d.textureStates[g] = S.textureEnabled, d.textureRefs[g] = m.particleTexture, q && (d.systemBindGroups[g] = r.createBindGroup({
5623
5643
  layout: fe.particleBindGroupLayout,
5624
5644
  entries: [
5625
5645
  { binding: 0, resource: { buffer: b } },
5626
- { binding: 1, resource: { buffer: h.appearanceUniformBuffer } },
5627
- { binding: 2, resource: h.particleTexture.createView() },
5646
+ { binding: 1, resource: { buffer: m.appearanceUniformBuffer } },
5647
+ { binding: 2, resource: m.particleTexture.createView() },
5628
5648
  { binding: 3, resource: se }
5629
5649
  ]
5630
5650
  }));
5631
5651
  const j = d.systemBindGroups[g], Q = S.shapeDisplay !== !1;
5632
5652
  if (v)
5633
- Q && (f.setPipeline(Vi), f.setBindGroup(0, j), f.setVertexBuffer(0, h.glbVertexBuffer), f.setVertexBuffer(1, h.instanceBuffer), f.setVertexBuffer(2, h.velocityBuffer), f.setIndexBuffer(h.glbIndexBuffer, h.glbIndexFormat), f.drawIndexed(h.glbIndexCount, h.activeParticles));
5653
+ Q && (f.setPipeline(Vi), f.setBindGroup(0, j), f.setVertexBuffer(0, m.glbVertexBuffer), f.setVertexBuffer(1, m.instanceBuffer), f.setVertexBuffer(2, m.velocityBuffer), f.setIndexBuffer(m.glbIndexBuffer, m.glbIndexFormat), f.drawIndexed(m.glbIndexCount, m.activeParticles));
5634
5654
  else {
5635
- f.setPipeline(S.blendMode === "additive" ? zi : Ii), f.setIndexBuffer(L, "uint16"), P[g] || (P[g] = T()), f.setVertexBuffer(0, P[g]), f.setBindGroup(0, j), Q && (f.setVertexBuffer(1, h.instanceBuffer), f.setVertexBuffer(2, h.velocityBuffer), f.setVertexBuffer(3, h.trailBuffer), f.drawIndexed(6, h.activeParticles));
5636
- const Z = De.get(g);
5637
- Z && (f.setVertexBuffer(1, N), f.setVertexBuffer(2, G), f.setVertexBuffer(3, de), f.drawIndexed(6, Z.count, 0, 0, Z.first)), Q && S.depthWriteEnabled && (f.setPipeline(Gi), f.drawIndexed(6, h.activeParticles));
5655
+ f.setPipeline(S.blendMode === "additive" ? zi : Ii), f.setIndexBuffer(L, "uint16"), P[g] || (P[g] = T()), f.setVertexBuffer(0, P[g]), f.setBindGroup(0, j), Q && (f.setVertexBuffer(1, m.instanceBuffer), f.setVertexBuffer(2, m.velocityBuffer), f.setVertexBuffer(3, m.trailBuffer), f.drawIndexed(6, m.activeParticles));
5656
+ const Z = Fe.get(g);
5657
+ Z && (f.setVertexBuffer(1, k), f.setVertexBuffer(2, G), f.setVertexBuffer(3, de), f.drawIndexed(6, Z.count, 0, 0, Z.first)), Q && S.depthWriteEnabled && (f.setPipeline(Gi), f.drawIndexed(6, m.activeParticles));
5638
5658
  }
5639
5659
  }
5640
5660
  function Qi() {
5641
- ft = a.width, pt = a.height, Lt();
5661
+ ft = a.width, ht = a.height, Lt();
5642
5662
  }
5643
5663
  function Ki() {
5644
5664
  d.clear();
5645
5665
  }
5646
5666
  function es() {
5647
- Ot = !0, l.destroy(), [be, Se, xe, Je].forEach((f) => f == null ? void 0 : f.destroy()), p.resizeTextures(), [
5667
+ Ot = !0, l.destroy(), [be, Se, xe, Je].forEach((f) => f == null ? void 0 : f.destroy()), h.resizeTextures(), [
5648
5668
  b,
5649
- w,
5669
+ _,
5650
5670
  M,
5651
5671
  R,
5652
5672
  x,
5653
5673
  L,
5654
- N,
5674
+ k,
5655
5675
  G,
5656
5676
  de
5657
5677
  ].forEach((f) => f == null ? void 0 : f.destroy()), Object.values(P).forEach((f) => f == null ? void 0 : f.destroy());
5658
5678
  }
5659
- async function kt(f, h) {
5660
- const S = await l.addSystems(f, h);
5679
+ async function Nt(f, m) {
5680
+ const S = await l.addSystems(f, m);
5661
5681
  for (const { config: g } of l.particleSystems)
5662
5682
  P[g.id] || (P[g.id] = T());
5663
5683
  return l.respawnAllSystems(), new Set(Array.isArray(S) ? S : []);
5664
5684
  }
5665
- function Nt(f) {
5666
- for (const h of f) {
5667
- const S = l.particleSystems.findIndex((g) => g.config.id === h);
5685
+ function kt(f) {
5686
+ for (const m of f) {
5687
+ const S = l.particleSystems.findIndex((g) => g.config.id === m);
5668
5688
  S >= 0 && l.removeSystem(S);
5669
5689
  }
5670
5690
  }
5671
- async function ts(f, h = [0, 0, 0]) {
5672
- const S = await kt(f, h);
5691
+ async function ts(f, m = [0, 0, 0]) {
5692
+ const S = await Nt(f, m);
5673
5693
  return { remove() {
5674
- Nt(S);
5694
+ kt(S);
5675
5695
  } };
5676
5696
  }
5677
- async function is(f, h = {}) {
5678
- const S = await kt(f, [0, 0, 0]);
5697
+ async function is(f, m = {}) {
5698
+ const S = await Nt(f, [0, 0, 0]);
5679
5699
  globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...S]}]`);
5680
- const g = { ids: S, pos: null, hist: [], getPosition: h.getPosition || null, orientToDirection: !!h.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5700
+ const g = { ids: S, pos: null, hist: [], getPosition: m.getPosition || null, orientToDirection: !!m.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5681
5701
  return W.push(g), {
5682
5702
  setPosition(v) {
5683
5703
  v && (g.pos = Array.isArray(v) ? [v[0], v[1], v[2]] : [v.x, v.y, v.z]);
@@ -5686,14 +5706,14 @@ async function vr(s, t = {}) {
5686
5706
  g.orientToDirection = !!v;
5687
5707
  },
5688
5708
  remove() {
5689
- Nt(S);
5709
+ kt(S);
5690
5710
  const v = W.indexOf(g);
5691
5711
  v >= 0 && W.splice(v, 1);
5692
5712
  }
5693
5713
  };
5694
5714
  }
5695
- function ss(f, h) {
5696
- const g = { ids: f instanceof Set ? f : new Set(f), pos: null, hist: [], getPosition: h, historyOnly: !0, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5715
+ function ss(f, m) {
5716
+ const g = { ids: f instanceof Set ? f : new Set(f), pos: null, hist: [], getPosition: m, historyOnly: !0, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5697
5717
  return W.push(g), {
5698
5718
  remove() {
5699
5719
  const v = W.indexOf(g);
@@ -5714,7 +5734,7 @@ async function vr(s, t = {}) {
5714
5734
  context: n,
5715
5735
  setCamera: Zi,
5716
5736
  setCameraMVP: $i,
5717
- setEmitters: ht,
5737
+ setEmitters: pt,
5718
5738
  loadPreset: Wi,
5719
5739
  addEmitter: ts,
5720
5740
  addMovingEmitter: is,
@@ -5731,16 +5751,16 @@ function Pr(s) {
5731
5751
  try {
5732
5752
  const l = s.backend;
5733
5753
  if (!l) return null;
5734
- const u = s.domElement.width, m = s.domElement.height, p = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
5735
- if (s.needsFrameBufferTarget && p) {
5736
- const w = l.get(p), M = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, p)) == null ? void 0 : i.depthTexture) || p.depthTexture, R = [
5737
- (r = w == null ? void 0 : w.depthTexture) == null ? void 0 : r.texture,
5738
- w == null ? void 0 : w.depthTexture,
5739
- (n = w == null ? void 0 : w.depthBuffer) == null ? void 0 : n.texture,
5754
+ const u = s.domElement.width, p = s.domElement.height, h = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
5755
+ if (s.needsFrameBufferTarget && h) {
5756
+ const _ = l.get(h), M = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, h)) == null ? void 0 : i.depthTexture) || h.depthTexture, R = [
5757
+ (r = _ == null ? void 0 : _.depthTexture) == null ? void 0 : r.texture,
5758
+ _ == null ? void 0 : _.depthTexture,
5759
+ (n = _ == null ? void 0 : _.depthBuffer) == null ? void 0 : n.texture,
5740
5760
  M ? (a = l.get(M)) == null ? void 0 : a.texture : null
5741
5761
  ];
5742
5762
  for (const x of R)
5743
- if (x && typeof x.createView == "function" && x.width === u && x.height === m) return x;
5763
+ if (x && typeof x.createView == "function" && x.width === u && x.height === p) return x;
5744
5764
  return null;
5745
5765
  }
5746
5766
  const d = s.getCanvasTarget ? l.get(s.getCanvasTarget()) : null, b = ((c = (o = d == null ? void 0 : d.descriptor) == null ? void 0 : o.depthStencilAttachment) == null ? void 0 : c.view) ?? null;
@@ -5751,9 +5771,9 @@ function Pr(s) {
5751
5771
  };
5752
5772
  }
5753
5773
  export {
5754
- Ns as GLBAnimator,
5774
+ ks as GLBAnimator,
5755
5775
  js as HZClock,
5756
- pr as Objects3DManager,
5776
+ hr as Objects3DManager,
5757
5777
  ms as ParticleEmitter,
5758
5778
  _s as ParticlePhysics,
5759
5779
  ui as ParticleScript,
@@ -5777,7 +5797,7 @@ export {
5777
5797
  fi as extractGLBTexture,
5778
5798
  xr as fetchPreset,
5779
5799
  Ks as glbMeshParticleShader,
5780
- hr as hexToRgb,
5800
+ pr as hexToRgb,
5781
5801
  vr as initHzFxOverlay,
5782
5802
  Js as initWebGPU,
5783
5803
  Ti as isHZFX,
@@ -5786,7 +5806,7 @@ export {
5786
5806
  ar as multiplyMatrices,
5787
5807
  Qs as object3dShader,
5788
5808
  lr as packHZFX,
5789
- Cs as parseGLB,
5809
+ As as parseGLB,
5790
5810
  vs as particlePhysicsShader,
5791
5811
  ys as particleShader,
5792
5812
  mr as rgbToHex,