paperlab 0.8.0 → 0.8.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/README.md +57 -30
- package/dist/{FxPostPass-V6YDK4H2.js → FxPostPass-ACFSHY3S.js} +4 -4
- package/dist/FxPostPass-ACFSHY3S.js.map +1 -0
- package/dist/{chunk-232SU3AQ.js → chunk-BIFUJCUA.js} +2 -2
- package/dist/{chunk-232SU3AQ.js.map → chunk-BIFUJCUA.js.map} +1 -1
- package/dist/{chunk-SVWWC5UL.js → chunk-LUKNPQ3S.js} +16 -17
- package/dist/chunk-LUKNPQ3S.js.map +1 -0
- package/dist/{chunk-7WOGU2D4.js → chunk-S74YZAXE.js} +2 -2
- package/dist/chunk-S74YZAXE.js.map +1 -0
- package/dist/{damageContract-nF1fgK7P.d.cts → damageContract-9RC4egJg.d.cts} +2 -2
- package/dist/{damageContract-nF1fgK7P.d.ts → damageContract-9RC4egJg.d.ts} +2 -2
- package/dist/fx.cjs +20 -20
- package/dist/fx.cjs.map +1 -1
- package/dist/fx.d.cts +42 -44
- package/dist/fx.d.ts +42 -44
- package/dist/fx.js +21 -21
- package/dist/fx.js.map +1 -1
- package/dist/index.cjs +22 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{slots-D_EE8GXn.d.cts → slots-DbJQfwVd.d.cts} +1 -1
- package/dist/{slots-D_EE8GXn.d.ts → slots-DbJQfwVd.d.ts} +1 -1
- package/dist/stage.cjs +23 -24
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.d.cts +1 -1
- package/dist/stage.d.ts +1 -1
- package/dist/stage.js +12 -12
- package/dist/stage.js.map +1 -1
- package/package.json +5 -5
- package/dist/FxPostPass-V6YDK4H2.js.map +0 -1
- package/dist/chunk-7WOGU2D4.js.map +0 -1
- package/dist/chunk-SVWWC5UL.js.map +0 -1
package/dist/fx.js
CHANGED
|
@@ -31,11 +31,11 @@ import {
|
|
|
31
31
|
luminance,
|
|
32
32
|
srgbToLinear,
|
|
33
33
|
timesPaperWhite
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-S74YZAXE.js";
|
|
35
35
|
import {
|
|
36
36
|
DAMAGE_CHANNELS,
|
|
37
37
|
DAMAGE_LOOK_DEFAULTS
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-BIFUJCUA.js";
|
|
39
39
|
|
|
40
40
|
// src/fx/particles.ts
|
|
41
41
|
var particlePresets = {
|
|
@@ -47,7 +47,7 @@ var particlePresets = {
|
|
|
47
47
|
* caught the bug in the version before this one. That version said "the hot
|
|
48
48
|
* end is now ~5.6, well over the bloom threshold" — and 5.6 was an ABSOLUTE
|
|
49
49
|
* luminance, while paper white under `window` is 1.6. So the hottest spark
|
|
50
|
-
* in the frame was **3.5× paper, under the
|
|
50
|
+
* in the frame was **3.5× paper, under the 4× floor**, and its
|
|
51
51
|
* own comment said otherwise. A number that cannot be compared to anything
|
|
52
52
|
* is a number nobody can check.
|
|
53
53
|
*
|
|
@@ -67,12 +67,12 @@ var particlePresets = {
|
|
|
67
67
|
drag: 0.8,
|
|
68
68
|
jitter: 1.5,
|
|
69
69
|
windCatch: 0.8,
|
|
70
|
-
// 0.3-1 mm of core
|
|
70
|
+
// 0.3-1 mm of core. A sheet is one world unit across, 210 mm, so
|
|
71
71
|
// 0.0035 is 0.7 mm. It was 0.005 — a full millimetre wide before the
|
|
72
72
|
// streak stretched it, which is where "wide bars" started.
|
|
73
73
|
size: [35e-4, 12e-4],
|
|
74
74
|
color: [
|
|
75
|
-
// 6× paper white: inside
|
|
75
|
+
// 6× paper white: inside the 4–8× band, so it blooms.
|
|
76
76
|
emitHex("#FFC271", 6),
|
|
77
77
|
// 0.7× — UNDER the bloom threshold on purpose, so a dying spark stops
|
|
78
78
|
// glowing rather than merely fading.
|
|
@@ -95,7 +95,7 @@ var particlePresets = {
|
|
|
95
95
|
// of the last flame. Left to live three and a half seconds and grow to
|
|
96
96
|
// seven centimetres, the last few of them overlapped into a flat wash
|
|
97
97
|
// over the hole with nothing left to move them — the one moment of a
|
|
98
|
-
// burn
|
|
98
|
+
// burn where the smoke looked wrong.
|
|
99
99
|
life: [1.4, 2.6],
|
|
100
100
|
speed: [0.05, 0.15],
|
|
101
101
|
direction: [0, 1, 0],
|
|
@@ -138,7 +138,7 @@ var particlePresets = {
|
|
|
138
138
|
drag: 1.6,
|
|
139
139
|
jitter: 1.2,
|
|
140
140
|
windCatch: 1,
|
|
141
|
-
// 5–10 mm across
|
|
141
|
+
// 5–10 mm across. A sheet is 210 mm, so 0.03 is 6.3 mm. They were
|
|
142
142
|
// 3.8 mm and there were far too many of them: a shower of specks rather
|
|
143
143
|
// than a few flakes you would notice.
|
|
144
144
|
size: [0.03, 0.026],
|
|
@@ -549,7 +549,7 @@ void main() {
|
|
|
549
549
|
// It used to be flat-topped across (smoothstep from 0.35, so the middle
|
|
550
550
|
// seventy per cent of the width was all at full brightness) and to keep a
|
|
551
551
|
// quarter of that brightness all the way to the end of the quad. Both
|
|
552
|
-
// together drew a wide bar with a squared-off end, which is what
|
|
552
|
+
// together drew a wide bar with a squared-off end, which is what a visual review
|
|
553
553
|
// saw up close. A spark is a point of light smeared by its own motion: it
|
|
554
554
|
// is brightest on its centre line and it runs out.
|
|
555
555
|
float across = abs(vQuad.x);
|
|
@@ -669,14 +669,14 @@ void main() {
|
|
|
669
669
|
float edge = 0.62 + 0.3 * flNoise(vec2(a * 1.6 + vSeed * 31.0, vSeed * 7.0));
|
|
670
670
|
float mask = 1.0 - smoothstep(edge - 0.06, edge, r);
|
|
671
671
|
if (mask <= 0.0) discard;
|
|
672
|
-
// Char in the middle, pale brittle ash at the edge
|
|
672
|
+
// Char in the middle, pale brittle ash at the edge \u2014 in patches
|
|
673
673
|
// along it, not all the way round: a flake is a few pixels across, and a
|
|
674
674
|
// continuous pale rim round a dark middle drew it as a hollow ring.
|
|
675
675
|
float rim = smoothstep(edge - 0.32, edge - 0.04, r);
|
|
676
676
|
float patches = smoothstep(0.45, 0.75, flNoise(vec2(a * 2.2 + vSeed * 17.0, vSeed * 13.0)));
|
|
677
677
|
float grain = flNoise(vQuad * 3.0 + vSeed * 23.0);
|
|
678
678
|
vec3 charC = vec3(0.05, 0.043, 0.038) * (0.7 + 0.6 * grain);
|
|
679
|
-
// #A49E9D,
|
|
679
|
+
// #A49E9D, sampled from the reference ash, in linear.
|
|
680
680
|
vec3 ashC = vec3(0.372, 0.344, 0.340);
|
|
681
681
|
// Pale ash with char under it, not char with a pale rim.
|
|
682
682
|
//
|
|
@@ -773,7 +773,7 @@ function FxParticles({ pool }) {
|
|
|
773
773
|
import { Suspense, lazy } from "react";
|
|
774
774
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
775
775
|
var Pass = lazy(
|
|
776
|
-
() => import("./FxPostPass-
|
|
776
|
+
() => import("./FxPostPass-ACFSHY3S.js").then((m) => ({ default: m.FxPostPass })).catch((error) => {
|
|
777
777
|
warnOnce(error);
|
|
778
778
|
return { default: (() => null) };
|
|
779
779
|
})
|
|
@@ -783,7 +783,7 @@ function warnOnce(cause) {
|
|
|
783
783
|
if (warned) return;
|
|
784
784
|
warned = true;
|
|
785
785
|
console.warn(
|
|
786
|
-
"[paperlab/fx] Rendering without FxPost
|
|
786
|
+
"[paperlab/fx] Rendering without FxPost, so fire will not bloom.\nIt needs two optional peers:\n npm i @react-three/postprocessing postprocessing\nLeave <FxPost> out to go without it deliberately and silence this.",
|
|
787
787
|
...cause === void 0 ? [] : [cause]
|
|
788
788
|
);
|
|
789
789
|
}
|
|
@@ -834,7 +834,7 @@ var Afterglow = class {
|
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Advance by `dt`, after the field has stepped. `blow` is the breath on the
|
|
837
|
-
* sheet, 0..1: it flares what is left (
|
|
837
|
+
* sheet, 0..1: it flares what is left ("on smoulder: beads flare,
|
|
838
838
|
* then fade").
|
|
839
839
|
*/
|
|
840
840
|
step(dt, blow = 0) {
|
|
@@ -1764,8 +1764,8 @@ void main() {
|
|
|
1764
1764
|
// The base used to be bright enough to read on its own \u2014 beige \u2014 which is
|
|
1765
1765
|
// right while flames are lighting it and wrong the moment they stop: the
|
|
1766
1766
|
// last of the smoke hung over a black stage as flat beige slabs, the same
|
|
1767
|
-
// colour everywhere, which reads as a filled shape rather than as smoke
|
|
1768
|
-
//
|
|
1767
|
+
// colour everywhere, which reads as a filled shape rather than as smoke.
|
|
1768
|
+
// Dim at the base and warm where the fire is: smoke by
|
|
1769
1769
|
// the flames looks as it did, smoke after them goes to a dim grey.
|
|
1770
1770
|
float smokeAlpha = 1.0 - exp(-smoke * uSmokeDensity);
|
|
1771
1771
|
vec3 smokeColor = vec3(0.075, 0.068, 0.062) + vec3(0.3, 0.14, 0.045) * smoothstep(0.12, 0.9, t);
|
|
@@ -2154,7 +2154,7 @@ var fireFluidDefaults = {
|
|
|
2154
2154
|
smoke: 0.7,
|
|
2155
2155
|
// Was 5 — a full unit a second, 210 mm/s, of gas pushed sideways out of the
|
|
2156
2156
|
// rim. Against a buoyancy of 1.7 units/s² that is what rolled the flames
|
|
2157
|
-
// into mushroom caps: the grey spirals over the text that
|
|
2157
|
+
// into mushroom caps: the grey spirals over the text that a visual review called
|
|
2158
2158
|
// the most synthetic thing in the frame. A flame leaves paper going UP.
|
|
2159
2159
|
radialImpulse: 0.8,
|
|
2160
2160
|
// In world units a second now (see `solverUniforms`): 1.4 is ~0.3 m/s, the
|
|
@@ -2187,7 +2187,7 @@ var fireFluidDefaults = {
|
|
|
2187
2187
|
// reached the text (~150 mm), 1.6 ~100 mm, 2.1 short licks (~60 mm);
|
|
2188
2188
|
// Hero.png's tallest is ~70 mm.
|
|
2189
2189
|
cooling: 1.8,
|
|
2190
|
-
// Was 1.4, which made a thick grey column, then 0.5.
|
|
2190
|
+
// Was 1.4, which made a thick grey column, then 0.5. The direction is
|
|
2191
2191
|
// light smoke, and with MacCormack advection keeping the smoke's fine
|
|
2192
2192
|
// structure it needs less of it to read: at 0.5 it veiled the upper sheet.
|
|
2193
2193
|
smokeProduction: 0.25,
|
|
@@ -2965,7 +2965,7 @@ var FxAudio = class {
|
|
|
2965
2965
|
constructor(options) {
|
|
2966
2966
|
const { quality = "auto", context, volume = 0.8 } = options;
|
|
2967
2967
|
this.quality = typeof quality === "string" ? fxQualityFor(quality) : quality;
|
|
2968
|
-
if (!context) throw new Error("FxAudio needs a context
|
|
2968
|
+
if (!context) throw new Error("FxAudio needs a context. See createAudioContext()");
|
|
2969
2969
|
this.ctx = context;
|
|
2970
2970
|
this.master = this.ctx.createGain();
|
|
2971
2971
|
this.master.gain.value = volume;
|
|
@@ -3225,18 +3225,18 @@ var FireSound = class {
|
|
|
3225
3225
|
}
|
|
3226
3226
|
/**
|
|
3227
3227
|
* A match struck: the scratch of the head across the box, then the hiss of
|
|
3228
|
-
* it flaring as the head burns off
|
|
3228
|
+
* it flaring as the head burns off. Two bursts of the shared
|
|
3229
3229
|
* noise, one bright and short, one breathier and longer.
|
|
3230
3230
|
*/
|
|
3231
3231
|
strike() {
|
|
3232
3232
|
this.burst("fire-strike", 0.9, { type: "bandpass", frequency: 3200, q: 1.1 }, 4e-3, 0.07, 0.8);
|
|
3233
3233
|
this.burst("fire-flare", 0.8, { type: "highpass", frequency: 1800, q: 0.7 }, 0.03, 0.45, 0.45, 0.05);
|
|
3234
3234
|
}
|
|
3235
|
-
/** Blown out: a soft, low breath of noise
|
|
3235
|
+
/** Blown out: a soft, low breath of noise. */
|
|
3236
3236
|
puff() {
|
|
3237
3237
|
this.burst("fire-puff", 0.6, { type: "lowpass", frequency: 520, q: 0.6 }, 0.02, 0.28, 0.55);
|
|
3238
3238
|
}
|
|
3239
|
-
/** One ember popping in the air — a tiny click on the frame it flashes
|
|
3239
|
+
/** One ember popping in the air — a tiny click on the frame it flashes. */
|
|
3240
3240
|
pop() {
|
|
3241
3241
|
const f = 3e3 + this.next() * 3e3;
|
|
3242
3242
|
this.burst(
|