import { d } from './index'; import { Expr, KitTexture, SharedSamplerName } from '../contract'; /** * Catmull-Rom tap POSITIONS for one axis, in normalised (UV) space: `(pos0, pos12, pos3)`. * `pos12` is offset off the texel centre so one bilinear tap covers the inner texel pair with the * correct ratio. `uv` is that axis's UV; `texSize` that axis's size in texels. */ export declare const catmullRomAxisPositions: import('typegpu').TgpuFn<(uv: d.F32, texSize: d.F32) => d.Vec3f>; /** * Catmull-Rom tap WEIGHTS for one axis: `(w0, w1 + w2, w3)`, matching * `catmullRomAxisPositions`. Sums to 1 (the cubic is a partition of unity), so a 3×3 product * of two axes' weights also sums to 1 — no renormalisation needed. */ export declare const catmullRomAxisWeights: import('typegpu').TgpuFn<(uv: d.F32, texSize: d.F32) => d.Vec3f>; /** WGSL identifier overrides for {@link bSplineTapSetup}'s emitted fn and struct. */ export interface BSplineTapNames { /** WGSL name of the setup fn. */ fnName?: string; /** WGSL name of the returned struct. */ structName?: string; } /** * Cubic B-SPLINE tap setup for a square texture of `gridSize` texels, as four hardware-bilinear * taps plus their weights (weights sum to 1). * * Where Catmull-Rom above is an INTERPOLATING filter for reconstructing image detail, the B-spline * is an APPROXIMATING one: it does not pass through the texel values, it smooths them, and it is * C1 — the reason to reach for it is a low-resolution FIELD whose derivative is visible. Hardware * bilinear is only C0, so a displacement field sampled bilinearly kinks at every cell border and a * sharp edge dragged by the field renders each kink as a ~1-cell scallop. PixelThrow's flow grid is * the exemplar. * * The 4×4 cubic footprint collapses to 2 bilinear fetches per axis (offsets h0/h1 with weights * g0/g1) — the classic GPU Gems trick. Sampling is the CALLER's job: take the four tap UVs through * whatever sampler and edge mode it wants, and weight by `w.x/.y/.z/.w` in that order. * * This is a factory, not a plain fn, because `gridSize` folds into the body as a literal (C3): call * it once per grid size at module scope and reuse the result. Results are memoised per * `gridSize|fnName|structName`. Both names land verbatim in the WGSL, so a migrating shader passes * the names it already emitted and its snapshot does not move. */ export declare function bSplineTapSetup(gridSize: number, names?: BSplineTapNames): { Taps: d.WgslStruct<{ uvA: d.Vec2f; uvB: d.Vec2f; uvC: d.Vec2f; uvD: d.Vec2f; w: d.Vec4f; }>; setup: import('typegpu').TgpuFn<(uv: d.Vec2f) => d.WgslStruct<{ uvA: d.Vec2f; uvB: d.Vec2f; uvC: d.Vec2f; uvD: d.Vec2f; w: d.Vec4f; }>>; }; /** * Expr-level Catmull-Rom sample of `tex` at `uv` — a drop-in replacement for `tex.sample(uv)` * on the RTT path of a distortion that can scale content up. * * Costs 9 bilinear taps instead of 1, so use it where reconstruction quality is the point (a * magnifying distortion resampling composed content) and keep the plain bilinear sample * everywhere content is moved around at ~1:1. * * Taps reach up to 1.5 texels beyond `uv`, and they go through the SAME sampler as `uv` itself * — with `linearClamp` that means the footprint clamps at the texture border rather than * wrapping, which is why the callers below only use this for the clamp/transparent edge modes. * * `range` bounds the cubic's ringing. `'positive'` (default) only kills undershoot below zero, * which is all an HDR premultiplied RTT needs — overshoot there is the edge acutance we want, and * the tonemap deals with the range. `'unit'` also clips overshoot above 1, for an LDR source whose * channels are consumed as-is (a glyph atlas's alpha, where >1 would over-brighten the blend). */ export declare const sampleCatmullRomExpr: (tex: KitTexture, uv: Expr, sampler?: SharedSamplerName, range?: "positive" | "unit") => Expr; //# sourceMappingURL=sampling.d.ts.map