24 lines
707 B
GLSL
24 lines
707 B
GLSL
highp vec3 brightness3(highp vec3 c, highp float val)
|
|
{
|
|
return clamp(c + vec3(val * 2.0 - 1.0), vec3(0), vec3(1));
|
|
}
|
|
|
|
highp vec3 contrast3(highp vec3 c, highp float val)
|
|
{
|
|
highp float v = val * 2.0 - 1.0;
|
|
highp float factor = ((259.0 / 255.0) * (v + 1.0)) / (1.0 * ((259.0 / 255.0) - v));
|
|
return clamp(factor * (c - 0.5) + 0.5, vec3(0), vec3(1));
|
|
}
|
|
|
|
highp float brightness1(highp float c, highp float val)
|
|
{
|
|
return clamp(c + (val * 2.0 - 1.0), 0.0, 1.0);
|
|
}
|
|
|
|
highp float contrast1(highp float c, highp float val)
|
|
{
|
|
highp float v = val * 2.0 - 1.0;
|
|
highp float factor = ((259.0 / 255.0) * (v + 1.0)) / (1.0 * ((259.0 / 255.0) - v));
|
|
return clamp(factor * (c - 0.5) + 0.5, 0.0, 1.0);
|
|
}
|