hz-particles 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- class ds {
1
+ class fs {
2
2
  constructor(t = {}) {
3
3
  this.config = t, this._posOut = [0, 0, 0], this._rotMatrix = null, this._invRotMatrix = null, this._cachedRotX = void 0, this._cachedRotY = void 0, this._cachedRotZ = void 0;
4
4
  }
@@ -10,14 +10,14 @@ class ds {
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), h = Math.cos(a), p = Math.sin(a);
14
14
  this._rotMatrix = [
15
- l * m,
16
- c * u * m - o * p,
17
- o * u * m + c * p,
15
+ l * h,
16
+ c * u * h - o * p,
17
+ o * u * h + c * p,
18
18
  l * p,
19
- c * u * p + o * m,
20
- o * u * p - c * m,
19
+ c * u * p + o * h,
20
+ o * u * p - c * h,
21
21
  -u,
22
22
  c * l,
23
23
  o * l
@@ -91,8 +91,8 @@ class ds {
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(), h = e + u * (i - e);
95
+ t[0] = o * h, t[1] = c * h, t[2] = l * h;
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
  }
@@ -244,33 +244,33 @@ class ds {
244
244
  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
245
  }
246
246
  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, M;
247
+ const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o, h = i - c, p = Math.sqrt(l * l + u * u + h * h);
248
+ let d, S, R;
249
249
  if (p > 1e-4) {
250
- let C = !1;
250
+ let T = !1;
251
251
  if (this.config.emissionShape === "circle" && this.config.circleVelocityDirection === "tangential") {
252
- const _ = this.inverseRotation(l, u, m), L = Math.sqrt(_[0] * _[0] + _[1] * _[1]);
252
+ const x = this.inverseRotation(l, u, h), L = Math.sqrt(x[0] * x[0] + x[1] * x[1]);
253
253
  if (L > 1e-4) {
254
- const v = -_[1] / L, w = _[0] / L, R = this.applyRotation(v, w, 0);
255
- d = R[0], b = R[1], M = R[2], C = !0;
254
+ const P = -x[1] / L, B = x[0] / L, M = this.applyRotation(P, B, 0);
255
+ d = M[0], S = M[1], R = M[2], T = !0;
256
256
  }
257
257
  } else if (this.config.emissionShape === "cylinder" && this.config.cylinderVelocityDirection === "tangential") {
258
- const _ = this.inverseRotation(l, u, m), L = Math.sqrt(_[0] * _[0] + _[2] * _[2]);
258
+ const x = this.inverseRotation(l, u, h), L = Math.sqrt(x[0] * x[0] + x[2] * x[2]);
259
259
  if (L > 1e-4) {
260
- const v = -_[2] / L, w = _[0] / L, R = this.applyRotation(v, 0, w);
261
- d = R[0], b = R[1], M = R[2], C = !0;
260
+ const P = -x[2] / L, B = x[0] / L, M = this.applyRotation(P, 0, B);
261
+ d = M[0], S = M[1], R = M[2], T = !0;
262
262
  } else {
263
- const v = Math.random() * Math.PI * 2, w = this.applyRotation(Math.cos(v), 0, Math.sin(v));
264
- d = w[0], b = w[1], M = w[2], C = !0;
263
+ const P = Math.random() * Math.PI * 2, B = this.applyRotation(Math.cos(P), 0, Math.sin(P));
264
+ d = B[0], S = B[1], R = B[2], T = !0;
265
265
  }
266
266
  }
267
- C || (d = l / p, b = u / p, M = m / p);
267
+ T || (d = l / p, S = u / p, R = h / p);
268
268
  } else {
269
- const C = Math.random() * Math.PI * 2, _ = Math.acos(2 * Math.random() - 1);
270
- d = Math.sin(_) * Math.cos(C), b = Math.sin(_) * Math.sin(C), M = Math.cos(_);
269
+ const T = Math.random() * Math.PI * 2, x = Math.acos(2 * Math.random() - 1);
270
+ d = Math.sin(x) * Math.cos(T), S = Math.sin(x) * Math.sin(T), R = Math.cos(x);
271
271
  }
272
- let T;
273
- this.config.randomSpeed ? T = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : T = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * T, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : b * T, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : M * T, r[n + 3] = 0;
272
+ let E;
273
+ this.config.randomSpeed ? E = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : E = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * E, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : S * E, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : R * E, r[n + 3] = 0;
274
274
  }
275
275
  setParticleColor(t, e) {
276
276
  if (this.config.randomColorEnabled && this.config.randomColors.length > 0) {
@@ -283,7 +283,7 @@ class ds {
283
283
  t[e + 6] = 0, t[e + 7] = i + (Math.random() * 0.4 - 0.2) * i;
284
284
  }
285
285
  }
286
- const fs = `
286
+ const ps = `
287
287
  struct Uniforms {
288
288
  transform: mat4x4<f32>,
289
289
  cameraPosition: vec3<f32>,
@@ -299,7 +299,7 @@ const fs = `
299
299
  singleColor: vec3<f32>,
300
300
  rotation: f32,
301
301
  startColor: vec3<f32>,
302
- rotationMode: f32, // 0=fixed, 1=random, 2=towards velocity
302
+ rotationMode: f32, // 0=fixed, 1=random, 2=towards velocity, 3=oriented (world 3D plane), 4=cylindrical billboard
303
303
  endColor: vec3<f32>,
304
304
  minRotation: f32,
305
305
  maxRotation: f32,
@@ -336,6 +336,10 @@ const fs = `
336
336
  systemVelX: f32, // emitter/system world velocity (for velocity-aligned rotation
337
337
  systemVelY: f32, // of trail particles that move WITH the emitter, e.g. a ball —
338
338
  systemVelZ: f32, // their local velocity is ~0 so they need the system velocity)
339
+ orientX: f32, // rotationMode==3 (oriented): world-plane Euler angles (degrees)
340
+ orientY: f32,
341
+ orientZ: f32,
342
+ _pad2: f32, // keep struct size a multiple of 16 bytes (56 floats = 224 B)
339
343
  }
340
344
 
341
345
  @binding(0) @group(0) var<uniform> uniforms : Uniforms;
@@ -505,13 +509,51 @@ const fs = `
505
509
  let rotatedX = scaledX * cosTheta - scaledY * sinTheta;
506
510
  let rotatedY = scaledX * sinTheta + scaledY * cosTheta;
507
511
 
508
- let finalPosition = vec4<f32>(
509
- viewCenter.x + rotatedX * distanceScaleFactor * uniforms.aspectRatio * viewCenter.w,
510
- viewCenter.y + rotatedY * distanceScaleFactor * viewCenter.w,
511
- viewCenter.z,
512
- viewCenter.w
513
- );
514
-
512
+ var finalPosition: vec4<f32>;
513
+ if (appearance.rotationMode == 3.0) {
514
+ // Oriented 3D mode: the sprite lies in a WORLD-space plane defined by Euler angles (degrees),
515
+ // no longer camera-facing. rotatedX/rotatedY already carry aspect + the per-particle in-plane
516
+ // rotation (which acts as roll within the tilted plane). Build the plane's right/up basis by
517
+ // rotating the world axes by Rx, then Ry, then Rz, place the quad corner in world space, and
518
+ // project. worldHalf matches the billboard's apparent size when the plane faces the camera.
519
+ let ox = appearance.orientX * 0.01745329252;
520
+ let oy = appearance.orientY * 0.01745329252;
521
+ let oz = appearance.orientZ * 0.01745329252;
522
+ let cx = cos(ox); let sx = sin(ox);
523
+ let cy = cos(oy); let sy = sin(oy);
524
+ let cz = cos(oz); let sz = sin(oz);
525
+ var rgt = vec3<f32>(1.0, 0.0, 0.0);
526
+ var upv = vec3<f32>(0.0, 1.0, 0.0);
527
+ rgt = vec3<f32>(rgt.x, rgt.y * cx - rgt.z * sx, rgt.y * sx + rgt.z * cx);
528
+ upv = vec3<f32>(upv.x, upv.y * cx - upv.z * sx, upv.y * sx + upv.z * cx);
529
+ rgt = vec3<f32>(rgt.x * cy + rgt.z * sy, rgt.y, -rgt.x * sy + rgt.z * cy);
530
+ upv = vec3<f32>(upv.x * cy + upv.z * sy, upv.y, -upv.x * sy + upv.z * cy);
531
+ rgt = vec3<f32>(rgt.x * cz - rgt.y * sz, rgt.x * sz + rgt.y * cz, rgt.z);
532
+ upv = vec3<f32>(upv.x * cz - upv.y * sz, upv.x * sz + upv.y * cz, upv.z);
533
+ let worldHalf = baseScaleFactor * 10.0;
534
+ let worldCorner = center + (rgt * rotatedX + upv * rotatedY) * worldHalf;
535
+ finalPosition = uniforms.transform * vec4<f32>(worldCorner, 1.0);
536
+ } else if (appearance.rotationMode == 4.0) {
537
+ // Cylindrical (upright) billboard: faces the camera around the world Y axis ONLY and stays
538
+ // vertical. From the side it looks like a normal billboard; from straight above/below you see
539
+ // it edge-on (like a tree/grass sprite). right = horizontal axis ⟂ to the view; up = world up.
540
+ let worldUp = vec3<f32>(0.0, 1.0, 0.0);
541
+ let toCam = uniforms.cameraPosition - center;
542
+ var rgt = cross(worldUp, toCam);
543
+ let rl = length(rgt);
544
+ rgt = select(vec3<f32>(1.0, 0.0, 0.0), rgt / rl, rl > 0.0001);
545
+ let worldHalf = baseScaleFactor * 10.0;
546
+ let worldCorner = center + (rgt * rotatedX + worldUp * rotatedY) * worldHalf;
547
+ finalPosition = uniforms.transform * vec4<f32>(worldCorner, 1.0);
548
+ } else {
549
+ finalPosition = vec4<f32>(
550
+ viewCenter.x + rotatedX * distanceScaleFactor * uniforms.aspectRatio * viewCenter.w,
551
+ viewCenter.y + rotatedY * distanceScaleFactor * viewCenter.w,
552
+ viewCenter.z,
553
+ viewCenter.w
554
+ );
555
+ }
556
+
515
557
  output.position = finalPosition;
516
558
  output.color = finalColor;
517
559
  output.alpha = alpha;
@@ -663,7 +705,7 @@ const fs = `
663
705
  return vec4<f32>(input.color, alpha);
664
706
  }
665
707
  }
666
- `, ps = `
708
+ `, hs = `
667
709
  struct BloomUniforms {
668
710
  direction: vec2<f32>,
669
711
  resolution: vec2<f32>,
@@ -723,7 +765,7 @@ const fs = `
723
765
 
724
766
  return result / totalWeight * 1.1;
725
767
  }
726
- `, hs = `
768
+ `, ms = `
727
769
  struct BloomIntensityUniforms {
728
770
  intensity: f32,
729
771
  color: vec3<f32>,
@@ -769,7 +811,7 @@ const fs = `
769
811
 
770
812
  return vec4<f32>(originalColor.rgb + (mappedBloom * bloomUniforms.intensity), originalColor.a);
771
813
  }
772
- `, ms = `
814
+ `, ys = `
773
815
  struct BloomIntensityUniforms {
774
816
  intensity: f32,
775
817
  color: vec3<f32>,
@@ -810,7 +852,7 @@ const fs = `
810
852
  fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
811
853
  return textureSample(originalTexture, texSampler, input.texCoord);
812
854
  }
813
- `, ys = `
855
+ `, gs = `
814
856
  @binding(0) @group(0) var texSampler: sampler;
815
857
  @binding(1) @group(0) var originalTexture: texture_2d<f32>;
816
858
  @binding(2) @group(0) var blurredTexture: texture_2d<f32>;
@@ -842,7 +884,7 @@ const fs = `
842
884
  let c = textureSample(originalTexture, texSampler, input.texCoord);
843
885
  return vec4<f32>(aces(c.rgb), c.a);
844
886
  }
845
- `, gs = `
887
+ `, bs = `
846
888
  struct PhysicsUniforms {
847
889
  deltaTime: f32,
848
890
  particleSpeed: f32,
@@ -1052,7 +1094,7 @@ const fs = `
1052
1094
  particleBuffer[baseIndex + 1u] = newPos.y;
1053
1095
  particleBuffer[baseIndex + 2u] = newPos.z;
1054
1096
  }
1055
- `, bs = `
1097
+ `, Ss = `
1056
1098
  @group(0) @binding(0) var<storage, read> restData: array<f32>;
1057
1099
  @group(0) @binding(1) var<storage, read> jointWeightsData: array<f32>;
1058
1100
  @group(0) @binding(2) var<storage, read> jointIndicesData: array<u32>;
@@ -1109,7 +1151,7 @@ const fs = `
1109
1151
  outputData[outBase + 7u] = uv_v;
1110
1152
  }
1111
1153
  `;
1112
- class Ss {
1154
+ class xs {
1113
1155
  constructor(t, e = 1e4) {
1114
1156
  this.device = t, this.physicsSettings = {
1115
1157
  deltaTime: 0.016,
@@ -1198,7 +1240,7 @@ class Ss {
1198
1240
  }),
1199
1241
  compute: {
1200
1242
  module: this.device.createShaderModule({
1201
- code: gs
1243
+ code: bs
1202
1244
  }),
1203
1245
  entryPoint: "main"
1204
1246
  }
@@ -1231,8 +1273,8 @@ class Ss {
1231
1273
  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);
1232
1274
  const l = a || this.device.createCommandEncoder({ label: "ParticlePhysicsEncoder" }), u = l.beginComputePass({ label: "ParticlePhysicsPass" });
1233
1275
  u.setPipeline(this.computePipeline), u.setBindGroup(0, this.computeBindGroup);
1234
- const m = Math.max(1, Math.ceil(e / 64));
1235
- u.dispatchWorkgroups(m, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1276
+ const h = Math.max(1, Math.ceil(e / 64));
1277
+ u.dispatchWorkgroups(h, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1236
1278
  }
1237
1279
  async readbackAndProcessParticles(t, e, i, r, n) {
1238
1280
  if (t <= 0)
@@ -1404,7 +1446,7 @@ class Ss {
1404
1446
  t.enabled !== void 0 && (e.softBoundaryEnabled = t.enabled), t.strength !== void 0 && (e.softBoundaryStrength = t.strength), t.falloff !== void 0 && (e.softBoundaryFalloff = t.falloff);
1405
1447
  }
1406
1448
  }
1407
- class xs {
1449
+ class vs {
1408
1450
  constructor(t) {
1409
1451
  this.device = t, this.defaultTexture = null, this.createDefaultTexture();
1410
1452
  }
@@ -1443,7 +1485,7 @@ class xs {
1443
1485
  t && t.label !== "defaultParticleTexture" && t.destroy();
1444
1486
  }
1445
1487
  }
1446
- const bi = Object.freeze({
1488
+ const Si = Object.freeze({
1447
1489
  sin: Math.sin,
1448
1490
  cos: Math.cos,
1449
1491
  abs: Math.abs,
@@ -1464,7 +1506,7 @@ const bi = Object.freeze({
1464
1506
  return s + (t - s) * e;
1465
1507
  },
1466
1508
  smoothstep(s, t, e) {
1467
- const i = bi.clamp((e - s) / (t - s), 0, 1);
1509
+ const i = Si.clamp((e - s) / (t - s), 0, 1);
1468
1510
  return i * i * (3 - 2 * i);
1469
1511
  }
1470
1512
  }), Ze = /* @__PURE__ */ new Set([
@@ -1483,7 +1525,7 @@ const bi = Object.freeze({
1483
1525
  "pulseFrequency",
1484
1526
  "bloomIntensity"
1485
1527
  ]);
1486
- class vs {
1528
+ class Ps {
1487
1529
  constructor(t) {
1488
1530
  this._collection = t, this._pd = null, this._vd = null, this._pi = 0, this._vi = 0;
1489
1531
  }
@@ -1561,9 +1603,9 @@ class vs {
1561
1603
  this._vd[this._vi + 2] = t, this._collection._dirty = !0;
1562
1604
  }
1563
1605
  }
1564
- class Ps {
1606
+ class _s {
1565
1607
  constructor() {
1566
- this._proxy = new vs(this), this._pd = null, this._vd = null, this.count = 0, this._dirty = !1;
1608
+ this._proxy = new Ps(this), this._pd = null, this._vd = null, this.count = 0, this._dirty = !1;
1567
1609
  }
1568
1610
  _bind(t, e, i) {
1569
1611
  this._pd = t, this._vd = e, this.count = i, this._dirty = !1;
@@ -1572,14 +1614,14 @@ class Ps {
1572
1614
  return t < 0 || t >= this.count ? null : this._proxy._bind(this._pd, this._vd, t);
1573
1615
  }
1574
1616
  }
1575
- const _s = 1e6;
1617
+ const ws = 1e6;
1576
1618
  function Bs(s) {
1577
1619
  let t = 0;
1578
1620
  return s.replace(
1579
1621
  /\b(for|while)\s*\([^)]*\)\s*\{/g,
1580
1622
  (e) => {
1581
1623
  const i = `__lc${t++}`;
1582
- return `${e} if(++${i}>${_s})throw new Error("Loop limit exceeded");`;
1624
+ return `${e} if(++${i}>${ws})throw new Error("Loop limit exceeded");`;
1583
1625
  }
1584
1626
  ).replace(
1585
1627
  /\b(for|while)\s*\([^)]*\)\s*\{/g,
@@ -1599,7 +1641,7 @@ function Bs(s) {
1599
1641
  const vt = /* @__PURE__ */ new Map();
1600
1642
  for (const s of Ze)
1601
1643
  vt.set(s.toLowerCase(), s);
1602
- function ws(s) {
1644
+ function Ms(s) {
1603
1645
  const t = { value: !1 }, e = /* @__PURE__ */ new Set();
1604
1646
  return new Proxy(s, {
1605
1647
  get(r, n) {
@@ -1627,14 +1669,14 @@ function ws(s) {
1627
1669
  }
1628
1670
  });
1629
1671
  }
1630
- class ri {
1672
+ class ni {
1631
1673
  /**
1632
1674
  * @param {string} source - User script source code
1633
1675
  * @param {object} config - ParticleSystem config (will be proxied)
1634
1676
  * @param {number} maxParticles - Max particle count for pre-allocation
1635
1677
  */
1636
1678
  constructor(t, e, i) {
1637
- this._particles = new Ps(), this._configProxy = ws(e), this._configSnapshot = null, this._fn = null, this._error = !1, this.compile(t);
1679
+ this._particles = new _s(), this._configProxy = Ms(e), this._configSnapshot = null, this._fn = null, this._error = !1, this.compile(t);
1638
1680
  }
1639
1681
  /**
1640
1682
  * Compile script source into a sandboxed function.
@@ -1672,7 +1714,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1672
1714
  if (!this._fn || this._error) return { configDirty: !1, particlesDirty: !1 };
1673
1715
  this._particles._bind(n, a, o), this._configProxy.__resetDirty();
1674
1716
  try {
1675
- this._fn(t, e, i, r, this._particles, this._configProxy, bi);
1717
+ this._fn(t, e, i, r, this._particles, this._configProxy, Si);
1676
1718
  } catch (c) {
1677
1719
  console.warn("[ParticleScript] Runtime error:", c.message);
1678
1720
  }
@@ -1721,12 +1763,12 @@ async function Rs(s) {
1721
1763
  const r = t.getUint32(8, !0);
1722
1764
  let n = 12, a = null, o = null;
1723
1765
  for (; n < r; ) {
1724
- const v = t.getUint32(n, !0), w = t.getUint32(n + 4, !0), R = s.slice(n + 8, n + 8 + v);
1725
- if (w === 1313821514) {
1726
- const X = new TextDecoder("utf-8").decode(R);
1727
- a = JSON.parse(X);
1728
- } else w === 5130562 && (o = R);
1729
- n += 8 + v;
1766
+ const P = t.getUint32(n, !0), B = t.getUint32(n + 4, !0), M = s.slice(n + 8, n + 8 + P);
1767
+ if (B === 1313821514) {
1768
+ const N = new TextDecoder("utf-8").decode(M);
1769
+ a = JSON.parse(N);
1770
+ } else B === 5130562 && (o = M);
1771
+ n += 8 + P;
1730
1772
  }
1731
1773
  if (!a)
1732
1774
  throw new Error("GLB file missing JSON chunk");
@@ -1738,44 +1780,44 @@ async function Rs(s) {
1738
1780
  const u = l.attributes.POSITION;
1739
1781
  if (u === void 0)
1740
1782
  throw new Error("Mesh primitive missing POSITION attribute");
1741
- const m = gt(a, o, u, 3, 5126);
1783
+ const h = gt(a, o, u, 3, 5126);
1742
1784
  let p;
1743
1785
  if (l.attributes.NORMAL !== void 0)
1744
1786
  p = gt(a, o, l.attributes.NORMAL, 3, 5126);
1745
1787
  else {
1746
- const v = l.indices;
1747
- if (v === void 0)
1788
+ const P = l.indices;
1789
+ if (P === void 0)
1748
1790
  throw new Error("Cannot generate normals without indices");
1749
- const w = ni(a, o, v);
1750
- p = Ms(m, w);
1791
+ const B = ai(a, o, P);
1792
+ p = Ts(h, B);
1751
1793
  }
1752
1794
  const d = l.indices;
1753
1795
  if (d === void 0)
1754
1796
  throw new Error("Mesh primitive missing indices");
1755
- const b = ni(a, o, d), M = m.length / 3, T = b.length;
1756
- let C = null;
1757
- l.attributes.TEXCOORD_0 !== void 0 && (C = gt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
1758
- let _ = !1;
1797
+ const S = ai(a, o, d), R = h.length / 3, E = S.length;
1798
+ let T = null;
1799
+ l.attributes.TEXCOORD_0 !== void 0 && (T = gt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
1800
+ let x = !1;
1759
1801
  if (a.materials && a.materials.length > 0) {
1760
- const v = a.materials[0];
1761
- v.pbrMetallicRoughness && v.pbrMetallicRoughness.baseColorTexture !== void 0 && (_ = !0);
1802
+ const P = a.materials[0];
1803
+ P.pbrMetallicRoughness && P.pbrMetallicRoughness.baseColorTexture !== void 0 && (x = !0);
1762
1804
  }
1763
1805
  let L = null;
1764
1806
  if (a.skins && a.skins.length > 0)
1765
1807
  try {
1766
- L = Is(a, o, l), console.log("Animation data extracted:", L);
1767
- } catch (v) {
1768
- console.warn("Failed to extract animation data:", v);
1808
+ L = zs(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", L);
1809
+ } catch (P) {
1810
+ console.warn("Failed to extract animation data:", P);
1769
1811
  }
1770
1812
  return {
1771
- positions: m,
1813
+ positions: h,
1772
1814
  normals: p,
1773
- indices: b,
1774
- texCoords: C,
1775
- vertexCount: M,
1776
- indexCount: T,
1815
+ indices: S,
1816
+ texCoords: T,
1817
+ vertexCount: R,
1818
+ indexCount: E,
1777
1819
  animationData: L,
1778
- hasBaseColorTexture: _
1820
+ hasBaseColorTexture: x
1779
1821
  };
1780
1822
  }
1781
1823
  function gt(s, t, e, i, r) {
@@ -1789,12 +1831,12 @@ function gt(s, t, e, i, r) {
1789
1831
  throw new Error(`Attribute accessor type mismatch: expected ${i} components, got ${o}`);
1790
1832
  if (n.componentType !== r)
1791
1833
  throw new Error(`Attribute component type mismatch: expected ${r}, got ${n.componentType}`);
1792
- 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);
1834
+ const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count, h = new DataView(t, l, u * i * 4), p = new Float32Array(u * i);
1793
1835
  for (let d = 0; d < u * i; d++)
1794
- p[d] = m.getFloat32(d * 4, !0);
1836
+ p[d] = h.getFloat32(d * 4, !0);
1795
1837
  return p;
1796
1838
  }
1797
- function ni(s, t, e) {
1839
+ function ai(s, t, e) {
1798
1840
  const i = s.accessors[e];
1799
1841
  if (i.type !== "SCALAR")
1800
1842
  throw new Error(`Indices accessor must be SCALAR, got ${i.type}`);
@@ -1812,19 +1854,19 @@ function ni(s, t, e) {
1812
1854
  } else
1813
1855
  throw new Error(`Unsupported index component type: ${i.componentType}`);
1814
1856
  }
1815
- function Ms(s, t) {
1857
+ function Ts(s, t) {
1816
1858
  const e = new Float32Array(s.length);
1817
1859
  for (let i = 0; i < t.length; i += 3) {
1818
- 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 = [
1819
- u[1] * m[2] - u[2] * m[1],
1820
- u[2] * m[0] - u[0] * m[2],
1821
- u[0] * m[1] - u[1] * m[0]
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]], h = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], p = [
1861
+ u[1] * h[2] - u[2] * h[1],
1862
+ u[2] * h[0] - u[0] * h[2],
1863
+ u[0] * h[1] - u[1] * h[0]
1822
1864
  ], d = Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
1823
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];
1824
1866
  }
1825
1867
  return e;
1826
1868
  }
1827
- function Ts(s, t, e) {
1869
+ function Es(s, t, e) {
1828
1870
  const i = s.accessors[e];
1829
1871
  if (i.type !== "VEC4")
1830
1872
  throw new Error(`JOINTS_0 must be VEC4, got ${i.type}`);
@@ -1842,7 +1884,7 @@ function Ts(s, t, e) {
1842
1884
  } else
1843
1885
  throw new Error(`Unsupported JOINTS_0 component type: ${i.componentType}`);
1844
1886
  }
1845
- function Es(s, t, e) {
1887
+ function Cs(s, t, e) {
1846
1888
  const i = s.accessors[e];
1847
1889
  if (i.type !== "VEC4")
1848
1890
  throw new Error(`WEIGHTS_0 must be VEC4, got ${i.type}`);
@@ -1860,7 +1902,7 @@ function Es(s, t, e) {
1860
1902
  } else
1861
1903
  throw new Error(`Unsupported WEIGHTS_0 component type: ${i.componentType}`);
1862
1904
  }
1863
- function Cs(s, t, e) {
1905
+ function As(s, t, e) {
1864
1906
  const i = s.accessors[e];
1865
1907
  if (i.type !== "MAT4")
1866
1908
  throw new Error(`Expected MAT4, got ${i.type}`);
@@ -1871,7 +1913,7 @@ function Cs(s, t, e) {
1871
1913
  c[l] = o.getFloat32(l * 4, !0);
1872
1914
  return c;
1873
1915
  }
1874
- function As(s, t, e) {
1916
+ function Us(s, t, e) {
1875
1917
  const i = s.accessors[e];
1876
1918
  if (i.type !== "SCALAR")
1877
1919
  throw new Error(`Expected SCALAR, got ${i.type}`);
@@ -1882,19 +1924,19 @@ function As(s, t, e) {
1882
1924
  c[l] = o.getFloat32(l * 4, !0);
1883
1925
  return c;
1884
1926
  }
1885
- function Us(s, t, e) {
1927
+ function Is(s, t, e) {
1886
1928
  const i = s.accessors[e], n = { VEC3: 3, VEC4: 4 }[i.type];
1887
1929
  if (!n)
1888
1930
  throw new Error(`Expected VEC3 or VEC4, got ${i.type}`);
1889
1931
  if (i.componentType !== 5126)
1890
1932
  throw new Error(`Expected FLOAT component type, got ${i.componentType}`);
1891
1933
  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);
1892
- for (let m = 0; m < c * n; m++)
1893
- u[m] = l.getFloat32(m * 4, !0);
1934
+ for (let h = 0; h < c * n; h++)
1935
+ u[h] = l.getFloat32(h * 4, !0);
1894
1936
  return u;
1895
1937
  }
1896
- function Is(s, t, e) {
1897
- const i = s.skins[0], r = i.joints, n = Cs(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? Ts(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? Es(s, t, e.attributes.WEIGHTS_0) : null;
1938
+ function zs(s, t, e) {
1939
+ const i = s.skins[0], r = i.joints, n = As(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? Es(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? Cs(s, t, e.attributes.WEIGHTS_0) : null;
1898
1940
  if (!a || !o)
1899
1941
  throw new Error("Mesh missing JOINTS_0 or WEIGHTS_0 attributes");
1900
1942
  const c = s.nodes.map((u) => ({
@@ -1906,22 +1948,22 @@ function Is(s, t, e) {
1906
1948
  })), l = [];
1907
1949
  if (s.animations && s.animations.length > 0)
1908
1950
  for (const u of s.animations) {
1909
- const m = [];
1951
+ const h = [];
1910
1952
  let p = 0;
1911
1953
  for (const d of u.channels) {
1912
- const b = u.samplers[d.sampler], M = As(s, t, b.input), T = Us(s, t, b.output), C = M[M.length - 1];
1913
- C > p && (p = C), m.push({
1954
+ const S = u.samplers[d.sampler], R = Us(s, t, S.input), E = Is(s, t, S.output), T = R[R.length - 1];
1955
+ T > p && (p = T), h.push({
1914
1956
  targetNode: d.target.node,
1915
1957
  targetPath: d.target.path,
1916
- interpolation: b.interpolation || "LINEAR",
1917
- timestamps: M,
1918
- values: T
1958
+ interpolation: S.interpolation || "LINEAR",
1959
+ timestamps: R,
1960
+ values: E
1919
1961
  });
1920
1962
  }
1921
1963
  l.push({
1922
1964
  name: u.name || `Animation ${l.length}`,
1923
1965
  duration: p,
1924
- channels: m
1966
+ channels: h
1925
1967
  });
1926
1968
  }
1927
1969
  return {
@@ -1933,7 +1975,7 @@ function Is(s, t, e) {
1933
1975
  animations: l
1934
1976
  };
1935
1977
  }
1936
- async function ai(s) {
1978
+ async function oi(s) {
1937
1979
  const t = new DataView(s);
1938
1980
  if (t.getUint32(0, !0) !== 1179937895)
1939
1981
  throw new Error("Invalid GLB file: incorrect magic number");
@@ -1943,11 +1985,11 @@ async function ai(s) {
1943
1985
  const r = t.getUint32(8, !0);
1944
1986
  let n = 12, a = null, o = null;
1945
1987
  for (; n < r; ) {
1946
- const L = t.getUint32(n, !0), v = t.getUint32(n + 4, !0), w = s.slice(n + 8, n + 8 + L);
1947
- if (v === 1313821514) {
1948
- const V = new TextDecoder("utf-8").decode(w);
1949
- a = JSON.parse(V);
1950
- } else v === 5130562 && (o = w);
1988
+ const L = t.getUint32(n, !0), P = t.getUint32(n + 4, !0), B = s.slice(n + 8, n + 8 + L);
1989
+ if (P === 1313821514) {
1990
+ const F = new TextDecoder("utf-8").decode(B);
1991
+ a = JSON.parse(F);
1992
+ } else P === 5130562 && (o = B);
1951
1993
  n += 8 + L;
1952
1994
  }
1953
1995
  if (!a)
@@ -1960,25 +2002,25 @@ async function ai(s) {
1960
2002
  const l = c.pbrMetallicRoughness.baseColorTexture.index;
1961
2003
  if (!a.textures || !a.textures[l])
1962
2004
  return null;
1963
- const m = a.textures[l].source;
1964
- if (m === void 0 || !a.images || !a.images[m])
2005
+ const h = a.textures[l].source;
2006
+ if (h === void 0 || !a.images || !a.images[h])
1965
2007
  return null;
1966
- const p = a.images[m], d = p.mimeType || "image/png";
2008
+ const p = a.images[h], d = p.mimeType || "image/png";
1967
2009
  if (p.bufferView === void 0)
1968
2010
  return null;
1969
2011
  if (!o)
1970
2012
  throw new Error("GLB file missing BIN chunk (required for embedded textures)");
1971
- const b = a.bufferViews[p.bufferView], M = b.byteOffset || 0, T = b.byteLength, C = o.slice(M, M + T);
1972
- return { imageBlob: new Blob([C], { type: d }), mimeType: d };
2013
+ const S = a.bufferViews[p.bufferView], R = S.byteOffset || 0, E = S.byteLength, T = o.slice(R, R + E);
2014
+ return { imageBlob: new Blob([T], { type: d }), mimeType: d };
1973
2015
  }
1974
- function oi(s, t, e) {
2016
+ function li(s, t, e) {
1975
2017
  return [
1976
2018
  s[0] + (t[0] - s[0]) * e,
1977
2019
  s[1] + (t[1] - s[1]) * e,
1978
2020
  s[2] + (t[2] - s[2]) * e
1979
2021
  ];
1980
2022
  }
1981
- function li(s, t, e) {
2023
+ function ci(s, t, e) {
1982
2024
  let i = s[0] * t[0] + s[1] * t[1] + s[2] * t[2] + s[3] * t[3], r = t;
1983
2025
  if (i < 0 && (i = -i, r = [-t[0], -t[1], -t[2], -t[3]]), i > 0.9995) {
1984
2026
  const l = [
@@ -2001,63 +2043,35 @@ function Gs(s) {
2001
2043
  const t = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2] + s[3] * s[3]);
2002
2044
  return t > 1e-4 ? [s[0] / t, s[1] / t, s[2] / t, s[3] / t] : [0, 0, 0, 1];
2003
2045
  }
2004
- function Ds(s) {
2005
- const t = s[0], e = s[1], i = s[2], r = s[3], n = t + t, a = e + e, o = i + i, c = t * n, l = t * a, u = t * o, m = e * a, p = e * o, d = i * o, b = r * n, M = r * a, T = r * o;
2006
- return new Float32Array([
2007
- 1 - (m + d),
2008
- l + T,
2009
- u - M,
2010
- 0,
2011
- l - T,
2012
- 1 - (c + d),
2013
- p + b,
2014
- 0,
2015
- u + M,
2016
- p - b,
2017
- 1 - (c + m),
2018
- 0,
2019
- 0,
2020
- 0,
2021
- 0,
2022
- 1
2023
- ]);
2046
+ function Ds(s, t) {
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, h = e * c, p = i * o, d = i * c, S = r * c, R = n * a, E = n * o, T = n * c, x = t || new Float32Array(16);
2048
+ return x[0] = 1 - (p + S), x[1] = u + T, x[2] = h - E, x[3] = 0, x[4] = u - T, x[5] = 1 - (l + S), x[6] = d + R, x[7] = 0, x[8] = h + E, x[9] = d - R, x[10] = 1 - (l + p), x[11] = 0, x[12] = 0, x[13] = 0, x[14] = 0, x[15] = 1, x;
2024
2049
  }
2025
- function zs(s, t, e) {
2026
- const i = Ds(t);
2027
- return new Float32Array([
2028
- i[0] * e[0],
2029
- i[1] * e[0],
2030
- i[2] * e[0],
2031
- 0,
2032
- i[4] * e[1],
2033
- i[5] * e[1],
2034
- i[6] * e[1],
2035
- 0,
2036
- i[8] * e[2],
2037
- i[9] * e[2],
2038
- i[10] * e[2],
2039
- 0,
2040
- s[0],
2041
- s[1],
2042
- s[2],
2043
- 1
2044
- ]);
2050
+ const Fs = new Float32Array(16);
2051
+ function Vs(s, t, e, i) {
2052
+ const r = Ds(t, Fs), n = i || new Float32Array(16);
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;
2045
2054
  }
2046
- function ci(s, t) {
2047
- const e = new Float32Array(16);
2048
- for (let i = 0; i < 4; i++)
2049
- for (let r = 0; r < 4; r++)
2050
- e[i * 4 + r] = s[0 + r] * t[i * 4 + 0] + s[4 + r] * t[i * 4 + 1] + s[8 + r] * t[i * 4 + 2] + s[12 + r] * t[i * 4 + 3];
2051
- return e;
2055
+ function ui(s, t, e) {
2056
+ const i = e || new Float32Array(16);
2057
+ for (let r = 0; r < 4; r++)
2058
+ for (let n = 0; n < 4; n++)
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];
2060
+ return i;
2052
2061
  }
2053
- class Vs {
2062
+ class Os {
2054
2063
  constructor(t) {
2055
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);
2056
2065
  for (let e = 0; e < this.nodes.length; e++)
2057
2066
  this.jointLocalTransforms[e] = new Float32Array(16), this.jointGlobalTransforms[e] = new Float32Array(16);
2058
2067
  for (let e = 0; e < this.joints.length; e++)
2059
2068
  this.jointFinalMatrices[e] = new Float32Array(16);
2060
- this.skinnedPositions = null, this.skinnedNormals = null, this._gpuSkinningReady = !1, this._buildTopologicalOrder(), console.log(`GLBAnimator initialized: ${this.joints.length} joints, ${this.animations.length} animations`);
2069
+ this.skinnedPositions = null, this.skinnedNormals = null, this._gpuSkinningReady = !1, this._buildTopologicalOrder(), this._parentMap = new Array(this.nodes.length).fill(-1);
2070
+ for (let e = 0; e < this.nodes.length; e++)
2071
+ for (const i of this.nodes[e].children) this._parentMap[i] = e;
2072
+ this._invBindViews = new Array(this.joints.length);
2073
+ for (let e = 0; e < this.joints.length; e++)
2074
+ this._invBindViews[e] = this.inverseBindMatrices.subarray(e * 16, e * 16 + 16);
2061
2075
  }
2062
2076
  /**
2063
2077
  * Set the rest pose (original vertex data).
@@ -2076,8 +2090,8 @@ class Vs {
2076
2090
  this._gpuDevice = t, this._gpuOutputBuffer = e;
2077
2091
  const r = this.restPositions.length / 3, n = new Float32Array(r * 8);
2078
2092
  for (let c = 0; c < r; c++) {
2079
- const l = c * 8, u = c * 3, m = c * 2;
2080
- 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, h = 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[h] : 0, n[l + 7] = i ? i[h + 1] : 0;
2081
2095
  }
2082
2096
  this._gpuRestDataBuffer = t.createBuffer({
2083
2097
  size: n.byteLength,
@@ -2112,7 +2126,7 @@ class Vs {
2112
2126
  this._gpuSkinningPipeline = t.createComputePipeline({
2113
2127
  layout: t.createPipelineLayout({ bindGroupLayouts: [o] }),
2114
2128
  compute: {
2115
- module: t.createShaderModule({ code: bs }),
2129
+ module: t.createShaderModule({ code: Ss }),
2116
2130
  entryPoint: "main"
2117
2131
  }
2118
2132
  }), this._gpuSkinningBindGroup = t.createBindGroup({
@@ -2124,7 +2138,7 @@ class Vs {
2124
2138
  { binding: 3, resource: { buffer: this._gpuJointMatricesBuffer } },
2125
2139
  { binding: 4, resource: { buffer: this._gpuOutputBuffer } }
2126
2140
  ]
2127
- }), this._gpuVertexCount = r, this._gpuSkinningReady = !0, console.log(`GPU skinning initialized: ${r} vertices, ${this.joints.length} joints`);
2141
+ }), this._gpuVertexCount = r, this._gpuSkinningReady = !0, globalThis.__HZFX_DEBUG && console.log(`GPU skinning initialized: ${r} vertices, ${this.joints.length} joints`);
2128
2142
  } catch (r) {
2129
2143
  console.warn("GPU skinning init failed, using CPU fallback:", r), this._gpuSkinningReady = !1;
2130
2144
  }
@@ -2202,11 +2216,11 @@ class Vs {
2202
2216
  return this._extractValue(r, i.length - 1, a);
2203
2217
  let o = 0, c = i.length - 1;
2204
2218
  for (; c - o > 1; ) {
2205
- const b = Math.floor((o + c) / 2);
2206
- i[b] <= e ? o = b : c = b;
2219
+ const S = Math.floor((o + c) / 2);
2220
+ i[S] <= e ? o = S : c = S;
2207
2221
  }
2208
- const l = i[o], u = i[c], m = (e - l) / (u - l), p = this._extractValue(r, o, a), d = this._extractValue(r, c, a);
2209
- return n === "STEP" ? p : a === "rotation" ? li(p, d, m) : oi(p, d, m);
2222
+ const l = i[o], u = i[c], h = (e - l) / (u - l), p = this._extractValue(r, o, a), d = this._extractValue(r, c, a);
2223
+ return n === "STEP" ? p : a === "rotation" ? ci(p, d, h) : li(p, d, h);
2210
2224
  }
2211
2225
  /**
2212
2226
  * Extract value from values array at the given index.
@@ -2233,24 +2247,20 @@ class Vs {
2233
2247
  const l = this._sampleChannel(c, t);
2234
2248
  c.targetPath === "translation" ? n = l : c.targetPath === "rotation" ? a = l : c.targetPath === "scale" && (o = l);
2235
2249
  }
2236
- this.jointLocalTransforms[i] = zs(n, a, o);
2250
+ Vs(n, a, o, this.jointLocalTransforms[i]);
2237
2251
  }
2238
2252
  }
2239
2253
  /**
2240
2254
  * Compute global transforms by propagating parent transforms.
2241
2255
  */
2242
2256
  _computeGlobalTransforms() {
2243
- const t = new Array(this.nodes.length).fill(-1);
2244
- for (let e = 0; e < this.nodes.length; e++) {
2245
- const i = this.nodes[e];
2246
- for (const r of i.children)
2247
- t[r] = e;
2248
- }
2257
+ const t = this._parentMap;
2249
2258
  for (const e of this.topologicalOrder) {
2250
2259
  const i = t[e];
2251
- i === -1 ? this.jointGlobalTransforms[e] = this.jointLocalTransforms[e] : this.jointGlobalTransforms[e] = ci(
2260
+ i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : ui(
2252
2261
  this.jointGlobalTransforms[i],
2253
- this.jointLocalTransforms[e]
2262
+ this.jointLocalTransforms[e],
2263
+ this.jointGlobalTransforms[e]
2254
2264
  );
2255
2265
  }
2256
2266
  }
@@ -2259,8 +2269,8 @@ class Vs {
2259
2269
  */
2260
2270
  _computeFinalMatrices() {
2261
2271
  for (let t = 0; t < this.joints.length; t++) {
2262
- const e = this.joints[t], i = this.jointGlobalTransforms[e], r = t * 16, n = this.inverseBindMatrices.slice(r, r + 16);
2263
- this.jointFinalMatrices[t] = ci(i, n);
2272
+ const e = this.joints[t], i = this.jointGlobalTransforms[e];
2273
+ ui(i, this._invBindViews[t], this.jointFinalMatrices[t]);
2264
2274
  }
2265
2275
  }
2266
2276
  /**
@@ -2270,20 +2280,20 @@ class Vs {
2270
2280
  _applySkinning() {
2271
2281
  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;
2272
2282
  for (let l = 0; l < t; l++) {
2273
- const u = l * 3, m = l * 4, p = e[u], d = e[u + 1], b = e[u + 2], M = i[u], T = i[u + 1], C = i[u + 2];
2274
- let _ = 0, L = 0, v = 0, w = 0, R = 0, V = 0;
2275
- for (let j = 0; j < 4; j++) {
2276
- const k = a[m + j];
2283
+ const u = l * 3, h = l * 4, p = e[u], d = e[u + 1], S = e[u + 2], R = i[u], E = i[u + 1], T = i[u + 2];
2284
+ let x = 0, L = 0, P = 0, B = 0, M = 0, F = 0;
2285
+ for (let Y = 0; Y < 4; Y++) {
2286
+ const k = a[h + Y];
2277
2287
  if (k === 0) continue;
2278
- const D = c[o[m + j]];
2279
- _ += (D[0] * p + D[4] * d + D[8] * b + D[12]) * k, L += (D[1] * p + D[5] * d + D[9] * b + D[13]) * k, v += (D[2] * p + D[6] * d + D[10] * b + D[14]) * k, w += (D[0] * M + D[4] * T + D[8] * C) * k, R += (D[1] * M + D[5] * T + D[9] * C) * k, V += (D[2] * M + D[6] * T + D[10] * C) * k;
2288
+ const G = c[o[h + Y]];
2289
+ x += (G[0] * p + G[4] * d + G[8] * S + G[12]) * k, L += (G[1] * p + G[5] * d + G[9] * S + G[13]) * k, P += (G[2] * p + G[6] * d + G[10] * S + G[14]) * k, B += (G[0] * R + G[4] * E + G[8] * T) * k, M += (G[1] * R + G[5] * E + G[9] * T) * k, F += (G[2] * R + G[6] * E + G[10] * T) * k;
2280
2290
  }
2281
- const X = Math.sqrt(w * w + R * R + V * V);
2282
- X > 1e-4 && (n[u] = w / X, n[u + 1] = R / X, n[u + 2] = V / X), r[u] = _, r[u + 1] = L, r[u + 2] = v;
2291
+ const N = Math.sqrt(B * B + M * M + F * F);
2292
+ N > 1e-4 && (n[u] = B / N, n[u + 1] = M / N, n[u + 2] = F / N), r[u] = x, r[u + 1] = L, r[u + 2] = P;
2283
2293
  }
2284
2294
  }
2285
2295
  }
2286
- class Fs {
2296
+ class Ls {
2287
2297
  constructor({ duration: t = 0, loop: e = !1, playbackRate: i = 1 } = {}) {
2288
2298
  this.currentTime = 0, this.duration = t, this.loop = e, this.playbackRate = i, this.paused = !1, this._justLooped = !1;
2289
2299
  }
@@ -2304,7 +2314,7 @@ class Fs {
2304
2314
  this.currentTime = Math.max(0, t || 0), this._justLooped = !1;
2305
2315
  }
2306
2316
  }
2307
- const ui = {
2317
+ const di = {
2308
2318
  linear: (s) => s,
2309
2319
  easeInQuad: (s) => s * s,
2310
2320
  easeOutQuad: (s) => 1 - (1 - s) * (1 - s),
@@ -2323,26 +2333,26 @@ const ui = {
2323
2333
  return Math.pow(2, -10 * s) * Math.sin((s * 10 - 0.75) * t) + 1;
2324
2334
  }
2325
2335
  };
2326
- function Os(s, t, e, i) {
2327
- 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;
2336
+ function Xs(s, t, e, i) {
2337
+ 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, h = (d) => ((l * d + c) * d + o) * d, p = (d) => (3 * a * d + 2 * n) * d + r;
2328
2338
  return (d) => {
2329
2339
  if (d <= 0) return 0;
2330
2340
  if (d >= 1) return 1;
2331
- let b = d;
2332
- for (let M = 0; M < 8; M++) {
2333
- const T = u(b) - d;
2334
- if (Math.abs(T) < 1e-5) break;
2335
- const C = p(b);
2336
- if (Math.abs(C) < 1e-6) break;
2337
- b -= T / C;
2341
+ let S = d;
2342
+ for (let R = 0; R < 8; R++) {
2343
+ const E = u(S) - d;
2344
+ if (Math.abs(E) < 1e-5) break;
2345
+ const T = p(S);
2346
+ if (Math.abs(T) < 1e-6) break;
2347
+ S -= E / T;
2338
2348
  }
2339
- return m(b);
2349
+ return h(S);
2340
2350
  };
2341
2351
  }
2342
- function Si(s, t) {
2343
- return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Os(s[0], s[1], s[2], s[3])(t) : (ui[s] || ui.linear)(t);
2352
+ function xi(s, t) {
2353
+ return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Xs(s[0], s[1], s[2], s[3])(t) : (di[s] || di.linear)(t);
2344
2354
  }
2345
- function Ls(s, t) {
2355
+ function Ns(s, t) {
2346
2356
  if (!Array.isArray(s) || s.length === 0) return;
2347
2357
  if (s.length === 1 || t <= s[0].t) return s[0].v;
2348
2358
  const e = s[s.length - 1];
@@ -2351,12 +2361,12 @@ function Ls(s, t) {
2351
2361
  const r = s[i], n = s[i + 1];
2352
2362
  if (t >= r.t && t <= n.t) {
2353
2363
  const a = n.t - r.t, o = a > 0 ? (t - r.t) / a : 0;
2354
- return r.v + (n.v - r.v) * Si(r.ease, o);
2364
+ return r.v + (n.v - r.v) * xi(r.ease, o);
2355
2365
  }
2356
2366
  }
2357
2367
  return e.v;
2358
2368
  }
2359
- function Ns(s, t) {
2369
+ function ks(s, t) {
2360
2370
  if (!Array.isArray(s) || s.length === 0) return;
2361
2371
  const e = (r, n, a) => [r[0] + (n[0] - r[0]) * a, r[1] + (n[1] - r[1]) * a, r[2] + (n[2] - r[2]) * a];
2362
2372
  if (s.length === 1 || t <= s[0].t) return s[0].v.slice();
@@ -2366,13 +2376,13 @@ function Ns(s, t) {
2366
2376
  const n = s[r], a = s[r + 1];
2367
2377
  if (t >= n.t && t <= a.t) {
2368
2378
  const o = a.t - n.t, c = o > 0 ? (t - n.t) / o : 0;
2369
- return e(n.v, a.v, Si(n.ease, c));
2379
+ return e(n.v, a.v, xi(n.ease, c));
2370
2380
  }
2371
2381
  }
2372
2382
  return i.v.slice();
2373
2383
  }
2374
- const Xs = ["gravityStrength", "emissionRate", "damping", "particleSize", "particleSpeed"], ks = { square: 0, circle: 1, triangle: 2, diamond: 3, star: 4, hexagon: 5, ring: 6, heart: 7, cross: 8, spark: 9, leaf: 10, capsule: 11, crescent: 12, line: 13, "curved-line": 14 };
2375
- function di(s) {
2384
+ const js = ["gravityStrength", "emissionRate", "damping", "particleSize", "particleSpeed"], Ys = { square: 0, circle: 1, triangle: 2, diamond: 3, star: 4, hexagon: 5, ring: 6, heart: 7, cross: 8, spark: 9, leaf: 10, capsule: 11, crescent: 12, line: 13, "curved-line": 14 };
2385
+ function fi(s) {
2376
2386
  const t = atob(s), e = new Uint8Array(t.length);
2377
2387
  for (let i = 0; i < t.length; i++)
2378
2388
  e[i] = t.charCodeAt(i);
@@ -2395,8 +2405,8 @@ class bt {
2395
2405
  usage: GPUBufferUsage.STORAGE | GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC,
2396
2406
  label: "particleTrailBuffer"
2397
2407
  }), this._trailResetData = new Float32Array(this.MAX_PARTICLES * 4), this.appearanceUniformBuffer = t.createBuffer({
2398
- size: 208,
2399
- // appearance uniforms + pulse + GLB rotation + system offset + sim rotation + noise distortion
2408
+ size: 224,
2409
+ // appearance uniforms + pulse + GLB rotation + system offset + sim rotation + noise distortion + orient3d
2400
2410
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
2401
2411
  label: "appearanceUniformBuffer"
2402
2412
  }), this.bloomIntensityBuffer = t.createBuffer({
@@ -2404,7 +2414,7 @@ class bt {
2404
2414
  // intensity (f32) + padding
2405
2415
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
2406
2416
  label: "systemBloomIntensityBuffer"
2407
- }), 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.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(52), 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 ds(e), this.physics = new Ss(t, this.MAX_PARTICLES), this.textureManager = new xs(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({
2417
+ }), 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 fs(e), this.physics = new xs(t, this.MAX_PARTICLES), this.textureManager = new vs(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({
2408
2418
  enabled: !0,
2409
2419
  shape: e.confinementShape,
2410
2420
  mode: e.confinementMode,
@@ -2417,7 +2427,7 @@ class bt {
2417
2427
  enabled: !0,
2418
2428
  strength: e.softBoundaryStrength,
2419
2429
  falloff: e.softBoundaryFalloff
2420
- }), this.particleTexture = this.textureManager.getDefaultTexture(), this.updateBloomIntensity(), this.updateAppearanceUniform(), this.frameCount = 0, this.shouldReset = !1, this._scriptParticleData = new Float32Array(this.MAX_PARTICLES * 8), this._scriptVelocityData = new Float32Array(this.MAX_PARTICLES * 4), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, this._particleScript = null, e.script && (this._particleScript = new ri(e.script, e, this.MAX_PARTICLES)), this.initComputePipeline(t);
2430
+ }), this.particleTexture = this.textureManager.getDefaultTexture(), this.updateBloomIntensity(), this.updateAppearanceUniform(), this.frameCount = 0, this.shouldReset = !1, this._scriptParticleData = new Float32Array(this.MAX_PARTICLES * 8), this._scriptVelocityData = new Float32Array(this.MAX_PARTICLES * 4), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, this._particleScript = null, e.script && (this._particleScript = new ni(e.script, e, this.MAX_PARTICLES)), this.initComputePipeline(t);
2421
2431
  }
2422
2432
  async initComputePipeline(t) {
2423
2433
  this.computeReady = await this.physics.initComputePipeline(this.instanceBuffer, this.velocityBuffer, this.trailBuffer);
@@ -2427,7 +2437,7 @@ class bt {
2427
2437
  * @param {string|null} source - Script source code, or null to disable
2428
2438
  */
2429
2439
  setScript(t) {
2430
- this._particleScript && (this._particleScript.destroy(), this._particleScript = null), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, t ? (this.config.script = t, this._particleScript = new ri(t, this.config, this.MAX_PARTICLES), this._particleScript.snapshotConfig(this.config)) : delete this.config.script;
2440
+ this._particleScript && (this._particleScript.destroy(), this._particleScript = null), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, t ? (this.config.script = t, this._particleScript = new ni(t, this.config, this.MAX_PARTICLES), this._particleScript.snapshotConfig(this.config)) : delete this.config.script;
2431
2441
  }
2432
2442
  async setTexture(t) {
2433
2443
  this.destroyed || (this.textureManager.destroyTexture(this.particleTexture), this.particleTexture = await this.textureManager.loadTexture(t), this.config.textureEnabled = !0, this.updateAppearanceUniform(), this.updateBuffers());
@@ -2454,16 +2464,16 @@ class bt {
2454
2464
  usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
2455
2465
  label: "glbIndexBuffer"
2456
2466
  }), 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) {
2457
- this.glbAnimator = new Vs(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);
2467
+ this.glbAnimator = new Os(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);
2458
2468
  try {
2459
2469
  await this.glbAnimator.initGPUSkinning(this.device, this.glbVertexBuffer, e.texCoords);
2460
2470
  } catch (r) {
2461
2471
  console.warn("GPU skinning init failed, using CPU fallback:", r);
2462
2472
  }
2463
- console.log(`GLB animated model loaded: ${e.animationData.animations.length} animations`);
2473
+ globalThis.__HZFX_DEBUG && console.log(`GLB animated model loaded: ${e.animationData.animations.length} animations`);
2464
2474
  } else
2465
2475
  this.glbAnimator = null, this.glbAnimated = !1, this.config.glbAnimated = !1, this._glbInterleavedData = null;
2466
- console.log(`GLB model loaded: ${e.vertexCount} vertices, ${e.indexCount} indices`);
2476
+ globalThis.__HZFX_DEBUG && console.log(`GLB model loaded: ${e.vertexCount} vertices, ${e.indexCount} indices`);
2467
2477
  } catch (e) {
2468
2478
  throw console.error("Failed to load GLB model:", e), e;
2469
2479
  }
@@ -2515,11 +2525,11 @@ class bt {
2515
2525
  updateAppearanceUniform() {
2516
2526
  if (this.destroyed) return;
2517
2527
  let t = 0;
2518
- this.config.rotationMode === "random" ? t = 1 : this.config.rotationMode === "velocity" && (t = 2);
2519
- const e = ks[this.config.particleShape] ?? 0, i = this._appearanceData;
2528
+ this.config.rotationMode === "random" ? t = 1 : this.config.rotationMode === "velocity" ? t = 2 : this.config.rotationMode === "oriented" ? t = 3 : this.config.rotationMode === "cylindrical" && (t = 4);
2529
+ const e = Ys[this.config.particleShape] ?? 0, i = this._appearanceData;
2520
2530
  i[0] = this.config.fadeEnabled ? 1 : 0, i[1] = this.config.randomColorEnabled ? 2 : this.config.colorTransitionEnabled ? 1 : 0, i[2] = this.config.particleSize, i[3] = this.config.textureEnabled ? 1 : 0, i[4] = this.config.particleColor[0], i[5] = this.config.particleColor[1], i[6] = this.config.particleColor[2], i[7] = this.config.rotation || 0, i[8] = this.config.startColor[0], i[9] = this.config.startColor[1], i[10] = this.config.startColor[2], i[11] = t, i[12] = this.config.endColor[0], i[13] = this.config.endColor[1], i[14] = this.config.endColor[2], i[15] = this.config.minRotation || 0, i[16] = this.config.maxRotation || 90, i[17] = this.config.aspectRatio || 1, i[18] = this.config.randomSize ? 1 : 0, i[19] = this.config.minSize || 0.1, i[20] = this.config.maxSize || 0.5, i[21] = this.config.fadeSizeEnabled ? 1 : 0, i[22] = this.config.opacity !== void 0 ? this.config.opacity : 1, i[23] = this.config.increaseSizeEnabled ? 1 : 0, i[24] = this.config.sizeLifetimeSpeed ?? 1, i[25] = e, i[26] = 0, i[27] = this.config.pulseEnabled ? 1 : 0, i[28] = this.config.pulseAmplitude ?? 0.5, i[29] = this.config.pulseFrequency ?? 1, i[30] = this.config.pulsePhaseRandom ?? 0, i[31] = this.config.pulseOpacity ? 1 : 0, i[32] = this.config.particleShapeRotationX || 0, i[33] = this.config.particleShapeRotationY || 0, i[34] = this.config.particleShapeRotationZ || 0, i[35] = 0;
2521
2531
  const r = this.config.followSystemTranslation ?? !0;
2522
- i[36] = r ? this._simPosition[0] : 0, i[37] = r ? this._simPosition[1] : 0, i[38] = r ? this._simPosition[2] : 0, i[39] = 0, i[40] = this._simRotX, i[41] = this._simRotZ, i[42] = this.config.velocityStretchEnabled ? 1 : 0, i[43] = this.config.velocityStretchFactor ?? 1, i[44] = this.config.noiseDistortEnabled ? 1 : 0, i[45] = this.config.noiseTilingX ?? 3, i[46] = this.config.noiseTilingY ?? 3, i[47] = this.config.noiseSpeed ?? -1.5, i[48] = this.config.noiseAmplitude ?? 0.08, i[49] = r ? this._simVelocity[0] : 0, i[50] = r ? this._simVelocity[1] : 0, i[51] = r ? this._simVelocity[2] : 0, this.device.queue.writeBuffer(this.appearanceUniformBuffer, 0, i);
2532
+ i[36] = r ? this._simPosition[0] : 0, i[37] = r ? this._simPosition[1] : 0, i[38] = r ? this._simPosition[2] : 0, i[39] = 0, i[40] = this._simRotX, i[41] = this._simRotZ, i[42] = this.config.velocityStretchEnabled ? 1 : 0, i[43] = this.config.velocityStretchFactor ?? 1, i[44] = this.config.noiseDistortEnabled ? 1 : 0, i[45] = this.config.noiseTilingX ?? 3, i[46] = this.config.noiseTilingY ?? 3, i[47] = this.config.noiseSpeed ?? -1.5, i[48] = this.config.noiseAmplitude ?? 0.08, i[49] = r ? this._simVelocity[0] : 0, i[50] = r ? this._simVelocity[1] : 0, i[51] = r ? this._simVelocity[2] : 0, i[52] = this.config.orientX ?? 0, i[53] = this.config.orientY ?? 0, i[54] = this.config.orientZ ?? 0, i[55] = 0, this.device.queue.writeBuffer(this.appearanceUniformBuffer, 0, i);
2523
2533
  }
2524
2534
  updateBloomIntensity() {
2525
2535
  const t = this._bloomIntensityData;
@@ -2615,11 +2625,11 @@ class bt {
2615
2625
  if (u > 0 && this._scriptTime >= u && !this._scriptConfigRestored)
2616
2626
  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));
2617
2627
  else if (!this._scriptConfigRestored) {
2618
- const m = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: p, particlesDirty: d } = this._particleScript.execute(
2628
+ const h = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: p, particlesDirty: d } = this._particleScript.execute(
2619
2629
  t,
2620
2630
  this._scriptTime,
2621
2631
  this._scriptFrame,
2622
- m,
2632
+ h,
2623
2633
  this._scriptParticleData,
2624
2634
  this._scriptVelocityData,
2625
2635
  this.activeParticles
@@ -2644,18 +2654,18 @@ class bt {
2644
2654
  if (!n && !this.emitting && !this.config.burstMode && !this.config.followSystemId && this.currentEmissionTime < this.effectiveEmissionDuration && (this.emitting = !0), !n && this.emitting)
2645
2655
  if (this.currentEmissionTime += t, this.currentEmissionTime < this.effectiveEmissionDuration) {
2646
2656
  const u = this.activeParticles;
2647
- let m = !1;
2657
+ let h = !1;
2648
2658
  if (this.config.followSystemId) {
2649
2659
  if (this._pendingFollowEmissions.length > 0) {
2650
2660
  const p = this._pendingFollowEmissions.length / 6;
2651
2661
  for (let d = 0; d < p; d++) {
2652
- const b = d * 6;
2662
+ const S = d * 6;
2653
2663
  if (this.emitFollowerParticle(
2654
- this._pendingFollowEmissions[b],
2655
- this._pendingFollowEmissions[b + 1],
2656
- this._pendingFollowEmissions[b + 2]
2664
+ this._pendingFollowEmissions[S],
2665
+ this._pendingFollowEmissions[S + 1],
2666
+ this._pendingFollowEmissions[S + 2]
2657
2667
  ))
2658
- m = !0;
2668
+ h = !0;
2659
2669
  else
2660
2670
  break;
2661
2671
  }
@@ -2672,10 +2682,10 @@ class bt {
2672
2682
  }
2673
2683
  p === 0 && c && this.config.emissionRate > 0 && this.activeParticles < this.particleCount && (p = 1);
2674
2684
  for (let d = 0; d < p && this.emitParticle(); d++)
2675
- m = !0;
2685
+ h = !0;
2676
2686
  }
2677
- if (m) {
2678
- const p = this.activeParticles - u, d = u * 8, b = u * 4;
2687
+ if (h) {
2688
+ const p = this.activeParticles - u, d = u * 8, S = u * 4;
2679
2689
  this.device.queue.writeBuffer(
2680
2690
  this.instanceBuffer,
2681
2691
  d * 4,
@@ -2685,10 +2695,10 @@ class bt {
2685
2695
  p * 8
2686
2696
  ), this.device.queue.writeBuffer(
2687
2697
  this.velocityBuffer,
2688
- b * 4,
2698
+ S * 4,
2689
2699
  // Offset in bytes (float32 = 4 bytes)
2690
2700
  this.particleVelocities,
2691
- b,
2701
+ S,
2692
2702
  p * 4
2693
2703
  );
2694
2704
  }
@@ -2779,13 +2789,13 @@ class bt {
2779
2789
  o * o + c * c + l * l
2780
2790
  );
2781
2791
  if (u > 1e-3) {
2782
- const m = this.config.particleSpeed * 2;
2783
- this.particleVelocities[i] = o / u * m, this.particleVelocities[i + 1] = c / u * m, this.particleVelocities[i + 2] = l / u * m;
2792
+ const h = this.config.particleSpeed * 2;
2793
+ this.particleVelocities[i] = o / u * h, this.particleVelocities[i + 1] = c / u * h, this.particleVelocities[i + 2] = l / u * h;
2784
2794
  } else {
2785
- const m = Math.sqrt(r * r + n * n + a * a);
2786
- if (m > 1e-3) {
2795
+ const h = Math.sqrt(r * r + n * n + a * a);
2796
+ if (h > 1e-3) {
2787
2797
  const p = this.config.particleSpeed * 2;
2788
- this.particleVelocities[i] = r / m * p, this.particleVelocities[i + 1] = n / m * p, this.particleVelocities[i + 2] = a / m * p;
2798
+ this.particleVelocities[i] = r / h * p, this.particleVelocities[i + 1] = n / h * p, this.particleVelocities[i + 2] = a / h * p;
2789
2799
  } else
2790
2800
  this.particleVelocities[i] = 0, this.particleVelocities[i + 1] = this.config.particleSpeed * 2, this.particleVelocities[i + 2] = 0;
2791
2801
  }
@@ -2830,9 +2840,9 @@ class bt {
2830
2840
  this.physics.setSoftBoundary(t);
2831
2841
  }
2832
2842
  }
2833
- class js {
2843
+ class Hs {
2834
2844
  constructor(t) {
2835
- this.device = t, this.particleSystems = [], this.activeSystemIndex = 0, this.systemCounter = 1, this.onSystemCreated = null, this.loop = void 0, this.clock = new Fs({ loop: !!this.loop }), this.ready = !0;
2845
+ this.device = t, this.particleSystems = [], this.activeSystemIndex = 0, this.systemCounter = 1, this.onSystemCreated = null, this.loop = void 0, this.clock = new Ls({ loop: !!this.loop }), this.ready = !0;
2836
2846
  }
2837
2847
  createParticleSystem(t = {}) {
2838
2848
  const e = this.systemCounter++, i = t.name || `System ${e + 1}`, r = {
@@ -2903,15 +2913,15 @@ class js {
2903
2913
  for (const { system: o, config: c } of this.particleSystems) {
2904
2914
  const l = c.keyframes;
2905
2915
  if (!(!l || c.keyframesEnabled === !1)) {
2906
- for (const u of Xs) {
2907
- const m = l[u];
2908
- if (m && m.length) {
2909
- const p = Ls(m, a);
2916
+ for (const u of js) {
2917
+ const h = l[u];
2918
+ if (h && h.length) {
2919
+ const p = Ns(h, a);
2910
2920
  p !== void 0 && (c[u] = p);
2911
2921
  }
2912
2922
  }
2913
2923
  if (l.particleColor && l.particleColor.length) {
2914
- const u = Ns(l.particleColor, a);
2924
+ const u = ks(l.particleColor, a);
2915
2925
  u && (c.particleColor = u, o.updateAppearanceUniform());
2916
2926
  }
2917
2927
  }
@@ -2981,7 +2991,7 @@ class js {
2981
2991
  try {
2982
2992
  let a = null;
2983
2993
  if (n.glbModelData)
2984
- a = di(n.glbModelData);
2994
+ a = fi(n.glbModelData);
2985
2995
  else if (n.glbFileName) {
2986
2996
  const o = await fetch(`/${n.glbFileName}`);
2987
2997
  o.ok ? a = await o.arrayBuffer() : console.warn(`GLB file not found: ${n.glbFileName}`);
@@ -2989,10 +2999,10 @@ class js {
2989
2999
  if (a) {
2990
3000
  if (await r.setGLBModel(a), n.animationIndex !== void 0 && r.glbAnimator && r.glbAnimator.setAnimation(n.animationIndex), n.animationSpeed !== void 0 && r.glbAnimator && (r.glbAnimator.speed = n.animationSpeed), n.animationLoop !== void 0 && r.glbAnimator && (r.glbAnimator.loop = n.animationLoop), n.useGlbTexture && (n.textureEnabled = !0), n.useGlbTexture && ((e = r.glbMeshData) != null && e.hasBaseColorTexture))
2991
3001
  try {
2992
- const o = await ai(a);
3002
+ const o = await oi(a);
2993
3003
  if (o) {
2994
3004
  const c = await createImageBitmap(o.imageBlob);
2995
- await r.setTexture(c), console.log(`GLB embedded texture restored for ${n.name}`);
3005
+ await r.setTexture(c), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${n.name}`);
2996
3006
  }
2997
3007
  } catch (o) {
2998
3008
  console.warn(`Failed to restore GLB texture for ${n.name}:`, o), n.useGlbTexture = !1;
@@ -3015,7 +3025,7 @@ class js {
3015
3025
  console.warn(`Failed to restore texture for ${n.name}:`, a), n.textureEnabled = !1;
3016
3026
  }
3017
3027
  for (const { system: r, config: n } of this.particleSystems)
3018
- r.updateAppearanceUniform(), (n.particleShapeRotationX || n.particleShapeRotationY || n.particleShapeRotationZ) && console.log(`[replaceSystems] ${n.name}: glbRotation XYZ = ${n.particleShapeRotationX}, ${n.particleShapeRotationY}, ${n.particleShapeRotationZ} | glbModelEnabled=${n.glbModelEnabled} | glbMeshData=${!!r.glbMeshData}`);
3028
+ r.updateAppearanceUniform();
3019
3029
  return this.respawnAllSystems(), !0;
3020
3030
  } catch (i) {
3021
3031
  return console.error("Error replacing systems:", i), !1;
@@ -3072,7 +3082,7 @@ class js {
3072
3082
  try {
3073
3083
  let l = null;
3074
3084
  if (c.glbModelData)
3075
- l = di(c.glbModelData);
3085
+ l = fi(c.glbModelData);
3076
3086
  else if (c.glbFileName) {
3077
3087
  const u = await fetch(`/${c.glbFileName}`);
3078
3088
  u.ok ? l = await u.arrayBuffer() : console.warn(`GLB file not found: ${c.glbFileName}`);
@@ -3080,10 +3090,10 @@ class js {
3080
3090
  if (l) {
3081
3091
  if (await o.setGLBModel(l), c.animationIndex !== void 0 && o.glbAnimator && o.glbAnimator.setAnimation(c.animationIndex), c.animationSpeed !== void 0 && o.glbAnimator && (o.glbAnimator.speed = c.animationSpeed), c.animationLoop !== void 0 && o.glbAnimator && (o.glbAnimator.loop = c.animationLoop), c.useGlbTexture && (c.textureEnabled = !0), c.useGlbTexture && ((r = o.glbMeshData) != null && r.hasBaseColorTexture))
3082
3092
  try {
3083
- const u = await ai(l);
3093
+ const u = await oi(l);
3084
3094
  if (u) {
3085
- const m = await createImageBitmap(u.imageBlob);
3086
- await o.setTexture(m), console.log(`GLB embedded texture restored for ${c.name}`);
3095
+ const h = await createImageBitmap(u.imageBlob);
3096
+ await o.setTexture(h), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
3087
3097
  }
3088
3098
  } catch (u) {
3089
3099
  console.warn(`Failed to restore GLB texture for ${c.name}:`, u), c.useGlbTexture = !1;
@@ -3097,8 +3107,8 @@ class js {
3097
3107
  if (c.textureEnabled && !c.glbModelEnabled && c.textureImageData && !o._textureRestored)
3098
3108
  try {
3099
3109
  const l = new Image();
3100
- await new Promise((m, p) => {
3101
- l.onload = m, l.onerror = p, l.src = c.textureImageData;
3110
+ await new Promise((h, p) => {
3111
+ l.onload = h, l.onerror = p, l.src = c.textureImageData;
3102
3112
  });
3103
3113
  const u = await createImageBitmap(l);
3104
3114
  await o.setTexture(u), o._textureRestored = !0;
@@ -3113,7 +3123,7 @@ class js {
3113
3123
  }
3114
3124
  }
3115
3125
  }
3116
- async function Ys(s) {
3126
+ async function qs(s) {
3117
3127
  if (!s)
3118
3128
  throw new Error("canvas is required for initWebGPU()");
3119
3129
  if (!navigator.gpu)
@@ -3125,37 +3135,37 @@ async function Ys(s) {
3125
3135
  alphaMode: "premultiplied"
3126
3136
  }), { device: i, context: t, format: r, canvas: s };
3127
3137
  }
3128
- const oe = "rgba16float";
3129
- function fi(s, t, e, i) {
3138
+ const le = "rgba16float";
3139
+ function pi(s, t, e, i) {
3130
3140
  const r = s.createTexture({
3131
3141
  size: [e, i],
3132
- format: oe,
3142
+ format: le,
3133
3143
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3134
3144
  mipLevelCount: 1,
3135
3145
  sampleCount: 1
3136
3146
  }), n = s.createTexture({
3137
3147
  size: [e, i],
3138
- format: oe,
3148
+ format: le,
3139
3149
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3140
3150
  mipLevelCount: 1,
3141
3151
  sampleCount: 1
3142
3152
  }), a = s.createTexture({
3143
3153
  size: [e, i],
3144
- format: oe,
3154
+ format: le,
3145
3155
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3146
3156
  mipLevelCount: 1,
3147
3157
  sampleCount: 1
3148
3158
  });
3149
3159
  return { sceneTexture: r, bloomTexA: n, bloomTexB: a };
3150
3160
  }
3151
- function pi(s, t, e) {
3161
+ function hi(s, t, e) {
3152
3162
  return s.createTexture({
3153
3163
  size: [t, e],
3154
3164
  format: "depth24plus",
3155
3165
  usage: GPUTextureUsage.RENDER_ATTACHMENT
3156
3166
  });
3157
3167
  }
3158
- function De(s, t, e) {
3168
+ function Ge(s, t, e) {
3159
3169
  const i = s.createBuffer({
3160
3170
  size: t.byteLength,
3161
3171
  usage: e,
@@ -3163,7 +3173,7 @@ function De(s, t, e) {
3163
3173
  });
3164
3174
  return new t.constructor(i.getMappedRange()).set(t), i.unmap(), i;
3165
3175
  }
3166
- const Hs = `
3176
+ const Zs = `
3167
3177
  struct Uniforms {
3168
3178
  transform: mat4x4<f32>,
3169
3179
  cameraPosition: vec3<f32>,
@@ -3225,7 +3235,7 @@ const Hs = `
3225
3235
 
3226
3236
  return finalColor;
3227
3237
  }
3228
- `, qs = `
3238
+ `, $s = `
3229
3239
  struct Uniforms {
3230
3240
  transform: mat4x4<f32>,
3231
3241
  cameraPosition: vec3<f32>,
@@ -3461,7 +3471,7 @@ const Hs = `
3461
3471
  return finalColor;
3462
3472
  }
3463
3473
  `;
3464
- function Zs(s) {
3474
+ function Ws(s) {
3465
3475
  const t = s.createBindGroupLayout({
3466
3476
  entries: [
3467
3477
  {
@@ -3547,7 +3557,7 @@ function Zs(s) {
3547
3557
  object3dBindGroupLayout: r
3548
3558
  };
3549
3559
  }
3550
- function $s(s, t, e, i = {}) {
3560
+ function Js(s, t, e, i = {}) {
3551
3561
  const { depthCompare: r } = i, n = r || "less", {
3552
3562
  particleBindGroupLayout: a,
3553
3563
  bloomBindGroupLayout: o,
@@ -3555,23 +3565,23 @@ function $s(s, t, e, i = {}) {
3555
3565
  object3dBindGroupLayout: l
3556
3566
  } = e, u = s.createPipelineLayout({
3557
3567
  bindGroupLayouts: [a]
3558
- }), m = s.createPipelineLayout({
3568
+ }), h = s.createPipelineLayout({
3559
3569
  bindGroupLayouts: [o]
3560
3570
  }), p = s.createPipelineLayout({
3561
3571
  bindGroupLayouts: [c]
3562
3572
  }), d = s.createShaderModule({
3563
- code: fs
3564
- }), b = s.createShaderModule({
3565
3573
  code: ps
3566
- }), M = s.createShaderModule({
3574
+ }), S = s.createShaderModule({
3567
3575
  code: hs
3568
- }), T = s.createShaderModule({
3576
+ }), R = s.createShaderModule({
3569
3577
  code: ms
3570
- }), C = s.createShaderModule({
3571
- code: Hs
3572
- }), _ = s.createShaderModule({
3573
- code: qs
3574
- }), L = ($) => s.createRenderPipeline({
3578
+ }), E = s.createShaderModule({
3579
+ code: ys
3580
+ }), T = s.createShaderModule({
3581
+ code: Zs
3582
+ }), x = s.createShaderModule({
3583
+ code: $s
3584
+ }), L = (W) => s.createRenderPipeline({
3575
3585
  layout: u,
3576
3586
  vertex: {
3577
3587
  module: d,
@@ -3638,8 +3648,8 @@ function $s(s, t, e, i = {}) {
3638
3648
  module: d,
3639
3649
  entryPoint: "fs_main",
3640
3650
  targets: [{
3641
- format: oe,
3642
- blend: $
3651
+ format: le,
3652
+ blend: W
3643
3653
  }]
3644
3654
  },
3645
3655
  primitive: {
@@ -3651,7 +3661,7 @@ function $s(s, t, e, i = {}) {
3651
3661
  depthCompare: n,
3652
3662
  format: "depth24plus"
3653
3663
  }
3654
- }), v = L({
3664
+ }), P = L({
3655
3665
  color: {
3656
3666
  srcFactor: "src-alpha",
3657
3667
  dstFactor: "one-minus-src-alpha",
@@ -3662,7 +3672,7 @@ function $s(s, t, e, i = {}) {
3662
3672
  dstFactor: "one-minus-src-alpha",
3663
3673
  operation: "add"
3664
3674
  }
3665
- }), w = L({
3675
+ }), B = L({
3666
3676
  color: {
3667
3677
  srcFactor: "src-alpha",
3668
3678
  dstFactor: "one",
@@ -3673,7 +3683,7 @@ function $s(s, t, e, i = {}) {
3673
3683
  dstFactor: "one-minus-src-alpha",
3674
3684
  operation: "add"
3675
3685
  }
3676
- }), R = s.createRenderPipeline({
3686
+ }), M = s.createRenderPipeline({
3677
3687
  layout: u,
3678
3688
  vertex: {
3679
3689
  module: d,
@@ -3740,7 +3750,7 @@ function $s(s, t, e, i = {}) {
3740
3750
  module: d,
3741
3751
  entryPoint: "fs_main",
3742
3752
  targets: [{
3743
- format: oe,
3753
+ format: le,
3744
3754
  writeMask: 0
3745
3755
  // No color write — depth only
3746
3756
  }]
@@ -3755,33 +3765,33 @@ function $s(s, t, e, i = {}) {
3755
3765
  // Always write depth (don't self-occlude)
3756
3766
  format: "depth24plus"
3757
3767
  }
3758
- }), V = s.createRenderPipeline({
3759
- layout: m,
3768
+ }), F = s.createRenderPipeline({
3769
+ layout: h,
3760
3770
  vertex: {
3761
- module: b,
3771
+ module: S,
3762
3772
  entryPoint: "vs_main"
3763
3773
  },
3764
3774
  fragment: {
3765
- module: b,
3775
+ module: S,
3766
3776
  entryPoint: "fs_main",
3767
3777
  targets: [{
3768
- format: oe
3778
+ format: le
3769
3779
  }]
3770
3780
  },
3771
3781
  primitive: {
3772
3782
  topology: "triangle-list"
3773
3783
  }
3774
- }), X = s.createRenderPipeline({
3784
+ }), N = s.createRenderPipeline({
3775
3785
  layout: p,
3776
3786
  vertex: {
3777
- module: M,
3787
+ module: R,
3778
3788
  entryPoint: "vs_main"
3779
3789
  },
3780
3790
  fragment: {
3781
- module: M,
3791
+ module: R,
3782
3792
  entryPoint: "fs_main",
3783
3793
  targets: [{
3784
- format: oe,
3794
+ format: le,
3785
3795
  blend: {
3786
3796
  color: {
3787
3797
  srcFactor: "one",
@@ -3799,17 +3809,17 @@ function $s(s, t, e, i = {}) {
3799
3809
  primitive: {
3800
3810
  topology: "triangle-list"
3801
3811
  }
3802
- }), j = s.createRenderPipeline({
3812
+ }), Y = s.createRenderPipeline({
3803
3813
  layout: p,
3804
3814
  vertex: {
3805
- module: T,
3815
+ module: E,
3806
3816
  entryPoint: "vs_main"
3807
3817
  },
3808
3818
  fragment: {
3809
- module: T,
3819
+ module: E,
3810
3820
  entryPoint: "fs_main",
3811
3821
  targets: [{
3812
- format: oe,
3822
+ format: le,
3813
3823
  blend: {
3814
3824
  color: {
3815
3825
  srcFactor: "one",
@@ -3827,7 +3837,7 @@ function $s(s, t, e, i = {}) {
3827
3837
  primitive: {
3828
3838
  topology: "triangle-list"
3829
3839
  }
3830
- }), k = s.createShaderModule({ code: ys }), D = s.createRenderPipeline({
3840
+ }), k = s.createShaderModule({ code: gs }), G = s.createRenderPipeline({
3831
3841
  layout: p,
3832
3842
  vertex: { module: k, entryPoint: "vs_main" },
3833
3843
  fragment: {
@@ -3842,12 +3852,12 @@ function $s(s, t, e, i = {}) {
3842
3852
  }]
3843
3853
  },
3844
3854
  primitive: { topology: "triangle-list" }
3845
- }), he = s.createPipelineLayout({
3855
+ }), pe = s.createPipelineLayout({
3846
3856
  bindGroupLayouts: [l]
3847
- }), ze = s.createRenderPipeline({
3848
- layout: he,
3857
+ }), De = s.createRenderPipeline({
3858
+ layout: pe,
3849
3859
  vertex: {
3850
- module: C,
3860
+ module: T,
3851
3861
  entryPoint: "vs_main",
3852
3862
  buffers: [
3853
3863
  {
@@ -3872,10 +3882,10 @@ function $s(s, t, e, i = {}) {
3872
3882
  ]
3873
3883
  },
3874
3884
  fragment: {
3875
- module: C,
3885
+ module: T,
3876
3886
  entryPoint: "fs_main",
3877
3887
  targets: [{
3878
- format: oe,
3888
+ format: le,
3879
3889
  blend: {
3880
3890
  color: {
3881
3891
  srcFactor: "src-alpha",
@@ -3902,7 +3912,7 @@ function $s(s, t, e, i = {}) {
3902
3912
  }), at = s.createRenderPipeline({
3903
3913
  layout: u,
3904
3914
  vertex: {
3905
- module: _,
3915
+ module: x,
3906
3916
  entryPoint: "vs_main",
3907
3917
  buffers: [
3908
3918
  {
@@ -3974,10 +3984,10 @@ function $s(s, t, e, i = {}) {
3974
3984
  ]
3975
3985
  },
3976
3986
  fragment: {
3977
- module: _,
3987
+ module: x,
3978
3988
  entryPoint: "fs_main",
3979
3989
  targets: [{
3980
- format: oe,
3990
+ format: le,
3981
3991
  blend: {
3982
3992
  color: {
3983
3993
  srcFactor: "src-alpha",
@@ -4003,14 +4013,14 @@ function $s(s, t, e, i = {}) {
4003
4013
  }
4004
4014
  });
4005
4015
  return {
4006
- particlePipeline: v,
4007
- particleAdditivePipeline: w,
4008
- particleDepthWritePipeline: R,
4009
- blurPipeline: V,
4010
- compositePipeline: X,
4011
- directRenderPipeline: j,
4012
- finalCompositePipeline: D,
4013
- object3dPipeline: ze,
4016
+ particlePipeline: P,
4017
+ particleAdditivePipeline: B,
4018
+ particleDepthWritePipeline: M,
4019
+ blurPipeline: F,
4020
+ compositePipeline: N,
4021
+ directRenderPipeline: Y,
4022
+ finalCompositePipeline: G,
4023
+ object3dPipeline: De,
4014
4024
  glbMeshPipeline: at
4015
4025
  };
4016
4026
  }
@@ -4024,7 +4034,7 @@ function St(s, t, e, i) {
4024
4034
  } = e, {
4025
4035
  sceneTexture: l,
4026
4036
  bloomTexA: u,
4027
- bloomTexB: m
4037
+ bloomTexB: h
4028
4038
  } = i, p = s.createBindGroup({
4029
4039
  layout: s.createBindGroupLayout({
4030
4040
  entries: [
@@ -4084,7 +4094,7 @@ function St(s, t, e, i) {
4084
4094
  resource: { buffer: a }
4085
4095
  }
4086
4096
  ]
4087
- }), b = s.createBindGroup({
4097
+ }), S = s.createBindGroup({
4088
4098
  layout: s.createBindGroupLayout({
4089
4099
  entries: [
4090
4100
  {
@@ -4118,7 +4128,7 @@ function St(s, t, e, i) {
4118
4128
  resource: { buffer: o }
4119
4129
  }
4120
4130
  ]
4121
- }), M = s.createBindGroup({
4131
+ }), R = s.createBindGroup({
4122
4132
  layout: s.createBindGroupLayout({
4123
4133
  entries: [
4124
4134
  {
@@ -4154,14 +4164,14 @@ function St(s, t, e, i) {
4154
4164
  },
4155
4165
  {
4156
4166
  binding: 2,
4157
- resource: m.createView()
4167
+ resource: h.createView()
4158
4168
  },
4159
4169
  {
4160
4170
  binding: 3,
4161
4171
  resource: { buffer: c }
4162
4172
  }
4163
4173
  ]
4164
- }), T = s.createBindGroup({
4174
+ }), E = s.createBindGroup({
4165
4175
  layout: s.createBindGroupLayout({
4166
4176
  entries: [
4167
4177
  {
@@ -4197,7 +4207,7 @@ function St(s, t, e, i) {
4197
4207
  },
4198
4208
  {
4199
4209
  binding: 2,
4200
- resource: m.createView()
4210
+ resource: h.createView()
4201
4211
  },
4202
4212
  {
4203
4213
  binding: 3,
@@ -4208,12 +4218,12 @@ function St(s, t, e, i) {
4208
4218
  return {
4209
4219
  particleBindGroup: p,
4210
4220
  horizontalBlurBindGroup: d,
4211
- verticalBlurBindGroup: b,
4212
- compositeBindGroup: M,
4213
- directRenderBindGroup: T
4221
+ verticalBlurBindGroup: S,
4222
+ compositeBindGroup: R,
4223
+ directRenderBindGroup: E
4214
4224
  };
4215
4225
  }
4216
- function Ws(s) {
4226
+ function Qs(s) {
4217
4227
  return s.createSampler({
4218
4228
  magFilter: "linear",
4219
4229
  minFilter: "linear",
@@ -4223,7 +4233,7 @@ function Ws(s) {
4223
4233
  maxAnisotropy: 16
4224
4234
  });
4225
4235
  }
4226
- function Js() {
4236
+ function Ks() {
4227
4237
  const s = new Float32Array([
4228
4238
  // Front face (z = 0.5)
4229
4239
  -0.5,
@@ -4421,13 +4431,13 @@ function Js() {
4421
4431
  ]);
4422
4432
  return { vertices: s, indices: t };
4423
4433
  }
4424
- function Qs(s = 16, t = 16) {
4434
+ function er(s = 16, t = 16) {
4425
4435
  const e = [], i = [];
4426
4436
  for (let r = 0; r <= s; r++) {
4427
4437
  const n = r * Math.PI / s, a = Math.sin(n), o = Math.cos(n);
4428
4438
  for (let c = 0; c <= t; c++) {
4429
- const l = c * 2 * Math.PI / t, u = Math.sin(l), p = Math.cos(l) * a, d = o, b = u * a;
4430
- e.push(p * 0.5, d * 0.5, b * 0.5), e.push(p, d, b);
4439
+ const l = c * 2 * Math.PI / t, u = Math.sin(l), p = Math.cos(l) * a, d = o, S = u * a;
4440
+ e.push(p * 0.5, d * 0.5, S * 0.5), e.push(p, d, S);
4431
4441
  }
4432
4442
  }
4433
4443
  for (let r = 0; r < s; r++)
@@ -4440,7 +4450,7 @@ function Qs(s = 16, t = 16) {
4440
4450
  indices: new Uint16Array(i)
4441
4451
  };
4442
4452
  }
4443
- class Ks {
4453
+ class tr {
4444
4454
  constructor(t, e, i, r, n) {
4445
4455
  this.id = t, this.type = e, this.position = i, this.scale = r, this.color = n, this.rotation = [0, 0, 0];
4446
4456
  }
@@ -4574,7 +4584,7 @@ class Ks {
4574
4584
  return i;
4575
4585
  }
4576
4586
  }
4577
- class or {
4587
+ class cr {
4578
4588
  constructor(t) {
4579
4589
  this.device = t, this.objects = [], this.nextId = 0, this.initializeGeometry(), this.onObjectAdded = null, this.onObjectRemoved = null, this.onObjectUpdated = null;
4580
4590
  }
@@ -4582,20 +4592,20 @@ class or {
4582
4592
  * Initialize geometry buffers for cube and sphere
4583
4593
  */
4584
4594
  initializeGeometry() {
4585
- const t = Js(), e = Qs(16, 16);
4586
- this.cubeVertexBuffer = De(
4595
+ const t = Ks(), e = er(16, 16);
4596
+ this.cubeVertexBuffer = Ge(
4587
4597
  this.device,
4588
4598
  t.vertices,
4589
4599
  GPUBufferUsage.VERTEX
4590
- ), this.cubeIndexBuffer = De(
4600
+ ), this.cubeIndexBuffer = Ge(
4591
4601
  this.device,
4592
4602
  t.indices,
4593
4603
  GPUBufferUsage.INDEX
4594
- ), this.cubeIndexCount = t.indices.length, this.sphereVertexBuffer = De(
4604
+ ), this.cubeIndexCount = t.indices.length, this.sphereVertexBuffer = Ge(
4595
4605
  this.device,
4596
4606
  e.vertices,
4597
4607
  GPUBufferUsage.VERTEX
4598
- ), this.sphereIndexBuffer = De(
4608
+ ), this.sphereIndexBuffer = Ge(
4599
4609
  this.device,
4600
4610
  e.indices,
4601
4611
  GPUBufferUsage.INDEX
@@ -4610,7 +4620,7 @@ class or {
4610
4620
  * @returns {Object3D} The created object
4611
4621
  */
4612
4622
  addObject(t, e = [0, 0, 0], i = [1, 1, 1], r = [1, 1, 1, 1]) {
4613
- const n = new Ks(this.nextId++, t, e, i, r);
4623
+ const n = new tr(this.nextId++, t, e, i, r);
4614
4624
  return n.uniformBuffer = this.device.createBuffer({
4615
4625
  size: 192,
4616
4626
  // modelMatrix (64) + normalMatrix (64) + color (16) + padding (48)
@@ -4699,21 +4709,21 @@ class or {
4699
4709
  }
4700
4710
  }
4701
4711
  }
4702
- function lr(s) {
4712
+ function ur(s) {
4703
4713
  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;
4704
4714
  return [t, e, i];
4705
4715
  }
4706
- function cr(s) {
4716
+ function dr(s) {
4707
4717
  if (!s) return "#ffffff";
4708
4718
  const t = Math.round(s[0] * 255).toString(16).padStart(2, "0"), e = Math.round(s[1] * 255).toString(16).padStart(2, "0"), i = Math.round(s[2] * 255).toString(16).padStart(2, "0");
4709
4719
  return `#${t}${e}${i}`;
4710
4720
  }
4711
- function ur(s, t, e) {
4712
- const i = hi([
4721
+ function fr(s, t, e) {
4722
+ const i = mi([
4713
4723
  s[0] - t[0],
4714
4724
  s[1] - t[1],
4715
4725
  s[2] - t[2]
4716
- ]), r = hi(mi(e, i)), n = mi(i, r);
4726
+ ]), r = mi(yi(e, i)), n = yi(i, r);
4717
4727
  return new Float32Array([
4718
4728
  r[0],
4719
4729
  n[0],
@@ -4733,7 +4743,7 @@ function ur(s, t, e) {
4733
4743
  1
4734
4744
  ]);
4735
4745
  }
4736
- function dr(s, t = Math.PI / 4) {
4746
+ function pr(s, t = Math.PI / 4) {
4737
4747
  const r = 1 / Math.tan(t / 2);
4738
4748
  return new Float32Array([
4739
4749
  r * s,
@@ -4754,11 +4764,11 @@ function dr(s, t = Math.PI / 4) {
4754
4764
  0
4755
4765
  ]);
4756
4766
  }
4757
- function hi(s) {
4767
+ function mi(s) {
4758
4768
  const t = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]);
4759
4769
  return [s[0] / t, s[1] / t, s[2] / t];
4760
4770
  }
4761
- function mi(s, t) {
4771
+ function yi(s, t) {
4762
4772
  return [
4763
4773
  s[1] * t[2] - s[2] * t[1],
4764
4774
  s[2] * t[0] - s[0] * t[2],
@@ -4768,7 +4778,7 @@ function mi(s, t) {
4768
4778
  function xt(s, t) {
4769
4779
  return s[0] * t[0] + s[1] * t[1] + s[2] * t[2];
4770
4780
  }
4771
- function er(s, t) {
4781
+ function ir(s, t) {
4772
4782
  const e = new Float32Array(16);
4773
4783
  for (let i = 0; i < 4; i++)
4774
4784
  for (let r = 0; r < 4; r++) {
@@ -4779,7 +4789,7 @@ function er(s, t) {
4779
4789
  }
4780
4790
  return e;
4781
4791
  }
4782
- const Pt = 1481005640, xi = 1, vi = 1313821514, Pi = 5130562, qe = "$hzfxAsset", _i = (s) => typeof atob == "function" ? Uint8Array.from(atob(s), (t) => t.charCodeAt(0)) : new Uint8Array(Buffer.from(s, "base64")), yi = (s) => {
4792
+ const Pt = 1481005640, vi = 1, Pi = 1313821514, _i = 5130562, qe = "$hzfxAsset", wi = (s) => typeof atob == "function" ? Uint8Array.from(atob(s), (t) => t.charCodeAt(0)) : new Uint8Array(Buffer.from(s, "base64")), gi = (s) => {
4783
4793
  if (typeof btoa == "function") {
4784
4794
  let t = "";
4785
4795
  for (let e = 0; e < s.length; e++) t += String.fromCharCode(s[e]);
@@ -4787,67 +4797,67 @@ const Pt = 1481005640, xi = 1, vi = 1313821514, Pi = 5130562, qe = "$hzfxAsset",
4787
4797
  }
4788
4798
  return Buffer.from(s).toString("base64");
4789
4799
  };
4790
- function tr(s) {
4791
- const t = s.indexOf(","), e = s.slice(5, t), i = e.split(";")[0] || "application/octet-stream", r = s.slice(t + 1), a = /;base64/i.test(e) ? _i(r) : new TextEncoder().encode(decodeURIComponent(r));
4800
+ function sr(s) {
4801
+ const t = s.indexOf(","), e = s.slice(5, t), i = e.split(";")[0] || "application/octet-stream", r = s.slice(t + 1), a = /;base64/i.test(e) ? wi(r) : new TextEncoder().encode(decodeURIComponent(r));
4792
4802
  return { mime: i, bytes: a };
4793
4803
  }
4794
- function gi(s) {
4804
+ function bi(s) {
4795
4805
  return (4 - s % 4) % 4;
4796
4806
  }
4797
- async function ir(s, t = {}) {
4807
+ async function rr(s, t = {}) {
4798
4808
  const { textureFormat: e = "keep", quality: i = 0.85 } = t, r = [], n = [];
4799
4809
  let a = 0;
4800
- const o = (w, R, V) => {
4801
- const X = a, j = w.length;
4802
- r.push({ offset: X, length: j, mime: R, kind: V }), n.push(w), a += j;
4803
- const k = gi(j);
4810
+ const o = (B, M, F) => {
4811
+ const N = a, Y = B.length;
4812
+ r.push({ offset: N, length: Y, mime: M, kind: F }), n.push(B), a += Y;
4813
+ const k = bi(Y);
4804
4814
  return k && (n.push(new Uint8Array(k)), a += k), r.length - 1;
4805
4815
  }, c = e === "webp" && typeof OffscreenCanvas < "u" && typeof createImageBitmap == "function", l = [];
4806
- for (const w of s.systems || []) {
4807
- const R = { ...w };
4808
- if (typeof R.textureImageData == "string" && R.textureImageData.startsWith("data:")) {
4809
- let { mime: V, bytes: X } = tr(R.textureImageData);
4810
- if (c && V !== "image/webp")
4816
+ for (const B of s.systems || []) {
4817
+ const M = { ...B };
4818
+ if (typeof M.textureImageData == "string" && M.textureImageData.startsWith("data:")) {
4819
+ let { mime: F, bytes: N } = sr(M.textureImageData);
4820
+ if (c && F !== "image/webp")
4811
4821
  try {
4812
- const j = await createImageBitmap(new Blob([X], { type: V })), k = new OffscreenCanvas(j.width, j.height);
4813
- k.getContext("2d").drawImage(j, 0, 0);
4814
- const D = await k.convertToBlob({ type: "image/webp", quality: i }), he = new Uint8Array(await D.arrayBuffer());
4815
- he.length < X.length && (X = he, V = "image/webp");
4822
+ const Y = await createImageBitmap(new Blob([N], { type: F })), k = new OffscreenCanvas(Y.width, Y.height);
4823
+ k.getContext("2d").drawImage(Y, 0, 0);
4824
+ const G = await k.convertToBlob({ type: "image/webp", quality: i }), pe = new Uint8Array(await G.arrayBuffer());
4825
+ pe.length < N.length && (N = pe, F = "image/webp");
4816
4826
  } catch {
4817
4827
  }
4818
- R.textureImageData = { [qe]: o(X, V, "texture") };
4828
+ M.textureImageData = { [qe]: o(N, F, "texture") };
4819
4829
  }
4820
- if (typeof R.glbModelData == "string" && R.glbModelData.length > 0) {
4821
- const V = _i(R.glbModelData);
4822
- R.glbModelData = { [qe]: o(V, "model/gltf-binary", "glb") };
4830
+ if (typeof M.glbModelData == "string" && M.glbModelData.length > 0) {
4831
+ const F = wi(M.glbModelData);
4832
+ M.glbModelData = { [qe]: o(F, "model/gltf-binary", "glb") };
4823
4833
  }
4824
- l.push(R);
4825
- }
4826
- const u = { ...s, systems: l, assets: r }, m = new TextEncoder().encode(JSON.stringify(u)), p = gi(m.length), d = new Uint8Array(a);
4827
- let b = 0;
4828
- for (const w of n)
4829
- d.set(w, b), b += w.length;
4830
- const M = m.length + p, T = 20 + M + 8 + a, C = new ArrayBuffer(T), _ = new DataView(C), L = new Uint8Array(C);
4831
- let v = 0;
4832
- _.setUint32(v, Pt, !0), v += 4, _.setUint32(v, xi, !0), v += 4, _.setUint32(v, T, !0), v += 4, _.setUint32(v, M, !0), v += 4, _.setUint32(v, vi, !0), v += 4, L.set(m, v), v += m.length;
4833
- for (let w = 0; w < p; w++) L[v++] = 32;
4834
- return _.setUint32(v, a, !0), v += 4, _.setUint32(v, Pi, !0), v += 4, L.set(d, v), v += a, C;
4834
+ l.push(M);
4835
+ }
4836
+ const u = { ...s, systems: l, assets: r }, h = new TextEncoder().encode(JSON.stringify(u)), p = bi(h.length), d = new Uint8Array(a);
4837
+ let S = 0;
4838
+ for (const B of n)
4839
+ d.set(B, S), S += B.length;
4840
+ const R = h.length + p, E = 20 + R + 8 + a, T = new ArrayBuffer(E), x = new DataView(T), L = new Uint8Array(T);
4841
+ let P = 0;
4842
+ x.setUint32(P, Pt, !0), P += 4, x.setUint32(P, vi, !0), P += 4, x.setUint32(P, E, !0), P += 4, x.setUint32(P, R, !0), P += 4, x.setUint32(P, Pi, !0), P += 4, L.set(h, P), P += h.length;
4843
+ for (let B = 0; B < p; B++) L[P++] = 32;
4844
+ return x.setUint32(P, a, !0), P += 4, x.setUint32(P, _i, !0), P += 4, L.set(d, P), P += a, T;
4835
4845
  }
4836
4846
  function Bi(s) {
4837
4847
  return !s || s.byteLength < 12 ? !1 : new DataView(s).getUint32(0, !0) === Pt;
4838
4848
  }
4839
- function wi(s) {
4849
+ function Mi(s) {
4840
4850
  const t = new DataView(s);
4841
4851
  if (t.getUint32(0, !0) !== Pt) throw new Error("[unpackHZFX] bad magic — not an .hzfx file");
4842
4852
  const e = t.getUint32(4, !0);
4843
- if (e !== xi) throw new Error(`[unpackHZFX] unsupported version ${e}`);
4853
+ if (e !== vi) throw new Error(`[unpackHZFX] unsupported version ${e}`);
4844
4854
  let i = 12, r = null, n = -1;
4845
4855
  const a = new Uint8Array(s);
4846
4856
  for (; i + 8 <= s.byteLength; ) {
4847
4857
  const p = t.getUint32(i, !0);
4848
4858
  i += 4;
4849
4859
  const d = t.getUint32(i, !0);
4850
- i += 4, d === vi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + p))) : d === Pi && (n = i), i += p;
4860
+ i += 4, d === Pi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + p))) : d === _i && (n = i), i += p;
4851
4861
  }
4852
4862
  if (!r) throw new Error("[unpackHZFX] missing JSON chunk");
4853
4863
  const o = r.assets || [], c = (p) => {
@@ -4856,25 +4866,25 @@ function wi(s) {
4856
4866
  }, l = (p) => p && typeof p == "object" && typeof p[qe] == "number", u = (r.systems || []).map((p) => {
4857
4867
  const d = { ...p };
4858
4868
  if (l(d.textureImageData)) {
4859
- const b = c(d.textureImageData[qe]);
4860
- d.textureImageData = b ? `data:${b.mime};base64,${yi(b.bytes)}` : void 0;
4869
+ const S = c(d.textureImageData[qe]);
4870
+ d.textureImageData = S ? `data:${S.mime};base64,${gi(S.bytes)}` : void 0;
4861
4871
  }
4862
4872
  if (l(d.glbModelData)) {
4863
- const b = c(d.glbModelData[qe]);
4864
- d.glbModelData = b ? yi(b.bytes) : void 0;
4873
+ const S = c(d.glbModelData[qe]);
4874
+ d.glbModelData = S ? gi(S.bytes) : void 0;
4865
4875
  }
4866
4876
  return d;
4867
- }), m = { ...r, systems: u };
4868
- return delete m.assets, m;
4877
+ }), h = { ...r, systems: u };
4878
+ return delete h.assets, h;
4869
4879
  }
4870
- function sr(s) {
4880
+ function nr(s) {
4871
4881
  const t = new Uint8Array(s);
4872
4882
  let e = "";
4873
4883
  for (let i = 0; i < t.byteLength; i++)
4874
4884
  e += String.fromCharCode(t[i]);
4875
4885
  return btoa(e);
4876
4886
  }
4877
- function rr(s) {
4887
+ function ar(s) {
4878
4888
  return {
4879
4889
  name: s.name,
4880
4890
  id: s.id,
@@ -4939,6 +4949,9 @@ function rr(s) {
4939
4949
  rotationMode: s.rotationMode,
4940
4950
  minRotation: s.minRotation,
4941
4951
  maxRotation: s.maxRotation,
4952
+ orientX: s.orientX,
4953
+ orientY: s.orientY,
4954
+ orientZ: s.orientZ,
4942
4955
  overrideXVelocity: s.overrideXVelocity,
4943
4956
  overrideYVelocity: s.overrideYVelocity,
4944
4957
  overrideZVelocity: s.overrideZVelocity,
@@ -5049,7 +5062,7 @@ function rr(s) {
5049
5062
  displayUnit: s.displayUnit || "m"
5050
5063
  };
5051
5064
  }
5052
- async function fr(s, t, e = "hzfx") {
5065
+ async function hr(s, t, e = "hzfx") {
5053
5066
  if (!s || !s.particleSystems || s.particleSystems.length === 0) {
5054
5067
  alert("No particle systems to save.");
5055
5068
  return;
@@ -5058,12 +5071,12 @@ async function fr(s, t, e = "hzfx") {
5058
5071
  const i = {
5059
5072
  version: "1.0",
5060
5073
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
5061
- systems: s.particleSystems.map(({ config: u, system: m }) => ({
5062
- ...rr(u),
5074
+ systems: s.particleSystems.map(({ config: u, system: h }) => ({
5075
+ ...ar(u),
5063
5076
  // single source of truth for config fields
5064
5077
  // Binary assets embedded so replaceSystems() can restore them
5065
5078
  textureImageData: u.textureEnabled && !u.glbModelEnabled && u.textureImageData ? u.textureImageData : void 0,
5066
- glbModelData: u.glbModelEnabled && m.glbRawArrayBuffer ? sr(m.glbRawArrayBuffer) : void 0
5079
+ glbModelData: u.glbModelEnabled && h.glbRawArrayBuffer ? nr(h.glbRawArrayBuffer) : void 0
5067
5080
  })),
5068
5081
  activeSystemIndex: s.activeSystemIndex,
5069
5082
  loop: s.loop || !1
@@ -5071,7 +5084,7 @@ async function fr(s, t, e = "hzfx") {
5071
5084
  }, r = e === "json" ? "json" : "hzfx";
5072
5085
  let n;
5073
5086
  if (r === "hzfx") {
5074
- const u = await ir(i, { textureFormat: "webp" });
5087
+ const u = await rr(i, { textureFormat: "webp" });
5075
5088
  n = new Blob([u], { type: "application/octet-stream" });
5076
5089
  } else
5077
5090
  n = new Blob([JSON.stringify(i, null, 2)], { type: "application/json" });
@@ -5088,7 +5101,7 @@ async function fr(s, t, e = "hzfx") {
5088
5101
  console.error("Error saving scene:", i), alert("Error saving scene. See console for details.");
5089
5102
  }
5090
5103
  }
5091
- function pr(s) {
5104
+ function mr(s) {
5092
5105
  return new Promise((t, e) => {
5093
5106
  try {
5094
5107
  const i = s.target.files[0];
@@ -5101,7 +5114,7 @@ function pr(s) {
5101
5114
  try {
5102
5115
  const a = n.target.result;
5103
5116
  let o;
5104
- if (Bi(a) ? o = wi(a) : o = JSON.parse(new TextDecoder().decode(a)), !Array.isArray(o.systems) || o.systems.length === 0)
5117
+ if (Bi(a) ? o = Mi(a) : o = JSON.parse(new TextDecoder().decode(a)), !Array.isArray(o.systems) || o.systems.length === 0)
5105
5118
  throw new Error("No valid particle systems found in the file");
5106
5119
  t({
5107
5120
  systems: o.systems.slice(),
@@ -5119,7 +5132,7 @@ function pr(s) {
5119
5132
  }
5120
5133
  });
5121
5134
  }
5122
- async function hr(s) {
5135
+ async function yr(s) {
5123
5136
  if (!s || typeof s != "string")
5124
5137
  throw new Error("[fetchPreset] url must be a non-empty string");
5125
5138
  const t = await fetch(s);
@@ -5127,7 +5140,7 @@ async function hr(s) {
5127
5140
  throw new Error(`[fetchPreset] HTTP ${t.status}: ${t.statusText}`);
5128
5141
  const e = await t.arrayBuffer();
5129
5142
  let i;
5130
- if (Bi(e) ? i = wi(e) : i = JSON.parse(new TextDecoder().decode(e)), !Array.isArray(i.systems) || i.systems.length === 0)
5143
+ if (Bi(e) ? i = Mi(e) : i = JSON.parse(new TextDecoder().decode(e)), !Array.isArray(i.systems) || i.systems.length === 0)
5131
5144
  throw new Error('[fetchPreset] Invalid preset: "systems" must be a non-empty array');
5132
5145
  return {
5133
5146
  version: i.version,
@@ -5135,7 +5148,7 @@ async function hr(s) {
5135
5148
  activeSystemIndex: i.activeSystemIndex ?? 0
5136
5149
  };
5137
5150
  }
5138
- const nr = (s) => `
5151
+ const or = (s) => `
5139
5152
  @vertex fn vs(@builtin(vertex_index) i: u32) -> @builtin(position) vec4f {
5140
5153
  var p = array<vec2f, 3>(vec2f(-1.0, -3.0), vec2f(-1.0, 1.0), vec2f(3.0, 1.0));
5141
5154
  return vec4f(p[i], 0.0, 1.0);
@@ -5145,51 +5158,51 @@ const nr = (s) => `
5145
5158
  return textureLoad(src, vec2i(pos.xy), 0);
5146
5159
  }
5147
5160
  `;
5148
- async function mr(s, t = {}) {
5161
+ async function gr(s, t = {}) {
5149
5162
  const { getSceneDepth: e = null, autoRespawn: i = !0 } = t;
5150
5163
  let r, n, a;
5151
5164
  const o = !!(s && s.device && s.context);
5152
- o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await Ys(a));
5153
- const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new js(r), u = { layouts: {}, pipelines: {} };
5154
- function m(f) {
5155
- const h = f ? "ms" : "ss";
5156
- if (!u.pipelines[h]) {
5157
- const S = r.createShaderModule({ code: nr(f) }), g = r.createBindGroupLayout({
5165
+ o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await qs(a));
5166
+ const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new Hs(r), u = { layouts: {}, pipelines: {} };
5167
+ function h(f) {
5168
+ const m = f ? "ms" : "ss";
5169
+ if (!u.pipelines[m]) {
5170
+ const b = r.createShaderModule({ code: or(f) }), g = r.createBindGroupLayout({
5158
5171
  entries: [{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "depth", multisampled: f } }]
5159
5172
  });
5160
- u.layouts[h] = g, u.pipelines[h] = r.createRenderPipeline({
5173
+ u.layouts[m] = g, u.pipelines[m] = r.createRenderPipeline({
5161
5174
  layout: r.createPipelineLayout({ bindGroupLayouts: [g] }),
5162
- vertex: { module: S, entryPoint: "vs" },
5163
- fragment: { module: S, entryPoint: "fs", targets: [] },
5175
+ vertex: { module: b, entryPoint: "vs" },
5176
+ fragment: { module: b, entryPoint: "fs", targets: [] },
5164
5177
  primitive: { topology: "triangle-list" },
5165
5178
  depthStencil: { format: "depth24plus", depthWriteEnabled: !0, depthCompare: "always" }
5166
5179
  });
5167
5180
  }
5168
- return { pipeline: u.pipelines[h], layout: u.layouts[h] };
5181
+ return { pipeline: u.pipelines[m], layout: u.layouts[m] };
5169
5182
  }
5170
5183
  const p = {
5171
5184
  bloomSourceTextures: {},
5172
5185
  bloomCompositeTextures: {},
5173
5186
  combinedTexture: null,
5174
- getBloomSourceTexture(f, h, S) {
5187
+ getBloomSourceTexture(f, m, b) {
5175
5188
  return this.bloomSourceTextures[f] || (this.bloomSourceTextures[f] = r.createTexture({
5176
- size: [h, S],
5189
+ size: [m, b],
5177
5190
  format: "rgba16float",
5178
5191
  // HDR chain (see webgpu.js HDR_FORMAT) — avoids additive clip
5179
5192
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5180
5193
  })), this.bloomSourceTextures[f];
5181
5194
  },
5182
- getBloomCompositeTexture(f, h, S) {
5195
+ getBloomCompositeTexture(f, m, b) {
5183
5196
  return this.bloomCompositeTextures[f] || (this.bloomCompositeTextures[f] = r.createTexture({
5184
- size: [h, S],
5197
+ size: [m, b],
5185
5198
  format: "rgba16float",
5186
5199
  // HDR chain
5187
5200
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5188
5201
  })), this.bloomCompositeTextures[f];
5189
5202
  },
5190
- getCombinedTexture(f, h) {
5203
+ getCombinedTexture(f, m) {
5191
5204
  return this.combinedTexture || (this.combinedTexture = r.createTexture({
5192
- size: [f, h],
5205
+ size: [f, m],
5193
5206
  format: "rgba16float",
5194
5207
  // HDR chain — tonemapped to canvas in the final pass
5195
5208
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
@@ -5214,151 +5227,154 @@ async function mr(s, t = {}) {
5214
5227
  clear() {
5215
5228
  this.systemBindGroups = {}, this.systemBloomHorizontalBindGroups = {}, this.secondHorizontalBindGroups = {}, this.systemBloomCompositeBindGroups = {}, this.combinedBloomCompositeBindGroups = {}, this.combinedInitialBindGroup = null, this.finalBindGroup = null, this.textureStates = {}, this.textureRefs = {};
5216
5229
  }
5217
- }, b = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), T = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), C = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), _ = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), L = De(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), v = {}, w = () => De(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);
5230
+ }, S = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), R = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), E = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), T = 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 = {}, B = () => 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);
5218
5231
  l.onSystemCreated = (f) => {
5219
- v[f] || (v[f] = w());
5232
+ P[f] || (P[f] = B());
5220
5233
  };
5221
- const R = 4e4, V = new Float32Array(R * 8), X = new Float32Array(R * 4), j = new Float32Array(R * 4), k = r.createBuffer({ size: R * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), D = r.createBuffer({ size: R * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), he = r.createBuffer({ size: R * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), ze = /* @__PURE__ */ new Map(), at = 8, $ = [];
5234
+ const M = 4e4, F = new Float32Array(M * 8), N = new Float32Array(M * 4), Y = new Float32Array(M * 4), k = r.createBuffer({ size: M * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), G = r.createBuffer({ size: M * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), pe = r.createBuffer({ size: M * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), De = /* @__PURE__ */ new Map(), at = 8, W = [];
5222
5235
  function _t(f) {
5223
- for (const h of $) if (h.ids.has(f)) return h;
5236
+ for (const m of W) if (m.ids.has(f)) return m;
5224
5237
  return null;
5225
5238
  }
5226
- function Ri(f, h) {
5239
+ function Ri(f, m) {
5227
5240
  if (!f.pos) return;
5228
- f.hist.push({ t: h, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
5229
- const S = h - at;
5230
- for (; f.hist.length > 2 && f.hist[0].t < S; ) f.hist.shift();
5231
- }
5232
- function Bt(f, h) {
5233
- const S = f.hist;
5234
- if (S.length === 0) return f.pos;
5235
- if (h >= S[S.length - 1].t) {
5236
- const g = S[S.length - 1];
5237
- return [g.x, g.y, g.z];
5241
+ f.hist.push({ t: m, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
5242
+ const b = m - at;
5243
+ for (; f.hist.length > 2 && f.hist[0].t < b; ) f.hist.shift();
5244
+ }
5245
+ function wt(f, m, b) {
5246
+ const g = f.hist;
5247
+ if (g.length === 0) {
5248
+ const H = f.pos;
5249
+ return H && (b[0] = H[0], b[1] = H[1], b[2] = H[2]), b;
5238
5250
  }
5239
- if (h <= S[0].t) return [S[0].x, S[0].y, S[0].z];
5240
- for (let g = S.length - 1; g > 0; g--)
5241
- if (S[g - 1].t <= h) {
5242
- const x = S[g - 1], J = S[g], H = (h - x.t) / Math.max(1e-6, J.t - x.t);
5243
- return [x.x + (J.x - x.x) * H, x.y + (J.y - x.y) * H, x.z + (J.z - x.z) * H];
5251
+ let v;
5252
+ if (m >= g[g.length - 1].t)
5253
+ return v = g[g.length - 1], b[0] = v.x, b[1] = v.y, b[2] = v.z, b;
5254
+ if (m <= g[0].t)
5255
+ return v = g[0], b[0] = v.x, b[1] = v.y, b[2] = v.z, b;
5256
+ for (let H = g.length - 1; H > 0; H--)
5257
+ if (g[H - 1].t <= m) {
5258
+ const j = g[H - 1], Q = g[H], Z = (m - j.t) / Math.max(1e-6, Q.t - j.t);
5259
+ return b[0] = j.x + (Q.x - j.x) * Z, b[1] = j.y + (Q.y - j.y) * Z, b[2] = j.z + (Q.z - j.z) * Z, b;
5244
5260
  }
5245
- return [S[0].x, S[0].y, S[0].z];
5261
+ return v = g[0], b[0] = v.x, b[1] = v.y, b[2] = v.z, b;
5246
5262
  }
5247
- const Mi = 0.41421356;
5248
- function Ti() {
5249
- ze.clear();
5250
- let f = 0, h = 0;
5263
+ const Ti = 0.41421356;
5264
+ function Ei() {
5265
+ De.clear();
5266
+ let f = 0, m = 0;
5251
5267
  A.position[0], A.position[1], A.position[2];
5252
- for (const { system: S, config: g } of l.particleSystems) {
5268
+ for (const { system: b, config: g } of l.particleSystems) {
5253
5269
  if (!g.emissionTrailEnabled || g.hidden || g.glbModelEnabled) continue;
5254
- S.readbackAndProcessParticles();
5255
- const x = S.particleData, J = S.particleVelocities, H = S.activeParticles;
5256
- if (!x || !J || H <= 0) continue;
5257
- const de = g.emissionTrailMode === "particles", q = 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)), z = g.emissionTrailShape || "straight", W = g.followSystemTranslation ?? !0, Q = S._simPosition, N = W && Q ? Q[0] : 0, Ke = W && Q ? Q[1] : 0, Ft = W && Q ? Q[2] : 0, Ue = S._simVelocity, Ot = Ue ? Ue[0] : 0, es = Ue ? Ue[1] : 0, Lt = Ue ? Ue[2] : 0, Fe = _t(g.id), Nt = !!(W && Fe && Fe.hist && Fe.hist.length > 1);
5258
- for (let et = 0; et < H; et++) {
5259
- const ye = et * 8, tt = x[ye], ft = x[ye + 1], it = x[ye + 2], ts = tt + N, is = ft + Ke, ss = it + Ft;
5260
- let Oe = x[ye + 3], Le = x[ye + 4], Ne = x[ye + 5];
5261
- const Xe = x[ye + 6], Ie = x[ye + 7];
5262
- if (Xe >= Ie || Ie <= 0) continue;
5263
- const ge = Xe / Ie;
5270
+ b.readbackAndProcessParticles();
5271
+ const v = b.particleData, H = b.particleVelocities, j = b.activeParticles;
5272
+ if (!v || !H || j <= 0) continue;
5273
+ const Q = g.emissionTrailMode === "particles", Z = f, Ae = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1, w = 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 = b._simPosition, X = J && K ? K[0] : 0, Ke = J && K ? K[1] : 0, Ot = J && K ? K[2] : 0, Ue = b._simVelocity, Lt = Ue ? Ue[0] : 0, ts = Ue ? Ue[1] : 0, Xt = Ue ? Ue[2] : 0, Ve = _t(g.id), Nt = !!(J && Ve && Ve.hist && Ve.hist.length > 1);
5274
+ for (let et = 0; et < j; et++) {
5275
+ const ye = et * 8, tt = v[ye], ft = v[ye + 1], it = v[ye + 2], is = tt + X, ss = ft + Ke, rs = it + Ot;
5276
+ let Oe = v[ye + 3], Le = v[ye + 4], Xe = v[ye + 5];
5277
+ const Ne = v[ye + 6], Ie = v[ye + 7];
5278
+ if (Ne >= Ie || Ie <= 0) continue;
5279
+ const ge = Ne / Ie;
5264
5280
  if (g.colorTransitionEnabled) {
5265
- const P = g.startColor ?? [1, 0, 0], G = g.endColor ?? [0, 0, 1];
5266
- Oe = P[0] + (G[0] - P[0]) * ge, Le = P[1] + (G[1] - P[1]) * ge, Ne = P[2] + (G[2] - P[2]) * ge;
5281
+ const _ = g.startColor ?? [1, 0, 0], z = g.endColor ?? [0, 0, 1];
5282
+ Oe = _[0] + (z[0] - _[0]) * ge, Le = _[1] + (z[1] - _[1]) * ge, Xe = _[2] + (z[2] - _[2]) * ge;
5267
5283
  }
5268
- Oe = Math.min(1, Oe * U), Le = Math.min(1, Le * U), Ne = Math.min(1, Ne * U);
5269
- let ke = B;
5284
+ Oe = Math.min(1, Oe * U), Le = Math.min(1, Le * U), Xe = Math.min(1, Xe * U);
5285
+ let ke = w;
5270
5286
  if (g.randomSize) {
5271
- const P = Math.sin(Ie * 54321.67) * 43758.5453 % 1, G = P < 0 ? P + 1 : P;
5272
- ke = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * G;
5287
+ const _ = Math.sin(Ie * 54321.67) * 43758.5453 % 1, z = _ < 0 ? _ + 1 : _;
5288
+ ke = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * z;
5273
5289
  }
5274
5290
  if (g.fadeSizeEnabled) {
5275
- const P = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5276
- ke *= 1 - Math.pow(ge, 1 / P);
5291
+ const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5292
+ ke *= 1 - Math.pow(ge, 1 / _);
5277
5293
  }
5278
5294
  if (g.increaseSizeEnabled) {
5279
- const P = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5280
- ke *= 1 + Math.pow(ge, 1 / P);
5295
+ const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5296
+ ke *= 1 + Math.pow(ge, 1 / _);
5281
5297
  }
5282
5298
  if (ke <= 0 || ge > 0.9) continue;
5283
- const Xt = Math.min((0.9 - ge) * (1 / 0.2), 1), kt = 0.75 * ke * Mi * Xt;
5299
+ const kt = Math.min((0.9 - ge) * (1 / 0.2), 1), jt = 0.75 * ke * Ti * kt;
5284
5300
  let je = y;
5285
- if (g.fadeEnabled && (je *= Math.max(0, 1 - ge)), je *= Xt, je < 0.01) continue;
5286
- const pt = et * 4, jt = J[pt], Yt = J[pt + 1], Ht = J[pt + 2], st = jt + Ot, rt = Yt + es, nt = Ht + Lt, qt = Math.sqrt(st * st + rt * rt + nt * nt);
5287
- if (qt < 1e-3) continue;
5288
- const ht = 1 / qt, Pe = st * ht, _e = rt * ht, be = nt * ht, Zt = A.right[0], $t = A.right[1], Wt = A.right[2];
5289
- let mt = Zt * Pe + $t * _e + Wt * be, re = Zt - mt * Pe, ne = $t - mt * _e, ae = Wt - mt * be, Ye = Math.sqrt(re * re + ne * ne + ae * ae);
5301
+ if (g.fadeEnabled && (je *= Math.max(0, 1 - ge)), je *= kt, je < 0.01) continue;
5302
+ const pt = et * 4, Yt = H[pt], Ht = H[pt + 1], qt = H[pt + 2], st = Yt + Lt, rt = Ht + ts, nt = qt + Xt, Zt = Math.sqrt(st * st + rt * rt + nt * nt);
5303
+ if (Zt < 1e-3) continue;
5304
+ const ht = 1 / Zt, Pe = st * ht, _e = rt * ht, be = nt * ht, $t = A.right[0], Wt = A.right[1], Jt = A.right[2];
5305
+ let mt = $t * Pe + Wt * _e + Jt * be, ne = $t - mt * Pe, ae = Wt - mt * _e, oe = Jt - mt * be, Ye = Math.sqrt(ne * ne + ae * ae + oe * oe);
5290
5306
  if (Ye < 0.2) {
5291
- const P = A.up[0], G = A.up[1], Z = A.up[2], F = P * Pe + G * _e + Z * be;
5292
- re = P - F * Pe, ne = G - F * _e, ae = Z - F * be, Ye = Math.sqrt(re * re + ne * ne + ae * ae) || 1;
5307
+ const _ = A.up[0], z = A.up[1], $ = A.up[2], V = _ * Pe + z * _e + $ * be;
5308
+ ne = _ - V * Pe, ae = z - V * _e, oe = $ - V * be, Ye = Math.sqrt(ne * ne + ae * ae + oe * oe) || 1;
5293
5309
  }
5294
- re /= Ye, ne /= Ye, ae /= Ye;
5295
- const He = Math.min(Ae, Xe);
5310
+ ne /= Ye, ae /= Ye, oe /= Ye;
5311
+ const He = Math.min(Ae, Ne);
5296
5312
  if (He < 1e-3) continue;
5297
- const Jt = g.gravityEnabled && g.gravityStrength || 0, Be = Fi, we = Oi, Re = Li;
5313
+ const Qt = g.gravityEnabled && g.gravityStrength || 0, we = Oi, Be = Li, Me = Xi;
5298
5314
  if (g.orientToDirection && g.burstMode && Nt) {
5299
- const P = S._emitSimRotY || 0, G = Ni, Z = Xi, F = ki;
5300
- for (let E = 0; E <= I; E++) {
5301
- const O = Bt(Fe, me - E / I * He);
5302
- G[E] = O[0], Z[E] = O[1], F[E] = O[2];
5315
+ const _ = b._emitSimRotY || 0, z = Ni, $ = ki, V = ji;
5316
+ for (let C = 0; C <= I; C++) {
5317
+ const O = wt(Ve, me - C / I * He, It);
5318
+ z[C] = O[0], $[C] = O[1], V[C] = O[2];
5303
5319
  }
5304
- for (let E = 0; E <= I; E++) {
5305
- const O = E > 0 ? E - 1 : 0, Y = E < I ? E + 1 : I;
5306
- let Me = G[O] - G[Y], Te = F[O] - F[Y];
5307
- const Se = (Math.hypot(Me, Te) > 1e-5 ? Math.atan2(Me, Te) : Math.atan2(Ot, Lt)) - P, ie = Math.cos(Se), se = Math.sin(Se), pe = E / I * He, yt = -0.5 * Jt * pe * pe;
5308
- Be[E] = ie * tt + se * it + G[E], we[E] = ft + yt + Z[E], Re[E] = -se * tt + ie * it + F[E];
5320
+ for (let C = 0; C <= I; C++) {
5321
+ const O = C > 0 ? C - 1 : 0, q = C < I ? C + 1 : I;
5322
+ let Re = z[O] - z[q], Te = V[O] - V[q];
5323
+ const Se = (Math.hypot(Re, Te) > 1e-5 ? Math.atan2(Re, Te) : Math.atan2(Lt, Xt)) - _, ie = Math.cos(Se), se = Math.sin(Se), fe = C / I * He, yt = -0.5 * Qt * fe * fe;
5324
+ we[C] = ie * tt + se * it + z[C], Be[C] = ft + yt + $[C], Me[C] = -se * tt + ie * it + V[C];
5309
5325
  }
5310
- } else for (let P = 0; P <= I; P++) {
5311
- const G = P / I * He, Z = -0.5 * Jt * G * G;
5326
+ } else for (let _ = 0; _ <= I; _++) {
5327
+ const z = _ / I * He, $ = -0.5 * Qt * z * z;
5312
5328
  if (Nt) {
5313
- const F = Bt(Fe, me - G);
5314
- Be[P] = tt - jt * G + F[0], we[P] = ft - Yt * G + Z + F[1], Re[P] = it - Ht * G + F[2];
5329
+ const V = wt(Ve, me - z, It);
5330
+ we[_] = tt - Yt * z + V[0], Be[_] = ft - Ht * z + $ + V[1], Me[_] = it - qt * z + V[2];
5315
5331
  } else
5316
- Be[P] = ts - st * G, we[P] = is - rt * G + Z, Re[P] = ss - nt * G;
5332
+ we[_] = is - st * z, Be[_] = ss - rt * z + $, Me[_] = rs - nt * z;
5317
5333
  }
5318
- if (z !== "straight") {
5319
- const P = g.emissionTrailShapeAmplitude ?? 0.1, G = g.emissionTrailShapeFrequency ?? 4, Z = g.emissionTrailShapeSpeed ?? 0;
5320
- let F = -be, E = 0, O = Pe, Y = Math.sqrt(F * F + O * O);
5321
- Y < 1e-6 && (F = 0, E = be, O = -_e, Y = Math.sqrt(F * F + E * E + O * O) || 1), F /= Y, E /= Y, O /= Y;
5322
- const Me = _e * O - be * E, Te = be * F - Pe * O, fe = Pe * E - _e * F;
5323
- for (let K = 1; K <= I; K++) {
5324
- const Se = K / I * He, ie = 2 * Math.PI * G * (me - Se) + Z * me;
5325
- let se = 0, pe = 0;
5326
- z === "zigzag" ? se = P * Math.sign(Math.sin(ie)) : z === "sine" ? se = P * Math.sin(ie) : z === "spiral" && (se = P * Math.sin(ie), pe = P * Math.cos(ie)), Be[K] += F * se + Me * pe, we[K] += E * se + Te * pe, Re[K] += O * se + fe * pe;
5334
+ if (D !== "straight") {
5335
+ const _ = g.emissionTrailShapeAmplitude ?? 0.1, z = g.emissionTrailShapeFrequency ?? 4, $ = g.emissionTrailShapeSpeed ?? 0;
5336
+ let V = -be, C = 0, O = Pe, q = Math.sqrt(V * V + O * O);
5337
+ q < 1e-6 && (V = 0, C = be, O = -_e, q = Math.sqrt(V * V + C * C + O * O) || 1), V /= q, C /= q, O /= q;
5338
+ const Re = _e * O - be * C, Te = be * V - Pe * O, de = Pe * C - _e * V;
5339
+ for (let ee = 1; ee <= I; ee++) {
5340
+ const Se = ee / I * He, ie = 2 * Math.PI * z * (me - Se) + $ * me;
5341
+ let se = 0, fe = 0;
5342
+ D === "zigzag" ? se = _ * Math.sign(Math.sin(ie)) : D === "sine" ? se = _ * Math.sin(ie) : D === "spiral" && (se = _ * Math.sin(ie), fe = _ * Math.cos(ie)), we[ee] += V * se + Re * fe, Be[ee] += C * se + Te * fe, Me[ee] += O * se + de * fe;
5327
5343
  }
5328
5344
  }
5329
- if (de)
5330
- for (let P = 1; P <= I && f < R; P++) {
5331
- const G = P / I, Z = Be[P] - N, F = we[P] - Ke, E = Re[P] - Ft, O = f * 8, Y = f * 4;
5332
- V[O] = Z, V[O + 1] = F, V[O + 2] = E, V[O + 3] = Oe, V[O + 4] = Le, V[O + 5] = Ne, V[O + 6] = Xe + (Ie - Xe) * G, V[O + 7] = Ie, X[Y] = 0, X[Y + 1] = 0, X[Y + 2] = 0, X[Y + 3] = 0, j[Y] = Z, j[Y + 1] = F, j[Y + 2] = E, j[Y + 3] = 0, f++;
5345
+ if (Q)
5346
+ for (let _ = 1; _ <= I && f < M; _++) {
5347
+ const z = _ / I, $ = we[_] - X, V = Be[_] - Ke, C = Me[_] - Ot, O = f * 8, q = f * 4;
5348
+ F[O] = $, F[O + 1] = V, F[O + 2] = C, F[O + 3] = Oe, F[O + 4] = Le, F[O + 5] = Xe, F[O + 6] = Ne + (Ie - Ne) * z, F[O + 7] = Ie, N[q] = 0, N[q + 1] = 0, N[q + 2] = 0, N[q + 3] = 0, Y[q] = $, Y[q + 1] = V, Y[q + 2] = C, Y[q + 3] = 0, f++;
5333
5349
  }
5334
5350
  else
5335
- for (let P = 0; P < I && !(h + 42 > ce.length); P++) {
5336
- const G = P / I, Z = (P + 1) / I, F = Be[P], E = we[P], O = Re[P], Y = Be[P + 1], Me = we[P + 1], Te = Re[P + 1], fe = kt * (1 - G), K = kt * (1 - Z), Se = je * (1 - G) * (1 - G), ie = je * (1 - Z) * (1 - Z), se = F + re * fe, pe = E + ne * fe, yt = O + ae * fe, Qt = F - re * fe, Kt = E - ne * fe, ei = O - ae * fe, ti = Y + re * K, ii = Me + ne * K, si = Te + ae * K, rs = Y - re * K, ns = Me - ne * K, as = Te - ae * K, Ge = (os, ls, cs, us) => {
5337
- ce[h++] = os, ce[h++] = ls, ce[h++] = cs, ce[h++] = Oe, ce[h++] = Le, ce[h++] = Ne, ce[h++] = us;
5351
+ for (let _ = 0; _ < I && !(m + 42 > ce.length); _++) {
5352
+ const z = _ / I, $ = (_ + 1) / I, V = we[_], C = Be[_], O = Me[_], q = we[_ + 1], Re = Be[_ + 1], Te = Me[_ + 1], de = jt * (1 - z), ee = jt * (1 - $), Se = je * (1 - z) * (1 - z), ie = je * (1 - $) * (1 - $), se = V + ne * de, fe = C + ae * de, yt = O + oe * de, Kt = V - ne * de, ei = C - ae * de, ti = O - oe * de, ii = q + ne * ee, si = Re + ae * ee, ri = Te + oe * ee, ns = q - ne * ee, as = Re - ae * ee, os = Te - oe * ee, ze = (ls, cs, us, ds) => {
5353
+ ce[m++] = ls, ce[m++] = cs, ce[m++] = us, ce[m++] = Oe, ce[m++] = Le, ce[m++] = Xe, ce[m++] = ds;
5338
5354
  };
5339
- Ge(se, pe, yt, Se), Ge(Qt, Kt, ei, Se), Ge(ti, ii, si, ie), Ge(Qt, Kt, ei, Se), Ge(rs, ns, as, ie), Ge(ti, ii, si, ie);
5355
+ ze(se, fe, yt, Se), ze(Kt, ei, ti, Se), ze(ii, si, ri, ie), ze(Kt, ei, ti, Se), ze(ns, as, os, ie), ze(ii, si, ri, ie);
5340
5356
  }
5341
5357
  }
5342
- de && f > q && ze.set(g.id, { first: q, count: f - q });
5358
+ Q && f > Z && De.set(g.id, { first: Z, count: f - Z });
5343
5359
  }
5344
- f > 0 && (r.queue.writeBuffer(k, 0, V, 0, f * 8), r.queue.writeBuffer(D, 0, X, 0, f * 4), r.queue.writeBuffer(he, 0, j, 0, f * 4)), Ve = h / 7, Ve > 0 && r.queue.writeBuffer(At, 0, ce, 0, h);
5360
+ f > 0 && (r.queue.writeBuffer(k, 0, F, 0, f * 8), r.queue.writeBuffer(G, 0, N, 0, f * 4), r.queue.writeBuffer(pe, 0, Y, 0, f * 4)), Fe = m / 7, Fe > 0 && r.queue.writeBuffer(At, 0, ce, 0, m);
5345
5361
  }
5346
- const wt = () => {
5347
- r.queue.writeBuffer(T, 0, new Float32Array([1, 0, a.width, a.height, 0, 0, 0, 0])), r.queue.writeBuffer(C, 0, new Float32Array([0, 1, a.width, a.height, 0, 0, 0, 0]));
5362
+ const Bt = () => {
5363
+ r.queue.writeBuffer(E, 0, new Float32Array([1, 0, a.width, a.height, 0, 0, 0, 0])), r.queue.writeBuffer(T, 0, new Float32Array([0, 1, a.width, a.height, 0, 0, 0, 0]));
5348
5364
  };
5349
- wt();
5350
- const Rt = new Float32Array(16).fill(0);
5351
- Rt[0] = 1, r.queue.writeBuffer(_, 0, Rt);
5352
- const ee = Ws(r), le = Zs(r), {
5353
- particlePipeline: Ei,
5354
- particleAdditivePipeline: Ci,
5355
- particleDepthWritePipeline: Ai,
5365
+ Bt();
5366
+ const Mt = new Float32Array(16).fill(0);
5367
+ Mt[0] = 1, r.queue.writeBuffer(x, 0, Mt);
5368
+ const re = Qs(r), he = Ws(r), {
5369
+ particlePipeline: Ci,
5370
+ particleAdditivePipeline: Ai,
5371
+ particleDepthWritePipeline: Ui,
5356
5372
  blurPipeline: $e,
5357
- compositePipeline: Ui,
5358
- directRenderPipeline: Mt,
5359
- finalCompositePipeline: Ii,
5373
+ compositePipeline: Ii,
5374
+ directRenderPipeline: Rt,
5375
+ finalCompositePipeline: zi,
5360
5376
  glbMeshPipeline: Gi
5361
- } = $s(r, c, le), Tt = r.createShaderModule({ code: `
5377
+ } = Js(r, c, he), Tt = r.createShaderModule({ code: `
5362
5378
  struct U { mvp: mat4x4<f32> };
5363
5379
  @group(0) @binding(0) var<uniform> u: U;
5364
5380
  struct VIn { @location(0) pos: vec3<f32>, @location(1) col: vec4<f32> };
@@ -5394,13 +5410,13 @@ async function mr(s, t = {}) {
5394
5410
  size: Ct * 7 * 4,
5395
5411
  usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
5396
5412
  label: "ribbonBuffer"
5397
- }), zi = r.createBindGroup({
5413
+ }), Fi = r.createBindGroup({
5398
5414
  layout: Et,
5399
- entries: [{ binding: 0, resource: { buffer: b } }]
5415
+ entries: [{ binding: 0, resource: { buffer: S } }]
5400
5416
  });
5401
- let Ve = 0, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue } = fi(r, c, a.width, a.height), ve = pi(r, a.width, a.height);
5402
- const ot = { uniformBuffer: b, appearanceUniformBuffer: M, horizontalBlurUniformBuffer: T, verticalBlurUniformBuffer: C, bloomIntensityBuffer: _ };
5403
- let We = St(r, ee, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue });
5417
+ let Fe = 0, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue } = pi(r, c, a.width, a.height), ve = hi(r, a.width, a.height);
5418
+ const ot = { uniformBuffer: S, appearanceUniformBuffer: R, horizontalBlurUniformBuffer: E, verticalBlurUniformBuffer: T, bloomIntensityBuffer: x };
5419
+ let We = St(r, re, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue });
5404
5420
  const A = {
5405
5421
  mvp: new Float32Array(16),
5406
5422
  position: new Float32Array([0, 0, 10]),
@@ -5410,26 +5426,26 @@ async function mr(s, t = {}) {
5410
5426
  hasCamera: !1
5411
5427
  };
5412
5428
  let me = 0, Vi = 0;
5413
- const Ee = new Float32Array(5), Ut = new Float32Array(16), Fi = new Array(65), Oi = new Array(65), Li = new Array(65), Ni = new Array(65), Xi = new Array(65), ki = new Array(65), Ce = { key: null, ms: !1, bindGroup: null };
5414
- let It = !1, lt = !0, Je = !1, Qe = null, ct = a.width, ut = a.height;
5429
+ const Ee = new Float32Array(5), Ut = new Float32Array(16), Oi = new Array(65), Li = new Array(65), Xi = new Array(65), Ni = new Array(65), ki = new Array(65), ji = new Array(65), It = [0, 0, 0], Ce = { key: null, ms: !1, bindGroup: null };
5430
+ let zt = !1, lt = !0, Je = !1, Qe = null, ct = a.width, ut = a.height;
5415
5431
  function Gt() {
5416
- const f = [te, xe, ue, ve], h = fi(r, c, a.width, a.height);
5417
- te = h.sceneTexture, xe = h.bloomTexA, ue = h.bloomTexB, ve = pi(r, a.width, a.height), wt(), d.clear(), p.resizeTextures(), We = St(r, ee, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue });
5418
- let S = !1;
5432
+ const f = [te, xe, ue, ve], m = pi(r, c, a.width, a.height);
5433
+ te = m.sceneTexture, xe = m.bloomTexA, ue = m.bloomTexB, ve = hi(r, a.width, a.height), Bt(), d.clear(), p.resizeTextures(), We = St(r, re, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue });
5434
+ let b = !1;
5419
5435
  const g = () => {
5420
- if (!S) {
5421
- S = !0, requestAnimationFrame(g);
5436
+ if (!b) {
5437
+ b = !0, requestAnimationFrame(g);
5422
5438
  return;
5423
5439
  }
5424
- f.forEach((x) => x.destroy());
5440
+ f.forEach((v) => v.destroy());
5425
5441
  };
5426
5442
  requestAnimationFrame(g);
5427
5443
  }
5428
- function ji(f, h, S) {
5429
- A.mvp.set(er(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;
5444
+ function Yi(f, m, b) {
5445
+ A.mvp.set(ir(f, m)), m && m.length >= 10 && (A.right[0] = m[0], A.right[1] = m[4], A.right[2] = m[8], A.up[0] = m[1], A.up[1] = m[5], A.up[2] = m[9]), b && (A.position[0] = b.x ?? b[0], A.position[1] = b.y ?? b[1], A.position[2] = b.z ?? b[2]), A.hasCamera = !0;
5430
5446
  }
5431
- function Yi(f, h) {
5432
- 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;
5447
+ function Hi(f, m) {
5448
+ A.mvp.set(f), m && (A.position[0] = m.x ?? m[0], A.position[1] = m.y ?? m[1], A.position[2] = m.z ?? m[2]), A.hasCamera = !0;
5433
5449
  }
5434
5450
  async function dt(f) {
5435
5451
  if (Je) {
@@ -5438,158 +5454,158 @@ async function mr(s, t = {}) {
5438
5454
  }
5439
5455
  Je = !0;
5440
5456
  try {
5441
- for (const h in v) delete v[h];
5442
- d.clear(), p.resizeTextures(), We = St(r, ee, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5443
- for (const h of f)
5444
- await l.addSystems(h.preset, h.position || [0, 0, 0]);
5445
- for (const { config: h } of l.particleSystems)
5446
- v[h.id] || (v[h.id] = w());
5457
+ for (const m in P) delete P[m];
5458
+ d.clear(), p.resizeTextures(), We = St(r, re, ot, { sceneTexture: te, bloomTexA: xe, bloomTexB: ue }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5459
+ for (const m of f)
5460
+ await l.addSystems(m.preset, m.position || [0, 0, 0]);
5461
+ for (const { config: m } of l.particleSystems)
5462
+ P[m.id] || (P[m.id] = B());
5447
5463
  lt = !0, l.respawnAllSystems();
5448
5464
  } finally {
5449
5465
  if (Je = !1, Qe) {
5450
- const h = Qe;
5451
- Qe = null, dt(h);
5466
+ const m = Qe;
5467
+ Qe = null, dt(m);
5452
5468
  }
5453
5469
  }
5454
5470
  }
5455
- async function Hi(f, h = [0, 0, 0]) {
5456
- return dt([{ preset: f, position: h }]);
5471
+ async function qi(f, m = [0, 0, 0]) {
5472
+ return dt([{ preset: f, position: m }]);
5457
5473
  }
5458
- function qi(f) {
5459
- if (It || Je || !l.ready || f <= 0 || l.particleSystems.length === 0) return;
5460
- const h = l.clock;
5461
- if (h && (h.loop = l.loop ?? i, h.duration = l.getTotalDuration(), f = h.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
5462
- if ((a.width !== ct || a.height !== ut) && (ct = a.width, ut = a.height, Gt()), me += f, $.length) {
5463
- for (const y of $) {
5474
+ function Zi(f) {
5475
+ if (zt || Je || !l.ready || f <= 0 || l.particleSystems.length === 0) return;
5476
+ const m = l.clock;
5477
+ if (m && (m.loop = l.loop ?? i, m.duration = l.getTotalDuration(), f = m.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
5478
+ if ((a.width !== ct || a.height !== ut) && (ct = a.width, ut = a.height, Gt()), me += f, W.length) {
5479
+ for (const y of W) {
5464
5480
  if (y.getPosition) {
5465
- const B = y.getPosition();
5466
- B ? (y.pos || (y.pos = y._posBuf), Array.isArray(B) ? (y.pos[0] = B[0], y.pos[1] = B[1], y.pos[2] = B[2]) : (y.pos[0] = B.x, y.pos[1] = B.y, y.pos[2] = B.z)) : y.pos = null;
5481
+ const w = y.getPosition();
5482
+ w ? (y.pos || (y.pos = y._posBuf), Array.isArray(w) ? (y.pos[0] = w[0], y.pos[1] = w[1], y.pos[2] = w[2]) : (y.pos[0] = w.x, y.pos[1] = w.y, y.pos[2] = w.z)) : y.pos = null;
5467
5483
  }
5468
5484
  y.vel = y._velBuf, y.pos && y.prevPos && y.wasActive && f > 0 ? (y.vel[0] = (y.pos[0] - y.prevPos[0]) / f, y.vel[1] = (y.pos[1] - y.prevPos[1]) / f, y.vel[2] = (y.pos[2] - y.prevPos[2]) / f) : (y.vel[0] = 0, y.vel[1] = 0, y.vel[2] = 0), y.justResumed = !!y.pos && !y.wasActive, y.justResumed && (y.hist.length = 0);
5469
5485
  }
5470
- for (const { system: y, config: B } of l.particleSystems) {
5471
- const U = _t(B.id);
5472
- if (!(!U || U.historyOnly) && (B.hidden = !U.pos, U.pos)) {
5486
+ for (const { system: y, config: w } of l.particleSystems) {
5487
+ const U = _t(w.id);
5488
+ if (!(!U || U.historyOnly) && (w.hidden = !U.pos, U.pos)) {
5473
5489
  let I = null;
5474
5490
  if (U.orientToDirection && U.vel) {
5475
- const z = U.vel[0], W = U.vel[2];
5476
- Math.hypot(z, W) > 1e-4 && (I = [0, 0, Math.atan2(z, W)]);
5491
+ const D = U.vel[0], J = U.vel[2];
5492
+ Math.hypot(D, J) > 1e-4 && (I = [0, 0, Math.atan2(D, J)]);
5477
5493
  }
5478
5494
  y.setSimulationTransform({ position: U.pos, velocity: U.vel, rotation: I }), y.updateAppearanceUniform(), (U.justResumed || y.activeParticles === 0) && y.spawnParticles();
5479
5495
  }
5480
5496
  }
5481
- for (const y of $)
5497
+ for (const y of W)
5482
5498
  y.pos ? Ri(y, me) : y.hist.length = 0, y.prevPos = y.pos ? y.pos.slice() : null, y.wasActive = !!y.pos;
5483
5499
  if (globalThis.__HZFX_DEBUG && (Vi++ & 63) === 0) {
5484
- const y = l.particleSystems.reduce((z, W) => z + (W.system.activeParticles | 0), 0), B = $.find((z) => z.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 = $.map((z) => `{ids:[${[...z.ids]}],pos:${z.pos ? "1" : "0"},hist:${z.hist.length}}`).join(",");
5485
- console.info(`[HZFX] movingGroups(${$.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${Ve} camDist=${U} t=${me.toFixed(1)}`);
5500
+ const y = l.particleSystems.reduce((D, J) => D + (J.system.activeParticles | 0), 0), w = W.find((D) => D.pos), U = w ? Math.hypot(A.position[0] - w.pos[0], A.position[1] - w.pos[1], A.position[2] - w.pos[2]).toFixed(1) : "-", I = W.map((D) => `{ids:[${[...D.ids]}],pos:${D.pos ? "1" : "0"},hist:${D.hist.length}}`).join(",");
5501
+ console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${Fe} camDist=${U} t=${me.toFixed(1)}`);
5486
5502
  }
5487
5503
  }
5488
- if (l.updateAllSystems(f), h ? h.loop : l.loop ?? i) {
5489
- const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system: B }) => B.activeParticles === 0 && !B.emitting);
5490
- (h && h.justLooped || y && lt) && l.respawnAllSystems(), lt = !y;
5504
+ if (l.updateAllSystems(f), m ? m.loop : l.loop ?? i) {
5505
+ const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system: w }) => w.activeParticles === 0 && !w.emitting);
5506
+ (m && m.justLooped || y && lt) && l.respawnAllSystems(), lt = !y;
5491
5507
  }
5492
- for (const { system: y, config: B } of l.particleSystems)
5493
- B.glbModelEnabled && y.glbAnimator && (y.glbAnimator.update(f), y.updateAnimatedGLBBuffer());
5494
- 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] = me, r.queue.writeBuffer(b, 64, Ee), Ti();
5495
- const g = l.particleSystems.some(({ config: y }) => y.bloomEnabled), x = r.createCommandEncoder();
5496
- let J = !1;
5508
+ for (const { system: y, config: w } of l.particleSystems)
5509
+ w.glbModelEnabled && y.glbAnimator && (y.glbAnimator.update(f), y.updateAnimatedGLBBuffer());
5510
+ r.queue.writeBuffer(S, 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] = me, r.queue.writeBuffer(S, 64, Ee), Ei();
5511
+ const g = l.particleSystems.some(({ config: y }) => y.bloomEnabled), v = r.createCommandEncoder();
5512
+ let H = !1;
5497
5513
  if (e)
5498
5514
  try {
5499
5515
  const y = e();
5500
5516
  if (y) {
5501
- let B = null, U = null, I = !1;
5502
- 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) {
5503
- const { pipeline: z, layout: W } = m(I);
5504
- (Ce.key !== B || Ce.ms !== I) && (Ce.key = B, Ce.ms = I, Ce.bindGroup = r.createBindGroup({
5505
- layout: W,
5517
+ let w = null, U = null, I = !1;
5518
+ if (y instanceof GPUTexture ? y.width === a.width && y.height === a.height && (w = y, U = () => y.createView({ aspect: "depth-only" }), I = y.sampleCount > 1) : y.view && (w = y.view, U = () => y.view, I = !!y.multisampled), w) {
5519
+ const { pipeline: D, layout: J } = h(I);
5520
+ (Ce.key !== w || Ce.ms !== I) && (Ce.key = w, Ce.ms = I, Ce.bindGroup = r.createBindGroup({
5521
+ layout: J,
5506
5522
  entries: [{ binding: 0, resource: U() }]
5507
5523
  }));
5508
- const Q = x.beginRenderPass({
5524
+ const K = v.beginRenderPass({
5509
5525
  colorAttachments: [],
5510
5526
  depthStencilAttachment: { view: ve.createView(), depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5511
5527
  });
5512
- Q.setPipeline(z), Q.setBindGroup(0, Ce.bindGroup), Q.draw(3), Q.end(), J = !0;
5528
+ K.setPipeline(D), K.setBindGroup(0, Ce.bindGroup), K.draw(3), K.end(), H = !0;
5513
5529
  }
5514
5530
  }
5515
5531
  } catch {
5516
5532
  }
5517
- const H = x.beginRenderPass({
5533
+ const j = v.beginRenderPass({
5518
5534
  colorAttachments: [{ view: te.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5519
- depthStencilAttachment: J ? { view: ve.createView(), depthLoadOp: "load", depthStoreOp: "store" } : { view: ve.createView(), depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5535
+ depthStencilAttachment: H ? { view: ve.createView(), depthLoadOp: "load", depthStoreOp: "store" } : { view: ve.createView(), depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5520
5536
  });
5521
- for (const { system: y, config: B } of l.particleSystems)
5522
- B.bloomEnabled || B.hidden || y.activeParticles === 0 || Dt(H, y, B, !0);
5523
- if (Ve > 0 && (H.setPipeline(Di), H.setBindGroup(0, zi), H.setVertexBuffer(0, At), H.draw(Ve)), H.end(), g) {
5537
+ for (const { system: y, config: w } of l.particleSystems)
5538
+ w.bloomEnabled || w.hidden || y.activeParticles === 0 || Dt(j, y, w);
5539
+ if (Fe > 0 && (j.setPipeline(Di), j.setBindGroup(0, Fi), j.setVertexBuffer(0, At), j.draw(Fe)), j.end(), g) {
5524
5540
  const y = {
5525
5541
  colorAttachments: [{ view: xe.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5526
- }, B = {
5542
+ }, w = {
5527
5543
  colorAttachments: [{ view: ue.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5528
5544
  };
5529
5545
  for (const { system: U, config: I } of l.particleSystems) {
5530
5546
  if (!I.bloomEnabled || I.hidden || U.activeParticles === 0) continue;
5531
- const z = U.config.id, W = p.getBloomSourceTexture(z, a.width, a.height), Q = x.beginRenderPass({
5532
- colorAttachments: [{ view: W.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5547
+ const D = U.config.id, J = p.getBloomSourceTexture(D, a.width, a.height), K = v.beginRenderPass({
5548
+ colorAttachments: [{ view: J.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5533
5549
  depthStencilAttachment: { view: ve.createView(), depthClearValue: 1, depthLoadOp: "load", depthStoreOp: "store" }
5534
5550
  });
5535
- Dt(Q, U, I, !1), Q.end(), Ut[0] = I.bloomIntensity, r.queue.writeBuffer(_, 0, Ut), d.systemBloomHorizontalBindGroups[z] || (d.systemBloomHorizontalBindGroups[z] = r.createBindGroup({
5536
- layout: le.bloomBindGroupLayout,
5551
+ Dt(K, U, I), K.end(), Ut[0] = I.bloomIntensity, r.queue.writeBuffer(x, 0, Ut), d.systemBloomHorizontalBindGroups[D] || (d.systemBloomHorizontalBindGroups[D] = r.createBindGroup({
5552
+ layout: he.bloomBindGroupLayout,
5537
5553
  entries: [
5538
- { binding: 0, resource: ee },
5539
- { binding: 1, resource: W.createView() },
5540
- { binding: 2, resource: { buffer: T } }
5554
+ { binding: 0, resource: re },
5555
+ { binding: 1, resource: J.createView() },
5556
+ { binding: 2, resource: { buffer: E } }
5541
5557
  ]
5542
5558
  }));
5543
- let N = x.beginRenderPass(y);
5544
- N.setPipeline($e), N.setBindGroup(0, d.systemBloomHorizontalBindGroups[z]), N.draw(3), N.end(), N = x.beginRenderPass(B), N.setPipeline($e), N.setBindGroup(0, We.verticalBlurBindGroup), N.draw(3), N.end(), d.secondHorizontalBindGroups[z] || (d.secondHorizontalBindGroups[z] = r.createBindGroup({
5545
- layout: le.bloomBindGroupLayout,
5559
+ let X = v.beginRenderPass(y);
5560
+ X.setPipeline($e), X.setBindGroup(0, d.systemBloomHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(w), X.setPipeline($e), X.setBindGroup(0, We.verticalBlurBindGroup), X.draw(3), X.end(), d.secondHorizontalBindGroups[D] || (d.secondHorizontalBindGroups[D] = r.createBindGroup({
5561
+ layout: he.bloomBindGroupLayout,
5546
5562
  entries: [
5547
- { binding: 0, resource: ee },
5563
+ { binding: 0, resource: re },
5548
5564
  { binding: 1, resource: ue.createView() },
5549
- { binding: 2, resource: { buffer: T } }
5565
+ { binding: 2, resource: { buffer: E } }
5550
5566
  ]
5551
- })), N = x.beginRenderPass(y), N.setPipeline($e), N.setBindGroup(0, d.secondHorizontalBindGroups[z]), N.draw(3), N.end(), N = x.beginRenderPass(B), N.setPipeline($e), N.setBindGroup(0, We.verticalBlurBindGroup), N.draw(3), N.end();
5552
- const Ke = p.getBloomCompositeTexture(z, a.width, a.height);
5553
- N = x.beginRenderPass({
5567
+ })), X = v.beginRenderPass(y), X.setPipeline($e), X.setBindGroup(0, d.secondHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(w), X.setPipeline($e), X.setBindGroup(0, We.verticalBlurBindGroup), X.draw(3), X.end();
5568
+ const Ke = p.getBloomCompositeTexture(D, a.width, a.height);
5569
+ X = v.beginRenderPass({
5554
5570
  colorAttachments: [{ view: Ke.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5555
- }), N.setPipeline(Ui), d.systemBloomCompositeBindGroups[z] || (d.systemBloomCompositeBindGroups[z] = r.createBindGroup({
5556
- layout: le.compositeBindGroupLayout,
5571
+ }), X.setPipeline(Ii), d.systemBloomCompositeBindGroups[D] || (d.systemBloomCompositeBindGroups[D] = r.createBindGroup({
5572
+ layout: he.compositeBindGroupLayout,
5557
5573
  entries: [
5558
- { binding: 0, resource: ee },
5559
- { binding: 1, resource: W.createView() },
5574
+ { binding: 0, resource: re },
5575
+ { binding: 1, resource: J.createView() },
5560
5576
  { binding: 2, resource: ue.createView() },
5561
5577
  { binding: 3, resource: { buffer: U.bloomIntensityBuffer } }
5562
5578
  ]
5563
- })), N.setBindGroup(0, d.systemBloomCompositeBindGroups[z]), N.draw(3), N.end();
5579
+ })), X.setBindGroup(0, d.systemBloomCompositeBindGroups[D]), X.draw(3), X.end();
5564
5580
  }
5565
5581
  }
5566
- const de = p.getCombinedTexture(a.width, a.height), q = x.beginRenderPass({
5567
- colorAttachments: [{ view: de.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5582
+ const Q = p.getCombinedTexture(a.width, a.height), Z = v.beginRenderPass({
5583
+ colorAttachments: [{ view: Q.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5568
5584
  });
5569
- q.setPipeline(Mt), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
5570
- layout: le.compositeBindGroupLayout,
5585
+ Z.setPipeline(Rt), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
5586
+ layout: he.compositeBindGroupLayout,
5571
5587
  entries: [
5572
- { binding: 0, resource: ee },
5588
+ { binding: 0, resource: re },
5573
5589
  { binding: 1, resource: te.createView() },
5574
5590
  { binding: 2, resource: te.createView() },
5575
- { binding: 3, resource: { buffer: _ } }
5591
+ { binding: 3, resource: { buffer: x } }
5576
5592
  ]
5577
- })), q.setBindGroup(0, d.combinedInitialBindGroup), q.draw(3);
5578
- for (const { config: y, system: B } of l.particleSystems) {
5579
- if (!y.bloomEnabled || y.hidden || B.activeParticles === 0) continue;
5580
- const U = B.config.id;
5581
- q.setPipeline(Mt), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
5582
- layout: le.compositeBindGroupLayout,
5593
+ })), Z.setBindGroup(0, d.combinedInitialBindGroup), Z.draw(3);
5594
+ for (const { config: y, system: w } of l.particleSystems) {
5595
+ if (!y.bloomEnabled || y.hidden || w.activeParticles === 0) continue;
5596
+ const U = w.config.id;
5597
+ Z.setPipeline(Rt), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
5598
+ layout: he.compositeBindGroupLayout,
5583
5599
  entries: [
5584
- { binding: 0, resource: ee },
5600
+ { binding: 0, resource: re },
5585
5601
  { binding: 1, resource: p.getBloomCompositeTexture(U, a.width, a.height).createView() },
5586
5602
  { binding: 2, resource: te.createView() },
5587
- { binding: 3, resource: { buffer: _ } }
5603
+ { binding: 3, resource: { buffer: x } }
5588
5604
  ]
5589
- })), q.setBindGroup(0, d.combinedBloomCompositeBindGroups[U]), q.draw(3);
5605
+ })), Z.setBindGroup(0, d.combinedBloomCompositeBindGroups[U]), Z.draw(3);
5590
5606
  }
5591
- q.end();
5592
- const Ae = x.beginRenderPass({
5607
+ Z.end();
5608
+ const Ae = v.beginRenderPass({
5593
5609
  colorAttachments: [{
5594
5610
  view: n.getCurrentTexture().createView(),
5595
5611
  loadOp: o ? "load" : "clear",
@@ -5597,117 +5613,104 @@ async function mr(s, t = {}) {
5597
5613
  clearValue: { r: 0, g: 0, b: 0, a: 0 }
5598
5614
  }]
5599
5615
  });
5600
- Ae.setPipeline(Ii), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
5601
- layout: le.compositeBindGroupLayout,
5616
+ Ae.setPipeline(zi), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
5617
+ layout: he.compositeBindGroupLayout,
5602
5618
  entries: [
5603
- { binding: 0, resource: ee },
5604
- { binding: 1, resource: de.createView() },
5619
+ { binding: 0, resource: re },
5620
+ { binding: 1, resource: Q.createView() },
5605
5621
  { binding: 2, resource: te.createView() },
5606
- { binding: 3, resource: { buffer: _ } }
5622
+ { binding: 3, resource: { buffer: x } }
5607
5623
  ]
5608
- })), Ae.setBindGroup(0, d.finalBindGroup), Ae.draw(3), Ae.end(), r.queue.submit([x.finish()]);
5609
- }
5610
- function Dt(f, h, S, g) {
5611
- const x = h.config.id, J = S.glbModelEnabled && h.glbMeshData;
5612
- let H;
5613
- if (g) {
5614
- const q = !d.systemBindGroups[x] || d.textureStates[x] !== S.textureEnabled || d.textureRefs[x] !== h.particleTexture;
5615
- d.textureStates[x] = S.textureEnabled, d.textureRefs[x] = h.particleTexture, q && (d.systemBindGroups[x] = r.createBindGroup({
5616
- layout: le.particleBindGroupLayout,
5617
- entries: [
5618
- { binding: 0, resource: { buffer: b } },
5619
- { binding: 1, resource: { buffer: h.appearanceUniformBuffer } },
5620
- { binding: 2, resource: h.particleTexture.createView() },
5621
- { binding: 3, resource: ee }
5622
- ]
5623
- })), H = d.systemBindGroups[x];
5624
- } else
5625
- H = r.createBindGroup({
5626
- layout: le.particleBindGroupLayout,
5627
- entries: [
5628
- { binding: 0, resource: { buffer: b } },
5629
- { binding: 1, resource: { buffer: h.appearanceUniformBuffer } },
5630
- { binding: 2, resource: h.particleTexture.createView() },
5631
- { binding: 3, resource: ee }
5632
- ]
5633
- });
5634
- const de = S.shapeDisplay !== !1;
5635
- if (J)
5636
- de && (f.setPipeline(Gi), f.setBindGroup(0, H), 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));
5624
+ })), Ae.setBindGroup(0, d.finalBindGroup), Ae.draw(3), Ae.end(), r.queue.submit([v.finish()]);
5625
+ }
5626
+ function Dt(f, m, b) {
5627
+ const g = m.config.id, v = b.glbModelEnabled && m.glbMeshData, H = !d.systemBindGroups[g] || d.textureStates[g] !== b.textureEnabled || d.textureRefs[g] !== m.particleTexture;
5628
+ d.textureStates[g] = b.textureEnabled, d.textureRefs[g] = m.particleTexture, H && (d.systemBindGroups[g] = r.createBindGroup({
5629
+ layout: he.particleBindGroupLayout,
5630
+ entries: [
5631
+ { binding: 0, resource: { buffer: S } },
5632
+ { binding: 1, resource: { buffer: m.appearanceUniformBuffer } },
5633
+ { binding: 2, resource: m.particleTexture.createView() },
5634
+ { binding: 3, resource: re }
5635
+ ]
5636
+ }));
5637
+ const j = d.systemBindGroups[g], Q = b.shapeDisplay !== !1;
5638
+ if (v)
5639
+ Q && (f.setPipeline(Gi), 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));
5637
5640
  else {
5638
- f.setPipeline(S.blendMode === "additive" ? Ci : Ei), f.setIndexBuffer(L, "uint16"), v[x] || (v[x] = w()), f.setVertexBuffer(0, v[x]), f.setBindGroup(0, H), de && (f.setVertexBuffer(1, h.instanceBuffer), f.setVertexBuffer(2, h.velocityBuffer), f.setVertexBuffer(3, h.trailBuffer), f.drawIndexed(6, h.activeParticles));
5639
- const q = ze.get(x);
5640
- q && (f.setVertexBuffer(1, k), f.setVertexBuffer(2, D), f.setVertexBuffer(3, he), f.drawIndexed(6, q.count, 0, 0, q.first)), de && S.depthWriteEnabled && (f.setPipeline(Ai), f.drawIndexed(6, h.activeParticles));
5641
+ f.setPipeline(b.blendMode === "additive" ? Ai : Ci), f.setIndexBuffer(L, "uint16"), P[g] || (P[g] = B()), 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));
5642
+ const Z = De.get(g);
5643
+ Z && (f.setVertexBuffer(1, k), f.setVertexBuffer(2, G), f.setVertexBuffer(3, pe), f.drawIndexed(6, Z.count, 0, 0, Z.first)), Q && b.depthWriteEnabled && (f.setPipeline(Ui), f.drawIndexed(6, m.activeParticles));
5641
5644
  }
5642
5645
  }
5643
- function Zi() {
5646
+ function $i() {
5644
5647
  ct = a.width, ut = a.height, Gt();
5645
5648
  }
5646
- function $i() {
5649
+ function Wi() {
5647
5650
  d.clear();
5648
5651
  }
5649
- function Wi() {
5650
- It = !0, l.destroy(), [te, xe, ue, ve].forEach((f) => f == null ? void 0 : f.destroy()), p.resizeTextures(), [
5651
- b,
5652
- M,
5652
+ function Ji() {
5653
+ zt = !0, l.destroy(), [te, xe, ue, ve].forEach((f) => f == null ? void 0 : f.destroy()), p.resizeTextures(), [
5654
+ S,
5655
+ R,
5656
+ E,
5653
5657
  T,
5654
- C,
5655
- _,
5658
+ x,
5656
5659
  L,
5657
5660
  k,
5658
- D,
5659
- he
5660
- ].forEach((f) => f == null ? void 0 : f.destroy()), Object.values(v).forEach((f) => f == null ? void 0 : f.destroy());
5661
+ G,
5662
+ pe
5663
+ ].forEach((f) => f == null ? void 0 : f.destroy()), Object.values(P).forEach((f) => f == null ? void 0 : f.destroy());
5661
5664
  }
5662
- async function zt(f, h) {
5663
- const S = await l.addSystems(f, h);
5665
+ async function Ft(f, m) {
5666
+ const b = await l.addSystems(f, m);
5664
5667
  for (const { config: g } of l.particleSystems)
5665
- v[g.id] || (v[g.id] = w());
5666
- return l.respawnAllSystems(), new Set(Array.isArray(S) ? S : []);
5668
+ P[g.id] || (P[g.id] = B());
5669
+ return l.respawnAllSystems(), new Set(Array.isArray(b) ? b : []);
5667
5670
  }
5668
5671
  function Vt(f) {
5669
- for (const h of f) {
5670
- const S = l.particleSystems.findIndex((g) => g.config.id === h);
5671
- S >= 0 && l.removeSystem(S);
5672
+ for (const m of f) {
5673
+ const b = l.particleSystems.findIndex((g) => g.config.id === m);
5674
+ b >= 0 && l.removeSystem(b);
5672
5675
  }
5673
5676
  }
5674
- async function Ji(f, h = [0, 0, 0]) {
5675
- const S = await zt(f, h);
5677
+ async function Qi(f, m = [0, 0, 0]) {
5678
+ const b = await Ft(f, m);
5676
5679
  return { remove() {
5677
- Vt(S);
5680
+ Vt(b);
5678
5681
  } };
5679
5682
  }
5680
- async function Qi(f, h = {}) {
5681
- const S = await zt(f, [0, 0, 0]);
5682
- globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...S]}]`);
5683
- const g = { ids: S, pos: null, hist: [], getPosition: h.getPosition || null, orientToDirection: !!h.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0] };
5684
- return $.push(g), {
5685
- setPosition(x) {
5686
- x && (g.pos = Array.isArray(x) ? [x[0], x[1], x[2]] : [x.x, x.y, x.z]);
5683
+ async function Ki(f, m = {}) {
5684
+ const b = await Ft(f, [0, 0, 0]);
5685
+ globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...b]}]`);
5686
+ const g = { ids: b, pos: null, hist: [], getPosition: m.getPosition || null, orientToDirection: !!m.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0] };
5687
+ return W.push(g), {
5688
+ setPosition(v) {
5689
+ v && (g.pos = Array.isArray(v) ? [v[0], v[1], v[2]] : [v.x, v.y, v.z]);
5687
5690
  },
5688
- setOrientToDirection(x) {
5689
- g.orientToDirection = !!x;
5691
+ setOrientToDirection(v) {
5692
+ g.orientToDirection = !!v;
5690
5693
  },
5691
5694
  remove() {
5692
- Vt(S);
5693
- const x = $.indexOf(g);
5694
- x >= 0 && $.splice(x, 1);
5695
+ Vt(b);
5696
+ const v = W.indexOf(g);
5697
+ v >= 0 && W.splice(v, 1);
5695
5698
  }
5696
5699
  };
5697
5700
  }
5698
- function Ki(f, h) {
5699
- 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] };
5700
- return $.push(g), {
5701
+ function es(f, m) {
5702
+ 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] };
5703
+ return W.push(g), {
5701
5704
  remove() {
5702
- const x = $.indexOf(g);
5703
- x >= 0 && $.splice(x, 1);
5705
+ const v = W.indexOf(g);
5706
+ v >= 0 && W.splice(v, 1);
5704
5707
  },
5705
5708
  // Update which systems this history group covers WITHOUT losing the accumulated path
5706
5709
  // history. Needed when the scene's systems change (e.g. duplicate/add/remove) while the
5707
5710
  // group is active — otherwise a newly-added system's id isn't in the set and its trail
5708
5711
  // can't follow the recorded movement path (it falls back to straight extrapolation).
5709
- setIds(x) {
5710
- g.ids = x instanceof Set ? x : new Set(x);
5712
+ setIds(v) {
5713
+ g.ids = v instanceof Set ? v : new Set(v);
5711
5714
  }
5712
5715
  };
5713
5716
  }
@@ -5715,28 +5718,28 @@ async function mr(s, t = {}) {
5715
5718
  manager: l,
5716
5719
  device: r,
5717
5720
  context: n,
5718
- setCamera: ji,
5719
- setCameraMVP: Yi,
5721
+ setCamera: Yi,
5722
+ setCameraMVP: Hi,
5720
5723
  setEmitters: dt,
5721
- loadPreset: Hi,
5722
- addEmitter: Ji,
5723
- addMovingEmitter: Qi,
5724
- render: qi,
5725
- resize: Zi,
5726
- clearCaches: $i,
5727
- trackHistoryGroup: Ki,
5728
- destroy: Wi
5724
+ loadPreset: qi,
5725
+ addEmitter: Qi,
5726
+ addMovingEmitter: Ki,
5727
+ render: Zi,
5728
+ resize: $i,
5729
+ clearCaches: Wi,
5730
+ trackHistoryGroup: es,
5731
+ destroy: Ji
5729
5732
  };
5730
5733
  }
5731
- function yr(s) {
5734
+ function br(s) {
5732
5735
  return () => {
5733
5736
  var t, e, i, r, n, a;
5734
5737
  try {
5735
5738
  const o = s.backend;
5736
5739
  if (!o) return null;
5737
5740
  if (s.needsFrameBufferTarget && s._frameBufferTarget) {
5738
- const u = (i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, s._frameBufferTarget)) == null ? void 0 : i.depthTexture, m = u ? (r = o.get(u)) == null ? void 0 : r.texture : null;
5739
- if (m && m.width === s.domElement.width && m.height === s.domElement.height) return m;
5741
+ const u = (i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, s._frameBufferTarget)) == null ? void 0 : i.depthTexture, h = u ? (r = o.get(u)) == null ? void 0 : r.texture : null;
5742
+ if (h && h.width === s.domElement.width && h.height === s.domElement.height) return h;
5740
5743
  }
5741
5744
  const c = s.getCanvasTarget ? o.get(s.getCanvasTarget()) : null, l = ((a = (n = c == null ? void 0 : c.descriptor) == null ? void 0 : n.depthStencilAttachment) == null ? void 0 : a.view) ?? null;
5742
5745
  return l ? { view: l, multisampled: (s.currentSamples ?? 0) > 1 } : null;
@@ -5746,46 +5749,46 @@ function yr(s) {
5746
5749
  };
5747
5750
  }
5748
5751
  export {
5749
- Vs as GLBAnimator,
5750
- Fs as HZClock,
5751
- or as Objects3DManager,
5752
- ds as ParticleEmitter,
5753
- Ss as ParticlePhysics,
5754
- ri as ParticleScript,
5752
+ Os as GLBAnimator,
5753
+ Ls as HZClock,
5754
+ cr as Objects3DManager,
5755
+ fs as ParticleEmitter,
5756
+ xs as ParticlePhysics,
5757
+ ni as ParticleScript,
5755
5758
  bt as ParticleSystem,
5756
- js as ParticleSystemManager,
5757
- xs as ParticleTextureManager,
5758
- ps as blurShader,
5759
- hs as compositeShader,
5760
- Zs as createBindGroupLayouts,
5759
+ Hs as ParticleSystemManager,
5760
+ vs as ParticleTextureManager,
5761
+ hs as blurShader,
5762
+ ms as compositeShader,
5763
+ Ws as createBindGroupLayouts,
5761
5764
  St as createBindGroups,
5762
- De as createBuffer,
5763
- Js as createCubeGeometry,
5764
- pi as createDepthTexture,
5765
- ur as createLookAtMatrix,
5766
- dr as createProjectionMatrix,
5767
- $s as createRenderPipelines,
5768
- fi as createRenderTextures,
5769
- Ws as createSampler,
5770
- Qs as createSphereGeometry,
5771
- ms as directRenderShader,
5772
- ai as extractGLBTexture,
5773
- hr as fetchPreset,
5774
- qs as glbMeshParticleShader,
5775
- lr as hexToRgb,
5776
- mr as initHzFxOverlay,
5777
- Ys as initWebGPU,
5765
+ Ge as createBuffer,
5766
+ Ks as createCubeGeometry,
5767
+ hi as createDepthTexture,
5768
+ fr as createLookAtMatrix,
5769
+ pr as createProjectionMatrix,
5770
+ Js as createRenderPipelines,
5771
+ pi as createRenderTextures,
5772
+ Qs as createSampler,
5773
+ er as createSphereGeometry,
5774
+ ys as directRenderShader,
5775
+ oi as extractGLBTexture,
5776
+ yr as fetchPreset,
5777
+ $s as glbMeshParticleShader,
5778
+ ur as hexToRgb,
5779
+ gr as initHzFxOverlay,
5780
+ qs as initWebGPU,
5778
5781
  Bi as isHZFX,
5779
- pr as loadScene,
5780
- yr as makeThreeSceneDepth,
5781
- er as multiplyMatrices,
5782
- Hs as object3dShader,
5783
- ir as packHZFX,
5782
+ mr as loadScene,
5783
+ br as makeThreeSceneDepth,
5784
+ ir as multiplyMatrices,
5785
+ Zs as object3dShader,
5786
+ rr as packHZFX,
5784
5787
  Rs as parseGLB,
5785
- gs as particlePhysicsShader,
5786
- fs as particleShader,
5787
- cr as rgbToHex,
5788
- fr as saveScene,
5789
- rr as serializeSystemConfig,
5790
- wi as unpackHZFX
5788
+ bs as particlePhysicsShader,
5789
+ ps as particleShader,
5790
+ dr as rgbToHex,
5791
+ hr as saveScene,
5792
+ ar as serializeSystemConfig,
5793
+ Mi as unpackHZFX
5791
5794
  };