From d6567010bf1c65abcbe09b959cde63664778d923 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 29 Oct 2016 20:48:09 -0300 Subject: -Many many fixes -Gizmos work again --- drivers/gles3/shaders/copy.glsl | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'drivers/gles3/shaders/copy.glsl') diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index eb58d66431..79982ecf25 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -5,9 +5,9 @@ layout(location=0) in highp vec4 vertex_attrib; #ifdef USE_CUBEMAP layout(location=4) in vec3 cube_in; #else -layout(location=4) in vec2 uv_in; // attrib:4 +layout(location=4) in vec2 uv_in; #endif -layout(location=5) in vec2 uv2_in; // attrib:5 +layout(location=5) in vec2 uv2_in; #ifdef USE_CUBEMAP out vec3 cube_interp; @@ -40,6 +40,15 @@ uniform sampler2D source; //texunit:0 #endif +float sRGB_gamma_correct(float c){ + float a = 0.055; + if(c < 0.0031308) + return 12.92*c; + else + return (1.0+a)*pow(c, 1.0/2.4) - a; +} + + uniform float stuff; in vec2 uv2_interp; @@ -57,6 +66,20 @@ void main() { vec4 color = texture( source, uv_interp ); #endif +#ifdef LINEAR_TO_SRGB + //regular Linear -> SRGB conversion + vec3 a = vec3(0.055); + color.rgb = mix( (vec3(1.0)+a)*pow(color.rgb,vec3(1.0/2.4))-a , 12.92*color.rgb , lessThan(color.rgb,vec3(0.0031308))); +#endif + +#ifdef DEBUG_GRADIENT + color.rg=uv_interp; + color.b=0.0; +#endif + +#ifdef DISABLE_ALPHA + color.a=1.0; +#endif frag_color = color; } -- cgit v1.2.3