Files
2026-01-09 23:21:38 +00:00

25 lines
406 B
GLSL
Executable File

#define M_FLOAT_EPS 1e-8
float mx_square(float x)
{
return x*x;
}
vec2 mx_square(vec2 x)
{
return x*x;
}
vec3 mx_square(vec3 x)
{
return x*x;
}
vec3 mx_srgb_encode(vec3 color)
{
bvec3 isAbove = greaterThan(color, vec3(0.0031308));
vec3 linSeg = color * 12.92;
vec3 powSeg = 1.055 * pow(max(color, vec3(0.0)), vec3(1.0 / 2.4)) - 0.055;
return mix(linSeg, powSeg, isAbove);
}