UNPKG

@thi.ng/shader-ast-stdlib

Version:

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

13 lines (12 loc) 347 B
import { F } from "@thi.ng/shader-ast/api/types"; import { defn, ret } from "@thi.ng/shader-ast/ast/function"; import { dot } from "@thi.ng/shader-ast/builtin/math"; const $ = (n) => defn(F, `magSq${n}`, [`vec${n}`], (v) => [ret(dot(v, v))]); const magSq2 = $(2); const magSq3 = $(3); const magSq4 = $(4); export { magSq2, magSq3, magSq4 };