vireuikit 0.2.0 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import { t as VireUIKitMediumParams, s as VireUIKitMediumEmission } from '../dynamics-DelasYER.cjs';
1
+ import { G as VireUIKitMediumParams, F as VireUIKitMediumEmission, a as VireUIKitMediumLight } from '../dynamics-DqGk_f1n.cjs';
2
2
  import { VireGlassBackdropPass } from 'vireglass/web';
3
3
 
4
4
  type MediumRuntime = {
@@ -17,6 +17,13 @@ type MediumRuntime = {
17
17
  * and their own decay extinguishes them; there is no lifetime timer here.
18
18
  */
19
19
  emit(emissions: readonly VireUIKitMediumEmission[]): void;
20
+ /**
21
+ * Ages, drifts and caps the crisp screen-space track layer's own live-track list (see
22
+ * `track-layer.ts`) and folds `emissions` into it as fresh tracks — independent of `emit()`
23
+ * above: that one stamps the SOFT grid residue, this one feeds the SHARP geometry `composite`
24
+ * draws over it. Called once per frame, same as `emit`.
25
+ */
26
+ stepTrackLayer(dt: number, emissions: readonly VireUIKitMediumEmission[]): void;
20
27
  /**
21
28
  * Composites the current density (vapor + condensate + tracks) into a buffer already bound by
22
29
  * the caller (the renderer's `contentFbo`) — this is exactly how the medium acts as the second
@@ -48,6 +55,14 @@ type MediumRuntime = {
48
55
  rows: number;
49
56
  data: number[];
50
57
  } | null;
58
+ /** The raw TRACK grid, at simulation-grid resolution, `data` as one density value per cell (a
59
+ * track carries no color — see `readCondensateGrid`). Used by the "sharp at birth, soft later"
60
+ * gate to measure a stamped track's cross-section directly. */
61
+ readTrackGrid(): {
62
+ cols: number;
63
+ rows: number;
64
+ data: number[];
65
+ } | null;
51
66
  destroy(): void;
52
67
  };
53
68
  declare function createMediumRuntime(gl: WebGL2RenderingContext, vertexSource: string): MediumRuntime;
@@ -84,8 +99,54 @@ type MediumBackdrop = {
84
99
  rows: number;
85
100
  data: number[];
86
101
  } | null;
102
+ readTrackGrid(): {
103
+ cols: number;
104
+ rows: number;
105
+ data: number[];
106
+ } | null;
87
107
  destroy(): void;
88
108
  };
89
109
  declare function createMediumBackdrop(): MediumBackdrop;
90
110
 
91
- export { type MediumBackdrop, type MediumFrame, type MediumRuntime, createMediumBackdrop, createMediumRuntime };
111
+ /** One track alive in the crisp layer: the original emission (never mutated) plus its age and
112
+ * drift. */
113
+ type VireUIKitLiveTrack = {
114
+ emission: VireUIKitMediumEmission;
115
+ /** Seconds since the track appeared. Negative while a burst ray is still waiting for its turn. */
116
+ age: number;
117
+ /** Accumulated rigid drift, as a fraction of `min(contentWidth, contentHeight)`. */
118
+ driftX: number;
119
+ driftY: number;
120
+ };
121
+ /** `(1 - age/life) ** gamma`, reaching exactly 0 at `age >= life`, so dropping a track never pops. */
122
+ declare function trackLayerFade(age: number, life: number): number;
123
+ /** Diffusion: droplets spread sideways as `sqrt(age)`, the way an ink line blurs. */
124
+ declare function trackLayerSigmaMul(age: number, broaden: number): number;
125
+ type VireUIKitTrackLayer = {
126
+ /**
127
+ * Ages and drifts every live track by `dt`, drops anything past its own life, appends
128
+ * `emissions` as fresh tracks and caps the list at `MEDIUM_TRACK_LAYER_MAX_TRACKS` (oldest out).
129
+ * Alpha rays arriving in one call are one burst: the first few appear at once, the rest are born
130
+ * over `MEDIUM_TRACK_LAYER_BURST_SPREAD` seconds.
131
+ */
132
+ step(dt: number, emissions: readonly VireUIKitMediumEmission[]): readonly VireUIKitLiveTrack[];
133
+ };
134
+ declare function createTrackLayer(): VireUIKitTrackLayer;
135
+
136
+ /** Fraction-space live tracks → per-instance floats in content px, y down like the emission
137
+ * fractions and the backdrop target (drift is y-up, hence its sign flip). Skips tracks not yet born,
138
+ * fully faded, or everything when `amount <= 0` (the canary `check:medium` uses). Exported for
139
+ * testing without a GPU. */
140
+ declare function buildTrackLayerInstances(tracks: readonly VireUIKitLiveTrack[], contentWidth: number, contentHeight: number, amount: number): {
141
+ data: Float32Array;
142
+ count: number;
143
+ };
144
+ type TrackLayerProgram = {
145
+ /** Draws the instances additively into the currently bound framebuffer. Leaves blending enabled;
146
+ * the renderer restores its own state after the backdrop pass. */
147
+ draw(contentWidth: number, contentHeight: number, data: Float32Array, count: number, trackLightFloor: number, lights: readonly (VireUIKitMediumLight | undefined)[], shadow: WebGLTexture): void;
148
+ destroy(): void;
149
+ };
150
+ declare function createTrackLayerProgram(gl: WebGL2RenderingContext): TrackLayerProgram;
151
+
152
+ export { type MediumBackdrop, type MediumFrame, type MediumRuntime, type TrackLayerProgram, type VireUIKitLiveTrack, type VireUIKitTrackLayer, buildTrackLayerInstances, createMediumBackdrop, createMediumRuntime, createTrackLayer, createTrackLayerProgram, trackLayerFade, trackLayerSigmaMul };
@@ -1,4 +1,4 @@
1
- import { t as VireUIKitMediumParams, s as VireUIKitMediumEmission } from '../dynamics-DelasYER.js';
1
+ import { G as VireUIKitMediumParams, F as VireUIKitMediumEmission, a as VireUIKitMediumLight } from '../dynamics-DqGk_f1n.js';
2
2
  import { VireGlassBackdropPass } from 'vireglass/web';
3
3
 
4
4
  type MediumRuntime = {
@@ -17,6 +17,13 @@ type MediumRuntime = {
17
17
  * and their own decay extinguishes them; there is no lifetime timer here.
18
18
  */
19
19
  emit(emissions: readonly VireUIKitMediumEmission[]): void;
20
+ /**
21
+ * Ages, drifts and caps the crisp screen-space track layer's own live-track list (see
22
+ * `track-layer.ts`) and folds `emissions` into it as fresh tracks — independent of `emit()`
23
+ * above: that one stamps the SOFT grid residue, this one feeds the SHARP geometry `composite`
24
+ * draws over it. Called once per frame, same as `emit`.
25
+ */
26
+ stepTrackLayer(dt: number, emissions: readonly VireUIKitMediumEmission[]): void;
20
27
  /**
21
28
  * Composites the current density (vapor + condensate + tracks) into a buffer already bound by
22
29
  * the caller (the renderer's `contentFbo`) — this is exactly how the medium acts as the second
@@ -48,6 +55,14 @@ type MediumRuntime = {
48
55
  rows: number;
49
56
  data: number[];
50
57
  } | null;
58
+ /** The raw TRACK grid, at simulation-grid resolution, `data` as one density value per cell (a
59
+ * track carries no color — see `readCondensateGrid`). Used by the "sharp at birth, soft later"
60
+ * gate to measure a stamped track's cross-section directly. */
61
+ readTrackGrid(): {
62
+ cols: number;
63
+ rows: number;
64
+ data: number[];
65
+ } | null;
51
66
  destroy(): void;
52
67
  };
53
68
  declare function createMediumRuntime(gl: WebGL2RenderingContext, vertexSource: string): MediumRuntime;
@@ -84,8 +99,54 @@ type MediumBackdrop = {
84
99
  rows: number;
85
100
  data: number[];
86
101
  } | null;
102
+ readTrackGrid(): {
103
+ cols: number;
104
+ rows: number;
105
+ data: number[];
106
+ } | null;
87
107
  destroy(): void;
88
108
  };
89
109
  declare function createMediumBackdrop(): MediumBackdrop;
90
110
 
91
- export { type MediumBackdrop, type MediumFrame, type MediumRuntime, createMediumBackdrop, createMediumRuntime };
111
+ /** One track alive in the crisp layer: the original emission (never mutated) plus its age and
112
+ * drift. */
113
+ type VireUIKitLiveTrack = {
114
+ emission: VireUIKitMediumEmission;
115
+ /** Seconds since the track appeared. Negative while a burst ray is still waiting for its turn. */
116
+ age: number;
117
+ /** Accumulated rigid drift, as a fraction of `min(contentWidth, contentHeight)`. */
118
+ driftX: number;
119
+ driftY: number;
120
+ };
121
+ /** `(1 - age/life) ** gamma`, reaching exactly 0 at `age >= life`, so dropping a track never pops. */
122
+ declare function trackLayerFade(age: number, life: number): number;
123
+ /** Diffusion: droplets spread sideways as `sqrt(age)`, the way an ink line blurs. */
124
+ declare function trackLayerSigmaMul(age: number, broaden: number): number;
125
+ type VireUIKitTrackLayer = {
126
+ /**
127
+ * Ages and drifts every live track by `dt`, drops anything past its own life, appends
128
+ * `emissions` as fresh tracks and caps the list at `MEDIUM_TRACK_LAYER_MAX_TRACKS` (oldest out).
129
+ * Alpha rays arriving in one call are one burst: the first few appear at once, the rest are born
130
+ * over `MEDIUM_TRACK_LAYER_BURST_SPREAD` seconds.
131
+ */
132
+ step(dt: number, emissions: readonly VireUIKitMediumEmission[]): readonly VireUIKitLiveTrack[];
133
+ };
134
+ declare function createTrackLayer(): VireUIKitTrackLayer;
135
+
136
+ /** Fraction-space live tracks → per-instance floats in content px, y down like the emission
137
+ * fractions and the backdrop target (drift is y-up, hence its sign flip). Skips tracks not yet born,
138
+ * fully faded, or everything when `amount <= 0` (the canary `check:medium` uses). Exported for
139
+ * testing without a GPU. */
140
+ declare function buildTrackLayerInstances(tracks: readonly VireUIKitLiveTrack[], contentWidth: number, contentHeight: number, amount: number): {
141
+ data: Float32Array;
142
+ count: number;
143
+ };
144
+ type TrackLayerProgram = {
145
+ /** Draws the instances additively into the currently bound framebuffer. Leaves blending enabled;
146
+ * the renderer restores its own state after the backdrop pass. */
147
+ draw(contentWidth: number, contentHeight: number, data: Float32Array, count: number, trackLightFloor: number, lights: readonly (VireUIKitMediumLight | undefined)[], shadow: WebGLTexture): void;
148
+ destroy(): void;
149
+ };
150
+ declare function createTrackLayerProgram(gl: WebGL2RenderingContext): TrackLayerProgram;
151
+
152
+ export { type MediumBackdrop, type MediumFrame, type MediumRuntime, type TrackLayerProgram, type VireUIKitLiveTrack, type VireUIKitTrackLayer, buildTrackLayerInstances, createMediumBackdrop, createMediumRuntime, createTrackLayer, createTrackLayerProgram, trackLayerFade, trackLayerSigmaMul };