@thi.ng/shader-ast-stdlib
Version:
Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast
14 lines (13 loc) • 511 B
JavaScript
import { $x, $xy, $xyz } from "@thi.ng/shader-ast/ast/swizzle";
import { texture } from "@thi.ng/shader-ast/builtin/texture";
import { indexToUV } from "./index-uv.js";
const readIndex1 = (tex, i, size) => $x(readIndex4(tex, i, size));
const readIndex2 = (tex, i, size) => $xy(readIndex4(tex, i, size));
const readIndex3 = (tex, i, size) => $xyz(readIndex4(tex, i, size));
const readIndex4 = (tex, i, size) => texture(tex, indexToUV(i, size));
export {
readIndex1,
readIndex2,
readIndex3,
readIndex4
};