UNPKG

@thi.ng/shader-ast-stdlib

Version:

Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast

11 lines (10 loc) 343 B
import { F } from "@thi.ng/shader-ast/api/types"; import { defn, ret } from "@thi.ng/shader-ast/ast/function"; import { clamp01 } from "../math/clamp.js"; import { fitNorm1 } from "../math/fit.js"; const fogLinear = defn(F, "fogLinear", [F, F, F], (dist, start, end) => [ ret(clamp01(fitNorm1(dist, start, end))) ]); export { fogLinear };