paperlab 0.8.0 → 0.9.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/README.md +59 -35
- 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-7WOGU2D4.js → chunk-S74YZAXE.js} +2 -2
- package/dist/chunk-S74YZAXE.js.map +1 -0
- package/dist/{chunk-SVWWC5UL.js → chunk-YQFQT3AH.js} +3336 -773
- package/dist/chunk-YQFQT3AH.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 +3396 -796
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -5
- package/dist/index.d.ts +63 -5
- package/dist/index.js +53 -8
- package/dist/index.js.map +1 -1
- package/dist/{slots-D_EE8GXn.d.cts → slots-BAVzglHw.d.cts} +125 -4
- package/dist/{slots-D_EE8GXn.d.ts → slots-BAVzglHw.d.ts} +125 -4
- package/dist/stage.cjs +3536 -979
- 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 +14 -13
- package/dist/stage.js.map +1 -1
- package/package.json +14 -14
- package/dist/FxPostPass-V6YDK4H2.js.map +0 -1
- package/dist/chunk-7WOGU2D4.js.map +0 -1
- package/dist/chunk-SVWWC5UL.js.map +0 -1
|
@@ -132,8 +132,8 @@ interface DamageLook {
|
|
|
132
132
|
edgeBite?: number;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
|
-
* What every burn is drawn with unless told otherwise —
|
|
136
|
-
* lab's sidebar
|
|
135
|
+
* What every burn is drawn with unless told otherwise — the tune made in the
|
|
136
|
+
* lab's sidebar, and the source of truth for how a burn looks:
|
|
137
137
|
* the lab starts from it, `/hands` inherits it, and a user changes it through
|
|
138
138
|
* `look`. The values it replaced, and why each of those had moved, are in the
|
|
139
139
|
* history of this file.
|
|
@@ -132,8 +132,8 @@ interface DamageLook {
|
|
|
132
132
|
edgeBite?: number;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
|
-
* What every burn is drawn with unless told otherwise —
|
|
136
|
-
* lab's sidebar
|
|
135
|
+
* What every burn is drawn with unless told otherwise — the tune made in the
|
|
136
|
+
* lab's sidebar, and the source of truth for how a burn looks:
|
|
137
137
|
* the lab starts from it, `/hands` inherits it, and a user changes it through
|
|
138
138
|
* `look`. The values it replaced, and why each of those had moved, are in the
|
|
139
139
|
* history of this file.
|
package/dist/fx.cjs
CHANGED
|
@@ -47,7 +47,7 @@ var init_damageContract = __esm({
|
|
|
47
47
|
emberFlicker: 1.65,
|
|
48
48
|
emberGlow: 1.25,
|
|
49
49
|
sparkle: 0.5,
|
|
50
|
-
// As wide as the char band
|
|
50
|
+
// As wide as the char band: the lip has to be seen. At
|
|
51
51
|
// 0.95 mm it was a hairline tracing the edge.
|
|
52
52
|
lipWidth: 3.5,
|
|
53
53
|
charWidth: 3.5,
|
|
@@ -846,7 +846,7 @@ void mainUv(inout vec2 uv) {
|
|
|
846
846
|
}
|
|
847
847
|
|
|
848
848
|
// The grade: the whole frame warms as the fire grows \u2014 a few percent, no
|
|
849
|
-
// more
|
|
849
|
+
// more. A multiply, so black stays black.
|
|
850
850
|
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
|
|
851
851
|
outputColor = vec4(inputColor.rgb * mix(vec3(1.0), uWarm, uGrade), inputColor.a);
|
|
852
852
|
}
|
|
@@ -1108,7 +1108,7 @@ var particlePresets = {
|
|
|
1108
1108
|
* caught the bug in the version before this one. That version said "the hot
|
|
1109
1109
|
* end is now ~5.6, well over the bloom threshold" — and 5.6 was an ABSOLUTE
|
|
1110
1110
|
* luminance, while paper white under `window` is 1.6. So the hottest spark
|
|
1111
|
-
* in the frame was **3.5× paper, under the
|
|
1111
|
+
* in the frame was **3.5× paper, under the 4× floor**, and its
|
|
1112
1112
|
* own comment said otherwise. A number that cannot be compared to anything
|
|
1113
1113
|
* is a number nobody can check.
|
|
1114
1114
|
*
|
|
@@ -1128,12 +1128,12 @@ var particlePresets = {
|
|
|
1128
1128
|
drag: 0.8,
|
|
1129
1129
|
jitter: 1.5,
|
|
1130
1130
|
windCatch: 0.8,
|
|
1131
|
-
// 0.3-1 mm of core
|
|
1131
|
+
// 0.3-1 mm of core. A sheet is one world unit across, 210 mm, so
|
|
1132
1132
|
// 0.0035 is 0.7 mm. It was 0.005 — a full millimetre wide before the
|
|
1133
1133
|
// streak stretched it, which is where "wide bars" started.
|
|
1134
1134
|
size: [35e-4, 12e-4],
|
|
1135
1135
|
color: [
|
|
1136
|
-
// 6× paper white: inside
|
|
1136
|
+
// 6× paper white: inside the 4–8× band, so it blooms.
|
|
1137
1137
|
emitHex("#FFC271", 6),
|
|
1138
1138
|
// 0.7× — UNDER the bloom threshold on purpose, so a dying spark stops
|
|
1139
1139
|
// glowing rather than merely fading.
|
|
@@ -1156,7 +1156,7 @@ var particlePresets = {
|
|
|
1156
1156
|
// of the last flame. Left to live three and a half seconds and grow to
|
|
1157
1157
|
// seven centimetres, the last few of them overlapped into a flat wash
|
|
1158
1158
|
// over the hole with nothing left to move them — the one moment of a
|
|
1159
|
-
// burn
|
|
1159
|
+
// burn where the smoke looked wrong.
|
|
1160
1160
|
life: [1.4, 2.6],
|
|
1161
1161
|
speed: [0.05, 0.15],
|
|
1162
1162
|
direction: [0, 1, 0],
|
|
@@ -1199,7 +1199,7 @@ var particlePresets = {
|
|
|
1199
1199
|
drag: 1.6,
|
|
1200
1200
|
jitter: 1.2,
|
|
1201
1201
|
windCatch: 1,
|
|
1202
|
-
// 5–10 mm across
|
|
1202
|
+
// 5–10 mm across. A sheet is 210 mm, so 0.03 is 6.3 mm. They were
|
|
1203
1203
|
// 3.8 mm and there were far too many of them: a shower of specks rather
|
|
1204
1204
|
// than a few flakes you would notice.
|
|
1205
1205
|
size: [0.03, 0.026],
|
|
@@ -1611,7 +1611,7 @@ void main() {
|
|
|
1611
1611
|
// It used to be flat-topped across (smoothstep from 0.35, so the middle
|
|
1612
1612
|
// seventy per cent of the width was all at full brightness) and to keep a
|
|
1613
1613
|
// quarter of that brightness all the way to the end of the quad. Both
|
|
1614
|
-
// together drew a wide bar with a squared-off end, which is what
|
|
1614
|
+
// together drew a wide bar with a squared-off end, which is what a visual review
|
|
1615
1615
|
// saw up close. A spark is a point of light smeared by its own motion: it
|
|
1616
1616
|
// is brightest on its centre line and it runs out.
|
|
1617
1617
|
float across = abs(vQuad.x);
|
|
@@ -1731,14 +1731,14 @@ void main() {
|
|
|
1731
1731
|
float edge = 0.62 + 0.3 * flNoise(vec2(a * 1.6 + vSeed * 31.0, vSeed * 7.0));
|
|
1732
1732
|
float mask = 1.0 - smoothstep(edge - 0.06, edge, r);
|
|
1733
1733
|
if (mask <= 0.0) discard;
|
|
1734
|
-
// Char in the middle, pale brittle ash at the edge
|
|
1734
|
+
// Char in the middle, pale brittle ash at the edge \u2014 in patches
|
|
1735
1735
|
// along it, not all the way round: a flake is a few pixels across, and a
|
|
1736
1736
|
// continuous pale rim round a dark middle drew it as a hollow ring.
|
|
1737
1737
|
float rim = smoothstep(edge - 0.32, edge - 0.04, r);
|
|
1738
1738
|
float patches = smoothstep(0.45, 0.75, flNoise(vec2(a * 2.2 + vSeed * 17.0, vSeed * 13.0)));
|
|
1739
1739
|
float grain = flNoise(vQuad * 3.0 + vSeed * 23.0);
|
|
1740
1740
|
vec3 charC = vec3(0.05, 0.043, 0.038) * (0.7 + 0.6 * grain);
|
|
1741
|
-
// #A49E9D,
|
|
1741
|
+
// #A49E9D, sampled from the reference ash, in linear.
|
|
1742
1742
|
vec3 ashC = vec3(0.372, 0.344, 0.340);
|
|
1743
1743
|
// Pale ash with char under it, not char with a pale rim.
|
|
1744
1744
|
//
|
|
@@ -1845,7 +1845,7 @@ function warnOnce(cause) {
|
|
|
1845
1845
|
if (warned) return;
|
|
1846
1846
|
warned = true;
|
|
1847
1847
|
console.warn(
|
|
1848
|
-
"[paperlab/fx] Rendering without FxPost
|
|
1848
|
+
"[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.",
|
|
1849
1849
|
...cause === void 0 ? [] : [cause]
|
|
1850
1850
|
);
|
|
1851
1851
|
}
|
|
@@ -1900,7 +1900,7 @@ var Afterglow = class {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
/**
|
|
1902
1902
|
* Advance by `dt`, after the field has stepped. `blow` is the breath on the
|
|
1903
|
-
* sheet, 0..1: it flares what is left (
|
|
1903
|
+
* sheet, 0..1: it flares what is left ("on smoulder: beads flare,
|
|
1904
1904
|
* then fade").
|
|
1905
1905
|
*/
|
|
1906
1906
|
step(dt, blow = 0) {
|
|
@@ -2835,8 +2835,8 @@ void main() {
|
|
|
2835
2835
|
// The base used to be bright enough to read on its own \u2014 beige \u2014 which is
|
|
2836
2836
|
// right while flames are lighting it and wrong the moment they stop: the
|
|
2837
2837
|
// last of the smoke hung over a black stage as flat beige slabs, the same
|
|
2838
|
-
// colour everywhere, which reads as a filled shape rather than as smoke
|
|
2839
|
-
//
|
|
2838
|
+
// colour everywhere, which reads as a filled shape rather than as smoke.
|
|
2839
|
+
// Dim at the base and warm where the fire is: smoke by
|
|
2840
2840
|
// the flames looks as it did, smoke after them goes to a dim grey.
|
|
2841
2841
|
float smokeAlpha = 1.0 - exp(-smoke * uSmokeDensity);
|
|
2842
2842
|
vec3 smokeColor = vec3(0.075, 0.068, 0.062) + vec3(0.3, 0.14, 0.045) * smoothstep(0.12, 0.9, t);
|
|
@@ -3225,7 +3225,7 @@ var fireFluidDefaults = {
|
|
|
3225
3225
|
smoke: 0.7,
|
|
3226
3226
|
// Was 5 — a full unit a second, 210 mm/s, of gas pushed sideways out of the
|
|
3227
3227
|
// rim. Against a buoyancy of 1.7 units/s² that is what rolled the flames
|
|
3228
|
-
// into mushroom caps: the grey spirals over the text that
|
|
3228
|
+
// into mushroom caps: the grey spirals over the text that a visual review called
|
|
3229
3229
|
// the most synthetic thing in the frame. A flame leaves paper going UP.
|
|
3230
3230
|
radialImpulse: 0.8,
|
|
3231
3231
|
// In world units a second now (see `solverUniforms`): 1.4 is ~0.3 m/s, the
|
|
@@ -3258,7 +3258,7 @@ var fireFluidDefaults = {
|
|
|
3258
3258
|
// reached the text (~150 mm), 1.6 ~100 mm, 2.1 short licks (~60 mm);
|
|
3259
3259
|
// Hero.png's tallest is ~70 mm.
|
|
3260
3260
|
cooling: 1.8,
|
|
3261
|
-
// Was 1.4, which made a thick grey column, then 0.5.
|
|
3261
|
+
// Was 1.4, which made a thick grey column, then 0.5. The direction is
|
|
3262
3262
|
// light smoke, and with MacCormack advection keeping the smoke's fine
|
|
3263
3263
|
// structure it needs less of it to read: at 0.5 it veiled the upper sheet.
|
|
3264
3264
|
smokeProduction: 0.25,
|
|
@@ -4042,7 +4042,7 @@ var FxAudio = class {
|
|
|
4042
4042
|
constructor(options) {
|
|
4043
4043
|
const { quality = "auto", context, volume = 0.8 } = options;
|
|
4044
4044
|
this.quality = typeof quality === "string" ? fxQualityFor(quality) : quality;
|
|
4045
|
-
if (!context) throw new Error("FxAudio needs a context
|
|
4045
|
+
if (!context) throw new Error("FxAudio needs a context. See createAudioContext()");
|
|
4046
4046
|
this.ctx = context;
|
|
4047
4047
|
this.master = this.ctx.createGain();
|
|
4048
4048
|
this.master.gain.value = volume;
|
|
@@ -4302,18 +4302,18 @@ var FireSound = class {
|
|
|
4302
4302
|
}
|
|
4303
4303
|
/**
|
|
4304
4304
|
* A match struck: the scratch of the head across the box, then the hiss of
|
|
4305
|
-
* it flaring as the head burns off
|
|
4305
|
+
* it flaring as the head burns off. Two bursts of the shared
|
|
4306
4306
|
* noise, one bright and short, one breathier and longer.
|
|
4307
4307
|
*/
|
|
4308
4308
|
strike() {
|
|
4309
4309
|
this.burst("fire-strike", 0.9, { type: "bandpass", frequency: 3200, q: 1.1 }, 4e-3, 0.07, 0.8);
|
|
4310
4310
|
this.burst("fire-flare", 0.8, { type: "highpass", frequency: 1800, q: 0.7 }, 0.03, 0.45, 0.45, 0.05);
|
|
4311
4311
|
}
|
|
4312
|
-
/** Blown out: a soft, low breath of noise
|
|
4312
|
+
/** Blown out: a soft, low breath of noise. */
|
|
4313
4313
|
puff() {
|
|
4314
4314
|
this.burst("fire-puff", 0.6, { type: "lowpass", frequency: 520, q: 0.6 }, 0.02, 0.28, 0.55);
|
|
4315
4315
|
}
|
|
4316
|
-
/** One ember popping in the air — a tiny click on the frame it flashes
|
|
4316
|
+
/** One ember popping in the air — a tiny click on the frame it flashes. */
|
|
4317
4317
|
pop() {
|
|
4318
4318
|
const f = 3e3 + this.next() * 3e3;
|
|
4319
4319
|
this.burst(
|