hz-particles 1.4.3 → 1.5.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 ms {
1
+ class ks {
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,15 +10,15 @@ class ms {
10
10
  if (t === this._cachedRotX && e === this._cachedRotY && i === this._cachedRotZ)
11
11
  return;
12
12
  this._cachedRotX = t, this._cachedRotY = e, this._cachedRotZ = i;
13
- const r = t * Math.PI / 180, n = e * Math.PI / 180, a = i * Math.PI / 180, o = Math.cos(r), c = Math.sin(r), l = Math.cos(n), u = Math.sin(n), p = Math.cos(a), h = 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), d = Math.sin(n), S = Math.cos(a), g = Math.sin(a);
14
14
  this._rotMatrix = [
15
- l * p,
16
- c * u * p - o * h,
17
- o * u * p + c * h,
18
- l * h,
19
- c * u * h + o * p,
20
- o * u * h - c * p,
21
- -u,
15
+ l * S,
16
+ c * d * S - o * g,
17
+ o * d * S + c * g,
18
+ l * g,
19
+ c * d * g + o * S,
20
+ o * d * g - c * S,
21
+ -d,
22
22
  c * l,
23
23
  o * l
24
24
  ], this._invRotMatrix = [
@@ -37,8 +37,8 @@ class ms {
37
37
  const r = this._posOut;
38
38
  if (this.config.emissionShape === "cube" || this.config.emissionShape === "box" ? this._emitFromCube(r) : this.config.emissionShape === "sphere" ? this._emitFromSphere(r) : this.config.emissionShape === "square" ? this._emitFromSquare(r) : this.config.emissionShape === "circle" ? this._emitFromCircle(r) : this.config.emissionShape === "cylinder" ? this._emitFromCylinder(r) : this.config.emissionShape === "plain" ? this._emitFromPlain(r) : this.config.emissionShape === "cone" ? this._emitFromCone(r) : this.config.emissionShape === "torus" ? this._emitFromTorus(r) : this.config.emissionShape === "line" ? this._emitFromLine(r) : this.config.emissionShape === "hemisphere" ? this._emitFromHemisphere(r) : this.config.emissionShape === "disc" ? this._emitFromDisc(r) : this.config.emissionShape === "annulus" ? this._emitFromAnnulus(r) : this.config.emissionShape === "capsule" ? this._emitFromCapsule(r) : this.config.emissionShape === "arc" ? this._emitFromArc(r) : this.config.emissionShape === "spiral" ? this._emitFromSpiral(r) : this.config.emissionShape === "frustum" ? this._emitFromFrustum(r) : this.config.emissionShape === "frustumSurface" ? this._emitFromFrustumSurface(r) : this.config.emissionShape === "cubeSurface" ? this._emitFromCubeSurface(r) : this.config.emissionShape === "sphereSurface" ? this._emitFromSphereSurface(r) : this.config.emissionShape === "boxFrame" ? this._emitFromBoxFrame(r) : this.config.emissionShape === "polygon" ? this._emitFromPolygon(r) : this.config.emissionShape === "rectangle" ? this._emitFromRectangle(r) : (r[0] = 0, r[1] = 0, r[2] = 0), this.config.emissionRotationX || this.config.emissionRotationY || this.config.emissionRotationZ) {
39
39
  this._updateRotationMatrix();
40
- const o = this._rotMatrix, c = r[0], l = r[1], u = r[2];
41
- r[0] = o[0] * c + o[1] * l + o[2] * u, r[1] = o[3] * c + o[4] * l + o[5] * u, r[2] = o[6] * c + o[7] * l + o[8] * u;
40
+ const o = this._rotMatrix, c = r[0], l = r[1], d = r[2];
41
+ r[0] = o[0] * c + o[1] * l + o[2] * d, r[1] = o[3] * c + o[4] * l + o[5] * d, r[2] = o[6] * c + o[7] * l + o[8] * d;
42
42
  }
43
43
  (this.config.emissionPositionX || this.config.emissionPositionY || this.config.emissionPositionZ) && (r[0] += this.config.emissionPositionX || 0, r[1] += this.config.emissionPositionY || 0, r[2] += this.config.emissionPositionZ || 0);
44
44
  const n = e * 8;
@@ -91,8 +91,8 @@ class ms {
91
91
  o = n, c = -0.5, l = a;
92
92
  break;
93
93
  }
94
- const u = Math.random(), p = e + u * (i - e);
95
- t[0] = o * p, t[1] = c * p, t[2] = l * p;
94
+ const d = Math.random(), S = e + d * (i - e);
95
+ t[0] = o * S, t[1] = c * S, t[2] = l * S;
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
  }
@@ -137,8 +137,8 @@ class ms {
137
137
  const e = this.config.coneInnerRadius || 0, i = this.config.coneOuterRadius || 2, r = this.config.coneHeight || 4, n = Math.random() * Math.PI * 2, a = Math.random(), o = a * r, c = i * (1 - a);
138
138
  let l;
139
139
  if (e > 0) {
140
- const u = e * (1 - a);
141
- l = u + (c - u) * Math.random();
140
+ const d = e * (1 - a);
141
+ l = d + (c - d) * Math.random();
142
142
  } else
143
143
  l = c * Math.sqrt(Math.random());
144
144
  t[0] = Math.cos(n) * l, t[1] = o, t[2] = Math.sin(n) * l;
@@ -170,8 +170,8 @@ class ms {
170
170
  const c = Math.random() * Math.PI * 2, l = e * Math.sqrt(Math.random());
171
171
  t[0] = Math.cos(c) * l, t[1] = (Math.random() - 0.5) * i, t[2] = Math.sin(c) * l;
172
172
  } else {
173
- const c = Math.random() * Math.PI * 2, l = Math.acos(2 * Math.random() - 1), u = e * Math.cbrt(Math.random());
174
- t[0] = u * Math.sin(l) * Math.cos(c), t[1] = u * Math.cos(l), t[2] = u * Math.sin(l) * Math.sin(c), t[1] += t[1] >= 0 ? r : -r;
173
+ const c = Math.random() * Math.PI * 2, l = Math.acos(2 * Math.random() - 1), d = e * Math.cbrt(Math.random());
174
+ t[0] = d * Math.sin(l) * Math.cos(c), t[1] = d * Math.cos(l), t[2] = d * Math.sin(l) * Math.sin(c), t[1] += t[1] >= 0 ? r : -r;
175
175
  }
176
176
  }
177
177
  _emitFromArc(t) {
@@ -193,11 +193,11 @@ class ms {
193
193
  if (Math.abs(a) < 1e-6 || o <= 1e-6)
194
194
  c = Math.random();
195
195
  else {
196
- const p = Math.random(), h = 0.5 * a, d = e, b = -p * o, _ = Math.max(0, d * d - 4 * h * b);
197
- c = (-d + Math.sqrt(_)) / (2 * h), Number.isFinite(c) || (c = Math.random()), c = Math.min(1, Math.max(0, c));
196
+ const S = Math.random(), g = 0.5 * a, p = e, v = -S * o, A = Math.max(0, p * p - 4 * g * v);
197
+ c = (-p + Math.sqrt(A)) / (2 * g), Number.isFinite(c) || (c = Math.random()), c = Math.min(1, Math.max(0, c));
198
198
  }
199
- const l = c * r, u = e + a * c;
200
- t[0] = Math.cos(n) * u, t[1] = l, t[2] = Math.sin(n) * u;
199
+ const l = c * r, d = e + a * c;
200
+ t[0] = Math.cos(n) * d, t[1] = l, t[2] = Math.sin(n) * d;
201
201
  }
202
202
  _emitFromCubeSurface(t) {
203
203
  const e = this.config.cubeSurfaceSize || 2, i = e * 0.5, r = Math.floor(Math.random() * 6), n = (Math.random() - 0.5) * e, a = (Math.random() - 0.5) * e;
@@ -243,8 +243,8 @@ class ms {
243
243
  const e = Math.max(3, Math.floor(this.config.polygonSides || 6)), i = this.config.polygonRadius || 2, r = Math.floor(Math.random() * e), n = r / e * Math.PI * 2, a = (r + 1) / e * Math.PI * 2;
244
244
  let o = Math.random(), c = Math.random();
245
245
  o + c > 1 && (o = 1 - o, c = 1 - c);
246
- const l = o * Math.cos(n) + c * Math.cos(a), u = o * Math.sin(n) + c * Math.sin(a);
247
- t[0] = l * i, t[1] = u * i, t[2] = 0;
246
+ const l = o * Math.cos(n) + c * Math.cos(a), d = o * Math.sin(n) + c * Math.sin(a);
247
+ t[0] = l * i, t[1] = d * i, t[2] = 0;
248
248
  }
249
249
  _emitFromRectangle(t) {
250
250
  const e = this.config.rectangleWidth || 2, i = this.config.rectangleHeight || 2;
@@ -256,33 +256,33 @@ class ms {
256
256
  e > 0 ? a = e + (i - e) * Math.random() : a = i * Math.sqrt(Math.random()), t[0] = Math.cos(n) * a, t[1] = (Math.random() - 0.5) * r, t[2] = Math.sin(n) * a;
257
257
  }
258
258
  calculateVelocity(t, e, i, r, n) {
259
- const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o, p = i - c, h = Math.sqrt(l * l + u * u + p * p);
260
- let d, b, _;
261
- if (h > 1e-4) {
262
- let R = !1;
259
+ const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, d = e - o, S = i - c, g = Math.sqrt(l * l + d * d + S * S);
260
+ let p, v, A;
261
+ if (g > 1e-4) {
262
+ let I = !1;
263
263
  if (this.config.emissionShape === "circle" && this.config.circleVelocityDirection === "tangential") {
264
- const x = this.inverseRotation(l, u, p), L = Math.sqrt(x[0] * x[0] + x[1] * x[1]);
265
- if (L > 1e-4) {
266
- const P = -x[1] / L, T = x[0] / L, E = this.applyRotation(P, T, 0);
267
- d = E[0], b = E[1], _ = E[2], R = !0;
264
+ const _ = this.inverseRotation(l, d, S), $ = Math.sqrt(_[0] * _[0] + _[1] * _[1]);
265
+ if ($ > 1e-4) {
266
+ const T = -_[1] / $, z = _[0] / $, F = this.applyRotation(T, z, 0);
267
+ p = F[0], v = F[1], A = F[2], I = !0;
268
268
  }
269
269
  } else if (this.config.emissionShape === "cylinder" && this.config.cylinderVelocityDirection === "tangential") {
270
- const x = this.inverseRotation(l, u, p), L = Math.sqrt(x[0] * x[0] + x[2] * x[2]);
271
- if (L > 1e-4) {
272
- const P = -x[2] / L, T = x[0] / L, E = this.applyRotation(P, 0, T);
273
- d = E[0], b = E[1], _ = E[2], R = !0;
270
+ const _ = this.inverseRotation(l, d, S), $ = Math.sqrt(_[0] * _[0] + _[2] * _[2]);
271
+ if ($ > 1e-4) {
272
+ const T = -_[2] / $, z = _[0] / $, F = this.applyRotation(T, 0, z);
273
+ p = F[0], v = F[1], A = F[2], I = !0;
274
274
  } else {
275
- const P = Math.random() * Math.PI * 2, T = this.applyRotation(Math.cos(P), 0, Math.sin(P));
276
- d = T[0], b = T[1], _ = T[2], R = !0;
275
+ const T = Math.random() * Math.PI * 2, z = this.applyRotation(Math.cos(T), 0, Math.sin(T));
276
+ p = z[0], v = z[1], A = z[2], I = !0;
277
277
  }
278
278
  }
279
- R || (d = l / h, b = u / h, _ = p / h);
279
+ I || (p = l / g, v = d / g, A = S / g);
280
280
  } else {
281
- const R = Math.random() * Math.PI * 2, x = Math.acos(2 * Math.random() - 1);
282
- d = Math.sin(x) * Math.cos(R), b = Math.sin(x) * Math.sin(R), _ = Math.cos(x);
281
+ const I = Math.random() * Math.PI * 2, _ = Math.acos(2 * Math.random() - 1);
282
+ p = Math.sin(_) * Math.cos(I), v = Math.sin(_) * Math.sin(I), A = Math.cos(_);
283
283
  }
284
- let M;
285
- this.config.randomSpeed ? M = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : M = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * M, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : b * M, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : _ * M, r[n + 3] = 0;
284
+ let U;
285
+ this.config.randomSpeed ? U = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : U = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : p * U, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : v * U, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : A * U, r[n + 3] = 0;
286
286
  }
287
287
  setParticleColor(t, e) {
288
288
  if (this.config.randomColorEnabled && this.config.randomColors.length > 0) {
@@ -295,7 +295,7 @@ class ms {
295
295
  t[e + 6] = 0, t[e + 7] = i + (Math.random() * 0.4 - 0.2) * i;
296
296
  }
297
297
  }
298
- const ys = `
298
+ const Xs = `
299
299
  struct Uniforms {
300
300
  transform: mat4x4<f32>,
301
301
  cameraPosition: vec3<f32>,
@@ -719,7 +719,7 @@ const ys = `
719
719
  return vec4<f32>(input.color, alpha);
720
720
  }
721
721
  }
722
- `, gs = `
722
+ `, Ns = `
723
723
  struct BloomUniforms {
724
724
  direction: vec2<f32>,
725
725
  resolution: vec2<f32>,
@@ -779,7 +779,7 @@ const ys = `
779
779
 
780
780
  return result / totalWeight * 1.1;
781
781
  }
782
- `, bs = `
782
+ `, Ys = `
783
783
  struct BloomIntensityUniforms {
784
784
  intensity: f32,
785
785
  color: vec3<f32>,
@@ -825,7 +825,7 @@ const ys = `
825
825
 
826
826
  return vec4<f32>(originalColor.rgb + (mappedBloom * bloomUniforms.intensity), originalColor.a);
827
827
  }
828
- `, Ss = `
828
+ `, js = `
829
829
  struct BloomIntensityUniforms {
830
830
  intensity: f32,
831
831
  color: vec3<f32>,
@@ -866,7 +866,7 @@ const ys = `
866
866
  fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
867
867
  return textureSample(originalTexture, texSampler, input.texCoord);
868
868
  }
869
- `, xs = `
869
+ `, qs = `
870
870
  @binding(0) @group(0) var texSampler: sampler;
871
871
  @binding(1) @group(0) var originalTexture: texture_2d<f32>;
872
872
  @binding(2) @group(0) var blurredTexture: texture_2d<f32>;
@@ -898,7 +898,7 @@ const ys = `
898
898
  let c = textureSample(originalTexture, texSampler, input.texCoord);
899
899
  return vec4<f32>(aces(c.rgb), c.a);
900
900
  }
901
- `, vs = `
901
+ `, Hs = `
902
902
  struct PhysicsUniforms {
903
903
  deltaTime: f32,
904
904
  particleSpeed: f32,
@@ -1108,7 +1108,7 @@ const ys = `
1108
1108
  particleBuffer[baseIndex + 1u] = newPos.y;
1109
1109
  particleBuffer[baseIndex + 2u] = newPos.z;
1110
1110
  }
1111
- `, Ps = `
1111
+ `, Zs = `
1112
1112
  @group(0) @binding(0) var<storage, read> restData: array<f32>;
1113
1113
  @group(0) @binding(1) var<storage, read> jointWeightsData: array<f32>;
1114
1114
  @group(0) @binding(2) var<storage, read> jointIndicesData: array<u32>;
@@ -1165,7 +1165,7 @@ const ys = `
1165
1165
  outputData[outBase + 7u] = uv_v;
1166
1166
  }
1167
1167
  `;
1168
- class _s {
1168
+ class $s {
1169
1169
  constructor(t, e = 1e4) {
1170
1170
  this.device = t, this.physicsSettings = {
1171
1171
  deltaTime: 0.016,
@@ -1254,7 +1254,7 @@ class _s {
1254
1254
  }),
1255
1255
  compute: {
1256
1256
  module: this.device.createShaderModule({
1257
- code: vs
1257
+ code: Hs
1258
1258
  }),
1259
1259
  entryPoint: "main"
1260
1260
  }
@@ -1285,10 +1285,10 @@ class _s {
1285
1285
  return;
1286
1286
  const o = this._physicsData, c = this.physicsSettings;
1287
1287
  o[0] = t, o[1] = i.particleSpeed, o[2] = c.gravity, o[3] = c.turbulence, o[4] = c.attractorStrength, o[5] = c.damping, o[6] = c.attractorPosition[0], o[7] = c.attractorPosition[1], o[8] = c.attractorPosition[2], this._physicsDataU32View[9] = e, o[10] = c.confinementEnabled ? 1 : 0, o[11] = c.confinementShape === "sphere" ? 1 : 0, o[12] = c.confinementMode === "kill" ? 1 : 0, o[13] = c.confinementSpace === "local" ? 1 : 0, o[14] = c.confinementBoxHalfSize[0], o[15] = c.confinementBoxHalfSize[1], o[16] = c.confinementBoxHalfSize[2], o[17] = c.confinementSphereRadius, o[18] = c.confinementRestitution, o[19] = c.confinementFriction, o[20] = c.confinementCenter[0], o[21] = c.confinementCenter[1], o[22] = c.confinementCenter[2], o[23] = c.softBoundaryEnabled ? 1 : 0, o[24] = c.softBoundaryStrength, o[25] = c.softBoundaryFalloff, o[26] = i.velocityStretchEnabled ? 1 : 0, o[27] = i.velocityStretchFactor ?? 1, o[28] = 0, o[29] = 0, o[30] = 0, o[31] = 0, this.device.queue.writeBuffer(this.physicsUniformBuffer, 0, o);
1288
- const l = a || this.device.createCommandEncoder({ label: "ParticlePhysicsEncoder" }), u = l.beginComputePass({ label: "ParticlePhysicsPass" });
1289
- u.setPipeline(this.computePipeline), u.setBindGroup(0, this.computeBindGroup);
1290
- const p = Math.max(1, Math.ceil(e / 64));
1291
- u.dispatchWorkgroups(p, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1288
+ const l = a || this.device.createCommandEncoder({ label: "ParticlePhysicsEncoder" }), d = l.beginComputePass({ label: "ParticlePhysicsPass" });
1289
+ d.setPipeline(this.computePipeline), d.setBindGroup(0, this.computeBindGroup);
1290
+ const S = Math.max(1, Math.ceil(e / 64));
1291
+ d.dispatchWorkgroups(S, 1, 1), d.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
1292
1292
  }
1293
1293
  async readbackAndProcessParticles(t, e, i, r, n) {
1294
1294
  if (t <= 0)
@@ -1461,7 +1461,7 @@ class _s {
1461
1461
  t.enabled !== void 0 && (e.softBoundaryEnabled = t.enabled), t.strength !== void 0 && (e.softBoundaryStrength = t.strength), t.falloff !== void 0 && (e.softBoundaryFalloff = t.falloff);
1462
1462
  }
1463
1463
  }
1464
- class ws {
1464
+ class Ws {
1465
1465
  constructor(t) {
1466
1466
  this.device = t, this.defaultTexture = null, this.createDefaultTexture();
1467
1467
  }
@@ -1500,7 +1500,7 @@ class ws {
1500
1500
  t && t.label !== "defaultParticleTexture" && t.destroy();
1501
1501
  }
1502
1502
  }
1503
- const Pi = Object.freeze({
1503
+ const ji = Object.freeze({
1504
1504
  sin: Math.sin,
1505
1505
  cos: Math.cos,
1506
1506
  abs: Math.abs,
@@ -1521,10 +1521,10 @@ const Pi = Object.freeze({
1521
1521
  return s + (t - s) * e;
1522
1522
  },
1523
1523
  smoothstep(s, t, e) {
1524
- const i = Pi.clamp((e - s) / (t - s), 0, 1);
1524
+ const i = ji.clamp((e - s) / (t - s), 0, 1);
1525
1525
  return i * i * (3 - 2 * i);
1526
1526
  }
1527
- }), $e = /* @__PURE__ */ new Set([
1527
+ }), At = /* @__PURE__ */ new Set([
1528
1528
  "particleSize",
1529
1529
  "particleSpeed",
1530
1530
  "particleColor",
@@ -1541,7 +1541,7 @@ const Pi = Object.freeze({
1541
1541
  "pulseFrequency",
1542
1542
  "bloomIntensity"
1543
1543
  ]);
1544
- class Bs {
1544
+ class Js {
1545
1545
  constructor(t) {
1546
1546
  this._collection = t, this._pd = null, this._vd = null, this._pi = 0, this._vi = 0;
1547
1547
  }
@@ -1619,9 +1619,9 @@ class Bs {
1619
1619
  this._vd[this._vi + 2] = t, this._collection._dirty = !0;
1620
1620
  }
1621
1621
  }
1622
- class Ms {
1622
+ class Ks {
1623
1623
  constructor() {
1624
- this._proxy = new Bs(this), this._pd = null, this._vd = null, this.count = 0, this._dirty = !1;
1624
+ this._proxy = new Js(this), this._pd = null, this._vd = null, this.count = 0, this._dirty = !1;
1625
1625
  }
1626
1626
  _bind(t, e, i) {
1627
1627
  this._pd = t, this._vd = e, this.count = i, this._dirty = !1;
@@ -1630,14 +1630,14 @@ class Ms {
1630
1630
  return t < 0 || t >= this.count ? null : this._proxy._bind(this._pd, this._vd, t);
1631
1631
  }
1632
1632
  }
1633
- const Rs = 1e6;
1634
- function Ts(s) {
1633
+ const Qs = 1e6;
1634
+ function er(s) {
1635
1635
  let t = 0;
1636
1636
  return s.replace(
1637
1637
  /\b(for|while)\s*\([^)]*\)\s*\{/g,
1638
1638
  (e) => {
1639
1639
  const i = `__lc${t++}`;
1640
- return `${e} if(++${i}>${Rs})throw new Error("Loop limit exceeded");`;
1640
+ return `${e} if(++${i}>${Qs})throw new Error("Loop limit exceeded");`;
1641
1641
  }
1642
1642
  ).replace(
1643
1643
  /\b(for|while)\s*\([^)]*\)\s*\{/g,
@@ -1654,10 +1654,10 @@ function Ts(s) {
1654
1654
  }
1655
1655
  );
1656
1656
  }
1657
- const wt = /* @__PURE__ */ new Map();
1658
- for (const s of $e)
1659
- wt.set(s.toLowerCase(), s);
1660
- function Es(s) {
1657
+ const ii = /* @__PURE__ */ new Map();
1658
+ for (const s of At)
1659
+ ii.set(s.toLowerCase(), s);
1660
+ function tr(s) {
1661
1661
  const t = { value: !1 }, e = /* @__PURE__ */ new Set();
1662
1662
  return new Proxy(s, {
1663
1663
  get(r, n) {
@@ -1666,16 +1666,16 @@ function Es(s) {
1666
1666
  t.value = !1;
1667
1667
  };
1668
1668
  if (typeof n != "string") return;
1669
- if ($e.has(n)) return r[n];
1670
- const a = wt.get(n.toLowerCase());
1669
+ if (At.has(n)) return r[n];
1670
+ const a = ii.get(n.toLowerCase());
1671
1671
  if (a)
1672
1672
  return e.has(n) || (e.add(n), console.warn(`[ParticleScript] config.${n} → did you mean config.${a}?`)), r[a];
1673
1673
  },
1674
1674
  set(r, n, a) {
1675
1675
  if (typeof n != "string") return !0;
1676
1676
  let o = n;
1677
- if (!$e.has(o)) {
1678
- const c = wt.get(o.toLowerCase());
1677
+ if (!At.has(o)) {
1678
+ const c = ii.get(o.toLowerCase());
1679
1679
  if (c)
1680
1680
  e.has(n) || (e.add(n), console.warn(`[ParticleScript] config.${n} → did you mean config.${c}?`)), o = c;
1681
1681
  else
@@ -1685,14 +1685,14 @@ function Es(s) {
1685
1685
  }
1686
1686
  });
1687
1687
  }
1688
- class ui {
1688
+ class Ii {
1689
1689
  /**
1690
1690
  * @param {string} source - User script source code
1691
1691
  * @param {object} config - ParticleSystem config (will be proxied)
1692
1692
  * @param {number} maxParticles - Max particle count for pre-allocation
1693
1693
  */
1694
1694
  constructor(t, e, i) {
1695
- this._particles = new Ms(), this._configProxy = Es(e), this._configSnapshot = null, this._fn = null, this._error = !1, this.compile(t);
1695
+ this._particles = new Ks(), this._configProxy = tr(e), this._configSnapshot = null, this._fn = null, this._error = !1, this.compile(t);
1696
1696
  }
1697
1697
  /**
1698
1698
  * Compile script source into a sandboxed function.
@@ -1708,7 +1708,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1708
1708
  var deltaTime = __deltaTime, time = __time;
1709
1709
  var currentFrame = __currentFrame, totalFrames = __totalFrames;
1710
1710
  var particles = __particles, config = __config, math = __math;
1711
- ${Ts(t)}
1711
+ ${er(t)}
1712
1712
  };`, r = new Function(i);
1713
1713
  this._fn = r();
1714
1714
  } catch (e) {
@@ -1730,7 +1730,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1730
1730
  if (!this._fn || this._error) return { configDirty: !1, particlesDirty: !1 };
1731
1731
  this._particles._bind(n, a, o), this._configProxy.__resetDirty();
1732
1732
  try {
1733
- this._fn(t, e, i, r, this._particles, this._configProxy, Pi);
1733
+ this._fn(t, e, i, r, this._particles, this._configProxy, ji);
1734
1734
  } catch (c) {
1735
1735
  console.warn("[ParticleScript] Runtime error:", c.message);
1736
1736
  }
@@ -1744,7 +1744,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1744
1744
  */
1745
1745
  snapshotConfig(t) {
1746
1746
  const e = {};
1747
- for (const i of $e) {
1747
+ for (const i of At) {
1748
1748
  const r = t[i];
1749
1749
  r !== void 0 && (e[i] = Array.isArray(r) ? [...r] : r);
1750
1750
  }
@@ -1755,7 +1755,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1755
1755
  */
1756
1756
  restoreConfig(t) {
1757
1757
  if (this._configSnapshot) {
1758
- for (const e of $e)
1758
+ for (const e of At)
1759
1759
  if (e in this._configSnapshot) {
1760
1760
  const i = this._configSnapshot[e];
1761
1761
  t[e] = Array.isArray(i) ? [...i] : i;
@@ -1769,7 +1769,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
1769
1769
  this._fn = null, this._particles = null, this._configProxy = null, this._configSnapshot = null;
1770
1770
  }
1771
1771
  }
1772
- async function As(s) {
1772
+ async function ir(s) {
1773
1773
  const t = new DataView(s);
1774
1774
  if (t.getUint32(0, !0) !== 1179937895)
1775
1775
  throw new Error("Invalid GLB file: incorrect magic number");
@@ -1779,12 +1779,12 @@ async function As(s) {
1779
1779
  const r = t.getUint32(8, !0);
1780
1780
  let n = 12, a = null, o = null;
1781
1781
  for (; n < r; ) {
1782
- const P = t.getUint32(n, !0), T = t.getUint32(n + 4, !0), E = s.slice(n + 8, n + 8 + P);
1783
- if (T === 1313821514) {
1784
- const N = new TextDecoder("utf-8").decode(E);
1785
- a = JSON.parse(N);
1786
- } else T === 5130562 && (o = E);
1787
- n += 8 + P;
1782
+ const T = t.getUint32(n, !0), z = t.getUint32(n + 4, !0), F = s.slice(n + 8, n + 8 + T);
1783
+ if (z === 1313821514) {
1784
+ const J = new TextDecoder("utf-8").decode(F);
1785
+ a = JSON.parse(J);
1786
+ } else z === 5130562 && (o = F);
1787
+ n += 8 + T;
1788
1788
  }
1789
1789
  if (!a)
1790
1790
  throw new Error("GLB file missing JSON chunk");
@@ -1793,50 +1793,50 @@ async function As(s) {
1793
1793
  const l = a.meshes[0].primitives[0];
1794
1794
  if (!l)
1795
1795
  throw new Error("First mesh has no primitives");
1796
- const u = l.attributes.POSITION;
1797
- if (u === void 0)
1796
+ const d = l.attributes.POSITION;
1797
+ if (d === void 0)
1798
1798
  throw new Error("Mesh primitive missing POSITION attribute");
1799
- const p = xt(a, o, u, 3, 5126);
1800
- let h;
1799
+ const S = Kt(a, o, d, 3, 5126);
1800
+ let g;
1801
1801
  if (l.attributes.NORMAL !== void 0)
1802
- h = xt(a, o, l.attributes.NORMAL, 3, 5126);
1802
+ g = Kt(a, o, l.attributes.NORMAL, 3, 5126);
1803
1803
  else {
1804
- const P = l.indices;
1805
- if (P === void 0)
1804
+ const T = l.indices;
1805
+ if (T === void 0)
1806
1806
  throw new Error("Cannot generate normals without indices");
1807
- const T = di(a, o, P);
1808
- h = Cs(p, T);
1807
+ const z = zi(a, o, T);
1808
+ g = sr(S, z);
1809
1809
  }
1810
- const d = l.indices;
1811
- if (d === void 0)
1810
+ const p = l.indices;
1811
+ if (p === void 0)
1812
1812
  throw new Error("Mesh primitive missing indices");
1813
- const b = di(a, o, d), _ = p.length / 3, M = b.length;
1814
- let R = null;
1815
- l.attributes.TEXCOORD_0 !== void 0 && (R = xt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
1816
- let x = !1;
1813
+ const v = zi(a, o, p), A = S.length / 3, U = v.length;
1814
+ let I = null;
1815
+ l.attributes.TEXCOORD_0 !== void 0 && (I = Kt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
1816
+ let _ = !1;
1817
1817
  if (a.materials && a.materials.length > 0) {
1818
- const P = a.materials[0];
1819
- P.pbrMetallicRoughness && P.pbrMetallicRoughness.baseColorTexture !== void 0 && (x = !0);
1818
+ const T = a.materials[0];
1819
+ T.pbrMetallicRoughness && T.pbrMetallicRoughness.baseColorTexture !== void 0 && (_ = !0);
1820
1820
  }
1821
- let L = null;
1821
+ let $ = null;
1822
1822
  if (a.skins && a.skins.length > 0)
1823
1823
  try {
1824
- L = Ds(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", L);
1825
- } catch (P) {
1826
- console.warn("Failed to extract animation data:", P);
1824
+ $ = cr(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", $);
1825
+ } catch (T) {
1826
+ console.warn("Failed to extract animation data:", T);
1827
1827
  }
1828
1828
  return {
1829
- positions: p,
1830
- normals: h,
1831
- indices: b,
1832
- texCoords: R,
1833
- vertexCount: _,
1834
- indexCount: M,
1835
- animationData: L,
1836
- hasBaseColorTexture: x
1829
+ positions: S,
1830
+ normals: g,
1831
+ indices: v,
1832
+ texCoords: I,
1833
+ vertexCount: A,
1834
+ indexCount: U,
1835
+ animationData: $,
1836
+ hasBaseColorTexture: _
1837
1837
  };
1838
1838
  }
1839
- function xt(s, t, e, i, r) {
1839
+ function Kt(s, t, e, i, r) {
1840
1840
  const n = s.accessors[e], o = {
1841
1841
  SCALAR: 1,
1842
1842
  VEC2: 2,
@@ -1847,12 +1847,12 @@ function xt(s, t, e, i, r) {
1847
1847
  throw new Error(`Attribute accessor type mismatch: expected ${i} components, got ${o}`);
1848
1848
  if (n.componentType !== r)
1849
1849
  throw new Error(`Attribute component type mismatch: expected ${r}, got ${n.componentType}`);
1850
- const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count, p = new DataView(t, l, u * i * 4), h = new Float32Array(u * i);
1851
- for (let d = 0; d < u * i; d++)
1852
- h[d] = p.getFloat32(d * 4, !0);
1853
- return h;
1850
+ const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), d = n.count, S = new DataView(t, l, d * i * 4), g = new Float32Array(d * i);
1851
+ for (let p = 0; p < d * i; p++)
1852
+ g[p] = S.getFloat32(p * 4, !0);
1853
+ return g;
1854
1854
  }
1855
- function di(s, t, e) {
1855
+ function zi(s, t, e) {
1856
1856
  const i = s.accessors[e];
1857
1857
  if (i.type !== "SCALAR")
1858
1858
  throw new Error(`Indices accessor must be SCALAR, got ${i.type}`);
@@ -1870,19 +1870,19 @@ function di(s, t, e) {
1870
1870
  } else
1871
1871
  throw new Error(`Unsupported index component type: ${i.componentType}`);
1872
1872
  }
1873
- function Cs(s, t) {
1873
+ function sr(s, t) {
1874
1874
  const e = new Float32Array(s.length);
1875
1875
  for (let i = 0; i < t.length; i += 3) {
1876
- const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], u = [c[0] - o[0], c[1] - o[1], c[2] - o[2]], p = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], h = [
1877
- u[1] * p[2] - u[2] * p[1],
1878
- u[2] * p[0] - u[0] * p[2],
1879
- u[0] * p[1] - u[1] * p[0]
1880
- ], d = Math.sqrt(h[0] * h[0] + h[1] * h[1] + h[2] * h[2]);
1881
- d > 0 && (h[0] /= d, h[1] /= d, h[2] /= d), e[r] = e[n] = e[a] = h[0], e[r + 1] = e[n + 1] = e[a + 1] = h[1], e[r + 2] = e[n + 2] = e[a + 2] = h[2];
1876
+ const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], d = [c[0] - o[0], c[1] - o[1], c[2] - o[2]], S = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], g = [
1877
+ d[1] * S[2] - d[2] * S[1],
1878
+ d[2] * S[0] - d[0] * S[2],
1879
+ d[0] * S[1] - d[1] * S[0]
1880
+ ], p = Math.sqrt(g[0] * g[0] + g[1] * g[1] + g[2] * g[2]);
1881
+ p > 0 && (g[0] /= p, g[1] /= p, g[2] /= p), e[r] = e[n] = e[a] = g[0], e[r + 1] = e[n + 1] = e[a + 1] = g[1], e[r + 2] = e[n + 2] = e[a + 2] = g[2];
1882
1882
  }
1883
1883
  return e;
1884
1884
  }
1885
- function Us(s, t, e) {
1885
+ function rr(s, t, e) {
1886
1886
  const i = s.accessors[e];
1887
1887
  if (i.type !== "VEC4")
1888
1888
  throw new Error(`JOINTS_0 must be VEC4, got ${i.type}`);
@@ -1900,7 +1900,7 @@ function Us(s, t, e) {
1900
1900
  } else
1901
1901
  throw new Error(`Unsupported JOINTS_0 component type: ${i.componentType}`);
1902
1902
  }
1903
- function Is(s, t, e) {
1903
+ function nr(s, t, e) {
1904
1904
  const i = s.accessors[e];
1905
1905
  if (i.type !== "VEC4")
1906
1906
  throw new Error(`WEIGHTS_0 must be VEC4, got ${i.type}`);
@@ -1918,7 +1918,7 @@ function Is(s, t, e) {
1918
1918
  } else
1919
1919
  throw new Error(`Unsupported WEIGHTS_0 component type: ${i.componentType}`);
1920
1920
  }
1921
- function zs(s, t, e) {
1921
+ function ar(s, t, e) {
1922
1922
  const i = s.accessors[e];
1923
1923
  if (i.type !== "MAT4")
1924
1924
  throw new Error(`Expected MAT4, got ${i.type}`);
@@ -1929,7 +1929,7 @@ function zs(s, t, e) {
1929
1929
  c[l] = o.getFloat32(l * 4, !0);
1930
1930
  return c;
1931
1931
  }
1932
- function Gs(s, t, e) {
1932
+ function or(s, t, e) {
1933
1933
  const i = s.accessors[e];
1934
1934
  if (i.type !== "SCALAR")
1935
1935
  throw new Error(`Expected SCALAR, got ${i.type}`);
@@ -1940,46 +1940,46 @@ function Gs(s, t, e) {
1940
1940
  c[l] = o.getFloat32(l * 4, !0);
1941
1941
  return c;
1942
1942
  }
1943
- function Fs(s, t, e) {
1943
+ function lr(s, t, e) {
1944
1944
  const i = s.accessors[e], n = { VEC3: 3, VEC4: 4 }[i.type];
1945
1945
  if (!n)
1946
1946
  throw new Error(`Expected VEC3 or VEC4, got ${i.type}`);
1947
1947
  if (i.componentType !== 5126)
1948
1948
  throw new Error(`Expected FLOAT component type, got ${i.componentType}`);
1949
- const o = (s.bufferViews[i.bufferView].byteOffset || 0) + (i.byteOffset || 0), c = i.count, l = new DataView(t, o, c * n * 4), u = new Float32Array(c * n);
1950
- for (let p = 0; p < c * n; p++)
1951
- u[p] = l.getFloat32(p * 4, !0);
1952
- return u;
1949
+ const o = (s.bufferViews[i.bufferView].byteOffset || 0) + (i.byteOffset || 0), c = i.count, l = new DataView(t, o, c * n * 4), d = new Float32Array(c * n);
1950
+ for (let S = 0; S < c * n; S++)
1951
+ d[S] = l.getFloat32(S * 4, !0);
1952
+ return d;
1953
1953
  }
1954
- function Ds(s, t, e) {
1955
- const i = s.skins[0], r = i.joints, n = zs(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? Us(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? Is(s, t, e.attributes.WEIGHTS_0) : null;
1954
+ function cr(s, t, e) {
1955
+ const i = s.skins[0], r = i.joints, n = ar(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? rr(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? nr(s, t, e.attributes.WEIGHTS_0) : null;
1956
1956
  if (!a || !o)
1957
1957
  throw new Error("Mesh missing JOINTS_0 or WEIGHTS_0 attributes");
1958
- const c = s.nodes.map((u) => ({
1959
- translation: u.translation || [0, 0, 0],
1960
- rotation: u.rotation || [0, 0, 0, 1],
1961
- scale: u.scale || [1, 1, 1],
1962
- children: u.children || [],
1963
- name: u.name || ""
1958
+ const c = s.nodes.map((d) => ({
1959
+ translation: d.translation || [0, 0, 0],
1960
+ rotation: d.rotation || [0, 0, 0, 1],
1961
+ scale: d.scale || [1, 1, 1],
1962
+ children: d.children || [],
1963
+ name: d.name || ""
1964
1964
  })), l = [];
1965
1965
  if (s.animations && s.animations.length > 0)
1966
- for (const u of s.animations) {
1967
- const p = [];
1968
- let h = 0;
1969
- for (const d of u.channels) {
1970
- const b = u.samplers[d.sampler], _ = Gs(s, t, b.input), M = Fs(s, t, b.output), R = _[_.length - 1];
1971
- R > h && (h = R), p.push({
1972
- targetNode: d.target.node,
1973
- targetPath: d.target.path,
1974
- interpolation: b.interpolation || "LINEAR",
1975
- timestamps: _,
1976
- values: M
1966
+ for (const d of s.animations) {
1967
+ const S = [];
1968
+ let g = 0;
1969
+ for (const p of d.channels) {
1970
+ const v = d.samplers[p.sampler], A = or(s, t, v.input), U = lr(s, t, v.output), I = A[A.length - 1];
1971
+ I > g && (g = I), S.push({
1972
+ targetNode: p.target.node,
1973
+ targetPath: p.target.path,
1974
+ interpolation: v.interpolation || "LINEAR",
1975
+ timestamps: A,
1976
+ values: U
1977
1977
  });
1978
1978
  }
1979
1979
  l.push({
1980
- name: u.name || `Animation ${l.length}`,
1981
- duration: h,
1982
- channels: p
1980
+ name: d.name || `Animation ${l.length}`,
1981
+ duration: g,
1982
+ channels: S
1983
1983
  });
1984
1984
  }
1985
1985
  return {
@@ -1991,7 +1991,7 @@ function Ds(s, t, e) {
1991
1991
  animations: l
1992
1992
  };
1993
1993
  }
1994
- async function fi(s) {
1994
+ async function Fi(s) {
1995
1995
  const t = new DataView(s);
1996
1996
  if (t.getUint32(0, !0) !== 1179937895)
1997
1997
  throw new Error("Invalid GLB file: incorrect magic number");
@@ -2001,12 +2001,12 @@ async function fi(s) {
2001
2001
  const r = t.getUint32(8, !0);
2002
2002
  let n = 12, a = null, o = null;
2003
2003
  for (; n < r; ) {
2004
- const L = t.getUint32(n, !0), P = t.getUint32(n + 4, !0), T = s.slice(n + 8, n + 8 + L);
2005
- if (P === 1313821514) {
2006
- const D = new TextDecoder("utf-8").decode(T);
2007
- a = JSON.parse(D);
2008
- } else P === 5130562 && (o = T);
2009
- n += 8 + L;
2004
+ const $ = t.getUint32(n, !0), T = t.getUint32(n + 4, !0), z = s.slice(n + 8, n + 8 + $);
2005
+ if (T === 1313821514) {
2006
+ const Z = new TextDecoder("utf-8").decode(z);
2007
+ a = JSON.parse(Z);
2008
+ } else T === 5130562 && (o = z);
2009
+ n += 8 + $;
2010
2010
  }
2011
2011
  if (!a)
2012
2012
  throw new Error("GLB file missing JSON chunk");
@@ -2018,48 +2018,48 @@ async function fi(s) {
2018
2018
  const l = c.pbrMetallicRoughness.baseColorTexture.index;
2019
2019
  if (!a.textures || !a.textures[l])
2020
2020
  return null;
2021
- const p = a.textures[l].source;
2022
- if (p === void 0 || !a.images || !a.images[p])
2021
+ const S = a.textures[l].source;
2022
+ if (S === void 0 || !a.images || !a.images[S])
2023
2023
  return null;
2024
- const h = a.images[p], d = h.mimeType || "image/png";
2025
- if (h.bufferView === void 0)
2024
+ const g = a.images[S], p = g.mimeType || "image/png";
2025
+ if (g.bufferView === void 0)
2026
2026
  return null;
2027
2027
  if (!o)
2028
2028
  throw new Error("GLB file missing BIN chunk (required for embedded textures)");
2029
- const b = a.bufferViews[h.bufferView], _ = b.byteOffset || 0, M = b.byteLength, R = o.slice(_, _ + M);
2030
- return { imageBlob: new Blob([R], { type: d }), mimeType: d };
2029
+ const v = a.bufferViews[g.bufferView], A = v.byteOffset || 0, U = v.byteLength, I = o.slice(A, A + U);
2030
+ return { imageBlob: new Blob([I], { type: p }), mimeType: p };
2031
2031
  }
2032
- function Vs(s, t, e, i) {
2032
+ function ur(s, t, e, i) {
2033
2033
  return i = i || [0, 0, 0], i[0] = s[0] + (t[0] - s[0]) * e, i[1] = s[1] + (t[1] - s[1]) * e, i[2] = s[2] + (t[2] - s[2]) * e, i;
2034
2034
  }
2035
- function Os(s, t, e, i) {
2035
+ function dr(s, t, e, i) {
2036
2036
  i = i || [0, 0, 0, 0];
2037
2037
  let r = s[0] * t[0] + s[1] * t[1] + s[2] * t[2] + s[3] * t[3], n = 1;
2038
2038
  if (r < 0 && (r = -r, n = -1), r > 0.9995) {
2039
2039
  i[0] = s[0] + (n * t[0] - s[0]) * e, i[1] = s[1] + (n * t[1] - s[1]) * e, i[2] = s[2] + (n * t[2] - s[2]) * e, i[3] = s[3] + (n * t[3] - s[3]) * e;
2040
- const u = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2] + i[3] * i[3]);
2041
- return u > 1e-4 ? (i[0] /= u, i[1] /= u, i[2] /= u, i[3] /= u) : (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1), i;
2040
+ const d = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2] + i[3] * i[3]);
2041
+ return d > 1e-4 ? (i[0] /= d, i[1] /= d, i[2] /= d, i[3] /= d) : (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1), i;
2042
2042
  }
2043
2043
  const a = Math.acos(r), o = Math.sin(a), c = Math.sin((1 - e) * a) / o, l = Math.sin(e * a) / o;
2044
2044
  return i[0] = s[0] * c + n * t[0] * l, i[1] = s[1] * c + n * t[1] * l, i[2] = s[2] * c + n * t[2] * l, i[3] = s[3] * c + n * t[3] * l, i;
2045
2045
  }
2046
- function Ls(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, p = e * c, h = i * o, d = i * c, b = r * c, _ = n * a, M = n * o, R = n * c, x = t || new Float32Array(16);
2048
- return x[0] = 1 - (h + b), x[1] = u + R, x[2] = p - M, x[3] = 0, x[4] = u - R, x[5] = 1 - (l + b), x[6] = d + _, x[7] = 0, x[8] = p + M, x[9] = d - _, x[10] = 1 - (l + h), x[11] = 0, x[12] = 0, x[13] = 0, x[14] = 0, x[15] = 1, x;
2046
+ function fr(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, d = e * o, S = e * c, g = i * o, p = i * c, v = r * c, A = n * a, U = n * o, I = n * c, _ = t || new Float32Array(16);
2048
+ return _[0] = 1 - (g + v), _[1] = d + I, _[2] = S - U, _[3] = 0, _[4] = d - I, _[5] = 1 - (l + v), _[6] = p + A, _[7] = 0, _[8] = S + U, _[9] = p - A, _[10] = 1 - (l + g), _[11] = 0, _[12] = 0, _[13] = 0, _[14] = 0, _[15] = 1, _;
2049
2049
  }
2050
- const Xs = new Float32Array(16);
2051
- function Ns(s, t, e, i) {
2052
- const r = Ls(t, Xs), n = i || new Float32Array(16);
2050
+ const pr = new Float32Array(16);
2051
+ function hr(s, t, e, i) {
2052
+ const r = fr(t, pr), n = i || new Float32Array(16);
2053
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;
2054
2054
  }
2055
- function hi(s, t, e) {
2055
+ function Gi(s, t, e) {
2056
2056
  const i = e || new Float32Array(16);
2057
2057
  for (let r = 0; r < 4; r++)
2058
2058
  for (let n = 0; n < 4; n++)
2059
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
2060
  return i;
2061
2061
  }
2062
- class ks {
2062
+ class mr {
2063
2063
  constructor(t) {
2064
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);
2065
2065
  for (let e = 0; e < this.nodes.length; e++)
@@ -2090,8 +2090,8 @@ class ks {
2090
2090
  this._gpuDevice = t, this._gpuOutputBuffer = e;
2091
2091
  const r = this.restPositions.length / 3, n = new Float32Array(r * 8);
2092
2092
  for (let c = 0; c < r; c++) {
2093
- const l = c * 8, u = c * 3, p = c * 2;
2094
- n[l] = this.restPositions[u], n[l + 1] = this.restPositions[u + 1], n[l + 2] = this.restPositions[u + 2], n[l + 3] = this.restNormals[u], n[l + 4] = this.restNormals[u + 1], n[l + 5] = this.restNormals[u + 2], n[l + 6] = i ? i[p] : 0, n[l + 7] = i ? i[p + 1] : 0;
2093
+ const l = c * 8, d = c * 3, S = c * 2;
2094
+ n[l] = this.restPositions[d], n[l + 1] = this.restPositions[d + 1], n[l + 2] = this.restPositions[d + 2], n[l + 3] = this.restNormals[d], n[l + 4] = this.restNormals[d + 1], n[l + 5] = this.restNormals[d + 2], n[l + 6] = i ? i[S] : 0, n[l + 7] = i ? i[S + 1] : 0;
2095
2095
  }
2096
2096
  this._gpuRestDataBuffer = t.createBuffer({
2097
2097
  size: n.byteLength,
@@ -2126,7 +2126,7 @@ class ks {
2126
2126
  this._gpuSkinningPipeline = t.createComputePipeline({
2127
2127
  layout: t.createPipelineLayout({ bindGroupLayouts: [o] }),
2128
2128
  compute: {
2129
- module: t.createShaderModule({ code: Ps }),
2129
+ module: t.createShaderModule({ code: Zs }),
2130
2130
  entryPoint: "main"
2131
2131
  }
2132
2132
  }), this._gpuSkinningBindGroup = t.createBindGroup({
@@ -2216,11 +2216,11 @@ class ks {
2216
2216
  return this._extractValue(n, r.length - 1, o, i);
2217
2217
  let c = 0, l = r.length - 1;
2218
2218
  for (; l - c > 1; ) {
2219
- const _ = Math.floor((c + l) / 2);
2220
- r[_] <= e ? c = _ : l = _;
2219
+ const A = Math.floor((c + l) / 2);
2220
+ r[A] <= e ? c = A : l = A;
2221
2221
  }
2222
- const u = r[c], p = r[l], h = (e - u) / (p - u), d = this._extractValue(n, c, o, this._sV0), b = this._extractValue(n, l, o, this._sV1);
2223
- return a === "STEP" ? (i[0] = d[0], i[1] = d[1], i[2] = d[2], o === "rotation" && (i[3] = d[3]), i) : o === "rotation" ? Os(d, b, h, i) : Vs(d, b, h, i);
2222
+ const d = r[c], S = r[l], g = (e - d) / (S - d), p = this._extractValue(n, c, o, this._sV0), v = this._extractValue(n, l, o, this._sV1);
2223
+ return a === "STEP" ? (i[0] = p[0], i[1] = p[1], i[2] = p[2], o === "rotation" && (i[3] = p[3]), i) : o === "rotation" ? dr(p, v, g, i) : ur(p, v, g, i);
2224
2224
  }
2225
2225
  /**
2226
2226
  * Extract value from values array at the given index.
@@ -2245,7 +2245,7 @@ class ks {
2245
2245
  let n = r.translation, a = r.rotation, o = r.scale;
2246
2246
  for (const c of e.channels)
2247
2247
  c.targetNode === i && (c.targetPath === "translation" ? n = this._sampleChannel(c, t, this._scrT) : c.targetPath === "rotation" ? a = this._sampleChannel(c, t, this._scrR) : c.targetPath === "scale" && (o = this._sampleChannel(c, t, this._scrS)));
2248
- Ns(n, a, o, this.jointLocalTransforms[i]);
2248
+ hr(n, a, o, this.jointLocalTransforms[i]);
2249
2249
  }
2250
2250
  }
2251
2251
  /**
@@ -2255,7 +2255,7 @@ class ks {
2255
2255
  const t = this._parentMap;
2256
2256
  for (const e of this.topologicalOrder) {
2257
2257
  const i = t[e];
2258
- i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : hi(
2258
+ i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : Gi(
2259
2259
  this.jointGlobalTransforms[i],
2260
2260
  this.jointLocalTransforms[e],
2261
2261
  this.jointGlobalTransforms[e]
@@ -2268,7 +2268,7 @@ class ks {
2268
2268
  _computeFinalMatrices() {
2269
2269
  for (let t = 0; t < this.joints.length; t++) {
2270
2270
  const e = this.joints[t], i = this.jointGlobalTransforms[e];
2271
- hi(i, this._invBindViews[t], this.jointFinalMatrices[t]);
2271
+ Gi(i, this._invBindViews[t], this.jointFinalMatrices[t]);
2272
2272
  }
2273
2273
  }
2274
2274
  /**
@@ -2278,20 +2278,20 @@ class ks {
2278
2278
  _applySkinning() {
2279
2279
  const t = this.restPositions.length / 3, e = this.restPositions, i = this.restNormals, r = this.skinnedPositions, n = this.skinnedNormals, a = this.jointWeights, o = this.jointIndices, c = this.jointFinalMatrices;
2280
2280
  for (let l = 0; l < t; l++) {
2281
- const u = l * 3, p = l * 4, h = e[u], d = e[u + 1], b = e[u + 2], _ = i[u], M = i[u + 1], R = i[u + 2];
2282
- let x = 0, L = 0, P = 0, T = 0, E = 0, D = 0;
2283
- for (let Y = 0; Y < 4; Y++) {
2284
- const k = a[p + Y];
2285
- if (k === 0) continue;
2286
- const G = c[o[p + Y]];
2287
- x += (G[0] * h + G[4] * d + G[8] * b + G[12]) * k, L += (G[1] * h + G[5] * d + G[9] * b + G[13]) * k, P += (G[2] * h + G[6] * d + G[10] * b + G[14]) * k, T += (G[0] * _ + G[4] * M + G[8] * R) * k, E += (G[1] * _ + G[5] * M + G[9] * R) * k, D += (G[2] * _ + G[6] * M + G[10] * R) * k;
2281
+ const d = l * 3, S = l * 4, g = e[d], p = e[d + 1], v = e[d + 2], A = i[d], U = i[d + 1], I = i[d + 2];
2282
+ let _ = 0, $ = 0, T = 0, z = 0, F = 0, Z = 0;
2283
+ for (let ee = 0; ee < 4; ee++) {
2284
+ const K = a[S + ee];
2285
+ if (K === 0) continue;
2286
+ const q = c[o[S + ee]];
2287
+ _ += (q[0] * g + q[4] * p + q[8] * v + q[12]) * K, $ += (q[1] * g + q[5] * p + q[9] * v + q[13]) * K, T += (q[2] * g + q[6] * p + q[10] * v + q[14]) * K, z += (q[0] * A + q[4] * U + q[8] * I) * K, F += (q[1] * A + q[5] * U + q[9] * I) * K, Z += (q[2] * A + q[6] * U + q[10] * I) * K;
2288
2288
  }
2289
- const N = Math.sqrt(T * T + E * E + D * D);
2290
- N > 1e-4 && (n[u] = T / N, n[u + 1] = E / N, n[u + 2] = D / N), r[u] = x, r[u + 1] = L, r[u + 2] = P;
2289
+ const J = Math.sqrt(z * z + F * F + Z * Z);
2290
+ J > 1e-4 && (n[d] = z / J, n[d + 1] = F / J, n[d + 2] = Z / J), r[d] = _, r[d + 1] = $, r[d + 2] = T;
2291
2291
  }
2292
2292
  }
2293
2293
  }
2294
- class js {
2294
+ class yr {
2295
2295
  constructor({ duration: t = 0, loop: e = !1, playbackRate: i = 1 } = {}) {
2296
2296
  this.currentTime = 0, this.duration = t, this.loop = e, this.playbackRate = i, this.paused = !1, this._justLooped = !1;
2297
2297
  }
@@ -2312,7 +2312,7 @@ class js {
2312
2312
  this.currentTime = Math.max(0, t || 0), this._justLooped = !1;
2313
2313
  }
2314
2314
  }
2315
- const pi = {
2315
+ const Di = {
2316
2316
  linear: (s) => s,
2317
2317
  easeInQuad: (s) => s * s,
2318
2318
  easeOutQuad: (s) => 1 - (1 - s) * (1 - s),
@@ -2331,26 +2331,26 @@ const pi = {
2331
2331
  return Math.pow(2, -10 * s) * Math.sin((s * 10 - 0.75) * t) + 1;
2332
2332
  }
2333
2333
  };
2334
- function Ys(s, t, e, i) {
2335
- const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, u = (d) => ((a * d + n) * d + r) * d, p = (d) => ((l * d + c) * d + o) * d, h = (d) => (3 * a * d + 2 * n) * d + r;
2336
- return (d) => {
2337
- if (d <= 0) return 0;
2338
- if (d >= 1) return 1;
2339
- let b = d;
2340
- for (let _ = 0; _ < 8; _++) {
2341
- const M = u(b) - d;
2342
- if (Math.abs(M) < 1e-5) break;
2343
- const R = h(b);
2344
- if (Math.abs(R) < 1e-6) break;
2345
- b -= M / R;
2334
+ function gr(s, t, e, i) {
2335
+ const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, d = (p) => ((a * p + n) * p + r) * p, S = (p) => ((l * p + c) * p + o) * p, g = (p) => (3 * a * p + 2 * n) * p + r;
2336
+ return (p) => {
2337
+ if (p <= 0) return 0;
2338
+ if (p >= 1) return 1;
2339
+ let v = p;
2340
+ for (let A = 0; A < 8; A++) {
2341
+ const U = d(v) - p;
2342
+ if (Math.abs(U) < 1e-5) break;
2343
+ const I = g(v);
2344
+ if (Math.abs(I) < 1e-6) break;
2345
+ v -= U / I;
2346
2346
  }
2347
- return p(b);
2347
+ return S(v);
2348
2348
  };
2349
2349
  }
2350
- function _i(s, t) {
2351
- return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Ys(s[0], s[1], s[2], s[3])(t) : (pi[s] || pi.linear)(t);
2350
+ function qi(s, t) {
2351
+ return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? gr(s[0], s[1], s[2], s[3])(t) : (Di[s] || Di.linear)(t);
2352
2352
  }
2353
- function qs(s, t) {
2353
+ function br(s, t) {
2354
2354
  if (!Array.isArray(s) || s.length === 0) return;
2355
2355
  if (s.length === 1 || t <= s[0].t) return s[0].v;
2356
2356
  const e = s[s.length - 1];
@@ -2359,12 +2359,12 @@ function qs(s, t) {
2359
2359
  const r = s[i], n = s[i + 1];
2360
2360
  if (t >= r.t && t <= n.t) {
2361
2361
  const a = n.t - r.t, o = a > 0 ? (t - r.t) / a : 0;
2362
- return r.v + (n.v - r.v) * _i(r.ease, o);
2362
+ return r.v + (n.v - r.v) * qi(r.ease, o);
2363
2363
  }
2364
2364
  }
2365
2365
  return e.v;
2366
2366
  }
2367
- function Hs(s, t, e) {
2367
+ function Sr(s, t, e) {
2368
2368
  if (!Array.isArray(s) || s.length === 0) return;
2369
2369
  const i = s.length, r = s[i - 1];
2370
2370
  let n, a, o;
@@ -2374,26 +2374,26 @@ function Hs(s, t, e) {
2374
2374
  n = a = r.v, o = 0;
2375
2375
  else {
2376
2376
  n = a = r.v, o = 0;
2377
- for (let p = 0; p < i - 1; p++) {
2378
- const h = s[p], d = s[p + 1];
2379
- if (t >= h.t && t <= d.t) {
2380
- const b = d.t - h.t;
2381
- n = h.v, a = d.v, o = _i(h.ease, b > 0 ? (t - h.t) / b : 0);
2377
+ for (let S = 0; S < i - 1; S++) {
2378
+ const g = s[S], p = s[S + 1];
2379
+ if (t >= g.t && t <= p.t) {
2380
+ const v = p.t - g.t;
2381
+ n = g.v, a = p.v, o = qi(g.ease, v > 0 ? (t - g.t) / v : 0);
2382
2382
  break;
2383
2383
  }
2384
2384
  }
2385
2385
  }
2386
- const c = n[0] + (a[0] - n[0]) * o, l = n[1] + (a[1] - n[1]) * o, u = n[2] + (a[2] - n[2]) * o;
2387
- return e ? (e[0] = c, e[1] = l, e[2] = u, e) : [c, l, u];
2386
+ const c = n[0] + (a[0] - n[0]) * o, l = n[1] + (a[1] - n[1]) * o, d = n[2] + (a[2] - n[2]) * o;
2387
+ return e ? (e[0] = c, e[1] = l, e[2] = d, e) : [c, l, d];
2388
2388
  }
2389
- const Zs = ["gravityStrength", "emissionRate", "damping", "particleSize", "particleSpeed"], $s = { 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 };
2390
- function mi(s) {
2389
+ const xr = ["gravityStrength", "emissionRate", "damping", "particleSize", "particleSpeed"], vr = { 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 };
2390
+ function Vi(s) {
2391
2391
  const t = atob(s), e = new Uint8Array(t.length);
2392
2392
  for (let i = 0; i < t.length; i++)
2393
2393
  e[i] = t.charCodeAt(i);
2394
2394
  return e.buffer;
2395
2395
  }
2396
- class vt {
2396
+ class Qt {
2397
2397
  constructor(t, e) {
2398
2398
  this.device = t, this.config = e, this.MAX_PARTICLES = e.maxParticles || 1e4, this.particleCount = e.particleCount || 100, this.activeParticles = 0, this.emitting = !1, this.currentEmissionTime = 0, this.emissionAccumulator = 0, this.destroyed = !1, this.particleData = new Float32Array(this.MAX_PARTICLES * 8), this.particleVelocities = new Float32Array(this.MAX_PARTICLES * 4), this.instanceBuffer = t.createBuffer({
2399
2399
  size: this.MAX_PARTICLES * 8 * 4,
@@ -2419,7 +2419,7 @@ class vt {
2419
2419
  // intensity (f32) + padding
2420
2420
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
2421
2421
  label: "systemBloomIntensityBuffer"
2422
- }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.attractorReverse === void 0 && (e.attractorReverse = !1), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(56), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this._emitSimRotY = 0, this.emitter = new ms(e), this.physics = new _s(t, this.MAX_PARTICLES), this.textureManager = new ws(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition, e.attractorReverse), e.confinementEnabled && this.setConfinement({
2422
+ }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.attractorReverse === void 0 && (e.attractorReverse = !1), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeStrokeEnabled === void 0 && (e.shapeStrokeEnabled = !1), e.shapeStrokeWidth === void 0 && (e.shapeStrokeWidth = 0.08), e.shapeStrokeSegments === void 0 && (e.shapeStrokeSegments = 96), e.shapeStrokeShape === void 0 && (e.shapeStrokeShape = "straight"), e.shapeStrokeAmplitude === void 0 && (e.shapeStrokeAmplitude = 0.08), e.shapeStrokeFrequency === void 0 && (e.shapeStrokeFrequency = 10), e.shapeStrokeSpeed === void 0 && (e.shapeStrokeSpeed = 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 ks(e), this.physics = new $s(t, this.MAX_PARTICLES), this.textureManager = new Ws(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition, e.attractorReverse), e.confinementEnabled && this.setConfinement({
2423
2423
  enabled: !0,
2424
2424
  shape: e.confinementShape,
2425
2425
  mode: e.confinementMode,
@@ -2432,7 +2432,7 @@ class vt {
2432
2432
  enabled: !0,
2433
2433
  strength: e.softBoundaryStrength,
2434
2434
  falloff: e.softBoundaryFalloff
2435
- }), 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 ui(e.script, e, this.MAX_PARTICLES)), this.initComputePipeline(t);
2435
+ }), 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 Ii(e.script, e, this.MAX_PARTICLES)), this.initComputePipeline(t);
2436
2436
  }
2437
2437
  async initComputePipeline(t) {
2438
2438
  this.computeReady = await this.physics.initComputePipeline(this.instanceBuffer, this.velocityBuffer, this.trailBuffer);
@@ -2442,7 +2442,7 @@ class vt {
2442
2442
  * @param {string|null} source - Script source code, or null to disable
2443
2443
  */
2444
2444
  setScript(t) {
2445
- 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 ui(t, this.config, this.MAX_PARTICLES), this._particleScript.snapshotConfig(this.config)) : delete this.config.script;
2445
+ 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 Ii(t, this.config, this.MAX_PARTICLES), this._particleScript.snapshotConfig(this.config)) : delete this.config.script;
2446
2446
  }
2447
2447
  async setTexture(t) {
2448
2448
  this.destroyed || (this.textureManager.destroyTexture(this.particleTexture), this.particleTexture = await this.textureManager.loadTexture(t), this.config.textureEnabled = !0, this.updateAppearanceUniform(), this.updateBuffers());
@@ -2453,7 +2453,7 @@ class vt {
2453
2453
  async setGLBModel(t) {
2454
2454
  try {
2455
2455
  this.glbRawArrayBuffer = t;
2456
- const e = await As(t);
2456
+ const e = await ir(t);
2457
2457
  this.glbMeshData = e, this.config.glbHasTexture = e.hasBaseColorTexture || !1;
2458
2458
  const i = new Float32Array(e.vertexCount * 8);
2459
2459
  for (let r = 0; r < e.vertexCount; r++) {
@@ -2469,7 +2469,7 @@ class vt {
2469
2469
  usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
2470
2470
  label: "glbIndexBuffer"
2471
2471
  }), this.device.queue.writeBuffer(this.glbIndexBuffer, 0, e.indices), this.glbIndexCount = e.indexCount, this.glbIndexFormat = e.indices instanceof Uint32Array ? "uint32" : "uint16", this.config.glbModelEnabled = !0, this.config.textureType = "glb", e.animationData) {
2472
- this.glbAnimator = new ks(e.animationData), this.glbAnimator.setRestPose(e.positions, e.normals), this.glbAnimated = !0, this.config.glbAnimated = !0, this.glbAnimator.loop = this.config.animationLoop, this._glbInterleavedData = new Float32Array(e.vertexCount * 8);
2472
+ this.glbAnimator = new mr(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);
2473
2473
  try {
2474
2474
  await this.glbAnimator.initGPUSkinning(this.device, this.glbVertexBuffer, e.texCoords);
2475
2475
  } catch (r) {
@@ -2531,7 +2531,7 @@ class vt {
2531
2531
  if (this.destroyed) return;
2532
2532
  let t = 0;
2533
2533
  this.config.rotationMode === "random" ? t = 1 : this.config.rotationMode === "velocity" ? t = 2 : this.config.rotationMode === "oriented" ? t = 3 : this.config.rotationMode === "cylindrical" && (t = 4);
2534
- const e = $s[this.config.particleShape] ?? 0, i = this._appearanceData;
2534
+ const e = vr[this.config.particleShape] ?? 0, i = this._appearanceData;
2535
2535
  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;
2536
2536
  const r = this.config.followSystemTranslation ?? !0;
2537
2537
  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);
@@ -2593,8 +2593,8 @@ class vt {
2593
2593
  this._emitSimRotY = this._simRotY || 0;
2594
2594
  const e = t * 8, i = t * 4;
2595
2595
  if (this._simRotMatrix) {
2596
- const r = this._simRotMatrix, n = this.particleData[e], a = this.particleData[e + 1], o = this.particleData[e + 2], c = this.particleVelocities[i], l = this.particleVelocities[i + 1], u = this.particleVelocities[i + 2];
2597
- this.particleData[e] = r[0] * n + r[1] * a + r[2] * o, this.particleData[e + 1] = r[3] * n + r[4] * a + r[5] * o, this.particleData[e + 2] = r[6] * n + r[7] * a + r[8] * o, this.particleVelocities[i] = r[0] * c + r[1] * l + r[2] * u, this.particleVelocities[i + 1] = r[3] * c + r[4] * l + r[5] * u, this.particleVelocities[i + 2] = r[6] * c + r[7] * l + r[8] * u;
2596
+ const r = this._simRotMatrix, n = this.particleData[e], a = this.particleData[e + 1], o = this.particleData[e + 2], c = this.particleVelocities[i], l = this.particleVelocities[i + 1], d = this.particleVelocities[i + 2];
2597
+ this.particleData[e] = r[0] * n + r[1] * a + r[2] * o, this.particleData[e + 1] = r[3] * n + r[4] * a + r[5] * o, this.particleData[e + 2] = r[6] * n + r[7] * a + r[8] * o, this.particleVelocities[i] = r[0] * c + r[1] * l + r[2] * d, this.particleVelocities[i + 1] = r[3] * c + r[4] * l + r[5] * d, this.particleVelocities[i + 2] = r[6] * c + r[7] * l + r[8] * d;
2598
2598
  }
2599
2599
  (this.config.followSystemTranslation ?? !0) || (this.particleData[e] += this._simPosition[0], this.particleData[e + 1] += this._simPosition[1], this.particleData[e + 2] += this._simPosition[2]);
2600
2600
  }
@@ -2626,20 +2626,20 @@ class vt {
2626
2626
  const r = this.config.startAt || 0, n = r > 0 && i < r;
2627
2627
  if (this._particleScript && this._scriptReadbackReady) {
2628
2628
  this._scriptReadbackReady = !1, this._scriptTime += t, this._scriptFrame++;
2629
- const u = this.config.emissionDurationInfinite ? 1 / 0 : (this.config.emissionDuration || 0) + (this.config.lifetime || 0);
2630
- if (u > 0 && this._scriptTime >= u && !this._scriptConfigRestored)
2629
+ const d = this.config.emissionDurationInfinite ? 1 / 0 : (this.config.emissionDuration || 0) + (this.config.lifetime || 0);
2630
+ if (d > 0 && this._scriptTime >= d && !this._scriptConfigRestored)
2631
2631
  this._scriptConfigRestored = !0, this._particleScript._configSnapshot && (this._particleScript.restoreConfig(this.config), this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse));
2632
2632
  else if (!this._scriptConfigRestored) {
2633
- const p = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: h, particlesDirty: d } = this._particleScript.execute(
2633
+ const S = d > 0 ? Math.ceil(d / 0.016666666666666666) : 0, { configDirty: g, particlesDirty: p } = this._particleScript.execute(
2634
2634
  t,
2635
2635
  this._scriptTime,
2636
2636
  this._scriptFrame,
2637
- p,
2637
+ S,
2638
2638
  this._scriptParticleData,
2639
2639
  this._scriptVelocityData,
2640
2640
  this.activeParticles
2641
2641
  );
2642
- d && this.activeParticles > 0 && (this.device.queue.writeBuffer(
2642
+ p && this.activeParticles > 0 && (this.device.queue.writeBuffer(
2643
2643
  this.instanceBuffer,
2644
2644
  0,
2645
2645
  this._scriptParticleData,
@@ -2651,58 +2651,58 @@ class vt {
2651
2651
  this._scriptVelocityData,
2652
2652
  0,
2653
2653
  this.activeParticles * 4
2654
- )), h && (this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse));
2654
+ )), g && (this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition, this.config.attractorReverse));
2655
2655
  }
2656
2656
  }
2657
2657
  this.physics.physicsAccumulator += t;
2658
2658
  const a = performance.now() / 1e3, c = a - this.physics.lastUpdateTime > 1 / this.physics.minUpdatesPerSecond, l = this.activeParticles;
2659
2659
  if (!n && !this.emitting && !this.config.burstMode && !this.config.followSystemId && this.currentEmissionTime < this.effectiveEmissionDuration && (this.emitting = !0), !n && this.emitting)
2660
2660
  if (this.currentEmissionTime += t, this.currentEmissionTime < this.effectiveEmissionDuration) {
2661
- const u = this.activeParticles;
2662
- let p = !1;
2661
+ const d = this.activeParticles;
2662
+ let S = !1;
2663
2663
  if (this.config.followSystemId) {
2664
2664
  if (this._pendingFollowEmissions.length > 0) {
2665
- const h = this._pendingFollowEmissions.length / 6;
2666
- for (let d = 0; d < h; d++) {
2667
- const b = d * 6;
2665
+ const g = this._pendingFollowEmissions.length / 6;
2666
+ for (let p = 0; p < g; p++) {
2667
+ const v = p * 6;
2668
2668
  if (this.emitFollowerParticle(
2669
- this._pendingFollowEmissions[b],
2670
- this._pendingFollowEmissions[b + 1],
2671
- this._pendingFollowEmissions[b + 2]
2669
+ this._pendingFollowEmissions[v],
2670
+ this._pendingFollowEmissions[v + 1],
2671
+ this._pendingFollowEmissions[v + 2]
2672
2672
  ))
2673
- p = !0;
2673
+ S = !0;
2674
2674
  else
2675
2675
  break;
2676
2676
  }
2677
2677
  }
2678
2678
  } else {
2679
- let h = 0;
2680
- const d = Math.max(0, this.config.emissionRate || 0);
2681
- this.activeParticles < this.particleCount && d > 0 ? (this.emissionAccumulator += d * t, h = Math.floor(this.emissionAccumulator + 1e-9), h > 0 && (this.emissionAccumulator -= h)) : this.activeParticles >= this.particleCount && (this.emissionAccumulator = 0);
2682
- for (let b = 0; b < h; b++)
2679
+ let g = 0;
2680
+ const p = Math.max(0, this.config.emissionRate || 0);
2681
+ this.activeParticles < this.particleCount && p > 0 ? (this.emissionAccumulator += p * t, g = Math.floor(this.emissionAccumulator + 1e-9), g > 0 && (this.emissionAccumulator -= g)) : this.activeParticles >= this.particleCount && (this.emissionAccumulator = 0);
2682
+ for (let v = 0; v < g; v++)
2683
2683
  if (this.emitParticle())
2684
- p = !0;
2684
+ S = !0;
2685
2685
  else {
2686
2686
  this.emissionAccumulator = 0;
2687
2687
  break;
2688
2688
  }
2689
2689
  }
2690
- if (p) {
2691
- const h = this.activeParticles - u, d = u * 8, b = u * 4;
2690
+ if (S) {
2691
+ const g = this.activeParticles - d, p = d * 8, v = d * 4;
2692
2692
  this.device.queue.writeBuffer(
2693
2693
  this.instanceBuffer,
2694
- d * 4,
2694
+ p * 4,
2695
2695
  // Offset in bytes (float32 = 4 bytes)
2696
2696
  this.particleData,
2697
- d,
2698
- h * 8
2697
+ p,
2698
+ g * 8
2699
2699
  ), this.device.queue.writeBuffer(
2700
2700
  this.velocityBuffer,
2701
- b * 4,
2701
+ v * 4,
2702
2702
  // Offset in bytes (float32 = 4 bytes)
2703
2703
  this.particleVelocities,
2704
- b,
2705
- h * 4
2704
+ v,
2705
+ g * 4
2706
2706
  );
2707
2707
  }
2708
2708
  } else
@@ -2729,8 +2729,8 @@ class vt {
2729
2729
  this._scriptVelocityData,
2730
2730
  this.instanceBuffer,
2731
2731
  this.velocityBuffer
2732
- ).then((u) => {
2733
- this._scriptReadbackPending = !1, u.shouldUpdate && (this._scriptReadbackReady = !0);
2732
+ ).then((d) => {
2733
+ this._scriptReadbackPending = !1, d.shouldUpdate && (this._scriptReadbackReady = !0);
2734
2734
  }).catch(() => {
2735
2735
  this._scriptReadbackPending = !1;
2736
2736
  }));
@@ -2758,8 +2758,8 @@ class vt {
2758
2758
  if (e !== r) {
2759
2759
  const o = r * 8, c = e * 8;
2760
2760
  this.particleData.copyWithin(c, o, o + 8);
2761
- const l = r * 4, u = e * 4;
2762
- this.particleVelocities.copyWithin(u, l, l + 4), i = !0;
2761
+ const l = r * 4, d = e * 4;
2762
+ this.particleVelocities.copyWithin(d, l, l + 4), i = !0;
2763
2763
  }
2764
2764
  e++;
2765
2765
  }
@@ -2788,17 +2788,17 @@ class vt {
2788
2788
  }
2789
2789
  updateParticleVelocities() {
2790
2790
  for (let t = 0; t < this.activeParticles; t++) {
2791
- const e = t * 8, i = t * 4, r = this.particleData[e], n = this.particleData[e + 1], a = this.particleData[e + 2], o = this.particleVelocities[i], c = this.particleVelocities[i + 1], l = this.particleVelocities[i + 2], u = Math.sqrt(
2791
+ const e = t * 8, i = t * 4, r = this.particleData[e], n = this.particleData[e + 1], a = this.particleData[e + 2], o = this.particleVelocities[i], c = this.particleVelocities[i + 1], l = this.particleVelocities[i + 2], d = Math.sqrt(
2792
2792
  o * o + c * c + l * l
2793
2793
  );
2794
- if (u > 1e-3) {
2795
- const p = this.config.particleSpeed * 2;
2796
- this.particleVelocities[i] = o / u * p, this.particleVelocities[i + 1] = c / u * p, this.particleVelocities[i + 2] = l / u * p;
2794
+ if (d > 1e-3) {
2795
+ const S = this.config.particleSpeed * 2;
2796
+ this.particleVelocities[i] = o / d * S, this.particleVelocities[i + 1] = c / d * S, this.particleVelocities[i + 2] = l / d * S;
2797
2797
  } else {
2798
- const p = Math.sqrt(r * r + n * n + a * a);
2799
- if (p > 1e-3) {
2800
- const h = this.config.particleSpeed * 2;
2801
- this.particleVelocities[i] = r / p * h, this.particleVelocities[i + 1] = n / p * h, this.particleVelocities[i + 2] = a / p * h;
2798
+ const S = Math.sqrt(r * r + n * n + a * a);
2799
+ if (S > 1e-3) {
2800
+ const g = this.config.particleSpeed * 2;
2801
+ this.particleVelocities[i] = r / S * g, this.particleVelocities[i + 1] = n / S * g, this.particleVelocities[i + 2] = a / S * g;
2802
2802
  } else
2803
2803
  this.particleVelocities[i] = 0, this.particleVelocities[i + 1] = this.config.particleSpeed * 2, this.particleVelocities[i + 2] = 0;
2804
2804
  }
@@ -2843,16 +2843,16 @@ class vt {
2843
2843
  this.physics.setSoftBoundary(t);
2844
2844
  }
2845
2845
  }
2846
- class Ws {
2846
+ class Pr {
2847
2847
  constructor(t) {
2848
- this.device = t, this.particleSystems = [], this.activeSystemIndex = 0, this.systemCounter = 1, this.onSystemCreated = null, this.loop = void 0, this.clock = new js({ loop: !!this.loop }), this.ready = !0;
2848
+ this.device = t, this.particleSystems = [], this.activeSystemIndex = 0, this.systemCounter = 1, this.onSystemCreated = null, this.loop = void 0, this.clock = new yr({ loop: !!this.loop }), this.ready = !0;
2849
2849
  }
2850
2850
  createParticleSystem(t = {}) {
2851
2851
  const e = this.systemCounter++, i = t.name || `System ${e + 1}`, r = {
2852
2852
  ...t,
2853
2853
  name: i,
2854
2854
  id: e
2855
- }, n = new vt(this.device, r);
2855
+ }, n = new Qt(this.device, r);
2856
2856
  return this.particleSystems.push({
2857
2857
  system: n,
2858
2858
  config: r
@@ -2916,16 +2916,16 @@ class Ws {
2916
2916
  for (const { system: o, config: c } of this.particleSystems) {
2917
2917
  const l = c.keyframes;
2918
2918
  if (!(!l || c.keyframesEnabled === !1)) {
2919
- for (const u of Zs) {
2920
- const p = l[u];
2921
- if (p && p.length) {
2922
- const h = qs(p, a);
2923
- h !== void 0 && (c[u] = h);
2919
+ for (const d of xr) {
2920
+ const S = l[d];
2921
+ if (S && S.length) {
2922
+ const g = br(S, a);
2923
+ g !== void 0 && (c[d] = g);
2924
2924
  }
2925
2925
  }
2926
2926
  if (l.particleColor && l.particleColor.length) {
2927
- const u = c.particleColor, p = u && typeof u.length == "number" && u.length >= 3 ? u : void 0, h = Hs(l.particleColor, a, p);
2928
- h && (c.particleColor = h, o.updateAppearanceUniform());
2927
+ const d = c.particleColor, S = d && typeof d.length == "number" && d.length >= 3 ? d : void 0, g = Sr(l.particleColor, a, S);
2928
+ g && (c.particleColor = g, o.updateAppearanceUniform());
2929
2929
  }
2930
2930
  }
2931
2931
  }
@@ -2976,7 +2976,7 @@ class Ws {
2976
2976
  const n = this.systemCounter++, a = {
2977
2977
  ...r,
2978
2978
  id: n
2979
- }, o = new vt(this.device, a);
2979
+ }, o = new Qt(this.device, a);
2980
2980
  this.particleSystems.push({
2981
2981
  system: o,
2982
2982
  config: a
@@ -2994,7 +2994,7 @@ class Ws {
2994
2994
  try {
2995
2995
  let a = null;
2996
2996
  if (n.glbModelData)
2997
- a = mi(n.glbModelData);
2997
+ a = Vi(n.glbModelData);
2998
2998
  else if (n.glbFileName) {
2999
2999
  const o = await fetch(`/${n.glbFileName}`);
3000
3000
  o.ok ? a = await o.arrayBuffer() : console.warn(`GLB file not found: ${n.glbFileName}`);
@@ -3002,7 +3002,7 @@ class Ws {
3002
3002
  if (a) {
3003
3003
  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))
3004
3004
  try {
3005
- const o = await fi(a);
3005
+ const o = await Fi(a);
3006
3006
  if (o) {
3007
3007
  const c = await createImageBitmap(o.imageBlob);
3008
3008
  await r.setTexture(c), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${n.name}`);
@@ -3070,9 +3070,9 @@ class Ws {
3070
3070
  (o.confinementCenter[1] || 0) + e[1],
3071
3071
  (o.confinementCenter[2] || 0) + e[2]
3072
3072
  ]);
3073
- const u = new vt(this.device, l);
3073
+ const d = new Qt(this.device, l);
3074
3074
  this.particleSystems.push({
3075
- system: u,
3075
+ system: d,
3076
3076
  config: l
3077
3077
  }), this.onSystemCreated && typeof this.onSystemCreated == "function" && this.onSystemCreated(c, l);
3078
3078
  }
@@ -3089,21 +3089,21 @@ class Ws {
3089
3089
  try {
3090
3090
  let l = null;
3091
3091
  if (c.glbModelData)
3092
- l = mi(c.glbModelData);
3092
+ l = Vi(c.glbModelData);
3093
3093
  else if (c.glbFileName) {
3094
- const u = await fetch(`/${c.glbFileName}`);
3095
- u.ok ? l = await u.arrayBuffer() : console.warn(`GLB file not found: ${c.glbFileName}`);
3094
+ const d = await fetch(`/${c.glbFileName}`);
3095
+ d.ok ? l = await d.arrayBuffer() : console.warn(`GLB file not found: ${c.glbFileName}`);
3096
3096
  }
3097
3097
  if (l) {
3098
3098
  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))
3099
3099
  try {
3100
- const u = await fi(l);
3101
- if (u) {
3102
- const p = await createImageBitmap(u.imageBlob);
3103
- await o.setTexture(p), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
3100
+ const d = await Fi(l);
3101
+ if (d) {
3102
+ const S = await createImageBitmap(d.imageBlob);
3103
+ await o.setTexture(S), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
3104
3104
  }
3105
- } catch (u) {
3106
- console.warn(`Failed to restore GLB texture for ${c.name}:`, u), c.useGlbTexture = !1;
3105
+ } catch (d) {
3106
+ console.warn(`Failed to restore GLB texture for ${c.name}:`, d), c.useGlbTexture = !1;
3107
3107
  }
3108
3108
  } else
3109
3109
  c.glbModelEnabled = !1;
@@ -3114,11 +3114,11 @@ class Ws {
3114
3114
  if (c.textureEnabled && !c.glbModelEnabled && c.textureImageData && !o._textureRestored)
3115
3115
  try {
3116
3116
  const l = new Image();
3117
- await new Promise((p, h) => {
3118
- l.onload = p, l.onerror = h, l.src = c.textureImageData;
3117
+ await new Promise((S, g) => {
3118
+ l.onload = S, l.onerror = g, l.src = c.textureImageData;
3119
3119
  });
3120
- const u = await createImageBitmap(l);
3121
- await o.setTexture(u), o._textureRestored = !0;
3120
+ const d = await createImageBitmap(l);
3121
+ await o.setTexture(d), o._textureRestored = !0;
3122
3122
  } catch (l) {
3123
3123
  console.warn(`Failed to restore texture for ${c.name}:`, l), c.textureEnabled = !1;
3124
3124
  }
@@ -3130,7 +3130,7 @@ class Ws {
3130
3130
  }
3131
3131
  }
3132
3132
  }
3133
- async function Js(s) {
3133
+ async function _r(s) {
3134
3134
  if (!s)
3135
3135
  throw new Error("canvas is required for initWebGPU()");
3136
3136
  if (!navigator.gpu)
@@ -3142,37 +3142,37 @@ async function Js(s) {
3142
3142
  alphaMode: "premultiplied"
3143
3143
  }), { device: i, context: t, format: r, canvas: s };
3144
3144
  }
3145
- const oe = "rgba16float";
3146
- function yi(s, t, e, i) {
3145
+ const Ne = "rgba16float";
3146
+ function Oi(s, t, e, i) {
3147
3147
  const r = s.createTexture({
3148
3148
  size: [e, i],
3149
- format: oe,
3149
+ format: Ne,
3150
3150
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3151
3151
  mipLevelCount: 1,
3152
3152
  sampleCount: 1
3153
3153
  }), n = s.createTexture({
3154
3154
  size: [e, i],
3155
- format: oe,
3155
+ format: Ne,
3156
3156
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3157
3157
  mipLevelCount: 1,
3158
3158
  sampleCount: 1
3159
3159
  }), a = s.createTexture({
3160
3160
  size: [e, i],
3161
- format: oe,
3161
+ format: Ne,
3162
3162
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
3163
3163
  mipLevelCount: 1,
3164
3164
  sampleCount: 1
3165
3165
  });
3166
3166
  return { sceneTexture: r, bloomTexA: n, bloomTexB: a };
3167
3167
  }
3168
- function gi(s, t, e) {
3168
+ function Li(s, t, e) {
3169
3169
  return s.createTexture({
3170
3170
  size: [t, e],
3171
3171
  format: "depth24plus",
3172
3172
  usage: GPUTextureUsage.RENDER_ATTACHMENT
3173
3173
  });
3174
3174
  }
3175
- function Ge(s, t, e) {
3175
+ function vt(s, t, e) {
3176
3176
  const i = s.createBuffer({
3177
3177
  size: t.byteLength,
3178
3178
  usage: e,
@@ -3180,7 +3180,7 @@ function Ge(s, t, e) {
3180
3180
  });
3181
3181
  return new t.constructor(i.getMappedRange()).set(t), i.unmap(), i;
3182
3182
  }
3183
- const Qs = `
3183
+ const Mr = `
3184
3184
  struct Uniforms {
3185
3185
  transform: mat4x4<f32>,
3186
3186
  cameraPosition: vec3<f32>,
@@ -3242,7 +3242,7 @@ const Qs = `
3242
3242
 
3243
3243
  return finalColor;
3244
3244
  }
3245
- `, Ks = `
3245
+ `, wr = `
3246
3246
  struct Uniforms {
3247
3247
  transform: mat4x4<f32>,
3248
3248
  cameraPosition: vec3<f32>,
@@ -3479,7 +3479,7 @@ const Qs = `
3479
3479
  return finalColor;
3480
3480
  }
3481
3481
  `;
3482
- function er(s) {
3482
+ function Br(s) {
3483
3483
  const t = s.createBindGroupLayout({
3484
3484
  entries: [
3485
3485
  {
@@ -3565,34 +3565,34 @@ function er(s) {
3565
3565
  object3dBindGroupLayout: r
3566
3566
  };
3567
3567
  }
3568
- function tr(s, t, e, i = {}) {
3568
+ function Rr(s, t, e, i = {}) {
3569
3569
  const { depthCompare: r } = i, n = r || "less", {
3570
3570
  particleBindGroupLayout: a,
3571
3571
  bloomBindGroupLayout: o,
3572
3572
  compositeBindGroupLayout: c,
3573
3573
  object3dBindGroupLayout: l
3574
- } = e, u = s.createPipelineLayout({
3574
+ } = e, d = s.createPipelineLayout({
3575
3575
  bindGroupLayouts: [a]
3576
- }), p = s.createPipelineLayout({
3576
+ }), S = s.createPipelineLayout({
3577
3577
  bindGroupLayouts: [o]
3578
- }), h = s.createPipelineLayout({
3578
+ }), g = s.createPipelineLayout({
3579
3579
  bindGroupLayouts: [c]
3580
- }), d = s.createShaderModule({
3581
- code: ys
3582
- }), b = s.createShaderModule({
3583
- code: gs
3580
+ }), p = s.createShaderModule({
3581
+ code: Xs
3582
+ }), v = s.createShaderModule({
3583
+ code: Ns
3584
+ }), A = s.createShaderModule({
3585
+ code: Ys
3586
+ }), U = s.createShaderModule({
3587
+ code: js
3588
+ }), I = s.createShaderModule({
3589
+ code: Mr
3584
3590
  }), _ = s.createShaderModule({
3585
- code: bs
3586
- }), M = s.createShaderModule({
3587
- code: Ss
3588
- }), R = s.createShaderModule({
3589
- code: Qs
3590
- }), x = s.createShaderModule({
3591
- code: Ks
3592
- }), L = (W) => s.createRenderPipeline({
3593
- layout: u,
3591
+ code: wr
3592
+ }), $ = (kt) => s.createRenderPipeline({
3593
+ layout: d,
3594
3594
  vertex: {
3595
- module: d,
3595
+ module: p,
3596
3596
  entryPoint: "vs_main",
3597
3597
  buffers: [
3598
3598
  {
@@ -3653,11 +3653,11 @@ function tr(s, t, e, i = {}) {
3653
3653
  ]
3654
3654
  },
3655
3655
  fragment: {
3656
- module: d,
3656
+ module: p,
3657
3657
  entryPoint: "fs_main",
3658
3658
  targets: [{
3659
- format: oe,
3660
- blend: W
3659
+ format: Ne,
3660
+ blend: kt
3661
3661
  }]
3662
3662
  },
3663
3663
  primitive: {
@@ -3669,7 +3669,7 @@ function tr(s, t, e, i = {}) {
3669
3669
  depthCompare: n,
3670
3670
  format: "depth24plus"
3671
3671
  }
3672
- }), P = L({
3672
+ }), T = $({
3673
3673
  color: {
3674
3674
  srcFactor: "src-alpha",
3675
3675
  dstFactor: "one-minus-src-alpha",
@@ -3680,7 +3680,7 @@ function tr(s, t, e, i = {}) {
3680
3680
  dstFactor: "one-minus-src-alpha",
3681
3681
  operation: "add"
3682
3682
  }
3683
- }), T = L({
3683
+ }), z = $({
3684
3684
  color: {
3685
3685
  srcFactor: "src-alpha",
3686
3686
  dstFactor: "one",
@@ -3691,10 +3691,10 @@ function tr(s, t, e, i = {}) {
3691
3691
  dstFactor: "one-minus-src-alpha",
3692
3692
  operation: "add"
3693
3693
  }
3694
- }), E = s.createRenderPipeline({
3695
- layout: u,
3694
+ }), F = s.createRenderPipeline({
3695
+ layout: d,
3696
3696
  vertex: {
3697
- module: d,
3697
+ module: p,
3698
3698
  entryPoint: "vs_main",
3699
3699
  buffers: [
3700
3700
  {
@@ -3755,10 +3755,10 @@ function tr(s, t, e, i = {}) {
3755
3755
  ]
3756
3756
  },
3757
3757
  fragment: {
3758
- module: d,
3758
+ module: p,
3759
3759
  entryPoint: "fs_main",
3760
3760
  targets: [{
3761
- format: oe,
3761
+ format: Ne,
3762
3762
  writeMask: 0
3763
3763
  // No color write — depth only
3764
3764
  }]
@@ -3773,33 +3773,33 @@ function tr(s, t, e, i = {}) {
3773
3773
  // Always write depth (don't self-occlude)
3774
3774
  format: "depth24plus"
3775
3775
  }
3776
- }), D = s.createRenderPipeline({
3777
- layout: p,
3776
+ }), Z = s.createRenderPipeline({
3777
+ layout: S,
3778
3778
  vertex: {
3779
- module: b,
3779
+ module: v,
3780
3780
  entryPoint: "vs_main"
3781
3781
  },
3782
3782
  fragment: {
3783
- module: b,
3783
+ module: v,
3784
3784
  entryPoint: "fs_main",
3785
3785
  targets: [{
3786
- format: oe
3786
+ format: Ne
3787
3787
  }]
3788
3788
  },
3789
3789
  primitive: {
3790
3790
  topology: "triangle-list"
3791
3791
  }
3792
- }), N = s.createRenderPipeline({
3793
- layout: h,
3792
+ }), J = s.createRenderPipeline({
3793
+ layout: g,
3794
3794
  vertex: {
3795
- module: _,
3795
+ module: A,
3796
3796
  entryPoint: "vs_main"
3797
3797
  },
3798
3798
  fragment: {
3799
- module: _,
3799
+ module: A,
3800
3800
  entryPoint: "fs_main",
3801
3801
  targets: [{
3802
- format: oe,
3802
+ format: Ne,
3803
3803
  blend: {
3804
3804
  color: {
3805
3805
  srcFactor: "one",
@@ -3817,17 +3817,17 @@ function tr(s, t, e, i = {}) {
3817
3817
  primitive: {
3818
3818
  topology: "triangle-list"
3819
3819
  }
3820
- }), Y = s.createRenderPipeline({
3821
- layout: h,
3820
+ }), ee = s.createRenderPipeline({
3821
+ layout: g,
3822
3822
  vertex: {
3823
- module: M,
3823
+ module: U,
3824
3824
  entryPoint: "vs_main"
3825
3825
  },
3826
3826
  fragment: {
3827
- module: M,
3827
+ module: U,
3828
3828
  entryPoint: "fs_main",
3829
3829
  targets: [{
3830
- format: oe,
3830
+ format: Ne,
3831
3831
  blend: {
3832
3832
  color: {
3833
3833
  srcFactor: "one",
@@ -3845,11 +3845,11 @@ function tr(s, t, e, i = {}) {
3845
3845
  primitive: {
3846
3846
  topology: "triangle-list"
3847
3847
  }
3848
- }), k = s.createShaderModule({ code: xs }), G = s.createRenderPipeline({
3849
- layout: h,
3850
- vertex: { module: k, entryPoint: "vs_main" },
3848
+ }), K = s.createShaderModule({ code: qs }), q = s.createRenderPipeline({
3849
+ layout: g,
3850
+ vertex: { module: K, entryPoint: "vs_main" },
3851
3851
  fragment: {
3852
- module: k,
3852
+ module: K,
3853
3853
  entryPoint: "fs_main",
3854
3854
  targets: [{
3855
3855
  format: t,
@@ -3860,12 +3860,12 @@ function tr(s, t, e, i = {}) {
3860
3860
  }]
3861
3861
  },
3862
3862
  primitive: { topology: "triangle-list" }
3863
- }), de = s.createPipelineLayout({
3863
+ }), Ke = s.createPipelineLayout({
3864
3864
  bindGroupLayouts: [l]
3865
- }), Fe = s.createRenderPipeline({
3866
- layout: de,
3865
+ }), Pt = s.createRenderPipeline({
3866
+ layout: Ke,
3867
3867
  vertex: {
3868
- module: R,
3868
+ module: I,
3869
3869
  entryPoint: "vs_main",
3870
3870
  buffers: [
3871
3871
  {
@@ -3890,10 +3890,10 @@ function tr(s, t, e, i = {}) {
3890
3890
  ]
3891
3891
  },
3892
3892
  fragment: {
3893
- module: R,
3893
+ module: I,
3894
3894
  entryPoint: "fs_main",
3895
3895
  targets: [{
3896
- format: oe,
3896
+ format: Ne,
3897
3897
  blend: {
3898
3898
  color: {
3899
3899
  srcFactor: "src-alpha",
@@ -3917,10 +3917,10 @@ function tr(s, t, e, i = {}) {
3917
3917
  depthCompare: n,
3918
3918
  format: "depth24plus"
3919
3919
  }
3920
- }), ct = s.createRenderPipeline({
3921
- layout: u,
3920
+ }), Ye = s.createRenderPipeline({
3921
+ layout: d,
3922
3922
  vertex: {
3923
- module: x,
3923
+ module: _,
3924
3924
  entryPoint: "vs_main",
3925
3925
  buffers: [
3926
3926
  {
@@ -3992,10 +3992,10 @@ function tr(s, t, e, i = {}) {
3992
3992
  ]
3993
3993
  },
3994
3994
  fragment: {
3995
- module: x,
3995
+ module: _,
3996
3996
  entryPoint: "fs_main",
3997
3997
  targets: [{
3998
- format: oe,
3998
+ format: Ne,
3999
3999
  blend: {
4000
4000
  color: {
4001
4001
  srcFactor: "src-alpha",
@@ -4021,18 +4021,18 @@ function tr(s, t, e, i = {}) {
4021
4021
  }
4022
4022
  });
4023
4023
  return {
4024
- particlePipeline: P,
4025
- particleAdditivePipeline: T,
4026
- particleDepthWritePipeline: E,
4027
- blurPipeline: D,
4028
- compositePipeline: N,
4029
- directRenderPipeline: Y,
4030
- finalCompositePipeline: G,
4031
- object3dPipeline: Fe,
4032
- glbMeshPipeline: ct
4024
+ particlePipeline: T,
4025
+ particleAdditivePipeline: z,
4026
+ particleDepthWritePipeline: F,
4027
+ blurPipeline: Z,
4028
+ compositePipeline: J,
4029
+ directRenderPipeline: ee,
4030
+ finalCompositePipeline: q,
4031
+ object3dPipeline: Pt,
4032
+ glbMeshPipeline: Ye
4033
4033
  };
4034
4034
  }
4035
- function Pt(s, t, e, i) {
4035
+ function ei(s, t, e, i) {
4036
4036
  const {
4037
4037
  uniformBuffer: r,
4038
4038
  appearanceUniformBuffer: n,
@@ -4041,9 +4041,9 @@ function Pt(s, t, e, i) {
4041
4041
  bloomIntensityBuffer: c
4042
4042
  } = e, {
4043
4043
  sceneTexture: l,
4044
- bloomTexA: u,
4045
- bloomTexB: p
4046
- } = i, h = s.createBindGroup({
4044
+ bloomTexA: d,
4045
+ bloomTexB: S
4046
+ } = i, g = s.createBindGroup({
4047
4047
  layout: s.createBindGroupLayout({
4048
4048
  entries: [
4049
4049
  {
@@ -4068,7 +4068,7 @@ function Pt(s, t, e, i) {
4068
4068
  resource: { buffer: n }
4069
4069
  }
4070
4070
  ]
4071
- }), d = s.createBindGroup({
4071
+ }), p = s.createBindGroup({
4072
4072
  layout: s.createBindGroupLayout({
4073
4073
  entries: [
4074
4074
  {
@@ -4102,7 +4102,7 @@ function Pt(s, t, e, i) {
4102
4102
  resource: { buffer: a }
4103
4103
  }
4104
4104
  ]
4105
- }), b = s.createBindGroup({
4105
+ }), v = s.createBindGroup({
4106
4106
  layout: s.createBindGroupLayout({
4107
4107
  entries: [
4108
4108
  {
@@ -4129,14 +4129,14 @@ function Pt(s, t, e, i) {
4129
4129
  },
4130
4130
  {
4131
4131
  binding: 1,
4132
- resource: u.createView()
4132
+ resource: d.createView()
4133
4133
  },
4134
4134
  {
4135
4135
  binding: 2,
4136
4136
  resource: { buffer: o }
4137
4137
  }
4138
4138
  ]
4139
- }), _ = s.createBindGroup({
4139
+ }), A = s.createBindGroup({
4140
4140
  layout: s.createBindGroupLayout({
4141
4141
  entries: [
4142
4142
  {
@@ -4172,14 +4172,14 @@ function Pt(s, t, e, i) {
4172
4172
  },
4173
4173
  {
4174
4174
  binding: 2,
4175
- resource: p.createView()
4175
+ resource: S.createView()
4176
4176
  },
4177
4177
  {
4178
4178
  binding: 3,
4179
4179
  resource: { buffer: c }
4180
4180
  }
4181
4181
  ]
4182
- }), M = s.createBindGroup({
4182
+ }), U = s.createBindGroup({
4183
4183
  layout: s.createBindGroupLayout({
4184
4184
  entries: [
4185
4185
  {
@@ -4215,7 +4215,7 @@ function Pt(s, t, e, i) {
4215
4215
  },
4216
4216
  {
4217
4217
  binding: 2,
4218
- resource: p.createView()
4218
+ resource: S.createView()
4219
4219
  },
4220
4220
  {
4221
4221
  binding: 3,
@@ -4224,14 +4224,14 @@ function Pt(s, t, e, i) {
4224
4224
  ]
4225
4225
  });
4226
4226
  return {
4227
- particleBindGroup: h,
4228
- horizontalBlurBindGroup: d,
4229
- verticalBlurBindGroup: b,
4230
- compositeBindGroup: _,
4231
- directRenderBindGroup: M
4227
+ particleBindGroup: g,
4228
+ horizontalBlurBindGroup: p,
4229
+ verticalBlurBindGroup: v,
4230
+ compositeBindGroup: A,
4231
+ directRenderBindGroup: U
4232
4232
  };
4233
4233
  }
4234
- function ir(s) {
4234
+ function Tr(s) {
4235
4235
  return s.createSampler({
4236
4236
  magFilter: "linear",
4237
4237
  minFilter: "linear",
@@ -4241,7 +4241,7 @@ function ir(s) {
4241
4241
  maxAnisotropy: 16
4242
4242
  });
4243
4243
  }
4244
- function sr() {
4244
+ function Er() {
4245
4245
  const s = new Float32Array([
4246
4246
  // Front face (z = 0.5)
4247
4247
  -0.5,
@@ -4439,13 +4439,13 @@ function sr() {
4439
4439
  ]);
4440
4440
  return { vertices: s, indices: t };
4441
4441
  }
4442
- function rr(s = 16, t = 16) {
4442
+ function Ar(s = 16, t = 16) {
4443
4443
  const e = [], i = [];
4444
4444
  for (let r = 0; r <= s; r++) {
4445
4445
  const n = r * Math.PI / s, a = Math.sin(n), o = Math.cos(n);
4446
4446
  for (let c = 0; c <= t; c++) {
4447
- const l = c * 2 * Math.PI / t, u = Math.sin(l), h = Math.cos(l) * a, d = o, b = u * a;
4448
- e.push(h * 0.5, d * 0.5, b * 0.5), e.push(h, d, b);
4447
+ const l = c * 2 * Math.PI / t, d = Math.sin(l), g = Math.cos(l) * a, p = o, v = d * a;
4448
+ e.push(g * 0.5, p * 0.5, v * 0.5), e.push(g, p, v);
4449
4449
  }
4450
4450
  }
4451
4451
  for (let r = 0; r < s; r++)
@@ -4458,7 +4458,7 @@ function rr(s = 16, t = 16) {
4458
4458
  indices: new Uint16Array(i)
4459
4459
  };
4460
4460
  }
4461
- class nr {
4461
+ class Cr {
4462
4462
  constructor(t, e, i, r, n) {
4463
4463
  this.id = t, this.type = e, this.position = i, this.scale = r, this.color = n, this.rotation = [0, 0, 0];
4464
4464
  }
@@ -4592,7 +4592,7 @@ class nr {
4592
4592
  return i;
4593
4593
  }
4594
4594
  }
4595
- class hr {
4595
+ class Vr {
4596
4596
  constructor(t) {
4597
4597
  this.device = t, this.objects = [], this.nextId = 0, this.initializeGeometry(), this.onObjectAdded = null, this.onObjectRemoved = null, this.onObjectUpdated = null;
4598
4598
  }
@@ -4600,20 +4600,20 @@ class hr {
4600
4600
  * Initialize geometry buffers for cube and sphere
4601
4601
  */
4602
4602
  initializeGeometry() {
4603
- const t = sr(), e = rr(16, 16);
4604
- this.cubeVertexBuffer = Ge(
4603
+ const t = Er(), e = Ar(16, 16);
4604
+ this.cubeVertexBuffer = vt(
4605
4605
  this.device,
4606
4606
  t.vertices,
4607
4607
  GPUBufferUsage.VERTEX
4608
- ), this.cubeIndexBuffer = Ge(
4608
+ ), this.cubeIndexBuffer = vt(
4609
4609
  this.device,
4610
4610
  t.indices,
4611
4611
  GPUBufferUsage.INDEX
4612
- ), this.cubeIndexCount = t.indices.length, this.sphereVertexBuffer = Ge(
4612
+ ), this.cubeIndexCount = t.indices.length, this.sphereVertexBuffer = vt(
4613
4613
  this.device,
4614
4614
  e.vertices,
4615
4615
  GPUBufferUsage.VERTEX
4616
- ), this.sphereIndexBuffer = Ge(
4616
+ ), this.sphereIndexBuffer = vt(
4617
4617
  this.device,
4618
4618
  e.indices,
4619
4619
  GPUBufferUsage.INDEX
@@ -4628,7 +4628,7 @@ class hr {
4628
4628
  * @returns {Object3D} The created object
4629
4629
  */
4630
4630
  addObject(t, e = [0, 0, 0], i = [1, 1, 1], r = [1, 1, 1, 1]) {
4631
- const n = new nr(this.nextId++, t, e, i, r);
4631
+ const n = new Cr(this.nextId++, t, e, i, r);
4632
4632
  return n.uniformBuffer = this.device.createBuffer({
4633
4633
  size: 192,
4634
4634
  // modelMatrix (64) + normalMatrix (64) + color (16) + padding (48)
@@ -4717,21 +4717,21 @@ class hr {
4717
4717
  }
4718
4718
  }
4719
4719
  }
4720
- function pr(s) {
4720
+ function Or(s) {
4721
4721
  const t = parseInt(s.slice(1, 3), 16) / 255, e = parseInt(s.slice(3, 5), 16) / 255, i = parseInt(s.slice(5, 7), 16) / 255;
4722
4722
  return [t, e, i];
4723
4723
  }
4724
- function mr(s) {
4724
+ function Lr(s) {
4725
4725
  if (!s) return "#ffffff";
4726
4726
  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");
4727
4727
  return `#${t}${e}${i}`;
4728
4728
  }
4729
- function yr(s, t, e) {
4730
- const i = bi([
4729
+ function kr(s, t, e) {
4730
+ const i = ki([
4731
4731
  s[0] - t[0],
4732
4732
  s[1] - t[1],
4733
4733
  s[2] - t[2]
4734
- ]), r = bi(Si(e, i)), n = Si(i, r);
4734
+ ]), r = ki(Xi(e, i)), n = Xi(i, r);
4735
4735
  return new Float32Array([
4736
4736
  r[0],
4737
4737
  n[0],
@@ -4745,13 +4745,13 @@ function yr(s, t, e) {
4745
4745
  n[2],
4746
4746
  i[2],
4747
4747
  0,
4748
- -_t(r, s),
4749
- -_t(n, s),
4750
- -_t(i, s),
4748
+ -ti(r, s),
4749
+ -ti(n, s),
4750
+ -ti(i, s),
4751
4751
  1
4752
4752
  ]);
4753
4753
  }
4754
- function gr(s, t = Math.PI / 4) {
4754
+ function Xr(s, t = Math.PI / 4) {
4755
4755
  const r = 1 / Math.tan(t / 2);
4756
4756
  return new Float32Array([
4757
4757
  r * s,
@@ -4772,21 +4772,21 @@ function gr(s, t = Math.PI / 4) {
4772
4772
  0
4773
4773
  ]);
4774
4774
  }
4775
- function bi(s) {
4775
+ function ki(s) {
4776
4776
  const t = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]);
4777
4777
  return [s[0] / t, s[1] / t, s[2] / t];
4778
4778
  }
4779
- function Si(s, t) {
4779
+ function Xi(s, t) {
4780
4780
  return [
4781
4781
  s[1] * t[2] - s[2] * t[1],
4782
4782
  s[2] * t[0] - s[0] * t[2],
4783
4783
  s[0] * t[1] - s[1] * t[0]
4784
4784
  ];
4785
4785
  }
4786
- function _t(s, t) {
4786
+ function ti(s, t) {
4787
4787
  return s[0] * t[0] + s[1] * t[1] + s[2] * t[2];
4788
4788
  }
4789
- function ar(s, t) {
4789
+ function Ur(s, t) {
4790
4790
  const e = new Float32Array(16);
4791
4791
  for (let i = 0; i < 4; i++)
4792
4792
  for (let r = 0; r < 4; r++) {
@@ -4797,7 +4797,7 @@ function ar(s, t) {
4797
4797
  }
4798
4798
  return e;
4799
4799
  }
4800
- const Bt = 1481005640, wi = 1, Bi = 1313821514, Mi = 5130562, Ze = "$hzfxAsset", Ri = (s) => typeof atob == "function" ? Uint8Array.from(atob(s), (t) => t.charCodeAt(0)) : new Uint8Array(Buffer.from(s, "base64")), xi = (s) => {
4800
+ const si = 1481005640, Hi = 1, Zi = 1313821514, $i = 5130562, Et = "$hzfxAsset", Wi = (s) => typeof atob == "function" ? Uint8Array.from(atob(s), (t) => t.charCodeAt(0)) : new Uint8Array(Buffer.from(s, "base64")), Ni = (s) => {
4801
4801
  if (typeof btoa == "function") {
4802
4802
  let t = "";
4803
4803
  for (let e = 0; e < s.length; e++) t += String.fromCharCode(s[e]);
@@ -4805,94 +4805,94 @@ const Bt = 1481005640, wi = 1, Bi = 1313821514, Mi = 5130562, Ze = "$hzfxAsset",
4805
4805
  }
4806
4806
  return Buffer.from(s).toString("base64");
4807
4807
  };
4808
- function or(s) {
4809
- 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) ? Ri(r) : new TextEncoder().encode(decodeURIComponent(r));
4808
+ function Ir(s) {
4809
+ 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));
4810
4810
  return { mime: i, bytes: a };
4811
4811
  }
4812
- function vi(s) {
4812
+ function Yi(s) {
4813
4813
  return (4 - s % 4) % 4;
4814
4814
  }
4815
- async function lr(s, t = {}) {
4815
+ async function zr(s, t = {}) {
4816
4816
  const { textureFormat: e = "keep", quality: i = 0.85 } = t, r = [], n = [];
4817
4817
  let a = 0;
4818
- const o = (T, E, D) => {
4819
- const N = a, Y = T.length;
4820
- r.push({ offset: N, length: Y, mime: E, kind: D }), n.push(T), a += Y;
4821
- const k = vi(Y);
4822
- return k && (n.push(new Uint8Array(k)), a += k), r.length - 1;
4818
+ const o = (z, F, Z) => {
4819
+ const J = a, ee = z.length;
4820
+ r.push({ offset: J, length: ee, mime: F, kind: Z }), n.push(z), a += ee;
4821
+ const K = Yi(ee);
4822
+ return K && (n.push(new Uint8Array(K)), a += K), r.length - 1;
4823
4823
  }, c = e === "webp" && typeof OffscreenCanvas < "u" && typeof createImageBitmap == "function", l = [];
4824
- for (const T of s.systems || []) {
4825
- const E = { ...T };
4826
- if (typeof E.textureImageData == "string" && E.textureImageData.startsWith("data:")) {
4827
- let { mime: D, bytes: N } = or(E.textureImageData);
4828
- if (c && D !== "image/webp")
4824
+ for (const z of s.systems || []) {
4825
+ const F = { ...z };
4826
+ if (typeof F.textureImageData == "string" && F.textureImageData.startsWith("data:")) {
4827
+ let { mime: Z, bytes: J } = Ir(F.textureImageData);
4828
+ if (c && Z !== "image/webp")
4829
4829
  try {
4830
- const Y = await createImageBitmap(new Blob([N], { type: D })), k = new OffscreenCanvas(Y.width, Y.height);
4831
- k.getContext("2d").drawImage(Y, 0, 0);
4832
- const G = await k.convertToBlob({ type: "image/webp", quality: i }), de = new Uint8Array(await G.arrayBuffer());
4833
- de.length < N.length && (N = de, D = "image/webp");
4830
+ const ee = await createImageBitmap(new Blob([J], { type: Z })), K = new OffscreenCanvas(ee.width, ee.height);
4831
+ K.getContext("2d").drawImage(ee, 0, 0);
4832
+ const q = await K.convertToBlob({ type: "image/webp", quality: i }), Ke = new Uint8Array(await q.arrayBuffer());
4833
+ Ke.length < J.length && (J = Ke, Z = "image/webp");
4834
4834
  } catch {
4835
4835
  }
4836
- E.textureImageData = { [Ze]: o(N, D, "texture") };
4836
+ F.textureImageData = { [Et]: o(J, Z, "texture") };
4837
4837
  }
4838
- if (typeof E.glbModelData == "string" && E.glbModelData.length > 0) {
4839
- const D = Ri(E.glbModelData);
4840
- E.glbModelData = { [Ze]: o(D, "model/gltf-binary", "glb") };
4838
+ if (typeof F.glbModelData == "string" && F.glbModelData.length > 0) {
4839
+ const Z = Wi(F.glbModelData);
4840
+ F.glbModelData = { [Et]: o(Z, "model/gltf-binary", "glb") };
4841
4841
  }
4842
- l.push(E);
4843
- }
4844
- const u = { ...s, systems: l, assets: r }, p = new TextEncoder().encode(JSON.stringify(u)), h = vi(p.length), d = new Uint8Array(a);
4845
- let b = 0;
4846
- for (const T of n)
4847
- d.set(T, b), b += T.length;
4848
- const _ = p.length + h, M = 20 + _ + 8 + a, R = new ArrayBuffer(M), x = new DataView(R), L = new Uint8Array(R);
4849
- let P = 0;
4850
- x.setUint32(P, Bt, !0), P += 4, x.setUint32(P, wi, !0), P += 4, x.setUint32(P, M, !0), P += 4, x.setUint32(P, _, !0), P += 4, x.setUint32(P, Bi, !0), P += 4, L.set(p, P), P += p.length;
4851
- for (let T = 0; T < h; T++) L[P++] = 32;
4852
- return x.setUint32(P, a, !0), P += 4, x.setUint32(P, Mi, !0), P += 4, L.set(d, P), P += a, R;
4842
+ l.push(F);
4843
+ }
4844
+ const d = { ...s, systems: l, assets: r }, S = new TextEncoder().encode(JSON.stringify(d)), g = Yi(S.length), p = new Uint8Array(a);
4845
+ let v = 0;
4846
+ for (const z of n)
4847
+ p.set(z, v), v += z.length;
4848
+ const A = S.length + g, U = 20 + A + 8 + a, I = new ArrayBuffer(U), _ = new DataView(I), $ = new Uint8Array(I);
4849
+ let T = 0;
4850
+ _.setUint32(T, si, !0), T += 4, _.setUint32(T, Hi, !0), T += 4, _.setUint32(T, U, !0), T += 4, _.setUint32(T, A, !0), T += 4, _.setUint32(T, Zi, !0), T += 4, $.set(S, T), T += S.length;
4851
+ for (let z = 0; z < g; z++) $[T++] = 32;
4852
+ return _.setUint32(T, a, !0), T += 4, _.setUint32(T, $i, !0), T += 4, $.set(p, T), T += a, I;
4853
4853
  }
4854
- function Ti(s) {
4855
- return !s || s.byteLength < 12 ? !1 : new DataView(s).getUint32(0, !0) === Bt;
4854
+ function Ji(s) {
4855
+ return !s || s.byteLength < 12 ? !1 : new DataView(s).getUint32(0, !0) === si;
4856
4856
  }
4857
- function Ei(s) {
4857
+ function Ki(s) {
4858
4858
  const t = new DataView(s);
4859
- if (t.getUint32(0, !0) !== Bt) throw new Error("[unpackHZFX] bad magic — not an .hzfx file");
4859
+ if (t.getUint32(0, !0) !== si) throw new Error("[unpackHZFX] bad magic — not an .hzfx file");
4860
4860
  const e = t.getUint32(4, !0);
4861
- if (e !== wi) throw new Error(`[unpackHZFX] unsupported version ${e}`);
4861
+ if (e !== Hi) throw new Error(`[unpackHZFX] unsupported version ${e}`);
4862
4862
  let i = 12, r = null, n = -1;
4863
4863
  const a = new Uint8Array(s);
4864
4864
  for (; i + 8 <= s.byteLength; ) {
4865
- const h = t.getUint32(i, !0);
4865
+ const g = t.getUint32(i, !0);
4866
4866
  i += 4;
4867
- const d = t.getUint32(i, !0);
4868
- i += 4, d === Bi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + h))) : d === Mi && (n = i), i += h;
4867
+ const p = t.getUint32(i, !0);
4868
+ i += 4, p === Zi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + g))) : p === $i && (n = i), i += g;
4869
4869
  }
4870
4870
  if (!r) throw new Error("[unpackHZFX] missing JSON chunk");
4871
- const o = r.assets || [], c = (h) => {
4872
- const d = o[h];
4873
- return !d || n < 0 ? null : { ...d, bytes: a.subarray(n + d.offset, n + d.offset + d.length) };
4874
- }, l = (h) => h && typeof h == "object" && typeof h[Ze] == "number", u = (r.systems || []).map((h) => {
4875
- const d = { ...h };
4876
- if (l(d.textureImageData)) {
4877
- const b = c(d.textureImageData[Ze]);
4878
- d.textureImageData = b ? `data:${b.mime};base64,${xi(b.bytes)}` : void 0;
4871
+ const o = r.assets || [], c = (g) => {
4872
+ const p = o[g];
4873
+ return !p || n < 0 ? null : { ...p, bytes: a.subarray(n + p.offset, n + p.offset + p.length) };
4874
+ }, l = (g) => g && typeof g == "object" && typeof g[Et] == "number", d = (r.systems || []).map((g) => {
4875
+ const p = { ...g };
4876
+ if (l(p.textureImageData)) {
4877
+ const v = c(p.textureImageData[Et]);
4878
+ p.textureImageData = v ? `data:${v.mime};base64,${Ni(v.bytes)}` : void 0;
4879
4879
  }
4880
- if (l(d.glbModelData)) {
4881
- const b = c(d.glbModelData[Ze]);
4882
- d.glbModelData = b ? xi(b.bytes) : void 0;
4880
+ if (l(p.glbModelData)) {
4881
+ const v = c(p.glbModelData[Et]);
4882
+ p.glbModelData = v ? Ni(v.bytes) : void 0;
4883
4883
  }
4884
- return d;
4885
- }), p = { ...r, systems: u };
4886
- return delete p.assets, p;
4884
+ return p;
4885
+ }), S = { ...r, systems: d };
4886
+ return delete S.assets, S;
4887
4887
  }
4888
- function cr(s) {
4888
+ function Fr(s) {
4889
4889
  const t = new Uint8Array(s);
4890
4890
  let e = "";
4891
4891
  for (let i = 0; i < t.byteLength; i++)
4892
4892
  e += String.fromCharCode(t[i]);
4893
4893
  return btoa(e);
4894
4894
  }
4895
- function ur(s) {
4895
+ function Gr(s) {
4896
4896
  return {
4897
4897
  name: s.name,
4898
4898
  id: s.id,
@@ -5043,6 +5043,13 @@ function ur(s) {
5043
5043
  emissionTrailShapeAmplitude: s.emissionTrailShapeAmplitude ?? 0.1,
5044
5044
  emissionTrailShapeFrequency: s.emissionTrailShapeFrequency ?? 4,
5045
5045
  emissionTrailShapeSpeed: s.emissionTrailShapeSpeed ?? 0,
5046
+ shapeStrokeEnabled: s.shapeStrokeEnabled || !1,
5047
+ shapeStrokeWidth: s.shapeStrokeWidth ?? 0.08,
5048
+ shapeStrokeSegments: s.shapeStrokeSegments ?? 96,
5049
+ shapeStrokeShape: s.shapeStrokeShape ?? "straight",
5050
+ shapeStrokeAmplitude: s.shapeStrokeAmplitude ?? 0.08,
5051
+ shapeStrokeFrequency: s.shapeStrokeFrequency ?? 10,
5052
+ shapeStrokeSpeed: s.shapeStrokeSpeed ?? 0,
5046
5053
  shapeDisplay: s.shapeDisplay ?? !0,
5047
5054
  blendMode: s.blendMode ?? "normal",
5048
5055
  noiseDistortEnabled: s.noiseDistortEnabled || !1,
@@ -5071,7 +5078,7 @@ function ur(s) {
5071
5078
  displayUnit: s.displayUnit || "m"
5072
5079
  };
5073
5080
  }
5074
- async function br(s, t, e = "hzfx") {
5081
+ async function Nr(s, t, e = "hzfx") {
5075
5082
  if (!s || !s.particleSystems || s.particleSystems.length === 0) {
5076
5083
  alert("No particle systems to save.");
5077
5084
  return;
@@ -5080,12 +5087,12 @@ async function br(s, t, e = "hzfx") {
5080
5087
  const i = {
5081
5088
  version: "1.0",
5082
5089
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
5083
- systems: s.particleSystems.map(({ config: u, system: p }) => ({
5084
- ...ur(u),
5090
+ systems: s.particleSystems.map(({ config: d, system: S }) => ({
5091
+ ...Gr(d),
5085
5092
  // single source of truth for config fields
5086
5093
  // Binary assets embedded so replaceSystems() can restore them
5087
- textureImageData: u.textureEnabled && !u.glbModelEnabled && u.textureImageData ? u.textureImageData : void 0,
5088
- glbModelData: u.glbModelEnabled && p.glbRawArrayBuffer ? cr(p.glbRawArrayBuffer) : void 0
5094
+ textureImageData: d.textureEnabled && !d.glbModelEnabled && d.textureImageData ? d.textureImageData : void 0,
5095
+ glbModelData: d.glbModelEnabled && S.glbRawArrayBuffer ? Fr(S.glbRawArrayBuffer) : void 0
5089
5096
  })),
5090
5097
  activeSystemIndex: s.activeSystemIndex,
5091
5098
  loop: s.loop || !1
@@ -5093,16 +5100,16 @@ async function br(s, t, e = "hzfx") {
5093
5100
  }, r = e === "json" ? "json" : "hzfx";
5094
5101
  let n;
5095
5102
  if (r === "hzfx") {
5096
- const u = await lr(i, { textureFormat: "webp" });
5097
- n = new Blob([u], { type: "application/octet-stream" });
5103
+ const d = await zr(i, { textureFormat: "webp" });
5104
+ n = new Blob([d], { type: "application/octet-stream" });
5098
5105
  } else
5099
5106
  n = new Blob([JSON.stringify(i, null, 2)], { type: "application/json" });
5100
5107
  let a;
5101
5108
  if (t)
5102
5109
  a = t;
5103
5110
  else {
5104
- const u = /* @__PURE__ */ new Date();
5105
- a = `particle-scene_${`${u.getFullYear()}-${(u.getMonth() + 1).toString().padStart(2, "0")}-${u.getDate().toString().padStart(2, "0")}_${u.getHours().toString().padStart(2, "0")}${u.getMinutes().toString().padStart(2, "0")}`}`;
5111
+ const d = /* @__PURE__ */ new Date();
5112
+ a = `particle-scene_${`${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}_${d.getHours().toString().padStart(2, "0")}${d.getMinutes().toString().padStart(2, "0")}`}`;
5106
5113
  }
5107
5114
  const o = `${a}.${r}`, c = URL.createObjectURL(n), l = document.createElement("a");
5108
5115
  l.href = c, l.download = o, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(c);
@@ -5110,7 +5117,7 @@ async function br(s, t, e = "hzfx") {
5110
5117
  console.error("Error saving scene:", i), alert("Error saving scene. See console for details.");
5111
5118
  }
5112
5119
  }
5113
- function Sr(s) {
5120
+ function Yr(s) {
5114
5121
  return new Promise((t, e) => {
5115
5122
  try {
5116
5123
  const i = s.target.files[0];
@@ -5123,7 +5130,7 @@ function Sr(s) {
5123
5130
  try {
5124
5131
  const a = n.target.result;
5125
5132
  let o;
5126
- if (Ti(a) ? o = Ei(a) : o = JSON.parse(new TextDecoder().decode(a)), !Array.isArray(o.systems) || o.systems.length === 0)
5133
+ if (Ji(a) ? o = Ki(a) : o = JSON.parse(new TextDecoder().decode(a)), !Array.isArray(o.systems) || o.systems.length === 0)
5127
5134
  throw new Error("No valid particle systems found in the file");
5128
5135
  t({
5129
5136
  systems: o.systems.slice(),
@@ -5141,7 +5148,7 @@ function Sr(s) {
5141
5148
  }
5142
5149
  });
5143
5150
  }
5144
- async function xr(s) {
5151
+ async function jr(s) {
5145
5152
  if (!s || typeof s != "string")
5146
5153
  throw new Error("[fetchPreset] url must be a non-empty string");
5147
5154
  const t = await fetch(s);
@@ -5149,7 +5156,7 @@ async function xr(s) {
5149
5156
  throw new Error(`[fetchPreset] HTTP ${t.status}: ${t.statusText}`);
5150
5157
  const e = await t.arrayBuffer();
5151
5158
  let i;
5152
- if (Ti(e) ? i = Ei(e) : i = JSON.parse(new TextDecoder().decode(e)), !Array.isArray(i.systems) || i.systems.length === 0)
5159
+ if (Ji(e) ? i = Ki(e) : i = JSON.parse(new TextDecoder().decode(e)), !Array.isArray(i.systems) || i.systems.length === 0)
5153
5160
  throw new Error('[fetchPreset] Invalid preset: "systems" must be a non-empty array');
5154
5161
  return {
5155
5162
  version: i.version,
@@ -5157,7 +5164,7 @@ async function xr(s) {
5157
5164
  activeSystemIndex: i.activeSystemIndex ?? 0
5158
5165
  };
5159
5166
  }
5160
- const dr = (s) => `
5167
+ const Dr = (s) => `
5161
5168
  @vertex fn vs(@builtin(vertex_index) i: u32) -> @builtin(position) vec4f {
5162
5169
  var p = array<vec2f, 3>(vec2f(-1.0, -3.0), vec2f(-1.0, 1.0), vec2f(3.0, 1.0));
5163
5170
  return vec4f(p[i], 0.0, 1.0);
@@ -5167,60 +5174,60 @@ const dr = (s) => `
5167
5174
  return textureLoad(src, vec2i(pos.xy), 0);
5168
5175
  }
5169
5176
  `;
5170
- async function vr(s, t = {}) {
5177
+ async function qr(s, t = {}) {
5171
5178
  const { getSceneDepth: e = null, autoRespawn: i = !0 } = t;
5172
5179
  let r, n, a;
5173
5180
  const o = !!(s && s.device && s.context);
5174
- o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await Js(a));
5175
- const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new Ws(r), u = { layouts: {}, pipelines: {} };
5176
- function p(f) {
5177
- const m = f ? "ms" : "ss";
5178
- if (!u.pipelines[m]) {
5179
- const S = r.createShaderModule({ code: dr(f) }), g = r.createBindGroupLayout({
5180
- entries: [{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "depth", multisampled: f } }]
5181
+ o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await _r(a));
5182
+ const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new Pr(r), d = { layouts: {}, pipelines: {} };
5183
+ function S(u) {
5184
+ const f = u ? "ms" : "ss";
5185
+ if (!d.pipelines[f]) {
5186
+ const h = r.createShaderModule({ code: Dr(u) }), b = r.createBindGroupLayout({
5187
+ entries: [{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "depth", multisampled: u } }]
5181
5188
  });
5182
- u.layouts[m] = g, u.pipelines[m] = r.createRenderPipeline({
5183
- layout: r.createPipelineLayout({ bindGroupLayouts: [g] }),
5184
- vertex: { module: S, entryPoint: "vs" },
5185
- fragment: { module: S, entryPoint: "fs", targets: [] },
5189
+ d.layouts[f] = b, d.pipelines[f] = r.createRenderPipeline({
5190
+ layout: r.createPipelineLayout({ bindGroupLayouts: [b] }),
5191
+ vertex: { module: h, entryPoint: "vs" },
5192
+ fragment: { module: h, entryPoint: "fs", targets: [] },
5186
5193
  primitive: { topology: "triangle-list" },
5187
5194
  depthStencil: { format: "depth24plus", depthWriteEnabled: !0, depthCompare: "always" }
5188
5195
  });
5189
5196
  }
5190
- return { pipeline: u.pipelines[m], layout: u.layouts[m] };
5197
+ return { pipeline: d.pipelines[f], layout: d.layouts[f] };
5191
5198
  }
5192
- const h = {
5199
+ const g = {
5193
5200
  bloomSourceTextures: {},
5194
5201
  bloomCompositeTextures: {},
5195
5202
  combinedTexture: null,
5196
- getBloomSourceTexture(f, m, S) {
5197
- return this.bloomSourceTextures[f] || (this.bloomSourceTextures[f] = r.createTexture({
5198
- size: [m, S],
5203
+ getBloomSourceTexture(u, f, h) {
5204
+ return this.bloomSourceTextures[u] || (this.bloomSourceTextures[u] = r.createTexture({
5205
+ size: [f, h],
5199
5206
  format: "rgba16float",
5200
5207
  // HDR chain (see webgpu.js HDR_FORMAT) — avoids additive clip
5201
5208
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5202
- })), this.bloomSourceTextures[f];
5209
+ })), this.bloomSourceTextures[u];
5203
5210
  },
5204
- getBloomCompositeTexture(f, m, S) {
5205
- return this.bloomCompositeTextures[f] || (this.bloomCompositeTextures[f] = r.createTexture({
5206
- size: [m, S],
5211
+ getBloomCompositeTexture(u, f, h) {
5212
+ return this.bloomCompositeTextures[u] || (this.bloomCompositeTextures[u] = r.createTexture({
5213
+ size: [f, h],
5207
5214
  format: "rgba16float",
5208
5215
  // HDR chain
5209
5216
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5210
- })), this.bloomCompositeTextures[f];
5217
+ })), this.bloomCompositeTextures[u];
5211
5218
  },
5212
- getCombinedTexture(f, m) {
5219
+ getCombinedTexture(u, f) {
5213
5220
  return this.combinedTexture || (this.combinedTexture = r.createTexture({
5214
- size: [f, m],
5221
+ size: [u, f],
5215
5222
  format: "rgba16float",
5216
5223
  // HDR chain — tonemapped to canvas in the final pass
5217
5224
  usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
5218
5225
  })), this.combinedTexture;
5219
5226
  },
5220
5227
  resizeTextures() {
5221
- Object.values(this.bloomSourceTextures).forEach((f) => f == null ? void 0 : f.destroy()), Object.values(this.bloomCompositeTextures).forEach((f) => f == null ? void 0 : f.destroy()), this.combinedTexture && this.combinedTexture.destroy(), this.bloomSourceTextures = {}, this.bloomCompositeTextures = {}, this.combinedTexture = null;
5228
+ Object.values(this.bloomSourceTextures).forEach((u) => u == null ? void 0 : u.destroy()), Object.values(this.bloomCompositeTextures).forEach((u) => u == null ? void 0 : u.destroy()), this.combinedTexture && this.combinedTexture.destroy(), this.bloomSourceTextures = {}, this.bloomCompositeTextures = {}, this.combinedTexture = null;
5222
5229
  }
5223
- }, d = {
5230
+ }, p = {
5224
5231
  systemBindGroups: {},
5225
5232
  systemBloomHorizontalBindGroups: {},
5226
5233
  secondHorizontalBindGroups: {},
@@ -5236,166 +5243,323 @@ async function vr(s, t = {}) {
5236
5243
  clear() {
5237
5244
  this.systemBindGroups = {}, this.systemBloomHorizontalBindGroups = {}, this.secondHorizontalBindGroups = {}, this.systemBloomCompositeBindGroups = {}, this.combinedBloomCompositeBindGroups = {}, this.combinedInitialBindGroup = null, this.finalBindGroup = null, this.textureStates = {}, this.textureRefs = {};
5238
5245
  }
5239
- }, b = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), _ = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), R = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), x = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), L = Ge(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), P = {}, T = () => Ge(r, new Float32Array([-0.5, -0.5, 0, 0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0]), GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST);
5240
- l.onSystemCreated = (f) => {
5241
- P[f] || (P[f] = T());
5246
+ }, v = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), A = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), U = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), I = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), _ = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), $ = vt(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), T = {}, z = () => vt(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);
5247
+ l.onSystemCreated = (u) => {
5248
+ T[u] || (T[u] = z());
5242
5249
  };
5243
- const E = 4e4, D = new Float32Array(E * 8), N = new Float32Array(E * 4), Y = new Float32Array(E * 4), k = r.createBuffer({ size: E * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), G = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), de = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), Fe = /* @__PURE__ */ new Map(), ct = 8, W = [];
5244
- function Mt(f) {
5245
- for (const m of W) if (m.ids.has(f)) return m;
5250
+ const F = 4e4, Z = new Float32Array(F * 8), J = new Float32Array(F * 4), ee = new Float32Array(F * 4), K = r.createBuffer({ size: F * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), q = r.createBuffer({ size: F * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), Ke = r.createBuffer({ size: F * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), Pt = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Map(), kt = 8, Se = [];
5251
+ function ri(u) {
5252
+ for (const f of Se) if (f.ids.has(u)) return f;
5246
5253
  return null;
5247
5254
  }
5248
- function Ai(f, m) {
5249
- if (!f.pos) return;
5250
- f.hist.push({ t: m, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
5251
- const S = m - ct;
5252
- for (; f.hist.length > 2 && f.hist[0].t < S; ) f.hist.shift();
5253
- }
5254
- function Rt(f, m, S) {
5255
- const g = f.hist;
5256
- if (g.length === 0) {
5257
- const q = f.pos;
5258
- return q && (S[0] = q[0], S[1] = q[1], S[2] = q[2]), S;
5255
+ function Qi(u, f) {
5256
+ if (!u.pos) return;
5257
+ u.hist.push({ t: f, x: u.pos[0], y: u.pos[1], z: u.pos[2] });
5258
+ const h = f - kt;
5259
+ for (; u.hist.length > 2 && u.hist[0].t < h; ) u.hist.shift();
5260
+ }
5261
+ function ni(u, f, h) {
5262
+ const b = u.hist;
5263
+ if (b.length === 0) {
5264
+ const R = u.pos;
5265
+ return R && (h[0] = R[0], h[1] = R[1], h[2] = R[2]), h;
5259
5266
  }
5260
- let v;
5261
- if (m >= g[g.length - 1].t)
5262
- return v = g[g.length - 1], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5263
- if (m <= g[0].t)
5264
- return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5265
- for (let q = g.length - 1; q > 0; q--)
5266
- if (g[q - 1].t <= m) {
5267
- const j = g[q - 1], Q = g[q], Z = (m - j.t) / Math.max(1e-6, Q.t - j.t);
5268
- return S[0] = j.x + (Q.x - j.x) * Z, S[1] = j.y + (Q.y - j.y) * Z, S[2] = j.z + (Q.z - j.z) * Z, S;
5267
+ let y;
5268
+ if (f >= b[b.length - 1].t)
5269
+ return y = b[b.length - 1], h[0] = y.x, h[1] = y.y, h[2] = y.z, h;
5270
+ if (f <= b[0].t)
5271
+ return y = b[0], h[0] = y.x, h[1] = y.y, h[2] = y.z, h;
5272
+ for (let R = b.length - 1; R > 0; R--)
5273
+ if (b[R - 1].t <= f) {
5274
+ const P = b[R - 1], M = b[R], x = (f - P.t) / Math.max(1e-6, M.t - P.t);
5275
+ return h[0] = P.x + (M.x - P.x) * x, h[1] = P.y + (M.y - P.y) * x, h[2] = P.z + (M.z - P.z) * x, h;
5269
5276
  }
5270
- return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
5271
- }
5272
- const Ci = 0.41421356;
5273
- function Ui() {
5274
- Fe.clear();
5275
- let f = 0, m = 0;
5276
- C.position[0], C.position[1], C.position[2];
5277
- for (const { system: S, config: g } of l.particleSystems) {
5278
- if (!g.emissionTrailEnabled || g.hidden || g.glbModelEnabled) continue;
5279
- S.readbackAndProcessParticles();
5280
- const v = S.particleData, q = S.particleVelocities, j = S.activeParticles;
5281
- if (!v || !q || j <= 0) continue;
5282
- const Q = g.emissionTrailMode === "particles", Z = f, Ce = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1, B = g.particleSize ?? 0.5, U = g.bloomIntensity || 1, I = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)), F = g.emissionTrailShape || "straight", J = g.followSystemTranslation ?? !0, K = S._simPosition, X = J && K ? K[0] : 0, it = J && K ? K[1] : 0, jt = J && K ? K[2] : 0, Ue = S._simVelocity, Yt = Ue ? Ue[0] : 0, rs = Ue ? Ue[1] : 0, qt = Ue ? Ue[2] : 0, Oe = Mt(g.id), Ht = !!(J && Oe && Oe.hist && Oe.hist.length > 1);
5283
- for (let st = 0; st < j; st++) {
5284
- const pe = st * 8, rt = v[pe], mt = v[pe + 1], nt = v[pe + 2], ns = rt + X, as = mt + it, os = nt + jt;
5285
- let Le = v[pe + 3], Xe = v[pe + 4], Ne = v[pe + 5];
5286
- const ke = v[pe + 6], Ie = v[pe + 7];
5287
- if (ke >= Ie || Ie <= 0) continue;
5288
- const me = ke / Ie;
5289
- if (g.colorTransitionEnabled) {
5290
- const w = g.startColor ?? [1, 0, 0], z = g.endColor ?? [0, 0, 1];
5291
- Le = w[0] + (z[0] - w[0]) * me, Xe = w[1] + (z[1] - w[1]) * me, Ne = w[2] + (z[2] - w[2]) * me;
5292
- }
5293
- Le = Math.min(1, Le * U), Xe = Math.min(1, Xe * U), Ne = Math.min(1, Ne * U);
5294
- let je = B;
5295
- if (g.randomSize) {
5296
- const w = Math.sin(Ie * 54321.67) * 43758.5453 % 1, z = w < 0 ? w + 1 : w;
5297
- je = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * z;
5298
- }
5299
- if (g.fadeSizeEnabled) {
5300
- const w = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5301
- je *= 1 - Math.pow(me, 1 / w);
5302
- }
5303
- if (g.increaseSizeEnabled) {
5304
- const w = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
5305
- je *= 1 + Math.pow(me, 1 / w);
5306
- }
5307
- if (je <= 0 || me > 0.9) continue;
5308
- const Zt = Math.min((0.9 - me) * (1 / 0.2), 1), $t = 0.75 * je * Ci * Zt;
5309
- let Ye = y;
5310
- if (g.fadeEnabled && (Ye *= Math.max(0, 1 - me)), Ye *= Zt, Ye < 0.01) continue;
5311
- const yt = st * 4, Wt = q[yt], Jt = q[yt + 1], Qt = q[yt + 2], at = Wt + Yt, ot = Jt + rs, lt = Qt + qt, Kt = Math.sqrt(at * at + ot * ot + lt * lt);
5312
- if (Kt < 1e-3) continue;
5313
- const gt = 1 / Kt, ve = at * gt, Pe = ot * gt, ye = lt * gt, ei = C.right[0], ti = C.right[1], ii = C.right[2];
5314
- let bt = ei * ve + ti * Pe + ii * ye, re = ei - bt * ve, ne = ti - bt * Pe, ae = ii - bt * ye, qe = Math.sqrt(re * re + ne * ne + ae * ae);
5315
- if (qe < 0.2) {
5316
- const w = C.up[0], z = C.up[1], $ = C.up[2], V = w * ve + z * Pe + $ * ye;
5317
- re = w - V * ve, ne = z - V * Pe, ae = $ - V * ye, qe = Math.sqrt(re * re + ne * ne + ae * ae) || 1;
5318
- }
5319
- re /= qe, ne /= qe, ae /= qe;
5320
- const He = Math.min(Ce, ke);
5321
- if (He < 1e-3) continue;
5322
- const si = g.gravityEnabled && g.gravityStrength || 0, _e = Ni, we = ki, Be = ji;
5323
- if (g.orientToDirection && g.burstMode && Ht) {
5324
- const w = S._emitSimRotY || 0, z = Yi, $ = qi, V = Hi;
5325
- for (let A = 0; A <= I; A++) {
5326
- const O = Rt(Oe, he - A / I * He, Vt);
5327
- z[A] = O[0], $[A] = O[1], V[A] = O[2];
5328
- }
5329
- for (let A = 0; A <= I; A++) {
5330
- const O = A > 0 ? A - 1 : 0, H = A < I ? A + 1 : I;
5331
- let Me = z[O] - z[H], Re = V[O] - V[H];
5332
- const ge = (Math.hypot(Me, Re) > 1e-5 ? Math.atan2(Me, Re) : Math.atan2(Yt, qt)) - w, te = Math.cos(ge), ie = Math.sin(ge), ue = A / I * He, St = -0.5 * si * ue * ue;
5333
- _e[A] = te * rt + ie * nt + z[A], we[A] = mt + St + $[A], Be[A] = -ie * rt + te * nt + V[A];
5334
- }
5335
- } else for (let w = 0; w <= I; w++) {
5336
- const z = w / I * He, $ = -0.5 * si * z * z;
5337
- if (Ht) {
5338
- const V = Rt(Oe, he - z, Vt);
5339
- _e[w] = rt - Wt * z + V[0], we[w] = mt - Jt * z + $ + V[1], Be[w] = nt - Qt * z + V[2];
5340
- } else
5341
- _e[w] = ns - at * z, we[w] = as - ot * z + $, Be[w] = os - lt * z;
5342
- }
5343
- if (F !== "straight") {
5344
- const w = g.emissionTrailShapeAmplitude ?? 0.1, z = g.emissionTrailShapeFrequency ?? 4, $ = g.emissionTrailShapeSpeed ?? 0;
5345
- let V = -ye, A = 0, O = ve, H = Math.sqrt(V * V + O * O);
5346
- H < 1e-6 && (V = 0, A = ye, O = -Pe, H = Math.sqrt(V * V + A * A + O * O) || 1), V /= H, A /= H, O /= H;
5347
- const Me = Pe * O - ye * A, Re = ye * V - ve * O, ce = ve * A - Pe * V;
5348
- for (let ee = 1; ee <= I; ee++) {
5349
- const ge = ee / I * He, te = 2 * Math.PI * z * (he - ge) + $ * he;
5350
- let ie = 0, ue = 0;
5351
- F === "zigzag" ? ie = w * Math.sign(Math.sin(te)) : F === "sine" ? ie = w * Math.sin(te) : F === "spiral" && (ie = w * Math.sin(te), ue = w * Math.cos(te)), _e[ee] += V * ie + Me * ue, we[ee] += A * ie + Re * ue, Be[ee] += O * ie + ce * ue;
5277
+ return y = b[0], h[0] = y.x, h[1] = y.y, h[2] = y.z, h;
5278
+ }
5279
+ const ft = Math.PI * 2, se = new Array(257), re = new Array(257), ne = new Array(257);
5280
+ new Array(257), new Array(257), new Array(257);
5281
+ const Re = [0, 0, 0];
5282
+ function es(u) {
5283
+ const f = u.emissionRotationX || 0, h = u.emissionRotationY || 0, b = u.emissionRotationZ || 0;
5284
+ if (!f && !h && !b) return null;
5285
+ const y = f * Math.PI / 180, R = h * Math.PI / 180, P = b * Math.PI / 180, M = Math.cos(y), x = Math.sin(y), w = Math.cos(R), m = Math.sin(R), B = Math.cos(P), C = Math.sin(P);
5286
+ return [
5287
+ w * B,
5288
+ x * m * B - M * C,
5289
+ M * m * B + x * C,
5290
+ w * C,
5291
+ x * m * C + M * B,
5292
+ M * m * C - x * B,
5293
+ -m,
5294
+ x * w,
5295
+ M * w
5296
+ ];
5297
+ }
5298
+ function Ct(u, f, h, b, y) {
5299
+ return y[0] = u[0] * f + u[1] * h + u[2] * b, y[1] = u[3] * f + u[4] * h + u[5] * b, y[2] = u[6] * f + u[7] * h + u[8] * b, y;
5300
+ }
5301
+ function ts(u, f, h, b, y, R, P) {
5302
+ let M = u, x = f, w = h;
5303
+ b && (Ct(b, M, x, w, P), M = P[0], x = P[1], w = P[2]), M += R.emissionPositionX || 0, x += R.emissionPositionY || 0, w += R.emissionPositionZ || 0, y._simRotMatrix && (Ct(y._simRotMatrix, M, x, w, P), M = P[0], x = P[1], w = P[2]);
5304
+ const m = y._simPosition;
5305
+ return P[0] = M + (m ? m[0] : 0), P[1] = x + (m ? m[1] : 0), P[2] = w + (m ? m[2] : 0), P;
5306
+ }
5307
+ function is(u, f, h, b, y, R) {
5308
+ let P = u, M = f, x = h;
5309
+ return b && (Ct(b, P, M, x, R), P = R[0], M = R[1], x = R[2]), y._simRotMatrix && (Ct(y._simRotMatrix, P, M, x, R), P = R[0], M = R[1], x = R[2]), R[0] = P, R[1] = M, R[2] = x, R;
5310
+ }
5311
+ function Xt(u, f, h, b, y) {
5312
+ const R = f * 2, P = h * 2, M = 2 * (R + P);
5313
+ let x = (u % 1 + 1) % 1 * M, w = 0, m = 0;
5314
+ return x < R ? (w = -f + x, m = h) : (x -= R) < P ? (w = f, m = h - x) : (x -= P) < R ? (w = f - x, m = -h) : (x -= R, w = -f, m = -h + x), b === "xz" ? (y[0] = w, y[1] = 0, y[2] = m) : (y[0] = w, y[1] = m, y[2] = 0), y;
5315
+ }
5316
+ function ss(u) {
5317
+ const f = u.emissionShape, h = Math.max(1, Math.min(256, Math.floor(u.shapeStrokeSegments ?? 96)));
5318
+ let b = 0, y = !1, R = [0, 0, 1];
5319
+ const P = Re;
5320
+ if (f === "circle") {
5321
+ y = !0, b = Math.max(3, h), R = [0, 0, 1];
5322
+ const M = u.circleOuterRadius ?? 2;
5323
+ for (let x = 0; x < b; x++) {
5324
+ const w = x / b * ft;
5325
+ se[x] = Math.cos(w) * M, re[x] = Math.sin(w) * M, ne[x] = 0;
5326
+ }
5327
+ } else if (f === "disc") {
5328
+ y = !0, b = Math.max(3, h), R = [0, 1, 0];
5329
+ const M = u.discRadius ?? 2;
5330
+ for (let x = 0; x < b; x++) {
5331
+ const w = x / b * ft;
5332
+ se[x] = Math.cos(w) * M, re[x] = 0, ne[x] = Math.sin(w) * M;
5333
+ }
5334
+ } else if (f === "annulus") {
5335
+ y = !0, b = Math.max(3, h), R = [0, 1, 0];
5336
+ const M = u.annulusInnerRadius ?? 1, x = u.annulusOuterRadius ?? 2, w = M + (x - M) * 0.5;
5337
+ for (let m = 0; m < b; m++) {
5338
+ const B = m / b * ft;
5339
+ se[m] = Math.cos(B) * w, re[m] = 0, ne[m] = Math.sin(B) * w;
5340
+ }
5341
+ } else if (f === "arc") {
5342
+ y = !1, b = Math.max(2, h + 1), R = [0, 0, 1];
5343
+ const M = u.arcInnerRadius ?? 0, x = u.arcOuterRadius ?? 2, w = M > 0 ? M + (x - M) * 0.5 : x, m = (u.arcStartAngle ?? 0) * Math.PI / 180, B = (u.arcEndAngle ?? 180) * Math.PI / 180;
5344
+ for (let C = 0; C < b; C++) {
5345
+ const H = b > 1 ? C / (b - 1) : 0, V = m + (B - m) * H;
5346
+ se[C] = Math.cos(V) * w, re[C] = Math.sin(V) * w, ne[C] = 0;
5347
+ }
5348
+ } else if (f === "square") {
5349
+ y = !0, b = Math.max(4, h), R = [0, 0, 1];
5350
+ const M = u.squareSize ?? 2;
5351
+ for (let x = 0; x < b; x++)
5352
+ Xt(x / b, M, M, "xy", P), se[x] = P[0], re[x] = P[1], ne[x] = P[2];
5353
+ } else if (f === "rectangle") {
5354
+ y = !0, b = Math.max(4, h), R = [0, 0, 1];
5355
+ const M = (u.rectangleWidth ?? 2) * 0.5, x = (u.rectangleHeight ?? 2) * 0.5;
5356
+ for (let w = 0; w < b; w++)
5357
+ Xt(w / b, M, x, "xy", P), se[w] = P[0], re[w] = P[1], ne[w] = P[2];
5358
+ } else if (f === "plain") {
5359
+ y = !0, b = Math.max(4, h), R = [0, 1, 0];
5360
+ const M = (u.planeWidth ?? 2) * 0.5, x = (u.planeDepth ?? 2) * 0.5;
5361
+ for (let w = 0; w < b; w++)
5362
+ Xt(w / b, M, x, "xz", P), se[w] = P[0], re[w] = P[1], ne[w] = P[2];
5363
+ } else if (f === "line") {
5364
+ y = !1, b = Math.max(2, h + 1), R = [0, 0, 1];
5365
+ const M = u.lineLength ?? 4;
5366
+ for (let x = 0; x < b; x++) {
5367
+ const w = b > 1 ? x / (b - 1) : 0;
5368
+ se[x] = 0, re[x] = (w - 0.5) * M, ne[x] = 0;
5369
+ }
5370
+ } else if (f === "polygon") {
5371
+ y = !0, b = Math.max(3, h), R = [0, 0, 1];
5372
+ const M = Math.max(3, Math.floor(u.polygonSides ?? 6)), x = u.polygonRadius ?? 2;
5373
+ for (let w = 0; w < b; w++) {
5374
+ const m = w / b * M, B = Math.floor(m), C = m - B, H = B / M * ft, V = (B + 1) / M * ft, L = Math.cos(H) * x, N = Math.sin(H) * x, D = Math.cos(V) * x, pe = Math.sin(V) * x;
5375
+ se[w] = L + (D - L) * C, re[w] = N + (pe - N) * C, ne[w] = 0;
5376
+ }
5377
+ } else
5378
+ b = 0;
5379
+ return { count: b, closed: y, planeNormal: R };
5380
+ }
5381
+ function rs(u, f, h) {
5382
+ if (!h.shapeStrokeEnabled || h.hidden) return u;
5383
+ const { count: b, closed: y, planeNormal: R } = ss(h);
5384
+ if (b < 2) return u;
5385
+ const P = es(h), M = Math.max(1e-4, h.shapeStrokeWidth ?? 0.08), x = Math.max(0, h.opacity ?? 1);
5386
+ if (x <= 0) return u;
5387
+ is(R[0], R[1], R[2], P, f, Re);
5388
+ let w = Math.hypot(Re[0], Re[1], Re[2]) || 1;
5389
+ const m = Re[0] / w, B = Re[1] / w, C = Re[2] / w;
5390
+ for (let X = 0; X < b; X++)
5391
+ ts(se[X], re[X], ne[X], P, f, h, Re), se[X] = Re[0], re[X] = Re[1], ne[X] = Re[2];
5392
+ const H = h.shapeStrokeShape ?? "straight";
5393
+ if (H !== "straight") {
5394
+ const X = h.shapeStrokeAmplitude ?? 0.08, ae = h.shapeStrokeFrequency ?? 10, he = h.shapeStrokeSpeed ?? 0;
5395
+ for (let te = 0; te < b; te++) {
5396
+ const Ie = te === 0 ? y ? b - 1 : 0 : te - 1, Te = te === b - 1 ? y ? 0 : b - 1 : te + 1, et = se[Te] - se[Ie], tt = re[Te] - re[Ie], ze = ne[Te] - ne[Ie], de = B * ze - C * tt, fe = C * et - m * ze, me = m * tt - B * et, Ee = Math.hypot(de, fe, me) || 1, Fe = de / Ee, xe = fe / Ee, Ge = me / Ee, ve = y ? te / b : te / Math.max(1, b - 1), oe = ft * ae * ve + he * ke;
5397
+ let Q = 0, ye = 0;
5398
+ H === "zigzag" ? Q = X * Math.sign(Math.sin(oe) || 1) : H === "sine" ? Q = X * Math.sin(oe) : H === "spiral" && (Q = X * Math.sin(oe), ye = X * Math.cos(oe)), se[te] += Fe * Q + m * ye, re[te] += xe * Q + B * ye, ne[te] += Ge * Q + C * ye;
5399
+ }
5400
+ }
5401
+ const V = y ? b : b - 1, L = h.bloomIntensity || 1, N = h.startColor ?? h.particleColor ?? [1, 1, 1], D = h.endColor ?? N, pe = h.particleColor ?? N, lt = h.randomColorEnabled && Array.isArray(h.randomColors) && h.randomColors.length > 0 ? h.randomColors[0] : null, ue = M * 0.5, wt = Math.max(M * 4, 1e-4), He = (h.shapeStrokeSpeed ?? 0) * ke;
5402
+ let Qe = 0;
5403
+ for (let X = 0; X < V; X++) {
5404
+ const ae = y ? (X + 1) % b : X + 1;
5405
+ Qe += Math.hypot(se[ae] - se[X], re[ae] - re[X], ne[ae] - ne[X]);
5406
+ }
5407
+ const Wt = y ? Math.max(1, Math.round(Qe / wt)) : Math.max(Qe / wt, 1e-6), Bt = Qe > 1e-6 ? Wt / Qe : 0;
5408
+ let Ze = 0;
5409
+ for (let X = 0; X < V && !(u + 54 > Ue.length); X++) {
5410
+ const ae = y ? (X + 1) % b : X + 1, he = se[X], te = re[X], Ie = ne[X], Te = se[ae], et = re[ae], tt = ne[ae];
5411
+ let ze = Te - he, de = et - te, fe = tt - Ie;
5412
+ const me = Math.hypot(ze, de, fe) || 1;
5413
+ ze /= me, de /= me, fe /= me;
5414
+ const Ee = G.right[0], Fe = G.right[1], xe = G.right[2];
5415
+ let Ge = Ee * ze + Fe * de + xe * fe, ve = Ee - Ge * ze, oe = Fe - Ge * de, Q = xe - Ge * fe, ye = Math.hypot(ve, oe, Q);
5416
+ if (ye < 0.2) {
5417
+ const Ce = G.up[0], Tt = G.up[1], E = G.up[2], O = Ce * ze + Tt * de + E * fe;
5418
+ ve = Ce - O * ze, oe = Tt - O * de, Q = E - O * fe, ye = Math.hypot(ve, oe, Q) || 1;
5419
+ }
5420
+ ve /= ye, oe /= ye, Q /= ye;
5421
+ const yt = y ? X / b : X / Math.max(1, b - 1), gt = y ? ae / b : ae / Math.max(1, b - 1), bt = Ze * Bt + He, it = (Ze + me) * Bt + He;
5422
+ let Pe, _e, De, Ae, le, ce;
5423
+ lt ? (Pe = Ae = lt[0], _e = le = lt[1], De = ce = lt[2]) : h.colorTransitionEnabled ? (Pe = N[0] + (D[0] - N[0]) * yt, _e = N[1] + (D[1] - N[1]) * yt, De = N[2] + (D[2] - N[2]) * yt, Ae = N[0] + (D[0] - N[0]) * gt, le = N[1] + (D[1] - N[1]) * gt, ce = N[2] + (D[2] - N[2]) * gt) : (Pe = Ae = pe[0], _e = le = pe[1], De = ce = pe[2]), Pe = Math.min(1, Pe * L), _e = Math.min(1, _e * L), De = Math.min(1, De * L), Ae = Math.min(1, Ae * L), le = Math.min(1, le * L), ce = Math.min(1, ce * L);
5424
+ const Xe = he + ve * ue, Vt = te + oe * ue, Ot = Ie + Q * ue, Rt = he - ve * ue, St = te - oe * ue, Me = Ie - Q * ue, we = Te + ve * ue, Be = et + oe * ue, st = tt + Q * ue, ct = Te - ve * ue, Lt = et - oe * ue, $e = tt - Q * ue, ge = (Ce, Tt, E, O, ie, Y, k, j, W) => {
5425
+ Ue[u++] = Ce, Ue[u++] = Tt, Ue[u++] = E, Ue[u++] = O, Ue[u++] = ie, Ue[u++] = Y, Ue[u++] = k, Ue[u++] = j, Ue[u++] = W;
5426
+ };
5427
+ ge(Xe, Vt, Ot, Pe, _e, De, x, bt, 0), ge(Rt, St, Me, Pe, _e, De, x, bt, 1), ge(we, Be, st, Ae, le, ce, x, it, 0), ge(Rt, St, Me, Pe, _e, De, x, bt, 1), ge(ct, Lt, $e, Ae, le, ce, x, it, 1), ge(we, Be, st, Ae, le, ce, x, it, 0), Ze += me;
5428
+ }
5429
+ return u;
5430
+ }
5431
+ const ns = 0.41421356;
5432
+ function as() {
5433
+ Pt.clear(), Ye.clear();
5434
+ let u = 0, f = 0, h = 0;
5435
+ G.position[0], G.position[1], G.position[2];
5436
+ for (const { system: b, config: y } of l.particleSystems) {
5437
+ if (y.hidden) continue;
5438
+ if (y.emissionTrailEnabled && !y.glbModelEnabled) {
5439
+ b.readbackAndProcessParticles();
5440
+ const P = b.particleData, M = b.particleVelocities, x = b.activeParticles;
5441
+ if (P && M && x > 0) {
5442
+ const w = y.emissionTrailMode === "particles", m = u, B = y.emissionTrailDuration ?? 1, C = y.opacity ?? 1, H = y.particleSize ?? 0.5, V = y.bloomIntensity || 1, L = Math.max(1, Math.min(64, y.emissionTrailSegments ?? 8)), N = y.emissionTrailShape || "straight", D = y.followSystemTranslation ?? !0, pe = b._simPosition, lt = D && pe ? pe[0] : 0, ue = D && pe ? pe[1] : 0, wt = D && pe ? pe[2] : 0, He = b._simVelocity, Qe = He ? He[0] : 0, Wt = He ? He[1] : 0, Bt = He ? He[2] : 0, Ze = ri(y.id), X = !!(D && Ze && Ze.hist && Ze.hist.length > 1);
5443
+ for (let ae = 0; ae < x; ae++) {
5444
+ const he = ae * 8, te = P[he], Ie = P[he + 1], Te = P[he + 2], et = te + lt, tt = Ie + ue, ze = Te + wt;
5445
+ let de = P[he + 3], fe = P[he + 4], me = P[he + 5];
5446
+ const Ee = P[he + 6], Fe = P[he + 7];
5447
+ if (Ee >= Fe || Fe <= 0) continue;
5448
+ const xe = Ee / Fe;
5449
+ if (y.colorTransitionEnabled) {
5450
+ const E = y.startColor ?? [1, 0, 0], O = y.endColor ?? [0, 0, 1];
5451
+ de = E[0] + (O[0] - E[0]) * xe, fe = E[1] + (O[1] - E[1]) * xe, me = E[2] + (O[2] - E[2]) * xe;
5452
+ }
5453
+ de = Math.min(1, de * V), fe = Math.min(1, fe * V), me = Math.min(1, me * V);
5454
+ let Ge = H;
5455
+ if (y.randomSize) {
5456
+ const E = Math.sin(Fe * 54321.67) * 43758.5453 % 1, O = E < 0 ? E + 1 : E;
5457
+ Ge = (y.minSize ?? 0.1) + ((y.maxSize ?? 0.5) - (y.minSize ?? 0.1)) * O;
5458
+ }
5459
+ if (y.fadeSizeEnabled) {
5460
+ const E = Math.max(0.01, Math.min(10, y.sizeLifetimeSpeed ?? 1));
5461
+ Ge *= 1 - Math.pow(xe, 1 / E);
5462
+ }
5463
+ if (y.increaseSizeEnabled) {
5464
+ const E = Math.max(0.01, Math.min(10, y.sizeLifetimeSpeed ?? 1));
5465
+ Ge *= 1 + Math.pow(xe, 1 / E);
5466
+ }
5467
+ if (Ge <= 0 || xe > 0.9) continue;
5468
+ const ve = Math.min((0.9 - xe) * (1 / 0.2), 1), oe = 0.75 * Ge * ns * ve;
5469
+ let Q = C;
5470
+ if (y.fadeEnabled && (Q *= Math.max(0, 1 - xe)), Q *= ve, Q < 0.01) continue;
5471
+ const ye = ae * 4, yt = M[ye], gt = M[ye + 1], bt = M[ye + 2], it = yt + Qe, Pe = gt + Wt, _e = bt + Bt, De = Math.sqrt(it * it + Pe * Pe + _e * _e);
5472
+ if (De < 1e-3) continue;
5473
+ const Ae = 1 / De, le = it * Ae, ce = Pe * Ae, Xe = _e * Ae, Vt = G.right[0], Ot = G.right[1], Rt = G.right[2];
5474
+ let St = Vt * le + Ot * ce + Rt * Xe, Me = Vt - St * le, we = Ot - St * ce, Be = Rt - St * Xe, st = Math.sqrt(Me * Me + we * we + Be * Be);
5475
+ if (st < 0.2) {
5476
+ const E = G.up[0], O = G.up[1], ie = G.up[2], Y = E * le + O * ce + ie * Xe;
5477
+ Me = E - Y * le, we = O - Y * ce, Be = ie - Y * Xe, st = Math.sqrt(Me * Me + we * we + Be * Be) || 1;
5478
+ }
5479
+ Me /= st, we /= st, Be /= st;
5480
+ const ct = Math.min(B, Ee);
5481
+ if (ct < 1e-3) continue;
5482
+ const Lt = y.gravityEnabled && y.gravityStrength || 0, $e = bs, ge = Ss, Ce = xs;
5483
+ if (y.orientToDirection && y.burstMode && X) {
5484
+ const E = b._emitSimRotY || 0, O = vs, ie = Ps, Y = _s;
5485
+ for (let k = 0; k <= L; k++) {
5486
+ const j = ni(Ze, ke - k / L * ct, Si);
5487
+ O[k] = j[0], ie[k] = j[1], Y[k] = j[2];
5488
+ }
5489
+ for (let k = 0; k <= L; k++) {
5490
+ const j = k > 0 ? k - 1 : 0, W = k < L ? k + 1 : L;
5491
+ let ut = O[j] - O[W], dt = Y[j] - Y[W];
5492
+ const rt = (Math.hypot(ut, dt) > 1e-5 ? Math.atan2(ut, dt) : Math.atan2(Qe, Bt)) - E, Ve = Math.cos(rt), Oe = Math.sin(rt), Je = k / L * ct, Jt = -0.5 * Lt * Je * Je;
5493
+ $e[k] = Ve * te + Oe * Te + O[k], ge[k] = Ie + Jt + ie[k], Ce[k] = -Oe * te + Ve * Te + Y[k];
5494
+ }
5495
+ } else for (let E = 0; E <= L; E++) {
5496
+ const O = E / L * ct, ie = -0.5 * Lt * O * O;
5497
+ if (X) {
5498
+ const Y = ni(Ze, ke - O, Si);
5499
+ $e[E] = te - yt * O + Y[0], ge[E] = Ie - gt * O + ie + Y[1], Ce[E] = Te - bt * O + Y[2];
5500
+ } else
5501
+ $e[E] = et - it * O, ge[E] = tt - Pe * O + ie, Ce[E] = ze - _e * O;
5502
+ }
5503
+ if (N !== "straight") {
5504
+ const E = y.emissionTrailShapeAmplitude ?? 0.1, O = y.emissionTrailShapeFrequency ?? 4, ie = y.emissionTrailShapeSpeed ?? 0;
5505
+ let Y = -Xe, k = 0, j = le, W = Math.sqrt(Y * Y + j * j);
5506
+ W < 1e-6 && (Y = 0, k = Xe, j = -ce, W = Math.sqrt(Y * Y + k * k + j * j) || 1), Y /= W, k /= W, j /= W;
5507
+ const ut = ce * j - Xe * k, dt = Xe * Y - le * j, We = le * k - ce * Y;
5508
+ for (let be = 1; be <= L; be++) {
5509
+ const rt = be / L * ct, Ve = 2 * Math.PI * O * (ke - rt) + ie * ke;
5510
+ let Oe = 0, Je = 0;
5511
+ N === "zigzag" ? Oe = E * Math.sign(Math.sin(Ve)) : N === "sine" ? Oe = E * Math.sin(Ve) : N === "spiral" && (Oe = E * Math.sin(Ve), Je = E * Math.cos(Ve)), $e[be] += Y * Oe + ut * Je, ge[be] += k * Oe + dt * Je, Ce[be] += j * Oe + We * Je;
5512
+ }
5513
+ }
5514
+ if (w)
5515
+ for (let E = 1; E <= L && u < F; E++) {
5516
+ const O = E / L, ie = $e[E] - lt, Y = ge[E] - ue, k = Ce[E] - wt, j = u * 8, W = u * 4;
5517
+ Z[j] = ie, Z[j + 1] = Y, Z[j + 2] = k, Z[j + 3] = de, Z[j + 4] = fe, Z[j + 5] = me, Z[j + 6] = Ee + (Fe - Ee) * O, Z[j + 7] = Fe, J[W] = 0, J[W + 1] = 0, J[W + 2] = 0, J[W + 3] = 0, ee[W] = ie, ee[W + 1] = Y, ee[W + 2] = k, ee[W + 3] = 0, u++;
5518
+ }
5519
+ else
5520
+ for (let E = 0; E < L && !(f + 42 > qe.length); E++) {
5521
+ const O = E / L, ie = (E + 1) / L, Y = $e[E], k = ge[E], j = Ce[E], W = $e[E + 1], ut = ge[E + 1], dt = Ce[E + 1], We = oe * (1 - O), be = oe * (1 - ie), rt = Q * (1 - O) * (1 - O), Ve = Q * (1 - ie) * (1 - ie), Oe = Y + Me * We, Je = k + we * We, Jt = j + Be * We, Ri = Y - Me * We, Ti = k - we * We, Ei = j - Be * We, Ai = W + Me * be, Ci = ut + we * be, Ui = dt + Be * be, zs = W - Me * be, Fs = ut - we * be, Gs = dt - Be * be, xt = (Ds, Vs, Os, Ls) => {
5522
+ qe[f++] = Ds, qe[f++] = Vs, qe[f++] = Os, qe[f++] = de, qe[f++] = fe, qe[f++] = me, qe[f++] = Ls;
5523
+ };
5524
+ xt(Oe, Je, Jt, rt), xt(Ri, Ti, Ei, rt), xt(Ai, Ci, Ui, Ve), xt(Ri, Ti, Ei, rt), xt(zs, Fs, Gs, Ve), xt(Ai, Ci, Ui, Ve);
5525
+ }
5352
5526
  }
5527
+ w && u > m && Pt.set(y.id, { first: m, count: u - m });
5353
5528
  }
5354
- if (Q)
5355
- for (let w = 1; w <= I && f < E; w++) {
5356
- const z = w / I, $ = _e[w] - X, V = we[w] - it, A = Be[w] - jt, O = f * 8, H = f * 4;
5357
- D[O] = $, D[O + 1] = V, D[O + 2] = A, D[O + 3] = Le, D[O + 4] = Xe, D[O + 5] = Ne, D[O + 6] = ke + (Ie - ke) * z, D[O + 7] = Ie, N[H] = 0, N[H + 1] = 0, N[H + 2] = 0, N[H + 3] = 0, Y[H] = $, Y[H + 1] = V, Y[H + 2] = A, Y[H + 3] = 0, f++;
5358
- }
5359
- else
5360
- for (let w = 0; w < I && !(m + 42 > le.length); w++) {
5361
- const z = w / I, $ = (w + 1) / I, V = _e[w], A = we[w], O = Be[w], H = _e[w + 1], Me = we[w + 1], Re = Be[w + 1], ce = $t * (1 - z), ee = $t * (1 - $), ge = Ye * (1 - z) * (1 - z), te = Ye * (1 - $) * (1 - $), ie = V + re * ce, ue = A + ne * ce, St = O + ae * ce, ri = V - re * ce, ni = A - ne * ce, ai = O - ae * ce, oi = H + re * ee, li = Me + ne * ee, ci = Re + ae * ee, ls = H - re * ee, cs = Me - ne * ee, us = Re - ae * ee, ze = (ds, fs, hs, ps) => {
5362
- le[m++] = ds, le[m++] = fs, le[m++] = hs, le[m++] = Le, le[m++] = Xe, le[m++] = Ne, le[m++] = ps;
5363
- };
5364
- ze(ie, ue, St, ge), ze(ri, ni, ai, ge), ze(oi, li, ci, te), ze(ri, ni, ai, ge), ze(ls, cs, us, te), ze(oi, li, ci, te);
5365
- }
5366
5529
  }
5367
- Q && f > Z && Fe.set(g.id, { first: Z, count: f - Z });
5530
+ const R = h;
5531
+ h = rs(h, b, y), h > R && Ye.set(y.id, { first: R / 9, count: (h - R) / 9 });
5368
5532
  }
5369
- f > 0 && (r.queue.writeBuffer(k, 0, D, 0, f * 8), r.queue.writeBuffer(G, 0, N, 0, f * 4), r.queue.writeBuffer(de, 0, Y, 0, f * 4)), De = m / 7, De > 0 && r.queue.writeBuffer(zt, 0, le, 0, m);
5533
+ u > 0 && (r.queue.writeBuffer(K, 0, Z, 0, u * 8), r.queue.writeBuffer(q, 0, J, 0, u * 4), r.queue.writeBuffer(Ke, 0, ee, 0, u * 4)), _t = f / 7, _t > 0 && r.queue.writeBuffer(Nt, 0, qe, 0, f), mi = h / 9, mi > 0 && r.queue.writeBuffer(Yt, 0, Ue, 0, h);
5370
5534
  }
5371
- const Tt = () => {
5372
- r.queue.writeBuffer(M, 0, new Float32Array([1, 0, a.width, a.height, 0, 0, 0, 0])), r.queue.writeBuffer(R, 0, new Float32Array([0, 1, a.width, a.height, 0, 0, 0, 0]));
5535
+ const ai = () => {
5536
+ r.queue.writeBuffer(U, 0, new Float32Array([1, 0, a.width, a.height, 0, 0, 0, 0])), r.queue.writeBuffer(I, 0, new Float32Array([0, 1, a.width, a.height, 0, 0, 0, 0]));
5373
5537
  };
5374
- Tt();
5375
- const Et = new Float32Array(16).fill(0);
5376
- Et[0] = 1, r.queue.writeBuffer(x, 0, Et);
5377
- const se = ir(r), fe = er(r), {
5378
- particlePipeline: Ii,
5379
- particleAdditivePipeline: zi,
5380
- particleDepthWritePipeline: Gi,
5381
- blurPipeline: We,
5382
- compositePipeline: Fi,
5383
- directRenderPipeline: At,
5384
- finalCompositePipeline: Di,
5385
- glbMeshPipeline: Vi
5386
- } = tr(r, c, fe), Ct = r.createShaderModule({ code: `
5538
+ ai();
5539
+ const oi = new Float32Array(16).fill(0);
5540
+ oi[0] = 1, r.queue.writeBuffer(_, 0, oi);
5541
+ const Le = Tr(r), je = Br(r), {
5542
+ particlePipeline: os,
5543
+ particleAdditivePipeline: ls,
5544
+ particleDepthWritePipeline: cs,
5545
+ blurPipeline: Ut,
5546
+ compositePipeline: us,
5547
+ directRenderPipeline: li,
5548
+ finalCompositePipeline: ds,
5549
+ glbMeshPipeline: fs
5550
+ } = Rr(r, c, je), ci = r.createShaderModule({ code: `
5387
5551
  struct U { mvp: mat4x4<f32> };
5388
5552
  @group(0) @binding(0) var<uniform> u: U;
5389
5553
  struct VIn { @location(0) pos: vec3<f32>, @location(1) col: vec4<f32> };
5390
5554
  struct VOut { @builtin(position) pos: vec4<f32>, @location(0) col: vec4<f32> };
5391
5555
  @vertex fn vs(v: VIn) -> VOut { var o: VOut; o.pos = u.mvp * vec4<f32>(v.pos, 1.0); o.col = v.col; return o; }
5392
5556
  @fragment fn fs(i: VOut) -> @location(0) vec4<f32> { return i.col; }
5393
- ` }), Ut = r.createBindGroupLayout({
5557
+ ` }), ui = r.createBindGroupLayout({
5394
5558
  entries: [{ binding: 0, visibility: GPUShaderStage.VERTEX, buffer: { type: "uniform" } }]
5395
- }), Oi = r.createRenderPipeline({
5396
- layout: r.createPipelineLayout({ bindGroupLayouts: [Ut] }),
5559
+ }), ps = r.createRenderPipeline({
5560
+ layout: r.createPipelineLayout({ bindGroupLayouts: [ui] }),
5397
5561
  vertex: {
5398
- module: Ct,
5562
+ module: ci,
5399
5563
  entryPoint: "vs",
5400
5564
  buffers: [{ arrayStride: 28, attributes: [
5401
5565
  { shaderLocation: 0, offset: 0, format: "float32x3" },
@@ -5403,7 +5567,7 @@ async function vr(s, t = {}) {
5403
5567
  ] }]
5404
5568
  },
5405
5569
  fragment: {
5406
- module: Ct,
5570
+ module: ci,
5407
5571
  entryPoint: "fs",
5408
5572
  targets: [{ format: "rgba16float", blend: {
5409
5573
  // renders into the HDR sceneTexture
@@ -5415,23 +5579,182 @@ async function vr(s, t = {}) {
5415
5579
  // depth24plus to match the non-bloom pass; test against the resolved scene depth
5416
5580
  // (occlusion) but don't write (transparent ribbon).
5417
5581
  depthStencil: { format: "depth24plus", depthWriteEnabled: !1, depthCompare: "less-equal" }
5418
- }), It = 512 * 64 * 6, le = new Float32Array(It * 7), zt = r.createBuffer({
5419
- size: It * 7 * 4,
5582
+ }), di = 512 * 64 * 6, qe = new Float32Array(di * 7), Nt = r.createBuffer({
5583
+ size: di * 7 * 4,
5420
5584
  usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
5421
5585
  label: "ribbonBuffer"
5422
- }), Li = r.createBindGroup({
5423
- layout: Ut,
5424
- entries: [{ binding: 0, resource: { buffer: b } }]
5586
+ }), hs = r.createBindGroup({
5587
+ layout: ui,
5588
+ entries: [{ binding: 0, resource: { buffer: v } }]
5425
5589
  });
5426
- let De = 0, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe } = yi(r, c, a.width, a.height), Je = gi(r, a.width, a.height), Te, Gt, Qe, Ve;
5427
- const Ft = () => {
5428
- const f = (m) => m.createView();
5429
- Te = f(be), Gt = f(Se), Qe = f(xe), Ve = f(Je);
5590
+ let _t = 0;
5591
+ const fi = r.createShaderModule({ code: `
5592
+ struct Uniforms {
5593
+ transform: mat4x4<f32>,
5594
+ cameraPosition: vec3<f32>,
5595
+ aspectRatio: f32,
5596
+ elapsedTime: f32,
5597
+ }
5598
+
5599
+ struct AppearanceUniforms {
5600
+ fadeEnabled: f32,
5601
+ colorTransitionEnabled: f32,
5602
+ particleSize: f32,
5603
+ textureEnabled: f32,
5604
+ singleColor: vec3<f32>,
5605
+ rotation: f32,
5606
+ startColor: vec3<f32>,
5607
+ rotationMode: f32,
5608
+ endColor: vec3<f32>,
5609
+ minRotation: f32,
5610
+ maxRotation: f32,
5611
+ aspectRatio: f32,
5612
+ randomSize: f32,
5613
+ minSize: f32,
5614
+ maxSize: f32,
5615
+ fadeSizeEnabled: f32,
5616
+ opacity: f32,
5617
+ increaseSizeEnabled: f32,
5618
+ sizeLifetimeSpeed: f32,
5619
+ particleShape: f32,
5620
+ particleShapeRotation: f32,
5621
+ pulseEnabled: f32,
5622
+ pulseAmplitude: f32,
5623
+ pulseFrequency: f32,
5624
+ pulsePhaseRandom: f32,
5625
+ pulseOpacity: f32,
5626
+ glbRotationX: f32,
5627
+ glbRotationY: f32,
5628
+ glbRotationZ: f32,
5629
+ _pad0: f32,
5630
+ systemOffset: vec3<f32>,
5631
+ _pad1: f32,
5632
+ simRotX: f32,
5633
+ simRotZ: f32,
5634
+ velocityStretchEnabled: f32,
5635
+ velocityStretchFactor: f32,
5636
+ noiseDistortEnabled: f32,
5637
+ noiseTilingX: f32,
5638
+ noiseTilingY: f32,
5639
+ noiseSpeed: f32,
5640
+ noiseAmplitude: f32,
5641
+ systemVelX: f32,
5642
+ systemVelY: f32,
5643
+ systemVelZ: f32,
5644
+ orientX: f32,
5645
+ orientY: f32,
5646
+ orientZ: f32,
5647
+ _pad2: f32,
5648
+ }
5649
+
5650
+ @group(0) @binding(0) var<uniform> uniforms : Uniforms;
5651
+ @group(0) @binding(1) var<uniform> appearance : AppearanceUniforms;
5652
+ @group(0) @binding(2) var particleTexture: texture_2d<f32>;
5653
+ @group(0) @binding(3) var particleSampler: sampler;
5654
+
5655
+ struct VIn {
5656
+ @location(0) pos: vec3<f32>,
5657
+ @location(1) col: vec4<f32>,
5658
+ @location(2) uv: vec2<f32>,
5659
+ };
5660
+
5661
+ struct VOut {
5662
+ @builtin(position) pos: vec4<f32>,
5663
+ @location(0) col: vec3<f32>,
5664
+ @location(1) alpha: f32,
5665
+ @location(2) uv: vec2<f32>,
5666
+ @location(3) noiseOffset: vec2<f32>,
5667
+ };
5668
+
5669
+ fn hash21(p: vec2<f32>) -> f32 {
5670
+ return fract(sin(dot(p, vec2<f32>(127.1, 311.7))) * 43758.5453);
5671
+ }
5672
+
5673
+ fn valueNoise(p: vec2<f32>) -> f32 {
5674
+ let i = floor(p);
5675
+ let f = fract(p);
5676
+ let u = f * f * (3.0 - 2.0 * f);
5677
+ let a = hash21(i);
5678
+ let b = hash21(i + vec2<f32>(1.0, 0.0));
5679
+ let c = hash21(i + vec2<f32>(0.0, 1.0));
5680
+ let d = hash21(i + vec2<f32>(1.0, 1.0));
5681
+ return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);
5682
+ }
5683
+
5684
+ @vertex
5685
+ fn vs(v: VIn) -> VOut {
5686
+ var o: VOut;
5687
+ o.pos = uniforms.transform * vec4<f32>(v.pos, 1.0);
5688
+ o.col = v.col.rgb;
5689
+ o.alpha = v.col.a;
5690
+ o.uv = v.uv;
5691
+ o.noiseOffset = vec2<f32>(
5692
+ uniforms.elapsedTime * appearance.noiseSpeed,
5693
+ uniforms.elapsedTime * appearance.noiseSpeed * 0.5
5694
+ );
5695
+ return o;
5696
+ }
5697
+
5698
+ @fragment
5699
+ fn fs(i: VOut) -> @location(0) vec4<f32> {
5700
+ let baseUV = vec2<f32>(fract(i.uv.x), clamp(i.uv.y, 0.001, 0.999));
5701
+ var sampleUV = baseUV;
5702
+ if (appearance.textureEnabled > 0.5) {
5703
+ if (appearance.noiseDistortEnabled > 0.5) {
5704
+ let nUV = baseUV * vec2<f32>(
5705
+ max(appearance.noiseTilingX, 0.0001),
5706
+ max(appearance.noiseTilingY, 0.0001)
5707
+ ) + i.noiseOffset;
5708
+ let n1 = valueNoise(nUV) - 0.5;
5709
+ let n2 = valueNoise(nUV + vec2<f32>(13.7, 7.3)) - 0.5;
5710
+ sampleUV = vec2<f32>(
5711
+ fract(sampleUV.x + n1 * appearance.noiseAmplitude),
5712
+ clamp(sampleUV.y + n2 * appearance.noiseAmplitude, 0.001, 0.999)
5713
+ );
5714
+ }
5715
+ let texColor = textureSample(particleTexture, particleSampler, sampleUV);
5716
+ return vec4<f32>(i.col * texColor.rgb, i.alpha * texColor.a);
5717
+ }
5718
+ return vec4<f32>(i.col, i.alpha);
5719
+ }
5720
+ ` }), pi = (u) => r.createRenderPipeline({
5721
+ layout: r.createPipelineLayout({ bindGroupLayouts: [je.particleBindGroupLayout] }),
5722
+ vertex: {
5723
+ module: fi,
5724
+ entryPoint: "vs",
5725
+ buffers: [{ arrayStride: 36, attributes: [
5726
+ { shaderLocation: 0, offset: 0, format: "float32x3" },
5727
+ { shaderLocation: 1, offset: 12, format: "float32x4" },
5728
+ { shaderLocation: 2, offset: 28, format: "float32x2" }
5729
+ ] }]
5730
+ },
5731
+ fragment: {
5732
+ module: fi,
5733
+ entryPoint: "fs",
5734
+ targets: [{ format: "rgba16float", blend: u }]
5735
+ },
5736
+ primitive: { topology: "triangle-list" },
5737
+ depthStencil: { format: "depth24plus", depthWriteEnabled: !1, depthCompare: "less-equal" }
5738
+ }), ms = pi({
5739
+ color: { srcFactor: "src-alpha", dstFactor: "one-minus-src-alpha", operation: "add" },
5740
+ alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" }
5741
+ }), ys = pi({
5742
+ color: { srcFactor: "src-alpha", dstFactor: "one", operation: "add" },
5743
+ alpha: { srcFactor: "one", dstFactor: "one-minus-src-alpha", operation: "add" }
5744
+ }), hi = 256 * 256 * 6, Ue = new Float32Array(hi * 9), Yt = r.createBuffer({
5745
+ size: hi * 9 * 4,
5746
+ usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
5747
+ label: "shapeStrokeBuffer"
5748
+ });
5749
+ let mi = 0, { sceneTexture: nt, bloomTexA: at, bloomTexB: ot } = Oi(r, c, a.width, a.height), It = Li(r, a.width, a.height), pt, yi, zt, Mt;
5750
+ const gi = () => {
5751
+ const u = (f) => f.createView();
5752
+ pt = u(nt), yi = u(at), zt = u(ot), Mt = u(It);
5430
5753
  };
5431
- Ft();
5432
- const ut = { uniformBuffer: b, appearanceUniformBuffer: _, horizontalBlurUniformBuffer: M, verticalBlurUniformBuffer: R, bloomIntensityBuffer: x };
5433
- let Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
5434
- const C = {
5754
+ gi();
5755
+ const jt = { uniformBuffer: v, appearanceUniformBuffer: A, horizontalBlurUniformBuffer: U, verticalBlurUniformBuffer: I, bloomIntensityBuffer: _ };
5756
+ let Ft = ei(r, Le, jt, { sceneTexture: nt, bloomTexA: at, bloomTexB: ot });
5757
+ const G = {
5435
5758
  mvp: new Float32Array(16),
5436
5759
  position: new Float32Array([0, 0, 10]),
5437
5760
  right: new Float32Array([1, 0, 0]),
@@ -5439,187 +5762,189 @@ async function vr(s, t = {}) {
5439
5762
  up: new Float32Array([0, 1, 0]),
5440
5763
  hasCamera: !1
5441
5764
  };
5442
- let he = 0, Xi = 0;
5443
- const Ee = new Float32Array(5), Dt = new Float32Array(16), Ni = new Array(65), ki = new Array(65), ji = new Array(65), Yi = new Array(65), qi = new Array(65), Hi = new Array(65), Vt = [0, 0, 0], Ae = { key: null, ms: !1, bindGroup: null };
5444
- let Ot = !1, dt = !0, et = !1, tt = null, ft = a.width, ht = a.height;
5445
- function Lt() {
5446
- const f = [be, Se, xe, Je], m = yi(r, c, a.width, a.height);
5447
- be = m.sceneTexture, Se = m.bloomTexA, xe = m.bloomTexB, Je = gi(r, a.width, a.height), Ft(), Tt(), d.clear(), h.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
5448
- let S = !1;
5449
- const g = () => {
5450
- if (!S) {
5451
- S = !0, requestAnimationFrame(g);
5765
+ let ke = 0, gs = 0;
5766
+ const ht = new Float32Array(5), bi = new Float32Array(16), bs = new Array(65), Ss = new Array(65), xs = new Array(65), vs = new Array(65), Ps = new Array(65), _s = new Array(65), Si = [0, 0, 0], mt = { key: null, ms: !1, bindGroup: null };
5767
+ let xi = !1, qt = !0, Gt = !1, Dt = null, Ht = a.width, Zt = a.height;
5768
+ function vi() {
5769
+ const u = [nt, at, ot, It], f = Oi(r, c, a.width, a.height);
5770
+ nt = f.sceneTexture, at = f.bloomTexA, ot = f.bloomTexB, It = Li(r, a.width, a.height), gi(), ai(), p.clear(), g.resizeTextures(), Ft = ei(r, Le, jt, { sceneTexture: nt, bloomTexA: at, bloomTexB: ot });
5771
+ let h = !1;
5772
+ const b = () => {
5773
+ if (!h) {
5774
+ h = !0, requestAnimationFrame(b);
5452
5775
  return;
5453
5776
  }
5454
- f.forEach((v) => v.destroy());
5777
+ u.forEach((y) => y.destroy());
5455
5778
  };
5456
- requestAnimationFrame(g);
5779
+ requestAnimationFrame(b);
5457
5780
  }
5458
- function Zi(f, m, S) {
5459
- C.mvp.set(ar(f, m)), m && m.length >= 10 && (C.right[0] = m[0], C.right[1] = m[4], C.right[2] = m[8], C.up[0] = m[1], C.up[1] = m[5], C.up[2] = m[9]), S && (C.position[0] = S.x ?? S[0], C.position[1] = S.y ?? S[1], C.position[2] = S.z ?? S[2]), C.hasCamera = !0;
5781
+ function Ms(u, f, h) {
5782
+ G.mvp.set(Ur(u, f)), f && f.length >= 10 && (G.right[0] = f[0], G.right[1] = f[4], G.right[2] = f[8], G.up[0] = f[1], G.up[1] = f[5], G.up[2] = f[9]), h && (G.position[0] = h.x ?? h[0], G.position[1] = h.y ?? h[1], G.position[2] = h.z ?? h[2]), G.hasCamera = !0;
5460
5783
  }
5461
- function $i(f, m) {
5462
- C.mvp.set(f), m && (C.position[0] = m.x ?? m[0], C.position[1] = m.y ?? m[1], C.position[2] = m.z ?? m[2]), C.hasCamera = !0;
5784
+ function ws(u, f) {
5785
+ G.mvp.set(u), f && (G.position[0] = f.x ?? f[0], G.position[1] = f.y ?? f[1], G.position[2] = f.z ?? f[2]), G.hasCamera = !0;
5463
5786
  }
5464
- async function pt(f) {
5465
- if (et) {
5466
- tt = f;
5787
+ async function $t(u) {
5788
+ if (Gt) {
5789
+ Dt = u;
5467
5790
  return;
5468
5791
  }
5469
- et = !0;
5792
+ Gt = !0;
5470
5793
  try {
5471
- for (const m in P) delete P[m];
5472
- d.clear(), h.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5473
- for (const m of f)
5474
- await l.addSystems(m.preset, m.position || [0, 0, 0]);
5475
- for (const { config: m } of l.particleSystems)
5476
- P[m.id] || (P[m.id] = T());
5477
- dt = !0, l.respawnAllSystems();
5794
+ for (const f in T) delete T[f];
5795
+ p.clear(), g.resizeTextures(), Ft = ei(r, Le, jt, { sceneTexture: nt, bloomTexA: at, bloomTexB: ot }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
5796
+ for (const f of u)
5797
+ await l.addSystems(f.preset, f.position || [0, 0, 0]);
5798
+ for (const { config: f } of l.particleSystems)
5799
+ T[f.id] || (T[f.id] = z());
5800
+ qt = !0, l.respawnAllSystems();
5478
5801
  } finally {
5479
- if (et = !1, tt) {
5480
- const m = tt;
5481
- tt = null, pt(m);
5802
+ if (Gt = !1, Dt) {
5803
+ const f = Dt;
5804
+ Dt = null, $t(f);
5482
5805
  }
5483
5806
  }
5484
5807
  }
5485
- async function Wi(f, m = [0, 0, 0]) {
5486
- return pt([{ preset: f, position: m }]);
5487
- }
5488
- function Ji(f) {
5489
- if (Ot || et || !l.ready || f <= 0 || l.particleSystems.length === 0) return;
5490
- const m = l.clock;
5491
- if (m && (m.loop = l.loop ?? i, m.duration = l.getTotalDuration(), f = m.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
5492
- if ((a.width !== ft || a.height !== ht) && (ft = a.width, ht = a.height, Lt()), he += f, W.length) {
5493
- for (const y of W) {
5494
- if (y.getPosition) {
5495
- const B = y.getPosition();
5496
- 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;
5808
+ async function Bs(u, f = [0, 0, 0]) {
5809
+ return $t([{ preset: u, position: f }]);
5810
+ }
5811
+ function Rs(u) {
5812
+ if (xi || Gt || !l.ready || u <= 0 || l.particleSystems.length === 0) return;
5813
+ const f = l.clock;
5814
+ if (f && (f.loop = l.loop ?? i, f.duration = l.getTotalDuration(), u = f.tick(u)), u > 0.1 && (u = 0.1), u <= 0) return;
5815
+ if ((a.width !== Ht || a.height !== Zt) && (Ht = a.width, Zt = a.height, vi()), ke += u, Se.length) {
5816
+ for (const m of Se) {
5817
+ if (m.getPosition) {
5818
+ const B = m.getPosition();
5819
+ B ? (m.pos || (m.pos = m._posBuf), Array.isArray(B) ? (m.pos[0] = B[0], m.pos[1] = B[1], m.pos[2] = B[2]) : (m.pos[0] = B.x, m.pos[1] = B.y, m.pos[2] = B.z)) : m.pos = null;
5497
5820
  }
5498
- 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);
5821
+ m.vel = m._velBuf, m.pos && m.prevPos && m.wasActive && u > 0 ? (m.vel[0] = (m.pos[0] - m.prevPos[0]) / u, m.vel[1] = (m.pos[1] - m.prevPos[1]) / u, m.vel[2] = (m.pos[2] - m.prevPos[2]) / u) : (m.vel[0] = 0, m.vel[1] = 0, m.vel[2] = 0), m.justResumed = !!m.pos && !m.wasActive, m.justResumed && (m.hist.length = 0);
5499
5822
  }
5500
- for (const { system: y, config: B } of l.particleSystems) {
5501
- const U = Mt(B.id);
5502
- if (!(!U || U.historyOnly) && (B.hidden = !U.pos, U.pos)) {
5503
- let I = null;
5504
- if (U.orientToDirection && U.vel) {
5505
- const F = U.vel[0], J = U.vel[2];
5506
- Math.hypot(F, J) > 1e-4 && (I = [0, 0, Math.atan2(F, J)]);
5823
+ for (const { system: m, config: B } of l.particleSystems) {
5824
+ const C = ri(B.id);
5825
+ if (!(!C || C.historyOnly) && (B.hidden = !C.pos, C.pos)) {
5826
+ let H = null;
5827
+ if (C.orientToDirection && C.vel) {
5828
+ const V = C.vel[0], L = C.vel[2];
5829
+ Math.hypot(V, L) > 1e-4 && (H = [0, 0, Math.atan2(V, L)]);
5507
5830
  }
5508
- y.setSimulationTransform({ position: U.pos, velocity: U.vel, rotation: I }), y.updateAppearanceUniform(), (U.justResumed || y.activeParticles === 0) && y.spawnParticles();
5831
+ m.setSimulationTransform({ position: C.pos, velocity: C.vel, rotation: H }), m.updateAppearanceUniform(), (C.justResumed || m.activeParticles === 0) && m.spawnParticles();
5509
5832
  }
5510
5833
  }
5511
- for (const y of W)
5512
- y.pos ? Ai(y, he) : y.hist.length = 0, y.pos ? (y._prevPosBuf[0] = y.pos[0], y._prevPosBuf[1] = y.pos[1], y._prevPosBuf[2] = y.pos[2], y.prevPos = y._prevPosBuf) : y.prevPos = null, y.wasActive = !!y.pos;
5513
- if (globalThis.__HZFX_DEBUG && (Xi++ & 63) === 0) {
5514
- const y = l.particleSystems.reduce((F, J) => F + (J.system.activeParticles | 0), 0), B = W.find((F) => F.pos), U = B ? Math.hypot(C.position[0] - B.pos[0], C.position[1] - B.pos[1], C.position[2] - B.pos[2]).toFixed(1) : "-", I = W.map((F) => `{ids:[${[...F.ids]}],pos:${F.pos ? "1" : "0"},hist:${F.hist.length}}`).join(",");
5515
- console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${De} camDist=${U} t=${he.toFixed(1)}`);
5834
+ for (const m of Se)
5835
+ m.pos ? Qi(m, ke) : m.hist.length = 0, m.pos ? (m._prevPosBuf[0] = m.pos[0], m._prevPosBuf[1] = m.pos[1], m._prevPosBuf[2] = m.pos[2], m.prevPos = m._prevPosBuf) : m.prevPos = null, m.wasActive = !!m.pos;
5836
+ if (globalThis.__HZFX_DEBUG && (gs++ & 63) === 0) {
5837
+ const m = l.particleSystems.reduce((V, L) => V + (L.system.activeParticles | 0), 0), B = Se.find((V) => V.pos), C = B ? Math.hypot(G.position[0] - B.pos[0], G.position[1] - B.pos[1], G.position[2] - B.pos[2]).toFixed(1) : "-", H = Se.map((V) => `{ids:[${[...V.ids]}],pos:${V.pos ? "1" : "0"},hist:${V.hist.length}}`).join(",");
5838
+ console.info(`[HZFX] movingGroups(${Se.length})=[${H}] activeParticles=${m} systems=${l.particleSystems.length} ribbonVerts=${_t} camDist=${C} t=${ke.toFixed(1)}`);
5516
5839
  }
5517
5840
  }
5518
- if (l.updateAllSystems(f), m ? m.loop : l.loop ?? i) {
5519
- const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system: B }) => B.activeParticles === 0 && !B.emitting);
5520
- (m && m.justLooped || y && dt) && l.respawnAllSystems(), dt = !y;
5841
+ if (l.updateAllSystems(u), f ? f.loop : l.loop ?? i) {
5842
+ const m = l.particleSystems.length > 0 && l.particleSystems.every(({ system: B }) => B.activeParticles === 0 && !B.emitting);
5843
+ (f && f.justLooped || m && qt) && l.respawnAllSystems(), qt = !m;
5521
5844
  }
5522
- for (const { system: y, config: B } of l.particleSystems)
5523
- B.glbModelEnabled && y.glbAnimator && (y.glbAnimator.update(f), y.updateAnimatedGLBBuffer());
5524
- r.queue.writeBuffer(b, 0, C.mvp), Ee[0] = C.position[0], Ee[1] = C.position[1], Ee[2] = C.position[2], Ee[3] = a.height / Math.max(1, a.width), Ee[4] = he, r.queue.writeBuffer(b, 64, Ee), Ui();
5525
- const g = l.particleSystems.some(({ config: y }) => y.bloomEnabled), v = r.createCommandEncoder();
5526
- let q = !1;
5845
+ for (const { system: m, config: B } of l.particleSystems)
5846
+ B.glbModelEnabled && m.glbAnimator && (m.glbAnimator.update(u), m.updateAnimatedGLBBuffer());
5847
+ r.queue.writeBuffer(v, 0, G.mvp), ht[0] = G.position[0], ht[1] = G.position[1], ht[2] = G.position[2], ht[3] = a.height / Math.max(1, a.width), ht[4] = ke, r.queue.writeBuffer(v, 64, ht), as();
5848
+ const b = l.particleSystems.some(
5849
+ ({ system: m, config: B }) => B.bloomEnabled && !B.hidden && (m.activeParticles > 0 || Ye.has(B.id))
5850
+ ), y = r.createCommandEncoder();
5851
+ let R = !1;
5527
5852
  if (e)
5528
5853
  try {
5529
- const y = e();
5530
- if (y) {
5531
- let B = null, U = null, I = !1;
5532
- if (y instanceof GPUTexture ? y.width === a.width && y.height === a.height && (B = y, U = () => y.createView({ aspect: "depth-only" }), I = y.sampleCount > 1) : y.view && (B = y.view, U = () => y.view, I = !!y.multisampled), B) {
5533
- const { pipeline: F, layout: J } = p(I);
5534
- (Ae.key !== B || Ae.ms !== I) && (Ae.key = B, Ae.ms = I, Ae.bindGroup = r.createBindGroup({
5535
- layout: J,
5536
- entries: [{ binding: 0, resource: U() }]
5854
+ const m = e();
5855
+ if (m) {
5856
+ let B = null, C = null, H = !1;
5857
+ if (m instanceof GPUTexture ? m.width === a.width && m.height === a.height && (B = m, C = () => m.createView({ aspect: "depth-only" }), H = m.sampleCount > 1) : m.view && (B = m.view, C = () => m.view, H = !!m.multisampled), B) {
5858
+ const { pipeline: V, layout: L } = S(H);
5859
+ (mt.key !== B || mt.ms !== H) && (mt.key = B, mt.ms = H, mt.bindGroup = r.createBindGroup({
5860
+ layout: L,
5861
+ entries: [{ binding: 0, resource: C() }]
5537
5862
  }));
5538
- const K = v.beginRenderPass({
5863
+ const N = y.beginRenderPass({
5539
5864
  colorAttachments: [],
5540
- depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5865
+ depthStencilAttachment: { view: Mt, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5541
5866
  });
5542
- K.setPipeline(F), K.setBindGroup(0, Ae.bindGroup), K.draw(3), K.end(), q = !0;
5867
+ N.setPipeline(V), N.setBindGroup(0, mt.bindGroup), N.draw(3), N.end(), R = !0;
5543
5868
  }
5544
5869
  }
5545
5870
  } catch {
5546
5871
  }
5547
- const j = v.beginRenderPass({
5548
- colorAttachments: [{ view: Te, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5549
- depthStencilAttachment: q ? { view: Ve, depthLoadOp: "load", depthStoreOp: "store" } : { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5872
+ const P = y.beginRenderPass({
5873
+ colorAttachments: [{ view: pt, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5874
+ depthStencilAttachment: R ? { view: Mt, depthLoadOp: "load", depthStoreOp: "store" } : { view: Mt, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
5550
5875
  });
5551
- for (const { system: y, config: B } of l.particleSystems)
5552
- B.bloomEnabled || B.hidden || y.activeParticles === 0 || Xt(j, y, B);
5553
- if (De > 0 && (j.setPipeline(Oi), j.setBindGroup(0, Li), j.setVertexBuffer(0, zt), j.draw(De)), j.end(), g) {
5554
- const y = {
5555
- colorAttachments: [{ view: Gt, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5876
+ for (const { system: m, config: B } of l.particleSystems)
5877
+ B.bloomEnabled || B.hidden || m.activeParticles === 0 && !Ye.has(B.id) || (_i(P, m, B), Mi(P, m, B));
5878
+ if (_t > 0 && (P.setPipeline(ps), P.setBindGroup(0, hs), P.setVertexBuffer(0, Nt), P.draw(_t)), P.end(), b) {
5879
+ const m = {
5880
+ colorAttachments: [{ view: yi, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5556
5881
  }, B = {
5557
- colorAttachments: [{ view: Qe, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5882
+ colorAttachments: [{ view: zt, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5558
5883
  };
5559
- for (const { system: U, config: I } of l.particleSystems) {
5560
- if (!I.bloomEnabled || I.hidden || U.activeParticles === 0) continue;
5561
- const F = U.config.id, J = h.getBloomSourceTexture(F, a.width, a.height), K = v.beginRenderPass({
5562
- colorAttachments: [{ view: J.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5563
- depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "load", depthStoreOp: "store" }
5884
+ for (const { system: C, config: H } of l.particleSystems) {
5885
+ if (!H.bloomEnabled || H.hidden || C.activeParticles === 0 && !Ye.has(H.id)) continue;
5886
+ const V = C.config.id, L = g.getBloomSourceTexture(V, a.width, a.height), N = y.beginRenderPass({
5887
+ colorAttachments: [{ view: L.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
5888
+ depthStencilAttachment: { view: Mt, depthClearValue: 1, depthLoadOp: "load", depthStoreOp: "store" }
5564
5889
  });
5565
- Xt(K, U, I), K.end(), Dt[0] = I.bloomIntensity, r.queue.writeBuffer(x, 0, Dt), d.systemBloomHorizontalBindGroups[F] || (d.systemBloomHorizontalBindGroups[F] = r.createBindGroup({
5566
- layout: fe.bloomBindGroupLayout,
5890
+ _i(N, C, H), Mi(N, C, H), N.end(), bi[0] = H.bloomIntensity, r.queue.writeBuffer(_, 0, bi), p.systemBloomHorizontalBindGroups[V] || (p.systemBloomHorizontalBindGroups[V] = r.createBindGroup({
5891
+ layout: je.bloomBindGroupLayout,
5567
5892
  entries: [
5568
- { binding: 0, resource: se },
5569
- { binding: 1, resource: J.createView() },
5570
- { binding: 2, resource: { buffer: M } }
5893
+ { binding: 0, resource: Le },
5894
+ { binding: 1, resource: L.createView() },
5895
+ { binding: 2, resource: { buffer: U } }
5571
5896
  ]
5572
5897
  }));
5573
- let X = v.beginRenderPass(y);
5574
- X.setPipeline(We), X.setBindGroup(0, d.systemBloomHorizontalBindGroups[F]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end(), d.secondHorizontalBindGroups[F] || (d.secondHorizontalBindGroups[F] = r.createBindGroup({
5575
- layout: fe.bloomBindGroupLayout,
5898
+ let D = y.beginRenderPass(m);
5899
+ D.setPipeline(Ut), D.setBindGroup(0, p.systemBloomHorizontalBindGroups[V]), D.draw(3), D.end(), D = y.beginRenderPass(B), D.setPipeline(Ut), D.setBindGroup(0, Ft.verticalBlurBindGroup), D.draw(3), D.end(), p.secondHorizontalBindGroups[V] || (p.secondHorizontalBindGroups[V] = r.createBindGroup({
5900
+ layout: je.bloomBindGroupLayout,
5576
5901
  entries: [
5577
- { binding: 0, resource: se },
5578
- { binding: 1, resource: Qe },
5579
- { binding: 2, resource: { buffer: M } }
5902
+ { binding: 0, resource: Le },
5903
+ { binding: 1, resource: zt },
5904
+ { binding: 2, resource: { buffer: U } }
5580
5905
  ]
5581
- })), X = v.beginRenderPass(y), X.setPipeline(We), X.setBindGroup(0, d.secondHorizontalBindGroups[F]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end();
5582
- const it = h.getBloomCompositeTexture(F, a.width, a.height);
5583
- X = v.beginRenderPass({
5584
- colorAttachments: [{ view: it.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5585
- }), X.setPipeline(Fi), d.systemBloomCompositeBindGroups[F] || (d.systemBloomCompositeBindGroups[F] = r.createBindGroup({
5586
- layout: fe.compositeBindGroupLayout,
5906
+ })), D = y.beginRenderPass(m), D.setPipeline(Ut), D.setBindGroup(0, p.secondHorizontalBindGroups[V]), D.draw(3), D.end(), D = y.beginRenderPass(B), D.setPipeline(Ut), D.setBindGroup(0, Ft.verticalBlurBindGroup), D.draw(3), D.end();
5907
+ const pe = g.getBloomCompositeTexture(V, a.width, a.height);
5908
+ D = y.beginRenderPass({
5909
+ colorAttachments: [{ view: pe.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5910
+ }), D.setPipeline(us), p.systemBloomCompositeBindGroups[V] || (p.systemBloomCompositeBindGroups[V] = r.createBindGroup({
5911
+ layout: je.compositeBindGroupLayout,
5587
5912
  entries: [
5588
- { binding: 0, resource: se },
5589
- { binding: 1, resource: J.createView() },
5590
- { binding: 2, resource: Qe },
5591
- { binding: 3, resource: { buffer: U.bloomIntensityBuffer } }
5913
+ { binding: 0, resource: Le },
5914
+ { binding: 1, resource: L.createView() },
5915
+ { binding: 2, resource: zt },
5916
+ { binding: 3, resource: { buffer: C.bloomIntensityBuffer } }
5592
5917
  ]
5593
- })), X.setBindGroup(0, d.systemBloomCompositeBindGroups[F]), X.draw(3), X.end();
5918
+ })), D.setBindGroup(0, p.systemBloomCompositeBindGroups[V]), D.draw(3), D.end();
5594
5919
  }
5595
5920
  }
5596
- const Q = h.getCombinedTexture(a.width, a.height), Z = v.beginRenderPass({
5597
- colorAttachments: [{ view: Q.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5921
+ const M = g.getCombinedTexture(a.width, a.height), x = y.beginRenderPass({
5922
+ colorAttachments: [{ view: M.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
5598
5923
  });
5599
- Z.setPipeline(At), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
5600
- layout: fe.compositeBindGroupLayout,
5924
+ x.setPipeline(li), p.combinedInitialBindGroup || (p.combinedInitialBindGroup = r.createBindGroup({
5925
+ layout: je.compositeBindGroupLayout,
5601
5926
  entries: [
5602
- { binding: 0, resource: se },
5603
- { binding: 1, resource: Te },
5604
- { binding: 2, resource: Te },
5605
- { binding: 3, resource: { buffer: x } }
5927
+ { binding: 0, resource: Le },
5928
+ { binding: 1, resource: pt },
5929
+ { binding: 2, resource: pt },
5930
+ { binding: 3, resource: { buffer: _ } }
5606
5931
  ]
5607
- })), Z.setBindGroup(0, d.combinedInitialBindGroup), Z.draw(3);
5608
- for (const { config: y, system: B } of l.particleSystems) {
5609
- if (!y.bloomEnabled || y.hidden || B.activeParticles === 0) continue;
5610
- const U = B.config.id;
5611
- Z.setPipeline(At), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
5612
- layout: fe.compositeBindGroupLayout,
5932
+ })), x.setBindGroup(0, p.combinedInitialBindGroup), x.draw(3);
5933
+ for (const { config: m, system: B } of l.particleSystems) {
5934
+ if (!m.bloomEnabled || m.hidden || B.activeParticles === 0 && !Ye.has(m.id)) continue;
5935
+ const C = B.config.id;
5936
+ x.setPipeline(li), p.combinedBloomCompositeBindGroups[C] || (p.combinedBloomCompositeBindGroups[C] = r.createBindGroup({
5937
+ layout: je.compositeBindGroupLayout,
5613
5938
  entries: [
5614
- { binding: 0, resource: se },
5615
- { binding: 1, resource: h.getBloomCompositeTexture(U, a.width, a.height).createView() },
5616
- { binding: 2, resource: Te },
5617
- { binding: 3, resource: { buffer: x } }
5939
+ { binding: 0, resource: Le },
5940
+ { binding: 1, resource: g.getBloomCompositeTexture(C, a.width, a.height).createView() },
5941
+ { binding: 2, resource: pt },
5942
+ { binding: 3, resource: { buffer: _ } }
5618
5943
  ]
5619
- })), Z.setBindGroup(0, d.combinedBloomCompositeBindGroups[U]), Z.draw(3);
5944
+ })), x.setBindGroup(0, p.combinedBloomCompositeBindGroups[C]), x.draw(3);
5620
5945
  }
5621
- Z.end();
5622
- const Ce = v.beginRenderPass({
5946
+ x.end();
5947
+ const w = y.beginRenderPass({
5623
5948
  colorAttachments: [{
5624
5949
  view: n.getCurrentTexture().createView(),
5625
5950
  loadOp: o ? "load" : "clear",
@@ -5627,104 +5952,112 @@ async function vr(s, t = {}) {
5627
5952
  clearValue: { r: 0, g: 0, b: 0, a: 0 }
5628
5953
  }]
5629
5954
  });
5630
- Ce.setPipeline(Di), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
5631
- layout: fe.compositeBindGroupLayout,
5955
+ w.setPipeline(ds), p.finalBindGroup || (p.finalBindGroup = r.createBindGroup({
5956
+ layout: je.compositeBindGroupLayout,
5632
5957
  entries: [
5633
- { binding: 0, resource: se },
5634
- { binding: 1, resource: Q.createView() },
5635
- { binding: 2, resource: Te },
5636
- { binding: 3, resource: { buffer: x } }
5958
+ { binding: 0, resource: Le },
5959
+ { binding: 1, resource: M.createView() },
5960
+ { binding: 2, resource: pt },
5961
+ { binding: 3, resource: { buffer: _ } }
5637
5962
  ]
5638
- })), Ce.setBindGroup(0, d.finalBindGroup), Ce.draw(3), Ce.end(), r.queue.submit([v.finish()]);
5963
+ })), w.setBindGroup(0, p.finalBindGroup), w.draw(3), w.end(), r.queue.submit([y.finish()]);
5639
5964
  }
5640
- function Xt(f, m, S) {
5641
- const g = m.config.id, v = S.glbModelEnabled && m.glbMeshData, q = !d.systemBindGroups[g] || d.textureStates[g] !== S.textureEnabled || d.textureRefs[g] !== m.particleTexture;
5642
- d.textureStates[g] = S.textureEnabled, d.textureRefs[g] = m.particleTexture, q && (d.systemBindGroups[g] = r.createBindGroup({
5643
- layout: fe.particleBindGroupLayout,
5965
+ function Pi(u, f) {
5966
+ const h = u.config.id, b = !p.systemBindGroups[h] || p.textureStates[h] !== f.textureEnabled || p.textureRefs[h] !== u.particleTexture;
5967
+ return p.textureStates[h] = f.textureEnabled, p.textureRefs[h] = u.particleTexture, b && (p.systemBindGroups[h] = r.createBindGroup({
5968
+ layout: je.particleBindGroupLayout,
5644
5969
  entries: [
5645
- { binding: 0, resource: { buffer: b } },
5646
- { binding: 1, resource: { buffer: m.appearanceUniformBuffer } },
5647
- { binding: 2, resource: m.particleTexture.createView() },
5648
- { binding: 3, resource: se }
5970
+ { binding: 0, resource: { buffer: v } },
5971
+ { binding: 1, resource: { buffer: u.appearanceUniformBuffer } },
5972
+ { binding: 2, resource: u.particleTexture.createView() },
5973
+ { binding: 3, resource: Le }
5649
5974
  ]
5650
- }));
5651
- const j = d.systemBindGroups[g], Q = S.shapeDisplay !== !1;
5652
- if (v)
5653
- Q && (f.setPipeline(Vi), f.setBindGroup(0, j), f.setVertexBuffer(0, m.glbVertexBuffer), f.setVertexBuffer(1, m.instanceBuffer), f.setVertexBuffer(2, m.velocityBuffer), f.setIndexBuffer(m.glbIndexBuffer, m.glbIndexFormat), f.drawIndexed(m.glbIndexCount, m.activeParticles));
5975
+ })), p.systemBindGroups[h];
5976
+ }
5977
+ function _i(u, f, h) {
5978
+ const b = f.config.id, y = h.glbModelEnabled && f.glbMeshData, R = Pi(f, h), P = h.shapeDisplay !== !1;
5979
+ if (y)
5980
+ P && (u.setPipeline(fs), u.setBindGroup(0, R), u.setVertexBuffer(0, f.glbVertexBuffer), u.setVertexBuffer(1, f.instanceBuffer), u.setVertexBuffer(2, f.velocityBuffer), u.setIndexBuffer(f.glbIndexBuffer, f.glbIndexFormat), u.drawIndexed(f.glbIndexCount, f.activeParticles));
5654
5981
  else {
5655
- f.setPipeline(S.blendMode === "additive" ? zi : Ii), f.setIndexBuffer(L, "uint16"), P[g] || (P[g] = T()), f.setVertexBuffer(0, P[g]), f.setBindGroup(0, j), Q && (f.setVertexBuffer(1, m.instanceBuffer), f.setVertexBuffer(2, m.velocityBuffer), f.setVertexBuffer(3, m.trailBuffer), f.drawIndexed(6, m.activeParticles));
5656
- const Z = Fe.get(g);
5657
- Z && (f.setVertexBuffer(1, k), f.setVertexBuffer(2, G), f.setVertexBuffer(3, de), f.drawIndexed(6, Z.count, 0, 0, Z.first)), Q && S.depthWriteEnabled && (f.setPipeline(Gi), f.drawIndexed(6, m.activeParticles));
5982
+ u.setPipeline(h.blendMode === "additive" ? ls : os), u.setIndexBuffer($, "uint16"), T[b] || (T[b] = z()), u.setVertexBuffer(0, T[b]), u.setBindGroup(0, R), P && (u.setVertexBuffer(1, f.instanceBuffer), u.setVertexBuffer(2, f.velocityBuffer), u.setVertexBuffer(3, f.trailBuffer), u.drawIndexed(6, f.activeParticles));
5983
+ const M = Pt.get(b);
5984
+ M && (u.setVertexBuffer(1, K), u.setVertexBuffer(2, q), u.setVertexBuffer(3, Ke), u.drawIndexed(6, M.count, 0, 0, M.first)), P && h.depthWriteEnabled && (u.setPipeline(cs), u.drawIndexed(6, f.activeParticles));
5658
5985
  }
5659
5986
  }
5660
- function Qi() {
5661
- ft = a.width, ht = a.height, Lt();
5987
+ function Mi(u, f, h) {
5988
+ const b = Ye.get(h.id);
5989
+ !b || b.count <= 0 || (u.setPipeline(h.blendMode === "additive" ? ys : ms), u.setBindGroup(0, Pi(f, h)), u.setVertexBuffer(0, Yt), u.draw(b.count, 1, b.first, 0));
5990
+ }
5991
+ function Ts() {
5992
+ Ht = a.width, Zt = a.height, vi();
5662
5993
  }
5663
- function Ki() {
5664
- d.clear();
5994
+ function Es() {
5995
+ p.clear();
5665
5996
  }
5666
- function es() {
5667
- Ot = !0, l.destroy(), [be, Se, xe, Je].forEach((f) => f == null ? void 0 : f.destroy()), h.resizeTextures(), [
5668
- b,
5997
+ function As() {
5998
+ xi = !0, l.destroy(), [nt, at, ot, It].forEach((u) => u == null ? void 0 : u.destroy()), g.resizeTextures(), [
5999
+ v,
6000
+ A,
6001
+ U,
6002
+ I,
5669
6003
  _,
5670
- M,
5671
- R,
5672
- x,
5673
- L,
5674
- k,
5675
- G,
5676
- de
5677
- ].forEach((f) => f == null ? void 0 : f.destroy()), Object.values(P).forEach((f) => f == null ? void 0 : f.destroy());
5678
- }
5679
- async function Nt(f, m) {
5680
- const S = await l.addSystems(f, m);
5681
- for (const { config: g } of l.particleSystems)
5682
- P[g.id] || (P[g.id] = T());
5683
- return l.respawnAllSystems(), new Set(Array.isArray(S) ? S : []);
5684
- }
5685
- function kt(f) {
5686
- for (const m of f) {
5687
- const S = l.particleSystems.findIndex((g) => g.config.id === m);
5688
- S >= 0 && l.removeSystem(S);
6004
+ $,
6005
+ K,
6006
+ q,
6007
+ Ke,
6008
+ Nt,
6009
+ Yt
6010
+ ].forEach((u) => u == null ? void 0 : u.destroy()), Object.values(T).forEach((u) => u == null ? void 0 : u.destroy());
6011
+ }
6012
+ async function wi(u, f) {
6013
+ const h = await l.addSystems(u, f);
6014
+ for (const { config: b } of l.particleSystems)
6015
+ T[b.id] || (T[b.id] = z());
6016
+ return l.respawnAllSystems(), new Set(Array.isArray(h) ? h : []);
6017
+ }
6018
+ function Bi(u) {
6019
+ for (const f of u) {
6020
+ const h = l.particleSystems.findIndex((b) => b.config.id === f);
6021
+ h >= 0 && l.removeSystem(h);
5689
6022
  }
5690
6023
  }
5691
- async function ts(f, m = [0, 0, 0]) {
5692
- const S = await Nt(f, m);
6024
+ async function Cs(u, f = [0, 0, 0]) {
6025
+ const h = await wi(u, f);
5693
6026
  return { remove() {
5694
- kt(S);
6027
+ Bi(h);
5695
6028
  } };
5696
6029
  }
5697
- async function is(f, m = {}) {
5698
- const S = await Nt(f, [0, 0, 0]);
5699
- globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...S]}]`);
5700
- const g = { ids: S, pos: null, hist: [], getPosition: m.getPosition || null, orientToDirection: !!m.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5701
- return W.push(g), {
5702
- setPosition(v) {
5703
- v && (g.pos = Array.isArray(v) ? [v[0], v[1], v[2]] : [v.x, v.y, v.z]);
6030
+ async function Us(u, f = {}) {
6031
+ const h = await wi(u, [0, 0, 0]);
6032
+ globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(u && u.systems || []).length} newIds=[${[...h]}]`);
6033
+ const b = { ids: h, pos: null, hist: [], getPosition: f.getPosition || null, orientToDirection: !!f.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
6034
+ return Se.push(b), {
6035
+ setPosition(y) {
6036
+ y && (b.pos = Array.isArray(y) ? [y[0], y[1], y[2]] : [y.x, y.y, y.z]);
5704
6037
  },
5705
- setOrientToDirection(v) {
5706
- g.orientToDirection = !!v;
6038
+ setOrientToDirection(y) {
6039
+ b.orientToDirection = !!y;
5707
6040
  },
5708
6041
  remove() {
5709
- kt(S);
5710
- const v = W.indexOf(g);
5711
- v >= 0 && W.splice(v, 1);
6042
+ Bi(h);
6043
+ const y = Se.indexOf(b);
6044
+ y >= 0 && Se.splice(y, 1);
5712
6045
  }
5713
6046
  };
5714
6047
  }
5715
- function ss(f, m) {
5716
- const g = { ids: f instanceof Set ? f : new Set(f), pos: null, hist: [], getPosition: m, historyOnly: !0, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
5717
- return W.push(g), {
6048
+ function Is(u, f) {
6049
+ const b = { ids: u instanceof Set ? u : new Set(u), pos: null, hist: [], getPosition: f, historyOnly: !0, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
6050
+ return Se.push(b), {
5718
6051
  remove() {
5719
- const v = W.indexOf(g);
5720
- v >= 0 && W.splice(v, 1);
6052
+ const y = Se.indexOf(b);
6053
+ y >= 0 && Se.splice(y, 1);
5721
6054
  },
5722
6055
  // Update which systems this history group covers WITHOUT losing the accumulated path
5723
6056
  // history. Needed when the scene's systems change (e.g. duplicate/add/remove) while the
5724
6057
  // group is active — otherwise a newly-added system's id isn't in the set and its trail
5725
6058
  // can't follow the recorded movement path (it falls back to straight extrapolation).
5726
- setIds(v) {
5727
- g.ids = v instanceof Set ? v : new Set(v);
6059
+ setIds(y) {
6060
+ b.ids = y instanceof Set ? y : new Set(y);
5728
6061
  }
5729
6062
  };
5730
6063
  }
@@ -5732,85 +6065,85 @@ async function vr(s, t = {}) {
5732
6065
  manager: l,
5733
6066
  device: r,
5734
6067
  context: n,
5735
- setCamera: Zi,
5736
- setCameraMVP: $i,
5737
- setEmitters: pt,
5738
- loadPreset: Wi,
5739
- addEmitter: ts,
5740
- addMovingEmitter: is,
5741
- render: Ji,
5742
- resize: Qi,
5743
- clearCaches: Ki,
5744
- trackHistoryGroup: ss,
5745
- destroy: es
6068
+ setCamera: Ms,
6069
+ setCameraMVP: ws,
6070
+ setEmitters: $t,
6071
+ loadPreset: Bs,
6072
+ addEmitter: Cs,
6073
+ addMovingEmitter: Us,
6074
+ render: Rs,
6075
+ resize: Ts,
6076
+ clearCaches: Es,
6077
+ trackHistoryGroup: Is,
6078
+ destroy: As
5746
6079
  };
5747
6080
  }
5748
- function Pr(s) {
6081
+ function Hr(s) {
5749
6082
  return () => {
5750
6083
  var t, e, i, r, n, a, o, c;
5751
6084
  try {
5752
6085
  const l = s.backend;
5753
6086
  if (!l) return null;
5754
- const u = s.domElement.width, p = s.domElement.height, h = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
5755
- if (s.needsFrameBufferTarget && h) {
5756
- const _ = l.get(h), M = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, h)) == null ? void 0 : i.depthTexture) || h.depthTexture, R = [
5757
- (r = _ == null ? void 0 : _.depthTexture) == null ? void 0 : r.texture,
5758
- _ == null ? void 0 : _.depthTexture,
5759
- (n = _ == null ? void 0 : _.depthBuffer) == null ? void 0 : n.texture,
5760
- M ? (a = l.get(M)) == null ? void 0 : a.texture : null
6087
+ const d = s.domElement.width, S = s.domElement.height, g = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
6088
+ if (s.needsFrameBufferTarget && g) {
6089
+ const A = l.get(g), U = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, g)) == null ? void 0 : i.depthTexture) || g.depthTexture, I = [
6090
+ (r = A == null ? void 0 : A.depthTexture) == null ? void 0 : r.texture,
6091
+ A == null ? void 0 : A.depthTexture,
6092
+ (n = A == null ? void 0 : A.depthBuffer) == null ? void 0 : n.texture,
6093
+ U ? (a = l.get(U)) == null ? void 0 : a.texture : null
5761
6094
  ];
5762
- for (const x of R)
5763
- if (x && typeof x.createView == "function" && x.width === u && x.height === p) return x;
6095
+ for (const _ of I)
6096
+ if (_ && typeof _.createView == "function" && _.width === d && _.height === S) return _;
5764
6097
  return null;
5765
6098
  }
5766
- const d = s.getCanvasTarget ? l.get(s.getCanvasTarget()) : null, b = ((c = (o = d == null ? void 0 : d.descriptor) == null ? void 0 : o.depthStencilAttachment) == null ? void 0 : c.view) ?? null;
5767
- return b ? { view: b, multisampled: (s.currentSamples ?? 0) > 1 } : null;
6099
+ const p = s.getCanvasTarget ? l.get(s.getCanvasTarget()) : null, v = ((c = (o = p == null ? void 0 : p.descriptor) == null ? void 0 : o.depthStencilAttachment) == null ? void 0 : c.view) ?? null;
6100
+ return v ? { view: v, multisampled: (s.currentSamples ?? 0) > 1 } : null;
5768
6101
  } catch {
5769
6102
  return null;
5770
6103
  }
5771
6104
  };
5772
6105
  }
5773
6106
  export {
5774
- ks as GLBAnimator,
5775
- js as HZClock,
5776
- hr as Objects3DManager,
5777
- ms as ParticleEmitter,
5778
- _s as ParticlePhysics,
5779
- ui as ParticleScript,
5780
- vt as ParticleSystem,
5781
- Ws as ParticleSystemManager,
5782
- ws as ParticleTextureManager,
5783
- gs as blurShader,
5784
- bs as compositeShader,
5785
- er as createBindGroupLayouts,
5786
- Pt as createBindGroups,
5787
- Ge as createBuffer,
5788
- sr as createCubeGeometry,
5789
- gi as createDepthTexture,
5790
- yr as createLookAtMatrix,
5791
- gr as createProjectionMatrix,
5792
- tr as createRenderPipelines,
5793
- yi as createRenderTextures,
5794
- ir as createSampler,
5795
- rr as createSphereGeometry,
5796
- Ss as directRenderShader,
5797
- fi as extractGLBTexture,
5798
- xr as fetchPreset,
5799
- Ks as glbMeshParticleShader,
5800
- pr as hexToRgb,
5801
- vr as initHzFxOverlay,
5802
- Js as initWebGPU,
5803
- Ti as isHZFX,
5804
- Sr as loadScene,
5805
- Pr as makeThreeSceneDepth,
5806
- ar as multiplyMatrices,
5807
- Qs as object3dShader,
5808
- lr as packHZFX,
5809
- As as parseGLB,
5810
- vs as particlePhysicsShader,
5811
- ys as particleShader,
5812
- mr as rgbToHex,
5813
- br as saveScene,
5814
- ur as serializeSystemConfig,
5815
- Ei as unpackHZFX
6107
+ mr as GLBAnimator,
6108
+ yr as HZClock,
6109
+ Vr as Objects3DManager,
6110
+ ks as ParticleEmitter,
6111
+ $s as ParticlePhysics,
6112
+ Ii as ParticleScript,
6113
+ Qt as ParticleSystem,
6114
+ Pr as ParticleSystemManager,
6115
+ Ws as ParticleTextureManager,
6116
+ Ns as blurShader,
6117
+ Ys as compositeShader,
6118
+ Br as createBindGroupLayouts,
6119
+ ei as createBindGroups,
6120
+ vt as createBuffer,
6121
+ Er as createCubeGeometry,
6122
+ Li as createDepthTexture,
6123
+ kr as createLookAtMatrix,
6124
+ Xr as createProjectionMatrix,
6125
+ Rr as createRenderPipelines,
6126
+ Oi as createRenderTextures,
6127
+ Tr as createSampler,
6128
+ Ar as createSphereGeometry,
6129
+ js as directRenderShader,
6130
+ Fi as extractGLBTexture,
6131
+ jr as fetchPreset,
6132
+ wr as glbMeshParticleShader,
6133
+ Or as hexToRgb,
6134
+ qr as initHzFxOverlay,
6135
+ _r as initWebGPU,
6136
+ Ji as isHZFX,
6137
+ Yr as loadScene,
6138
+ Hr as makeThreeSceneDepth,
6139
+ Ur as multiplyMatrices,
6140
+ Mr as object3dShader,
6141
+ zr as packHZFX,
6142
+ ir as parseGLB,
6143
+ Hs as particlePhysicsShader,
6144
+ Xs as particleShader,
6145
+ Lr as rgbToHex,
6146
+ Nr as saveScene,
6147
+ Gr as serializeSystemConfig,
6148
+ Ki as unpackHZFX
5816
6149
  };