UNPKG

@thi.ng/shader-ast

Version:

DSL to define shader code in TypeScript and cross-compile to GLSL, JS and other targets

36 lines (35 loc) 832 B
import { builtinCall } from "../ast/function.js"; const $bvec = (t) => "bvec" + t[t.length - 1]; const $call = (fn, a, b) => builtinCall(fn, $bvec(a.type), a, b); function lessThan(a, b) { return $call("lessThan", a, b); } function lessThanEqual(a, b) { return $call("lessThanEqual", a, b); } function greaterThan(a, b) { return $call("greaterThan", a, b); } function greaterThanEqual(a, b) { return $call("greaterThanEqual", a, b); } function equal(a, b) { return $call("equal", a, b); } function notEqual(a, b) { return $call("notEqual", a, b); } const _any = (v) => builtinCall("any", "bool", v); const all = (v) => builtinCall("all", "bool", v); const _not = (v) => builtinCall("not", v.type, v); export { _any, _not, all, equal, greaterThan, greaterThanEqual, lessThan, lessThanEqual, notEqual };