Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vec4 when_eq(vec4 x, vec4 y) {
return 1.0 - abs(sign(x - y));
}
vec4 when_neq(vec4 x, vec4 y) {
return abs(sign(x - y));
}
vec4 when_gt(vec4 x, vec4 y) {
return max(sign(x - y), 0.0);
}
vec4 when_lt(vec4 x, vec4 y) {
return max(sign(y - x), 0.0);
}
vec4 when_ge(vec4 x, vec4 y) {
return 1.0 - when_lt(x, y);
}
vec4 when_le(vec4 x, vec4 y) {
return 1.0 - when_gt(x, y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment