UNPKG

@thi.ng/shader-ast-stdlib

Version:

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

16 lines (15 loc) 408 B
import { vec2 } from "@thi.ng/shader-ast/ast/lit"; import { mul } from "@thi.ng/shader-ast/ast/ops"; import { cos, sin } from "@thi.ng/shader-ast/builtin/math"; const sincos = (x, r) => { const res = vec2(sin(x), cos(x)); return r != void 0 ? mul(res, r) : res; }; const cossin = (x, r) => { const res = vec2(cos(x), sin(x)); return r != void 0 ? mul(res, r) : res; }; export { cossin, sincos };