@adatechnology/game-vfx 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -1
- package/dist/index.global.js +210 -42
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +210 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1106,11 +1106,11 @@ var OrderedPool = class {
|
|
|
1106
1106
|
this.spare.push(record);
|
|
1107
1107
|
}
|
|
1108
1108
|
/** Keeps the records `keep` accepts, in the same order, without allocating. `context` goes to `keep` so no closure is needed per frame. */
|
|
1109
|
-
compact(
|
|
1109
|
+
compact(keep2, context) {
|
|
1110
1110
|
let write = 0;
|
|
1111
1111
|
for (let read = 0; read < this.items.length; read++) {
|
|
1112
1112
|
const record = this.items[read];
|
|
1113
|
-
if (
|
|
1113
|
+
if (keep2(record, context)) {
|
|
1114
1114
|
this.items[write++] = record;
|
|
1115
1115
|
continue;
|
|
1116
1116
|
}
|
|
@@ -1396,12 +1396,14 @@ function streamFor(eventSeed) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
1398
|
// src/solids.ts
|
|
1399
|
+
var MAX_PAD = 0.45;
|
|
1399
1400
|
var SKIN = 5e-3;
|
|
1400
1401
|
var Solids = class {
|
|
1401
1402
|
constructor() {
|
|
1402
1403
|
__publicField(this, "queries", /* @__PURE__ */ new Map());
|
|
1403
1404
|
__publicField(this, "list", []);
|
|
1404
|
-
|
|
1405
|
+
// fractions from the start: the fields hold fractions, and a field that held a whole number first boxes each fraction written to it
|
|
1406
|
+
__publicField(this, "hit", { x: 0.5, y: 0.5, z: 0.5, nx: 0.5, ny: 0.5, nz: 0.5, d: 0.5 });
|
|
1405
1407
|
}
|
|
1406
1408
|
get empty() {
|
|
1407
1409
|
return this.list.length === 0;
|
|
@@ -1417,18 +1419,19 @@ var Solids = class {
|
|
|
1417
1419
|
this.list = [];
|
|
1418
1420
|
}
|
|
1419
1421
|
/**
|
|
1420
|
-
* Stops a step that goes into a solid: `out` gets the nearest hit, put back `pad` metres off the surface (never behind where the step began) and
|
|
1422
|
+
* Stops a step that goes into a solid: `out` gets the nearest hit, put back the step's `pad` metres (at most `MAX_PAD`) off the surface (never behind where the step began) and
|
|
1421
1423
|
* the surface's normal. Answers whether the step was stopped.
|
|
1422
1424
|
*/
|
|
1423
|
-
stop(move,
|
|
1425
|
+
stop(move, out) {
|
|
1424
1426
|
const dx = move.x1 - move.x0;
|
|
1425
1427
|
const dy = move.y1 - move.y0;
|
|
1426
1428
|
const dz = move.z1 - move.z0;
|
|
1427
|
-
const length = Math.
|
|
1429
|
+
const length = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
1428
1430
|
if (!(length > 0)) return false;
|
|
1429
1431
|
let nearest = Infinity;
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
+
const list = this.list;
|
|
1433
|
+
for (let index = 0; index < list.length; index++) {
|
|
1434
|
+
if (!list[index](move, this.hit)) continue;
|
|
1432
1435
|
const reached = ((this.hit.x - move.x0) * dx + (this.hit.y - move.y0) * dy + (this.hit.z - move.z0) * dz) / length;
|
|
1433
1436
|
if (reached >= nearest) continue;
|
|
1434
1437
|
nearest = reached;
|
|
@@ -1440,17 +1443,26 @@ var Solids = class {
|
|
|
1440
1443
|
out.nz = this.hit.nz;
|
|
1441
1444
|
}
|
|
1442
1445
|
if (nearest === Infinity) return false;
|
|
1443
|
-
const
|
|
1446
|
+
const hitX2 = out.x;
|
|
1447
|
+
const hitY2 = out.y;
|
|
1448
|
+
const hitZ = out.z;
|
|
1449
|
+
out.d = out.nx * hitX2 + out.ny * hitY2 + out.nz * hitZ;
|
|
1450
|
+
const back = Math.min(Math.min(Math.max(move.pad, 0), MAX_PAD) + SKIN, Math.max(nearest, 0));
|
|
1444
1451
|
out.x -= dx / length * back;
|
|
1445
1452
|
out.y -= dy / length * back;
|
|
1446
1453
|
out.z -= dz / length * back;
|
|
1454
|
+
const off = (out.x - hitX2) * out.nx + (out.y - hitY2) * out.ny + (out.z - hitZ) * out.nz;
|
|
1455
|
+
if (off < SKIN) {
|
|
1456
|
+
out.x += out.nx * (SKIN - off);
|
|
1457
|
+
out.y += out.ny * (SKIN - off);
|
|
1458
|
+
out.z += out.nz * (SKIN - off);
|
|
1459
|
+
}
|
|
1447
1460
|
return true;
|
|
1448
1461
|
}
|
|
1449
1462
|
};
|
|
1450
1463
|
|
|
1451
1464
|
// src/enclosures.ts
|
|
1452
1465
|
var SKIN2 = 5e-3;
|
|
1453
|
-
var MAX_PAD = 0.45;
|
|
1454
1466
|
function rotation(q) {
|
|
1455
1467
|
const [x, y, z, w] = q ?? [0, 0, 0, 1];
|
|
1456
1468
|
const n = Math.hypot(x, y, z, w) || 1;
|
|
@@ -1475,7 +1487,7 @@ var Enclosures = class {
|
|
|
1475
1487
|
__publicField(this, "spaces", /* @__PURE__ */ new Map());
|
|
1476
1488
|
__publicField(this, "list", []);
|
|
1477
1489
|
__publicField(this, "random");
|
|
1478
|
-
__publicField(this, "out", { x: 0, y: 0, z: 0, nx: 0, ny: 0, nz: 0 });
|
|
1490
|
+
__publicField(this, "out", { x: 0.5, y: 0.5, z: 0.5, nx: 0.5, ny: 0.5, nz: 0.5, d: 0.5 });
|
|
1479
1491
|
__publicField(this, "l0", new Float64Array(3));
|
|
1480
1492
|
__publicField(this, "l1", new Float64Array(3));
|
|
1481
1493
|
__publicField(this, "q", new Float64Array(3));
|
|
@@ -1550,7 +1562,7 @@ var Enclosures = class {
|
|
|
1550
1562
|
}
|
|
1551
1563
|
/** Passes at `rate` per second. */
|
|
1552
1564
|
chance(rate, dt) {
|
|
1553
|
-
return rate > 0 && this.random.next() < 1 - Math.exp(-rate * dt);
|
|
1565
|
+
return rate > 0 && dt > 0 && this.random.next() < 1 - Math.exp(-rate * dt);
|
|
1554
1566
|
}
|
|
1555
1567
|
/** The opening the wall point `q` (local) is in lets it through now. */
|
|
1556
1568
|
through(s, q, dt) {
|
|
@@ -1573,7 +1585,7 @@ var Enclosures = class {
|
|
|
1573
1585
|
}
|
|
1574
1586
|
confineMove(move, dt) {
|
|
1575
1587
|
if (this.confineSpaces(move, dt)) return true;
|
|
1576
|
-
return !this.solids.empty && this.solids.stop(move,
|
|
1588
|
+
return !this.solids.empty && this.solids.stop(move, this.out);
|
|
1577
1589
|
}
|
|
1578
1590
|
confineSpaces(move, dt) {
|
|
1579
1591
|
const list = this.list;
|
|
@@ -1643,6 +1655,7 @@ var Enclosures = class {
|
|
|
1643
1655
|
out.nx = r[axis2] * sign;
|
|
1644
1656
|
out.ny = r[3 + axis2] * sign;
|
|
1645
1657
|
out.nz = r[6 + axis2] * sign;
|
|
1658
|
+
out.d = out.nx * s.cx + out.ny * s.cy + out.nz * s.cz + (in0 ? -h[axis2] : h[axis2]);
|
|
1646
1659
|
return true;
|
|
1647
1660
|
}
|
|
1648
1661
|
return false;
|
|
@@ -1661,6 +1674,129 @@ function slideAlong(out, vx2, vy2, vz2) {
|
|
|
1661
1674
|
return [vx2 - into * out.nx, vy2 - into * out.ny, vz2 - into * out.nz];
|
|
1662
1675
|
}
|
|
1663
1676
|
|
|
1677
|
+
// src/pools/puff-cuts.ts
|
|
1678
|
+
var PUFF_REACH = 1.28;
|
|
1679
|
+
var PROBES = [{ x: 1, y: 0, z: 0 }, { x: -1, y: 0, z: 0 }, { x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: -1 }, { x: 0, y: 1, z: 0 }];
|
|
1680
|
+
var PROBES_PER_SECOND = 60;
|
|
1681
|
+
var FRAMES_PER_PROBE = 3;
|
|
1682
|
+
var GROUND_FACING = 0.7;
|
|
1683
|
+
var SAME_WALL = 0.9;
|
|
1684
|
+
var PROBE = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
1685
|
+
var KeptCut = class {
|
|
1686
|
+
constructor() {
|
|
1687
|
+
__publicField(this, "on", false);
|
|
1688
|
+
__publicField(this, "nx", 0.5);
|
|
1689
|
+
__publicField(this, "ny", 0.5);
|
|
1690
|
+
__publicField(this, "nz", 0.5);
|
|
1691
|
+
__publicField(this, "d", 0.5);
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
function createCut() {
|
|
1695
|
+
return new KeptCut();
|
|
1696
|
+
}
|
|
1697
|
+
function clearCuts(puff3) {
|
|
1698
|
+
puff3.cuts[0].on = false;
|
|
1699
|
+
puff3.cuts[1].on = false;
|
|
1700
|
+
}
|
|
1701
|
+
var WrittenWay = class {
|
|
1702
|
+
constructor() {
|
|
1703
|
+
__publicField(this, "x", 0.5);
|
|
1704
|
+
__publicField(this, "y", 0.5);
|
|
1705
|
+
__publicField(this, "z", 0.5);
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
var WAY = new WrittenWay();
|
|
1709
|
+
function probe(confiner, puff3, way) {
|
|
1710
|
+
const reach = puff3.size * PUFF_REACH;
|
|
1711
|
+
if (!(reach > 0)) return false;
|
|
1712
|
+
PROBE.x0 = puff3.x;
|
|
1713
|
+
PROBE.y0 = puff3.y;
|
|
1714
|
+
PROBE.z0 = puff3.z;
|
|
1715
|
+
PROBE.x1 = puff3.x + way.x * reach;
|
|
1716
|
+
PROBE.y1 = puff3.y + way.y * reach;
|
|
1717
|
+
PROBE.z1 = puff3.z + way.z * reach;
|
|
1718
|
+
PROBE.pad = 0;
|
|
1719
|
+
return confiner.confineMove(PROBE, 0) && confiner.out.ny <= GROUND_FACING;
|
|
1720
|
+
}
|
|
1721
|
+
var isFartherFrom = (puff3, a, b) => a.nx * puff3.x + a.ny * puff3.y + a.nz * puff3.z - a.d > b.nx * puff3.x + b.ny * puff3.y + b.nz * puff3.z - b.d;
|
|
1722
|
+
var isBehind = (puff3, face) => face.nx * puff3.x + face.ny * puff3.y + face.nz * puff3.z < face.d;
|
|
1723
|
+
var sameWall = (cut, face) => cut.on && cut.nx * face.nx + cut.ny * face.ny + cut.nz * face.nz > SAME_WALL;
|
|
1724
|
+
function cutFor(puff3, face) {
|
|
1725
|
+
const first = puff3.cuts[0];
|
|
1726
|
+
const second = puff3.cuts[1];
|
|
1727
|
+
if (sameWall(first, face)) return first;
|
|
1728
|
+
if (sameWall(second, face)) return second;
|
|
1729
|
+
if (!first.on) return first;
|
|
1730
|
+
if (!second.on) return second;
|
|
1731
|
+
const farther = isFartherFrom(puff3, first, second) ? first : second;
|
|
1732
|
+
return isFartherFrom(puff3, farther, face) ? farther : void 0;
|
|
1733
|
+
}
|
|
1734
|
+
function cutAtFace(puff3, face) {
|
|
1735
|
+
if (face.ny > GROUND_FACING) return;
|
|
1736
|
+
const cut = cutFor(puff3, face);
|
|
1737
|
+
if (!cut) return;
|
|
1738
|
+
cut.on = true;
|
|
1739
|
+
cut.nx = face.nx;
|
|
1740
|
+
cut.ny = face.ny;
|
|
1741
|
+
cut.nz = face.nz;
|
|
1742
|
+
cut.d = face.d;
|
|
1743
|
+
}
|
|
1744
|
+
function cutFrom(puff3, out) {
|
|
1745
|
+
cutAtFace(puff3, out);
|
|
1746
|
+
}
|
|
1747
|
+
function cutAt(confiner, puff3, way) {
|
|
1748
|
+
if (!probe(confiner, puff3, way)) return false;
|
|
1749
|
+
cutAtFace(puff3, confiner.out);
|
|
1750
|
+
return true;
|
|
1751
|
+
}
|
|
1752
|
+
function backward(puff3) {
|
|
1753
|
+
const speed = Math.sqrt(puff3.vx * puff3.vx + puff3.vy * puff3.vy + puff3.vz * puff3.vz);
|
|
1754
|
+
if (!(speed > 0)) return null;
|
|
1755
|
+
WAY.x = -puff3.vx / speed;
|
|
1756
|
+
WAY.y = -puff3.vy / speed;
|
|
1757
|
+
WAY.z = -puff3.vz / speed;
|
|
1758
|
+
return WAY;
|
|
1759
|
+
}
|
|
1760
|
+
function along(cut, sign) {
|
|
1761
|
+
WAY.x = sign * cut.nx;
|
|
1762
|
+
WAY.y = sign * cut.ny;
|
|
1763
|
+
WAY.z = sign * cut.nz;
|
|
1764
|
+
return WAY;
|
|
1765
|
+
}
|
|
1766
|
+
function dropPassed(confiner, puff3) {
|
|
1767
|
+
for (let i = 0; i < 2; i++) {
|
|
1768
|
+
const cut = puff3.cuts[i];
|
|
1769
|
+
if (!cut.on || !isBehind(puff3, cut)) continue;
|
|
1770
|
+
cut.on = false;
|
|
1771
|
+
cutAt(confiner, puff3, along(cut, 1));
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
function keep(confiner, puff3, cut) {
|
|
1775
|
+
if (!cut.on) return;
|
|
1776
|
+
if (!probe(confiner, puff3, along(cut, -1))) {
|
|
1777
|
+
cut.on = false;
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
cut.d = confiner.out.d;
|
|
1781
|
+
}
|
|
1782
|
+
function lookForWalls(confiner, puff3) {
|
|
1783
|
+
dropPassed(confiner, puff3);
|
|
1784
|
+
const turn = Math.round(puff3.t * PROBES_PER_SECOND);
|
|
1785
|
+
if (turn <= 1) {
|
|
1786
|
+
const back = backward(puff3);
|
|
1787
|
+
if (back) cutAt(confiner, puff3, back);
|
|
1788
|
+
for (let i = 0; i < PROBES.length; i++) cutAt(confiner, puff3, PROBES[i]);
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
if (turn % FRAMES_PER_PROBE !== 0) return;
|
|
1792
|
+
const slot = turn / FRAMES_PER_PROBE % (PROBES.length + 3);
|
|
1793
|
+
if (slot < 2) keep(confiner, puff3, puff3.cuts[slot]);
|
|
1794
|
+
else if (slot === 2) {
|
|
1795
|
+
const back = backward(puff3);
|
|
1796
|
+
if (back) cutAt(confiner, puff3, back);
|
|
1797
|
+
} else cutAt(confiner, puff3, PROBES[slot - 3]);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1664
1800
|
// src/pools/puffs.ts
|
|
1665
1801
|
var FLOOR_FRACTION = 0.4;
|
|
1666
1802
|
var FLOOR_BOUNCE = -0.2;
|
|
@@ -1701,7 +1837,8 @@ function createPuffPool(capacity) {
|
|
|
1701
1837
|
age: 0,
|
|
1702
1838
|
heat: 0,
|
|
1703
1839
|
size: 0,
|
|
1704
|
-
source: void 0
|
|
1840
|
+
source: void 0,
|
|
1841
|
+
cuts: [createCut(), createCut()]
|
|
1705
1842
|
}));
|
|
1706
1843
|
}
|
|
1707
1844
|
function spawnPuff(pool, random, init) {
|
|
@@ -1735,6 +1872,7 @@ function spawnPuff(pool, random, init) {
|
|
|
1735
1872
|
puff3.heat = 0;
|
|
1736
1873
|
puff3.size = 0;
|
|
1737
1874
|
puff3.source = init.source;
|
|
1875
|
+
clearCuts(puff3);
|
|
1738
1876
|
return puff3;
|
|
1739
1877
|
}
|
|
1740
1878
|
function ageOrKeep2(puff3, dt) {
|
|
@@ -1784,17 +1922,21 @@ function updatePuffs(pool, dt, wind, confiner) {
|
|
|
1784
1922
|
MOVE.z0 = puff3.z;
|
|
1785
1923
|
if (puff3.ring) moveOnRing(puff3, puff3.ring, wind);
|
|
1786
1924
|
else moveFree(puff3, dt, age, heat, wind);
|
|
1787
|
-
|
|
1925
|
+
const carried = confining && CARRIED_KINDS[puff3.kind];
|
|
1926
|
+
if (carried && confine(confiner, puff3, dt)) {
|
|
1788
1927
|
const out = confiner.out;
|
|
1789
1928
|
puff3.x = out.x;
|
|
1790
1929
|
puff3.y = out.y;
|
|
1791
1930
|
puff3.z = out.z;
|
|
1792
1931
|
slideInto(out, puff3);
|
|
1932
|
+
cutFrom(puff3, out);
|
|
1793
1933
|
}
|
|
1794
1934
|
const size = puff3.s0 + (puff3.s1 - puff3.s0) * (1 - Math.exp(-puff3.t * puff3.gk)) + puff3.sg * Math.min(puff3.t, GROWTH_CAP_SECONDS);
|
|
1795
1935
|
puff3.size = size * Math.min(1, puff3.t * ARRIVAL_FRAME + ARRIVAL_BASE);
|
|
1796
1936
|
puff3.age = age;
|
|
1797
1937
|
puff3.heat = heat;
|
|
1938
|
+
if (carried) lookForWalls(confiner, puff3);
|
|
1939
|
+
else clearCuts(puff3);
|
|
1798
1940
|
}
|
|
1799
1941
|
}
|
|
1800
1942
|
|
|
@@ -4922,10 +5064,10 @@ var DEFAULT_DIRECTION = [0, 0, -1];
|
|
|
4922
5064
|
var MAX_SCALE = 3;
|
|
4923
5065
|
var MIN_SCALE = 0.6;
|
|
4924
5066
|
function reflected(direction, normal) {
|
|
4925
|
-
const
|
|
4926
|
-
const out = [direction[0] - 2 *
|
|
5067
|
+
const along2 = direction[0] * normal[0] + direction[1] * normal[1] + direction[2] * normal[2];
|
|
5068
|
+
const out = [direction[0] - 2 * along2 * normal[0], direction[1] - 2 * along2 * normal[1], direction[2] - 2 * along2 * normal[2]];
|
|
4927
5069
|
const length = Math.hypot(out[0], out[1], out[2]);
|
|
4928
|
-
if (length < 1e-6 || Math.abs(
|
|
5070
|
+
if (length < 1e-6 || Math.abs(along2) > 0.98) return normal;
|
|
4929
5071
|
return [out[0] / length, out[1] / length, out[2] / length];
|
|
4930
5072
|
}
|
|
4931
5073
|
var numberOr = (value, fallback2) => typeof value === "number" && Number.isFinite(value) ? value : fallback2;
|
|
@@ -5902,7 +6044,7 @@ function composeShock(context) {
|
|
|
5902
6044
|
spawnShock(core.shocks, spec);
|
|
5903
6045
|
}
|
|
5904
6046
|
function composeDust(context) {
|
|
5905
|
-
const { core, def, random, x, z, size, scale } = context;
|
|
6047
|
+
const { core, def, random, x, y, z, size, scale } = context;
|
|
5906
6048
|
if (!core.layers.smoke || !def.dust.count || !(scale > 0.15)) return;
|
|
5907
6049
|
const count = Math.round(def.dust.count * scale);
|
|
5908
6050
|
const color = hexToLinearRgb(def.dust.color);
|
|
@@ -5932,7 +6074,7 @@ function composeDust(context) {
|
|
|
5932
6074
|
color,
|
|
5933
6075
|
kind: 1
|
|
5934
6076
|
});
|
|
5935
|
-
bornFrom(core, dust, x,
|
|
6077
|
+
bornFrom(core, dust, x, y, z);
|
|
5936
6078
|
}
|
|
5937
6079
|
}
|
|
5938
6080
|
function coneAngle(context) {
|
|
@@ -6269,6 +6411,9 @@ function updateScreen(state, dt) {
|
|
|
6269
6411
|
|
|
6270
6412
|
// src/sprites/kind-pool.ts
|
|
6271
6413
|
var PAD_OF_SIZE2 = 0.35;
|
|
6414
|
+
var STEP = { x0: 0.5, y0: 0.5, z0: 0.5, x1: 0.5, y1: 0.5, z1: 0.5, pad: 0.5 };
|
|
6415
|
+
var GROUND_RESAMPLE = 0.1;
|
|
6416
|
+
var VELOCITY = { vx: 0.5, vy: 0.5, vz: 0.5 };
|
|
6272
6417
|
var clamp4 = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
6273
6418
|
var lerp4 = (a, b, t) => a + (b - a) * t;
|
|
6274
6419
|
function rgb(hex) {
|
|
@@ -6316,6 +6461,8 @@ var SpriteKindPool = class {
|
|
|
6316
6461
|
__publicField(this, "bounced");
|
|
6317
6462
|
__publicField(this, "floor");
|
|
6318
6463
|
__publicField(this, "riseMul");
|
|
6464
|
+
/** The ground under each sprite as last asked (`GROUND_RESAMPLE`): x and z where it was asked, and its height. NaN x: not asked yet. */
|
|
6465
|
+
__publicField(this, "ground");
|
|
6319
6466
|
const n = Math.max(1, capacity);
|
|
6320
6467
|
this.position = new Float32Array(n * 3);
|
|
6321
6468
|
this.color = new Float32Array(n * 3);
|
|
@@ -6338,6 +6485,7 @@ var SpriteKindPool = class {
|
|
|
6338
6485
|
this.bounced = new Uint8Array(n);
|
|
6339
6486
|
this.floor = new Float32Array(n);
|
|
6340
6487
|
this.riseMul = new Float32Array(n);
|
|
6488
|
+
this.ground = new Float32Array(n * 3);
|
|
6341
6489
|
}
|
|
6342
6490
|
spawn(kind, p, v, random, options) {
|
|
6343
6491
|
if (this.capacity <= 0) return;
|
|
@@ -6365,6 +6513,7 @@ var SpriteKindPool = class {
|
|
|
6365
6513
|
this.bounced[i] = 0;
|
|
6366
6514
|
this.floor[i] = options?.floor ?? Number.NaN;
|
|
6367
6515
|
this.riseMul[i] = options?.rise ?? 1;
|
|
6516
|
+
this.ground[i * 3] = Number.NaN;
|
|
6368
6517
|
this.size[i] = this.size0[i];
|
|
6369
6518
|
this.alpha[i] = 0;
|
|
6370
6519
|
}
|
|
@@ -6458,18 +6607,36 @@ var SpriteKindPool = class {
|
|
|
6458
6607
|
let z = this.position[i3 + 2] + vz2 * dt;
|
|
6459
6608
|
const confiner = host.confiner;
|
|
6460
6609
|
if (def.carried && confiner && !confiner.empty) {
|
|
6461
|
-
|
|
6462
|
-
|
|
6610
|
+
STEP.x0 = this.position[i3];
|
|
6611
|
+
STEP.y0 = this.position[i3 + 1];
|
|
6612
|
+
STEP.z0 = this.position[i3 + 2];
|
|
6613
|
+
STEP.x1 = x;
|
|
6614
|
+
STEP.y1 = y;
|
|
6615
|
+
STEP.z1 = z;
|
|
6616
|
+
STEP.pad = this.size0[i] * (1 + (def.grow - 1) * t) * PAD_OF_SIZE2;
|
|
6617
|
+
if (confiner.confineMove(STEP, dt)) {
|
|
6463
6618
|
const out = confiner.out;
|
|
6464
6619
|
x = out.x;
|
|
6465
6620
|
y = out.y;
|
|
6466
6621
|
z = out.z;
|
|
6467
|
-
|
|
6622
|
+
VELOCITY.vx = vx2;
|
|
6623
|
+
VELOCITY.vy = vy2;
|
|
6624
|
+
VELOCITY.vz = vz2;
|
|
6625
|
+
slideInto(out, VELOCITY);
|
|
6626
|
+
vx2 = VELOCITY.vx;
|
|
6627
|
+
vy2 = VELOCITY.vy;
|
|
6628
|
+
vz2 = VELOCITY.vz;
|
|
6468
6629
|
}
|
|
6469
6630
|
}
|
|
6470
6631
|
if (def.ground !== "none") {
|
|
6471
6632
|
const own = this.floor[i];
|
|
6472
|
-
const
|
|
6633
|
+
const ground = this.ground;
|
|
6634
|
+
if (Number.isNaN(own) && !(Math.abs(x - ground[i3]) < GROUND_RESAMPLE && Math.abs(z - ground[i3 + 1]) < GROUND_RESAMPLE)) {
|
|
6635
|
+
ground[i3] = x;
|
|
6636
|
+
ground[i3 + 1] = z;
|
|
6637
|
+
ground[i3 + 2] = host.groundAt(x, z);
|
|
6638
|
+
}
|
|
6639
|
+
const gy = Number.isNaN(own) ? ground[i3 + 2] + 5e-3 : own;
|
|
6473
6640
|
if (y < gy) {
|
|
6474
6641
|
if (def.ground === "land") {
|
|
6475
6642
|
const tag = this.tag[i];
|
|
@@ -7341,10 +7508,10 @@ var MeshPool = class {
|
|
|
7341
7508
|
if (particle.fade) particle.opacity = Math.max(0, particle.startOpacity * (1 - particle.age / particle.life));
|
|
7342
7509
|
particle.vy -= particle.gravity * dt;
|
|
7343
7510
|
if (particle.drag) {
|
|
7344
|
-
const
|
|
7345
|
-
particle.vx *=
|
|
7346
|
-
particle.vy *=
|
|
7347
|
-
particle.vz *=
|
|
7511
|
+
const keep2 = Math.max(0, 1 - particle.drag * dt);
|
|
7512
|
+
particle.vx *= keep2;
|
|
7513
|
+
particle.vy *= keep2;
|
|
7514
|
+
particle.vz *= keep2;
|
|
7348
7515
|
}
|
|
7349
7516
|
if (particle.carried) this.ride(particle, dt);
|
|
7350
7517
|
else {
|
|
@@ -8203,10 +8370,10 @@ function createVfx(options = {}) {
|
|
|
8203
8370
|
for (let index = fires.items.length - 1; index >= 0; index--) if (fires.items[index].handle === handle) fires.removeAt(index);
|
|
8204
8371
|
},
|
|
8205
8372
|
clearSource(source) {
|
|
8206
|
-
const
|
|
8373
|
+
const keep2 = (record, gone) => record.source !== gone;
|
|
8207
8374
|
const drop = (pool) => {
|
|
8208
8375
|
const before = pool.count;
|
|
8209
|
-
pool.compact(
|
|
8376
|
+
pool.compact(keep2, source);
|
|
8210
8377
|
return before - pool.count;
|
|
8211
8378
|
};
|
|
8212
8379
|
return drop(core.fires) + drop(core.puffs) + drop(core.sparks) + drop(core.chunks) + drop(core.glows) + spriteSystem.clearSource(source);
|
|
@@ -9380,10 +9547,10 @@ var MIST_DRAG = 1.2;
|
|
|
9380
9547
|
function moveDrop(drop, context) {
|
|
9381
9548
|
const { dt } = context;
|
|
9382
9549
|
drop.age += dt;
|
|
9383
|
-
const
|
|
9384
|
-
drop.vx *=
|
|
9385
|
-
drop.vz *=
|
|
9386
|
-
drop.vy = drop.vy *
|
|
9550
|
+
const keep2 = Math.exp(-DROP_DRAG * dt);
|
|
9551
|
+
drop.vx *= keep2;
|
|
9552
|
+
drop.vz *= keep2;
|
|
9553
|
+
drop.vy = drop.vy * keep2 - WATER_GRAVITY * dt;
|
|
9387
9554
|
drop.x += drop.vx * dt;
|
|
9388
9555
|
drop.y += drop.vy * dt;
|
|
9389
9556
|
drop.z += drop.vz * dt;
|
|
@@ -9443,10 +9610,10 @@ function ageBubble(bubble, dt) {
|
|
|
9443
9610
|
}
|
|
9444
9611
|
function ageMist(mist, dt) {
|
|
9445
9612
|
mist.age += dt;
|
|
9446
|
-
const
|
|
9447
|
-
mist.vx *=
|
|
9448
|
-
mist.vy = mist.vy *
|
|
9449
|
-
mist.vz *=
|
|
9613
|
+
const keep2 = Math.exp(-MIST_DRAG * dt);
|
|
9614
|
+
mist.vx *= keep2;
|
|
9615
|
+
mist.vy = mist.vy * keep2 - 0.15 * dt;
|
|
9616
|
+
mist.vz *= keep2;
|
|
9450
9617
|
mist.x += mist.vx * dt;
|
|
9451
9618
|
mist.y += mist.vy * dt;
|
|
9452
9619
|
mist.z += mist.vz * dt;
|
|
@@ -9819,10 +9986,10 @@ function spawnTrail(context, point, plan) {
|
|
|
9819
9986
|
const count = Math.min(TRAIL_BUBBLES_MAX, Math.round(plan.profile.bubblesPerMetre * plan.trailLength * context.detail));
|
|
9820
9987
|
const [ex, ey, ez] = plan.trailEnd;
|
|
9821
9988
|
for (let index = 0; index < count; index++) {
|
|
9822
|
-
const
|
|
9823
|
-
const jitter = 0.01 + 0.02 *
|
|
9824
|
-
const at3 = [point[0] + (ex - point[0]) *
|
|
9825
|
-
addBubble(context, at3, point[1],
|
|
9989
|
+
const along2 = random.next() ** 1.6;
|
|
9990
|
+
const jitter = 0.01 + 0.02 * along2;
|
|
9991
|
+
const at3 = [point[0] + (ex - point[0]) * along2 + random.between(-jitter, jitter), point[1] + (ey - point[1]) * along2, point[2] + (ez - point[2]) * along2 + random.between(-jitter, jitter)];
|
|
9992
|
+
addBubble(context, at3, point[1], along2 * 0.05, random.between(3e-3, 0.01));
|
|
9826
9993
|
}
|
|
9827
9994
|
}
|
|
9828
9995
|
function spawnBlast(context, point, level, plan) {
|
|
@@ -10062,6 +10229,7 @@ export {
|
|
|
10062
10229
|
OrderedPool,
|
|
10063
10230
|
PIECES_DRAWN_VARIABLE,
|
|
10064
10231
|
PROFILES,
|
|
10232
|
+
PUFF_REACH,
|
|
10065
10233
|
RAIN_CAPACITY,
|
|
10066
10234
|
RainField,
|
|
10067
10235
|
SCRAPE_LIMIT,
|