@thi.ng/shader-ast-stdlib
Version:
Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast
30 lines • 1.1 kB
TypeScript
import type { Vec2Term, Vec4Term } from "@thi.ng/shader-ast";
/**
* Computes UV coord in `[0,1]` interval from given `fragCoord` and screen
* `res`.
*
* @param fragCoord -
* @param res -
*/
export declare const fragUV: (fragCoord: Vec4Term, res: Vec2Term) => import("@thi.ng/shader-ast").Op2<"vec2">;
/**
* Takes `pos`, a screen coord (e.g. gl_FragCoord) and viewport resolution
* `res`, returns aspect corrected uv, with uv.y in `[-1,1]` interval and uv.x
* scaled by the aspect ratio `resx / resy`.
*
* @param fragCoord - vec2
* @param resolution - vec2
*/
export declare const aspectCorrectedUV: import("@thi.ng/shader-ast").TaggedFn2<"vec2", "vec2", "vec2">;
/**
* Returns true if at least one coordinate of the given point is within the
* `width` internal border region of UV rect (`[0,0]`..`[1,1]`).
*
* ```c
* borderMask(vec2(0.91, 0.5), 0.1) // true
* borderMask(vec2(0.2, 0.01), 0.1) // true
* borderMask(vec2(0.2, 0.2), 0.1) // false
* ```
*/
export declare const borderMask: import("@thi.ng/shader-ast").TaggedFn2<"vec2", "float", "bool">;
//# sourceMappingURL=uv.d.ts.map