import { d } from './index'; /** One square cell: its integer index and the `[0,1)²` coordinate within it. */ export declare const CellTile: d.WgslStruct<{ /** Integer cell index — `floor(p)`. Stable per cell, so it is what you hash. */ cell: d.Vec2f; /** Position within the cell, `[0,1)²` — `fract(p)`. What you draw against. */ local: d.Vec2f; }>; /** * Split a scaled UV into its square cell index and in-cell coordinate. * * Both halves come back because a pattern needs both: `local` draws the cell's content, `cell` * seeds its randomness. Splitting them at the call site is where sign bugs creep in — `fract` is * floored in WGSL and `floor` matches it, so this pair is consistent for negative coordinates * (which a rotation or an upstream distortion's `uvContext` will produce). */ export declare const squareTiling: import('typegpu').TgpuFn<(p: d.Vec2f) => d.WgslStruct<{ /** Integer cell index — `floor(p)`. Stable per cell, so it is what you hash. */ cell: d.Vec2f; /** Position within the cell, `[0,1)²` — `fract(p)`. What you draw against. */ local: d.Vec2f; }>>; /** One hexagonal cell: the local vector from its centre, and the centre's own coordinate. */ export declare const HexCell: d.WgslStruct<{ /** Vector from the nearest hex centre to the sample point. Drives edge distance and face cuts. */ gv: d.Vec2f; /** The hex centre in lattice space (`p - gv`). Snap and round this to get a hashable index. */ id: d.Vec2f; }>; /** * Hexagonal lattice lookup: find the nearest hex centre to `p` and return the local offset. * * The standard two-offset-grids trick — a hex lattice is two interleaved rectangular grids, so * folding `p` into both and keeping whichever candidate centre is nearer lands on the correct hex * without any branching. The fold uses {@link geom.flooredMod2} (not WGSL `%`, which is truncated) * so it stays periodic for negative coordinates. * * `s` is the lattice period and picks the ORIENTATION: * * - `vec2f(SQRT3, 1)` — pointy-top hexagons (flat sides left/right). HexGrid's honeycomb. * - `vec2f(1, SQRT3)` — the transpose, flat-top hexagons. What a rhombille / isometric-cube cut * needs, because the three rhombus faces have to meet at a vertical vertex. * * Those two really are the same code with `s` transposed, which is why the orientation is a * parameter and not two functions. */ export declare const hexTiling: import('typegpu').TgpuFn<(p: d.Vec2f, s: d.Vec2f) => d.WgslStruct<{ /** Vector from the nearest hex centre to the sample point. Drives edge distance and face cuts. */ gv: d.Vec2f; /** The hex centre in lattice space (`p - gv`). Snap and round this to get a hashable index. */ id: d.Vec2f; }>>; /** * Skew an equilateral-triangle lattice onto a unit-square integer grid: * `M · p` where `M = [[1, -1/√3], [0, 2/√3]]`. * * Equilateral triangles are awkward to index directly; after this skew each unit square holds * exactly two triangles, split by the anti-diagonal, so `floor`/`fract` indexing works and the * anti-diagonal test (`fract.x + fract.y > 1`) picks which of the pair you are in. * * The result is a sheared space: distances in it are NOT the distances in the original lattice, so * take anti-aliasing footprints from this coordinate (which is what the derivative sees) and read * edge distances in it too, consistently. * * The X term divides by `SQRT3` rather than multiplying by a folded `1/√3`: the two differ in the * last bit, and the division is what the shipped lattice was authored against. */ export declare const triLattice: import('typegpu').TgpuFn<(p: d.Vec2f) => d.Vec2f>; /** * Screen UV of the CENTRE of the cell containing `uv`, for a `cells`-per-shortest-edge lattice * (aspect-corrected, Y-flipped, guarded aspect). * * This is what a pattern generator returns from `mapSampleUVs` so that mapped props are sampled * once per cell rather than once per fragment. Without it, a mapped `thickness` or `dotSize` varies * *within* a cell, which clips the cell's content against the map source's boundaries instead of * transitioning whole cells — the difference between dots that grow and dots that get shaved. * * The round trip is deliberate: correct → snap → un-correct, so the returned value is a screen UV * the composer can sample a map texture with directly. * * See {@link cellCentreUVRotated} for the lattice-with-rotation form. There are two functions * rather than one with a rotation argument because a rotation of zero still costs a `cos`, a `sin`, * and a second un-rotate in the unrotated case. */ export declare const cellCentreUV: import('typegpu').TgpuFn<(uv: d.Vec2f, viewport: d.Vec2f, cells: d.F32) => d.Vec2f>; /** * {@link cellCentreUV} for a lattice rotated by `rotationRad` about the canvas centre: correct + * flip, rotate, snap to the cell centre in rotated space, un-rotate, un-correct. * * The angle arrives in RADIANS — the caller converts, so the degrees-to-radians constant stays at * the shader's own module scope where the rest of its rotation math reads it. */ export declare const cellCentreUVRotated: import('typegpu').TgpuFn<(uv: d.Vec2f, viewport: d.Vec2f, cells: d.F32, rotationRad: d.F32) => d.Vec2f>; /** * Per-cell pseudo-random scalar in `[0, 1)` from an integer cell index. * * The legacy fract-only chain (NO `sin` — unlike {@link rowSpeedHash} below), byte-identical across * the pattern fleet: scale the index by `(123.34, 345.45)` and take the fractional part, cross-couple * the two components through `q + dot(q, q + 34.345)`, then fract their product. It is not a good * hash — it has visible structure at large indices and is sensitive to float precision — but it is * the hash every shipped preset's cell randomness was authored against, so it is frozen (D-6). * * Hash INTEGER indices. Feeding a continuous coordinate produces sub-pixel jitter within a cell * instead of one value per cell; lattices whose centres fall on non-integers (hex, rhombille) must * `round` them onto integers first. * * New shaders: use `noise.hash*` instead. */ export declare const cellHash: import('typegpu').TgpuFn<(id: d.Vec2f) => d.F32>; /** * Per-ROW pseudo-random scalar in `[0, 1)` from a row index — the 1D member of the same legacy * family, and the one that genuinely is a sin-fract chain * (`fract(sin(row * 127.1) * 43758.5453)`), frozen for the same reason (D-6). * * Used to give each row of a pattern its own drift speed. Pass a floored row index. */ export declare const rowSpeedHash: import('typegpu').TgpuFn<(row: d.F32) => d.F32>; /** * Turn a `[0,1)` row hash into a speed multiplier centred on 1: `1 + (hash - 0.5) * 4 * variance`. * * Centred on 1 so `variance = 0` leaves every row at the base speed, and scaled by 4 so a variance * of 1 spans `[-1, 3]` — wide enough that some rows reverse, which is what makes the motion read as * irregular rather than as a single sheared drift. */ export declare const rowSpeedMultiplier: import('typegpu').TgpuFn<(rowHash: d.F32, variance: d.F32) => d.F32>; /** * Turn a `[0,1)` cell hash into a brightness multiplier: `max(1 + (rand - 0.5) * 2 * variation, 0)`. * * Centred on 1 so `variation = 0` is exactly the unmodified colour, spanning `[0, 2]` at full * variation (some cells doubled, some black). The `max(_, 0)` floor matters because the multiplier * is applied to a colour: a negative factor would flip the sign of the RGB and, once blended, * produce colours that are not in the authored palette at all. */ export declare const variationFactor: import('typegpu').TgpuFn<(rand: d.F32, variation: d.F32) => d.F32>; //# sourceMappingURL=cells.d.ts.map