UNPKG

@thi.ng/shader-ast-stdlib

Version:

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

15 lines (14 loc) 451 B
import { F, V2, V3 } from "@thi.ng/shader-ast/api/types"; import { defn, ret } from "@thi.ng/shader-ast/ast/function"; import { add } from "@thi.ng/shader-ast/ast/ops"; import { dot } from "@thi.ng/shader-ast/builtin/math"; const sdfPlane2 = defn(F, "sdPlane2", [V2, V2, F], (p, n, w) => [ ret(add(dot(p, n), w)) ]); const sdfPlane3 = defn(F, "sdPlane3", [V3, V3, F], (p, n, w) => [ ret(add(dot(p, n), w)) ]); export { sdfPlane2, sdfPlane3 };