vireuikit 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -185,899 +185,17 @@ function stepGrowth(state, dt, open, reduceMotion = false, timing = DEFAULT_GROW
185
185
  return movedShrink || movedGrow;
186
186
  }
187
187
 
188
- // src/medium/oklab.ts
189
- var LINEAR_TO_LMS = [
190
- [0.4122214708, 0.5363325363, 0.0514459929],
191
- [0.2119034982, 0.6806995451, 0.1073969566],
192
- [0.0883024619, 0.2817188376, 0.6299787005]
193
- ];
194
- var LMS_TO_OKLAB = [
195
- [0.2104542553, 0.793617785, -0.0040720468],
196
- [1.9779984951, -2.428592205, 0.4505937099],
197
- [0.0259040371, 0.7827717662, -0.808675766]
198
- ];
199
- var OKLAB_TO_LMS = [
200
- [1, 0.3963377774, 0.2158037573],
201
- [1, -0.1055613458, -0.0638541728],
202
- [1, -0.0894841775, -1.291485548]
203
- ];
204
- var LMS_TO_LINEAR = [
205
- [4.0767416621, -3.3077115913, 0.2309699292],
206
- [-1.2684380046, 2.6097574011, -0.3413193965],
207
- [-0.0041960863, -0.7034186147, 1.707614701]
208
- ];
209
- var glsl = (v) => Number.isInteger(v) ? v.toFixed(1) : String(v);
210
- var row = (m, i, vars) => m[i].map((k, j) => `${glsl(k)} * ${vars[j]}`).join(" + ");
211
- var VG_OKLAB_TO_SRGB = `
212
- float3 vgLinearToSrgb(float3 c) {
213
- float3 lo = c * 12.92;
214
- float3 hi = 1.055 * pow(max(c, float3(0.0)), float3(1.0 / 2.4)) - 0.055;
215
- return mix(lo, hi, step(float3(0.0031308), c));
216
- }
217
-
218
- float3 vgOklabToLinear(float3 lab) {
219
- float l_ = ${row(OKLAB_TO_LMS, 0, ["lab.x", "lab.y", "lab.z"])};
220
- float m_ = ${row(OKLAB_TO_LMS, 1, ["lab.x", "lab.y", "lab.z"])};
221
- float s_ = ${row(OKLAB_TO_LMS, 2, ["lab.x", "lab.y", "lab.z"])};
222
- float l = l_ * l_ * l_;
223
- float m = m_ * m_ * m_;
224
- float s = s_ * s_ * s_;
225
- return float3(
226
- ${row(LMS_TO_LINEAR, 0, ["l", "m", "s"])},
227
- ${row(LMS_TO_LINEAR, 1, ["l", "m", "s"])},
228
- ${row(LMS_TO_LINEAR, 2, ["l", "m", "s"])}
229
- );
230
- }
231
- `;
232
- var apply = (m, v) => [
233
- m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2],
234
- m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2],
235
- m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2]
236
- ];
237
- var srgbChannelToLinear = (c) => c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
238
- var linearChannelToSrgb = (c) => c <= 31308e-7 ? c * 12.92 : 1.055 * Math.pow(Math.max(c, 0), 1 / 2.4) - 0.055;
239
- function srgbToOklab(rgb) {
240
- const linear = rgb.map(srgbChannelToLinear);
241
- const lms = apply(LINEAR_TO_LMS, linear);
242
- return apply(LMS_TO_OKLAB, lms.map((v) => Math.cbrt(Math.max(v, 0))));
243
- }
244
- function oklabToSrgb(lab) {
245
- const lms = apply(OKLAB_TO_LMS, lab).map((v) => v * v * v);
246
- return apply(LMS_TO_LINEAR, lms).map(linearChannelToSrgb);
247
- }
248
-
249
- // src/medium/species.ts
250
- var MEDIUM_SPECIES_LIGHTNESS = 0.44;
251
- var MEDIUM_SPECIES_HUE_SPREAD = 32;
252
- var clamp01 = (v) => Math.min(1, Math.max(0, v));
253
- function characterOf(color) {
254
- const [lightness, a, b] = srgbToOklab(color);
255
- return {
256
- hue: Math.atan2(b, a) * 180 / Math.PI,
257
- chroma: Math.hypot(a, b),
258
- lightness
259
- };
260
- }
261
- function speciesFamily(character, spreadDeg = MEDIUM_SPECIES_HUE_SPREAD) {
262
- const { hue, chroma, lightness } = character;
263
- const tone = (deg) => {
264
- const rad = deg * Math.PI / 180;
265
- return oklabToSrgb([lightness, chroma * Math.cos(rad), chroma * Math.sin(rad)]).map(
266
- clamp01
267
- );
268
- };
269
- return [tone(hue - spreadDeg), tone(hue), tone(hue + spreadDeg)];
270
- }
271
- function neutralSpecies(baseColor) {
272
- const { hue, chroma } = characterOf(baseColor);
273
- return speciesFamily({ hue, chroma, lightness: MEDIUM_SPECIES_LIGHTNESS });
274
- }
275
-
276
- // src/medium/params.ts
277
- var BASE_COLOR = [0.07, 0.08, 0.1];
278
- var MEDIUM_DEFAULTS = {
279
- decay: 0.06,
280
- curlFreq: 0.045,
281
- curlSpeed: 0.12,
282
- advectSpeed: 26,
283
- turbulence: 1,
284
- condensationRate: 0.18,
285
- condensationFloor: 0.12,
286
- evaporationRate: 0.2,
287
- condensateSettleSpeed: 8,
288
- condensateSettleWiggle: 0.4,
289
- condensateSpreadRate: 0.08,
290
- condensateTint: 0.2,
291
- condensateGain: 5,
292
- condensateColor: [0.94, 0.95, 0.97],
293
- channelColors: neutralSpecies(BASE_COLOR),
294
- baseColor: BASE_COLOR,
295
- baseWeight: 0.9,
296
- depthFarScale: 1.6,
297
- depthFarOffsetFrac: [0.47, 0.53],
298
- depthFarBlurRadius: 5,
299
- depthFarWeight: 0.5,
300
- gravityVaporDrift: 0.6,
301
- gravityBottomBoost: 2,
302
- gravityBottomBoostStart: 0.75
303
- };
304
- function depthFarOffsetPx(offsetFrac, gridWidth, gridHeight) {
305
- return [offsetFrac[0] * gridWidth, offsetFrac[1] * gridHeight];
306
- }
307
- function wrappedDistanceFromZero(value, period) {
308
- const wrapped = (value % period + period) % period;
309
- return Math.min(wrapped, period - wrapped);
310
- }
311
- var MEDIUM_PROBE_FLOOR_PX = 22;
312
- var MEDIUM_DEFAULT_CELL_PX = 26;
313
- var MEDIUM_TRACK_PRESETS = {
314
- alpha: {
315
- lengthFrac: 0.22,
316
- headWidthFrac: 0.05,
317
- tailWidthFrac: 0.12,
318
- raggedFrac: 0,
319
- raggedFreq: 0,
320
- settleFrac: 0.02,
321
- tailDim: 0.55,
322
- intensity: 1.15
323
- },
324
- beta: {
325
- lengthFrac: 0.42,
326
- headWidthFrac: 0.018,
327
- tailWidthFrac: 0.05,
328
- raggedFrac: 0.045,
329
- raggedFreq: 5,
330
- settleFrac: 0.05,
331
- tailDim: 0.45,
332
- intensity: 0.85
333
- },
334
- natural: {
335
- lengthFrac: 0.13,
336
- headWidthFrac: 0.02,
337
- tailWidthFrac: 0.04,
338
- raggedFrac: 0.02,
339
- raggedFreq: 4,
340
- settleFrac: 0.02,
341
- tailDim: 0.5,
342
- intensity: 0.4
343
- }
344
- };
345
- var MEDIUM_DRIFT_TURBULENCE = 0.045;
346
- var MEDIUM_PLAYING_TURBULENCE_RANGE = [0.55, 1.15];
347
- var MEDIUM_TURBULENCE_TAU = 2.5;
348
- var MEDIUM_EMISSION_BEATS = 4;
349
- var MEDIUM_EMISSION_PROBABILITY = 0.55;
350
- var MEDIUM_MIN_EMISSION_INTERVAL = 1.2;
351
- var MEDIUM_NATURAL_INTERVAL = 25;
352
- var MEDIUM_NATURAL_JITTER = 35;
353
- var MEDIUM_SENSITIVE_TOP = 0.55;
354
- var MEDIUM_SENSITIVE_BOTTOM = 0.95;
355
- var MEDIUM_TRACK_DEPTH_WIDTH_RANGE = [0.55, 1];
356
- var MEDIUM_TRACK_DEPTH_INTENSITY_RANGE = [0.4, 1];
357
-
358
- // src/medium/noise.ts
359
- var VG_VALUE_NOISE = `
360
- float vgHash21(float2 p) {
361
- float h = dot(p, float2(127.1, 311.7));
362
- return fract(sin(h) * 43758.5453123);
363
- }
364
-
365
- float vgValueNoise(float2 p) {
366
- float2 i = floor(p);
367
- float2 f = fract(p);
368
- float a = vgHash21(i);
369
- float b = vgHash21(i + float2(1.0, 0.0));
370
- float c = vgHash21(i + float2(0.0, 1.0));
371
- float d = vgHash21(i + float2(1.0, 1.0));
372
- float2 u = f * f * (3.0 - 2.0 * f);
373
- return mix(mix(a, b, u.x), mix(c, d, u.x), u.y) * 2.0 - 1.0;
374
- }
375
- `;
376
- var glslFloat = (v) => Number.isInteger(v) ? v.toFixed(1) : String(v);
377
- var MEDIUM_TIME_PERIOD = 1e3;
378
- var MEDIUM_TIME_OCTAVES = [
379
- { rate: 0.6, offset: 0, scale: 1 },
380
- { rate: 1.7, offset: 11, scale: 2.03 },
381
- { rate: 0.9, offset: 37, scale: 4.11 },
382
- { rate: 0.15, offset: 5, scale: 0.35 }
383
- ];
384
- function mediumOctavePeriod(rate) {
385
- const period = rate * MEDIUM_TIME_PERIOD;
386
- if (!Number.isInteger(period)) {
387
- throw new Error(
388
- `medium noise: octave rate ${rate} * MEDIUM_TIME_PERIOD ${MEDIUM_TIME_PERIOD} = ${period}, not an integer \u2014 the phase wrap would not be seamless`
389
- );
390
- }
391
- return period;
392
- }
393
- var glslOctave = (o) => ({
394
- rate: glslFloat(o.rate),
395
- offset: glslFloat(o.offset),
396
- scale: glslFloat(o.scale),
397
- period: glslFloat(mediumOctavePeriod(o.rate))
398
- });
399
- var [VG_OCT0, VG_OCT1, VG_OCT2, VG_OCT3] = MEDIUM_TIME_OCTAVES.map(glslOctave);
400
- var VG_CURL_NOISE = `
401
- ${VG_VALUE_NOISE}
402
-
403
- float vgHash31(float3 p) {
404
- float h = dot(p, float3(127.1, 311.7, 74.7));
405
- return fract(sin(h) * 43758.5453123);
406
- }
407
-
408
- // 3D value-noise: time is a third grid axis, not a coordinate shift. A shift would just SLIDE the
409
- // pattern (a "traveling" look, when motion is meant to read as random), while trilinear
410
- // interpolation over t CHANGES the pattern itself between grid nodes \u2014 nearby moments look alike,
411
- // distant ones don't, and no repeat ever shows up.
412
- float vgValueNoise3(float3 p) {
413
- float3 i = floor(p);
414
- float3 f = fract(p);
415
- float3 u = f * f * (3.0 - 2.0 * f);
416
- float n000 = vgHash31(i);
417
- float n100 = vgHash31(i + float3(1.0, 0.0, 0.0));
418
- float n010 = vgHash31(i + float3(0.0, 1.0, 0.0));
419
- float n110 = vgHash31(i + float3(1.0, 1.0, 0.0));
420
- float n001 = vgHash31(i + float3(0.0, 0.0, 1.0));
421
- float n101 = vgHash31(i + float3(1.0, 0.0, 1.0));
422
- float n011 = vgHash31(i + float3(0.0, 1.0, 1.0));
423
- float n111 = vgHash31(i + float3(1.0, 1.0, 1.0));
424
- float nx00 = mix(n000, n100, u.x);
425
- float nx10 = mix(n010, n110, u.x);
426
- float nx01 = mix(n001, n101, u.x);
427
- float nx11 = mix(n011, n111, u.x);
428
- float nxy0 = mix(nx00, nx10, u.y);
429
- float nxy1 = mix(nx01, nx11, u.y);
430
- return mix(nxy0, nxy1, u.z) * 2.0 - 1.0;
431
- }
432
-
433
- // Same as vgValueNoise3, but the z axis wraps at \`period\`: BOTH z-lattice neighbors (i.z and
434
- // i.z + 1.0) are folded into [0, period) before hashing, so this is EXACTLY the same function of
435
- // z and of z + period \u2014 not just close. vgPotential below calls this once per octave, each with
436
- // the period matching its own rate (MEDIUM_TIME_OCTAVES), so a phase that wraps at
437
- // MEDIUM_TIME_PERIOD reproduces the identical field instead of jumping to a new one.
438
- float vgValueNoise3Periodic(float3 p, float period) {
439
- float3 i = floor(p);
440
- float3 f = fract(p);
441
- float3 u = f * f * (3.0 - 2.0 * f);
442
- float z0 = mod(i.z, period);
443
- float z1 = mod(i.z + 1.0, period);
444
- float n000 = vgHash31(float3(i.xy, z0));
445
- float n100 = vgHash31(float3(i.xy + float2(1.0, 0.0), z0));
446
- float n010 = vgHash31(float3(i.xy + float2(0.0, 1.0), z0));
447
- float n110 = vgHash31(float3(i.xy + float2(1.0, 1.0), z0));
448
- float n001 = vgHash31(float3(i.xy, z1));
449
- float n101 = vgHash31(float3(i.xy + float2(1.0, 0.0), z1));
450
- float n011 = vgHash31(float3(i.xy + float2(0.0, 1.0), z1));
451
- float n111 = vgHash31(float3(i.xy + float2(1.0, 1.0), z1));
452
- float nx00 = mix(n000, n100, u.x);
453
- float nx10 = mix(n010, n110, u.x);
454
- float nx01 = mix(n001, n101, u.x);
455
- float nx11 = mix(n011, n111, u.x);
456
- float nxy0 = mix(nx00, nx10, u.y);
457
- float nxy1 = mix(nx01, nx11, u.y);
458
- return mix(nxy0, nxy1, u.z) * 2.0 - 1.0;
459
- }
460
-
461
- // The potential is an fbm of three octaves, each evolving over the field's PHASE at its own speed
462
- // (unrelated to the others, plus a phase offset): no single phase shift can align them all at
463
- // once, so no traveling pattern remains. Each octave wraps its own z-lattice at the period that
464
- // matches its rate (see MEDIUM_TIME_OCTAVES/vgValueNoise3Periodic), so
465
- // vgPotential(p, phase) === vgPotential(p, phase + ${glslFloat(MEDIUM_TIME_PERIOD)}) exactly \u2014 a
466
- // CPU-side phase accumulator can wrap at that period with no visible jump (see web/medium.ts). The
467
- // large-scale factor is a slow non-uniformity layered over the sum \u2014 without it, a field that's
468
- // uniform by statistics still reads as a regular cell pattern.
469
- float vgPotential(float2 p, float phase) {
470
- float v = vgValueNoise3Periodic(float3(p * ${VG_OCT0.scale}, phase * ${VG_OCT0.rate} + ${VG_OCT0.offset}), ${VG_OCT0.period}) * 0.5;
471
- v += vgValueNoise3Periodic(float3(p * ${VG_OCT1.scale}, phase * ${VG_OCT1.rate} + ${VG_OCT1.offset}), ${VG_OCT1.period}) * 0.25;
472
- v += vgValueNoise3Periodic(float3(p * ${VG_OCT2.scale}, phase * ${VG_OCT2.rate} + ${VG_OCT2.offset}), ${VG_OCT2.period}) * 0.125;
473
- float macro = vgValueNoise3Periodic(float3(p * ${VG_OCT3.scale}, phase * ${VG_OCT3.rate} + ${VG_OCT3.offset}), ${VG_OCT3.period});
474
- return v * (0.7 + 0.3 * macro);
475
- }
476
-
477
- // Velocity = (dPsi/dy, -dPsi/dx) \u2014 the curl of a scalar field, solenoidal for any Psi. Central
478
- // differences instead of an analytic derivative: the potential is a sum of three value-noise
479
- // calls, and there is no cheaper way to differentiate it by hand than four extra samples.
480
- float2 vgCurlVelocity(float2 p, float phase) {
481
- float e = 0.6;
482
- float px1 = vgPotential(p + float2(e, 0.0), phase);
483
- float px0 = vgPotential(p - float2(e, 0.0), phase);
484
- float py1 = vgPotential(p + float2(0.0, e), phase);
485
- float py0 = vgPotential(p - float2(0.0, e), phase);
486
- return float2(py1 - py0, -(px1 - px0)) / (2.0 * e);
487
- }
488
-
489
- // vgPotential above is periodic in TIME only: the simulation domain is a torus (gl.REPEAT), but
490
- // the lattice itself never wraps in x/y, so velocity jumps at the domain seam and dye on either
491
- // side of it is transported differently \u2014 a straight seam, made worse wherever something re-reads
492
- // the field at a different scale (the far depth plane's tile boundary). vgValueNoise3Seamless
493
- // wraps ALL THREE lattice axes: xyPeriod/zPeriod fold BOTH neighbors of a cell into their own
494
- // period before hashing, so the field is EXACTLY the same one period over, in space exactly as it
495
- // already was in time.
496
- //
497
- // The period has to be an integer number of lattice cells, or the wrap would jump instead of
498
- // closing seamlessly (the same requirement MEDIUM_TIME_OCTAVES/mediumOctavePeriod enforces for
499
- // time) \u2014 but unlike time, the spatial period depends on the GRID SIZE, which this shader has no
500
- // notion of. So xyPeriod travels together with a per-octave spatial frequency the CPU computes to
501
- // make gridSize * frequency land on that exact integer (see computeMediumSpatialPeriods below);
502
- // both arrive together as one uniform per octave (u_spatialN.xy = frequency, .zw = period),
503
- // recomputed by web/medium.ts whenever the grid resizes.
504
- float vgValueNoise3Seamless(float3 p, float2 xyPeriod, float zPeriod) {
505
- float3 i = floor(p);
506
- float3 f = fract(p);
507
- float3 u = f * f * (3.0 - 2.0 * f);
508
- float x0 = mod(i.x, xyPeriod.x);
509
- float x1 = mod(i.x + 1.0, xyPeriod.x);
510
- float y0 = mod(i.y, xyPeriod.y);
511
- float y1 = mod(i.y + 1.0, xyPeriod.y);
512
- float z0 = mod(i.z, zPeriod);
513
- float z1 = mod(i.z + 1.0, zPeriod);
514
- float n000 = vgHash31(float3(x0, y0, z0));
515
- float n100 = vgHash31(float3(x1, y0, z0));
516
- float n010 = vgHash31(float3(x0, y1, z0));
517
- float n110 = vgHash31(float3(x1, y1, z0));
518
- float n001 = vgHash31(float3(x0, y0, z1));
519
- float n101 = vgHash31(float3(x1, y0, z1));
520
- float n011 = vgHash31(float3(x0, y1, z1));
521
- float n111 = vgHash31(float3(x1, y1, z1));
522
- float nx00 = mix(n000, n100, u.x);
523
- float nx10 = mix(n010, n110, u.x);
524
- float nx01 = mix(n001, n101, u.x);
525
- float nx11 = mix(n011, n111, u.x);
526
- float nxy0 = mix(nx00, nx10, u.y);
527
- float nxy1 = mix(nx01, nx11, u.y);
528
- return mix(nxy0, nxy1, u.z) * 2.0 - 1.0;
529
- }
530
-
531
- // Same four-octave fbm as vgPotential, but every octave reads the seamless lattice above at its
532
- // OWN (frequency, period) pair \u2014 sN.xy replaces that octave's compile-time \`scale\` constant (it
533
- // has to be a uniform now: the adjustment depends on the live grid size), sN.zw is the matching
534
- // integer period. \`p\` is still curlFreq-scaled exactly as vgPotential's caller scales it \u2014 only
535
- // the per-octave multiplier changed from a constant to a grid-dependent uniform, so the finite
536
- // difference in vgCurlVelocitySeamless below needs no epsilon change of its own.
537
- float vgPotentialSeamless(float2 p, float phase, float4 s0, float4 s1, float4 s2, float4 s3) {
538
- float v = vgValueNoise3Seamless(float3(p * s0.xy, phase * ${VG_OCT0.rate} + ${VG_OCT0.offset}), s0.zw, ${VG_OCT0.period}) * 0.5;
539
- v += vgValueNoise3Seamless(float3(p * s1.xy, phase * ${VG_OCT1.rate} + ${VG_OCT1.offset}), s1.zw, ${VG_OCT1.period}) * 0.25;
540
- v += vgValueNoise3Seamless(float3(p * s2.xy, phase * ${VG_OCT2.rate} + ${VG_OCT2.offset}), s2.zw, ${VG_OCT2.period}) * 0.125;
541
- float macro = vgValueNoise3Seamless(float3(p * s3.xy, phase * ${VG_OCT3.rate} + ${VG_OCT3.offset}), s3.zw, ${VG_OCT3.period});
542
- return v * (0.7 + 0.3 * macro);
543
- }
544
-
545
- float2 vgCurlVelocitySeamless(float2 p, float phase, float4 s0, float4 s1, float4 s2, float4 s3) {
546
- float e = 0.6;
547
- float px1 = vgPotentialSeamless(p + float2(e, 0.0), phase, s0, s1, s2, s3);
548
- float px0 = vgPotentialSeamless(p - float2(e, 0.0), phase, s0, s1, s2, s3);
549
- float py1 = vgPotentialSeamless(p + float2(0.0, e), phase, s0, s1, s2, s3);
550
- float py0 = vgPotentialSeamless(p - float2(0.0, e), phase, s0, s1, s2, s3);
551
- return float2(py1 - py0, -(px1 - px0)) / (2.0 * e);
552
- }
553
- `;
554
-
555
- // src/medium/seed-shader.ts
556
- var MEDIUM_SEED_SHADER = `
557
- uniform float2 u_spot0;
558
- uniform float2 u_spot1;
559
- uniform float2 u_spot2;
560
- uniform float u_spotRadius;
561
-
562
- float vgSpot(float2 p, float2 c, float r) {
563
- float d = length(p - c) / max(r, 1.0);
564
- return exp(-d * d * 2.0);
565
- }
566
-
567
- half4 main(float2 xy) {
568
- float3 dye = float3(
569
- vgSpot(xy, u_spot0, u_spotRadius),
570
- vgSpot(xy, u_spot1, u_spotRadius),
571
- vgSpot(xy, u_spot2, u_spotRadius)
572
- );
573
- return half4(half3(dye), half(1.0));
574
- }
575
- `;
576
-
577
- // src/medium/resample-shader.ts
578
- var MEDIUM_RESAMPLE_SHADER = `
579
- uniform shader u_src;
580
-
581
- half4 main(float2 xy) {
582
- float2 uv = xy / u_resolution;
583
- float2 src = uv * u_srcSize;
584
- return u_src.eval(float2(src.x, u_srcSize.y - src.y));
585
- }
586
- `;
587
-
588
- // src/medium/advect-shader.ts
589
- var MEDIUM_ADVECT_UNIFORMS = `
590
- uniform shader u_dye;
591
- uniform float u_dt;
592
- uniform float u_phase;
593
- uniform float u_curlFreq;
594
- uniform float u_advectSpeed;
595
- uniform float u_turbulence;
596
- // One float4 per MEDIUM_TIME_OCTAVES entry: xy is that octave's seamless spatial frequency, zw its
597
- // matching integer lattice period \u2014 both grid-size-dependent, so they can't be compile-time
598
- // constants (see vgPotentialSeamless/computeMediumSpatialPeriods in noise.ts). Recomputed by
599
- // web/medium.ts's bindVelocityUniforms every frame from the live grid dimensions.
600
- uniform float4 u_spatial0;
601
- uniform float4 u_spatial1;
602
- uniform float4 u_spatial2;
603
- uniform float4 u_spatial3;
604
-
605
- ${VG_CURL_NOISE}
606
- `;
607
- var MEDIUM_ADVECT_VELOCITY = `
608
- float2 curl = vgCurlVelocitySeamless(xy * u_curlFreq, u_phase, u_spatial0, u_spatial1, u_spatial2, u_spatial3);
609
- float2 vel = curl * u_advectSpeed * u_turbulence;
610
- `;
611
- var MEDIUM_ADVECT_VELOCITY_SETTLE = `
612
- ${MEDIUM_ADVECT_VELOCITY}
613
- vel.y += u_settleSpeed;
614
- vel.x += curl.x * u_advectSpeed * u_settleWiggle;
615
- `;
616
- var MEDIUM_ADVECT_VELOCITY_VAPOR = `
617
- ${MEDIUM_ADVECT_VELOCITY}
618
- vel.y += u_vaporDrift;
619
- `;
620
- var MEDIUM_VAPOR_FORWARD_SHADER = `
621
- ${MEDIUM_ADVECT_UNIFORMS}
622
- uniform float u_vaporDrift;
623
-
624
- half4 main(float2 xy) {
625
- ${MEDIUM_ADVECT_VELOCITY_VAPOR}
626
- float2 src = xy - vel * u_dt;
627
- return u_dye.eval(float2(src.x, u_dyeSize.y - src.y));
628
- }
629
- `;
630
- var MEDIUM_CONDENSATE_FORWARD_SHADER = `
631
- ${MEDIUM_ADVECT_UNIFORMS}
632
- uniform float u_settleSpeed;
633
- uniform float u_settleWiggle;
634
-
635
- half4 main(float2 xy) {
636
- ${MEDIUM_ADVECT_VELOCITY_SETTLE}
637
- float2 src = xy - vel * u_dt;
638
- return u_dye.eval(float2(src.x, u_dyeSize.y - src.y));
639
- }
640
- `;
641
- var MEDIUM_MACCORMACK_CORRECT = `
642
- float2 srcForward = xy - vel * u_dt;
643
- float2 srcReverse = xy + vel * u_dt;
644
- half4 forwardSelf = u_forward.eval(float2(xy.x, u_forwardSize.y - xy.y));
645
- half4 forwardReverse = u_forward.eval(float2(srcReverse.x, u_forwardSize.y - srcReverse.y));
646
- half4 prevSelf = u_dye.eval(float2(xy.x, u_dyeSize.y - xy.y));
647
- half4 corrected = forwardSelf + half4(0.5) * (prevSelf - forwardReverse);
648
-
649
- float2 src = float2(srcForward.x, u_dyeSize.y - srcForward.y);
650
- float2 base = floor(src - 0.5);
651
- half4 c00 = u_dye.eval(base + float2(0.5, 0.5));
652
- half4 c10 = u_dye.eval(base + float2(1.5, 0.5));
653
- half4 c01 = u_dye.eval(base + float2(0.5, 1.5));
654
- half4 c11 = u_dye.eval(base + float2(1.5, 1.5));
655
- half4 lo = min(min(c00, c10), min(c01, c11));
656
- half4 hi = max(max(c00, c10), max(c01, c11));
657
- half4 limited = clamp(corrected, lo, hi);
658
- `;
659
- var MEDIUM_VAPOR_CORRECT_SHADER = `
660
- ${MEDIUM_ADVECT_UNIFORMS}
661
- uniform shader u_forward;
662
- uniform float u_vaporDrift;
663
-
664
- half4 main(float2 xy) {
665
- ${MEDIUM_ADVECT_VELOCITY_VAPOR}
666
- ${MEDIUM_MACCORMACK_CORRECT}
667
- return limited;
668
- }
669
- `;
670
- var MEDIUM_CONDENSATE_CORRECT_SHADER = `
671
- ${MEDIUM_ADVECT_UNIFORMS}
672
- uniform float u_settleSpeed;
673
- uniform float u_settleWiggle;
674
- uniform shader u_forward;
675
-
676
- half4 main(float2 xy) {
677
- ${MEDIUM_ADVECT_VELOCITY_SETTLE}
678
- ${MEDIUM_MACCORMACK_CORRECT}
679
- return limited;
680
- }
681
- `;
682
- var MEDIUM_VAPOR_REACT_SHADER = `
683
- uniform shader u_transported;
684
- uniform shader u_condensateTransported;
685
- uniform float u_dt;
686
- uniform float u_condensationRate;
687
- uniform float u_condensationFloor;
688
- uniform float u_evaporationRate;
689
- uniform float u_totalScale;
690
-
691
- half4 main(float2 xy) {
692
- float3 prevVapor = float3(u_transported.eval(float2(xy.x, u_transportedSize.y - xy.y)).rgb);
693
- float condensateAtXy = float(u_condensateTransported.eval(float2(xy.x, u_condensateTransportedSize.y - xy.y)).r);
694
- float vaporTotal = prevVapor.r + prevVapor.g + prevVapor.b;
695
-
696
- // Only the EXCESS of vapor above the background floor condenses, not any nonzero density \u2014
697
- // otherwise condensate would exactly retrace the vapor spot's shape (the same outline, or
698
- // softer from blur), leaving the two phases nowhere to visually diverge: vapor is already soft,
699
- // and condensate needs to read brighter and sharper than it. The floor concentrates condensate
700
- // in dense turbulence cores, leaving the sparse vapor around it uncondensed \u2014 that's where the
701
- // contrast comes from.
702
- float excess = max(0.0, vaporTotal - u_condensationFloor);
703
- float condensedAmount = excess * (1.0 - exp(-u_condensationRate * u_dt));
704
- float lossFraction = vaporTotal > 1e-6 ? condensedAmount / vaporTotal : 0.0;
705
- float3 afterLoss = prevVapor * (1.0 - lossFraction);
706
-
707
- float condKeep = exp(-u_evaporationRate * u_dt);
708
- float returned = condensateAtXy * (1.0 - condKeep);
709
-
710
- // Evaporated water is distributed by the CURRENT vapor proportion \u2014 the condensation/
711
- // evaporation cycle doesn't shift the hue, water only oscillates between phases (color belongs
712
- // to vapor).
713
- float sumAfterLoss = afterLoss.r + afterLoss.g + afterLoss.b;
714
- float3 hueShare = sumAfterLoss > 1e-6 ? afterLoss / sumAfterLoss : float3(1.0 / 3.0);
715
- float3 vapor = (afterLoss + hueShare * returned) * u_totalScale;
716
- return half4(half3(vapor), half(1.0));
717
- }
718
- `;
719
- var MEDIUM_CONDENSATE_REACT_SHADER = `
720
- uniform shader u_transported;
721
- uniform shader u_vaporTransported;
722
- uniform shader u_dye;
723
- uniform float u_dt;
724
- uniform float u_condensationRate;
725
- uniform float u_condensationFloor;
726
- uniform float u_evaporationRate;
727
- uniform float u_spreadRate;
728
- uniform float u_totalScale;
729
-
730
- half4 main(float2 xy) {
731
- float prevCondensate = float(u_transported.eval(float2(xy.x, u_transportedSize.y - xy.y)).r);
732
- float3 vaporAtXy = float3(u_vaporTransported.eval(float2(xy.x, u_vaporTransportedSize.y - xy.y)).rgb);
733
- float vaporTotal = vaporAtXy.r + vaporAtXy.g + vaporAtXy.b;
734
-
735
- float excess = max(0.0, vaporTotal - u_condensationFloor);
736
- float condensed = excess * (1.0 - exp(-u_condensationRate * u_dt));
737
- float condKeep = exp(-u_evaporationRate * u_dt);
738
- float afterReaction = prevCondensate * condKeep + condensed;
739
-
740
- // Growth is an Euler step separate from transport: the neighbors are sampled at THIS cell's own
741
- // xy in the ORIGINAL (pre-transport-this-frame) field u_dye, not the already
742
- // transported/corrected value. On a non-uniform flow, warping compresses the domain in some
743
- // places and stretches it in others, and blurring at a warped point stacks those distortions \u2014
744
- // the error accumulates frame over frame (measured: condensate steadily gained about 5% extra
745
- // water alongside its own mass growth). Right on the grid, with no warp, the same blur is an
746
- // honest averaging kernel that conserves the sum on a periodic domain.
747
- float2 selfSrc = float2(xy.x, u_dyeSize.y - xy.y);
748
- float n0 = float(u_dye.eval(float2(selfSrc.x + 1.0, selfSrc.y)).r);
749
- float n1 = float(u_dye.eval(float2(selfSrc.x - 1.0, selfSrc.y)).r);
750
- float n2 = float(u_dye.eval(float2(selfSrc.x, selfSrc.y - 1.0)).r);
751
- float n3 = float(u_dye.eval(float2(selfSrc.x, selfSrc.y + 1.0)).r);
752
- float neighborAvg = (n0 + n1 + n2 + n3) * 0.25;
753
- float spreadWeight = 1.0 - exp(-u_spreadRate * u_dt);
754
- float grown = mix(afterReaction, neighborAvg, spreadWeight) * u_totalScale;
755
-
756
- return half4(half3(grown, 0.0, 0.0), half(1.0));
757
- }
758
- `;
759
- var MEDIUM_TRACK_ADVECT_SHADER = `
760
- ${MEDIUM_ADVECT_UNIFORMS}
761
- uniform float u_decay;
762
-
763
- half4 main(float2 xy) {
764
- ${MEDIUM_ADVECT_VELOCITY}
765
- float2 back = xy - vel * u_dt;
766
- half4 prev = u_dye.eval(float2(back.x, u_dyeSize.y - back.y));
767
- float3 decayed = float3(prev.rgb) * exp(-u_decay * u_dt);
768
- return half4(half3(decayed), half(1.0));
769
- }
770
- `;
771
-
772
- // src/medium/composite-shader.ts
773
- var VG_CUBIC_WEIGHTS = `
774
- float4 vgCubicWeights(float v) {
775
- float4 n = float4(1.0, 2.0, 3.0, 4.0) - v;
776
- float4 s = n * n * n;
777
- float x = s.x;
778
- float y = s.y - 4.0 * s.x;
779
- float z = s.z - 4.0 * s.y + 6.0 * s.x;
780
- float w = 6.0 - x - y - z;
781
- return float4(x, y, z, w) * (1.0 / 6.0);
782
- }
783
- `;
784
- function vgBicubicSampler(fnName, textureName) {
785
- return `
786
- half4 ${fnName}(float2 px) {
787
- float2 shifted = px - 0.5;
788
- float2 fxy = fract(shifted);
789
- float2 base = shifted - fxy;
790
- float4 xw = vgCubicWeights(fxy.x);
791
- float4 yw = vgCubicWeights(fxy.y);
792
- float2 sx = float2(xw.x + xw.y, xw.z + xw.w);
793
- float2 sy = float2(yw.x + yw.y, yw.z + yw.w);
794
- float2 offsetX = float2(base.x - 0.5 + xw.y / sx.x, base.x + 1.5 + xw.w / sx.y);
795
- float2 offsetY = float2(base.y - 0.5 + yw.y / sy.x, base.y + 1.5 + yw.w / sy.y);
796
- half4 s00 = ${textureName}.eval(float2(offsetX.x, offsetY.x));
797
- half4 s10 = ${textureName}.eval(float2(offsetX.y, offsetY.x));
798
- half4 s01 = ${textureName}.eval(float2(offsetX.x, offsetY.y));
799
- half4 s11 = ${textureName}.eval(float2(offsetX.y, offsetY.y));
800
- float wx = sx.x / (sx.x + sx.y);
801
- float wy = sy.x / (sy.x + sy.y);
802
- return mix(mix(s11, s01, wx), mix(s10, s00, wx), wy);
803
- }
804
- `;
805
- }
806
- var MEDIUM_COMPOSITE_SHADER = `
807
- uniform shader u_vapor;
808
- uniform shader u_condensate;
809
- uniform shader u_track;
810
- uniform float2 u_dyeScale;
811
- uniform float3 u_lab0;
812
- uniform float3 u_lab1;
813
- uniform float3 u_lab2;
814
- uniform float3 u_labBg;
815
- uniform float3 u_labCondensate;
816
- uniform float u_baseWeight;
817
- uniform float u_condensateTint;
818
- uniform float u_condensateGain;
819
- uniform float u_farScale;
820
- uniform float2 u_farOffset;
821
- uniform float u_farBlurRadius;
822
- uniform float u_farWeight;
823
- uniform float u_gravityBoost;
824
- uniform float u_gravityBoostStart;
825
-
826
- ${VG_OKLAB_TO_SRGB}
827
- ${VG_CUBIC_WEIGHTS}
828
- ${vgBicubicSampler("vgBicubicVapor", "u_vapor")}
829
- ${vgBicubicSampler("vgBicubicCondensate", "u_condensate")}
830
-
831
- half4 main(float2 xy) {
832
- float2 baseSrc = xy * u_dyeScale;
833
-
834
- // Near plane \u2014 the calibrated look lives here. Bicubic (see the file header) on vapor and
835
- // condensate; track stays a plain bilinear read.
836
- half4 vapor = vgBicubicVapor(baseSrc);
837
- half4 condensate = vgBicubicCondensate(baseSrc);
838
- half4 track = u_track.eval(baseSrc);
839
-
840
- // Far plane \u2014 the identical field, scaled and offset (see the file header). An 8-tap ring, not
841
- // the near plane's \xB1x/\xB1y box: axis-aligned taps read the SAME column/row on both sides of any
842
- // residual axis-aligned structure (a seam, a resize artifact), which is exactly how a straight
843
- // line gets doubled into four parallel copies instead of softened away \u2014 measured directly via
844
- // check-medium.mjs's isotropy gate (see its report). The ring is rotated a half-step (22.5\xB0) off
845
- // the axes so no tap direction ever coincides with a grid row or column. Radius stays in the same
846
- // far-plane texture-space unit as before (u_farBlurRadius, grid-px) \u2014 only the tap PATTERN
847
- // changed, not what it measures in.
848
- float2 farSrc = baseSrc * u_farScale + u_farOffset;
849
- float2 ring0 = float2( 0.9238795, 0.3826834) * u_farBlurRadius;
850
- float2 ring1 = float2( 0.3826834, 0.9238795) * u_farBlurRadius;
851
- float2 ring2 = float2(-0.3826834, 0.9238795) * u_farBlurRadius;
852
- float2 ring3 = float2(-0.9238795, 0.3826834) * u_farBlurRadius;
853
- float2 ring4 = float2(-0.9238795, -0.3826834) * u_farBlurRadius;
854
- float2 ring5 = float2(-0.3826834, -0.9238795) * u_farBlurRadius;
855
- float2 ring6 = float2( 0.3826834, -0.9238795) * u_farBlurRadius;
856
- float2 ring7 = float2( 0.9238795, -0.3826834) * u_farBlurRadius;
857
- half4 vaporFar = (u_vapor.eval(farSrc + ring0) + u_vapor.eval(farSrc + ring1) +
858
- u_vapor.eval(farSrc + ring2) + u_vapor.eval(farSrc + ring3) +
859
- u_vapor.eval(farSrc + ring4) + u_vapor.eval(farSrc + ring5) +
860
- u_vapor.eval(farSrc + ring6) + u_vapor.eval(farSrc + ring7)) * half4(0.125);
861
- half4 condensateFar = (u_condensate.eval(farSrc + ring0) + u_condensate.eval(farSrc + ring1) +
862
- u_condensate.eval(farSrc + ring2) + u_condensate.eval(farSrc + ring3) +
863
- u_condensate.eval(farSrc + ring4) + u_condensate.eval(farSrc + ring5) +
864
- u_condensate.eval(farSrc + ring6) + u_condensate.eval(farSrc + ring7)) * half4(0.125);
865
-
866
- // Gravity's "denser layer at the bottom of the chamber" \u2014 a compositing-only boost (see
867
- // MEDIUM_DEFAULTS.gravityBottomBoost): it scales how density already in the conserved buffers is
868
- // DISPLAYED, never the buffers themselves, so it can't threaten water conservation. Shared by
869
- // both planes: the chamber's floor is denser everywhere along its depth, not just up close.
870
- //
871
- // Verified with a headless render, not assumed: ramping this with xy.y directly lit up the TOP
872
- // of the frame, not the bottom (contentTexture's own orientation contract flips y once more
873
- // between this pass and the final scene \u2014 see the file header) \u2014 hence the 1.0 - below.
874
- float bottomFrac = 1.0 - xy.y / u_resolution.y;
875
- float bottomT = smoothstep(u_gravityBoostStart, 1.0, bottomFrac);
876
- float bottomBoost = 1.0 + u_gravityBoost * bottomT;
877
-
878
- float gasR = (float(vapor.r) + float(vaporFar.r) * u_farWeight) * bottomBoost;
879
- float gasG = (float(vapor.g) + float(vaporFar.g) * u_farWeight) * bottomBoost;
880
- float gasB = (float(vapor.b) + float(vaporFar.b) * u_farWeight) * bottomBoost;
881
- float w0 = gasR + float(track.r);
882
- float w1 = gasG + float(track.g);
883
- float w2 = gasB + float(track.b);
884
- float wBg = u_baseWeight;
885
-
886
- // A faint condensate hint from the LOCAL vapor, not its own color (droplets scatter light
887
- // rather than tint it) \u2014 a fraction of the way from white to the vapor tone sampled right here.
888
- float vaporLocal = max(w0 + w1 + w2, 1e-4);
889
- float3 vaporHue = (u_lab0 * w0 + u_lab1 * w1 + u_lab2 * w2) / vaporLocal;
890
- float3 condensateLab = mix(u_labCondensate, vaporHue, u_condensateTint);
891
- float wCondensate =
892
- (float(condensate.r) + float(condensateFar.r) * u_farWeight) * u_condensateGain * bottomBoost;
893
-
894
- float total = max(w0 + w1 + w2 + wBg + wCondensate, 1e-4);
895
- float3 mixLab =
896
- (u_labBg * wBg + u_lab0 * w0 + u_lab1 * w1 + u_lab2 * w2 + condensateLab * wCondensate) / total;
897
- float3 rgbLinear = clamp(vgOklabToLinear(mixLab), float3(0.0), float3(1.0));
898
- float3 srgb = vgLinearToSrgb(rgbLinear);
899
- return half4(half3(srgb), half(1.0));
900
- }
901
- `;
902
-
903
- // src/medium/emit-shader.ts
904
- var MEDIUM_EMIT_SHADER = `
905
- uniform float2 u_source;
906
- uniform float2 u_head;
907
- uniform float u_headWidth;
908
- uniform float u_tailWidth;
909
- uniform float u_raggedAmp;
910
- uniform float u_raggedFreq;
911
- uniform float u_settle;
912
- uniform float u_tailDim;
913
- uniform float u_intensity;
914
- uniform float u_seed;
915
- uniform float3 u_channelMask;
916
-
917
- ${VG_VALUE_NOISE}
918
-
919
- half4 main(float2 xy) {
920
- float2 dir = u_head - u_source;
921
- float len = max(length(dir), 1.0);
922
- float2 side = float2(-dir.y, dir.x) / len;
923
-
924
- float best = 0.0;
925
- const int STEPS = 12;
926
- for (int i = 0; i < STEPS; i++) {
927
- float s = float(i) / float(STEPS - 1);
928
- float tailness = 1.0 - s;
929
- float ragged = u_raggedAmp * tailness * vgValueNoise(float2(s * u_raggedFreq + u_seed, u_seed * 3.7));
930
- float2 p = mix(u_source, u_head, s) + side * ragged + float2(0.0, u_settle * tailness * tailness);
931
- float w = max(mix(u_tailWidth, u_headWidth, s), 0.5);
932
- float amp = mix(u_tailDim, 1.0, s);
933
- float d = length(xy - p);
934
- float v = amp * exp(-(d * d) / (2.0 * w * w));
935
- best = max(best, v);
936
- }
937
-
938
- float3 dye = u_channelMask * (best * u_intensity);
939
- return half4(half3(dye), half(1.0));
940
- }
941
- `;
942
-
943
- // src/medium/dynamics.ts
944
- function hash01(n) {
945
- const s = Math.sin(n * 12.9898) * 43758.5453;
946
- return s - Math.floor(s);
947
- }
948
- function channelFromSeed(seed) {
949
- const idx = Math.floor(hash01(seed * 1.37) * 3) % 3;
950
- return idx === 0 ? [1, 0, 0] : idx === 1 ? [0, 1, 0] : [0, 0, 1];
951
- }
952
- function lerp(range, t) {
953
- return range[0] + (range[1] - range[0]) * t;
954
- }
955
- function applyTrackDepth(preset, depth) {
956
- const widthScale = lerp(MEDIUM_TRACK_DEPTH_WIDTH_RANGE, depth);
957
- const intensityScale = lerp(MEDIUM_TRACK_DEPTH_INTENSITY_RANGE, depth);
958
- return {
959
- ...preset,
960
- headWidthFrac: preset.headWidthFrac * widthScale,
961
- tailWidthFrac: preset.tailWidthFrac * widthScale,
962
- intensity: preset.intensity * intensityScale
963
- };
964
- }
965
- function buildEmission(presetName, source, seed, intensityScale) {
966
- const preset = MEDIUM_TRACK_PRESETS[presetName];
967
- const depth = hash01(seed * 4.63);
968
- const depthApplied = applyTrackDepth(preset, depth);
969
- return {
970
- ...depthApplied,
971
- intensity: depthApplied.intensity * intensityScale,
972
- source,
973
- angle: hash01(seed * 7.31) * Math.PI * 2,
974
- seed,
975
- channel: channelFromSeed(seed),
976
- depth
977
- };
978
- }
979
- function createMediumDynamics() {
980
- let turbulence = MEDIUM_DRIFT_TURBULENCE;
981
- let lastBar = -1;
982
- let idleClock = 0;
983
- let naturalIndex = 0;
984
- let nextNaturalAt = MEDIUM_NATURAL_INTERVAL * 0.5;
985
- let simTime = 0;
986
- let lastEmissionAt = -Infinity;
987
- function step(input) {
988
- const { state, bpm, amplitude, positionSeconds, sourcePoint, dt } = input;
989
- simTime += dt;
990
- const amp = Math.max(0, Math.min(1, amplitude));
991
- const target = state === "playing" ? MEDIUM_PLAYING_TURBULENCE_RANGE[0] + (MEDIUM_PLAYING_TURBULENCE_RANGE[1] - MEDIUM_PLAYING_TURBULENCE_RANGE[0]) * amp : MEDIUM_DRIFT_TURBULENCE;
992
- turbulence += (target - turbulence) * (1 - Math.exp(-dt / MEDIUM_TURBULENCE_TAU));
993
- const emissions = [];
994
- if (state === "playing" && bpm > 0) {
995
- const beats = positionSeconds * bpm / 60;
996
- const bar = Math.floor(beats / MEDIUM_EMISSION_BEATS);
997
- if (bar !== lastBar) {
998
- lastBar = bar;
999
- const eligible = hash01(bar * 0.618) < MEDIUM_EMISSION_PROBABILITY && simTime - lastEmissionAt >= MEDIUM_MIN_EMISSION_INTERVAL;
1000
- if (eligible) {
1001
- lastEmissionAt = simTime;
1002
- const presetName = hash01(bar * 3.14) < 0.55 ? "alpha" : "beta";
1003
- emissions.push(buildEmission(presetName, sourcePoint, bar, 0.6 + 0.4 * amp));
1004
- }
1005
- }
1006
- } else if (state === "idle") {
1007
- idleClock += dt;
1008
- if (idleClock >= nextNaturalAt) {
1009
- const idx = naturalIndex;
1010
- naturalIndex += 1;
1011
- const randomSource = [
1012
- hash01(idx * 2.1 + 0.5),
1013
- MEDIUM_SENSITIVE_TOP + hash01(idx * 5.9 + 1.7) * (MEDIUM_SENSITIVE_BOTTOM - MEDIUM_SENSITIVE_TOP)
1014
- ];
1015
- emissions.push(buildEmission("natural", randomSource, idx, 1));
1016
- nextNaturalAt = idleClock + MEDIUM_NATURAL_INTERVAL + hash01(idx * 1.7) * MEDIUM_NATURAL_JITTER;
1017
- }
1018
- }
1019
- return { turbulence, emissions };
1020
- }
1021
- return { step };
1022
- }
1023
-
1024
188
  exports.ATOM_AT_REST = ATOM_AT_REST;
1025
189
  exports.DEFAULT_GROWTH_TIMING = DEFAULT_GROWTH_TIMING;
1026
- exports.LINEAR_TO_LMS = LINEAR_TO_LMS;
1027
- exports.LMS_TO_LINEAR = LMS_TO_LINEAR;
1028
- exports.LMS_TO_OKLAB = LMS_TO_OKLAB;
1029
- exports.MEDIUM_COMPOSITE_SHADER = MEDIUM_COMPOSITE_SHADER;
1030
- exports.MEDIUM_CONDENSATE_CORRECT_SHADER = MEDIUM_CONDENSATE_CORRECT_SHADER;
1031
- exports.MEDIUM_CONDENSATE_FORWARD_SHADER = MEDIUM_CONDENSATE_FORWARD_SHADER;
1032
- exports.MEDIUM_CONDENSATE_REACT_SHADER = MEDIUM_CONDENSATE_REACT_SHADER;
1033
- exports.MEDIUM_DEFAULTS = MEDIUM_DEFAULTS;
1034
- exports.MEDIUM_DEFAULT_CELL_PX = MEDIUM_DEFAULT_CELL_PX;
1035
- exports.MEDIUM_DRIFT_TURBULENCE = MEDIUM_DRIFT_TURBULENCE;
1036
- exports.MEDIUM_EMISSION_BEATS = MEDIUM_EMISSION_BEATS;
1037
- exports.MEDIUM_EMISSION_PROBABILITY = MEDIUM_EMISSION_PROBABILITY;
1038
- exports.MEDIUM_EMIT_SHADER = MEDIUM_EMIT_SHADER;
1039
- exports.MEDIUM_MIN_EMISSION_INTERVAL = MEDIUM_MIN_EMISSION_INTERVAL;
1040
- exports.MEDIUM_NATURAL_INTERVAL = MEDIUM_NATURAL_INTERVAL;
1041
- exports.MEDIUM_NATURAL_JITTER = MEDIUM_NATURAL_JITTER;
1042
- exports.MEDIUM_PLAYING_TURBULENCE_RANGE = MEDIUM_PLAYING_TURBULENCE_RANGE;
1043
- exports.MEDIUM_PROBE_FLOOR_PX = MEDIUM_PROBE_FLOOR_PX;
1044
- exports.MEDIUM_RESAMPLE_SHADER = MEDIUM_RESAMPLE_SHADER;
1045
- exports.MEDIUM_SEED_SHADER = MEDIUM_SEED_SHADER;
1046
- exports.MEDIUM_SENSITIVE_BOTTOM = MEDIUM_SENSITIVE_BOTTOM;
1047
- exports.MEDIUM_SENSITIVE_TOP = MEDIUM_SENSITIVE_TOP;
1048
- exports.MEDIUM_SPECIES_HUE_SPREAD = MEDIUM_SPECIES_HUE_SPREAD;
1049
- exports.MEDIUM_SPECIES_LIGHTNESS = MEDIUM_SPECIES_LIGHTNESS;
1050
- exports.MEDIUM_TIME_PERIOD = MEDIUM_TIME_PERIOD;
1051
- exports.MEDIUM_TRACK_ADVECT_SHADER = MEDIUM_TRACK_ADVECT_SHADER;
1052
- exports.MEDIUM_TRACK_DEPTH_INTENSITY_RANGE = MEDIUM_TRACK_DEPTH_INTENSITY_RANGE;
1053
- exports.MEDIUM_TRACK_DEPTH_WIDTH_RANGE = MEDIUM_TRACK_DEPTH_WIDTH_RANGE;
1054
- exports.MEDIUM_TRACK_PRESETS = MEDIUM_TRACK_PRESETS;
1055
- exports.MEDIUM_TURBULENCE_TAU = MEDIUM_TURBULENCE_TAU;
1056
- exports.MEDIUM_VAPOR_CORRECT_SHADER = MEDIUM_VAPOR_CORRECT_SHADER;
1057
- exports.MEDIUM_VAPOR_FORWARD_SHADER = MEDIUM_VAPOR_FORWARD_SHADER;
1058
- exports.MEDIUM_VAPOR_REACT_SHADER = MEDIUM_VAPOR_REACT_SHADER;
1059
- exports.OKLAB_TO_LMS = OKLAB_TO_LMS;
1060
- exports.VG_CURL_NOISE = VG_CURL_NOISE;
1061
- exports.VG_OKLAB_TO_SRGB = VG_OKLAB_TO_SRGB;
1062
- exports.VG_VALUE_NOISE = VG_VALUE_NOISE;
1063
- exports.applyTrackDepth = applyTrackDepth;
1064
190
  exports.atomAtRest = atomAtRest;
1065
191
  exports.atomLift = atomLift;
1066
192
  exports.atomMaterial = atomMaterial;
1067
- exports.characterOf = characterOf;
1068
193
  exports.createGrowthState = createGrowthState;
1069
- exports.createMediumDynamics = createMediumDynamics;
1070
- exports.depthFarOffsetPx = depthFarOffsetPx;
1071
194
  exports.growthFrame = growthFrame;
1072
195
  exports.growthInk = growthInk;
1073
196
  exports.growthPhase = growthPhase;
1074
- exports.neutralSpecies = neutralSpecies;
1075
- exports.oklabToSrgb = oklabToSrgb;
1076
197
  exports.smoothstep = smoothstep;
1077
- exports.speciesFamily = speciesFamily;
1078
- exports.srgbToOklab = srgbToOklab;
1079
198
  exports.stepGrowth = stepGrowth;
1080
199
  exports.stepSpring = stepSpring;
1081
- exports.wrappedDistanceFromZero = wrappedDistanceFromZero;
1082
200
  //# sourceMappingURL=index.cjs.map
1083
201
  //# sourceMappingURL=index.cjs.map