mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-02-01 11:34:59 +01:00
15 lines
485 B
GLSL
15 lines
485 B
GLSL
// Return 0 if x < 1 otherwise 1
|
|
#define zero_or_one(x) step(1.f, x)
|
|
// condition must be zero or one. When 1 thenval is returned otherwise elseval
|
|
#define if_one_then(condition, thenval, elseval) mix(elseval, thenval, condition)
|
|
// a < b ? thenval : elseval
|
|
#define if_less_than(a, b, thenval, elseval) mix(thenval, elseval, step(b, a))
|
|
|
|
vec4 vec4_premul(vec3 rgb, float a) {
|
|
return vec4(rgb * a, a);
|
|
}
|
|
|
|
vec4 vec4_premul(vec4 rgba) {
|
|
return vec4(rgba.rgb * rgba.a, rgba.a);
|
|
}
|