mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 15:22:27 +02:00
30 lines
868 B
Plaintext
30 lines
868 B
Plaintext
mediump float toLinear(mediump float sRGB)
|
|
{
|
|
mediump float higher = pow((sRGB + 0.055)/1.055, 2.4);
|
|
mediump float lower = sRGB/12.92;
|
|
#ifdef HAS_BOOL_MIX
|
|
bool cutoff = sRGB < 0.04045;
|
|
return mix(higher, lower, cutoff);
|
|
#else
|
|
// Fake it; this is 0.0 if 'lower' should be used, 1.0 if 'higher' should be used
|
|
mediump float s = max(0.0, sign(sRGB - 0.04045));
|
|
return mix(lower, higher, s);
|
|
#endif
|
|
}
|
|
|
|
void fragment()
|
|
{
|
|
// NOTE: This shader does NOT work correctly!!!
|
|
// This assumes the depth is projected onto a circle, which it IS NOT.
|
|
|
|
highp float PI = 3.1415;
|
|
highp vec2 uv = (UV * 2.0) - 1.0;
|
|
highp float angle = atan(uv.y, -uv.x) + PI + radians(135.0);
|
|
|
|
angle = mod(angle, 2.0 * PI);
|
|
angle /= (PI * 2.0);
|
|
|
|
highp float val = zTexture(vec2(angle, 0.5)).r / 8.0;
|
|
COLOR = vec4(vec3(toLinear(val)), 0.5);
|
|
}
|