hz-particles 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/hz-particles-r3f.cjs +2 -2
- package/dist-lib/hz-particles-r3f.mjs +141 -140
- package/dist-lib/hz-particles.cjs +14 -14
- package/dist-lib/hz-particles.mjs +716 -714
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class ms {
|
|
2
2
|
constructor(t = {}) {
|
|
3
3
|
this.config = t, this._posOut = [0, 0, 0], this._rotMatrix = null, this._invRotMatrix = null, this._cachedRotX = void 0, this._cachedRotY = void 0, this._cachedRotZ = void 0;
|
|
4
4
|
}
|
|
@@ -10,14 +10,14 @@ class fs {
|
|
|
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),
|
|
13
|
+
const r = t * Math.PI / 180, n = e * Math.PI / 180, a = i * Math.PI / 180, o = Math.cos(r), c = Math.sin(r), l = Math.cos(n), u = Math.sin(n), m = Math.cos(a), p = Math.sin(a);
|
|
14
14
|
this._rotMatrix = [
|
|
15
|
-
l *
|
|
16
|
-
c * u *
|
|
17
|
-
o * u *
|
|
15
|
+
l * m,
|
|
16
|
+
c * u * m - o * p,
|
|
17
|
+
o * u * m + c * p,
|
|
18
18
|
l * p,
|
|
19
|
-
c * u * p + o *
|
|
20
|
-
o * u * p - c *
|
|
19
|
+
c * u * p + o * m,
|
|
20
|
+
o * u * p - c * m,
|
|
21
21
|
-u,
|
|
22
22
|
c * l,
|
|
23
23
|
o * l
|
|
@@ -91,8 +91,8 @@ class fs {
|
|
|
91
91
|
o = n, c = -0.5, l = a;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
const u = Math.random(),
|
|
95
|
-
t[0] = o *
|
|
94
|
+
const u = Math.random(), m = e + u * (i - e);
|
|
95
|
+
t[0] = o * m, t[1] = c * m, t[2] = l * m;
|
|
96
96
|
} else
|
|
97
97
|
t[0] = (Math.random() - 0.5) * i, t[1] = (Math.random() - 0.5) * i, t[2] = (Math.random() - 0.5) * i;
|
|
98
98
|
}
|
|
@@ -244,33 +244,33 @@ class fs {
|
|
|
244
244
|
e > 0 ? a = e + (i - e) * Math.random() : a = i * Math.sqrt(Math.random()), t[0] = Math.cos(n) * a, t[1] = (Math.random() - 0.5) * r, t[2] = Math.sin(n) * a;
|
|
245
245
|
}
|
|
246
246
|
calculateVelocity(t, e, i, r, n) {
|
|
247
|
-
const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o,
|
|
248
|
-
let d,
|
|
247
|
+
const a = this.config.emissionPositionX || 0, o = this.config.emissionPositionY || 0, c = this.config.emissionPositionZ || 0, l = t - a, u = e - o, m = i - c, p = Math.sqrt(l * l + u * u + m * m);
|
|
248
|
+
let d, b, w;
|
|
249
249
|
if (p > 1e-4) {
|
|
250
|
-
let
|
|
250
|
+
let R = !1;
|
|
251
251
|
if (this.config.emissionShape === "circle" && this.config.circleVelocityDirection === "tangential") {
|
|
252
|
-
const x = this.inverseRotation(l, u,
|
|
252
|
+
const x = this.inverseRotation(l, u, m), L = Math.sqrt(x[0] * x[0] + x[1] * x[1]);
|
|
253
253
|
if (L > 1e-4) {
|
|
254
|
-
const P = -x[1] / L,
|
|
255
|
-
d =
|
|
254
|
+
const P = -x[1] / L, T = x[0] / L, E = this.applyRotation(P, T, 0);
|
|
255
|
+
d = E[0], b = E[1], w = E[2], R = !0;
|
|
256
256
|
}
|
|
257
257
|
} else if (this.config.emissionShape === "cylinder" && this.config.cylinderVelocityDirection === "tangential") {
|
|
258
|
-
const x = this.inverseRotation(l, u,
|
|
258
|
+
const x = this.inverseRotation(l, u, m), L = Math.sqrt(x[0] * x[0] + x[2] * x[2]);
|
|
259
259
|
if (L > 1e-4) {
|
|
260
|
-
const P = -x[2] / L,
|
|
261
|
-
d =
|
|
260
|
+
const P = -x[2] / L, T = x[0] / L, E = this.applyRotation(P, 0, T);
|
|
261
|
+
d = E[0], b = E[1], w = E[2], R = !0;
|
|
262
262
|
} else {
|
|
263
|
-
const P = Math.random() * Math.PI * 2,
|
|
264
|
-
d =
|
|
263
|
+
const P = Math.random() * Math.PI * 2, T = this.applyRotation(Math.cos(P), 0, Math.sin(P));
|
|
264
|
+
d = T[0], b = T[1], w = T[2], R = !0;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
R || (d = l / p, b = u / p, w = m / p);
|
|
268
268
|
} else {
|
|
269
|
-
const
|
|
270
|
-
d = Math.sin(x) * Math.cos(
|
|
269
|
+
const R = Math.random() * Math.PI * 2, x = Math.acos(2 * Math.random() - 1);
|
|
270
|
+
d = Math.sin(x) * Math.cos(R), b = Math.sin(x) * Math.sin(R), w = Math.cos(x);
|
|
271
271
|
}
|
|
272
|
-
let
|
|
273
|
-
this.config.randomSpeed ?
|
|
272
|
+
let M;
|
|
273
|
+
this.config.randomSpeed ? M = (this.config.minSpeed || 0) + Math.random() * ((this.config.maxSpeed || 1) - (this.config.minSpeed || 0)) : M = this.config.particleSpeed, r[n] = this.config.overrideXVelocity ? this.config.xVelocity : d * M, r[n + 1] = this.config.overrideYVelocity ? this.config.yVelocity : b * M, r[n + 2] = this.config.overrideZVelocity ? this.config.zVelocity : w * M, r[n + 3] = 0;
|
|
274
274
|
}
|
|
275
275
|
setParticleColor(t, e) {
|
|
276
276
|
if (this.config.randomColorEnabled && this.config.randomColors.length > 0) {
|
|
@@ -283,7 +283,7 @@ class fs {
|
|
|
283
283
|
t[e + 6] = 0, t[e + 7] = i + (Math.random() * 0.4 - 0.2) * i;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
const
|
|
286
|
+
const ys = `
|
|
287
287
|
struct Uniforms {
|
|
288
288
|
transform: mat4x4<f32>,
|
|
289
289
|
cameraPosition: vec3<f32>,
|
|
@@ -705,7 +705,7 @@ const ps = `
|
|
|
705
705
|
return vec4<f32>(input.color, alpha);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
`,
|
|
708
|
+
`, gs = `
|
|
709
709
|
struct BloomUniforms {
|
|
710
710
|
direction: vec2<f32>,
|
|
711
711
|
resolution: vec2<f32>,
|
|
@@ -765,7 +765,7 @@ const ps = `
|
|
|
765
765
|
|
|
766
766
|
return result / totalWeight * 1.1;
|
|
767
767
|
}
|
|
768
|
-
`,
|
|
768
|
+
`, bs = `
|
|
769
769
|
struct BloomIntensityUniforms {
|
|
770
770
|
intensity: f32,
|
|
771
771
|
color: vec3<f32>,
|
|
@@ -811,7 +811,7 @@ const ps = `
|
|
|
811
811
|
|
|
812
812
|
return vec4<f32>(originalColor.rgb + (mappedBloom * bloomUniforms.intensity), originalColor.a);
|
|
813
813
|
}
|
|
814
|
-
`,
|
|
814
|
+
`, Ss = `
|
|
815
815
|
struct BloomIntensityUniforms {
|
|
816
816
|
intensity: f32,
|
|
817
817
|
color: vec3<f32>,
|
|
@@ -852,7 +852,7 @@ const ps = `
|
|
|
852
852
|
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
|
|
853
853
|
return textureSample(originalTexture, texSampler, input.texCoord);
|
|
854
854
|
}
|
|
855
|
-
`,
|
|
855
|
+
`, xs = `
|
|
856
856
|
@binding(0) @group(0) var texSampler: sampler;
|
|
857
857
|
@binding(1) @group(0) var originalTexture: texture_2d<f32>;
|
|
858
858
|
@binding(2) @group(0) var blurredTexture: texture_2d<f32>;
|
|
@@ -884,7 +884,7 @@ const ps = `
|
|
|
884
884
|
let c = textureSample(originalTexture, texSampler, input.texCoord);
|
|
885
885
|
return vec4<f32>(aces(c.rgb), c.a);
|
|
886
886
|
}
|
|
887
|
-
`,
|
|
887
|
+
`, vs = `
|
|
888
888
|
struct PhysicsUniforms {
|
|
889
889
|
deltaTime: f32,
|
|
890
890
|
particleSpeed: f32,
|
|
@@ -1094,7 +1094,7 @@ const ps = `
|
|
|
1094
1094
|
particleBuffer[baseIndex + 1u] = newPos.y;
|
|
1095
1095
|
particleBuffer[baseIndex + 2u] = newPos.z;
|
|
1096
1096
|
}
|
|
1097
|
-
`,
|
|
1097
|
+
`, Ps = `
|
|
1098
1098
|
@group(0) @binding(0) var<storage, read> restData: array<f32>;
|
|
1099
1099
|
@group(0) @binding(1) var<storage, read> jointWeightsData: array<f32>;
|
|
1100
1100
|
@group(0) @binding(2) var<storage, read> jointIndicesData: array<u32>;
|
|
@@ -1151,7 +1151,7 @@ const ps = `
|
|
|
1151
1151
|
outputData[outBase + 7u] = uv_v;
|
|
1152
1152
|
}
|
|
1153
1153
|
`;
|
|
1154
|
-
class
|
|
1154
|
+
class _s {
|
|
1155
1155
|
constructor(t, e = 1e4) {
|
|
1156
1156
|
this.device = t, this.physicsSettings = {
|
|
1157
1157
|
deltaTime: 0.016,
|
|
@@ -1240,7 +1240,7 @@ class xs {
|
|
|
1240
1240
|
}),
|
|
1241
1241
|
compute: {
|
|
1242
1242
|
module: this.device.createShaderModule({
|
|
1243
|
-
code:
|
|
1243
|
+
code: vs
|
|
1244
1244
|
}),
|
|
1245
1245
|
entryPoint: "main"
|
|
1246
1246
|
}
|
|
@@ -1273,8 +1273,8 @@ class xs {
|
|
|
1273
1273
|
o[0] = t, o[1] = i.particleSpeed, o[2] = c.gravity, o[3] = c.turbulence, o[4] = c.attractorStrength, o[5] = c.damping, o[6] = c.attractorPosition[0], o[7] = c.attractorPosition[1], o[8] = c.attractorPosition[2], this._physicsDataU32View[9] = e, o[10] = c.confinementEnabled ? 1 : 0, o[11] = c.confinementShape === "sphere" ? 1 : 0, o[12] = c.confinementMode === "kill" ? 1 : 0, o[13] = c.confinementSpace === "local" ? 1 : 0, o[14] = c.confinementBoxHalfSize[0], o[15] = c.confinementBoxHalfSize[1], o[16] = c.confinementBoxHalfSize[2], o[17] = c.confinementSphereRadius, o[18] = c.confinementRestitution, o[19] = c.confinementFriction, o[20] = c.confinementCenter[0], o[21] = c.confinementCenter[1], o[22] = c.confinementCenter[2], o[23] = c.softBoundaryEnabled ? 1 : 0, o[24] = c.softBoundaryStrength, o[25] = c.softBoundaryFalloff, o[26] = i.velocityStretchEnabled ? 1 : 0, o[27] = i.velocityStretchFactor ?? 1, o[28] = 0, o[29] = 0, o[30] = 0, o[31] = 0, this.device.queue.writeBuffer(this.physicsUniformBuffer, 0, o);
|
|
1274
1274
|
const l = a || this.device.createCommandEncoder({ label: "ParticlePhysicsEncoder" }), u = l.beginComputePass({ label: "ParticlePhysicsPass" });
|
|
1275
1275
|
u.setPipeline(this.computePipeline), u.setBindGroup(0, this.computeBindGroup);
|
|
1276
|
-
const
|
|
1277
|
-
u.dispatchWorkgroups(
|
|
1276
|
+
const m = Math.max(1, Math.ceil(e / 64));
|
|
1277
|
+
u.dispatchWorkgroups(m, 1, 1), u.end(), a || this.device.queue.submit([l.finish()]), this.lastUpdateTime = performance.now() / 1e3;
|
|
1278
1278
|
}
|
|
1279
1279
|
async readbackAndProcessParticles(t, e, i, r, n) {
|
|
1280
1280
|
if (t <= 0)
|
|
@@ -1446,7 +1446,7 @@ class xs {
|
|
|
1446
1446
|
t.enabled !== void 0 && (e.softBoundaryEnabled = t.enabled), t.strength !== void 0 && (e.softBoundaryStrength = t.strength), t.falloff !== void 0 && (e.softBoundaryFalloff = t.falloff);
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
1449
|
-
class
|
|
1449
|
+
class ws {
|
|
1450
1450
|
constructor(t) {
|
|
1451
1451
|
this.device = t, this.defaultTexture = null, this.createDefaultTexture();
|
|
1452
1452
|
}
|
|
@@ -1485,7 +1485,7 @@ class vs {
|
|
|
1485
1485
|
t && t.label !== "defaultParticleTexture" && t.destroy();
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
|
-
const
|
|
1488
|
+
const Pi = Object.freeze({
|
|
1489
1489
|
sin: Math.sin,
|
|
1490
1490
|
cos: Math.cos,
|
|
1491
1491
|
abs: Math.abs,
|
|
@@ -1506,10 +1506,10 @@ const Si = Object.freeze({
|
|
|
1506
1506
|
return s + (t - s) * e;
|
|
1507
1507
|
},
|
|
1508
1508
|
smoothstep(s, t, e) {
|
|
1509
|
-
const i =
|
|
1509
|
+
const i = Pi.clamp((e - s) / (t - s), 0, 1);
|
|
1510
1510
|
return i * i * (3 - 2 * i);
|
|
1511
1511
|
}
|
|
1512
|
-
}),
|
|
1512
|
+
}), $e = /* @__PURE__ */ new Set([
|
|
1513
1513
|
"particleSize",
|
|
1514
1514
|
"particleSpeed",
|
|
1515
1515
|
"particleColor",
|
|
@@ -1525,7 +1525,7 @@ const Si = Object.freeze({
|
|
|
1525
1525
|
"pulseFrequency",
|
|
1526
1526
|
"bloomIntensity"
|
|
1527
1527
|
]);
|
|
1528
|
-
class
|
|
1528
|
+
class Bs {
|
|
1529
1529
|
constructor(t) {
|
|
1530
1530
|
this._collection = t, this._pd = null, this._vd = null, this._pi = 0, this._vi = 0;
|
|
1531
1531
|
}
|
|
@@ -1603,9 +1603,9 @@ class Ps {
|
|
|
1603
1603
|
this._vd[this._vi + 2] = t, this._collection._dirty = !0;
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class Ms {
|
|
1607
1607
|
constructor() {
|
|
1608
|
-
this._proxy = new
|
|
1608
|
+
this._proxy = new Bs(this), this._pd = null, this._vd = null, this.count = 0, this._dirty = !1;
|
|
1609
1609
|
}
|
|
1610
1610
|
_bind(t, e, i) {
|
|
1611
1611
|
this._pd = t, this._vd = e, this.count = i, this._dirty = !1;
|
|
@@ -1614,14 +1614,14 @@ class _s {
|
|
|
1614
1614
|
return t < 0 || t >= this.count ? null : this._proxy._bind(this._pd, this._vd, t);
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
|
-
const
|
|
1618
|
-
function
|
|
1617
|
+
const Rs = 1e6;
|
|
1618
|
+
function Ts(s) {
|
|
1619
1619
|
let t = 0;
|
|
1620
1620
|
return s.replace(
|
|
1621
1621
|
/\b(for|while)\s*\([^)]*\)\s*\{/g,
|
|
1622
1622
|
(e) => {
|
|
1623
1623
|
const i = `__lc${t++}`;
|
|
1624
|
-
return `${e} if(++${i}>${
|
|
1624
|
+
return `${e} if(++${i}>${Rs})throw new Error("Loop limit exceeded");`;
|
|
1625
1625
|
}
|
|
1626
1626
|
).replace(
|
|
1627
1627
|
/\b(for|while)\s*\([^)]*\)\s*\{/g,
|
|
@@ -1638,10 +1638,10 @@ function Bs(s) {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
);
|
|
1640
1640
|
}
|
|
1641
|
-
const
|
|
1642
|
-
for (const s of
|
|
1643
|
-
|
|
1644
|
-
function
|
|
1641
|
+
const wt = /* @__PURE__ */ new Map();
|
|
1642
|
+
for (const s of $e)
|
|
1643
|
+
wt.set(s.toLowerCase(), s);
|
|
1644
|
+
function Es(s) {
|
|
1645
1645
|
const t = { value: !1 }, e = /* @__PURE__ */ new Set();
|
|
1646
1646
|
return new Proxy(s, {
|
|
1647
1647
|
get(r, n) {
|
|
@@ -1650,16 +1650,16 @@ function Ms(s) {
|
|
|
1650
1650
|
t.value = !1;
|
|
1651
1651
|
};
|
|
1652
1652
|
if (typeof n != "string") return;
|
|
1653
|
-
if (
|
|
1654
|
-
const a =
|
|
1653
|
+
if ($e.has(n)) return r[n];
|
|
1654
|
+
const a = wt.get(n.toLowerCase());
|
|
1655
1655
|
if (a)
|
|
1656
1656
|
return e.has(n) || (e.add(n), console.warn(`[ParticleScript] config.${n} → did you mean config.${a}?`)), r[a];
|
|
1657
1657
|
},
|
|
1658
1658
|
set(r, n, a) {
|
|
1659
1659
|
if (typeof n != "string") return !0;
|
|
1660
1660
|
let o = n;
|
|
1661
|
-
if (
|
|
1662
|
-
const c =
|
|
1661
|
+
if (!$e.has(o)) {
|
|
1662
|
+
const c = wt.get(o.toLowerCase());
|
|
1663
1663
|
if (c)
|
|
1664
1664
|
e.has(n) || (e.add(n), console.warn(`[ParticleScript] config.${n} → did you mean config.${c}?`)), o = c;
|
|
1665
1665
|
else
|
|
@@ -1669,14 +1669,14 @@ function Ms(s) {
|
|
|
1669
1669
|
}
|
|
1670
1670
|
});
|
|
1671
1671
|
}
|
|
1672
|
-
class
|
|
1672
|
+
class ui {
|
|
1673
1673
|
/**
|
|
1674
1674
|
* @param {string} source - User script source code
|
|
1675
1675
|
* @param {object} config - ParticleSystem config (will be proxied)
|
|
1676
1676
|
* @param {number} maxParticles - Max particle count for pre-allocation
|
|
1677
1677
|
*/
|
|
1678
1678
|
constructor(t, e, i) {
|
|
1679
|
-
this._particles = new
|
|
1679
|
+
this._particles = new Ms(), this._configProxy = Es(e), this._configSnapshot = null, this._fn = null, this._error = !1, this.compile(t);
|
|
1680
1680
|
}
|
|
1681
1681
|
/**
|
|
1682
1682
|
* Compile script source into a sandboxed function.
|
|
@@ -1692,7 +1692,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
|
|
|
1692
1692
|
var deltaTime = __deltaTime, time = __time;
|
|
1693
1693
|
var currentFrame = __currentFrame, totalFrames = __totalFrames;
|
|
1694
1694
|
var particles = __particles, config = __config, math = __math;
|
|
1695
|
-
${
|
|
1695
|
+
${Ts(t)}
|
|
1696
1696
|
};`, r = new Function(i);
|
|
1697
1697
|
this._fn = r();
|
|
1698
1698
|
} catch (e) {
|
|
@@ -1714,7 +1714,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
|
|
|
1714
1714
|
if (!this._fn || this._error) return { configDirty: !1, particlesDirty: !1 };
|
|
1715
1715
|
this._particles._bind(n, a, o), this._configProxy.__resetDirty();
|
|
1716
1716
|
try {
|
|
1717
|
-
this._fn(t, e, i, r, this._particles, this._configProxy,
|
|
1717
|
+
this._fn(t, e, i, r, this._particles, this._configProxy, Pi);
|
|
1718
1718
|
} catch (c) {
|
|
1719
1719
|
console.warn("[ParticleScript] Runtime error:", c.message);
|
|
1720
1720
|
}
|
|
@@ -1728,7 +1728,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
|
|
|
1728
1728
|
*/
|
|
1729
1729
|
snapshotConfig(t) {
|
|
1730
1730
|
const e = {};
|
|
1731
|
-
for (const i of
|
|
1731
|
+
for (const i of $e) {
|
|
1732
1732
|
const r = t[i];
|
|
1733
1733
|
r !== void 0 && (e[i] = Array.isArray(r) ? [...r] : r);
|
|
1734
1734
|
}
|
|
@@ -1739,7 +1739,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
|
|
|
1739
1739
|
*/
|
|
1740
1740
|
restoreConfig(t) {
|
|
1741
1741
|
if (this._configSnapshot) {
|
|
1742
|
-
for (const e of
|
|
1742
|
+
for (const e of $e)
|
|
1743
1743
|
if (e in this._configSnapshot) {
|
|
1744
1744
|
const i = this._configSnapshot[e];
|
|
1745
1745
|
t[e] = Array.isArray(i) ? [...i] : i;
|
|
@@ -1753,7 +1753,7 @@ return function(__deltaTime, __time, __currentFrame, __totalFrames, __particles,
|
|
|
1753
1753
|
this._fn = null, this._particles = null, this._configProxy = null, this._configSnapshot = null;
|
|
1754
1754
|
}
|
|
1755
1755
|
}
|
|
1756
|
-
async function
|
|
1756
|
+
async function Cs(s) {
|
|
1757
1757
|
const t = new DataView(s);
|
|
1758
1758
|
if (t.getUint32(0, !0) !== 1179937895)
|
|
1759
1759
|
throw new Error("Invalid GLB file: incorrect magic number");
|
|
@@ -1763,11 +1763,11 @@ async function Rs(s) {
|
|
|
1763
1763
|
const r = t.getUint32(8, !0);
|
|
1764
1764
|
let n = 12, a = null, o = null;
|
|
1765
1765
|
for (; n < r; ) {
|
|
1766
|
-
const P = t.getUint32(n, !0),
|
|
1767
|
-
if (
|
|
1768
|
-
const
|
|
1769
|
-
a = JSON.parse(
|
|
1770
|
-
} else
|
|
1766
|
+
const P = t.getUint32(n, !0), T = t.getUint32(n + 4, !0), E = s.slice(n + 8, n + 8 + P);
|
|
1767
|
+
if (T === 1313821514) {
|
|
1768
|
+
const k = new TextDecoder("utf-8").decode(E);
|
|
1769
|
+
a = JSON.parse(k);
|
|
1770
|
+
} else T === 5130562 && (o = E);
|
|
1771
1771
|
n += 8 + P;
|
|
1772
1772
|
}
|
|
1773
1773
|
if (!a)
|
|
@@ -1780,23 +1780,23 @@ async function Rs(s) {
|
|
|
1780
1780
|
const u = l.attributes.POSITION;
|
|
1781
1781
|
if (u === void 0)
|
|
1782
1782
|
throw new Error("Mesh primitive missing POSITION attribute");
|
|
1783
|
-
const
|
|
1783
|
+
const m = xt(a, o, u, 3, 5126);
|
|
1784
1784
|
let p;
|
|
1785
1785
|
if (l.attributes.NORMAL !== void 0)
|
|
1786
|
-
p =
|
|
1786
|
+
p = xt(a, o, l.attributes.NORMAL, 3, 5126);
|
|
1787
1787
|
else {
|
|
1788
1788
|
const P = l.indices;
|
|
1789
1789
|
if (P === void 0)
|
|
1790
1790
|
throw new Error("Cannot generate normals without indices");
|
|
1791
|
-
const
|
|
1792
|
-
p =
|
|
1791
|
+
const T = di(a, o, P);
|
|
1792
|
+
p = As(m, T);
|
|
1793
1793
|
}
|
|
1794
1794
|
const d = l.indices;
|
|
1795
1795
|
if (d === void 0)
|
|
1796
1796
|
throw new Error("Mesh primitive missing indices");
|
|
1797
|
-
const
|
|
1798
|
-
let
|
|
1799
|
-
l.attributes.TEXCOORD_0 !== void 0 && (
|
|
1797
|
+
const b = di(a, o, d), w = m.length / 3, M = b.length;
|
|
1798
|
+
let R = null;
|
|
1799
|
+
l.attributes.TEXCOORD_0 !== void 0 && (R = xt(a, o, l.attributes.TEXCOORD_0, 2, 5126));
|
|
1800
1800
|
let x = !1;
|
|
1801
1801
|
if (a.materials && a.materials.length > 0) {
|
|
1802
1802
|
const P = a.materials[0];
|
|
@@ -1805,22 +1805,22 @@ async function Rs(s) {
|
|
|
1805
1805
|
let L = null;
|
|
1806
1806
|
if (a.skins && a.skins.length > 0)
|
|
1807
1807
|
try {
|
|
1808
|
-
L =
|
|
1808
|
+
L = Fs(a, o, l), globalThis.__HZFX_DEBUG && console.log("Animation data extracted:", L);
|
|
1809
1809
|
} catch (P) {
|
|
1810
1810
|
console.warn("Failed to extract animation data:", P);
|
|
1811
1811
|
}
|
|
1812
1812
|
return {
|
|
1813
|
-
positions:
|
|
1813
|
+
positions: m,
|
|
1814
1814
|
normals: p,
|
|
1815
|
-
indices:
|
|
1816
|
-
texCoords:
|
|
1817
|
-
vertexCount:
|
|
1818
|
-
indexCount:
|
|
1815
|
+
indices: b,
|
|
1816
|
+
texCoords: R,
|
|
1817
|
+
vertexCount: w,
|
|
1818
|
+
indexCount: M,
|
|
1819
1819
|
animationData: L,
|
|
1820
1820
|
hasBaseColorTexture: x
|
|
1821
1821
|
};
|
|
1822
1822
|
}
|
|
1823
|
-
function
|
|
1823
|
+
function xt(s, t, e, i, r) {
|
|
1824
1824
|
const n = s.accessors[e], o = {
|
|
1825
1825
|
SCALAR: 1,
|
|
1826
1826
|
VEC2: 2,
|
|
@@ -1831,12 +1831,12 @@ function gt(s, t, e, i, r) {
|
|
|
1831
1831
|
throw new Error(`Attribute accessor type mismatch: expected ${i} components, got ${o}`);
|
|
1832
1832
|
if (n.componentType !== r)
|
|
1833
1833
|
throw new Error(`Attribute component type mismatch: expected ${r}, got ${n.componentType}`);
|
|
1834
|
-
const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count,
|
|
1834
|
+
const l = (s.bufferViews[n.bufferView].byteOffset || 0) + (n.byteOffset || 0), u = n.count, m = new DataView(t, l, u * i * 4), p = new Float32Array(u * i);
|
|
1835
1835
|
for (let d = 0; d < u * i; d++)
|
|
1836
|
-
p[d] =
|
|
1836
|
+
p[d] = m.getFloat32(d * 4, !0);
|
|
1837
1837
|
return p;
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1839
|
+
function di(s, t, e) {
|
|
1840
1840
|
const i = s.accessors[e];
|
|
1841
1841
|
if (i.type !== "SCALAR")
|
|
1842
1842
|
throw new Error(`Indices accessor must be SCALAR, got ${i.type}`);
|
|
@@ -1854,19 +1854,19 @@ function ai(s, t, e) {
|
|
|
1854
1854
|
} else
|
|
1855
1855
|
throw new Error(`Unsupported index component type: ${i.componentType}`);
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function As(s, t) {
|
|
1858
1858
|
const e = new Float32Array(s.length);
|
|
1859
1859
|
for (let i = 0; i < t.length; i += 3) {
|
|
1860
|
-
const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], u = [c[0] - o[0], c[1] - o[1], c[2] - o[2]],
|
|
1861
|
-
u[1] *
|
|
1862
|
-
u[2] *
|
|
1863
|
-
u[0] *
|
|
1860
|
+
const r = t[i] * 3, n = t[i + 1] * 3, a = t[i + 2] * 3, o = [s[r], s[r + 1], s[r + 2]], c = [s[n], s[n + 1], s[n + 2]], l = [s[a], s[a + 1], s[a + 2]], u = [c[0] - o[0], c[1] - o[1], c[2] - o[2]], m = [l[0] - o[0], l[1] - o[1], l[2] - o[2]], p = [
|
|
1861
|
+
u[1] * m[2] - u[2] * m[1],
|
|
1862
|
+
u[2] * m[0] - u[0] * m[2],
|
|
1863
|
+
u[0] * m[1] - u[1] * m[0]
|
|
1864
1864
|
], d = Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
|
|
1865
1865
|
d > 0 && (p[0] /= d, p[1] /= d, p[2] /= d), e[r] = e[n] = e[a] = p[0], e[r + 1] = e[n + 1] = e[a + 1] = p[1], e[r + 2] = e[n + 2] = e[a + 2] = p[2];
|
|
1866
1866
|
}
|
|
1867
1867
|
return e;
|
|
1868
1868
|
}
|
|
1869
|
-
function
|
|
1869
|
+
function Us(s, t, e) {
|
|
1870
1870
|
const i = s.accessors[e];
|
|
1871
1871
|
if (i.type !== "VEC4")
|
|
1872
1872
|
throw new Error(`JOINTS_0 must be VEC4, got ${i.type}`);
|
|
@@ -1884,7 +1884,7 @@ function Es(s, t, e) {
|
|
|
1884
1884
|
} else
|
|
1885
1885
|
throw new Error(`Unsupported JOINTS_0 component type: ${i.componentType}`);
|
|
1886
1886
|
}
|
|
1887
|
-
function
|
|
1887
|
+
function Is(s, t, e) {
|
|
1888
1888
|
const i = s.accessors[e];
|
|
1889
1889
|
if (i.type !== "VEC4")
|
|
1890
1890
|
throw new Error(`WEIGHTS_0 must be VEC4, got ${i.type}`);
|
|
@@ -1902,7 +1902,7 @@ function Cs(s, t, e) {
|
|
|
1902
1902
|
} else
|
|
1903
1903
|
throw new Error(`Unsupported WEIGHTS_0 component type: ${i.componentType}`);
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1905
|
+
function zs(s, t, e) {
|
|
1906
1906
|
const i = s.accessors[e];
|
|
1907
1907
|
if (i.type !== "MAT4")
|
|
1908
1908
|
throw new Error(`Expected MAT4, got ${i.type}`);
|
|
@@ -1913,7 +1913,7 @@ function As(s, t, e) {
|
|
|
1913
1913
|
c[l] = o.getFloat32(l * 4, !0);
|
|
1914
1914
|
return c;
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function Gs(s, t, e) {
|
|
1917
1917
|
const i = s.accessors[e];
|
|
1918
1918
|
if (i.type !== "SCALAR")
|
|
1919
1919
|
throw new Error(`Expected SCALAR, got ${i.type}`);
|
|
@@ -1924,19 +1924,19 @@ function Us(s, t, e) {
|
|
|
1924
1924
|
c[l] = o.getFloat32(l * 4, !0);
|
|
1925
1925
|
return c;
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1927
|
+
function Ds(s, t, e) {
|
|
1928
1928
|
const i = s.accessors[e], n = { VEC3: 3, VEC4: 4 }[i.type];
|
|
1929
1929
|
if (!n)
|
|
1930
1930
|
throw new Error(`Expected VEC3 or VEC4, got ${i.type}`);
|
|
1931
1931
|
if (i.componentType !== 5126)
|
|
1932
1932
|
throw new Error(`Expected FLOAT component type, got ${i.componentType}`);
|
|
1933
1933
|
const o = (s.bufferViews[i.bufferView].byteOffset || 0) + (i.byteOffset || 0), c = i.count, l = new DataView(t, o, c * n * 4), u = new Float32Array(c * n);
|
|
1934
|
-
for (let
|
|
1935
|
-
u[
|
|
1934
|
+
for (let m = 0; m < c * n; m++)
|
|
1935
|
+
u[m] = l.getFloat32(m * 4, !0);
|
|
1936
1936
|
return u;
|
|
1937
1937
|
}
|
|
1938
|
-
function
|
|
1939
|
-
const i = s.skins[0], r = i.joints, n =
|
|
1938
|
+
function Fs(s, t, e) {
|
|
1939
|
+
const i = s.skins[0], r = i.joints, n = zs(s, t, i.inverseBindMatrices), a = e.attributes.JOINTS_0 !== void 0 ? Us(s, t, e.attributes.JOINTS_0) : null, o = e.attributes.WEIGHTS_0 !== void 0 ? Is(s, t, e.attributes.WEIGHTS_0) : null;
|
|
1940
1940
|
if (!a || !o)
|
|
1941
1941
|
throw new Error("Mesh missing JOINTS_0 or WEIGHTS_0 attributes");
|
|
1942
1942
|
const c = s.nodes.map((u) => ({
|
|
@@ -1948,22 +1948,22 @@ function zs(s, t, e) {
|
|
|
1948
1948
|
})), l = [];
|
|
1949
1949
|
if (s.animations && s.animations.length > 0)
|
|
1950
1950
|
for (const u of s.animations) {
|
|
1951
|
-
const
|
|
1951
|
+
const m = [];
|
|
1952
1952
|
let p = 0;
|
|
1953
1953
|
for (const d of u.channels) {
|
|
1954
|
-
const
|
|
1955
|
-
|
|
1954
|
+
const b = u.samplers[d.sampler], w = Gs(s, t, b.input), M = Ds(s, t, b.output), R = w[w.length - 1];
|
|
1955
|
+
R > p && (p = R), m.push({
|
|
1956
1956
|
targetNode: d.target.node,
|
|
1957
1957
|
targetPath: d.target.path,
|
|
1958
|
-
interpolation:
|
|
1959
|
-
timestamps:
|
|
1960
|
-
values:
|
|
1958
|
+
interpolation: b.interpolation || "LINEAR",
|
|
1959
|
+
timestamps: w,
|
|
1960
|
+
values: M
|
|
1961
1961
|
});
|
|
1962
1962
|
}
|
|
1963
1963
|
l.push({
|
|
1964
1964
|
name: u.name || `Animation ${l.length}`,
|
|
1965
1965
|
duration: p,
|
|
1966
|
-
channels:
|
|
1966
|
+
channels: m
|
|
1967
1967
|
});
|
|
1968
1968
|
}
|
|
1969
1969
|
return {
|
|
@@ -1975,7 +1975,7 @@ function zs(s, t, e) {
|
|
|
1975
1975
|
animations: l
|
|
1976
1976
|
};
|
|
1977
1977
|
}
|
|
1978
|
-
async function
|
|
1978
|
+
async function fi(s) {
|
|
1979
1979
|
const t = new DataView(s);
|
|
1980
1980
|
if (t.getUint32(0, !0) !== 1179937895)
|
|
1981
1981
|
throw new Error("Invalid GLB file: incorrect magic number");
|
|
@@ -1985,11 +1985,11 @@ async function oi(s) {
|
|
|
1985
1985
|
const r = t.getUint32(8, !0);
|
|
1986
1986
|
let n = 12, a = null, o = null;
|
|
1987
1987
|
for (; n < r; ) {
|
|
1988
|
-
const L = t.getUint32(n, !0), P = t.getUint32(n + 4, !0),
|
|
1988
|
+
const L = t.getUint32(n, !0), P = t.getUint32(n + 4, !0), T = s.slice(n + 8, n + 8 + L);
|
|
1989
1989
|
if (P === 1313821514) {
|
|
1990
|
-
const F = new TextDecoder("utf-8").decode(
|
|
1990
|
+
const F = new TextDecoder("utf-8").decode(T);
|
|
1991
1991
|
a = JSON.parse(F);
|
|
1992
|
-
} else P === 5130562 && (o =
|
|
1992
|
+
} else P === 5130562 && (o = T);
|
|
1993
1993
|
n += 8 + L;
|
|
1994
1994
|
}
|
|
1995
1995
|
if (!a)
|
|
@@ -2002,71 +2002,55 @@ async function oi(s) {
|
|
|
2002
2002
|
const l = c.pbrMetallicRoughness.baseColorTexture.index;
|
|
2003
2003
|
if (!a.textures || !a.textures[l])
|
|
2004
2004
|
return null;
|
|
2005
|
-
const
|
|
2006
|
-
if (
|
|
2005
|
+
const m = a.textures[l].source;
|
|
2006
|
+
if (m === void 0 || !a.images || !a.images[m])
|
|
2007
2007
|
return null;
|
|
2008
|
-
const p = a.images[
|
|
2008
|
+
const p = a.images[m], d = p.mimeType || "image/png";
|
|
2009
2009
|
if (p.bufferView === void 0)
|
|
2010
2010
|
return null;
|
|
2011
2011
|
if (!o)
|
|
2012
2012
|
throw new Error("GLB file missing BIN chunk (required for embedded textures)");
|
|
2013
|
-
const
|
|
2014
|
-
return { imageBlob: new Blob([
|
|
2015
|
-
}
|
|
2016
|
-
function li(s, t, e) {
|
|
2017
|
-
return [
|
|
2018
|
-
s[0] + (t[0] - s[0]) * e,
|
|
2019
|
-
s[1] + (t[1] - s[1]) * e,
|
|
2020
|
-
s[2] + (t[2] - s[2]) * e
|
|
2021
|
-
];
|
|
2013
|
+
const b = a.bufferViews[p.bufferView], w = b.byteOffset || 0, M = b.byteLength, R = o.slice(w, w + M);
|
|
2014
|
+
return { imageBlob: new Blob([R], { type: d }), mimeType: d };
|
|
2022
2015
|
}
|
|
2023
|
-
function
|
|
2024
|
-
|
|
2025
|
-
if (i < 0 && (i = -i, r = [-t[0], -t[1], -t[2], -t[3]]), i > 0.9995) {
|
|
2026
|
-
const l = [
|
|
2027
|
-
s[0] + (r[0] - s[0]) * e,
|
|
2028
|
-
s[1] + (r[1] - s[1]) * e,
|
|
2029
|
-
s[2] + (r[2] - s[2]) * e,
|
|
2030
|
-
s[3] + (r[3] - s[3]) * e
|
|
2031
|
-
];
|
|
2032
|
-
return Gs(l);
|
|
2033
|
-
}
|
|
2034
|
-
const n = Math.acos(i), a = Math.sin(n), o = Math.sin((1 - e) * n) / a, c = Math.sin(e * n) / a;
|
|
2035
|
-
return [
|
|
2036
|
-
s[0] * o + r[0] * c,
|
|
2037
|
-
s[1] * o + r[1] * c,
|
|
2038
|
-
s[2] * o + r[2] * c,
|
|
2039
|
-
s[3] * o + r[3] * c
|
|
2040
|
-
];
|
|
2016
|
+
function Vs(s, t, e, i) {
|
|
2017
|
+
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;
|
|
2041
2018
|
}
|
|
2042
|
-
function
|
|
2043
|
-
|
|
2044
|
-
|
|
2019
|
+
function Os(s, t, e, i) {
|
|
2020
|
+
i = i || [0, 0, 0, 0];
|
|
2021
|
+
let r = s[0] * t[0] + s[1] * t[1] + s[2] * t[2] + s[3] * t[3], n = 1;
|
|
2022
|
+
if (r < 0 && (r = -r, n = -1), r > 0.9995) {
|
|
2023
|
+
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;
|
|
2024
|
+
const u = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2] + i[3] * i[3]);
|
|
2025
|
+
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;
|
|
2026
|
+
}
|
|
2027
|
+
const a = Math.acos(r), o = Math.sin(a), c = Math.sin((1 - e) * a) / o, l = Math.sin(e * a) / o;
|
|
2028
|
+
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
2029
|
}
|
|
2046
|
-
function
|
|
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,
|
|
2048
|
-
return x[0] = 1 - (p +
|
|
2030
|
+
function Ls(s, t) {
|
|
2031
|
+
const e = s[0], i = s[1], r = s[2], n = s[3], a = e + e, o = i + i, c = r + r, l = e * a, u = e * o, m = e * c, p = i * o, d = i * c, b = r * c, w = n * a, M = n * o, R = n * c, x = t || new Float32Array(16);
|
|
2032
|
+
return x[0] = 1 - (p + b), x[1] = u + R, x[2] = m - M, x[3] = 0, x[4] = u - R, x[5] = 1 - (l + b), x[6] = d + w, x[7] = 0, x[8] = m + M, x[9] = d - w, x[10] = 1 - (l + p), x[11] = 0, x[12] = 0, x[13] = 0, x[14] = 0, x[15] = 1, x;
|
|
2049
2033
|
}
|
|
2050
|
-
const
|
|
2051
|
-
function
|
|
2052
|
-
const r =
|
|
2034
|
+
const Xs = new Float32Array(16);
|
|
2035
|
+
function ks(s, t, e, i) {
|
|
2036
|
+
const r = Ls(t, Xs), n = i || new Float32Array(16);
|
|
2053
2037
|
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
2038
|
}
|
|
2055
|
-
function
|
|
2039
|
+
function pi(s, t, e) {
|
|
2056
2040
|
const i = e || new Float32Array(16);
|
|
2057
2041
|
for (let r = 0; r < 4; r++)
|
|
2058
2042
|
for (let n = 0; n < 4; n++)
|
|
2059
2043
|
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
2044
|
return i;
|
|
2061
2045
|
}
|
|
2062
|
-
class
|
|
2046
|
+
class Ns {
|
|
2063
2047
|
constructor(t) {
|
|
2064
2048
|
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
2049
|
for (let e = 0; e < this.nodes.length; e++)
|
|
2066
2050
|
this.jointLocalTransforms[e] = new Float32Array(16), this.jointGlobalTransforms[e] = new Float32Array(16);
|
|
2067
2051
|
for (let e = 0; e < this.joints.length; e++)
|
|
2068
2052
|
this.jointFinalMatrices[e] = new Float32Array(16);
|
|
2069
|
-
this.skinnedPositions = null, this.skinnedNormals = null, this._gpuSkinningReady = !1, this._buildTopologicalOrder(), this._parentMap = new Array(this.nodes.length).fill(-1);
|
|
2053
|
+
this.skinnedPositions = null, this.skinnedNormals = null, this._gpuSkinningReady = !1, this._sV0 = new Float64Array(4), this._sV1 = new Float64Array(4), this._scrT = new Float64Array(3), this._scrR = new Float64Array(4), this._scrS = new Float64Array(3), this._buildTopologicalOrder(), this._parentMap = new Array(this.nodes.length).fill(-1);
|
|
2070
2054
|
for (let e = 0; e < this.nodes.length; e++)
|
|
2071
2055
|
for (const i of this.nodes[e].children) this._parentMap[i] = e;
|
|
2072
2056
|
this._invBindViews = new Array(this.joints.length);
|
|
@@ -2090,8 +2074,8 @@ class Os {
|
|
|
2090
2074
|
this._gpuDevice = t, this._gpuOutputBuffer = e;
|
|
2091
2075
|
const r = this.restPositions.length / 3, n = new Float32Array(r * 8);
|
|
2092
2076
|
for (let c = 0; c < r; c++) {
|
|
2093
|
-
const l = c * 8, u = c * 3,
|
|
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[
|
|
2077
|
+
const l = c * 8, u = c * 3, m = c * 2;
|
|
2078
|
+
n[l] = this.restPositions[u], n[l + 1] = this.restPositions[u + 1], n[l + 2] = this.restPositions[u + 2], n[l + 3] = this.restNormals[u], n[l + 4] = this.restNormals[u + 1], n[l + 5] = this.restNormals[u + 2], n[l + 6] = i ? i[m] : 0, n[l + 7] = i ? i[m + 1] : 0;
|
|
2095
2079
|
}
|
|
2096
2080
|
this._gpuRestDataBuffer = t.createBuffer({
|
|
2097
2081
|
size: n.byteLength,
|
|
@@ -2126,7 +2110,7 @@ class Os {
|
|
|
2126
2110
|
this._gpuSkinningPipeline = t.createComputePipeline({
|
|
2127
2111
|
layout: t.createPipelineLayout({ bindGroupLayouts: [o] }),
|
|
2128
2112
|
compute: {
|
|
2129
|
-
module: t.createShaderModule({ code:
|
|
2113
|
+
module: t.createShaderModule({ code: Ps }),
|
|
2130
2114
|
entryPoint: "main"
|
|
2131
2115
|
}
|
|
2132
2116
|
}), this._gpuSkinningBindGroup = t.createBindGroup({
|
|
@@ -2208,31 +2192,32 @@ class Os {
|
|
|
2208
2192
|
/**
|
|
2209
2193
|
* Sample a single channel at the given time.
|
|
2210
2194
|
*/
|
|
2211
|
-
_sampleChannel(t, e) {
|
|
2212
|
-
const { timestamps:
|
|
2213
|
-
if (e <=
|
|
2214
|
-
return this._extractValue(
|
|
2215
|
-
if (e >=
|
|
2216
|
-
return this._extractValue(
|
|
2217
|
-
let
|
|
2218
|
-
for (;
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2195
|
+
_sampleChannel(t, e, i) {
|
|
2196
|
+
const { timestamps: r, values: n, interpolation: a, targetPath: o } = t;
|
|
2197
|
+
if (e <= r[0])
|
|
2198
|
+
return this._extractValue(n, 0, o, i);
|
|
2199
|
+
if (e >= r[r.length - 1])
|
|
2200
|
+
return this._extractValue(n, r.length - 1, o, i);
|
|
2201
|
+
let c = 0, l = r.length - 1;
|
|
2202
|
+
for (; l - c > 1; ) {
|
|
2203
|
+
const w = Math.floor((c + l) / 2);
|
|
2204
|
+
r[w] <= e ? c = w : l = w;
|
|
2221
2205
|
}
|
|
2222
|
-
const
|
|
2223
|
-
return
|
|
2206
|
+
const u = r[c], m = r[l], p = (e - u) / (m - u), d = this._extractValue(n, c, o, this._sV0), b = this._extractValue(n, l, o, this._sV1);
|
|
2207
|
+
return a === "STEP" ? (i[0] = d[0], i[1] = d[1], i[2] = d[2], o === "rotation" && (i[3] = d[3]), i) : o === "rotation" ? Os(d, b, p, i) : Vs(d, b, p, i);
|
|
2224
2208
|
}
|
|
2225
2209
|
/**
|
|
2226
2210
|
* Extract value from values array at the given index.
|
|
2227
2211
|
*/
|
|
2228
|
-
_extractValue(t, e, i) {
|
|
2212
|
+
_extractValue(t, e, i, r) {
|
|
2229
2213
|
if (i === "rotation") {
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2214
|
+
const n = e * 4;
|
|
2215
|
+
r[0] = t[n], r[1] = t[n + 1], r[2] = t[n + 2], r[3] = t[n + 3];
|
|
2232
2216
|
} else {
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2217
|
+
const n = e * 3;
|
|
2218
|
+
r[0] = t[n], r[1] = t[n + 1], r[2] = t[n + 2];
|
|
2235
2219
|
}
|
|
2220
|
+
return r;
|
|
2236
2221
|
}
|
|
2237
2222
|
/**
|
|
2238
2223
|
* Compute local transforms for all nodes at the given time.
|
|
@@ -2243,11 +2228,8 @@ class Os {
|
|
|
2243
2228
|
const r = this.nodes[i];
|
|
2244
2229
|
let n = r.translation, a = r.rotation, o = r.scale;
|
|
2245
2230
|
for (const c of e.channels)
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
c.targetPath === "translation" ? n = l : c.targetPath === "rotation" ? a = l : c.targetPath === "scale" && (o = l);
|
|
2249
|
-
}
|
|
2250
|
-
Vs(n, a, o, this.jointLocalTransforms[i]);
|
|
2231
|
+
c.targetNode === i && (c.targetPath === "translation" ? n = this._sampleChannel(c, t, this._scrT) : c.targetPath === "rotation" ? a = this._sampleChannel(c, t, this._scrR) : c.targetPath === "scale" && (o = this._sampleChannel(c, t, this._scrS)));
|
|
2232
|
+
ks(n, a, o, this.jointLocalTransforms[i]);
|
|
2251
2233
|
}
|
|
2252
2234
|
}
|
|
2253
2235
|
/**
|
|
@@ -2257,7 +2239,7 @@ class Os {
|
|
|
2257
2239
|
const t = this._parentMap;
|
|
2258
2240
|
for (const e of this.topologicalOrder) {
|
|
2259
2241
|
const i = t[e];
|
|
2260
|
-
i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) :
|
|
2242
|
+
i === -1 ? this.jointGlobalTransforms[e].set(this.jointLocalTransforms[e]) : pi(
|
|
2261
2243
|
this.jointGlobalTransforms[i],
|
|
2262
2244
|
this.jointLocalTransforms[e],
|
|
2263
2245
|
this.jointGlobalTransforms[e]
|
|
@@ -2270,7 +2252,7 @@ class Os {
|
|
|
2270
2252
|
_computeFinalMatrices() {
|
|
2271
2253
|
for (let t = 0; t < this.joints.length; t++) {
|
|
2272
2254
|
const e = this.joints[t], i = this.jointGlobalTransforms[e];
|
|
2273
|
-
|
|
2255
|
+
pi(i, this._invBindViews[t], this.jointFinalMatrices[t]);
|
|
2274
2256
|
}
|
|
2275
2257
|
}
|
|
2276
2258
|
/**
|
|
@@ -2280,20 +2262,20 @@ class Os {
|
|
|
2280
2262
|
_applySkinning() {
|
|
2281
2263
|
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;
|
|
2282
2264
|
for (let l = 0; l < t; l++) {
|
|
2283
|
-
const u = l * 3,
|
|
2284
|
-
let x = 0, L = 0, P = 0,
|
|
2265
|
+
const u = l * 3, m = l * 4, p = e[u], d = e[u + 1], b = e[u + 2], w = i[u], M = i[u + 1], R = i[u + 2];
|
|
2266
|
+
let x = 0, L = 0, P = 0, T = 0, E = 0, F = 0;
|
|
2285
2267
|
for (let Y = 0; Y < 4; Y++) {
|
|
2286
|
-
const
|
|
2287
|
-
if (
|
|
2288
|
-
const G = c[o[
|
|
2289
|
-
x += (G[0] * p + G[4] * d + G[8] *
|
|
2268
|
+
const N = a[m + Y];
|
|
2269
|
+
if (N === 0) continue;
|
|
2270
|
+
const G = c[o[m + Y]];
|
|
2271
|
+
x += (G[0] * p + G[4] * d + G[8] * b + G[12]) * N, L += (G[1] * p + G[5] * d + G[9] * b + G[13]) * N, P += (G[2] * p + G[6] * d + G[10] * b + G[14]) * N, T += (G[0] * w + G[4] * M + G[8] * R) * N, E += (G[1] * w + G[5] * M + G[9] * R) * N, F += (G[2] * w + G[6] * M + G[10] * R) * N;
|
|
2290
2272
|
}
|
|
2291
|
-
const
|
|
2292
|
-
|
|
2273
|
+
const k = Math.sqrt(T * T + E * E + F * F);
|
|
2274
|
+
k > 1e-4 && (n[u] = T / k, n[u + 1] = E / k, n[u + 2] = F / k), r[u] = x, r[u + 1] = L, r[u + 2] = P;
|
|
2293
2275
|
}
|
|
2294
2276
|
}
|
|
2295
2277
|
}
|
|
2296
|
-
class
|
|
2278
|
+
class js {
|
|
2297
2279
|
constructor({ duration: t = 0, loop: e = !1, playbackRate: i = 1 } = {}) {
|
|
2298
2280
|
this.currentTime = 0, this.duration = t, this.loop = e, this.playbackRate = i, this.paused = !1, this._justLooped = !1;
|
|
2299
2281
|
}
|
|
@@ -2314,7 +2296,7 @@ class Ls {
|
|
|
2314
2296
|
this.currentTime = Math.max(0, t || 0), this._justLooped = !1;
|
|
2315
2297
|
}
|
|
2316
2298
|
}
|
|
2317
|
-
const
|
|
2299
|
+
const hi = {
|
|
2318
2300
|
linear: (s) => s,
|
|
2319
2301
|
easeInQuad: (s) => s * s,
|
|
2320
2302
|
easeOutQuad: (s) => 1 - (1 - s) * (1 - s),
|
|
@@ -2333,26 +2315,26 @@ const di = {
|
|
|
2333
2315
|
return Math.pow(2, -10 * s) * Math.sin((s * 10 - 0.75) * t) + 1;
|
|
2334
2316
|
}
|
|
2335
2317
|
};
|
|
2336
|
-
function
|
|
2337
|
-
const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, u = (d) => ((a * d + n) * d + r) * d,
|
|
2318
|
+
function Ys(s, t, e, i) {
|
|
2319
|
+
const r = 3 * s, n = 3 * (e - s) - r, a = 1 - r - n, o = 3 * t, c = 3 * (i - t) - o, l = 1 - o - c, u = (d) => ((a * d + n) * d + r) * d, m = (d) => ((l * d + c) * d + o) * d, p = (d) => (3 * a * d + 2 * n) * d + r;
|
|
2338
2320
|
return (d) => {
|
|
2339
2321
|
if (d <= 0) return 0;
|
|
2340
2322
|
if (d >= 1) return 1;
|
|
2341
|
-
let
|
|
2342
|
-
for (let
|
|
2343
|
-
const
|
|
2344
|
-
if (Math.abs(
|
|
2345
|
-
const
|
|
2346
|
-
if (Math.abs(
|
|
2347
|
-
|
|
2323
|
+
let b = d;
|
|
2324
|
+
for (let w = 0; w < 8; w++) {
|
|
2325
|
+
const M = u(b) - d;
|
|
2326
|
+
if (Math.abs(M) < 1e-5) break;
|
|
2327
|
+
const R = p(b);
|
|
2328
|
+
if (Math.abs(R) < 1e-6) break;
|
|
2329
|
+
b -= M / R;
|
|
2348
2330
|
}
|
|
2349
|
-
return
|
|
2331
|
+
return m(b);
|
|
2350
2332
|
};
|
|
2351
2333
|
}
|
|
2352
|
-
function
|
|
2353
|
-
return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ?
|
|
2334
|
+
function _i(s, t) {
|
|
2335
|
+
return typeof s == "function" ? s(t) : Array.isArray(s) && s.length === 4 ? Ys(s[0], s[1], s[2], s[3])(t) : (hi[s] || hi.linear)(t);
|
|
2354
2336
|
}
|
|
2355
|
-
function
|
|
2337
|
+
function Hs(s, t) {
|
|
2356
2338
|
if (!Array.isArray(s) || s.length === 0) return;
|
|
2357
2339
|
if (s.length === 1 || t <= s[0].t) return s[0].v;
|
|
2358
2340
|
const e = s[s.length - 1];
|
|
@@ -2361,34 +2343,41 @@ function Ns(s, t) {
|
|
|
2361
2343
|
const r = s[i], n = s[i + 1];
|
|
2362
2344
|
if (t >= r.t && t <= n.t) {
|
|
2363
2345
|
const a = n.t - r.t, o = a > 0 ? (t - r.t) / a : 0;
|
|
2364
|
-
return r.v + (n.v - r.v) *
|
|
2346
|
+
return r.v + (n.v - r.v) * _i(r.ease, o);
|
|
2365
2347
|
}
|
|
2366
2348
|
}
|
|
2367
2349
|
return e.v;
|
|
2368
2350
|
}
|
|
2369
|
-
function
|
|
2351
|
+
function qs(s, t, e) {
|
|
2370
2352
|
if (!Array.isArray(s) || s.length === 0) return;
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2353
|
+
const i = s.length, r = s[i - 1];
|
|
2354
|
+
let n, a, o;
|
|
2355
|
+
if (i === 1 || t <= s[0].t)
|
|
2356
|
+
n = a = s[0].v, o = 0;
|
|
2357
|
+
else if (t >= r.t)
|
|
2358
|
+
n = a = r.v, o = 0;
|
|
2359
|
+
else {
|
|
2360
|
+
n = a = r.v, o = 0;
|
|
2361
|
+
for (let m = 0; m < i - 1; m++) {
|
|
2362
|
+
const p = s[m], d = s[m + 1];
|
|
2363
|
+
if (t >= p.t && t <= d.t) {
|
|
2364
|
+
const b = d.t - p.t;
|
|
2365
|
+
n = p.v, a = d.v, o = _i(p.ease, b > 0 ? (t - p.t) / b : 0);
|
|
2366
|
+
break;
|
|
2367
|
+
}
|
|
2380
2368
|
}
|
|
2381
2369
|
}
|
|
2382
|
-
|
|
2370
|
+
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;
|
|
2371
|
+
return e ? (e[0] = c, e[1] = l, e[2] = u, e) : [c, l, u];
|
|
2383
2372
|
}
|
|
2384
|
-
const
|
|
2385
|
-
function
|
|
2373
|
+
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 };
|
|
2374
|
+
function mi(s) {
|
|
2386
2375
|
const t = atob(s), e = new Uint8Array(t.length);
|
|
2387
2376
|
for (let i = 0; i < t.length; i++)
|
|
2388
2377
|
e[i] = t.charCodeAt(i);
|
|
2389
2378
|
return e.buffer;
|
|
2390
2379
|
}
|
|
2391
|
-
class
|
|
2380
|
+
class vt {
|
|
2392
2381
|
constructor(t, e) {
|
|
2393
2382
|
this.device = t, this.config = e, this.MAX_PARTICLES = e.maxParticles || 1e4, this.particleCount = e.particleCount || 100, this.activeParticles = 0, this.emitting = !1, this.currentEmissionTime = 0, this.destroyed = !1, this.particleData = new Float32Array(this.MAX_PARTICLES * 8), this.particleVelocities = new Float32Array(this.MAX_PARTICLES * 4), this.instanceBuffer = t.createBuffer({
|
|
2394
2383
|
size: this.MAX_PARTICLES * 8 * 4,
|
|
@@ -2414,7 +2403,7 @@ class bt {
|
|
|
2414
2403
|
// intensity (f32) + padding
|
|
2415
2404
|
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
|
|
2416
2405
|
label: "systemBloomIntensityBuffer"
|
|
2417
|
-
}), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(56), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this._emitSimRotY = 0, this.emitter = new fs(e), this.physics = new xs(t, this.MAX_PARTICLES), this.textureManager = new vs(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition), e.confinementEnabled && this.setConfinement({
|
|
2406
|
+
}), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation !== void 0 && (e.rotation = (e.rotation || 0) + e.particleShapeRotation, delete e.particleShapeRotation), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.1), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.orientX === void 0 && (e.orientX = 0), e.orientY === void 0 && (e.orientY = 0), e.orientZ === void 0 && (e.orientZ = 0), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.05), e.maxSize === void 0 && (e.maxSize = 0.15), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.startAt === void 0 && (e.startAt = 0), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.emissionDurationInfinite === void 0 && (e.emissionDurationInfinite = !1), e.emissionDuration > 300 && (e.emissionDurationInfinite = !0, e.emissionDuration = 10), e.outerLength === void 0 && (e.outerLength = e.cubeLength ?? 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.emissionRotationX === void 0 && (e.emissionRotationX = 0), e.emissionRotationY === void 0 && (e.emissionRotationY = 0), e.emissionRotationZ === void 0 && (e.emissionRotationZ = 0), e.emissionPositionX === void 0 && (e.emissionPositionX = e.emissionTranslationX ?? 0), e.emissionPositionY === void 0 && (e.emissionPositionY = e.emissionTranslationY ?? 0), e.emissionPositionZ === void 0 && (e.emissionPositionZ = e.emissionTranslationZ ?? 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.blendMode === void 0 && (e.blendMode = "normal"), e.noiseDistortEnabled === void 0 && (e.noiseDistortEnabled = !1), e.noiseTilingX === void 0 && (e.noiseTilingX = 3), e.noiseTilingY === void 0 && (e.noiseTilingY = 3), e.noiseSpeed === void 0 && (e.noiseSpeed = -1.5), e.noiseAmplitude === void 0 && (e.noiseAmplitude = 0.08), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailMode === void 0 && (e.emissionTrailMode = "ribbon"), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(56), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this._emitSimRotY = 0, this.emitter = new ms(e), this.physics = new _s(t, this.MAX_PARTICLES), this.textureManager = new ws(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition), e.confinementEnabled && this.setConfinement({
|
|
2418
2407
|
enabled: !0,
|
|
2419
2408
|
shape: e.confinementShape,
|
|
2420
2409
|
mode: e.confinementMode,
|
|
@@ -2427,7 +2416,7 @@ class bt {
|
|
|
2427
2416
|
enabled: !0,
|
|
2428
2417
|
strength: e.softBoundaryStrength,
|
|
2429
2418
|
falloff: e.softBoundaryFalloff
|
|
2430
|
-
}), this.particleTexture = this.textureManager.getDefaultTexture(), this.updateBloomIntensity(), this.updateAppearanceUniform(), this.frameCount = 0, this.shouldReset = !1, this._scriptParticleData = new Float32Array(this.MAX_PARTICLES * 8), this._scriptVelocityData = new Float32Array(this.MAX_PARTICLES * 4), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, this._particleScript = null, e.script && (this._particleScript = new
|
|
2419
|
+
}), 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);
|
|
2431
2420
|
}
|
|
2432
2421
|
async initComputePipeline(t) {
|
|
2433
2422
|
this.computeReady = await this.physics.initComputePipeline(this.instanceBuffer, this.velocityBuffer, this.trailBuffer);
|
|
@@ -2437,7 +2426,7 @@ class bt {
|
|
|
2437
2426
|
* @param {string|null} source - Script source code, or null to disable
|
|
2438
2427
|
*/
|
|
2439
2428
|
setScript(t) {
|
|
2440
|
-
this._particleScript && (this._particleScript.destroy(), this._particleScript = null), this._scriptReadbackPending = !1, this._scriptReadbackReady = !1, this._scriptFrame = 0, this._scriptTime = 0, this._scriptConfigRestored = !1, t ? (this.config.script = t, this._particleScript = new
|
|
2429
|
+
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;
|
|
2441
2430
|
}
|
|
2442
2431
|
async setTexture(t) {
|
|
2443
2432
|
this.destroyed || (this.textureManager.destroyTexture(this.particleTexture), this.particleTexture = await this.textureManager.loadTexture(t), this.config.textureEnabled = !0, this.updateAppearanceUniform(), this.updateBuffers());
|
|
@@ -2448,7 +2437,7 @@ class bt {
|
|
|
2448
2437
|
async setGLBModel(t) {
|
|
2449
2438
|
try {
|
|
2450
2439
|
this.glbRawArrayBuffer = t;
|
|
2451
|
-
const e = await
|
|
2440
|
+
const e = await Cs(t);
|
|
2452
2441
|
this.glbMeshData = e, this.config.glbHasTexture = e.hasBaseColorTexture || !1;
|
|
2453
2442
|
const i = new Float32Array(e.vertexCount * 8);
|
|
2454
2443
|
for (let r = 0; r < e.vertexCount; r++) {
|
|
@@ -2464,7 +2453,7 @@ class bt {
|
|
|
2464
2453
|
usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
|
|
2465
2454
|
label: "glbIndexBuffer"
|
|
2466
2455
|
}), 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) {
|
|
2467
|
-
this.glbAnimator = new
|
|
2456
|
+
this.glbAnimator = new Ns(e.animationData), this.glbAnimator.setRestPose(e.positions, e.normals), this.glbAnimated = !0, this.config.glbAnimated = !0, this.glbAnimator.loop = this.config.animationLoop, this._glbInterleavedData = new Float32Array(e.vertexCount * 8);
|
|
2468
2457
|
try {
|
|
2469
2458
|
await this.glbAnimator.initGPUSkinning(this.device, this.glbVertexBuffer, e.texCoords);
|
|
2470
2459
|
} catch (r) {
|
|
@@ -2526,7 +2515,7 @@ class bt {
|
|
|
2526
2515
|
if (this.destroyed) return;
|
|
2527
2516
|
let t = 0;
|
|
2528
2517
|
this.config.rotationMode === "random" ? t = 1 : this.config.rotationMode === "velocity" ? t = 2 : this.config.rotationMode === "oriented" ? t = 3 : this.config.rotationMode === "cylindrical" && (t = 4);
|
|
2529
|
-
const e =
|
|
2518
|
+
const e = $s[this.config.particleShape] ?? 0, i = this._appearanceData;
|
|
2530
2519
|
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;
|
|
2531
2520
|
const r = this.config.followSystemTranslation ?? !0;
|
|
2532
2521
|
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);
|
|
@@ -2625,11 +2614,11 @@ class bt {
|
|
|
2625
2614
|
if (u > 0 && this._scriptTime >= u && !this._scriptConfigRestored)
|
|
2626
2615
|
this._scriptConfigRestored = !0, this._particleScript._configSnapshot && (this._particleScript.restoreConfig(this.config), this.updateAppearanceUniform(), this.updateBloomIntensity(), this.config.gravityEnabled && this.setGravity(this.config.gravityStrength), this.config.dampingEnabled && this.physics.setDamping(this.config.dampingStrength), this.config.attractorEnabled && this.setAttractor(this.config.attractorStrength, this.config.attractorPosition));
|
|
2627
2616
|
else if (!this._scriptConfigRestored) {
|
|
2628
|
-
const
|
|
2617
|
+
const m = u > 0 ? Math.ceil(u / 0.016666666666666666) : 0, { configDirty: p, particlesDirty: d } = this._particleScript.execute(
|
|
2629
2618
|
t,
|
|
2630
2619
|
this._scriptTime,
|
|
2631
2620
|
this._scriptFrame,
|
|
2632
|
-
|
|
2621
|
+
m,
|
|
2633
2622
|
this._scriptParticleData,
|
|
2634
2623
|
this._scriptVelocityData,
|
|
2635
2624
|
this.activeParticles
|
|
@@ -2654,18 +2643,18 @@ class bt {
|
|
|
2654
2643
|
if (!n && !this.emitting && !this.config.burstMode && !this.config.followSystemId && this.currentEmissionTime < this.effectiveEmissionDuration && (this.emitting = !0), !n && this.emitting)
|
|
2655
2644
|
if (this.currentEmissionTime += t, this.currentEmissionTime < this.effectiveEmissionDuration) {
|
|
2656
2645
|
const u = this.activeParticles;
|
|
2657
|
-
let
|
|
2646
|
+
let m = !1;
|
|
2658
2647
|
if (this.config.followSystemId) {
|
|
2659
2648
|
if (this._pendingFollowEmissions.length > 0) {
|
|
2660
2649
|
const p = this._pendingFollowEmissions.length / 6;
|
|
2661
2650
|
for (let d = 0; d < p; d++) {
|
|
2662
|
-
const
|
|
2651
|
+
const b = d * 6;
|
|
2663
2652
|
if (this.emitFollowerParticle(
|
|
2664
|
-
this._pendingFollowEmissions[
|
|
2665
|
-
this._pendingFollowEmissions[
|
|
2666
|
-
this._pendingFollowEmissions[
|
|
2653
|
+
this._pendingFollowEmissions[b],
|
|
2654
|
+
this._pendingFollowEmissions[b + 1],
|
|
2655
|
+
this._pendingFollowEmissions[b + 2]
|
|
2667
2656
|
))
|
|
2668
|
-
|
|
2657
|
+
m = !0;
|
|
2669
2658
|
else
|
|
2670
2659
|
break;
|
|
2671
2660
|
}
|
|
@@ -2682,10 +2671,10 @@ class bt {
|
|
|
2682
2671
|
}
|
|
2683
2672
|
p === 0 && c && this.config.emissionRate > 0 && this.activeParticles < this.particleCount && (p = 1);
|
|
2684
2673
|
for (let d = 0; d < p && this.emitParticle(); d++)
|
|
2685
|
-
|
|
2674
|
+
m = !0;
|
|
2686
2675
|
}
|
|
2687
|
-
if (
|
|
2688
|
-
const p = this.activeParticles - u, d = u * 8,
|
|
2676
|
+
if (m) {
|
|
2677
|
+
const p = this.activeParticles - u, d = u * 8, b = u * 4;
|
|
2689
2678
|
this.device.queue.writeBuffer(
|
|
2690
2679
|
this.instanceBuffer,
|
|
2691
2680
|
d * 4,
|
|
@@ -2695,10 +2684,10 @@ class bt {
|
|
|
2695
2684
|
p * 8
|
|
2696
2685
|
), this.device.queue.writeBuffer(
|
|
2697
2686
|
this.velocityBuffer,
|
|
2698
|
-
|
|
2687
|
+
b * 4,
|
|
2699
2688
|
// Offset in bytes (float32 = 4 bytes)
|
|
2700
2689
|
this.particleVelocities,
|
|
2701
|
-
|
|
2690
|
+
b,
|
|
2702
2691
|
p * 4
|
|
2703
2692
|
);
|
|
2704
2693
|
}
|
|
@@ -2789,13 +2778,13 @@ class bt {
|
|
|
2789
2778
|
o * o + c * c + l * l
|
|
2790
2779
|
);
|
|
2791
2780
|
if (u > 1e-3) {
|
|
2792
|
-
const
|
|
2793
|
-
this.particleVelocities[i] = o / u *
|
|
2781
|
+
const m = this.config.particleSpeed * 2;
|
|
2782
|
+
this.particleVelocities[i] = o / u * m, this.particleVelocities[i + 1] = c / u * m, this.particleVelocities[i + 2] = l / u * m;
|
|
2794
2783
|
} else {
|
|
2795
|
-
const
|
|
2796
|
-
if (
|
|
2784
|
+
const m = Math.sqrt(r * r + n * n + a * a);
|
|
2785
|
+
if (m > 1e-3) {
|
|
2797
2786
|
const p = this.config.particleSpeed * 2;
|
|
2798
|
-
this.particleVelocities[i] = r /
|
|
2787
|
+
this.particleVelocities[i] = r / m * p, this.particleVelocities[i + 1] = n / m * p, this.particleVelocities[i + 2] = a / m * p;
|
|
2799
2788
|
} else
|
|
2800
2789
|
this.particleVelocities[i] = 0, this.particleVelocities[i + 1] = this.config.particleSpeed * 2, this.particleVelocities[i + 2] = 0;
|
|
2801
2790
|
}
|
|
@@ -2840,16 +2829,16 @@ class bt {
|
|
|
2840
2829
|
this.physics.setSoftBoundary(t);
|
|
2841
2830
|
}
|
|
2842
2831
|
}
|
|
2843
|
-
class
|
|
2832
|
+
class Ws {
|
|
2844
2833
|
constructor(t) {
|
|
2845
|
-
this.device = t, this.particleSystems = [], this.activeSystemIndex = 0, this.systemCounter = 1, this.onSystemCreated = null, this.loop = void 0, this.clock = new
|
|
2834
|
+
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;
|
|
2846
2835
|
}
|
|
2847
2836
|
createParticleSystem(t = {}) {
|
|
2848
2837
|
const e = this.systemCounter++, i = t.name || `System ${e + 1}`, r = {
|
|
2849
2838
|
...t,
|
|
2850
2839
|
name: i,
|
|
2851
2840
|
id: e
|
|
2852
|
-
}, n = new
|
|
2841
|
+
}, n = new vt(this.device, r);
|
|
2853
2842
|
return this.particleSystems.push({
|
|
2854
2843
|
system: n,
|
|
2855
2844
|
config: r
|
|
@@ -2913,16 +2902,16 @@ class Hs {
|
|
|
2913
2902
|
for (const { system: o, config: c } of this.particleSystems) {
|
|
2914
2903
|
const l = c.keyframes;
|
|
2915
2904
|
if (!(!l || c.keyframesEnabled === !1)) {
|
|
2916
|
-
for (const u of
|
|
2917
|
-
const
|
|
2918
|
-
if (
|
|
2919
|
-
const p =
|
|
2905
|
+
for (const u of Zs) {
|
|
2906
|
+
const m = l[u];
|
|
2907
|
+
if (m && m.length) {
|
|
2908
|
+
const p = Hs(m, a);
|
|
2920
2909
|
p !== void 0 && (c[u] = p);
|
|
2921
2910
|
}
|
|
2922
2911
|
}
|
|
2923
2912
|
if (l.particleColor && l.particleColor.length) {
|
|
2924
|
-
const u =
|
|
2925
|
-
|
|
2913
|
+
const u = c.particleColor, m = u && typeof u.length == "number" && u.length >= 3 ? u : void 0, p = qs(l.particleColor, a, m);
|
|
2914
|
+
p && (c.particleColor = p, o.updateAppearanceUniform());
|
|
2926
2915
|
}
|
|
2927
2916
|
}
|
|
2928
2917
|
}
|
|
@@ -2973,7 +2962,7 @@ class Hs {
|
|
|
2973
2962
|
const n = this.systemCounter++, a = {
|
|
2974
2963
|
...r,
|
|
2975
2964
|
id: n
|
|
2976
|
-
}, o = new
|
|
2965
|
+
}, o = new vt(this.device, a);
|
|
2977
2966
|
this.particleSystems.push({
|
|
2978
2967
|
system: o,
|
|
2979
2968
|
config: a
|
|
@@ -2991,7 +2980,7 @@ class Hs {
|
|
|
2991
2980
|
try {
|
|
2992
2981
|
let a = null;
|
|
2993
2982
|
if (n.glbModelData)
|
|
2994
|
-
a =
|
|
2983
|
+
a = mi(n.glbModelData);
|
|
2995
2984
|
else if (n.glbFileName) {
|
|
2996
2985
|
const o = await fetch(`/${n.glbFileName}`);
|
|
2997
2986
|
o.ok ? a = await o.arrayBuffer() : console.warn(`GLB file not found: ${n.glbFileName}`);
|
|
@@ -2999,7 +2988,7 @@ class Hs {
|
|
|
2999
2988
|
if (a) {
|
|
3000
2989
|
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))
|
|
3001
2990
|
try {
|
|
3002
|
-
const o = await
|
|
2991
|
+
const o = await fi(a);
|
|
3003
2992
|
if (o) {
|
|
3004
2993
|
const c = await createImageBitmap(o.imageBlob);
|
|
3005
2994
|
await r.setTexture(c), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${n.name}`);
|
|
@@ -3063,7 +3052,7 @@ class Hs {
|
|
|
3063
3052
|
o.attractorPosition[1] + e[1],
|
|
3064
3053
|
o.attractorPosition[2] + e[2]
|
|
3065
3054
|
]);
|
|
3066
|
-
const u = new
|
|
3055
|
+
const u = new vt(this.device, l);
|
|
3067
3056
|
this.particleSystems.push({
|
|
3068
3057
|
system: u,
|
|
3069
3058
|
config: l
|
|
@@ -3082,7 +3071,7 @@ class Hs {
|
|
|
3082
3071
|
try {
|
|
3083
3072
|
let l = null;
|
|
3084
3073
|
if (c.glbModelData)
|
|
3085
|
-
l =
|
|
3074
|
+
l = mi(c.glbModelData);
|
|
3086
3075
|
else if (c.glbFileName) {
|
|
3087
3076
|
const u = await fetch(`/${c.glbFileName}`);
|
|
3088
3077
|
u.ok ? l = await u.arrayBuffer() : console.warn(`GLB file not found: ${c.glbFileName}`);
|
|
@@ -3090,10 +3079,10 @@ class Hs {
|
|
|
3090
3079
|
if (l) {
|
|
3091
3080
|
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))
|
|
3092
3081
|
try {
|
|
3093
|
-
const u = await
|
|
3082
|
+
const u = await fi(l);
|
|
3094
3083
|
if (u) {
|
|
3095
|
-
const
|
|
3096
|
-
await o.setTexture(
|
|
3084
|
+
const m = await createImageBitmap(u.imageBlob);
|
|
3085
|
+
await o.setTexture(m), globalThis.__HZFX_DEBUG && console.log(`GLB embedded texture restored for ${c.name}`);
|
|
3097
3086
|
}
|
|
3098
3087
|
} catch (u) {
|
|
3099
3088
|
console.warn(`Failed to restore GLB texture for ${c.name}:`, u), c.useGlbTexture = !1;
|
|
@@ -3107,8 +3096,8 @@ class Hs {
|
|
|
3107
3096
|
if (c.textureEnabled && !c.glbModelEnabled && c.textureImageData && !o._textureRestored)
|
|
3108
3097
|
try {
|
|
3109
3098
|
const l = new Image();
|
|
3110
|
-
await new Promise((
|
|
3111
|
-
l.onload =
|
|
3099
|
+
await new Promise((m, p) => {
|
|
3100
|
+
l.onload = m, l.onerror = p, l.src = c.textureImageData;
|
|
3112
3101
|
});
|
|
3113
3102
|
const u = await createImageBitmap(l);
|
|
3114
3103
|
await o.setTexture(u), o._textureRestored = !0;
|
|
@@ -3123,7 +3112,7 @@ class Hs {
|
|
|
3123
3112
|
}
|
|
3124
3113
|
}
|
|
3125
3114
|
}
|
|
3126
|
-
async function
|
|
3115
|
+
async function Js(s) {
|
|
3127
3116
|
if (!s)
|
|
3128
3117
|
throw new Error("canvas is required for initWebGPU()");
|
|
3129
3118
|
if (!navigator.gpu)
|
|
@@ -3135,30 +3124,30 @@ async function qs(s) {
|
|
|
3135
3124
|
alphaMode: "premultiplied"
|
|
3136
3125
|
}), { device: i, context: t, format: r, canvas: s };
|
|
3137
3126
|
}
|
|
3138
|
-
const
|
|
3139
|
-
function
|
|
3127
|
+
const oe = "rgba16float";
|
|
3128
|
+
function yi(s, t, e, i) {
|
|
3140
3129
|
const r = s.createTexture({
|
|
3141
3130
|
size: [e, i],
|
|
3142
|
-
format:
|
|
3131
|
+
format: oe,
|
|
3143
3132
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
|
|
3144
3133
|
mipLevelCount: 1,
|
|
3145
3134
|
sampleCount: 1
|
|
3146
3135
|
}), n = s.createTexture({
|
|
3147
3136
|
size: [e, i],
|
|
3148
|
-
format:
|
|
3137
|
+
format: oe,
|
|
3149
3138
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
|
|
3150
3139
|
mipLevelCount: 1,
|
|
3151
3140
|
sampleCount: 1
|
|
3152
3141
|
}), a = s.createTexture({
|
|
3153
3142
|
size: [e, i],
|
|
3154
|
-
format:
|
|
3143
|
+
format: oe,
|
|
3155
3144
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
|
|
3156
3145
|
mipLevelCount: 1,
|
|
3157
3146
|
sampleCount: 1
|
|
3158
3147
|
});
|
|
3159
3148
|
return { sceneTexture: r, bloomTexA: n, bloomTexB: a };
|
|
3160
3149
|
}
|
|
3161
|
-
function
|
|
3150
|
+
function gi(s, t, e) {
|
|
3162
3151
|
return s.createTexture({
|
|
3163
3152
|
size: [t, e],
|
|
3164
3153
|
format: "depth24plus",
|
|
@@ -3173,7 +3162,7 @@ function Ge(s, t, e) {
|
|
|
3173
3162
|
});
|
|
3174
3163
|
return new t.constructor(i.getMappedRange()).set(t), i.unmap(), i;
|
|
3175
3164
|
}
|
|
3176
|
-
const
|
|
3165
|
+
const Qs = `
|
|
3177
3166
|
struct Uniforms {
|
|
3178
3167
|
transform: mat4x4<f32>,
|
|
3179
3168
|
cameraPosition: vec3<f32>,
|
|
@@ -3235,7 +3224,7 @@ const Zs = `
|
|
|
3235
3224
|
|
|
3236
3225
|
return finalColor;
|
|
3237
3226
|
}
|
|
3238
|
-
`,
|
|
3227
|
+
`, Ks = `
|
|
3239
3228
|
struct Uniforms {
|
|
3240
3229
|
transform: mat4x4<f32>,
|
|
3241
3230
|
cameraPosition: vec3<f32>,
|
|
@@ -3471,7 +3460,7 @@ const Zs = `
|
|
|
3471
3460
|
return finalColor;
|
|
3472
3461
|
}
|
|
3473
3462
|
`;
|
|
3474
|
-
function
|
|
3463
|
+
function er(s) {
|
|
3475
3464
|
const t = s.createBindGroupLayout({
|
|
3476
3465
|
entries: [
|
|
3477
3466
|
{
|
|
@@ -3557,7 +3546,7 @@ function Ws(s) {
|
|
|
3557
3546
|
object3dBindGroupLayout: r
|
|
3558
3547
|
};
|
|
3559
3548
|
}
|
|
3560
|
-
function
|
|
3549
|
+
function tr(s, t, e, i = {}) {
|
|
3561
3550
|
const { depthCompare: r } = i, n = r || "less", {
|
|
3562
3551
|
particleBindGroupLayout: a,
|
|
3563
3552
|
bloomBindGroupLayout: o,
|
|
@@ -3565,22 +3554,22 @@ function Js(s, t, e, i = {}) {
|
|
|
3565
3554
|
object3dBindGroupLayout: l
|
|
3566
3555
|
} = e, u = s.createPipelineLayout({
|
|
3567
3556
|
bindGroupLayouts: [a]
|
|
3568
|
-
}),
|
|
3557
|
+
}), m = s.createPipelineLayout({
|
|
3569
3558
|
bindGroupLayouts: [o]
|
|
3570
3559
|
}), p = s.createPipelineLayout({
|
|
3571
3560
|
bindGroupLayouts: [c]
|
|
3572
3561
|
}), d = s.createShaderModule({
|
|
3573
|
-
code: ps
|
|
3574
|
-
}), S = s.createShaderModule({
|
|
3575
|
-
code: hs
|
|
3576
|
-
}), R = s.createShaderModule({
|
|
3577
|
-
code: ms
|
|
3578
|
-
}), E = s.createShaderModule({
|
|
3579
3562
|
code: ys
|
|
3580
|
-
}),
|
|
3581
|
-
code:
|
|
3563
|
+
}), b = s.createShaderModule({
|
|
3564
|
+
code: gs
|
|
3565
|
+
}), w = s.createShaderModule({
|
|
3566
|
+
code: bs
|
|
3567
|
+
}), M = s.createShaderModule({
|
|
3568
|
+
code: Ss
|
|
3569
|
+
}), R = s.createShaderModule({
|
|
3570
|
+
code: Qs
|
|
3582
3571
|
}), x = s.createShaderModule({
|
|
3583
|
-
code:
|
|
3572
|
+
code: Ks
|
|
3584
3573
|
}), L = (W) => s.createRenderPipeline({
|
|
3585
3574
|
layout: u,
|
|
3586
3575
|
vertex: {
|
|
@@ -3648,7 +3637,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3648
3637
|
module: d,
|
|
3649
3638
|
entryPoint: "fs_main",
|
|
3650
3639
|
targets: [{
|
|
3651
|
-
format:
|
|
3640
|
+
format: oe,
|
|
3652
3641
|
blend: W
|
|
3653
3642
|
}]
|
|
3654
3643
|
},
|
|
@@ -3672,7 +3661,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3672
3661
|
dstFactor: "one-minus-src-alpha",
|
|
3673
3662
|
operation: "add"
|
|
3674
3663
|
}
|
|
3675
|
-
}),
|
|
3664
|
+
}), T = L({
|
|
3676
3665
|
color: {
|
|
3677
3666
|
srcFactor: "src-alpha",
|
|
3678
3667
|
dstFactor: "one",
|
|
@@ -3683,7 +3672,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3683
3672
|
dstFactor: "one-minus-src-alpha",
|
|
3684
3673
|
operation: "add"
|
|
3685
3674
|
}
|
|
3686
|
-
}),
|
|
3675
|
+
}), E = s.createRenderPipeline({
|
|
3687
3676
|
layout: u,
|
|
3688
3677
|
vertex: {
|
|
3689
3678
|
module: d,
|
|
@@ -3750,7 +3739,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3750
3739
|
module: d,
|
|
3751
3740
|
entryPoint: "fs_main",
|
|
3752
3741
|
targets: [{
|
|
3753
|
-
format:
|
|
3742
|
+
format: oe,
|
|
3754
3743
|
writeMask: 0
|
|
3755
3744
|
// No color write — depth only
|
|
3756
3745
|
}]
|
|
@@ -3766,32 +3755,32 @@ function Js(s, t, e, i = {}) {
|
|
|
3766
3755
|
format: "depth24plus"
|
|
3767
3756
|
}
|
|
3768
3757
|
}), F = s.createRenderPipeline({
|
|
3769
|
-
layout:
|
|
3758
|
+
layout: m,
|
|
3770
3759
|
vertex: {
|
|
3771
|
-
module:
|
|
3760
|
+
module: b,
|
|
3772
3761
|
entryPoint: "vs_main"
|
|
3773
3762
|
},
|
|
3774
3763
|
fragment: {
|
|
3775
|
-
module:
|
|
3764
|
+
module: b,
|
|
3776
3765
|
entryPoint: "fs_main",
|
|
3777
3766
|
targets: [{
|
|
3778
|
-
format:
|
|
3767
|
+
format: oe
|
|
3779
3768
|
}]
|
|
3780
3769
|
},
|
|
3781
3770
|
primitive: {
|
|
3782
3771
|
topology: "triangle-list"
|
|
3783
3772
|
}
|
|
3784
|
-
}),
|
|
3773
|
+
}), k = s.createRenderPipeline({
|
|
3785
3774
|
layout: p,
|
|
3786
3775
|
vertex: {
|
|
3787
|
-
module:
|
|
3776
|
+
module: w,
|
|
3788
3777
|
entryPoint: "vs_main"
|
|
3789
3778
|
},
|
|
3790
3779
|
fragment: {
|
|
3791
|
-
module:
|
|
3780
|
+
module: w,
|
|
3792
3781
|
entryPoint: "fs_main",
|
|
3793
3782
|
targets: [{
|
|
3794
|
-
format:
|
|
3783
|
+
format: oe,
|
|
3795
3784
|
blend: {
|
|
3796
3785
|
color: {
|
|
3797
3786
|
srcFactor: "one",
|
|
@@ -3812,14 +3801,14 @@ function Js(s, t, e, i = {}) {
|
|
|
3812
3801
|
}), Y = s.createRenderPipeline({
|
|
3813
3802
|
layout: p,
|
|
3814
3803
|
vertex: {
|
|
3815
|
-
module:
|
|
3804
|
+
module: M,
|
|
3816
3805
|
entryPoint: "vs_main"
|
|
3817
3806
|
},
|
|
3818
3807
|
fragment: {
|
|
3819
|
-
module:
|
|
3808
|
+
module: M,
|
|
3820
3809
|
entryPoint: "fs_main",
|
|
3821
3810
|
targets: [{
|
|
3822
|
-
format:
|
|
3811
|
+
format: oe,
|
|
3823
3812
|
blend: {
|
|
3824
3813
|
color: {
|
|
3825
3814
|
srcFactor: "one",
|
|
@@ -3837,11 +3826,11 @@ function Js(s, t, e, i = {}) {
|
|
|
3837
3826
|
primitive: {
|
|
3838
3827
|
topology: "triangle-list"
|
|
3839
3828
|
}
|
|
3840
|
-
}),
|
|
3829
|
+
}), N = s.createShaderModule({ code: xs }), G = s.createRenderPipeline({
|
|
3841
3830
|
layout: p,
|
|
3842
|
-
vertex: { module:
|
|
3831
|
+
vertex: { module: N, entryPoint: "vs_main" },
|
|
3843
3832
|
fragment: {
|
|
3844
|
-
module:
|
|
3833
|
+
module: N,
|
|
3845
3834
|
entryPoint: "fs_main",
|
|
3846
3835
|
targets: [{
|
|
3847
3836
|
format: t,
|
|
@@ -3852,12 +3841,12 @@ function Js(s, t, e, i = {}) {
|
|
|
3852
3841
|
}]
|
|
3853
3842
|
},
|
|
3854
3843
|
primitive: { topology: "triangle-list" }
|
|
3855
|
-
}),
|
|
3844
|
+
}), de = s.createPipelineLayout({
|
|
3856
3845
|
bindGroupLayouts: [l]
|
|
3857
3846
|
}), De = s.createRenderPipeline({
|
|
3858
|
-
layout:
|
|
3847
|
+
layout: de,
|
|
3859
3848
|
vertex: {
|
|
3860
|
-
module:
|
|
3849
|
+
module: R,
|
|
3861
3850
|
entryPoint: "vs_main",
|
|
3862
3851
|
buffers: [
|
|
3863
3852
|
{
|
|
@@ -3882,10 +3871,10 @@ function Js(s, t, e, i = {}) {
|
|
|
3882
3871
|
]
|
|
3883
3872
|
},
|
|
3884
3873
|
fragment: {
|
|
3885
|
-
module:
|
|
3874
|
+
module: R,
|
|
3886
3875
|
entryPoint: "fs_main",
|
|
3887
3876
|
targets: [{
|
|
3888
|
-
format:
|
|
3877
|
+
format: oe,
|
|
3889
3878
|
blend: {
|
|
3890
3879
|
color: {
|
|
3891
3880
|
srcFactor: "src-alpha",
|
|
@@ -3909,7 +3898,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3909
3898
|
depthCompare: n,
|
|
3910
3899
|
format: "depth24plus"
|
|
3911
3900
|
}
|
|
3912
|
-
}),
|
|
3901
|
+
}), ct = s.createRenderPipeline({
|
|
3913
3902
|
layout: u,
|
|
3914
3903
|
vertex: {
|
|
3915
3904
|
module: x,
|
|
@@ -3987,7 +3976,7 @@ function Js(s, t, e, i = {}) {
|
|
|
3987
3976
|
module: x,
|
|
3988
3977
|
entryPoint: "fs_main",
|
|
3989
3978
|
targets: [{
|
|
3990
|
-
format:
|
|
3979
|
+
format: oe,
|
|
3991
3980
|
blend: {
|
|
3992
3981
|
color: {
|
|
3993
3982
|
srcFactor: "src-alpha",
|
|
@@ -4014,17 +4003,17 @@ function Js(s, t, e, i = {}) {
|
|
|
4014
4003
|
});
|
|
4015
4004
|
return {
|
|
4016
4005
|
particlePipeline: P,
|
|
4017
|
-
particleAdditivePipeline:
|
|
4018
|
-
particleDepthWritePipeline:
|
|
4006
|
+
particleAdditivePipeline: T,
|
|
4007
|
+
particleDepthWritePipeline: E,
|
|
4019
4008
|
blurPipeline: F,
|
|
4020
|
-
compositePipeline:
|
|
4009
|
+
compositePipeline: k,
|
|
4021
4010
|
directRenderPipeline: Y,
|
|
4022
4011
|
finalCompositePipeline: G,
|
|
4023
4012
|
object3dPipeline: De,
|
|
4024
|
-
glbMeshPipeline:
|
|
4013
|
+
glbMeshPipeline: ct
|
|
4025
4014
|
};
|
|
4026
4015
|
}
|
|
4027
|
-
function
|
|
4016
|
+
function Pt(s, t, e, i) {
|
|
4028
4017
|
const {
|
|
4029
4018
|
uniformBuffer: r,
|
|
4030
4019
|
appearanceUniformBuffer: n,
|
|
@@ -4034,7 +4023,7 @@ function St(s, t, e, i) {
|
|
|
4034
4023
|
} = e, {
|
|
4035
4024
|
sceneTexture: l,
|
|
4036
4025
|
bloomTexA: u,
|
|
4037
|
-
bloomTexB:
|
|
4026
|
+
bloomTexB: m
|
|
4038
4027
|
} = i, p = s.createBindGroup({
|
|
4039
4028
|
layout: s.createBindGroupLayout({
|
|
4040
4029
|
entries: [
|
|
@@ -4094,7 +4083,7 @@ function St(s, t, e, i) {
|
|
|
4094
4083
|
resource: { buffer: a }
|
|
4095
4084
|
}
|
|
4096
4085
|
]
|
|
4097
|
-
}),
|
|
4086
|
+
}), b = s.createBindGroup({
|
|
4098
4087
|
layout: s.createBindGroupLayout({
|
|
4099
4088
|
entries: [
|
|
4100
4089
|
{
|
|
@@ -4128,7 +4117,7 @@ function St(s, t, e, i) {
|
|
|
4128
4117
|
resource: { buffer: o }
|
|
4129
4118
|
}
|
|
4130
4119
|
]
|
|
4131
|
-
}),
|
|
4120
|
+
}), w = s.createBindGroup({
|
|
4132
4121
|
layout: s.createBindGroupLayout({
|
|
4133
4122
|
entries: [
|
|
4134
4123
|
{
|
|
@@ -4164,14 +4153,14 @@ function St(s, t, e, i) {
|
|
|
4164
4153
|
},
|
|
4165
4154
|
{
|
|
4166
4155
|
binding: 2,
|
|
4167
|
-
resource:
|
|
4156
|
+
resource: m.createView()
|
|
4168
4157
|
},
|
|
4169
4158
|
{
|
|
4170
4159
|
binding: 3,
|
|
4171
4160
|
resource: { buffer: c }
|
|
4172
4161
|
}
|
|
4173
4162
|
]
|
|
4174
|
-
}),
|
|
4163
|
+
}), M = s.createBindGroup({
|
|
4175
4164
|
layout: s.createBindGroupLayout({
|
|
4176
4165
|
entries: [
|
|
4177
4166
|
{
|
|
@@ -4207,7 +4196,7 @@ function St(s, t, e, i) {
|
|
|
4207
4196
|
},
|
|
4208
4197
|
{
|
|
4209
4198
|
binding: 2,
|
|
4210
|
-
resource:
|
|
4199
|
+
resource: m.createView()
|
|
4211
4200
|
},
|
|
4212
4201
|
{
|
|
4213
4202
|
binding: 3,
|
|
@@ -4218,12 +4207,12 @@ function St(s, t, e, i) {
|
|
|
4218
4207
|
return {
|
|
4219
4208
|
particleBindGroup: p,
|
|
4220
4209
|
horizontalBlurBindGroup: d,
|
|
4221
|
-
verticalBlurBindGroup:
|
|
4222
|
-
compositeBindGroup:
|
|
4223
|
-
directRenderBindGroup:
|
|
4210
|
+
verticalBlurBindGroup: b,
|
|
4211
|
+
compositeBindGroup: w,
|
|
4212
|
+
directRenderBindGroup: M
|
|
4224
4213
|
};
|
|
4225
4214
|
}
|
|
4226
|
-
function
|
|
4215
|
+
function ir(s) {
|
|
4227
4216
|
return s.createSampler({
|
|
4228
4217
|
magFilter: "linear",
|
|
4229
4218
|
minFilter: "linear",
|
|
@@ -4233,7 +4222,7 @@ function Qs(s) {
|
|
|
4233
4222
|
maxAnisotropy: 16
|
|
4234
4223
|
});
|
|
4235
4224
|
}
|
|
4236
|
-
function
|
|
4225
|
+
function sr() {
|
|
4237
4226
|
const s = new Float32Array([
|
|
4238
4227
|
// Front face (z = 0.5)
|
|
4239
4228
|
-0.5,
|
|
@@ -4431,13 +4420,13 @@ function Ks() {
|
|
|
4431
4420
|
]);
|
|
4432
4421
|
return { vertices: s, indices: t };
|
|
4433
4422
|
}
|
|
4434
|
-
function
|
|
4423
|
+
function rr(s = 16, t = 16) {
|
|
4435
4424
|
const e = [], i = [];
|
|
4436
4425
|
for (let r = 0; r <= s; r++) {
|
|
4437
4426
|
const n = r * Math.PI / s, a = Math.sin(n), o = Math.cos(n);
|
|
4438
4427
|
for (let c = 0; c <= t; c++) {
|
|
4439
|
-
const l = c * 2 * Math.PI / t, u = Math.sin(l), p = Math.cos(l) * a, d = o,
|
|
4440
|
-
e.push(p * 0.5, d * 0.5,
|
|
4428
|
+
const l = c * 2 * Math.PI / t, u = Math.sin(l), p = Math.cos(l) * a, d = o, b = u * a;
|
|
4429
|
+
e.push(p * 0.5, d * 0.5, b * 0.5), e.push(p, d, b);
|
|
4441
4430
|
}
|
|
4442
4431
|
}
|
|
4443
4432
|
for (let r = 0; r < s; r++)
|
|
@@ -4450,7 +4439,7 @@ function er(s = 16, t = 16) {
|
|
|
4450
4439
|
indices: new Uint16Array(i)
|
|
4451
4440
|
};
|
|
4452
4441
|
}
|
|
4453
|
-
class
|
|
4442
|
+
class nr {
|
|
4454
4443
|
constructor(t, e, i, r, n) {
|
|
4455
4444
|
this.id = t, this.type = e, this.position = i, this.scale = r, this.color = n, this.rotation = [0, 0, 0];
|
|
4456
4445
|
}
|
|
@@ -4584,7 +4573,7 @@ class tr {
|
|
|
4584
4573
|
return i;
|
|
4585
4574
|
}
|
|
4586
4575
|
}
|
|
4587
|
-
class
|
|
4576
|
+
class pr {
|
|
4588
4577
|
constructor(t) {
|
|
4589
4578
|
this.device = t, this.objects = [], this.nextId = 0, this.initializeGeometry(), this.onObjectAdded = null, this.onObjectRemoved = null, this.onObjectUpdated = null;
|
|
4590
4579
|
}
|
|
@@ -4592,7 +4581,7 @@ class cr {
|
|
|
4592
4581
|
* Initialize geometry buffers for cube and sphere
|
|
4593
4582
|
*/
|
|
4594
4583
|
initializeGeometry() {
|
|
4595
|
-
const t =
|
|
4584
|
+
const t = sr(), e = rr(16, 16);
|
|
4596
4585
|
this.cubeVertexBuffer = Ge(
|
|
4597
4586
|
this.device,
|
|
4598
4587
|
t.vertices,
|
|
@@ -4620,7 +4609,7 @@ class cr {
|
|
|
4620
4609
|
* @returns {Object3D} The created object
|
|
4621
4610
|
*/
|
|
4622
4611
|
addObject(t, e = [0, 0, 0], i = [1, 1, 1], r = [1, 1, 1, 1]) {
|
|
4623
|
-
const n = new
|
|
4612
|
+
const n = new nr(this.nextId++, t, e, i, r);
|
|
4624
4613
|
return n.uniformBuffer = this.device.createBuffer({
|
|
4625
4614
|
size: 192,
|
|
4626
4615
|
// modelMatrix (64) + normalMatrix (64) + color (16) + padding (48)
|
|
@@ -4709,21 +4698,21 @@ class cr {
|
|
|
4709
4698
|
}
|
|
4710
4699
|
}
|
|
4711
4700
|
}
|
|
4712
|
-
function
|
|
4701
|
+
function hr(s) {
|
|
4713
4702
|
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;
|
|
4714
4703
|
return [t, e, i];
|
|
4715
4704
|
}
|
|
4716
|
-
function
|
|
4705
|
+
function mr(s) {
|
|
4717
4706
|
if (!s) return "#ffffff";
|
|
4718
4707
|
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");
|
|
4719
4708
|
return `#${t}${e}${i}`;
|
|
4720
4709
|
}
|
|
4721
|
-
function
|
|
4722
|
-
const i =
|
|
4710
|
+
function yr(s, t, e) {
|
|
4711
|
+
const i = bi([
|
|
4723
4712
|
s[0] - t[0],
|
|
4724
4713
|
s[1] - t[1],
|
|
4725
4714
|
s[2] - t[2]
|
|
4726
|
-
]), r =
|
|
4715
|
+
]), r = bi(Si(e, i)), n = Si(i, r);
|
|
4727
4716
|
return new Float32Array([
|
|
4728
4717
|
r[0],
|
|
4729
4718
|
n[0],
|
|
@@ -4737,13 +4726,13 @@ function fr(s, t, e) {
|
|
|
4737
4726
|
n[2],
|
|
4738
4727
|
i[2],
|
|
4739
4728
|
0,
|
|
4740
|
-
-
|
|
4741
|
-
-
|
|
4742
|
-
-
|
|
4729
|
+
-_t(r, s),
|
|
4730
|
+
-_t(n, s),
|
|
4731
|
+
-_t(i, s),
|
|
4743
4732
|
1
|
|
4744
4733
|
]);
|
|
4745
4734
|
}
|
|
4746
|
-
function
|
|
4735
|
+
function gr(s, t = Math.PI / 4) {
|
|
4747
4736
|
const r = 1 / Math.tan(t / 2);
|
|
4748
4737
|
return new Float32Array([
|
|
4749
4738
|
r * s,
|
|
@@ -4764,21 +4753,21 @@ function pr(s, t = Math.PI / 4) {
|
|
|
4764
4753
|
0
|
|
4765
4754
|
]);
|
|
4766
4755
|
}
|
|
4767
|
-
function
|
|
4756
|
+
function bi(s) {
|
|
4768
4757
|
const t = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]);
|
|
4769
4758
|
return [s[0] / t, s[1] / t, s[2] / t];
|
|
4770
4759
|
}
|
|
4771
|
-
function
|
|
4760
|
+
function Si(s, t) {
|
|
4772
4761
|
return [
|
|
4773
4762
|
s[1] * t[2] - s[2] * t[1],
|
|
4774
4763
|
s[2] * t[0] - s[0] * t[2],
|
|
4775
4764
|
s[0] * t[1] - s[1] * t[0]
|
|
4776
4765
|
];
|
|
4777
4766
|
}
|
|
4778
|
-
function
|
|
4767
|
+
function _t(s, t) {
|
|
4779
4768
|
return s[0] * t[0] + s[1] * t[1] + s[2] * t[2];
|
|
4780
4769
|
}
|
|
4781
|
-
function
|
|
4770
|
+
function ar(s, t) {
|
|
4782
4771
|
const e = new Float32Array(16);
|
|
4783
4772
|
for (let i = 0; i < 4; i++)
|
|
4784
4773
|
for (let r = 0; r < 4; r++) {
|
|
@@ -4789,7 +4778,7 @@ function ir(s, t) {
|
|
|
4789
4778
|
}
|
|
4790
4779
|
return e;
|
|
4791
4780
|
}
|
|
4792
|
-
const
|
|
4781
|
+
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) => {
|
|
4793
4782
|
if (typeof btoa == "function") {
|
|
4794
4783
|
let t = "";
|
|
4795
4784
|
for (let e = 0; e < s.length; e++) t += String.fromCharCode(s[e]);
|
|
@@ -4797,94 +4786,94 @@ const Pt = 1481005640, vi = 1, Pi = 1313821514, _i = 5130562, qe = "$hzfxAsset",
|
|
|
4797
4786
|
}
|
|
4798
4787
|
return Buffer.from(s).toString("base64");
|
|
4799
4788
|
};
|
|
4800
|
-
function
|
|
4801
|
-
const t = s.indexOf(","), e = s.slice(5, t), i = e.split(";")[0] || "application/octet-stream", r = s.slice(t + 1), a = /;base64/i.test(e) ?
|
|
4789
|
+
function or(s) {
|
|
4790
|
+
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));
|
|
4802
4791
|
return { mime: i, bytes: a };
|
|
4803
4792
|
}
|
|
4804
|
-
function
|
|
4793
|
+
function vi(s) {
|
|
4805
4794
|
return (4 - s % 4) % 4;
|
|
4806
4795
|
}
|
|
4807
|
-
async function
|
|
4796
|
+
async function lr(s, t = {}) {
|
|
4808
4797
|
const { textureFormat: e = "keep", quality: i = 0.85 } = t, r = [], n = [];
|
|
4809
4798
|
let a = 0;
|
|
4810
|
-
const o = (
|
|
4811
|
-
const
|
|
4812
|
-
r.push({ offset:
|
|
4813
|
-
const
|
|
4814
|
-
return
|
|
4799
|
+
const o = (T, E, F) => {
|
|
4800
|
+
const k = a, Y = T.length;
|
|
4801
|
+
r.push({ offset: k, length: Y, mime: E, kind: F }), n.push(T), a += Y;
|
|
4802
|
+
const N = vi(Y);
|
|
4803
|
+
return N && (n.push(new Uint8Array(N)), a += N), r.length - 1;
|
|
4815
4804
|
}, c = e === "webp" && typeof OffscreenCanvas < "u" && typeof createImageBitmap == "function", l = [];
|
|
4816
|
-
for (const
|
|
4817
|
-
const
|
|
4818
|
-
if (typeof
|
|
4819
|
-
let { mime: F, bytes:
|
|
4805
|
+
for (const T of s.systems || []) {
|
|
4806
|
+
const E = { ...T };
|
|
4807
|
+
if (typeof E.textureImageData == "string" && E.textureImageData.startsWith("data:")) {
|
|
4808
|
+
let { mime: F, bytes: k } = or(E.textureImageData);
|
|
4820
4809
|
if (c && F !== "image/webp")
|
|
4821
4810
|
try {
|
|
4822
|
-
const Y = await createImageBitmap(new Blob([
|
|
4823
|
-
|
|
4824
|
-
const G = await
|
|
4825
|
-
|
|
4811
|
+
const Y = await createImageBitmap(new Blob([k], { type: F })), N = new OffscreenCanvas(Y.width, Y.height);
|
|
4812
|
+
N.getContext("2d").drawImage(Y, 0, 0);
|
|
4813
|
+
const G = await N.convertToBlob({ type: "image/webp", quality: i }), de = new Uint8Array(await G.arrayBuffer());
|
|
4814
|
+
de.length < k.length && (k = de, F = "image/webp");
|
|
4826
4815
|
} catch {
|
|
4827
4816
|
}
|
|
4828
|
-
|
|
4817
|
+
E.textureImageData = { [Ze]: o(k, F, "texture") };
|
|
4829
4818
|
}
|
|
4830
|
-
if (typeof
|
|
4831
|
-
const F =
|
|
4832
|
-
|
|
4819
|
+
if (typeof E.glbModelData == "string" && E.glbModelData.length > 0) {
|
|
4820
|
+
const F = Ri(E.glbModelData);
|
|
4821
|
+
E.glbModelData = { [Ze]: o(F, "model/gltf-binary", "glb") };
|
|
4833
4822
|
}
|
|
4834
|
-
l.push(
|
|
4823
|
+
l.push(E);
|
|
4835
4824
|
}
|
|
4836
|
-
const u = { ...s, systems: l, assets: r },
|
|
4837
|
-
let
|
|
4838
|
-
for (const
|
|
4839
|
-
d.set(
|
|
4840
|
-
const
|
|
4825
|
+
const u = { ...s, systems: l, assets: r }, m = new TextEncoder().encode(JSON.stringify(u)), p = vi(m.length), d = new Uint8Array(a);
|
|
4826
|
+
let b = 0;
|
|
4827
|
+
for (const T of n)
|
|
4828
|
+
d.set(T, b), b += T.length;
|
|
4829
|
+
const w = m.length + p, M = 20 + w + 8 + a, R = new ArrayBuffer(M), x = new DataView(R), L = new Uint8Array(R);
|
|
4841
4830
|
let P = 0;
|
|
4842
|
-
x.setUint32(P,
|
|
4843
|
-
for (let
|
|
4844
|
-
return x.setUint32(P, a, !0), P += 4, x.setUint32(P,
|
|
4831
|
+
x.setUint32(P, Bt, !0), P += 4, x.setUint32(P, wi, !0), P += 4, x.setUint32(P, M, !0), P += 4, x.setUint32(P, w, !0), P += 4, x.setUint32(P, Bi, !0), P += 4, L.set(m, P), P += m.length;
|
|
4832
|
+
for (let T = 0; T < p; T++) L[P++] = 32;
|
|
4833
|
+
return x.setUint32(P, a, !0), P += 4, x.setUint32(P, Mi, !0), P += 4, L.set(d, P), P += a, R;
|
|
4845
4834
|
}
|
|
4846
|
-
function
|
|
4847
|
-
return !s || s.byteLength < 12 ? !1 : new DataView(s).getUint32(0, !0) ===
|
|
4835
|
+
function Ti(s) {
|
|
4836
|
+
return !s || s.byteLength < 12 ? !1 : new DataView(s).getUint32(0, !0) === Bt;
|
|
4848
4837
|
}
|
|
4849
|
-
function
|
|
4838
|
+
function Ei(s) {
|
|
4850
4839
|
const t = new DataView(s);
|
|
4851
|
-
if (t.getUint32(0, !0) !==
|
|
4840
|
+
if (t.getUint32(0, !0) !== Bt) throw new Error("[unpackHZFX] bad magic — not an .hzfx file");
|
|
4852
4841
|
const e = t.getUint32(4, !0);
|
|
4853
|
-
if (e !==
|
|
4842
|
+
if (e !== wi) throw new Error(`[unpackHZFX] unsupported version ${e}`);
|
|
4854
4843
|
let i = 12, r = null, n = -1;
|
|
4855
4844
|
const a = new Uint8Array(s);
|
|
4856
4845
|
for (; i + 8 <= s.byteLength; ) {
|
|
4857
4846
|
const p = t.getUint32(i, !0);
|
|
4858
4847
|
i += 4;
|
|
4859
4848
|
const d = t.getUint32(i, !0);
|
|
4860
|
-
i += 4, d ===
|
|
4849
|
+
i += 4, d === Bi ? r = JSON.parse(new TextDecoder().decode(a.subarray(i, i + p))) : d === Mi && (n = i), i += p;
|
|
4861
4850
|
}
|
|
4862
4851
|
if (!r) throw new Error("[unpackHZFX] missing JSON chunk");
|
|
4863
4852
|
const o = r.assets || [], c = (p) => {
|
|
4864
4853
|
const d = o[p];
|
|
4865
4854
|
return !d || n < 0 ? null : { ...d, bytes: a.subarray(n + d.offset, n + d.offset + d.length) };
|
|
4866
|
-
}, l = (p) => p && typeof p == "object" && typeof p[
|
|
4855
|
+
}, l = (p) => p && typeof p == "object" && typeof p[Ze] == "number", u = (r.systems || []).map((p) => {
|
|
4867
4856
|
const d = { ...p };
|
|
4868
4857
|
if (l(d.textureImageData)) {
|
|
4869
|
-
const
|
|
4870
|
-
d.textureImageData =
|
|
4858
|
+
const b = c(d.textureImageData[Ze]);
|
|
4859
|
+
d.textureImageData = b ? `data:${b.mime};base64,${xi(b.bytes)}` : void 0;
|
|
4871
4860
|
}
|
|
4872
4861
|
if (l(d.glbModelData)) {
|
|
4873
|
-
const
|
|
4874
|
-
d.glbModelData =
|
|
4862
|
+
const b = c(d.glbModelData[Ze]);
|
|
4863
|
+
d.glbModelData = b ? xi(b.bytes) : void 0;
|
|
4875
4864
|
}
|
|
4876
4865
|
return d;
|
|
4877
|
-
}),
|
|
4878
|
-
return delete
|
|
4866
|
+
}), m = { ...r, systems: u };
|
|
4867
|
+
return delete m.assets, m;
|
|
4879
4868
|
}
|
|
4880
|
-
function
|
|
4869
|
+
function cr(s) {
|
|
4881
4870
|
const t = new Uint8Array(s);
|
|
4882
4871
|
let e = "";
|
|
4883
4872
|
for (let i = 0; i < t.byteLength; i++)
|
|
4884
4873
|
e += String.fromCharCode(t[i]);
|
|
4885
4874
|
return btoa(e);
|
|
4886
4875
|
}
|
|
4887
|
-
function
|
|
4876
|
+
function ur(s) {
|
|
4888
4877
|
return {
|
|
4889
4878
|
name: s.name,
|
|
4890
4879
|
id: s.id,
|
|
@@ -5062,7 +5051,7 @@ function ar(s) {
|
|
|
5062
5051
|
displayUnit: s.displayUnit || "m"
|
|
5063
5052
|
};
|
|
5064
5053
|
}
|
|
5065
|
-
async function
|
|
5054
|
+
async function br(s, t, e = "hzfx") {
|
|
5066
5055
|
if (!s || !s.particleSystems || s.particleSystems.length === 0) {
|
|
5067
5056
|
alert("No particle systems to save.");
|
|
5068
5057
|
return;
|
|
@@ -5071,12 +5060,12 @@ async function hr(s, t, e = "hzfx") {
|
|
|
5071
5060
|
const i = {
|
|
5072
5061
|
version: "1.0",
|
|
5073
5062
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5074
|
-
systems: s.particleSystems.map(({ config: u, system:
|
|
5075
|
-
...
|
|
5063
|
+
systems: s.particleSystems.map(({ config: u, system: m }) => ({
|
|
5064
|
+
...ur(u),
|
|
5076
5065
|
// single source of truth for config fields
|
|
5077
5066
|
// Binary assets embedded so replaceSystems() can restore them
|
|
5078
5067
|
textureImageData: u.textureEnabled && !u.glbModelEnabled && u.textureImageData ? u.textureImageData : void 0,
|
|
5079
|
-
glbModelData: u.glbModelEnabled &&
|
|
5068
|
+
glbModelData: u.glbModelEnabled && m.glbRawArrayBuffer ? cr(m.glbRawArrayBuffer) : void 0
|
|
5080
5069
|
})),
|
|
5081
5070
|
activeSystemIndex: s.activeSystemIndex,
|
|
5082
5071
|
loop: s.loop || !1
|
|
@@ -5084,7 +5073,7 @@ async function hr(s, t, e = "hzfx") {
|
|
|
5084
5073
|
}, r = e === "json" ? "json" : "hzfx";
|
|
5085
5074
|
let n;
|
|
5086
5075
|
if (r === "hzfx") {
|
|
5087
|
-
const u = await
|
|
5076
|
+
const u = await lr(i, { textureFormat: "webp" });
|
|
5088
5077
|
n = new Blob([u], { type: "application/octet-stream" });
|
|
5089
5078
|
} else
|
|
5090
5079
|
n = new Blob([JSON.stringify(i, null, 2)], { type: "application/json" });
|
|
@@ -5101,7 +5090,7 @@ async function hr(s, t, e = "hzfx") {
|
|
|
5101
5090
|
console.error("Error saving scene:", i), alert("Error saving scene. See console for details.");
|
|
5102
5091
|
}
|
|
5103
5092
|
}
|
|
5104
|
-
function
|
|
5093
|
+
function Sr(s) {
|
|
5105
5094
|
return new Promise((t, e) => {
|
|
5106
5095
|
try {
|
|
5107
5096
|
const i = s.target.files[0];
|
|
@@ -5114,7 +5103,7 @@ function mr(s) {
|
|
|
5114
5103
|
try {
|
|
5115
5104
|
const a = n.target.result;
|
|
5116
5105
|
let o;
|
|
5117
|
-
if (
|
|
5106
|
+
if (Ti(a) ? o = Ei(a) : o = JSON.parse(new TextDecoder().decode(a)), !Array.isArray(o.systems) || o.systems.length === 0)
|
|
5118
5107
|
throw new Error("No valid particle systems found in the file");
|
|
5119
5108
|
t({
|
|
5120
5109
|
systems: o.systems.slice(),
|
|
@@ -5132,7 +5121,7 @@ function mr(s) {
|
|
|
5132
5121
|
}
|
|
5133
5122
|
});
|
|
5134
5123
|
}
|
|
5135
|
-
async function
|
|
5124
|
+
async function xr(s) {
|
|
5136
5125
|
if (!s || typeof s != "string")
|
|
5137
5126
|
throw new Error("[fetchPreset] url must be a non-empty string");
|
|
5138
5127
|
const t = await fetch(s);
|
|
@@ -5140,7 +5129,7 @@ async function yr(s) {
|
|
|
5140
5129
|
throw new Error(`[fetchPreset] HTTP ${t.status}: ${t.statusText}`);
|
|
5141
5130
|
const e = await t.arrayBuffer();
|
|
5142
5131
|
let i;
|
|
5143
|
-
if (
|
|
5132
|
+
if (Ti(e) ? i = Ei(e) : i = JSON.parse(new TextDecoder().decode(e)), !Array.isArray(i.systems) || i.systems.length === 0)
|
|
5144
5133
|
throw new Error('[fetchPreset] Invalid preset: "systems" must be a non-empty array');
|
|
5145
5134
|
return {
|
|
5146
5135
|
version: i.version,
|
|
@@ -5148,7 +5137,7 @@ async function yr(s) {
|
|
|
5148
5137
|
activeSystemIndex: i.activeSystemIndex ?? 0
|
|
5149
5138
|
};
|
|
5150
5139
|
}
|
|
5151
|
-
const
|
|
5140
|
+
const dr = (s) => `
|
|
5152
5141
|
@vertex fn vs(@builtin(vertex_index) i: u32) -> @builtin(position) vec4f {
|
|
5153
5142
|
var p = array<vec2f, 3>(vec2f(-1.0, -3.0), vec2f(-1.0, 1.0), vec2f(3.0, 1.0));
|
|
5154
5143
|
return vec4f(p[i], 0.0, 1.0);
|
|
@@ -5158,51 +5147,51 @@ const or = (s) => `
|
|
|
5158
5147
|
return textureLoad(src, vec2i(pos.xy), 0);
|
|
5159
5148
|
}
|
|
5160
5149
|
`;
|
|
5161
|
-
async function
|
|
5150
|
+
async function vr(s, t = {}) {
|
|
5162
5151
|
const { getSceneDepth: e = null, autoRespawn: i = !0 } = t;
|
|
5163
5152
|
let r, n, a;
|
|
5164
5153
|
const o = !!(s && s.device && s.context);
|
|
5165
|
-
o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await
|
|
5166
|
-
const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new
|
|
5167
|
-
function
|
|
5168
|
-
const
|
|
5169
|
-
if (!u.pipelines[
|
|
5170
|
-
const
|
|
5154
|
+
o ? ({ device: r, context: n, canvas: a } = s, a || (a = n.canvas)) : (a = s, { device: r, context: n } = await Js(a));
|
|
5155
|
+
const c = navigator.gpu.getPreferredCanvasFormat(), l = t.manager || new Ws(r), u = { layouts: {}, pipelines: {} };
|
|
5156
|
+
function m(f) {
|
|
5157
|
+
const h = f ? "ms" : "ss";
|
|
5158
|
+
if (!u.pipelines[h]) {
|
|
5159
|
+
const S = r.createShaderModule({ code: dr(f) }), g = r.createBindGroupLayout({
|
|
5171
5160
|
entries: [{ binding: 0, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: "depth", multisampled: f } }]
|
|
5172
5161
|
});
|
|
5173
|
-
u.layouts[
|
|
5162
|
+
u.layouts[h] = g, u.pipelines[h] = r.createRenderPipeline({
|
|
5174
5163
|
layout: r.createPipelineLayout({ bindGroupLayouts: [g] }),
|
|
5175
|
-
vertex: { module:
|
|
5176
|
-
fragment: { module:
|
|
5164
|
+
vertex: { module: S, entryPoint: "vs" },
|
|
5165
|
+
fragment: { module: S, entryPoint: "fs", targets: [] },
|
|
5177
5166
|
primitive: { topology: "triangle-list" },
|
|
5178
5167
|
depthStencil: { format: "depth24plus", depthWriteEnabled: !0, depthCompare: "always" }
|
|
5179
5168
|
});
|
|
5180
5169
|
}
|
|
5181
|
-
return { pipeline: u.pipelines[
|
|
5170
|
+
return { pipeline: u.pipelines[h], layout: u.layouts[h] };
|
|
5182
5171
|
}
|
|
5183
5172
|
const p = {
|
|
5184
5173
|
bloomSourceTextures: {},
|
|
5185
5174
|
bloomCompositeTextures: {},
|
|
5186
5175
|
combinedTexture: null,
|
|
5187
|
-
getBloomSourceTexture(f,
|
|
5176
|
+
getBloomSourceTexture(f, h, S) {
|
|
5188
5177
|
return this.bloomSourceTextures[f] || (this.bloomSourceTextures[f] = r.createTexture({
|
|
5189
|
-
size: [
|
|
5178
|
+
size: [h, S],
|
|
5190
5179
|
format: "rgba16float",
|
|
5191
5180
|
// HDR chain (see webgpu.js HDR_FORMAT) — avoids additive clip
|
|
5192
5181
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
5193
5182
|
})), this.bloomSourceTextures[f];
|
|
5194
5183
|
},
|
|
5195
|
-
getBloomCompositeTexture(f,
|
|
5184
|
+
getBloomCompositeTexture(f, h, S) {
|
|
5196
5185
|
return this.bloomCompositeTextures[f] || (this.bloomCompositeTextures[f] = r.createTexture({
|
|
5197
|
-
size: [
|
|
5186
|
+
size: [h, S],
|
|
5198
5187
|
format: "rgba16float",
|
|
5199
5188
|
// HDR chain
|
|
5200
5189
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
5201
5190
|
})), this.bloomCompositeTextures[f];
|
|
5202
5191
|
},
|
|
5203
|
-
getCombinedTexture(f,
|
|
5192
|
+
getCombinedTexture(f, h) {
|
|
5204
5193
|
return this.combinedTexture || (this.combinedTexture = r.createTexture({
|
|
5205
|
-
size: [f,
|
|
5194
|
+
size: [f, h],
|
|
5206
5195
|
format: "rgba16float",
|
|
5207
5196
|
// HDR chain — tonemapped to canvas in the final pass
|
|
5208
5197
|
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING
|
|
@@ -5227,166 +5216,166 @@ async function gr(s, t = {}) {
|
|
|
5227
5216
|
clear() {
|
|
5228
5217
|
this.systemBindGroups = {}, this.systemBloomHorizontalBindGroups = {}, this.secondHorizontalBindGroups = {}, this.systemBloomCompositeBindGroups = {}, this.combinedBloomCompositeBindGroups = {}, this.combinedInitialBindGroup = null, this.finalBindGroup = null, this.textureStates = {}, this.textureRefs = {};
|
|
5229
5218
|
}
|
|
5230
|
-
},
|
|
5219
|
+
}, b = r.createBuffer({ size: 96, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), w = r.createBuffer({ size: 208, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), M = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), R = r.createBuffer({ size: 32, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), x = r.createBuffer({ size: 64, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST }), L = Ge(r, new Uint16Array([0, 1, 2, 0, 2, 3]), GPUBufferUsage.INDEX), P = {}, T = () => Ge(r, new Float32Array([-0.5, -0.5, 0, 0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, 0.5, 0]), GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST);
|
|
5231
5220
|
l.onSystemCreated = (f) => {
|
|
5232
|
-
P[f] || (P[f] =
|
|
5221
|
+
P[f] || (P[f] = T());
|
|
5233
5222
|
};
|
|
5234
|
-
const
|
|
5235
|
-
function
|
|
5236
|
-
for (const
|
|
5223
|
+
const E = 4e4, F = new Float32Array(E * 8), k = new Float32Array(E * 4), Y = new Float32Array(E * 4), N = r.createBuffer({ size: E * 8 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), G = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), de = r.createBuffer({ size: E * 4 * 4, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST }), De = /* @__PURE__ */ new Map(), ct = 8, W = [];
|
|
5224
|
+
function Mt(f) {
|
|
5225
|
+
for (const h of W) if (h.ids.has(f)) return h;
|
|
5237
5226
|
return null;
|
|
5238
5227
|
}
|
|
5239
|
-
function
|
|
5228
|
+
function Ci(f, h) {
|
|
5240
5229
|
if (!f.pos) return;
|
|
5241
|
-
f.hist.push({ t:
|
|
5242
|
-
const
|
|
5243
|
-
for (; f.hist.length > 2 && f.hist[0].t <
|
|
5230
|
+
f.hist.push({ t: h, x: f.pos[0], y: f.pos[1], z: f.pos[2] });
|
|
5231
|
+
const S = h - ct;
|
|
5232
|
+
for (; f.hist.length > 2 && f.hist[0].t < S; ) f.hist.shift();
|
|
5244
5233
|
}
|
|
5245
|
-
function
|
|
5234
|
+
function Rt(f, h, S) {
|
|
5246
5235
|
const g = f.hist;
|
|
5247
5236
|
if (g.length === 0) {
|
|
5248
5237
|
const H = f.pos;
|
|
5249
|
-
return H && (
|
|
5238
|
+
return H && (S[0] = H[0], S[1] = H[1], S[2] = H[2]), S;
|
|
5250
5239
|
}
|
|
5251
5240
|
let v;
|
|
5252
|
-
if (
|
|
5253
|
-
return v = g[g.length - 1],
|
|
5254
|
-
if (
|
|
5255
|
-
return v = g[0],
|
|
5241
|
+
if (h >= g[g.length - 1].t)
|
|
5242
|
+
return v = g[g.length - 1], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
|
|
5243
|
+
if (h <= g[0].t)
|
|
5244
|
+
return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
|
|
5256
5245
|
for (let H = g.length - 1; H > 0; H--)
|
|
5257
|
-
if (g[H - 1].t <=
|
|
5258
|
-
const j = g[H - 1], Q = g[H], Z = (
|
|
5259
|
-
return
|
|
5246
|
+
if (g[H - 1].t <= h) {
|
|
5247
|
+
const j = g[H - 1], Q = g[H], Z = (h - j.t) / Math.max(1e-6, Q.t - j.t);
|
|
5248
|
+
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;
|
|
5260
5249
|
}
|
|
5261
|
-
return v = g[0],
|
|
5250
|
+
return v = g[0], S[0] = v.x, S[1] = v.y, S[2] = v.z, S;
|
|
5262
5251
|
}
|
|
5263
|
-
const
|
|
5264
|
-
function
|
|
5252
|
+
const Ai = 0.41421356;
|
|
5253
|
+
function Ui() {
|
|
5265
5254
|
De.clear();
|
|
5266
|
-
let f = 0,
|
|
5255
|
+
let f = 0, h = 0;
|
|
5267
5256
|
A.position[0], A.position[1], A.position[2];
|
|
5268
|
-
for (const { system:
|
|
5257
|
+
for (const { system: S, config: g } of l.particleSystems) {
|
|
5269
5258
|
if (!g.emissionTrailEnabled || g.hidden || g.glbModelEnabled) continue;
|
|
5270
|
-
|
|
5271
|
-
const v =
|
|
5259
|
+
S.readbackAndProcessParticles();
|
|
5260
|
+
const v = S.particleData, H = S.particleVelocities, j = S.activeParticles;
|
|
5272
5261
|
if (!v || !H || j <= 0) continue;
|
|
5273
|
-
const Q = g.emissionTrailMode === "particles", Z = f, Ae = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1,
|
|
5274
|
-
for (let
|
|
5275
|
-
const
|
|
5276
|
-
let
|
|
5277
|
-
const Ne = v[
|
|
5262
|
+
const Q = g.emissionTrailMode === "particles", Z = f, Ae = g.emissionTrailDuration ?? 1, y = g.opacity ?? 1, B = g.particleSize ?? 0.5, U = g.bloomIntensity || 1, I = Math.max(1, Math.min(64, g.emissionTrailSegments ?? 8)), D = g.emissionTrailShape || "straight", J = g.followSystemTranslation ?? !0, K = S._simPosition, X = J && K ? K[0] : 0, it = J && K ? K[1] : 0, jt = J && K ? K[2] : 0, Ue = S._simVelocity, Yt = Ue ? Ue[0] : 0, rs = Ue ? Ue[1] : 0, Ht = Ue ? Ue[2] : 0, Oe = Mt(g.id), qt = !!(J && Oe && Oe.hist && Oe.hist.length > 1);
|
|
5263
|
+
for (let st = 0; st < j; st++) {
|
|
5264
|
+
const he = st * 8, rt = v[he], mt = v[he + 1], nt = v[he + 2], ns = rt + X, as = mt + it, os = nt + jt;
|
|
5265
|
+
let Le = v[he + 3], Xe = v[he + 4], ke = v[he + 5];
|
|
5266
|
+
const Ne = v[he + 6], Ie = v[he + 7];
|
|
5278
5267
|
if (Ne >= Ie || Ie <= 0) continue;
|
|
5279
|
-
const
|
|
5268
|
+
const me = Ne / Ie;
|
|
5280
5269
|
if (g.colorTransitionEnabled) {
|
|
5281
5270
|
const _ = g.startColor ?? [1, 0, 0], z = g.endColor ?? [0, 0, 1];
|
|
5282
|
-
|
|
5271
|
+
Le = _[0] + (z[0] - _[0]) * me, Xe = _[1] + (z[1] - _[1]) * me, ke = _[2] + (z[2] - _[2]) * me;
|
|
5283
5272
|
}
|
|
5284
|
-
|
|
5285
|
-
let
|
|
5273
|
+
Le = Math.min(1, Le * U), Xe = Math.min(1, Xe * U), ke = Math.min(1, ke * U);
|
|
5274
|
+
let je = B;
|
|
5286
5275
|
if (g.randomSize) {
|
|
5287
5276
|
const _ = Math.sin(Ie * 54321.67) * 43758.5453 % 1, z = _ < 0 ? _ + 1 : _;
|
|
5288
|
-
|
|
5277
|
+
je = (g.minSize ?? 0.1) + ((g.maxSize ?? 0.5) - (g.minSize ?? 0.1)) * z;
|
|
5289
5278
|
}
|
|
5290
5279
|
if (g.fadeSizeEnabled) {
|
|
5291
5280
|
const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
|
|
5292
|
-
|
|
5281
|
+
je *= 1 - Math.pow(me, 1 / _);
|
|
5293
5282
|
}
|
|
5294
5283
|
if (g.increaseSizeEnabled) {
|
|
5295
5284
|
const _ = Math.max(0.01, Math.min(10, g.sizeLifetimeSpeed ?? 1));
|
|
5296
|
-
|
|
5285
|
+
je *= 1 + Math.pow(me, 1 / _);
|
|
5297
5286
|
}
|
|
5298
|
-
if (
|
|
5299
|
-
const
|
|
5300
|
-
let
|
|
5301
|
-
if (g.fadeEnabled && (
|
|
5302
|
-
const
|
|
5303
|
-
if (
|
|
5304
|
-
const
|
|
5305
|
-
let
|
|
5306
|
-
if (
|
|
5307
|
-
const _ = A.up[0], z = A.up[1], $ = A.up[2], V = _ *
|
|
5308
|
-
|
|
5287
|
+
if (je <= 0 || me > 0.9) continue;
|
|
5288
|
+
const Zt = Math.min((0.9 - me) * (1 / 0.2), 1), $t = 0.75 * je * Ai * Zt;
|
|
5289
|
+
let Ye = y;
|
|
5290
|
+
if (g.fadeEnabled && (Ye *= Math.max(0, 1 - me)), Ye *= Zt, Ye < 0.01) continue;
|
|
5291
|
+
const yt = st * 4, Wt = H[yt], Jt = H[yt + 1], Qt = H[yt + 2], at = Wt + Yt, ot = Jt + rs, lt = Qt + Ht, Kt = Math.sqrt(at * at + ot * ot + lt * lt);
|
|
5292
|
+
if (Kt < 1e-3) continue;
|
|
5293
|
+
const gt = 1 / Kt, ve = at * gt, Pe = ot * gt, ye = lt * gt, ei = A.right[0], ti = A.right[1], ii = A.right[2];
|
|
5294
|
+
let bt = ei * ve + ti * Pe + ii * ye, re = ei - bt * ve, ne = ti - bt * Pe, ae = ii - bt * ye, He = Math.sqrt(re * re + ne * ne + ae * ae);
|
|
5295
|
+
if (He < 0.2) {
|
|
5296
|
+
const _ = A.up[0], z = A.up[1], $ = A.up[2], V = _ * ve + z * Pe + $ * ye;
|
|
5297
|
+
re = _ - V * ve, ne = z - V * Pe, ae = $ - V * ye, He = Math.sqrt(re * re + ne * ne + ae * ae) || 1;
|
|
5309
5298
|
}
|
|
5310
|
-
|
|
5311
|
-
const
|
|
5312
|
-
if (
|
|
5313
|
-
const
|
|
5314
|
-
if (g.orientToDirection && g.burstMode &&
|
|
5315
|
-
const _ =
|
|
5299
|
+
re /= He, ne /= He, ae /= He;
|
|
5300
|
+
const qe = Math.min(Ae, Ne);
|
|
5301
|
+
if (qe < 1e-3) continue;
|
|
5302
|
+
const si = g.gravityEnabled && g.gravityStrength || 0, _e = ki, we = Ni, Be = ji;
|
|
5303
|
+
if (g.orientToDirection && g.burstMode && qt) {
|
|
5304
|
+
const _ = S._emitSimRotY || 0, z = Yi, $ = Hi, V = qi;
|
|
5316
5305
|
for (let C = 0; C <= I; C++) {
|
|
5317
|
-
const O =
|
|
5306
|
+
const O = Rt(Oe, pe - C / I * qe, Vt);
|
|
5318
5307
|
z[C] = O[0], $[C] = O[1], V[C] = O[2];
|
|
5319
5308
|
}
|
|
5320
5309
|
for (let C = 0; C <= I; C++) {
|
|
5321
5310
|
const O = C > 0 ? C - 1 : 0, q = C < I ? C + 1 : I;
|
|
5322
|
-
let
|
|
5323
|
-
const
|
|
5324
|
-
|
|
5311
|
+
let Me = z[O] - z[q], Re = V[O] - V[q];
|
|
5312
|
+
const ge = (Math.hypot(Me, Re) > 1e-5 ? Math.atan2(Me, Re) : Math.atan2(Yt, Ht)) - _, te = Math.cos(ge), ie = Math.sin(ge), ue = C / I * qe, St = -0.5 * si * ue * ue;
|
|
5313
|
+
_e[C] = te * rt + ie * nt + z[C], we[C] = mt + St + $[C], Be[C] = -ie * rt + te * nt + V[C];
|
|
5325
5314
|
}
|
|
5326
5315
|
} else for (let _ = 0; _ <= I; _++) {
|
|
5327
|
-
const z = _ / I *
|
|
5328
|
-
if (
|
|
5329
|
-
const V =
|
|
5330
|
-
|
|
5316
|
+
const z = _ / I * qe, $ = -0.5 * si * z * z;
|
|
5317
|
+
if (qt) {
|
|
5318
|
+
const V = Rt(Oe, pe - z, Vt);
|
|
5319
|
+
_e[_] = rt - Wt * z + V[0], we[_] = mt - Jt * z + $ + V[1], Be[_] = nt - Qt * z + V[2];
|
|
5331
5320
|
} else
|
|
5332
|
-
|
|
5321
|
+
_e[_] = ns - at * z, we[_] = as - ot * z + $, Be[_] = os - lt * z;
|
|
5333
5322
|
}
|
|
5334
5323
|
if (D !== "straight") {
|
|
5335
5324
|
const _ = g.emissionTrailShapeAmplitude ?? 0.1, z = g.emissionTrailShapeFrequency ?? 4, $ = g.emissionTrailShapeSpeed ?? 0;
|
|
5336
|
-
let V = -
|
|
5337
|
-
q < 1e-6 && (V = 0, C =
|
|
5338
|
-
const
|
|
5325
|
+
let V = -ye, C = 0, O = ve, q = Math.sqrt(V * V + O * O);
|
|
5326
|
+
q < 1e-6 && (V = 0, C = ye, O = -Pe, q = Math.sqrt(V * V + C * C + O * O) || 1), V /= q, C /= q, O /= q;
|
|
5327
|
+
const Me = Pe * O - ye * C, Re = ye * V - ve * O, ce = ve * C - Pe * V;
|
|
5339
5328
|
for (let ee = 1; ee <= I; ee++) {
|
|
5340
|
-
const
|
|
5341
|
-
let
|
|
5342
|
-
D === "zigzag" ?
|
|
5329
|
+
const ge = ee / I * qe, te = 2 * Math.PI * z * (pe - ge) + $ * pe;
|
|
5330
|
+
let ie = 0, ue = 0;
|
|
5331
|
+
D === "zigzag" ? ie = _ * Math.sign(Math.sin(te)) : D === "sine" ? ie = _ * Math.sin(te) : D === "spiral" && (ie = _ * Math.sin(te), ue = _ * Math.cos(te)), _e[ee] += V * ie + Me * ue, we[ee] += C * ie + Re * ue, Be[ee] += O * ie + ce * ue;
|
|
5343
5332
|
}
|
|
5344
5333
|
}
|
|
5345
5334
|
if (Q)
|
|
5346
|
-
for (let _ = 1; _ <= I && f <
|
|
5347
|
-
const z = _ / I, $ =
|
|
5348
|
-
F[O] = $, F[O + 1] = V, F[O + 2] = C, F[O + 3] =
|
|
5335
|
+
for (let _ = 1; _ <= I && f < E; _++) {
|
|
5336
|
+
const z = _ / I, $ = _e[_] - X, V = we[_] - it, C = Be[_] - jt, O = f * 8, q = f * 4;
|
|
5337
|
+
F[O] = $, F[O + 1] = V, F[O + 2] = C, F[O + 3] = Le, F[O + 4] = Xe, F[O + 5] = ke, F[O + 6] = Ne + (Ie - Ne) * z, F[O + 7] = Ie, k[q] = 0, k[q + 1] = 0, k[q + 2] = 0, k[q + 3] = 0, Y[q] = $, Y[q + 1] = V, Y[q + 2] = C, Y[q + 3] = 0, f++;
|
|
5349
5338
|
}
|
|
5350
5339
|
else
|
|
5351
|
-
for (let _ = 0; _ < I && !(
|
|
5352
|
-
const z = _ / I, $ = (_ + 1) / I, V =
|
|
5353
|
-
|
|
5340
|
+
for (let _ = 0; _ < I && !(h + 42 > le.length); _++) {
|
|
5341
|
+
const z = _ / I, $ = (_ + 1) / I, V = _e[_], C = we[_], O = Be[_], q = _e[_ + 1], Me = we[_ + 1], Re = Be[_ + 1], ce = $t * (1 - z), ee = $t * (1 - $), ge = Ye * (1 - z) * (1 - z), te = Ye * (1 - $) * (1 - $), ie = V + re * ce, ue = C + ne * ce, St = O + ae * ce, ri = V - re * ce, ni = C - ne * ce, ai = O - ae * ce, oi = q + re * ee, li = Me + ne * ee, ci = Re + ae * ee, ls = q - re * ee, cs = Me - ne * ee, us = Re - ae * ee, ze = (ds, fs, ps, hs) => {
|
|
5342
|
+
le[h++] = ds, le[h++] = fs, le[h++] = ps, le[h++] = Le, le[h++] = Xe, le[h++] = ke, le[h++] = hs;
|
|
5354
5343
|
};
|
|
5355
|
-
ze(
|
|
5344
|
+
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);
|
|
5356
5345
|
}
|
|
5357
5346
|
}
|
|
5358
5347
|
Q && f > Z && De.set(g.id, { first: Z, count: f - Z });
|
|
5359
5348
|
}
|
|
5360
|
-
f > 0 && (r.queue.writeBuffer(
|
|
5349
|
+
f > 0 && (r.queue.writeBuffer(N, 0, F, 0, f * 8), r.queue.writeBuffer(G, 0, k, 0, f * 4), r.queue.writeBuffer(de, 0, Y, 0, f * 4)), Fe = h / 7, Fe > 0 && r.queue.writeBuffer(zt, 0, le, 0, h);
|
|
5361
5350
|
}
|
|
5362
|
-
const
|
|
5363
|
-
r.queue.writeBuffer(
|
|
5351
|
+
const Tt = () => {
|
|
5352
|
+
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]));
|
|
5364
5353
|
};
|
|
5365
|
-
|
|
5366
|
-
const
|
|
5367
|
-
|
|
5368
|
-
const
|
|
5369
|
-
particlePipeline:
|
|
5370
|
-
particleAdditivePipeline:
|
|
5371
|
-
particleDepthWritePipeline:
|
|
5372
|
-
blurPipeline:
|
|
5373
|
-
compositePipeline:
|
|
5374
|
-
directRenderPipeline:
|
|
5375
|
-
finalCompositePipeline:
|
|
5376
|
-
glbMeshPipeline:
|
|
5377
|
-
} =
|
|
5354
|
+
Tt();
|
|
5355
|
+
const Et = new Float32Array(16).fill(0);
|
|
5356
|
+
Et[0] = 1, r.queue.writeBuffer(x, 0, Et);
|
|
5357
|
+
const se = ir(r), fe = er(r), {
|
|
5358
|
+
particlePipeline: Ii,
|
|
5359
|
+
particleAdditivePipeline: zi,
|
|
5360
|
+
particleDepthWritePipeline: Gi,
|
|
5361
|
+
blurPipeline: We,
|
|
5362
|
+
compositePipeline: Di,
|
|
5363
|
+
directRenderPipeline: Ct,
|
|
5364
|
+
finalCompositePipeline: Fi,
|
|
5365
|
+
glbMeshPipeline: Vi
|
|
5366
|
+
} = tr(r, c, fe), At = r.createShaderModule({ code: `
|
|
5378
5367
|
struct U { mvp: mat4x4<f32> };
|
|
5379
5368
|
@group(0) @binding(0) var<uniform> u: U;
|
|
5380
5369
|
struct VIn { @location(0) pos: vec3<f32>, @location(1) col: vec4<f32> };
|
|
5381
5370
|
struct VOut { @builtin(position) pos: vec4<f32>, @location(0) col: vec4<f32> };
|
|
5382
5371
|
@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; }
|
|
5383
5372
|
@fragment fn fs(i: VOut) -> @location(0) vec4<f32> { return i.col; }
|
|
5384
|
-
` }),
|
|
5373
|
+
` }), Ut = r.createBindGroupLayout({
|
|
5385
5374
|
entries: [{ binding: 0, visibility: GPUShaderStage.VERTEX, buffer: { type: "uniform" } }]
|
|
5386
|
-
}),
|
|
5387
|
-
layout: r.createPipelineLayout({ bindGroupLayouts: [
|
|
5375
|
+
}), Oi = r.createRenderPipeline({
|
|
5376
|
+
layout: r.createPipelineLayout({ bindGroupLayouts: [Ut] }),
|
|
5388
5377
|
vertex: {
|
|
5389
|
-
module:
|
|
5378
|
+
module: At,
|
|
5390
5379
|
entryPoint: "vs",
|
|
5391
5380
|
buffers: [{ arrayStride: 28, attributes: [
|
|
5392
5381
|
{ shaderLocation: 0, offset: 0, format: "float32x3" },
|
|
@@ -5394,7 +5383,7 @@ async function gr(s, t = {}) {
|
|
|
5394
5383
|
] }]
|
|
5395
5384
|
},
|
|
5396
5385
|
fragment: {
|
|
5397
|
-
module:
|
|
5386
|
+
module: At,
|
|
5398
5387
|
entryPoint: "fs",
|
|
5399
5388
|
targets: [{ format: "rgba16float", blend: {
|
|
5400
5389
|
// renders into the HDR sceneTexture
|
|
@@ -5406,17 +5395,22 @@ async function gr(s, t = {}) {
|
|
|
5406
5395
|
// depth24plus to match the non-bloom pass; test against the resolved scene depth
|
|
5407
5396
|
// (occlusion) but don't write (transparent ribbon).
|
|
5408
5397
|
depthStencil: { format: "depth24plus", depthWriteEnabled: !1, depthCompare: "less-equal" }
|
|
5409
|
-
}),
|
|
5410
|
-
size:
|
|
5398
|
+
}), It = 512 * 64 * 6, le = new Float32Array(It * 7), zt = r.createBuffer({
|
|
5399
|
+
size: It * 7 * 4,
|
|
5411
5400
|
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
5412
5401
|
label: "ribbonBuffer"
|
|
5413
|
-
}),
|
|
5414
|
-
layout:
|
|
5415
|
-
entries: [{ binding: 0, resource: { buffer:
|
|
5402
|
+
}), Li = r.createBindGroup({
|
|
5403
|
+
layout: Ut,
|
|
5404
|
+
entries: [{ binding: 0, resource: { buffer: b } }]
|
|
5416
5405
|
});
|
|
5417
|
-
let Fe = 0, { sceneTexture:
|
|
5418
|
-
const
|
|
5419
|
-
|
|
5406
|
+
let Fe = 0, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe } = yi(r, c, a.width, a.height), Je = gi(r, a.width, a.height), Te, Gt, Qe, Ve;
|
|
5407
|
+
const Dt = () => {
|
|
5408
|
+
const f = (h) => h.createView();
|
|
5409
|
+
Te = f(be), Gt = f(Se), Qe = f(xe), Ve = f(Je);
|
|
5410
|
+
};
|
|
5411
|
+
Dt();
|
|
5412
|
+
const ut = { uniformBuffer: b, appearanceUniformBuffer: w, horizontalBlurUniformBuffer: M, verticalBlurUniformBuffer: R, bloomIntensityBuffer: x };
|
|
5413
|
+
let Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
|
|
5420
5414
|
const A = {
|
|
5421
5415
|
mvp: new Float32Array(16),
|
|
5422
5416
|
position: new Float32Array([0, 0, 10]),
|
|
@@ -5425,67 +5419,67 @@ async function gr(s, t = {}) {
|
|
|
5425
5419
|
up: new Float32Array([0, 1, 0]),
|
|
5426
5420
|
hasCamera: !1
|
|
5427
5421
|
};
|
|
5428
|
-
let
|
|
5429
|
-
const Ee = new Float32Array(5),
|
|
5430
|
-
let
|
|
5431
|
-
function
|
|
5432
|
-
const f = [
|
|
5433
|
-
|
|
5434
|
-
let
|
|
5422
|
+
let pe = 0, Xi = 0;
|
|
5423
|
+
const Ee = new Float32Array(5), Ft = new Float32Array(16), ki = new Array(65), Ni = new Array(65), ji = new Array(65), Yi = new Array(65), Hi = new Array(65), qi = new Array(65), Vt = [0, 0, 0], Ce = { key: null, ms: !1, bindGroup: null };
|
|
5424
|
+
let Ot = !1, dt = !0, et = !1, tt = null, ft = a.width, pt = a.height;
|
|
5425
|
+
function Lt() {
|
|
5426
|
+
const f = [be, Se, xe, Je], h = yi(r, c, a.width, a.height);
|
|
5427
|
+
be = h.sceneTexture, Se = h.bloomTexA, xe = h.bloomTexB, Je = gi(r, a.width, a.height), Dt(), Tt(), d.clear(), p.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe });
|
|
5428
|
+
let S = !1;
|
|
5435
5429
|
const g = () => {
|
|
5436
|
-
if (!
|
|
5437
|
-
|
|
5430
|
+
if (!S) {
|
|
5431
|
+
S = !0, requestAnimationFrame(g);
|
|
5438
5432
|
return;
|
|
5439
5433
|
}
|
|
5440
5434
|
f.forEach((v) => v.destroy());
|
|
5441
5435
|
};
|
|
5442
5436
|
requestAnimationFrame(g);
|
|
5443
5437
|
}
|
|
5444
|
-
function
|
|
5445
|
-
A.mvp.set(
|
|
5438
|
+
function Zi(f, h, S) {
|
|
5439
|
+
A.mvp.set(ar(f, h)), h && h.length >= 10 && (A.right[0] = h[0], A.right[1] = h[4], A.right[2] = h[8], A.up[0] = h[1], A.up[1] = h[5], A.up[2] = h[9]), S && (A.position[0] = S.x ?? S[0], A.position[1] = S.y ?? S[1], A.position[2] = S.z ?? S[2]), A.hasCamera = !0;
|
|
5446
5440
|
}
|
|
5447
|
-
function
|
|
5448
|
-
A.mvp.set(f),
|
|
5441
|
+
function $i(f, h) {
|
|
5442
|
+
A.mvp.set(f), h && (A.position[0] = h.x ?? h[0], A.position[1] = h.y ?? h[1], A.position[2] = h.z ?? h[2]), A.hasCamera = !0;
|
|
5449
5443
|
}
|
|
5450
|
-
async function
|
|
5451
|
-
if (
|
|
5452
|
-
|
|
5444
|
+
async function ht(f) {
|
|
5445
|
+
if (et) {
|
|
5446
|
+
tt = f;
|
|
5453
5447
|
return;
|
|
5454
5448
|
}
|
|
5455
|
-
|
|
5449
|
+
et = !0;
|
|
5456
5450
|
try {
|
|
5457
|
-
for (const
|
|
5458
|
-
d.clear(), p.resizeTextures(),
|
|
5459
|
-
for (const
|
|
5460
|
-
await l.addSystems(
|
|
5461
|
-
for (const { config:
|
|
5462
|
-
P[
|
|
5463
|
-
|
|
5451
|
+
for (const h in P) delete P[h];
|
|
5452
|
+
d.clear(), p.resizeTextures(), Ke = Pt(r, se, ut, { sceneTexture: be, bloomTexA: Se, bloomTexB: xe }), await l.replaceSystems({ systems: [], activeSystemIndex: 0 });
|
|
5453
|
+
for (const h of f)
|
|
5454
|
+
await l.addSystems(h.preset, h.position || [0, 0, 0]);
|
|
5455
|
+
for (const { config: h } of l.particleSystems)
|
|
5456
|
+
P[h.id] || (P[h.id] = T());
|
|
5457
|
+
dt = !0, l.respawnAllSystems();
|
|
5464
5458
|
} finally {
|
|
5465
|
-
if (
|
|
5466
|
-
const
|
|
5467
|
-
|
|
5459
|
+
if (et = !1, tt) {
|
|
5460
|
+
const h = tt;
|
|
5461
|
+
tt = null, ht(h);
|
|
5468
5462
|
}
|
|
5469
5463
|
}
|
|
5470
5464
|
}
|
|
5471
|
-
async function
|
|
5472
|
-
return
|
|
5465
|
+
async function Wi(f, h = [0, 0, 0]) {
|
|
5466
|
+
return ht([{ preset: f, position: h }]);
|
|
5473
5467
|
}
|
|
5474
|
-
function
|
|
5475
|
-
if (
|
|
5476
|
-
const
|
|
5477
|
-
if (
|
|
5478
|
-
if ((a.width !==
|
|
5468
|
+
function Ji(f) {
|
|
5469
|
+
if (Ot || et || !l.ready || f <= 0 || l.particleSystems.length === 0) return;
|
|
5470
|
+
const h = l.clock;
|
|
5471
|
+
if (h && (h.loop = l.loop ?? i, h.duration = l.getTotalDuration(), f = h.tick(f)), f > 0.1 && (f = 0.1), f <= 0) return;
|
|
5472
|
+
if ((a.width !== ft || a.height !== pt) && (ft = a.width, pt = a.height, Lt()), pe += f, W.length) {
|
|
5479
5473
|
for (const y of W) {
|
|
5480
5474
|
if (y.getPosition) {
|
|
5481
|
-
const
|
|
5482
|
-
|
|
5475
|
+
const B = y.getPosition();
|
|
5476
|
+
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;
|
|
5483
5477
|
}
|
|
5484
5478
|
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);
|
|
5485
5479
|
}
|
|
5486
|
-
for (const { system: y, config:
|
|
5487
|
-
const U =
|
|
5488
|
-
if (!(!U || U.historyOnly) && (
|
|
5480
|
+
for (const { system: y, config: B } of l.particleSystems) {
|
|
5481
|
+
const U = Mt(B.id);
|
|
5482
|
+
if (!(!U || U.historyOnly) && (B.hidden = !U.pos, U.pos)) {
|
|
5489
5483
|
let I = null;
|
|
5490
5484
|
if (U.orientToDirection && U.vel) {
|
|
5491
5485
|
const D = U.vel[0], J = U.vel[2];
|
|
@@ -5495,35 +5489,35 @@ async function gr(s, t = {}) {
|
|
|
5495
5489
|
}
|
|
5496
5490
|
}
|
|
5497
5491
|
for (const y of W)
|
|
5498
|
-
y.pos ?
|
|
5499
|
-
if (globalThis.__HZFX_DEBUG && (
|
|
5500
|
-
const y = l.particleSystems.reduce((D, J) => D + (J.system.activeParticles | 0), 0),
|
|
5501
|
-
console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${Fe} camDist=${U} t=${
|
|
5492
|
+
y.pos ? Ci(y, pe) : y.hist.length = 0, y.pos ? (y._prevPosBuf[0] = y.pos[0], y._prevPosBuf[1] = y.pos[1], y._prevPosBuf[2] = y.pos[2], y.prevPos = y._prevPosBuf) : y.prevPos = null, y.wasActive = !!y.pos;
|
|
5493
|
+
if (globalThis.__HZFX_DEBUG && (Xi++ & 63) === 0) {
|
|
5494
|
+
const y = l.particleSystems.reduce((D, J) => D + (J.system.activeParticles | 0), 0), B = W.find((D) => D.pos), U = B ? Math.hypot(A.position[0] - B.pos[0], A.position[1] - B.pos[1], A.position[2] - B.pos[2]).toFixed(1) : "-", I = W.map((D) => `{ids:[${[...D.ids]}],pos:${D.pos ? "1" : "0"},hist:${D.hist.length}}`).join(",");
|
|
5495
|
+
console.info(`[HZFX] movingGroups(${W.length})=[${I}] activeParticles=${y} systems=${l.particleSystems.length} ribbonVerts=${Fe} camDist=${U} t=${pe.toFixed(1)}`);
|
|
5502
5496
|
}
|
|
5503
5497
|
}
|
|
5504
|
-
if (l.updateAllSystems(f),
|
|
5505
|
-
const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system:
|
|
5506
|
-
(
|
|
5498
|
+
if (l.updateAllSystems(f), h ? h.loop : l.loop ?? i) {
|
|
5499
|
+
const y = l.particleSystems.length > 0 && l.particleSystems.every(({ system: B }) => B.activeParticles === 0 && !B.emitting);
|
|
5500
|
+
(h && h.justLooped || y && dt) && l.respawnAllSystems(), dt = !y;
|
|
5507
5501
|
}
|
|
5508
|
-
for (const { system: y, config:
|
|
5509
|
-
|
|
5510
|
-
r.queue.writeBuffer(
|
|
5502
|
+
for (const { system: y, config: B } of l.particleSystems)
|
|
5503
|
+
B.glbModelEnabled && y.glbAnimator && (y.glbAnimator.update(f), y.updateAnimatedGLBBuffer());
|
|
5504
|
+
r.queue.writeBuffer(b, 0, A.mvp), Ee[0] = A.position[0], Ee[1] = A.position[1], Ee[2] = A.position[2], Ee[3] = a.height / Math.max(1, a.width), Ee[4] = pe, r.queue.writeBuffer(b, 64, Ee), Ui();
|
|
5511
5505
|
const g = l.particleSystems.some(({ config: y }) => y.bloomEnabled), v = r.createCommandEncoder();
|
|
5512
5506
|
let H = !1;
|
|
5513
5507
|
if (e)
|
|
5514
5508
|
try {
|
|
5515
5509
|
const y = e();
|
|
5516
5510
|
if (y) {
|
|
5517
|
-
let
|
|
5518
|
-
if (y instanceof GPUTexture ? y.width === a.width && y.height === a.height && (
|
|
5519
|
-
const { pipeline: D, layout: J } =
|
|
5520
|
-
(Ce.key !==
|
|
5511
|
+
let B = null, U = null, I = !1;
|
|
5512
|
+
if (y instanceof GPUTexture ? y.width === a.width && y.height === a.height && (B = y, U = () => y.createView({ aspect: "depth-only" }), I = y.sampleCount > 1) : y.view && (B = y.view, U = () => y.view, I = !!y.multisampled), B) {
|
|
5513
|
+
const { pipeline: D, layout: J } = m(I);
|
|
5514
|
+
(Ce.key !== B || Ce.ms !== I) && (Ce.key = B, Ce.ms = I, Ce.bindGroup = r.createBindGroup({
|
|
5521
5515
|
layout: J,
|
|
5522
5516
|
entries: [{ binding: 0, resource: U() }]
|
|
5523
5517
|
}));
|
|
5524
5518
|
const K = v.beginRenderPass({
|
|
5525
5519
|
colorAttachments: [],
|
|
5526
|
-
depthStencilAttachment: { view:
|
|
5520
|
+
depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
|
|
5527
5521
|
});
|
|
5528
5522
|
K.setPipeline(D), K.setBindGroup(0, Ce.bindGroup), K.draw(3), K.end(), H = !0;
|
|
5529
5523
|
}
|
|
@@ -5531,49 +5525,49 @@ async function gr(s, t = {}) {
|
|
|
5531
5525
|
} catch {
|
|
5532
5526
|
}
|
|
5533
5527
|
const j = v.beginRenderPass({
|
|
5534
|
-
colorAttachments: [{ view:
|
|
5535
|
-
depthStencilAttachment: H ? { view:
|
|
5528
|
+
colorAttachments: [{ view: Te, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
|
|
5529
|
+
depthStencilAttachment: H ? { view: Ve, depthLoadOp: "load", depthStoreOp: "store" } : { view: Ve, depthClearValue: 1, depthLoadOp: "clear", depthStoreOp: "store" }
|
|
5536
5530
|
});
|
|
5537
|
-
for (const { system: y, config:
|
|
5538
|
-
|
|
5539
|
-
if (Fe > 0 && (j.setPipeline(
|
|
5531
|
+
for (const { system: y, config: B } of l.particleSystems)
|
|
5532
|
+
B.bloomEnabled || B.hidden || y.activeParticles === 0 || Xt(j, y, B);
|
|
5533
|
+
if (Fe > 0 && (j.setPipeline(Oi), j.setBindGroup(0, Li), j.setVertexBuffer(0, zt), j.draw(Fe)), j.end(), g) {
|
|
5540
5534
|
const y = {
|
|
5541
|
-
colorAttachments: [{ view:
|
|
5542
|
-
},
|
|
5543
|
-
colorAttachments: [{ view:
|
|
5535
|
+
colorAttachments: [{ view: Gt, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
|
|
5536
|
+
}, B = {
|
|
5537
|
+
colorAttachments: [{ view: Qe, loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
|
|
5544
5538
|
};
|
|
5545
5539
|
for (const { system: U, config: I } of l.particleSystems) {
|
|
5546
5540
|
if (!I.bloomEnabled || I.hidden || U.activeParticles === 0) continue;
|
|
5547
5541
|
const D = U.config.id, J = p.getBloomSourceTexture(D, a.width, a.height), K = v.beginRenderPass({
|
|
5548
5542
|
colorAttachments: [{ view: J.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }],
|
|
5549
|
-
depthStencilAttachment: { view:
|
|
5543
|
+
depthStencilAttachment: { view: Ve, depthClearValue: 1, depthLoadOp: "load", depthStoreOp: "store" }
|
|
5550
5544
|
});
|
|
5551
|
-
|
|
5552
|
-
layout:
|
|
5545
|
+
Xt(K, U, I), K.end(), Ft[0] = I.bloomIntensity, r.queue.writeBuffer(x, 0, Ft), d.systemBloomHorizontalBindGroups[D] || (d.systemBloomHorizontalBindGroups[D] = r.createBindGroup({
|
|
5546
|
+
layout: fe.bloomBindGroupLayout,
|
|
5553
5547
|
entries: [
|
|
5554
|
-
{ binding: 0, resource:
|
|
5548
|
+
{ binding: 0, resource: se },
|
|
5555
5549
|
{ binding: 1, resource: J.createView() },
|
|
5556
|
-
{ binding: 2, resource: { buffer:
|
|
5550
|
+
{ binding: 2, resource: { buffer: M } }
|
|
5557
5551
|
]
|
|
5558
5552
|
}));
|
|
5559
5553
|
let X = v.beginRenderPass(y);
|
|
5560
|
-
X.setPipeline(
|
|
5561
|
-
layout:
|
|
5554
|
+
X.setPipeline(We), X.setBindGroup(0, d.systemBloomHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end(), d.secondHorizontalBindGroups[D] || (d.secondHorizontalBindGroups[D] = r.createBindGroup({
|
|
5555
|
+
layout: fe.bloomBindGroupLayout,
|
|
5562
5556
|
entries: [
|
|
5563
|
-
{ binding: 0, resource:
|
|
5564
|
-
{ binding: 1, resource:
|
|
5565
|
-
{ binding: 2, resource: { buffer:
|
|
5557
|
+
{ binding: 0, resource: se },
|
|
5558
|
+
{ binding: 1, resource: Qe },
|
|
5559
|
+
{ binding: 2, resource: { buffer: M } }
|
|
5566
5560
|
]
|
|
5567
|
-
})), X = v.beginRenderPass(y), X.setPipeline(
|
|
5568
|
-
const
|
|
5561
|
+
})), X = v.beginRenderPass(y), X.setPipeline(We), X.setBindGroup(0, d.secondHorizontalBindGroups[D]), X.draw(3), X.end(), X = v.beginRenderPass(B), X.setPipeline(We), X.setBindGroup(0, Ke.verticalBlurBindGroup), X.draw(3), X.end();
|
|
5562
|
+
const it = p.getBloomCompositeTexture(D, a.width, a.height);
|
|
5569
5563
|
X = v.beginRenderPass({
|
|
5570
|
-
colorAttachments: [{ view:
|
|
5571
|
-
}), X.setPipeline(
|
|
5572
|
-
layout:
|
|
5564
|
+
colorAttachments: [{ view: it.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
|
|
5565
|
+
}), X.setPipeline(Di), d.systemBloomCompositeBindGroups[D] || (d.systemBloomCompositeBindGroups[D] = r.createBindGroup({
|
|
5566
|
+
layout: fe.compositeBindGroupLayout,
|
|
5573
5567
|
entries: [
|
|
5574
|
-
{ binding: 0, resource:
|
|
5568
|
+
{ binding: 0, resource: se },
|
|
5575
5569
|
{ binding: 1, resource: J.createView() },
|
|
5576
|
-
{ binding: 2, resource:
|
|
5570
|
+
{ binding: 2, resource: Qe },
|
|
5577
5571
|
{ binding: 3, resource: { buffer: U.bloomIntensityBuffer } }
|
|
5578
5572
|
]
|
|
5579
5573
|
})), X.setBindGroup(0, d.systemBloomCompositeBindGroups[D]), X.draw(3), X.end();
|
|
@@ -5582,24 +5576,24 @@ async function gr(s, t = {}) {
|
|
|
5582
5576
|
const Q = p.getCombinedTexture(a.width, a.height), Z = v.beginRenderPass({
|
|
5583
5577
|
colorAttachments: [{ view: Q.createView(), loadOp: "clear", storeOp: "store", clearValue: { r: 0, g: 0, b: 0, a: 0 } }]
|
|
5584
5578
|
});
|
|
5585
|
-
Z.setPipeline(
|
|
5586
|
-
layout:
|
|
5579
|
+
Z.setPipeline(Ct), d.combinedInitialBindGroup || (d.combinedInitialBindGroup = r.createBindGroup({
|
|
5580
|
+
layout: fe.compositeBindGroupLayout,
|
|
5587
5581
|
entries: [
|
|
5588
|
-
{ binding: 0, resource:
|
|
5589
|
-
{ binding: 1, resource:
|
|
5590
|
-
{ binding: 2, resource:
|
|
5582
|
+
{ binding: 0, resource: se },
|
|
5583
|
+
{ binding: 1, resource: Te },
|
|
5584
|
+
{ binding: 2, resource: Te },
|
|
5591
5585
|
{ binding: 3, resource: { buffer: x } }
|
|
5592
5586
|
]
|
|
5593
5587
|
})), Z.setBindGroup(0, d.combinedInitialBindGroup), Z.draw(3);
|
|
5594
|
-
for (const { config: y, system:
|
|
5595
|
-
if (!y.bloomEnabled || y.hidden ||
|
|
5596
|
-
const U =
|
|
5597
|
-
Z.setPipeline(
|
|
5598
|
-
layout:
|
|
5588
|
+
for (const { config: y, system: B } of l.particleSystems) {
|
|
5589
|
+
if (!y.bloomEnabled || y.hidden || B.activeParticles === 0) continue;
|
|
5590
|
+
const U = B.config.id;
|
|
5591
|
+
Z.setPipeline(Ct), d.combinedBloomCompositeBindGroups[U] || (d.combinedBloomCompositeBindGroups[U] = r.createBindGroup({
|
|
5592
|
+
layout: fe.compositeBindGroupLayout,
|
|
5599
5593
|
entries: [
|
|
5600
|
-
{ binding: 0, resource:
|
|
5594
|
+
{ binding: 0, resource: se },
|
|
5601
5595
|
{ binding: 1, resource: p.getBloomCompositeTexture(U, a.width, a.height).createView() },
|
|
5602
|
-
{ binding: 2, resource:
|
|
5596
|
+
{ binding: 2, resource: Te },
|
|
5603
5597
|
{ binding: 3, resource: { buffer: x } }
|
|
5604
5598
|
]
|
|
5605
5599
|
})), Z.setBindGroup(0, d.combinedBloomCompositeBindGroups[U]), Z.draw(3);
|
|
@@ -5613,77 +5607,77 @@ async function gr(s, t = {}) {
|
|
|
5613
5607
|
clearValue: { r: 0, g: 0, b: 0, a: 0 }
|
|
5614
5608
|
}]
|
|
5615
5609
|
});
|
|
5616
|
-
Ae.setPipeline(
|
|
5617
|
-
layout:
|
|
5610
|
+
Ae.setPipeline(Fi), d.finalBindGroup || (d.finalBindGroup = r.createBindGroup({
|
|
5611
|
+
layout: fe.compositeBindGroupLayout,
|
|
5618
5612
|
entries: [
|
|
5619
|
-
{ binding: 0, resource:
|
|
5613
|
+
{ binding: 0, resource: se },
|
|
5620
5614
|
{ binding: 1, resource: Q.createView() },
|
|
5621
|
-
{ binding: 2, resource:
|
|
5615
|
+
{ binding: 2, resource: Te },
|
|
5622
5616
|
{ binding: 3, resource: { buffer: x } }
|
|
5623
5617
|
]
|
|
5624
5618
|
})), Ae.setBindGroup(0, d.finalBindGroup), Ae.draw(3), Ae.end(), r.queue.submit([v.finish()]);
|
|
5625
5619
|
}
|
|
5626
|
-
function
|
|
5627
|
-
const g =
|
|
5628
|
-
d.textureStates[g] =
|
|
5629
|
-
layout:
|
|
5620
|
+
function Xt(f, h, S) {
|
|
5621
|
+
const g = h.config.id, v = S.glbModelEnabled && h.glbMeshData, H = !d.systemBindGroups[g] || d.textureStates[g] !== S.textureEnabled || d.textureRefs[g] !== h.particleTexture;
|
|
5622
|
+
d.textureStates[g] = S.textureEnabled, d.textureRefs[g] = h.particleTexture, H && (d.systemBindGroups[g] = r.createBindGroup({
|
|
5623
|
+
layout: fe.particleBindGroupLayout,
|
|
5630
5624
|
entries: [
|
|
5631
|
-
{ binding: 0, resource: { buffer:
|
|
5632
|
-
{ binding: 1, resource: { buffer:
|
|
5633
|
-
{ binding: 2, resource:
|
|
5634
|
-
{ binding: 3, resource:
|
|
5625
|
+
{ binding: 0, resource: { buffer: b } },
|
|
5626
|
+
{ binding: 1, resource: { buffer: h.appearanceUniformBuffer } },
|
|
5627
|
+
{ binding: 2, resource: h.particleTexture.createView() },
|
|
5628
|
+
{ binding: 3, resource: se }
|
|
5635
5629
|
]
|
|
5636
5630
|
}));
|
|
5637
|
-
const j = d.systemBindGroups[g], Q =
|
|
5631
|
+
const j = d.systemBindGroups[g], Q = S.shapeDisplay !== !1;
|
|
5638
5632
|
if (v)
|
|
5639
|
-
Q && (f.setPipeline(
|
|
5633
|
+
Q && (f.setPipeline(Vi), f.setBindGroup(0, j), f.setVertexBuffer(0, h.glbVertexBuffer), f.setVertexBuffer(1, h.instanceBuffer), f.setVertexBuffer(2, h.velocityBuffer), f.setIndexBuffer(h.glbIndexBuffer, h.glbIndexFormat), f.drawIndexed(h.glbIndexCount, h.activeParticles));
|
|
5640
5634
|
else {
|
|
5641
|
-
f.setPipeline(
|
|
5635
|
+
f.setPipeline(S.blendMode === "additive" ? zi : Ii), f.setIndexBuffer(L, "uint16"), P[g] || (P[g] = T()), f.setVertexBuffer(0, P[g]), f.setBindGroup(0, j), Q && (f.setVertexBuffer(1, h.instanceBuffer), f.setVertexBuffer(2, h.velocityBuffer), f.setVertexBuffer(3, h.trailBuffer), f.drawIndexed(6, h.activeParticles));
|
|
5642
5636
|
const Z = De.get(g);
|
|
5643
|
-
Z && (f.setVertexBuffer(1,
|
|
5637
|
+
Z && (f.setVertexBuffer(1, N), f.setVertexBuffer(2, G), f.setVertexBuffer(3, de), f.drawIndexed(6, Z.count, 0, 0, Z.first)), Q && S.depthWriteEnabled && (f.setPipeline(Gi), f.drawIndexed(6, h.activeParticles));
|
|
5644
5638
|
}
|
|
5645
5639
|
}
|
|
5646
|
-
function
|
|
5647
|
-
|
|
5640
|
+
function Qi() {
|
|
5641
|
+
ft = a.width, pt = a.height, Lt();
|
|
5648
5642
|
}
|
|
5649
|
-
function
|
|
5643
|
+
function Ki() {
|
|
5650
5644
|
d.clear();
|
|
5651
5645
|
}
|
|
5652
|
-
function
|
|
5653
|
-
|
|
5654
|
-
|
|
5646
|
+
function es() {
|
|
5647
|
+
Ot = !0, l.destroy(), [be, Se, xe, Je].forEach((f) => f == null ? void 0 : f.destroy()), p.resizeTextures(), [
|
|
5648
|
+
b,
|
|
5649
|
+
w,
|
|
5650
|
+
M,
|
|
5655
5651
|
R,
|
|
5656
|
-
E,
|
|
5657
|
-
T,
|
|
5658
5652
|
x,
|
|
5659
5653
|
L,
|
|
5660
|
-
|
|
5654
|
+
N,
|
|
5661
5655
|
G,
|
|
5662
|
-
|
|
5656
|
+
de
|
|
5663
5657
|
].forEach((f) => f == null ? void 0 : f.destroy()), Object.values(P).forEach((f) => f == null ? void 0 : f.destroy());
|
|
5664
5658
|
}
|
|
5665
|
-
async function
|
|
5666
|
-
const
|
|
5659
|
+
async function kt(f, h) {
|
|
5660
|
+
const S = await l.addSystems(f, h);
|
|
5667
5661
|
for (const { config: g } of l.particleSystems)
|
|
5668
|
-
P[g.id] || (P[g.id] =
|
|
5669
|
-
return l.respawnAllSystems(), new Set(Array.isArray(
|
|
5662
|
+
P[g.id] || (P[g.id] = T());
|
|
5663
|
+
return l.respawnAllSystems(), new Set(Array.isArray(S) ? S : []);
|
|
5670
5664
|
}
|
|
5671
|
-
function
|
|
5672
|
-
for (const
|
|
5673
|
-
const
|
|
5674
|
-
|
|
5665
|
+
function Nt(f) {
|
|
5666
|
+
for (const h of f) {
|
|
5667
|
+
const S = l.particleSystems.findIndex((g) => g.config.id === h);
|
|
5668
|
+
S >= 0 && l.removeSystem(S);
|
|
5675
5669
|
}
|
|
5676
5670
|
}
|
|
5677
|
-
async function
|
|
5678
|
-
const
|
|
5671
|
+
async function ts(f, h = [0, 0, 0]) {
|
|
5672
|
+
const S = await kt(f, h);
|
|
5679
5673
|
return { remove() {
|
|
5680
|
-
|
|
5674
|
+
Nt(S);
|
|
5681
5675
|
} };
|
|
5682
5676
|
}
|
|
5683
|
-
async function
|
|
5684
|
-
const
|
|
5685
|
-
globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...
|
|
5686
|
-
const g = { ids:
|
|
5677
|
+
async function is(f, h = {}) {
|
|
5678
|
+
const S = await kt(f, [0, 0, 0]);
|
|
5679
|
+
globalThis.__HZFX_DEBUG && console.info(`[HZFX] addMovingEmitter: presetSystems=${(f && f.systems || []).length} newIds=[${[...S]}]`);
|
|
5680
|
+
const g = { ids: S, pos: null, hist: [], getPosition: h.getPosition || null, orientToDirection: !!h.orientToDirection, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
|
|
5687
5681
|
return W.push(g), {
|
|
5688
5682
|
setPosition(v) {
|
|
5689
5683
|
v && (g.pos = Array.isArray(v) ? [v[0], v[1], v[2]] : [v.x, v.y, v.z]);
|
|
@@ -5692,14 +5686,14 @@ async function gr(s, t = {}) {
|
|
|
5692
5686
|
g.orientToDirection = !!v;
|
|
5693
5687
|
},
|
|
5694
5688
|
remove() {
|
|
5695
|
-
|
|
5689
|
+
Nt(S);
|
|
5696
5690
|
const v = W.indexOf(g);
|
|
5697
5691
|
v >= 0 && W.splice(v, 1);
|
|
5698
5692
|
}
|
|
5699
5693
|
};
|
|
5700
5694
|
}
|
|
5701
|
-
function
|
|
5702
|
-
const g = { ids: f instanceof Set ? f : new Set(f), pos: null, hist: [], getPosition:
|
|
5695
|
+
function ss(f, h) {
|
|
5696
|
+
const g = { ids: f instanceof Set ? f : new Set(f), pos: null, hist: [], getPosition: h, historyOnly: !0, _posBuf: [0, 0, 0], _velBuf: [0, 0, 0], _prevPosBuf: [0, 0, 0] };
|
|
5703
5697
|
return W.push(g), {
|
|
5704
5698
|
remove() {
|
|
5705
5699
|
const v = W.indexOf(g);
|
|
@@ -5718,77 +5712,85 @@ async function gr(s, t = {}) {
|
|
|
5718
5712
|
manager: l,
|
|
5719
5713
|
device: r,
|
|
5720
5714
|
context: n,
|
|
5721
|
-
setCamera:
|
|
5722
|
-
setCameraMVP:
|
|
5723
|
-
setEmitters:
|
|
5724
|
-
loadPreset:
|
|
5725
|
-
addEmitter:
|
|
5726
|
-
addMovingEmitter:
|
|
5727
|
-
render:
|
|
5728
|
-
resize:
|
|
5729
|
-
clearCaches:
|
|
5730
|
-
trackHistoryGroup:
|
|
5731
|
-
destroy:
|
|
5715
|
+
setCamera: Zi,
|
|
5716
|
+
setCameraMVP: $i,
|
|
5717
|
+
setEmitters: ht,
|
|
5718
|
+
loadPreset: Wi,
|
|
5719
|
+
addEmitter: ts,
|
|
5720
|
+
addMovingEmitter: is,
|
|
5721
|
+
render: Ji,
|
|
5722
|
+
resize: Qi,
|
|
5723
|
+
clearCaches: Ki,
|
|
5724
|
+
trackHistoryGroup: ss,
|
|
5725
|
+
destroy: es
|
|
5732
5726
|
};
|
|
5733
5727
|
}
|
|
5734
|
-
function
|
|
5728
|
+
function Pr(s) {
|
|
5735
5729
|
return () => {
|
|
5736
|
-
var t, e, i, r, n, a;
|
|
5730
|
+
var t, e, i, r, n, a, o, c;
|
|
5737
5731
|
try {
|
|
5738
|
-
const
|
|
5739
|
-
if (!
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5732
|
+
const l = s.backend;
|
|
5733
|
+
if (!l) return null;
|
|
5734
|
+
const u = s.domElement.width, m = s.domElement.height, p = (typeof s._getFrameBufferTarget == "function" ? s._getFrameBufferTarget() : null) || s._frameBufferTarget || null;
|
|
5735
|
+
if (s.needsFrameBufferTarget && p) {
|
|
5736
|
+
const w = l.get(p), M = ((i = (e = (t = s._textures) == null ? void 0 : t.get) == null ? void 0 : e.call(t, p)) == null ? void 0 : i.depthTexture) || p.depthTexture, R = [
|
|
5737
|
+
(r = w == null ? void 0 : w.depthTexture) == null ? void 0 : r.texture,
|
|
5738
|
+
w == null ? void 0 : w.depthTexture,
|
|
5739
|
+
(n = w == null ? void 0 : w.depthBuffer) == null ? void 0 : n.texture,
|
|
5740
|
+
M ? (a = l.get(M)) == null ? void 0 : a.texture : null
|
|
5741
|
+
];
|
|
5742
|
+
for (const x of R)
|
|
5743
|
+
if (x && typeof x.createView == "function" && x.width === u && x.height === m) return x;
|
|
5744
|
+
return null;
|
|
5743
5745
|
}
|
|
5744
|
-
const
|
|
5745
|
-
return
|
|
5746
|
+
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;
|
|
5747
|
+
return b ? { view: b, multisampled: (s.currentSamples ?? 0) > 1 } : null;
|
|
5746
5748
|
} catch {
|
|
5747
5749
|
return null;
|
|
5748
5750
|
}
|
|
5749
5751
|
};
|
|
5750
5752
|
}
|
|
5751
5753
|
export {
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5754
|
+
Ns as GLBAnimator,
|
|
5755
|
+
js as HZClock,
|
|
5756
|
+
pr as Objects3DManager,
|
|
5757
|
+
ms as ParticleEmitter,
|
|
5758
|
+
_s as ParticlePhysics,
|
|
5759
|
+
ui as ParticleScript,
|
|
5760
|
+
vt as ParticleSystem,
|
|
5761
|
+
Ws as ParticleSystemManager,
|
|
5762
|
+
ws as ParticleTextureManager,
|
|
5763
|
+
gs as blurShader,
|
|
5764
|
+
bs as compositeShader,
|
|
5765
|
+
er as createBindGroupLayouts,
|
|
5766
|
+
Pt as createBindGroups,
|
|
5765
5767
|
Ge as createBuffer,
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5768
|
+
sr as createCubeGeometry,
|
|
5769
|
+
gi as createDepthTexture,
|
|
5770
|
+
yr as createLookAtMatrix,
|
|
5771
|
+
gr as createProjectionMatrix,
|
|
5772
|
+
tr as createRenderPipelines,
|
|
5773
|
+
yi as createRenderTextures,
|
|
5774
|
+
ir as createSampler,
|
|
5775
|
+
rr as createSphereGeometry,
|
|
5776
|
+
Ss as directRenderShader,
|
|
5777
|
+
fi as extractGLBTexture,
|
|
5778
|
+
xr as fetchPreset,
|
|
5779
|
+
Ks as glbMeshParticleShader,
|
|
5780
|
+
hr as hexToRgb,
|
|
5781
|
+
vr as initHzFxOverlay,
|
|
5782
|
+
Js as initWebGPU,
|
|
5783
|
+
Ti as isHZFX,
|
|
5784
|
+
Sr as loadScene,
|
|
5785
|
+
Pr as makeThreeSceneDepth,
|
|
5786
|
+
ar as multiplyMatrices,
|
|
5787
|
+
Qs as object3dShader,
|
|
5788
|
+
lr as packHZFX,
|
|
5789
|
+
Cs as parseGLB,
|
|
5790
|
+
vs as particlePhysicsShader,
|
|
5791
|
+
ys as particleShader,
|
|
5792
|
+
mr as rgbToHex,
|
|
5793
|
+
br as saveScene,
|
|
5794
|
+
ur as serializeSystemConfig,
|
|
5795
|
+
Ei as unpackHZFX
|
|
5794
5796
|
};
|