import { d } from './index'; import { v2f, v4f } from 'typegpu/data'; import { Expr, KitTexture } from '../contract'; /** Stretch (mode 0): clamp UV into [0,1] (`clamp(uv, vec2(0), vec2(1))`). */ export declare const edgeClampUV: import('typegpu').TgpuFn<(uv: d.Vec2f) => d.Vec2f>; /** * Mirror (mode 2): reflect UV back into [0,1]. Per-component: `m = mod(abs(x), 2); m > 1 ? * 2 - m : m`. The `m >= 1.0` reflection predicate is equivalent to `step(1, m)`. */ export declare const edgeMirrorUV: import('typegpu').TgpuFn<(uv: d.Vec2f) => d.Vec2f>; /** Wrap (mode 3): tile UV via `fract(uv)`. */ export declare const edgeWrapUV: import('typegpu').TgpuFn<(uv: d.Vec2f) => d.Vec2f>; /** * Transparent (mode 1) coverage: 1 where the looked-up UV is inside [0,1] on both axes, * else 0 (`step(0,x)*step(x,1)*step(0,y)*step(y,1)`). */ export declare const edgeTransparentMask: import('typegpu').TgpuFn<(uv: d.Vec2f) => d.F32>; /** * Applies edge handling as a UV transformation (no color sampling). Used during UV * composition so each distortion in a chain applies its own edge handling before the next * transforms those UVs further. * * - transparent (1): pass-through (coverage is dropped later, at the color stage). * - mirror (2) / wrap (3) / stretch (0): the matching per-mode `tgpu.fn`. */ export declare const applyEdgeToUV: (uv: v2f, edgeMode: number) => v2f; /** * Bakes edge handling into a UV-remap step for the analytic fast path. Returns the * coordinate to look up one layer down plus an updated coverage mask: * - transparent (1): leaves the UV alone and drops coverage where the looked-up coordinate * falls outside [0,1] (matches applyEdgeHandling's alpha cut). * - stretch/mirror/wrap (0/2/3): transforms the UV via applyEdgeToUV, mask unchanged. */ export declare const composeEdgeRemap: (distortedUV: v2f, mask: number, edgeMode: number) => { uv: v2f; mask: number; }; /** * Applies edge handling to sampled colors based on UV bounds. Supports the four modes for * distorted UVs that fall outside [0,1]. * * @param distortedUV the distorted UV (pre-clamp) * @param sampledColor the color sampled with clamped UVs * @param sample re-sample callback (bind `kitTexture.sample`), or null for the * non-RTT path — mirror/wrap then fall back to stretch, as before * @param edgeMode 0=stretch, 1=transparent, 2=mirror, 3=wrap */ export declare const applyEdgeHandling: (distortedUV: v2f, sampledColor: v4f, sample: ((uv: v2f) => v4f) | null, edgeMode: number) => v4f; /** * Expr-level `applyEdgeToUV`: transform a distorted-UV Expr per the compile-time edge mode. * transparent (1) passes the UV through (coverage is dropped at the color/mask stage); mirror * (2) / wrap (3) / stretch (0) emit the matching per-mode fn call. */ export declare const applyEdgeToUVExpr: (uv: Expr, edgeMode: number) => Expr; /** * Expr-level `composeEdgeRemap` for the analytic UV-fold fast path. Returns the coordinate to * look up one layer down plus an updated coverage mask: * - transparent (1): UV unchanged; multiply the mask by the in-bounds coverage of the looked-up * coordinate (`edgeTransparentMask`). * - stretch/mirror/wrap (0/2/3): transform the UV via `applyEdgeToUVExpr`, mask unchanged. */ export declare const composeEdgeRemapExpr: (distortedUV: Expr, mask: Expr, edgeMode: number) => { uv: Expr; mask: Expr; }; /** * Expr-level `applyEdgeHandling` for the RTT-filter path — edge handling on a SAMPLED color. * Supply a `sample` callback (bind `kitTexture.sample`) that samples the composed content at a * UV Expr. * - transparent (1): sample straight, then fade alpha to 0 outside [0,1] (`edgeTransparentMask`). * - mirror (2) / wrap (3): re-sample at the reflected / tiled UV. * - stretch (0): sample straight (the linearClamp sampler clamps out-of-range UVs to the edge). */ export declare const applyEdgeHandlingExpr: (distortedUV: Expr, sample: (uv: Expr) => Expr, edgeMode: number) => Expr; /** * `applyEdgeHandlingExpr` with the best RECONSTRUCTION FILTER for the mode — the one-liner a * geometric distortion's RTT path should use instead of hand-rolling `(uv) => tex.sample(uv)`. * * A distortion that scales content up is resampling a texture at less than one texel per pixel, * and a single bilinear tap reconstructs hard edges (text, logos, clip boundaries) as visible * facets. Catmull-Rom (kit/sampling) fixes that for 9 taps. Per mode: * - stretch (0) / transparent (1): Catmull-Rom through `linearClamp` — the footprint clamps at * the border, which is exactly what both modes want. * - wrap (3): Catmull-Rom through `linearRepeat`, so taps that reach past the edge tile instead * of clamping (no seam). * - mirror (2): plain bilinear. There is no mirror-repeat sampler in the shared kit set, so a * wide footprint would clamp across the reflection seam; not worth a sampler for the one mode. * * Distortions that are deliberately blocky (Pixelate), already low-pass (DiffuseBlur), or take * many taps per pixel (chromatic splits) should keep the plain bilinear path. */ export declare const sampleRemappedExpr: (tex: KitTexture, distortedUV: Expr, edgeMode: number) => Expr; //# sourceMappingURL=edges.d.ts.map