Skip to content

Commit

Permalink
feat(shader-ast-stdlib): add pre/postmultiplyAlpha() fns
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 4, 2023
1 parent f5bbcc8 commit 367ebbd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/shader-ast-stdlib/src/color/porter-duff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ export const porterDuff = (
];
});

export const premultiplyAlpha = (col: Vec4Sym) =>
vec4(mul($xyz(col), $w(col)), $w(col));

export const postmultiplyAlpha = (col: Vec4Sym) =>
vec4(div($xyz(col), $w(col)), $w(col));

// coefficient functions

export const ZERO = () => FLOAT0;
Expand Down

0 comments on commit 367ebbd

Please sign in to comment.